All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -perfbook] whymb: Fix description of compiler mischief
@ 2020-12-02 14:50 Akira Yokosawa
  2020-12-03 11:04 ` Motohiro Kanda
  2020-12-03 16:51 ` Paul E. McKenney
  0 siblings, 2 replies; 10+ messages in thread
From: Akira Yokosawa @ 2020-12-02 14:50 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: Motohiro Kanda, perfbook, Akira Yokosawa

From 89ab8426f9821b6a8bf86e9d4f7eb596e0cfed73 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
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@gmail.com>
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
Hi Paul,

(Cc: Motohiro)

Looks like this inconsistency in the Answer to Quick Quiz has
been Motohiro's translation note for quite a while.
(since 2017?)

He contributed to perfbook in the past.  There is a couple of
commits with his Reported-by.

Motohiro, do you mind if I submit patches to Paul on behalf of
you like this?

And I think Paul is likely to do some wordsmithing on top of
this patch. ;-)

        Thanks, Akira
--
 appendix/whymb/whymemorybarriers.tex | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/appendix/whymb/whymemorybarriers.tex b/appendix/whymb/whymemorybarriers.tex
index dff7fafc..301342f3 100644
--- a/appendix/whymb/whymemorybarriers.tex
+++ b/appendix/whymb/whymemorybarriers.tex
@@ -1152,7 +1152,10 @@ void bar(void)
 }
 \end{VerbatimN}
 
-	Given this optimization, the assertion could clearly fire.
+	Given this optimization, the code would behave in a completely
+	different way than the original intention.
+	If \co{bar()} observed \qco{b == 0}, the assertion could not
+	be reached due to the infinite loop.
 	You should use volatile casts or (where available) C++
 	relaxed atomics to prevent the compiler from optimizing
 	your parallel code into oblivion.
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH -perfbook] whymb: Fix description of compiler mischief
  2020-12-02 14:50 [PATCH -perfbook] whymb: Fix description of compiler mischief Akira Yokosawa
@ 2020-12-03 11:04 ` Motohiro Kanda
  2020-12-03 13:38   ` Akira Yokosawa
  2020-12-03 16:51 ` Paul E. McKenney
  1 sibling, 1 reply; 10+ messages in thread
From: Motohiro Kanda @ 2020-12-03 11:04 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: Paul E. McKenney, perfbook

Hi, all

> Motohiro, do you mind if I submit patches to Paul on behalf of

Certainly, please submit patches.

While I was working on Japanese translation, I felt something odd with this
smp_mb sample code, but I did not report one to upstream because I was
not so sure.
I just left a comment on my translation.

It is my great pleasure that someone reads my translation so seriously, Akira.

Thanks again for great book, Paul and others!

--
Motohiro Kanda

2020-12-02 23:50 GMT+09:00, Akira Yokosawa <akiyks@gmail.com>:
> From 89ab8426f9821b6a8bf86e9d4f7eb596e0cfed73 Mon Sep 17 00:00:00 2001
> From: Akira Yokosawa <akiyks@gmail.com>
> 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@gmail.com>
> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> ---
> Hi Paul,
>
> (Cc: Motohiro)
>
> Looks like this inconsistency in the Answer to Quick Quiz has
> been Motohiro's translation note for quite a while.
> (since 2017?)
>
> He contributed to perfbook in the past.  There is a couple of
> commits with his Reported-by.
>
> Motohiro, do you mind if I submit patches to Paul on behalf of
> you like this?
>
> And I think Paul is likely to do some wordsmithing on top of
> this patch. ;-)
>
>         Thanks, Akira
> --
>  appendix/whymb/whymemorybarriers.tex | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/appendix/whymb/whymemorybarriers.tex
> b/appendix/whymb/whymemorybarriers.tex
> index dff7fafc..301342f3 100644
> --- a/appendix/whymb/whymemorybarriers.tex
> +++ b/appendix/whymb/whymemorybarriers.tex
> @@ -1152,7 +1152,10 @@ void bar(void)
>  }
>  \end{VerbatimN}
>
> -	Given this optimization, the assertion could clearly fire.
> +	Given this optimization, the code would behave in a completely
> +	different way than the original intention.
> +	If \co{bar()} observed \qco{b == 0}, the assertion could not
> +	be reached due to the infinite loop.
>  	You should use volatile casts or (where available) C++
>  	relaxed atomics to prevent the compiler from optimizing
>  	your parallel code into oblivion.
> --
> 2.17.1
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -perfbook] whymb: Fix description of compiler mischief
  2020-12-03 11:04 ` Motohiro Kanda
