[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f7u4e6bc6anj5nnphkxszmynk2yrrbs6hvpje4gzxwc56a73pq@jlf3dfza7nmm>
Date: Wed, 16 Jul 2025 05:43:49 -0700
From: Breno Leitao <leitao@...ian.org>
To: Andrea Righi <arighi@...dia.com>
Cc: Tejun Heo <tj@...nel.org>, David Vernet <void@...ifault.com>,
Changwoo Min <changwoo@...lia.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] sched_ext: Track currently locked rq
On Wed, Jul 16, 2025 at 02:40:14PM +0200, Andrea Righi wrote:
> Hi Breno,
>
> On Wed, Jul 16, 2025 at 03:47:38AM -0700, Breno Leitao wrote:
> > Hello Andrea,
> >
> > On Tue, Jul 15, 2025 at 07:20:28PM +0200, Andrea Righi wrote:
> > > > On Tue, Apr 22, 2025 at 10:26:32AM +0200, Andrea Righi wrote:
> >
> > > >
> > > > > + lockdep_assert_rq_held(rq);
> > > > > + __this_cpu_write(locked_rq, rq);
> > > >
> > > > This is hitting the following BUG() on some of my debug kernels:
> > > >
> > > > BUG: using __this_cpu_write() in preemptible [00000000] code: scx_layered_6-9/68770
> > > >
> > > > I have lockdep enabled, and I don't see the assert above. I am wondering
> > > > if rq is locked but preemption continues to be enabled (!?)
> > >
> > > Interesting. And it makes sense, because we may have callbacks called from
> > > a preemptible context (especially when rq == NULL).
> > >
> > > I think we can just put a preempt_disable() / preempt_enable() around
> > > __this_cpu_write(). If we jump to another CPU during the callback it's
> > > fine, since we would track the rq state on the other CPU with its own local
> > > variable. And if we were able to jump there, it means that preemption was
> > > disabled as well.
> >
> > First of all thanks for the suggestion!
> >
> > What about a patch like the following:
>
> Looks good to me, feel free to add my:
>
> Acked-by: Andrea Righi <arighi@...dia.com>
Thanks. I will send it to the mailing list them.
--breno
Powered by blists - more mailing lists