From: Scott Wood <scottwood@freescale.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 5/5] KVM: PPC: booke: Improve timer register emulation
Date: Tue, 27 Sep 2011 16:45:24 +0000 [thread overview]
Message-ID: <4E81FDA4.70703@freescale.com> (raw)
In-Reply-To: <20110826233145.GE30607@schlenkerla.am.freescale.net>
On 09/27/2011 11:21 AM, Bhushan Bharat-R65777 wrote:
>
>
>> -----Original Message-----
>> From: kvm-ppc-owner@vger.kernel.org [mailto:kvm-ppc-
>> owner@vger.kernel.org] On Behalf Of Alexander Graf
>> Sent: Tuesday, September 27, 2011 9:39 PM
>> To: Bhushan Bharat-R65777
>> Cc: Wood Scott-B07421; Liu Yu-B13201; kvm-ppc@vger.kernel.org
>> Subject: Re: [PATCH 5/5] KVM: PPC: booke: Improve timer register
>> emulation
>>
>>
>> On 27.09.2011, at 18:01, Bhushan Bharat-R65777 wrote:
>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: kvm-ppc-owner@vger.kernel.org [mailto:kvm-ppc-
>>>> owner@vger.kernel.org] On Behalf Of Alexander Graf
>>>> Sent: Tuesday, September 27, 2011 1:45 PM
>>>> To: Wood Scott-B07421
>>>> Cc: Liu Yu-B13201; Wood Scott-B07421; kvm-ppc@vger.kernel.org
>>>> Subject: Re: [PATCH 5/5] KVM: PPC: booke: Improve timer register
>>>> emulation
>>>>
>>>>
>>>> On 27.09.2011, at 02:44, Scott Wood wrote:
>>>>
>>>>> On 09/24/2011 02:27 AM, Alexander Graf wrote:
>>>>>> I think I'm getting your point. So what we want is:
>>>>>>
>>>>>> in timer handler:
>>>>>>
>>>>>> set_bit(TSR_DIS, vcpu->arch.tsr);
>>>>>> kvm_make_request(KVM_REQ_PPC_TSR_UPDATE, vcpu);
>>>>>> kvm_vcpu_kick(vcpu);
>>>
>>> Still there can be a case where first request not handled and another
>> event happens? Or we would like to pause till first request is handled by
>> vcpu?
>>
>> If the first DIS request is not handled and another event happens, the
>> interrupts get coalesced (like on real hardware). If there is another TSR
>> bit set still, int_pending should still be active and the guest exits the
>> next time it sets MSR_EE, making us inject the next interrupt.
>>
>
> This may not work for watchdog, where every event causes a state change.
For watchdog, this would only be used for delivering the interrupt (or a
final expiration exit to qemu, which would be a separate request bit).
ENW/WIS would be handled from timer context, like DIS is here.
The watchdog timer could use a compare and swap to avoid this sort of race:
vcpu thread watchdog timer
----------- --------------
*expires*
set ENW
*expires*
see ENW set
clear ENW+WIS
set WIS
sees WIS but not ENW
...if we care. It's something that shouldn't be possible in hardware,
but not of much consequence (the guest is unlikely to clear ENW+WIS one
time but only ENW the next). Not hard to avoid either, though.
Other races are possible, but (unless I'm missing one) they don't
produce results that couldn't have been produced by the vcpu thread
being a few cycles slower.
-Scott
prev parent reply other threads:[~2011-09-27 16:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-26 23:31 [PATCH 5/5] KVM: PPC: booke: Improve timer register emulation Scott Wood
2011-09-05 22:45 ` Alexander Graf
2011-09-06 3:17 ` Liu Yu-B13201
2011-09-06 8:04 ` Alexander Graf
2011-09-06 19:05 ` Alexander Graf
2011-09-07 10:16 ` Liu Yu-B13201
2011-09-07 10:41 ` Alexander Graf
2011-09-08 2:20 ` Liu Yu-B13201
2011-09-08 9:21 ` Liu Yu-B13201
2011-09-08 15:34 ` Scott Wood
2011-09-08 15:39 ` Alexander Graf
2011-09-15 20:52 ` Scott Wood
2011-09-19 9:32 ` Alexander Graf
2011-09-19 19:12 ` Scott Wood
2011-09-24 7:27 ` Alexander Graf
2011-09-27 0:44 ` Scott Wood
2011-09-27 8:14 ` Alexander Graf
2011-09-27 16:01 ` Bhushan Bharat-R65777
2011-09-27 16:09 ` Alexander Graf
2011-09-27 16:21 ` Bhushan Bharat-R65777
2011-09-27 16:32 ` Alexander Graf
2011-09-27 16:45 ` Scott Wood [this message]
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=4E81FDA4.70703@freescale.com \
--to=scottwood@freescale.com \
--cc=kvm-ppc@vger.kernel.org \
/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.