From: DDD <dongdong.deng@windriver.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: dzickus@redhat.com, peterz@infradead.org, tglx@linutronix.de,
mingo@redhat.com, hpa@zytor.com, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: avoid calling arch_trigger_all_cpu_backtrace() at the same time on SMP
Date: Thu, 11 Nov 2010 17:51:33 +0800 [thread overview]
Message-ID: <4CDBBCA5.50306@windriver.com> (raw)
In-Reply-To: <20101111092301.GD18789@elte.hu>
Ingo Molnar wrote:
> * Dongdong Deng <dongdong.deng@windriver.com> wrote:
>
>> +static int backtrace_flag;
>
>> + if (cmpxchg(&backtrace_flag, 0, 1) != 0)
>
> Sorry to be a PITA, but i asked for test_and_set() because that's the simplest
> primitive. cmpxchg() semantics is not nearly as obvious and people regularly get it
> wrong :-/
As the 'backtrace_flag' could be accessed by multi-cpus on SMP at the
same time, I use cmpxchg() for getting a atomic/memory barrier operation
for 'backtrace_flag' variable.
If we use test_and_set, maybe we need smp_wmb() after test_and_set. (If
I wrong, please correct me, thanks. :-) )
Should we still need to use test_and_set?
If need, I will use test_and_set at my next patch.
>
> Also, variables that cmpxchg or test_and_set operates on need to be long, not int.
Got it, I will change it to 'unsigned long' type.
Thanks for your teaching.
Dongdong
>
> Ingo
>
next prev parent reply other threads:[~2010-11-11 9:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-11 2:20 [PATCH] x86: avoid calling arch_trigger_all_cpu_backtrace() at the same time on SMP Dongdong Deng
2010-11-11 9:23 ` Ingo Molnar
2010-11-11 9:51 ` DDD [this message]
2010-11-11 10:01 ` Ingo Molnar
2010-11-11 11:00 ` DDD
2010-11-11 9:51 ` Eric Dumazet
2010-11-11 9:57 ` Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2010-11-02 18:16 Don Zickus
2010-11-10 7:43 ` Ingo Molnar
2010-11-10 8:35 ` DDD
2010-11-10 8:39 ` Ingo Molnar
2010-10-11 10:31 Dongdong Deng
2010-10-18 11:00 ` DDD
2010-10-18 18:03 ` Don Zickus
2010-10-21 5:17 ` DDD
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=4CDBBCA5.50306@windriver.com \
--to=dongdong.deng@windriver.com \
--cc=dzickus@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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