From: David Daney <ddaney@caviumnetworks.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Daney <ddaney.cavm@gmail.com>,
Ralf Baechle <ralf@linux-mips.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mips <linux-mips@linux-mips.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
David Daney <david.daney@cavium.com>
Subject: Re: [PATCH] smp.h: Use local_irq_{save,restore}() in !SMP version of on_each_cpu().
Date: Fri, 14 Jun 2013 09:35:50 -0700 [thread overview]
Message-ID: <51BB4666.9050007@caviumnetworks.com> (raw)
In-Reply-To: <CA+55aFziBGnSgLimDe7WBRPQ+f3RVAsrdbo212oj85c-XSz4oA@mail.gmail.com>
On 06/13/2013 10:46 PM, Linus Torvalds wrote:
> On Thu, Jun 13, 2013 at 6:07 PM, David Daney <ddaney.cavm@gmail.com> wrote:
>>
>> Suggested fix: Do what we already do in the SMP version of
>> on_each_cpu(), and use local_irq_save/local_irq_restore.
>
> I was going to apply this, but started looking a bit more.
>
> Using "flags" as a variable name inside a macro like this is a
> *really* bad idea.
>
> Lookie here:
>
> [torvalds@pixel linux]$ git grep on_each_cpu.*flags
> arch/s390/kernel/perf_cpum_cf.c: on_each_cpu(setup_pmc_cpu,
> &flags, 1);
> arch/s390/kernel/perf_cpum_cf.c: on_each_cpu(setup_pmc_cpu,
> &flags, 1);
>
> and ask yourself what happens when the "info" argument expands to
> "&flags", and it all compiles perfectly fine, but the "&flags" takes
> the address of the new _inner_ variable called "flags" from the macro
> expansion. Not the one that the caller actually intends..
>
> Oops.
>
> Not a good idea.
>
Yeah, I think making it a static inline function may be the best approach.
I am going to test doing that and send a new patch very soon.
David Daney
> So I would suggest trivially renaming "flags" as "__flags" or
> something, or perhaps even just making it a real function and avoiding
> the whole namespace issue.
>
> And rather than doing that blindly by editing the patch at after -rc5,
> I'm just going to ask you to re-send a tested patch. Ok?
>
> Linus
>
prev parent reply other threads:[~2013-06-14 16:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-14 1:07 [PATCH] smp.h: Use local_irq_{save,restore}() in !SMP version of on_each_cpu() David Daney
2013-06-14 5:46 ` Linus Torvalds
2013-06-14 16:35 ` David Daney [this message]
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=51BB4666.9050007@caviumnetworks.com \
--to=ddaney@caviumnetworks.com \
--cc=akpm@linux-foundation.org \
--cc=david.daney@cavium.com \
--cc=ddaney.cavm@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=torvalds@linux-foundation.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