Re: [PATCH v2] locking/rwsem: Disable preemption while trying for rwsem lock

From: Greg KH
Date: Tue Apr 02 2024 - 13:42:15 EST


On Tue, Apr 02, 2024 at 08:30:32PM +0300, Aaro Koskinen wrote:
> Stable team,
>
> Please cherry-pick this patch into v5.15 stable:
>
> locking/rwsem: Disable preemption while trying for rwsem lock
>
> commit 48dfb5d2560d36fb16c7d430c229d1604ea7d185
>
> It fixes the following bug present in v5.15:
>
> > > > From: Gokul krishna Krishnakumar <quic_gokukris@xxxxxxxxxxx>
> > > > We observe RT task is hogging CPU when trying to acquire rwsem lock
> > > > which was acquired by a kworker task but before the rwsem owner was set.
> > > >
> > > > Here is the scenario:
> > > > 1. CFS task (affined to a particular CPU) takes rwsem lock.
> > > >
> > > > 2. CFS task gets preempted by a RT task before setting owner.
> > > >
> > > > 3. RT task (FIFO) is trying to acquire the lock, but spinning until
> > > > RT throttling happens for the lock as the lock was taken by CFS task.
>
> If the RT throttling is disabled, the RT task will remain looping forever
> in the kernel. If the system is UP, it will lock up completely.
>
> The issue can be easily reproduced by running RT task and normal task which
> are affined to the same CPU core.

Does this only affect the -rt patchset, or is this an issue with a
"clean" kernel release?

thanks,

greg k-h