lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 11 Nov 2010 17:51:33 +0800
From:	DDD <dongdong.deng@...driver.com>
To:	Ingo Molnar <mingo@...e.hu>
CC:	dzickus@...hat.com, peterz@...radead.org, tglx@...utronix.de,
	mingo@...hat.com, hpa@...or.com, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: avoid calling arch_trigger_all_cpu_backtrace() at
 the same time on SMP

Ingo Molnar wrote:
> * Dongdong Deng <dongdong.deng@...driver.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
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