Documentation/credentials.txt
Hi,
In the section 'ACCESSING ANOTHER TASK'S CREDENTIALS', the file Documentation/credentials.txt says:
Quoted 2 lines
A function need not get RCU read lock to use
__task_cred()if it is holding a spinlock at the time as this implicitly holds the RCU read lock.
AIUI, that is not actually right any more, is it? A spinlock does not suffice as it does not necessarily imply an RCU read-side critical section (anymore). Of course the spinlock specifically protecting updates would suffice, but that's not what this is saying.
Am I way off base?
thanks,
-serge
Quoted 8 lines · Serge E. Hallyn
Hi,
In the section 'ACCESSING ANOTHER TASK'S CREDENTIALS', the file
Documentation/credentials.txtsays:Quoted 2 lines
A function need not get RCU read lock to use
__task_cred()if it is holding a spinlock at the time as this implicitly holds the RCU read lock.
Quoted 6 lines
AIUI, that is not actually right any more, is it? A spinlock does not suffice as it does not necessarily imply an RCU read-side critical section (anymore). Of course the spinlock specifically protecting updates would suffice, but that's not what this is saying.
Am I way off base?
You are absolutely correct, good catch!!!
Now, a spinlock still does imply an RCU read-side critical section given the following configuration options:
o !CONFIG_PREEMPT
o CONFIG_PREEMPT && CONFIG_TREE_RCU
o CONFIG_PREEMPT && CONFIG_TINY_RCU
However, relying on this is usually bad practice, as such code is prone to failure given the following configuration options:
o CONFIG_PREEMPT && CONFIG_TREE_PREEMPT_RCU
o CONFIG_PREEMPT_RT (given the -rt patchset)
And when I get my act together and complete CONFIG_TINY_PREEMPT_RCU, then CONFIG_PREEMPT && CONFIG_TINY_PREEMPT_RCU will also invalidate the assumption that holding a spinlock acts as an RCU read-side critical section.
Did you want to submit a patch for this?
Thanx, Paul
Quoted 32 lines · Paul E. McKenney
Quoted 8 lines · Serge E. Hallyn
Hi,
In the section 'ACCESSING ANOTHER TASK'S CREDENTIALS', the file
Documentation/credentials.txtsays:Quoted 2 lines
A function need not get RCU read lock to use
__task_cred()if it is holding a spinlock at the time as this implicitly holds the RCU read lock.Quoted 6 lines
AIUI, that is not actually right any more, is it? A spinlock does not suffice as it does not necessarily imply an RCU read-side critical section (anymore). Of course the spinlock specifically protecting updates would suffice, but that's not what this is saying.
Am I way off base?
You are absolutely correct, good catch!!!
Now, a spinlock still does imply an RCU read-side critical section given the following configuration options:
o !CONFIG_PREEMPT
o
CONFIG_PREEMPT&&CONFIG_TREE_RCUo
CONFIG_PREEMPT&&CONFIG_TINY_RCUHowever, relying on this is usually bad practice, as such code is prone to failure given the following configuration options:
o
CONFIG_PREEMPT&&CONFIG_TREE_PREEMPT_RCU
Quoted 8 lines
o
CONFIG_PREEMPT_RT(given the -rt patchset)And when I get my act together and complete
CONFIG_TINY_PREEMPT_RCU, thenCONFIG_PREEMPT&&CONFIG_TINY_PREEMPT_RCUwill also invalidate the assumption that holding a spinlock acts as an RCU read-side critical section.Did you want to submit a patch for this?
Yup, sent, thanks.
-serge