Re: [PATCH -perfbook] whymb: Fix description of compiler mischief

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 3 Dec 2020 08:51:43 -0800, Paul E. McKenney wrote:
> On Wed, Dec 02, 2020 at 11:50:27PM +0900, Akira Yokosawa wrote:
>> >From 89ab8426f9821b6a8bf86e9d4f7eb596e0cfed73 Mon Sep 17 00:00:00 2001
>> From: Akira Yokosawa <akiyks@xxxxxxxxx>
>> Date: Wed, 2 Dec 2020 07:35:08 +0900
>> Subject: [PATCH -perfbook] whymb: Fix description of compiler mischief
>>
>> In this code snippet, the assertion can not fire due to different
>> reasons.
>> When bar() observes b == 1, the smp_mb() assures a == 1.
>> When bar() observes b == 0, the while loop will loop forever and
>> the assertion can't be reached.
>>
>> This was pointed out by Motohiro Kanda in his Japanese translation
>> of perfbook [1].
>>
>> [1]: https://sites.google.com/site/kandamotohiro/perfbook-d/perfbookappendixf10
>>
>> Cc: Motohiro Kanda <kanda.motohiro@xxxxxxxxx>
>> Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
> 
> I took this patch as is, but added a patch on top that (hopefully)
> does a better job of explaining the situation.  Thank you both!!!

Ah, this was your original intention of this Quick Quiz.

Yes, this explains the situation much better.

I did thought about dropping the smp_mb() in the snippet at first,
but that would require me to do a larger rewrite of the answer.
Instead, I submitted the minimal patch to attract your attention. ;-)

> 
> Would it also help to add a reference to the discussion of control
> dependencies? 

Yes, I think so.
Section 15.3.3 or Section 15.3 as a whole would be a good reference.

        Thanks, Akira


>                The straightforward answer given that information is
> "control dependencies do not order later loads".
> 
> Motohiro, would you be OK with my mentioning your translation in the
> next set of release notes for perfbook?  Either way, I much appreciate
> your doing this work!
> 
> 							Thanx, Paul
> 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux