Received: by 10.192.165.156 with SMTP id m28csp195962imm; Sun, 15 Apr 2018 20:52:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Vof1rzDh1igLRErtuFYZ6L69gSs+P2ksqEk/RyrjwmY8ViFvVDNvJpSr7S/NQz2XpK6s+ X-Received: by 10.98.206.143 with SMTP id y137mr6134780pfg.219.1523850725440; Sun, 15 Apr 2018 20:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523850725; cv=none; d=google.com; s=arc-20160816; b=zjXQo8cjxWXBRXwzYfOz9hVrdX3C7jTbIycL//wcvdlN6RSKtlrlNuxnxEhcDfn5rc fx6Xa4fNK7Hhl30T0VlPFzWgZPaNi65bgkNIFYv8DmgUp4LFJVVzWaC7TT2pkkcYxw3o yI7anSEDYRfdxAmK6ijo8bOGQPszelb1wIn6ArETF4316TBkzvYIC55eewkACyN4cJ3c sY0naHhelUVS58WLfAGaWUMhd6yVbrX3JL2r15h5vj0Hn4L7G5piLy3LEOmRl44j1GDl d3DmD81jBmQO5KPCkUyKus3KFB/jOlIvIaIrDq4FAiRYQgAUi1zY0Bs0ZWVNTnMmgEDr bGnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=qq2WcdwjNo6D/1nnEJfnBykosET5ZmIxpPIXqUGLEAw=; b=goEPuOjM3zbBrOnLSwQrf/MEBsyFiVHF83g7OePsRwPrqHZOAAoe5xwVrHXmG784A9 2gHMO7ojvPiuq5m+iJiOJd5rff9gVQVcfWU3Rtp8OHwpP0jvuVSkcSTn3jwZ2zp/j43o +W2TSqzs0JKMugg1UUGSw+zqftoB1s7EhbKHRKZEBDa4f2cLZZ1zHENA9Rlz11BT4tFk oXmYHh0ZXGJRS7rlQjob6xAstgotSFg3z+tfpECCGz9ZUbu1jHfsOQegf6kG+1NF4OqU O1ehQ91AYpmdHaCqxMxzVBA+tMPk9TphzGRsr0AyDx3g0HqiW+g0224Q0e6qKm5bxwmT Hh4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=SEwjvGEx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1si3080534pgb.281.2018.04.15.20.51.48; Sun, 15 Apr 2018 20:52:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=SEwjvGEx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751942AbeDPDse (ORCPT + 99 others); Sun, 15 Apr 2018 23:48:34 -0400 Received: from casper.infradead.org ([85.118.1.10]:49540 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751884AbeDPDsd (ORCPT ); Sun, 15 Apr 2018 23:48:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Message-ID:In-Reply-To:Subject:cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qq2WcdwjNo6D/1nnEJfnBykosET5ZmIxpPIXqUGLEAw=; b=SEwjvGExH1UtSMnFdRoSgnMej Oob025fVn2cYqL6AjRRYHod8HbgIDYjOhWI36G4eGzLzS2c7fizkmHphEvLz/LwnxsiDZBc7AYSau cja3NyHtFuTu1UTBB2BMAhOVHU6barRlAOCRKcfZHzpMYb0dG4JSRGgDtON539vXYGrVgeUm9qgi8 FyHy2mc6ocIOX+ndLkyyF6x18OqOnsJwkZoMuRS7sXg6cTDUfA9EctqziEKIvMIDySlBdnd4QNdlL 1dfTMdrbTfLSB8JtkZSHtUshz02aeUEEpXynGm5DyhOfGhmllZTrLt7fB6g9lNuMsIi1WZ7B2B2mG dFzAeeakg==; Received: from jsimmons (helo=localhost) by casper.infradead.org with local-esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f7v7z-00052K-2c; Mon, 16 Apr 2018 03:48:28 +0000 Date: Mon, 16 Apr 2018 04:48:26 +0100 (BST) From: James Simmons To: NeilBrown cc: Oleg Drokin , Greg Kroah-Hartman , Andreas Dilger , Linux Kernel Mailing List , Lustre Development List Subject: Re: [PATCH 1/6] staging: lustre: move stack-check macros to libcfs_debug.h In-Reply-To: <152383935730.23409.6748888065027051683.stgit@noble> Message-ID: References: <152383910760.23409.2327082725637657049.stgit@noble> <152383935730.23409.6748888065027051683.stgit@noble> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180416_044827_113296_FED3457A X-CRM114-Status: GOOD ( 17.69 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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. > Signed-off-by: NeilBrown > --- > .../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 > #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 */ > > >