All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: Junchang Wang <junchangwang@gmail.com>,
	"Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: Re: [PATCH v2 0/3] Toyrcu: replace plain accesses with READ_ONCE() and
Date: Fri, 26 Apr 2019 00:38:40 +0900	[thread overview]
Message-ID: <95b306ce-9ddb-0ac5-ee5c-077cb4a9a27e@gmail.com> (raw)
In-Reply-To: <1556180994-16131-1-git-send-email-junchangwang@gmail.com>

Hi Junchang,

On Thu, 25 Apr 2019 16:29:51 +0800, Junchang Wang wrote:
> Hi Paul and Akira,
> 
> This patch set replaces plain accesses and ACCESS_ONCE() with READ_ONCE()
> and WRITE_ONCE() in Toy RCU examples. I will send another patch updating
> tex file accordingly on top of this patch set.

As far as accesses to rcu_gp_ctr, this patch set looks good to me.

In updating toyrcu.tex file, I suggested to extract the snippets from
code under CodeSamples/defer, but some snippets in toyrcu.tex consist of
code from both .h and .c. Current scheme does not support such merging
of snippets from multiple source files.

Your option is to manually convert verbbox environment to Verbatim
environment. Sorry I suggested infeasible extractions the other day.
rcu_qs.c and rcu_qs.h are in separate snippets, and they can be
extracted by fcvextract.pl. In this case, commit 4a41491166cd
("defer/hazptr: Extract snippet from hazptr.c") should be a good example,
especially the "gobbleblank=yes" option.

If you have any question, feel free to ask me. I'm looking forward to
seeing your update.

Paul, in the sources Junchang has touched, per-thread variable
"rcu_reader_gp" is updated by its owner, but is read accessed from
for_each_thread loops in updater side. So I think accesses to each of
them need to be annotated by WRITE_ONCE (in owner) and READ_ONCE (in updater).
I looked at only the diffs in the 1st patch set and didn't notice the raciness
of them.

Macros for accessing per-thread variables are expanded to array references,
and there are "barrier()"s in these loops.
So I think there is little chance those accesses would be optimized by
currently available compilers.

Do you see the need to annotate the accesses to per-thread variable?

        Thanks, Akira 

> 
> --
> Junchang Wang (3):
>   rcu: Use READ_ONCE() and WRITE_ONCE() for shared variable rcu_gp_ctr
>   rcu_nest: Use READ_ONCE() and WRITE_ONCE() for shared variable
>     rcu_gp_ctr
>   rcu_qs: Use READ_ONCE() AND WRITE_ONCE() for shared variable
>     rcu_gp_ctr
> 
>  CodeSamples/defer/rcu.c      | 2 +-
>  CodeSamples/defer/rcu.h      | 4 ++--
>  CodeSamples/defer/rcu_nest.c | 2 +-
>  CodeSamples/defer/rcu_nest.h | 2 +-
>  CodeSamples/defer/rcu_qs.c   | 2 +-
>  CodeSamples/defer/rcu_qs.h   | 4 ++--
>  6 files changed, 8 insertions(+), 8 deletions(-)
> 


  parent reply	other threads:[~2019-04-25 15:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-25  8:29 [PATCH v2 0/3] Toyrcu: replace plain accesses with READ_ONCE() and Junchang Wang
2019-04-25  8:29 ` [PATCH v2 1/3] rcu: Use READ_ONCE() and WRITE_ONCE() for shared variable rcu_gp_ctr Junchang Wang
2019-04-25  8:29 ` [PATCH v2 2/3] rcu_nest: " Junchang Wang
2019-04-25  8:29 ` [PATCH v2 3/3] rcu_qs: Use READ_ONCE() AND " Junchang Wang
2019-04-25 15:38 ` Akira Yokosawa [this message]
2019-04-26  8:15   ` [PATCH v2 0/3] Toyrcu: replace plain accesses with READ_ONCE() and Junchang Wang
2019-04-26 13:43   ` Paul E. McKenney
2019-04-27 14:27     ` Akira Yokosawa
2019-04-28 14:57       ` Junchang Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=95b306ce-9ddb-0ac5-ee5c-077cb4a9a27e@gmail.com \
    --to=akiyks@gmail.com \
    --cc=junchangwang@gmail.com \
    --cc=paulmck@linux.ibm.com \
    --cc=perfbook@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.