[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5BB1E0B502000078001ED124@prv1-mh.provo.novell.com>
Date: Mon, 01 Oct 2018 02:54:13 -0600
From: "Jan Beulich" <JBeulich@...e.com>
To: "Juergen Gross" <jgross@...e.com>
Cc: "Borislav Petkov" <bp@...en8.de>,
"Peter Zijlstra" <peterz@...radead.org>,
"the arch/x86 maintainers" <x86@...nel.org>, <tglx@...utronix.de>,
"xen-devel" <xen-devel@...ts.xenproject.org>,
"Boris Ostrovsky" <boris.ostrovsky@...cle.com>,
<longman@...hat.com>, <mingo@...hat.com>,
<linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>,
<hpa@...or.com>
Subject: Re: [Xen-devel] [PATCH 1/2] xen: fix race in xen_qlock_wait()
>>> On 01.10.18 at 09:16, <jgross@...e.com> wrote:
> In the following situation a vcpu waiting for a lock might not be
> woken up from xen_poll_irq():
>
> CPU 1: CPU 2: CPU 3:
> takes a spinlock
> tries to get lock
> -> xen_qlock_wait()
> -> xen_clear_irq_pending()
Doesn't the last line above ...
> frees the lock
> -> xen_qlock_kick(cpu2)
... need to be below here?
> takes lock again
> tries to get lock
> -> *lock = _Q_SLOW_VAL
> -> *lock == _Q_SLOW_VAL ?
> -> xen_poll_irq()
> frees the lock
> -> xen_qlock_kick(cpu3)
>
> And cpu 2 will sleep forever.
>
> This can be avoided easily by modifying xen_qlock_wait() to call
> xen_poll_irq() only if the related irq was not pending and to call
> xen_clear_irq_pending() only if it was pending.
>
> Cc: stable@...r.kernel.org
> Cc: Waiman.Long@...com
> Cc: peterz@...radead.org
> Signed-off-by: Juergen Gross <jgross@...e.com>
Patch itself
Reviewed-by: Jan Beulich <jbeulich@...e.com>
Jan
Powered by blists - more mailing lists