RE: [PATCH v8 6/7] apei/ghes: Use unrcu_pointer for cmpxchg

From: Justin He
Date: Wed Oct 12 2022 - 08:07:19 EST


Hi Borislav

> -----Original Message-----
> From: Borislav Petkov <bp@xxxxxxxxx>
> Sent: Tuesday, October 11, 2022 10:46 PM
> To: Justin He <Justin.He@xxxxxxx>
> Cc: Len Brown <lenb@xxxxxxxxxx>; James Morse <James.Morse@xxxxxxx>;
> Tony Luck <tony.luck@xxxxxxxxx>; Mauro Carvalho Chehab
> <mchehab@xxxxxxxxxx>; Robert Richter <rric@xxxxxxxxxx>; Robert Moore
> <robert.moore@xxxxxxxxx>; Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx>; Yazen
> Ghannam <yazen.ghannam@xxxxxxx>; Jan Luebbe <jlu@xxxxxxxxxxxxxx>;
> Khuong Dinh <khuong@xxxxxxxxxxxxxxxxxxxxxx>; Kani Toshi
> <toshi.kani@xxxxxxx>; Ard Biesheuvel <ardb@xxxxxxxxxx>;
> linux-acpi@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> linux-edac@xxxxxxxxxxxxxxx; devel@xxxxxxxxxx; Rafael J . Wysocki
> <rafael@xxxxxxxxxx>; Shuai Xue <xueshuai@xxxxxxxxxxxxxxxxx>; Jarkko
> Sakkinen <jarkko@xxxxxxxxxx>; linux-efi@xxxxxxxxxxxxxxx; nd <nd@xxxxxxx>;
> kernel test robot <lkp@xxxxxxxxx>
> Subject: Re: [PATCH v8 6/7] apei/ghes: Use unrcu_pointer for cmpxchg
>
> On Tue, Oct 11, 2022 at 02:32:48PM +0000, Justin He wrote:
> > My original purpose is to make it pass the sparse checking.
>
> Then do this pls.
>
> This is a combined diff - do a second patch which does only remove the
> smp_wmb(). The smp_wmb() there is not needed as the cmpxchg() already
> implies a smp_mb() so there's no need for that separate, explicit one.
>
I have a concern about what if cmpxchg failed? Do we have to still guarantee the ordering since cmpxchg will not imply a smp_mb if it failed.

Besides, I didn't find the paired smp_mb or smp_rmb
for this smp_wmb. Do you have any ideas?

--
Cheers,
Justin (Jia He)