[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH0PR11MB58805C9797BEC218610C5145DAAB9@PH0PR11MB5880.namprd11.prod.outlook.com>
Date: Thu, 23 Feb 2023 05:13:19 +0000
From: "Zhang, Qiang1" <qiang1.zhang@...el.com>
To: "paulmck@...nel.org" <paulmck@...nel.org>,
Davidlohr Bueso <dave@...olabs.net>
CC: "josh@...htriplett.org" <josh@...htriplett.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] locktorture: Add raw_spinlock* torture tests for
PREEMPT_RT kernels
> On Wed, 22 Feb 2023, Paul E. McKenney wrote:
>
> > commit edc9d419ee8c22821ffd664466a5cf19208c3f02
> > Author: Zqiang <qiang1.zhang@...el.com>
> > Date: Wed Feb 15 14:10:35 2023 +0800
> >
> > locktorture: Add raw_spinlock* torture tests for PREEMPT_RT kernels
> >
> > In PREEMPT_RT kernels, both spin_lock() and spin_lock_irq() are converted
> > to sleepable rt_spin_lock(). This means that the interrupt related suffix
> > for spin_lock/unlock(_irq, irqsave/irqrestore) do not affect the CPU's
> > interrupt state. This commit therefore adds raw spin-lock torture tests.
> > This in turn permits pure spin locks to be tested in PREEMPT_RT kernels.
> >
> > Signed-off-by: Zqiang <qiang1.zhang@...el.com>
> > Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
>
> This is a nice addition, thanks. Just one comment below.
>
> > diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
> > index 9425aff089365..ed8e5baafe49f 100644
> > --- a/kernel/locking/locktorture.c
> > +++ b/kernel/locking/locktorture.c
> > @@ -257,6 +257,61 @@ static struct lock_torture_ops spin_lock_irq_ops = {
> > .name = "spin_lock_irq"
> > };
> >
> > +#ifdef CONFIG_PREEMPT_RT
> > +static DEFINE_RAW_SPINLOCK(torture_raw_spinlock);
>
> How about leaving raw spinlocks regardless of preempt-rt, and instead
> change the default lock (which is spin_lock) based on CONFIG_PREEMPT_RT
> and use the raw one in that case?
>
>That makes a lot of sense to me! In fact, I tested this by deleting
>those #ifdef statements. ;-)
>
>Zqiang, would you like to take the patch and make that change, with
>attribution?
If I understand correctly, I should remove #ifdef statements, right?
If yes, I will change and resend 😊.
Thanks
Zqiang
>
> Thanx, Paul
Powered by blists - more mailing lists