@ 2020-12-03 13:38   ` Akira Yokosawa
  0 siblings, 0 replies; 10+ messages in thread
From: Akira Yokosawa @ 2020-12-03 13:38 UTC (permalink / raw)
  To: Motohiro Kanda; +Cc: Paul E. McKenney, perfbook, Akira Yokosawa

On Thu, 3 Dec 2020 20:04:56 +0900, Motohiro Kanda wrote:
> Hi, all
> 
>> Motohiro, do you mind if I submit patches to Paul on behalf of
> 
> Certainly, please submit patches.

Glad to hearing from you, Motohiro!
Can I take it as your Acked-by?

> 
> While I was working on Japanese translation, I felt something odd with this
> smp_mb sample code, but I did not report one to upstream because I was
> not so sure.
> I just left a comment on my translation.
> 
> It is my great pleasure that someone reads my translation so seriously, Akira.

I'll keep picking up comments in your translation and submitting
patches upstream based on them.

Some background:

I was tempted to do translation on my own when I first encountered
perfbook, but seeing what you had done at the time (2015 or 2016),
I changed my mind and started contributing to perfbook as a LaTeX advisor.
The rapid update pace of upstream perfbook was another factor I
changed my mind.
At that time your translation was work-in-progress, but last weekend,
I was impressed to find out it is mostly complete.

If there is anything I can't understand in your comments, I'll ask
you in person (in Japanese maybe).

        Thanks, Akira

> 
> Thanks again for great book, Paul and others!
> 
> --
> Motohiro Kanda
> 
[...]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -perfbook] whymb: Fix description of compiler mischief
  2020-12-02 14:50 [PATCH -perfbook] whymb: Fix description of compiler mischief Akira Yokosawa
  2020-12-03 11:04 ` Motohiro Kanda
@ 2020-12-03 16:51 ` Paul E. McKenney
  2020-12-03 22:42   ` Akira Yokosawa
  2020-12-05  3:16   ` Motohiro Kanda
  1 sibling, 2 replies; 10+ messages in thread
From: Paul E. McKenney @ 2020-12-03 16:51 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: Motohiro Kanda, perfbook

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@gmail.com>
> 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@gmail.com>
> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>

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!!!

Would it also help to add a reference to the discussion of control
dependencies?  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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -perfbook] whymb: Fix description of compiler mischief
  2020-12-03 16:51 ` Paul E. McKenney
@ 2020-12-03 22:42   ` Akira Yokosawa
  2020-12-05  3:16   ` Motohiro Kanda
  1 sibling, 0 replies; 10+ messages in thread
From: Akira Yokosawa @ 2020-12-03 22:42 UTC (permalink / raw)
  To: paulmck; +Cc: Motohiro Kanda, perfbook

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@gmail.com>
>> 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@gmail.com>
>> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> 
> 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
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -perfbook] whymb: Fix description of compiler mischief
  2020-12-03 16:51 ` Paul E. McKenney
  2020-12-03 22:42   ` Akira Yokosawa
@ 2020-12-05  3:16   ` Motohiro Kanda
  2020-12-08 18:43     ` Paul E. McKenney
  1 sibling, 1 reply; 10+ messages in thread
From: Motohiro Kanda @ 2020-12-05  3:16 UTC (permalink / raw)
  To: paulmck; +Cc: Akira Yokosawa, perfbook

> Motohiro, would you be OK with my mentioning your translation in the
Sure, my honor!

--
Motohiro Kanda

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -perfbook] whymb: Fix description of compiler mischief
  2020-12-05  3:16   ` Motohiro Kanda
@ 2020-12-08 18:43     ` Paul E. McKenney
  2020-12-09  6:17       ` Motohiro Kanda
  0 siblings, 1 reply; 10+ messages in thread
From: Paul E. McKenney @ 2020-12-08 18:43 UTC (permalink / raw)
  To: Motohiro Kanda; +Cc: Akira Yokosawa, perfbook

On Sat, Dec 05, 2020 at 12:16:57PM +0900, Motohiro Kanda wrote:
> > Motohiro, would you be OK with my mentioning your translation in the
> Sure, my honor!

Very good!

We have you in the FAQ, but it just says that you have started.

What should I change that to?  "N chapters done"?  "Done through
Chapter/Appendix X"?  "Completed"?  Something else?

							Thanx, Paul

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -perfbook] whymb: Fix description of compiler mischief
  2020-12-08 18:43     ` Paul E. McKenney
@ 2020-12-09  6:17       ` Motohiro Kanda
  2020-12-10  1:29         ` Paul E. McKenney
  0 siblings, 1 reply; 10+ messages in thread
From: Motohiro Kanda @ 2020-12-09  6:17 UTC (permalink / raw)
  To: paulmck; +Cc: Akira Yokosawa, perfbook

Paul,

Will you change the FAQ.txt in following way?

>        Motohiro Kanda has started work on a Japanese translation:
>        https://sites.google.com/site/kandamotohiro/perfbook

to,
quote:

Motohiro Kanda publishes a Japanese translation of most chapters:

https://sites.google.com/view/kandamotohiro2/perfbook

This one is based on 2014 edition and contains topics including
"Parallel Real-Time Computing", "Axiomatic Approaches" from later
editions.

end quote

Some background:

Due to Google classic site deprecation policy, I have moved all of my
contents from
sites.google.com/site/kandamotohiro
to sites.google.com/view/kandamotohiro2.

https://sites.google.com/site/kandamotohiro/perfbook will be gone on
September 2021.

