qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH] call_rcu: stop using mb_set/mb_read
Date: Mon, 1 May 2023 10:07:34 +0100	[thread overview]
Message-ID: <30ffdb29-264e-585c-38c2-2a1bb00f23a2@linaro.org> (raw)
In-Reply-To: <20230430112515.240063-1-pbonzini@redhat.com>

On 4/30/23 12:25, Paolo Bonzini wrote:
> Use a store-release when enqueuing a new call_rcu, and a load-acquire
> when dequeuing; and read the tail after checking that node->next is
> consistent, which is the standard message passing pattern and it is
> clearer than mb_read/mb_set.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   util/rcu.c | 38 +++++++++++++++++++++++++++-----------
>   1 file changed, 27 insertions(+), 11 deletions(-)
> 
> diff --git a/util/rcu.c b/util/rcu.c
> index e5b6e52be6f8..867607cd5a1e 100644
> --- a/util/rcu.c
> +++ b/util/rcu.c
> @@ -189,8 +189,22 @@ static void enqueue(struct rcu_head *node)
>       struct rcu_head **old_tail;
>   
>       node->next = NULL;
> +
> +    /*
> +     * Make this node the tail of the list.  The node will be
> +     * used by further enqueue operations, but it will not
> +     * be dequeued yet...
> +     */
>       old_tail = qatomic_xchg(&tail, &node->next);
> -    qatomic_mb_set(old_tail, node);
> +
> +    /*
> +     * ... until it is pointed to from another item in the list.
> +     * In the meanwhile, try_dequeue() will find a NULL next pointer

Either "In the meantime" or "Meanwhile" (noun vs adverb).
E.g. "Meanwhile, at Try Dequeue's volcano lair..."  :-)


> +    /* If the head node has NULL in its next pointer, the value is
> +     * wrong and we need to wait until its enqueuer finishes the update.
> +     */

/*
  *
  */

I know surrounding code is different, but slowly it will all be edited.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


      reply	other threads:[~2023-05-01  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-30 11:25 [PATCH] call_rcu: stop using mb_set/mb_read Paolo Bonzini
2023-05-01  9:07 ` Richard Henderson [this message]

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=30ffdb29-264e-585c-38c2-2a1bb00f23a2@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).