From: Mike Snitzer <snitzer@redhat.com>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
linux-kernel@vger.kernel.org,
Mikulas Patocka <mpatocka@redhat.com>,
Alasdair Kergon <agk@redhat.com>,
dm-devel@redhat.com, Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
linux-s390@vger.kernel.org
Subject: Re: md: dm-writeback: add __noreturn to BUG-ging function
Date: Wed, 18 Nov 2020 10:49:44 -0500 [thread overview]
Message-ID: <20201118154944.GB545@redhat.com> (raw)
In-Reply-To: <20201117163147.GA27243@redhat.com>
On Tue, Nov 17 2020 at 11:31am -0500,
Mike Snitzer <snitzer@redhat.com> wrote:
> On Mon, Nov 16 2020 at 6:00pm -0500,
> Randy Dunlap <rdunlap@infradead.org> wrote:
>
> > On 11/15/20 11:30 PM, Christian Borntraeger wrote:
> > >
> > >
> > > On 13.11.20 23:52, Randy Dunlap wrote:
> > >> Building on arch/s390/ flags this as an error, so add the
> > >> __noreturn attribute modifier to prevent the build error.
> > >>
> > >> cc1: some warnings being treated as errors
> > >> ../drivers/md/dm-writecache.c: In function 'persistent_memory_claim':
> > >> ../drivers/md/dm-writecache.c:323:1: error: no return statement in function returning non-void [-Werror=return-type]
> > >
> > > ok with me, but I am asking why
> > >
> > > the unreachable macro is not good enough. For x86 it obviously is.
> > >
> > > form arch/s390/include/asm/bug.h
> > > #define BUG() do { \
> > > __EMIT_BUG(0); \
> > > unreachable(); \
> > > } while (0)
> > >
> >
> > Hi Christian,
> >
> > Good question.
> > I don't see any guidance about when to use one or the other etc.
> >
> > I see __noreturn being used 109 times and unreachable();
> > being used 33 times, but only now that I look at them.
> > That had nothing to do with why I used __noreturn in the patch.
>
> But doesn't that speak to the proper fix being needed in unreachable()?
> Or at a minimum the fix is needed to arch/s390/include/asm/bug.h's BUG.
>
> I really don't think we should be papering over that by sprinkling
> __noreturn around the kernel's BUG() callers.
>
> Maybe switch arch/s390/include/asm/bug.h's BUG to be like
> arch/mips/include/asm/bug.h? It itself uses __noreturn with a 'static
> inline' function definition rather than #define.
>
> Does that fix the issue?
>
> Thanks,
> Mike
>
> p.s. you modified dm-writecache.c (not dm-writeback, wich doesn't
> exist).
I don't think my suggestion will help.. given it'd still leave
persistent_memory_claim() without a return statement.
Think it worthwhile to just add a dummy 'return 0;' after the BUG().
Mike
next prev parent reply other threads:[~2020-11-18 15:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 22:52 [PATCH] md: dm-writeback: add __noreturn to BUG-ging function Randy Dunlap
2020-11-16 7:30 ` Christian Borntraeger
2020-11-16 23:00 ` Randy Dunlap
2020-11-17 16:31 ` Mike Snitzer
2020-11-18 15:49 ` Mike Snitzer [this message]
2020-11-18 16:07 ` Mike Snitzer
2020-11-18 16:35 ` Christian Borntraeger
2020-11-18 16:38 ` Randy Dunlap
2020-11-18 21:24 ` Mikulas Patocka
2020-11-20 14:08 ` Mike Snitzer
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=20201118154944.GB545@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=dm-devel@redhat.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=rdunlap@infradead.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