LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: James Simmons <jsimmons@infradead.org>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: Re: [PATCH 1/6] staging: lustre: move stack-check macros to libcfs_debug.h
Date: Wed, 18 Apr 2018 12:17:37 +1000	[thread overview]
Message-ID: <87a7u1s1fi.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <alpine.LFD.2.21.1804160438220.16188@casper.infradead.org>

[-- Attachment #1: Type: text/plain, Size: 5235 bytes --]

On Mon, Apr 16 2018, James Simmons wrote:

>> CDEBUG_STACK() and CHECK_STACK() are macros to help with
>> debugging, so move them from
>>    drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
>> to
>>    drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
>> 
>> This seems a more fitting location, and is a step towards
>> removing linux/libcfs.h and simplifying the include file structure.
>
> Nak. Currently the lustre client always enables debugging but that
> shouldn't be the case. What we do need is the able to turn off the 
> crazy debugging stuff. In the development branch of lustre it is
> done with CDEBUG_ENABLED. We need something like that in Kconfig
> much like we have CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK. Since we like
> to be able to turn that off this should be moved to just after
> LIBCFS_DEBUG_MSG_DATA_DECL. Then from CHECK_STACK down to CWARN()
> it can be build out. When CDEBUG_ENABLED is disabled CDEBUG_LIMIT
> would be empty.

So why, exactly, is this an argument to justify a NAK?
Are you just saying  that the code I moved into libcfs_debug.h should be
moved to somewhere a bit later in the file?
That can easily be done when it is needed.  It isn't needed now so why
insist on it?

Each patch should do one thing and make clear forward progress.  This
patch gets rid of an unnecessary file and brings related code together.
I think that qualifies.

Thanks,
NeilBrown


>  
>> Signed-off-by: NeilBrown <neilb@suse.com>
>> ---
>>  .../lustre/include/linux/libcfs/libcfs_debug.h     |   32 ++++++++++++++++++++
>>  .../lustre/include/linux/libcfs/linux/libcfs.h     |   31 -------------------
>>  2 files changed, 32 insertions(+), 31 deletions(-)
>> 
>> diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
>> index 9290a19429e7..0dc7b91efe7c 100644
>> --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
>> +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
>> @@ -62,6 +62,38 @@ int libcfs_debug_str2mask(int *mask, const char *str, int is_subsys);
>>  extern unsigned int libcfs_catastrophe;
>>  extern unsigned int libcfs_panic_on_lbug;
>>  
>> +/* Enable debug-checks on stack size - except on x86_64 */
>> +#if !defined(__x86_64__)
>> +# ifdef __ia64__
>> +#  define CDEBUG_STACK() (THREAD_SIZE -				 \
>> +			  ((unsigned long)__builtin_dwarf_cfa() &       \
>> +			   (THREAD_SIZE - 1)))
>> +# else
>> +#  define CDEBUG_STACK() (THREAD_SIZE -				 \
>> +			  ((unsigned long)__builtin_frame_address(0) &  \
>> +			   (THREAD_SIZE - 1)))
>> +# endif /* __ia64__ */
>> +
>> +#define __CHECK_STACK(msgdata, mask, cdls)			      \
>> +do {								    \
>> +	if (unlikely(CDEBUG_STACK() > libcfs_stack)) {		  \
>> +		LIBCFS_DEBUG_MSG_DATA_INIT(msgdata, D_WARNING, NULL);   \
>> +		libcfs_stack = CDEBUG_STACK();			  \
>> +		libcfs_debug_msg(msgdata,			       \
>> +				 "maximum lustre stack %lu\n",	  \
>> +				 CDEBUG_STACK());		       \
>> +		(msgdata)->msg_mask = mask;			     \
>> +		(msgdata)->msg_cdls = cdls;			     \
>> +		dump_stack();					   \
>> +	      /*panic("LBUG");*/					\
>> +	}							       \
>> +} while (0)
>> +#define CFS_CHECK_STACK(msgdata, mask, cdls)  __CHECK_STACK(msgdata, mask, cdls)
>> +#else /* __x86_64__ */
>> +#define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while (0)
>> +#define CDEBUG_STACK() (0L)
>> +#endif /* __x86_64__ */
>> +
>>  #ifndef DEBUG_SUBSYSTEM
>>  # define DEBUG_SUBSYSTEM S_UNDEFINED
>>  #endif
>> diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
>> index 07d3cb2217d1..83aec9c7698f 100644
>> --- a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
>> +++ b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
>> @@ -80,35 +80,4 @@
>>  #include <stdarg.h>
>>  #include "linux-cpu.h"
>>  
>> -#if !defined(__x86_64__)
>> -# ifdef __ia64__
>> -#  define CDEBUG_STACK() (THREAD_SIZE -				 \
>> -			  ((unsigned long)__builtin_dwarf_cfa() &       \
>> -			   (THREAD_SIZE - 1)))
>> -# else
>> -#  define CDEBUG_STACK() (THREAD_SIZE -				 \
>> -			  ((unsigned long)__builtin_frame_address(0) &  \
>> -			   (THREAD_SIZE - 1)))
>> -# endif /* __ia64__ */
>> -
>> -#define __CHECK_STACK(msgdata, mask, cdls)			      \
>> -do {								    \
>> -	if (unlikely(CDEBUG_STACK() > libcfs_stack)) {		  \
>> -		LIBCFS_DEBUG_MSG_DATA_INIT(msgdata, D_WARNING, NULL);   \
>> -		libcfs_stack = CDEBUG_STACK();			  \
>> -		libcfs_debug_msg(msgdata,			       \
>> -				 "maximum lustre stack %lu\n",	  \
>> -				 CDEBUG_STACK());		       \
>> -		(msgdata)->msg_mask = mask;			     \
>> -		(msgdata)->msg_cdls = cdls;			     \
>> -		dump_stack();					   \
>> -	      /*panic("LBUG");*/					\
>> -	}							       \
>> -} while (0)
>> -#define CFS_CHECK_STACK(msgdata, mask, cdls)  __CHECK_STACK(msgdata, mask, cdls)
>> -#else /* __x86_64__ */
>> -#define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while (0)
>> -#define CDEBUG_STACK() (0L)
>> -#endif /* __x86_64__ */
>> -
>>  #endif /* _LINUX_LIBCFS_H */
>> 
>> 
>> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  parent reply	other threads:[~2018-04-18  2:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16  0:42 [PATCH 0/6] staging: lustre: code rearrangement NeilBrown
2018-04-16  0:42 ` [PATCH 3/6] staging: lustre: remove include/linux/libcfs/linux/linux-cpu.h NeilBrown
2018-04-16  3:52   ` James Simmons
2018-04-18  2:33     ` NeilBrown
2018-04-23 13:13     ` Greg Kroah-Hartman
2018-04-16  0:42 ` [PATCH 4/6] staging: lustre: rearrange placement of CPU partition management code NeilBrown
2018-04-16  3:53   ` James Simmons
2018-04-16  0:42 ` [PATCH 1/6] staging: lustre: move stack-check macros to libcfs_debug.h NeilBrown
2018-04-16  3:48   ` James Simmons
2018-04-16 15:27     ` [lustre-devel] " Patrick Farrell
2018-04-16 22:42       ` James Simmons
2018-04-16 22:48         ` Doug Oucharek
2018-04-17  5:26           ` Dilger, Andreas
2018-04-17 15:41             ` Doug Oucharek
2018-04-18  2:29         ` NeilBrown
2018-04-18  4:23           ` Patrick Farrell
2018-04-18  2:17     ` NeilBrown [this message]
2018-04-23 13:03       ` Greg Kroah-Hartman
2018-04-16  0:42 ` [PATCH 6/6] staging: lustre: move remaining code from linux-module.c to module.c NeilBrown
2018-04-16  0:42 ` [PATCH 5/6] staging: lustre: move misc-device registration closer to related code NeilBrown
2018-04-23 13:12   ` Greg Kroah-Hartman
2018-04-16  0:42 ` [PATCH 2/6] staging: lustre: remove libcfs/linux/libcfs.h NeilBrown
2018-04-16  3:35   ` James Simmons
2018-04-18  2:32     ` NeilBrown
2018-04-23 13:03       ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7u1s1fi.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=andreas.dilger@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).