LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Satyam Sharma <satyam.sharma@gmail.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
	Jan Glauber <jan.glauber@de.ibm.com>,
	David Miller <davem@davemloft.net>,
	akpm@osdl.org, mingo@elte.hu, ak@suse.de, schwidefsky@de.ibm.com,
	linux-kernel@vger.kernel.org, Alan Cox <alan@redhat.com>
Subject: Re: [patch] i386/x86_64: smp_call_function locking inconsistency
Date: Sun, 10 Jun 2007 10:38:47 +0300	[thread overview]
Message-ID: <466BAA87.8000400@qumranet.com> (raw)
In-Reply-To: <a781481a0706071033y4bd86301v51bb0ebeb0e6f8b9@mail.gmail.com>

Satyam Sharma wrote:
> On 6/7/07, Avi Kivity <avi@qumranet.com> wrote:
>> Satyam Sharma wrote:
>> >
>> > Oh wait, the on_one_cpu() patch proposes on UP:
>> >
>> > +static inline int on_one_cpu(int cpu, void (*func)(void *info), void
>> > *info,
>> > +                 int retry, int wait)
>> > +{
>> >
>> > /* this needs a if (cpu == 0) check here, IMO */
>> >
>> > +    local_irq_disable();
>> > +    func(info);
>> > +    local_irq_enable();
>> > +    return 0;
>> >
>> > /* else WARN and return -EINVAL; */
>> >
>> > +}
>> >
>> > which is broken without the suggested additions, IMHO
>> > (this is what got me into this in the first place). There
>> > _is_ a difference between on_each_cpu() and the
>> > smp_call_function* semantics (as discussed on the other
>> > thread -- gargh! my mistake for opening this discussion up
>> > on so many threads), and in its current form on_one_cpu()
>> > has quite confused semantics, trying to mix the two. I guess
>> > on_one_cpu() would be better off simply being just an
>> > atomic wrapper over smp_processor_id() and
>> > smp_call_function_single() (which is the *real* issue that
>> > needs solving in the first place), and do it well.
>> >
>>
>> This is on UP, so (cpu == 0) is trivially true.
>
> Yes, the caller code might derive the value for the cpu arg in
> such a manner to always only ever yield 0 on UP. OTOH,
> WARN_ON(!...)'s are often added for such assumptions that are
> understood to be trivially true. Note that a warning for cpu != 0
> would be perfectly justified, we'd clearly want to flag such
> (errant) users.

We don't catch incorrect cpu values in smp (because we can't); there's 
no reason to do so in UP IMO.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2007-06-10  7:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-08 20:32 Heiko Carstens
2007-02-08 20:43 ` David Miller
2007-02-09  8:42   ` Heiko Carstens
2007-02-09 12:57     ` Jan Glauber
2007-06-07 14:07       ` Satyam Sharma
2007-06-07 16:27         ` Heiko Carstens
2007-06-07 16:54           ` Satyam Sharma
2007-06-07 17:18             ` Satyam Sharma
2007-06-07 17:22               ` Avi Kivity
2007-06-07 17:33                 ` Satyam Sharma
2007-06-10  7:38                   ` Avi Kivity [this message]
2007-06-08 19:43             ` Andi Kleen
2007-06-08 19:42         ` Andi Kleen
2007-02-09  7:40 ` Andi Kleen

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=466BAA87.8000400@qumranet.com \
    --to=avi@qumranet.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=alan@redhat.com \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jan.glauber@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=satyam.sharma@gmail.com \
    --cc=schwidefsky@de.ibm.com \
    --subject='Re: [patch] i386/x86_64: smp_call_function locking inconsistency' \
    /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

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).