All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pranith Kumar <pranith@gatech.edu>
To: paulmck@linux.vnet.ibm.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: usage of rcu_dereference_raw
Date: Mon, 21 Apr 2014 18:47:34 -0400	[thread overview]
Message-ID: <5355A006.9090502@gatech.edu> (raw)


On Mon, Apr 21, 2014 at 6:03 PM, Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
>>   do most of the uses of rcu_dereference_raw() need to be changed to use other
>>   dereference functions or are there cases where its usage is valid?
>
> The second call from iwl_op_mode_dvm_stop() -might- be valid.  For it
> to be valid, there must be a grace period between the time that the
> field was made inaccessible to readers and the time that iwl_uninit_drv()
> was called.  Usually something like synchronize_rcu() waits for the
> needed grace period.

So there are valid use cases of the rcu_dereference_raw() in scenarios where
we can verify that a grace period has passed.

Thank you for the info. Mind adding it as a comment as in the patch below?

add comment for rcu_dereference_raw

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 include/linux/rcupdate.h |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 00a7fd6..af40a86 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -662,7 +662,13 @@ static inline void rcu_preempt_sleep_check(void)
     __rcu_dereference_check((p), rcu_read_lock_sched_held() || (c), \
                 __rcu)
 
-#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/
+/* rcu_dereference_raw() - rcu_dereference with no checking
+ * @p: The pointer to read, prior to dereferencing
+ *
+ * Use this to dereference a rcu pointer if you are sure that there exists a
+ * grace period between the time this pointer was made inaccessible to readers
+ */
+#define rcu_dereference_raw(p) rcu_dereference_check(p, 1)
 
 /*
  * The tracing infrastructure traces RCU (we want that), but unfortunately
-- 
1.7.9.5


-- 
Pranith

             reply	other threads:[~2014-04-21 22:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 22:47 Pranith Kumar [this message]
2014-04-28 21:13 ` usage of rcu_dereference_raw Paul E. McKenney
  -- strict thread matches above, loose matches on Subject: below --
2014-04-21 21:37 Pranith Kumar
2014-04-21 22:03 ` Paul E. McKenney

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=5355A006.9090502@gatech.edu \
    --to=pranith@gatech.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.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.