All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zqiang" <qiang.zhang@linux.dev>
To: "Christian Loehle" <christian.loehle@arm.com>,
	tj@kernel.org, void@manifault.com, arighi@nvidia.com,
	changwoo@igalia.com
Cc: sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched_ext: Fix lockdep warnings in the ops_dump_init()
Date: Mon, 08 Dec 2025 13:25:40 +0000	[thread overview]
Message-ID: <6ce126d5e8262ff22b46fb11d368e23d72d911ba@linux.dev> (raw)
In-Reply-To: <88d4bad3-213c-4486-b56f-da49ad458924@arm.com>

> On 12/8/25 11:23, Zqiang wrote:  
> 
> > For builts with PREEMPT\_RT=y kernel, the dump\_lock convert to  
> > sleepable rt-spinlock and not disable-irq, the following lockdep  
> > warning will appear:  
> >   
> > WARNING: CPU: 3 PID: 47 at kernel/sched/ext.c:4130 ops\_dump\_init+0x60/0xa0  
> > Modules linked in:  
> > CPU: 3 UID: 0 PID: 47 Comm: irq\_work/3  
> > RIP: 0010:ops\_dump\_init+0x60/0xa0  
> > Call Trace:  
> > <TASK>  
> > scx\_dump\_state+0x1091/0x1620  
> > ? \_\_schedule+0xf1c/0x3ec0  
> > ? rcu\_is\_watching+0x19/0xb0  
> > ? \_\_pfx\_scx\_dump\_state+0x10/0x10  
> > ? kvm\_sched\_clock\_read+0x15/0x30  
> > ? \_\_lock\_acquire+0x98b/0x1ae0  
> > ? \_\_this\_cpu\_preempt\_check+0x17/0x20  
> > ? insn\_get\_modrm+0x107/0x6e0  
> > scx\_error\_irq\_workfn+0xeb/0x120  
> > irq\_work\_single+0x113/0x260  
> > irq\_work\_run\_list.part.7+0x44/0x70  
> > run\_irq\_workd+0x6b/0x90  
> > ? \_\_pfx\_run\_irq\_workd+0x10/0x10  
> > smpboot\_thread\_fn+0x34c/0xa50  
> > ? trace\_preempt\_on+0x54/0x120  
> > ? \_\_pfx\_smpboot\_thread\_fn+0x10/0x10  
> > kthread+0x411/0x8a0  
> > ? \_\_pfx\_kthread+0x10/0x10  
> > ? rt\_spin\_unlock+0x9f/0x210  
> > ? \_\_pfx\_kthread+0x10/0x10  
> > ret\_from\_fork+0x406/0x500  
> > ? \_\_switch\_to\_asm+0x33/0x70  
> > ? \_\_pfx\_kthread+0x10/0x10  
> > ret\_from\_fork\_asm+0x1a/0x30  
> > </TASK>  
> >   
> > This commit therefore convert dump\_lock to raw spinlock.  
> >   
> > Signed-off-by: Zqiang <qiang.zhang@linux.dev>  
> > \---  
> > kernel/sched/ext.c | 6 +++---  
> > 1 file changed, 3 insertions(+), 3 deletions(-)  
> >   
> > diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c  
> > index 59fa391636c7..2e19e3689f1c 100644  
> > \--- a/kernel/sched/ext.c  
> > +++ b/kernel/sched/ext.c  
> > @@ -4235,7 +4235,7 @@ static void scx\_dump\_task(struct seq\_buf \*s, struct scx\_dump\_ctx \*dctx,  
> >   
> > static void scx\_dump\_state(struct scx\_exit\_info \*ei, size\_t dump\_len)  
> > {  
> > \- static DEFINE\_SPINLOCK(dump\_lock);  
> > \+ static DEFINE\_RAW\_SPINLOCK(dump\_lock);  
> > static const char trunc\_marker\[\] = "\\n\\n~~~~ TRUNCATED ~~~~\\n";  
> > struct scx\_sched \*sch = scx\_root;  
> > struct scx\_dump\_ctx dctx = {  
> > @@ -4251,7 +4251,7 @@ static void scx\_dump\_state(struct scx\_exit\_info \*ei, size\_t dump\_len)  
> > char \*buf;  
> > int cpu;  
> >   
> > \- spin\_lock\_irqsave(&dump\_lock, flags);  
> > \+ raw\_spin\_lock\_irqsave(&dump\_lock, flags);  
> >   
> > seq\_buf\_init(&s, ei->dump, dump\_len);  
> >   
> > @@ -4375,7 +4375,7 @@ static void scx\_dump\_state(struct scx\_exit\_info \*ei, size\_t dump\_len)  
> > memcpy(ei->dump + dump\_len - sizeof(trunc\_marker),  
> > trunc\_marker, sizeof(trunc\_marker));  
> >   
> > \- spin\_unlock\_irqrestore(&dump\_lock, flags);  
> > \+ raw\_spin\_unlock\_irqrestore(&dump\_lock, flags);  
> > }  
> >   
> > static void scx\_error\_irq\_workfn(struct irq\_work \*irq\_work)
> 
>   
> This is already part of Tejun's cgroup sub-scheduler support series:  
> [https://lore.kernel.org/lkml/20250920005931.2753828-39-tj@kernel.org/](https://lore.kernel.org/lkml/20250920005931.2753828-39-tj@kernel.org/)


Thank you for pointing it :),  please this patch.

Thanks
Zqiang

  reply	other threads:[~2025-12-08 13:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-08 11:23 [PATCH] sched_ext: Fix the memleak for sch->helper objects Zqiang
2025-12-08 11:23 ` [PATCH] sched_ext: Fix lockdep warnings in the ops_dump_init() Zqiang
2025-12-08 11:29   ` Christian Loehle
2025-12-08 13:25     ` Zqiang [this message]
2025-12-08 17:12 ` [PATCH] sched_ext: Fix the memleak for sch->helper objects Tejun Heo

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=6ce126d5e8262ff22b46fb11d368e23d72d911ba@linux.dev \
    --to=qiang.zhang@linux.dev \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=christian.loehle@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tj@kernel.org \
    --cc=void@manifault.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.