From: Jan Kiszka <jan.kiszka@web.de>
To: Claudio Fontana <claudio.fontana@huawei.com>,
Peter Maydell <peter.maydell@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
kvm-devel <kvm@vger.kernel.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
arm-mail-list <linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC PATCH] KVM: arm/arm64: Don't let userspace update CNTVOFF once guest is running
Date: Fri, 26 Jun 2015 06:49:34 +0200 [thread overview]
Message-ID: <558CD9DE.3010609@web.de> (raw)
In-Reply-To: <558BC90B.4060806@huawei.com>
[-- Attachment #1.1: Type: text/plain, Size: 1897 bytes --]
On 2015-06-25 11:25, Claudio Fontana wrote:
> On 25.06.2015 11:10, Peter Maydell wrote:
>> On 25 June 2015 at 09:59, Claudio Fontana <claudio.fontana@huawei.com> wrote:
>>> Once the VM is created, I think QEMU should not request kvm to
>>> change the virtual offset of the VM anymore: maybe an unexpected
>>> consequence of QEMU's target-arm/kvm64.c::kvm_arch_put_registers ?
>>
>> Hmm. In general we assume that we can:
>> * stop the VM
>> * read all the guest system registers
>> * write those values back again
>> * restart the VM
>>
>> if we need to. Is that what's happening here, or are we doing
>> something odder?
>>
>> -- PMM
>>
>
> What I guess could be happening by looking at the code in linux
>
> virt/kvm/arm/arch_timer.c::kvm_arm_timer_set_reg
>
> is that QEMU tries to set the KVM_REG_ARM_TIMER_CNT register from exactly the previous value,
> but just because of the fact that the set function is called, cntvoff is updated,
> since the value provided by the user is apparently assumed to be _relative_ to the physical timer.
>
> This is apparent to me in the code in that function which says:
>
> case KVM_REG_ARM_TIMER_CNT: {
> /* ... */
> u64 cntvoff = kvm_phys_timer_read() - value;
> /* ... */
> }
>
> And this is matched by the corresponding get function kvm_arm_timer_get_reg where it says:
>
> case KVM_REG_ARM_TIMER_CNT:
> return kvm_phys_timer_read() - vcpu->kvm->arch.timer.cntvoff;
>
> The time difference between when the GET is issued by QEMU and when the PUT is issued then would account for the difference.
QEMU has the concept of write-back levels: KVM_PUT_RUNTIME_STATE,
KVM_PUT_RESET_STATE and KVM_PUT_FULL_STATE. I suspect this registers is
just sorted into the wrong category, thus written as part of the
RUNTIME_STATE. We had such bug patterns during the x86 maturing phase as
well.
Jan
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 151 bytes --]
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2015-06-26 4:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-24 14:54 [RFC PATCH] KVM: arm/arm64: Don't let userspace update CNTVOFF once guest is running Marc Zyngier
2015-06-25 8:04 ` Christoffer Dall
2015-06-25 8:48 ` Marc Zyngier
2015-06-25 8:59 ` Claudio Fontana
2015-06-25 9:10 ` Peter Maydell
2015-06-25 9:25 ` Claudio Fontana
2015-06-26 4:49 ` Jan Kiszka [this message]
2015-06-29 17:20 ` Claudio Fontana
2015-06-29 17:37 ` Peter Maydell
2015-07-08 15:56 ` Marc Zyngier
2015-07-08 16:06 ` Peter Maydell
2015-07-08 16:37 ` Marc Zyngier
2015-07-08 19:13 ` Peter Maydell
2015-07-09 10:22 ` Christoffer Dall
2015-07-09 10:38 ` Peter Maydell
2015-07-09 12:05 ` Christoffer Dall
2015-07-09 12:07 ` Peter Maydell
2015-07-09 12:24 ` Christoffer Dall
2015-07-09 14:17 ` Christoffer Dall
2015-07-09 14:26 ` Peter Maydell
2015-07-09 16:06 ` Christoffer Dall
2015-07-09 10:40 ` Jan Kiszka
2015-07-09 12:08 ` Christoffer Dall
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=558CD9DE.3010609@web.de \
--to=jan.kiszka@web.de \
--cc=claudio.fontana@huawei.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=peter.maydell@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).