From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH RFC] xfs: support debug mode with assert warnings
Date: Tue, 2 May 2017 08:14:25 -0400 [thread overview]
Message-ID: <20170502121423.GB6975@bfoster.bfoster> (raw)
In-Reply-To: <20170502073730.GA19021@infradead.org>
On Tue, May 02, 2017 at 12:37:30AM -0700, Christoph Hellwig wrote:
> On Fri, Apr 28, 2017 at 01:29:01PM -0400, Brian Foster wrote:
> > Signed-off-by: Brian Foster <bfoster@redhat.com>
> > ---
> >
> > Hi all,
> >
> > Every now and then I find myself wanting to enable DEBUG mode code
> > without having to BUG the kernel every time an assert fails. Currently,
> > I end up just commenting out the BUG() call from assfail(). Any thoughts
> > on something like the below to update our configuration to support the
> > ability to enable debug mode with assert warnings?
> >
> > While this appears as a new option in Kconfig, it just reuses the
> > existing XFS_WARN definition to convert asserts into warnings regardless
> > of whether debug mode is enabled or not. There are probably multiple
> > other ways to do something like this (e.g., a Kconfig 'choice' selection
> > for various XFS debug modes, dropping the BUG() entirely, etc.).
> > Thoughts?
> >
> > Brian
> >
> > fs/xfs/Kconfig | 9 +++++++++
> > fs/xfs/xfs_linux.h | 32 +++++++++++++++++++-------------
> > 2 files changed, 28 insertions(+), 13 deletions(-)
> >
> > diff --git a/fs/xfs/Kconfig b/fs/xfs/Kconfig
> > index 35faf12..db6d830 100644
> > --- a/fs/xfs/Kconfig
> > +++ b/fs/xfs/Kconfig
> > @@ -96,3 +96,12 @@ config XFS_DEBUG
> > not useful unless you are debugging a particular problem.
> >
> > Say N unless you are an XFS developer, or you play one on TV.
> > +
> > +config XFS_WARN
> > + bool "Non-fatal Asserts"
> > + default n
> > + depends on XFS_FS && XFS_DEBUG
> > + help
> > + Say Y here to convert DEBUG mode ASSERT failures into warnings.
> > + Otherwise, ASSERT failures are considered fatal errors and BUG the
> > + kernel.
>
> I'm very confused by this patch. At least my fs/xfs/Kconfig already
> has a "config XFS_WARN" line. What am I missing?
As noted above, this is just a reuse of the flag. XFS_WARN and XFS_DEBUG
are currently mutually exclusive. The former enables warnings on assert
failures. The latter enables BUG()'s on assert failures and the
additional, typical debug mode code. The Kconfig hack above simply pops
up a conditional option when debug mode is enabled that effectively
allows setting both XFS_WARN and XFS_DEBUG at the same time. The header
files interpret this as debug mode enabled with an override for the
assert failures to warn rather than BUG().
Note that this is just a hack and we can organize the Kconfig options
however we want. For example, we could call this XFS_DEBUG_WARN and
continue to consider it a debug mode sub-flag, or we could turn the
debug mode option into a multi-mode selector (i.e., Debug modes: "None,"
"Warn only," "Debug mode," "Debug mode w/ non-fatal asserts"). I played
around a bit with the latter but it seems like a bit of overkill to me.
Brian
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-05-02 12:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 17:29 [PATCH RFC] xfs: support debug mode with assert warnings Brian Foster
2017-05-02 7:37 ` Christoph Hellwig
2017-05-02 12:14 ` Brian Foster [this message]
2017-05-04 11:57 ` Christoph Hellwig
2017-05-04 12:44 ` Brian Foster
2017-05-04 16:41 ` Darrick J. Wong
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=20170502121423.GB6975@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
/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).