From: Alexander Graf <agraf@suse.de>
To: "Suresh E. Warrier" <warrier@linux.vnet.ibm.com>,
Paul Mackerras <paulus@samba.org>,
kvm-ppc@vger.kernel.org
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 5/5] KVM: PPC: Book3S HV: Check wait conditions before sleeping in kvmppc_vcore_blocked
Date: Sun, 23 Nov 2014 00:41:36 +0000 [thread overview]
Message-ID: <54712D40.7060903@suse.de> (raw)
In-Reply-To: <546E418C.1080105@linux.vnet.ibm.com>
On 20.11.14 20:31, Suresh E. Warrier wrote:
>
>
> On 11/20/2014 11:36 AM, Alexander Graf wrote:
>>
>>
>> On 03.11.14 05:52, Paul Mackerras wrote:
>>> From: "Suresh E. Warrier" <warrier@linux.vnet.ibm.com>
>>>
>>> The kvmppc_vcore_blocked() code does not check for the wait condition
>>> after putting the process on the wait queue. This means that it is
>>> possible for an external interrupt to become pending, but the vcpu to
>>> remain asleep until the next decrementer interrupt. The fix is to
>>> make one last check for pending exceptions and ceded state before
>>> calling schedule().
>>>
>>> Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
>>> Signed-off-by: Paul Mackerras <paulus@samba.org>
>>
>> I don't understand the race you're fixing here. Can you please explain it?
>>
>
> When a virtual interrupt needs to be delivered to the guest, and the
> virtual ICS state for the interrupt and virtual ICP state for the VCPU
> allow for the VCPU to be immediately interrupted, we
> 1. Set the BOOK3S_INTERRUPT_EXTERNAL_LEVEL bit in pending_exceptions.
> 2. Call kvmppc_fast_vcpu_kick_hv(), which checks the wait queue at vcpu->wq
> to wake the VCPU up.
>
> The caller of kvmppc_vcore_blocked() does the check for pending exceptions, but
> there is a race condition here and we do need to check again after the VCPU
> is put on the wait queue.
I see. Thanks, applied to kvm-ppc-queue.
Alex
WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: "Suresh E. Warrier" <warrier@linux.vnet.ibm.com>,
Paul Mackerras <paulus@samba.org>,
kvm-ppc@vger.kernel.org
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 5/5] KVM: PPC: Book3S HV: Check wait conditions before sleeping in kvmppc_vcore_blocked
Date: Sun, 23 Nov 2014 01:41:36 +0100 [thread overview]
Message-ID: <54712D40.7060903@suse.de> (raw)
In-Reply-To: <546E418C.1080105@linux.vnet.ibm.com>
On 20.11.14 20:31, Suresh E. Warrier wrote:
>
>
> On 11/20/2014 11:36 AM, Alexander Graf wrote:
>>
>>
>> On 03.11.14 05:52, Paul Mackerras wrote:
>>> From: "Suresh E. Warrier" <warrier@linux.vnet.ibm.com>
>>>
>>> The kvmppc_vcore_blocked() code does not check for the wait condition
>>> after putting the process on the wait queue. This means that it is
>>> possible for an external interrupt to become pending, but the vcpu to
>>> remain asleep until the next decrementer interrupt. The fix is to
>>> make one last check for pending exceptions and ceded state before
>>> calling schedule().
>>>
>>> Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
>>> Signed-off-by: Paul Mackerras <paulus@samba.org>
>>
>> I don't understand the race you're fixing here. Can you please explain it?
>>
>
> When a virtual interrupt needs to be delivered to the guest, and the
> virtual ICS state for the interrupt and virtual ICP state for the VCPU
> allow for the VCPU to be immediately interrupted, we
> 1. Set the BOOK3S_INTERRUPT_EXTERNAL_LEVEL bit in pending_exceptions.
> 2. Call kvmppc_fast_vcpu_kick_hv(), which checks the wait queue at vcpu->wq
> to wake the VCPU up.
>
> The caller of kvmppc_vcore_blocked() does the check for pending exceptions, but
> there is a race condition here and we do need to check again after the VCPU
> is put on the wait queue.
I see. Thanks, applied to kvm-ppc-queue.
Alex
next prev parent reply other threads:[~2014-11-23 0:41 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 4:51 [PATCH 0/5] Some fixes for HV KVM on PPC Paul Mackerras
2014-11-03 4:51 ` Paul Mackerras
2014-11-03 4:51 ` [PATCH 1/5] KVM: PPC: Book3S HV: Fix computation of tlbie operand Paul Mackerras
2014-11-03 4:51 ` Paul Mackerras
2014-11-03 5:59 ` Aneesh Kumar K.V
2014-11-03 6:11 ` Aneesh Kumar K.V
2014-11-03 6:29 ` Aneesh Kumar K.V
2014-11-03 6:41 ` Aneesh Kumar K.V
2014-11-03 4:51 ` [PATCH 2/5] KVM: PPC: Book3S HV: Fix an issue where guest is paused on receiving HMI Paul Mackerras
2014-11-03 4:51 ` Paul Mackerras
2014-11-20 17:32 ` Alexander Graf
2014-11-20 17:32 ` Alexander Graf
2014-11-03 4:51 ` [PATCH 3/5] KVM: PPC: Book3S HV: Fix KSM memory corruption Paul Mackerras
2014-11-03 4:51 ` Paul Mackerras
2014-11-03 4:51 ` [PATCH 4/5] KVM: PPC: Book3S HV: Fix inaccuracies in ICP emulation for H_IPI Paul Mackerras
2014-11-03 4:51 ` Paul Mackerras
2014-11-03 4:52 ` [PATCH 5/5] KVM: PPC: Book3S HV: Check wait conditions before sleeping in kvmppc_vcore_blocked Paul Mackerras
2014-11-03 4:52 ` Paul Mackerras
2014-11-20 17:36 ` Alexander Graf
2014-11-20 17:36 ` Alexander Graf
2014-11-20 19:31 ` Suresh E. Warrier
2014-11-20 19:31 ` Suresh E. Warrier
2014-11-23 0:41 ` Alexander Graf [this message]
2014-11-23 0:41 ` Alexander Graf
2014-11-20 17:36 ` [PATCH 0/5] Some fixes for HV KVM on PPC Alexander Graf
2014-11-20 17:36 ` Alexander Graf
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=54712D40.7060903@suse.de \
--to=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=paulus@samba.org \
--cc=warrier@linux.vnet.ibm.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.