mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@redhat.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Ingo Molnar <mingo@elte.hu>, lkml <linux-kernel@vger.kernel.org>,
	systemtap <systemtap@sources.redhat.com>,
	DLE <dle-develop@lists.sourceforge.net>,
	Jason Baron <jbaron@redhat.com>
Subject: Re: [PATCH -tip 2/2] x86: Issue at least one memory barrier in	stop_machine_text_poke().
Date: Wed, 03 Mar 2010 16:39:14 -0500	[thread overview]
Message-ID: <4B8ED702.8070403@redhat.com> (raw)
In-Reply-To: <20100303213614.GA29880@Krystal>

Mathieu Desnoyers wrote:
> * Masami Hiramatsu (mhiramat@redhat.com) wrote:
>> Fix stop_machine_text_poke() to issue smp_mb() before exiting waiting
>> loop. Also, use ACCESS_ONCE() to check a flag according to Mathieu's
>> comment.
>>
>> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
>> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> Cc: Ingo Molnar <mingo@elte.hu>
>> Cc: Jason Baron <jbaron@redhat.com>
>> ---
>>
>>  arch/x86/kernel/alternative.c |    6 +++---
>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
>> index 635e4f4..3236a11 100644
>> --- a/arch/x86/kernel/alternative.c
>> +++ b/arch/x86/kernel/alternative.c
>> @@ -596,9 +596,9 @@ static int __kprobes stop_machine_text_poke(void *data)
>>  		smp_wmb();	/* Make sure other cpus see that this has run */
>>  		wrote_text = 1;
>>  	} else {
>> -		while (!wrote_text)
>> -			smp_rmb();
>> -		sync_core();
>> +		while (!ACCESS_ONCE(wrote_text))
> 
> Well, cpu_relax() has a "memory" clobber, so the access once is not required to
> ensure the variable is re-read. And, sorry to contradict my previous statement
> somewhat, but given that we don't care if the compiler fetches wrote_text in
> chunks or not, ACCESS_ONCE() is not required here. So rather than leaving people
> wondering why we put an ACCESS_ONCE() here, it's probably better to leave it
> out.

Ah, OK. Indeed, volatile is for compiler...

Thank you,

-- 
Masami Hiramatsu
e-mail: mhiramat@redhat.com

  reply	other threads:[~2010-03-03 21:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-03 21:26 [PATCH -tip 1/2] perf probe: Correct probe syntax on command line help Masami Hiramatsu
2010-03-03 21:27 ` [PATCH -tip 2/2] x86: Issue at least one memory barrier in stop_machine_text_poke() Masami Hiramatsu
2010-03-03 21:36   ` Mathieu Desnoyers
2010-03-03 21:39     ` Masami Hiramatsu [this message]
2010-03-03 21:48     ` [PATCH -tip] " Masami Hiramatsu
2010-03-03 21:48       ` Mathieu Desnoyers

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=4B8ED702.8070403@redhat.com \
    --to=mhiramat@redhat.com \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@elte.hu \
    --cc=systemtap@sources.redhat.com \
    /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

all inboxes | Powered by JetHome®