I have translated chapter 1 to 16 and appendix A to D and F. All from
2014 first printed edition.
I loved "Parallel Real-Time Computing" chapter in 2015 edition and
"Axiomatic Approaches" section in 2017 edition and added their
translation as well.

But I do not have energy to keep up with the speed and volume of latest changes.
So, my translation is published as-is, based on old 2014 edition.

You can change wordings of my FAQ.txt change proposal as you like.
Thanks.

--
Motohiro Kanda

> We have you in the FAQ, but it just says that you have started.
>
> What should I change that to?  "N chapters done"?  "Done through
> Chapter/Appendix X"?  "Completed"?  Something else?
>
> 							Thanx, Paul
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -perfbook] whymb: Fix description of compiler mischief
  2020-12-09  6:17       ` Motohiro Kanda
@ 2020-12-10  1:29         ` Paul E. McKenney
  2020-12-10  1:32           ` Motohiro Kanda
  0 siblings, 1 reply; 10+ messages in thread
From: Paul E. McKenney @ 2020-12-10  1:29 UTC (permalink / raw)
  To: Motohiro Kanda; +Cc: Akira Yokosawa, perfbook

On Wed, Dec 09, 2020 at 03:17:13PM +0900, Motohiro Kanda wrote:
> Paul,
> 
> Will you change the FAQ.txt in following way?
> 
> >        Motohiro Kanda has started work on a Japanese translation:
> >        https://sites.google.com/site/kandamotohiro/perfbook
> 
> to,
> quote:
> 
> Motohiro Kanda publishes a Japanese translation of most chapters:
> 
> https://sites.google.com/view/kandamotohiro2/perfbook
> 
> This one is based on 2014 edition and contains topics including
> "Parallel Real-Time Computing", "Axiomatic Approaches" from later
> editions.
> 
> end quote
> 
> Some background:
> 
> Due to Google classic site deprecation policy, I have moved all of my
> contents from
> sites.google.com/site/kandamotohiro
> to sites.google.com/view/kandamotohiro2.
> 
> https://sites.google.com/site/kandamotohiro/perfbook will be gone on
> September 2021.
> 
> I have translated chapter 1 to 16 and appendix A to D and F. All from
> 2014 first printed edition.
> I loved "Parallel Real-Time Computing" chapter in 2015 edition and
> "Axiomatic Approaches" section in 2017 edition and added their
> translation as well.
> 
> But I do not have energy to keep up with the speed and volume of latest changes.
> So, my translation is published as-is, based on old 2014 edition.
> 
> You can change wordings of my FAQ.txt change proposal as you like.
> Thanks.

How about like this?  Please let me know of any errors or omission
so that I can fix them.

							Thanx, Paul

------------------------------------------------------------------------

commit a80871756cccbaba8678b7f762794dd56d697de9
Author: Paul E. McKenney <paulmck@kernel.org>
Date:   Wed Dec 9 17:27:37 2020 -0800

    FAQ: Update information on Motohiro Kanda's Japanese translation
    
    Reported-by: Akira Yokosawa <akiyks@gmail.com>
    Reported-by: Motohiro Kanda <kanda.motohiro@gmail.com>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

diff --git a/FAQ.txt b/FAQ.txt
index a284615..45e30c3 100644
--- a/FAQ.txt
+++ b/FAQ.txt
@@ -128,9 +128,12 @@
 
 		http://kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook-cn.2011.10.18a.pdf
 
-		Motohiro Kanda has started work on a Japanese translation:
+		Motohiro Kanda has a Japanese translation of Chapters 1-16
+		and Appendices A-D and F based on the 2014 print edition,
+		but with the "Parallel Real-Time Computing" and "Axiomatic
+		Approaches" sections taken from later editions:
 
-		https://sites.google.com/site/kandamotohiro/perfbook
+		https://sites.google.com/view/kandamotohiro2/perfbook
 
 		SeongJae Park has started work on a Korean translation:
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH -perfbook] whymb: Fix description of compiler mischief
  2020-12-10  1:29         ` Paul E. McKenney
@ 2020-12-10  1:32           ` Motohiro Kanda
  0 siblings, 0 replies; 10+ messages in thread
From: Motohiro Kanda @ 2020-12-10  1:32 UTC (permalink / raw)
  To: paulmck; +Cc: Akira Yokosawa, perfbook

[-- Attachment #1: Type: text/plain, Size: 47 bytes --]

Yes, Looks good. Thanks.
—
Motohiro Kanda

[-- Attachment #2: Type: text/html, Size: 87 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-12-10  1:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 14:50 [PATCH -perfbook] whymb: Fix description of compiler mischief Akira Yokosawa
2020-12-03 11:04 ` Motohiro Kanda
2020-12-03 13:38   ` Akira Yokosawa
2020-12-03 16:51 ` Paul E. McKenney
2020-12-03 22:42   ` Akira Yokosawa
2020-12-05  3:16   ` Motohiro Kanda
2020-12-08 18:43     ` Paul E. McKenney
2020-12-09  6:17       ` Motohiro Kanda
2020-12-10  1:29         ` Paul E. McKenney
2020-12-10  1:32           ` Motohiro Kanda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.