* [PATCH] toolsoftrade: Fix code listing 4.22 in Chapter 4
@ 2019-03-19 14:59 Slavomir Kaslev
2019-03-19 15:33 ` Steven Rostedt
2019-03-19 15:38 ` Paul E. McKenney
0 siblings, 2 replies; 4+ messages in thread
From: Slavomir Kaslev @ 2019-03-19 14:59 UTC (permalink / raw)
To: paulmck; +Cc: perfbook, rostedt, slavomir.kaslev
Code listing 4.22 is broken since the READ_ONCE() macro takes a rvalue and the
expression parenthesis are unbalanced. This patch fixes it.
Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
---
toolsoftrade/toolsoftrade.tex | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/toolsoftrade/toolsoftrade.tex b/toolsoftrade/toolsoftrade.tex
index 41605a33..4e0764d0 100644
--- a/toolsoftrade/toolsoftrade.tex
+++ b/toolsoftrade/toolsoftrade.tex
@@ -2111,7 +2111,7 @@ Listing~\ref{lst:toolsoftrade:Avoiding Danger, 2018 Style}.
\begin{listing}[tbp]
\begin{linelabel}[ln:toolsoftrade:Preventing Load Fusing]
\begin{VerbatimL}[commandchars=\\\{\}]
-while (!READ_ONCE((!need_to_stop))
+while (!READ_ONCE(need_to_stop))
do_something_quickly();
\end{VerbatimL}
\end{linelabel}
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] toolsoftrade: Fix code listing 4.22 in Chapter 4
2019-03-19 14:59 [PATCH] toolsoftrade: Fix code listing 4.22 in Chapter 4 Slavomir Kaslev
@ 2019-03-19 15:33 ` Steven Rostedt
2019-03-19 15:40 ` Paul E. McKenney
2019-03-19 15:38 ` Paul E. McKenney
1 sibling, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2019-03-19 15:33 UTC (permalink / raw)
To: Slavomir Kaslev; +Cc: paulmck, perfbook, slavomir.kaslev
On Tue, 19 Mar 2019 16:59:27 +0200
Slavomir Kaslev <kaslevs@vmware.com> wrote:
> Code listing 4.22 is broken since the READ_ONCE() macro takes a rvalue and the
> expression parenthesis are unbalanced. This patch fixes it.
>
> Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
> ---
> toolsoftrade/toolsoftrade.tex | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/toolsoftrade/toolsoftrade.tex b/toolsoftrade/toolsoftrade.tex
> index 41605a33..4e0764d0 100644
> --- a/toolsoftrade/toolsoftrade.tex
> +++ b/toolsoftrade/toolsoftrade.tex
> @@ -2111,7 +2111,7 @@ Listing~\ref{lst:toolsoftrade:Avoiding Danger, 2018 Style}.
> \begin{listing}[tbp]
> \begin{linelabel}[ln:toolsoftrade:Preventing Load Fusing]
> \begin{VerbatimL}[commandchars=\\\{\}]
> -while (!READ_ONCE((!need_to_stop))
> +while (!READ_ONCE(need_to_stop))
But doesn't this change the logic?
I'm guessing that the double "!" was wrong too.
-- Steve
> do_something_quickly();
> \end{VerbatimL}
> \end{linelabel}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] toolsoftrade: Fix code listing 4.22 in Chapter 4
2019-03-19 14:59 [PATCH] toolsoftrade: Fix code listing 4.22 in Chapter 4 Slavomir Kaslev
2019-03-19 15:33 ` Steven Rostedt
@ 2019-03-19 15:38 ` Paul E. McKenney
1 sibling, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2019-03-19 15:38 UTC (permalink / raw)
To: Slavomir Kaslev; +Cc: perfbook, rostedt, slavomir.kaslev
On Tue, Mar 19, 2019 at 04:59:27PM +0200, Slavomir Kaslev wrote:
> Code listing 4.22 is broken since the READ_ONCE() macro takes a rvalue and the
> expression parenthesis are unbalanced. This patch fixes it.
>
> Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
Good eyes, thank you! Queued and pushed.
Thanx, Paul
> ---
> toolsoftrade/toolsoftrade.tex | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/toolsoftrade/toolsoftrade.tex b/toolsoftrade/toolsoftrade.tex
> index 41605a33..4e0764d0 100644
> --- a/toolsoftrade/toolsoftrade.tex
> +++ b/toolsoftrade/toolsoftrade.tex
> @@ -2111,7 +2111,7 @@ Listing~\ref{lst:toolsoftrade:Avoiding Danger, 2018 Style}.
> \begin{listing}[tbp]
> \begin{linelabel}[ln:toolsoftrade:Preventing Load Fusing]
> \begin{VerbatimL}[commandchars=\\\{\}]
> -while (!READ_ONCE((!need_to_stop))
> +while (!READ_ONCE(need_to_stop))
> do_something_quickly();
> \end{VerbatimL}
> \end{linelabel}
> --
> 2.19.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] toolsoftrade: Fix code listing 4.22 in Chapter 4
2019-03-19 15:33 ` Steven Rostedt
@ 2019-03-19 15:40 ` Paul E. McKenney
0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2019-03-19 15:40 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Slavomir Kaslev, perfbook, slavomir.kaslev
On Tue, Mar 19, 2019 at 11:33:05AM -0400, Steven Rostedt wrote:
> On Tue, 19 Mar 2019 16:59:27 +0200
> Slavomir Kaslev <kaslevs@vmware.com> wrote:
>
> > Code listing 4.22 is broken since the READ_ONCE() macro takes a rvalue and the
> > expression parenthesis are unbalanced. This patch fixes it.
> >
> > Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
> > ---
> > toolsoftrade/toolsoftrade.tex | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/toolsoftrade/toolsoftrade.tex b/toolsoftrade/toolsoftrade.tex
> > index 41605a33..4e0764d0 100644
> > --- a/toolsoftrade/toolsoftrade.tex
> > +++ b/toolsoftrade/toolsoftrade.tex
> > @@ -2111,7 +2111,7 @@ Listing~\ref{lst:toolsoftrade:Avoiding Danger, 2018 Style}.
> > \begin{listing}[tbp]
> > \begin{linelabel}[ln:toolsoftrade:Preventing Load Fusing]
> > \begin{VerbatimL}[commandchars=\\\{\}]
> > -while (!READ_ONCE((!need_to_stop))
> > +while (!READ_ONCE(need_to_stop))
>
> But doesn't this change the logic?
It does.
> I'm guessing that the double "!" was wrong too.
And it was. In converting Listing 4.16 to 4.24 (your listing numbers
may vary), I added the READ_ONCE(), but missed removing the extra "!".
Or I added the READ_ONCE() in the wrong place, your choice. ;-)
Thanx, Paul
> -- Steve
>
>
> > do_something_quickly();
> > \end{VerbatimL}
> > \end{linelabel}
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-19 15:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-19 14:59 [PATCH] toolsoftrade: Fix code listing 4.22 in Chapter 4 Slavomir Kaslev
2019-03-19 15:33 ` Steven Rostedt
2019-03-19 15:40 ` Paul E. McKenney
2019-03-19 15:38 ` Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox