All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Chuang Xu <xuchuangxclwt@bytedance.com>
Cc: dgilbert@redhat.com, quintela@redhat.com, pbonzini@redhat.com,
	peterx@redhat.com, david@redhat.com, philmd@linaro.org,
	zhouyibo@bytedance.com, qemu-devel@nongnu.org
Subject: Re: [RFC v4 1/3] rcu: introduce rcu_read_locked()
Date: Wed, 04 Jan 2023 14:20:02 +0000	[thread overview]
Message-ID: <87zgaypeih.fsf@linaro.org> (raw)
In-Reply-To: <20221223142307.1614945-2-xuchuangxclwt@bytedance.com>


Chuang Xu <xuchuangxclwt@bytedance.com> writes:

> add rcu_read_locked() to detect holding of rcu lock.
>
> Signed-off-by: Chuang Xu <xuchuangxclwt@bytedance.com>
> ---
>  include/qemu/rcu.h | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
> index b063c6fde8..42cbd0080f 100644
> --- a/include/qemu/rcu.h
> +++ b/include/qemu/rcu.h
> @@ -119,6 +119,13 @@ static inline void rcu_read_unlock(void)
>      }
>  }
>  
> +static inline bool rcu_read_locked(void)

We use the locked suffix to indicate functions that should be called
with a lock held. Perhaps renaming this to rcu_read_is_locked() would
make the intent of the function clearer?

> +{
> +    struct rcu_reader_data *p_rcu_reader = get_ptr_rcu_reader();
> +
> +    return p_rcu_reader->depth > 0;
> +}
> +
>  extern void synchronize_rcu(void);
>  
>  /*


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2023-01-04 14:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23 14:23 [RFC v4 0/3] migration: reduce time of loading non-iterable vmstate Chuang Xu
2022-12-23 14:23 ` [RFC v4 1/3] rcu: introduce rcu_read_locked() Chuang Xu
2023-01-04 14:20   ` Alex Bennée [this message]
2023-01-05  8:17     ` Chuang Xu
2022-12-23 14:23 ` [RFC v4 2/3] memory: add depth assert in address_space_to_flatview Chuang Xu
2022-12-23 15:37   ` Peter Xu
2022-12-23 15:47   ` Paolo Bonzini
2022-12-23 15:54     ` Peter Xu
2022-12-28  8:27       ` Paolo Bonzini
2023-01-03 17:43         ` Peter Xu
2023-01-10  8:09           ` Chuang Xu
2023-01-10 14:45             ` Peter Xu
2023-01-12  7:59               ` Chuang Xu
2023-01-12 15:13                 ` Peter Xu
2023-01-13 19:29                   ` Chuang Xu
2022-12-28 10:50   ` Philippe Mathieu-Daudé
2023-01-04  7:39     ` [External] " Chuang Xu
2022-12-23 14:23 ` [RFC v4 3/3] migration: reduce time of loading non-iterable vmstate Chuang Xu
2022-12-23 16:06   ` David Hildenbrand
2023-01-04  7:31     ` Chuang Xu
2022-12-23 15:50 ` [RFC v4 0/3] " Peter Xu
2022-12-23 19:11   ` Chuang Xu

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=87zgaypeih.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=xuchuangxclwt@bytedance.com \
    --cc=zhouyibo@bytedance.com \
    /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.