From: Pavel Machek <pavel@ucw.cz>
To: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
Cc: "Zhang, Yanmin" <yanmin.zhang@intel.com>,
linux-kernel@vger.kernel.org, "Shah,
Rajesh" <rajesh.shah@intel.com>
Subject: Re: [BUG] Variable stopmachine_state should be volatile
Date: Fri, 2 Dec 2005 04:53:36 +0100 [thread overview]
Message-ID: <20051202035336.GC1770@elf.ucw.cz> (raw)
In-Reply-To: <88056F38E9E48644A0F562A38C64FB60067BE61C@scsmsx403.amr.corp.intel.com>
Hi!
> >Thanks. The functions are not performance sensitive, so
> >atomic_t is ok. Here is the new patch.
> >
>
> The only reason atomic_t will help in this case is because it uses volatile for internal counter, as it does nothing additional on atomic_read(). I don't get what is the issue with using volatile directly. May be I am missing something. Pavel can you elaborate please.
>
Look at atomic_t again. It is definitely not "just volatile",
definitely not on non-i386 architectures.
> The code here is doing something like this
>
> While (variable != specific_value)
> cpu_relax();
So either do
while (variable != value)
mb();
or better use atomic_t.
> So, making variable atomic or declaring variable as volatile should have the same impact here. Note there is only one CPU setting this variable and rest of the CPUs just read it.
>
> If volatile is not good, probably we need to find something other than atomic as well.
>
atomic_t works, is used across the kernel, and works on all
architectures. volatile int does not. Do not use it.
Pavel
--
Thanks, Sharp!
next parent reply other threads:[~2005-12-02 3:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <88056F38E9E48644A0F562A38C64FB60067BE61C@scsmsx403.amr.corp.intel.com>
2005-12-02 3:53 ` Pavel Machek [this message]
2005-12-12 7:06 [BUG] Variable stopmachine_state should be volatile Zhang, Yanmin
-- strict thread matches above, loose matches on Subject: below --
2005-12-08 18:53 Luck, Tony
2005-12-08 1:37 Zhang, Yanmin
2005-12-12 13:39 ` Christoph Hellwig
2005-12-02 2:48 Zhang, Yanmin
2005-12-01 5:27 Zhang, Yanmin
2005-12-01 10:26 ` Pavel Machek
2005-12-01 2:58 Zhang, Yanmin
2005-12-01 3:25 ` Pavel Machek
2005-11-30 2:04 Zhang, Yanmin
2005-11-30 22:19 ` Pavel Machek
2005-12-02 8:04 ` Arjan van de Ven
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=20051202035336.GC1770@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=rajesh.shah@intel.com \
--cc=venkatesh.pallipadi@intel.com \
--cc=yanmin.zhang@intel.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