All of lore.kernel.org
 help / color / mirror / Atom feed
* Question on (locking: Make spinlock_t and rwlock_t a RCU section on RT)
@ 2021-07-26  7:43 Zhang, Qiang
  2021-07-30 14:44 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang, Qiang @ 2021-07-26  7:43 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: linux-rt-users, LKML, Thomas Gleixner

Hello,  I have some questions about this patch 

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Tue, 19 Nov 2019 09:25:04 +0100
Subject: [PATCH] locking: Make spinlock_t and rwlock_t a RCU section on RT

On !RT a locked spinlock_t and rwlock_t disables preemption which
implies a RCU read section. There is code that relies on that behaviour.

Add an explicit RCU read section on RT while a sleeping lock (a lock
which would disables preemption on !RT) acquired.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/locking/rtmutex.c   |    6 ++++++
 kernel/locking/rwlock-rt.c |    6 ++++++
 2 files changed, 12 insertions(+)

--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1136,6 +1136,7 @@ void __lockfunc rt_spin_lock(spinlock_t
 {
        spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
        rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock);
+       rcu_read_lock();
        migrate_disable();
...............................

Operation of sleep is not allowed in RCU read critical area,  If  after acquiring a rt-spinlock , try to acquire another one rt-spinlock,  This may cause sleep, and trigger RCU warning.  

Is there a problem with my analysis or something I missed?

Thanks
Qiang

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question on (locking: Make spinlock_t and rwlock_t a RCU section on RT)
  2021-07-26  7:43 Question on (locking: Make spinlock_t and rwlock_t a RCU section on RT) Zhang, Qiang
@ 2021-07-30 14:44 ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-07-30 14:44 UTC (permalink / raw)
  To: Zhang, Qiang; +Cc: linux-rt-users, LKML, Thomas Gleixner

On 2021-07-26 07:43:33 [+0000], Zhang, Qiang wrote:
> Operation of sleep is not allowed in RCU read critical area,  If
> after acquiring a rt-spinlock , try to acquire another one
> rt-spinlock,  This may cause sleep, and trigger RCU warning.  
> 
> Is there a problem with my analysis or something I missed?

This warning is suppressed on RT. Same as on CONFIG_PREEMPT when a task
gets preempted while in a rcu_read_lock() section.

> Thanks
> Qiang

Sebastian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-30 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26  7:43 Question on (locking: Make spinlock_t and rwlock_t a RCU section on RT) Zhang, Qiang
2021-07-30 14:44 ` Sebastian Andrzej Siewior

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.