All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: "Andreas Färber" <afaerber@suse.de>,
	"Anthony Liguori" <aliguori@us.ibm.com>,
	kvm@vger.kernel.org, "Gleb Natapov" <gleb@redhat.com>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>, "Avi Kivity" <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 1/8] kvm: Set cpu_single_env only once
Date: Sat, 11 Feb 2012 15:18:16 +0100	[thread overview]
Message-ID: <4F3678A8.60406@web.de> (raw)
In-Reply-To: <CAAu8pHuNArB9hMui2PJdsY9AKsOQ30Q3CnbhADNH+CLnWL0N7w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2412 bytes --]

On 2012-02-11 15:11, Blue Swirl wrote:
> On Sat, Feb 11, 2012 at 14:00, Jan Kiszka <jan.kiszka@web.de> wrote:
>> On 2012-02-11 14:54, Blue Swirl wrote:
>>> On Sat, Feb 11, 2012 at 12:43, Jan Kiszka <jan.kiszka@web.de> wrote:
>>>> On 2012-02-11 12:49, Andreas Färber wrote:
>>>>> Am 11.02.2012 12:25, schrieb Blue Swirl:
>>>>>> I think using cpu_single_env is an indication of a problem, like poor
>>>>>> code, layering violation or poor API (vmport). What is your use case?
>>>>>
>>>>> I couldn't spot any in this series. Jan, note that any new use of env or
>>>>> cpu_single_env will need to be redone when we convert to QOM CPU.
>>>>
>>>> cpu_single_env should have nothing to do with QOM.
>>>>
>>>> The ABIs of vmport and the KVM VAPI require a reference to the calling
>>>> VCPU, and that's why you find tons of them in patch 5.
>>>
>>> Yes, this seems to be another case of a badly designed ABI. I guess
>>> there is no way to change that anymore, just like vmport?
>>
>> Believe me, I grumbled over it more than once while porting it from
>> qemu-kvm. The point is that some (Windows) VMs out there are running
>> already with this option ROM loaded and working this unfortunate ABI.
> 
> Maybe in time those could be deprecated and a ROM using a sane ABI
> introduced instead. After some grace time the old ABI could be finally
> removed.

At some point. But now we have this interface and no other even thought
out. Given that we want to provide a migration path from qemu-kvm to
upstream rather sooner than later, I think there is no way around this
model for a certain, not too short period.

> 
>>>
>>> Some of the cpu_single_env accesses in patch 5 could be avoided when
>>> APIC is moved closer to CPU. VAPIC should be also close to APIC so it
>>> should be able to access the CPU directly. In some other cases the
>>> current state could be passed around instead once it is known.
>>
>> Some callbacks are I/O-port originated, ie. not associated with the
>> per-CPU MMIO area or some MSR. So we would have to pass down the causing
>> CPU to every I/O handler - not sure if that is desired...
> 
> I meant things like vapic_enable_tpr_reporting(), current CPUState
> could be passed via vapic_prepare() easily.

Oh, there is in fact dead code in vapic_enable_tpr_reporting. It just
iterates over all VCPUs, no need to know the current one.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kiszka <jan.kiszka@web.de>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: "Anthony Liguori" <aliguori@us.ibm.com>,
	"Gleb Natapov" <gleb@redhat.com>,
	kvm@vger.kernel.org, "Marcelo Tosatti" <mtosatti@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>, "Avi Kivity" <avi@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v2 1/8] kvm: Set cpu_single_env only once
Date: Sat, 11 Feb 2012 15:18:16 +0100	[thread overview]
Message-ID: <4F3678A8.60406@web.de> (raw)
In-Reply-To: <CAAu8pHuNArB9hMui2PJdsY9AKsOQ30Q3CnbhADNH+CLnWL0N7w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2412 bytes --]

On 2012-02-11 15:11, Blue Swirl wrote:
> On Sat, Feb 11, 2012 at 14:00, Jan Kiszka <jan.kiszka@web.de> wrote:
>> On 2012-02-11 14:54, Blue Swirl wrote:
>>> On Sat, Feb 11, 2012 at 12:43, Jan Kiszka <jan.kiszka@web.de> wrote:
>>>> On 2012-02-11 12:49, Andreas Färber wrote:
>>>>> Am 11.02.2012 12:25, schrieb Blue Swirl:
>>>>>> I think using cpu_single_env is an indication of a problem, like poor
>>>>>> code, layering violation or poor API (vmport). What is your use case?
>>>>>
>>>>> I couldn't spot any in this series. Jan, note that any new use of env or
>>>>> cpu_single_env will need to be redone when we convert to QOM CPU.
>>>>
>>>> cpu_single_env should have nothing to do with QOM.
>>>>
>>>> The ABIs of vmport and the KVM VAPI require a reference to the calling
>>>> VCPU, and that's why you find tons of them in patch 5.
>>>
>>> Yes, this seems to be another case of a badly designed ABI. I guess
>>> there is no way to change that anymore, just like vmport?
>>
>> Believe me, I grumbled over it more than once while porting it from
>> qemu-kvm. The point is that some (Windows) VMs out there are running
>> already with this option ROM loaded and working this unfortunate ABI.
> 
> Maybe in time those could be deprecated and a ROM using a sane ABI
> introduced instead. After some grace time the old ABI could be finally
> removed.

At some point. But now we have this interface and no other even thought
out. Given that we want to provide a migration path from qemu-kvm to
upstream rather sooner than later, I think there is no way around this
model for a certain, not too short period.

> 
>>>
>>> Some of the cpu_single_env accesses in patch 5 could be avoided when
>>> APIC is moved closer to CPU. VAPIC should be also close to APIC so it
>>> should be able to access the CPU directly. In some other cases the
>>> current state could be passed around instead once it is known.
>>
>> Some callbacks are I/O-port originated, ie. not associated with the
>> per-CPU MMIO area or some MSR. So we would have to pass down the causing
>> CPU to every I/O handler - not sure if that is desired...
> 
> I meant things like vapic_enable_tpr_reporting(), current CPUState
> could be passed via vapic_prepare() easily.

Oh, there is in fact dead code in vapic_enable_tpr_reporting. It just
iterates over all VCPUs, no need to know the current one.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  reply	other threads:[~2012-02-11 14:18 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 18:31 [PATCH v2 0/8] uq/master: TPR access optimization for Windows guests Jan Kiszka
2012-02-10 18:31 ` [Qemu-devel] " Jan Kiszka
2012-02-10 18:31 ` [PATCH v2 1/8] kvm: Set cpu_single_env only once Jan Kiszka
2012-02-10 18:31   ` [Qemu-devel] " Jan Kiszka
2012-02-11 10:02   ` Blue Swirl
2012-02-11 10:02     ` [Qemu-devel] " Blue Swirl
2012-02-11 10:06     ` Jan Kiszka
2012-02-11 10:06       ` [Qemu-devel] " Jan Kiszka
2012-02-11 11:25       ` Blue Swirl
2012-02-11 11:25         ` [Qemu-devel] " Blue Swirl
2012-02-11 11:49         ` Andreas Färber
2012-02-11 11:49           ` [Qemu-devel] " Andreas Färber
2012-02-11 12:43           ` Jan Kiszka
2012-02-11 12:43             ` Jan Kiszka
2012-02-11 13:06             ` Andreas Färber
2012-02-11 13:06               ` [Qemu-devel] " Andreas Färber
2012-02-11 13:07               ` Jan Kiszka
2012-02-11 13:07                 ` Jan Kiszka
2012-02-11 13:21                 ` Andreas Färber
2012-02-11 13:21                   ` Andreas Färber
2012-02-11 13:35                   ` Jan Kiszka
2012-02-11 13:35                     ` [Qemu-devel] " Jan Kiszka
2012-02-11 13:59                     ` Andreas Färber
2012-02-11 13:59                       ` [Qemu-devel] " Andreas Färber
2012-02-11 14:02                       ` Jan Kiszka
2012-02-11 14:02                         ` [Qemu-devel] " Jan Kiszka
2012-02-11 14:12                         ` Andreas Färber
2012-02-11 14:12                           ` Andreas Färber
2012-02-11 14:24                           ` Jan Kiszka
2012-02-11 14:24                             ` Jan Kiszka
2012-02-11 14:49                             ` Andreas Färber
2012-02-11 14:49                               ` [Qemu-devel] " Andreas Färber
2012-02-13  8:17                           ` Paolo Bonzini
2012-02-13  8:17                             ` Paolo Bonzini
2012-02-11 13:54             ` Blue Swirl
2012-02-11 13:54               ` Blue Swirl
2012-02-11 14:00               ` Jan Kiszka
2012-02-11 14:00                 ` [Qemu-devel] " Jan Kiszka
2012-02-11 14:11                 ` Blue Swirl
2012-02-11 14:11                   ` Blue Swirl
2012-02-11 14:18                   ` Jan Kiszka [this message]
2012-02-11 14:18                     ` Jan Kiszka
2012-02-11 14:23                     ` Blue Swirl
2012-02-11 14:23                       ` Blue Swirl
2012-02-11 12:41         ` Jan Kiszka
2012-02-11 12:41           ` [Qemu-devel] " Jan Kiszka
2012-02-10 18:31 ` [PATCH v2 2/8] Allow to use pause_all_vcpus from VCPU context Jan Kiszka
2012-02-10 18:31   ` [Qemu-devel] " Jan Kiszka
2012-02-11 14:16   ` Blue Swirl
2012-02-11 14:16     ` [Qemu-devel] " Blue Swirl
2012-02-11 14:31     ` Jan Kiszka
2012-02-11 14:31       ` [Qemu-devel] " Jan Kiszka
2012-02-10 18:31 ` [PATCH v2 3/8] target-i386: Add infrastructure for reporting TPR MMIO accesses Jan Kiszka
2012-02-10 18:31   ` [Qemu-devel] " Jan Kiszka
2012-02-11 14:32   ` Blue Swirl
2012-02-11 14:32     ` Blue Swirl
2012-02-10 18:31 ` [PATCH v2 4/8] kvmvapic: Add option ROM Jan Kiszka
2012-02-10 18:31   ` [Qemu-devel] " Jan Kiszka
2012-02-10 18:31 ` [PATCH v2 5/8] kvmvapic: Introduce TPR access optimization for Windows guests Jan Kiszka
2012-02-10 18:31   ` [Qemu-devel] " Jan Kiszka
2012-02-11 15:25   ` Blue Swirl
2012-02-11 15:25     ` [Qemu-devel] " Blue Swirl
2012-02-13 10:16     ` Jan Kiszka
2012-02-13 10:16       ` Jan Kiszka
2012-02-13 18:50       ` Blue Swirl
2012-02-13 18:50         ` Blue Swirl
2012-02-13 19:11         ` Gleb Natapov
2012-02-13 19:11           ` Gleb Natapov
2012-02-13 19:22         ` Jan Kiszka
2012-02-13 19:22           ` [Qemu-devel] " Jan Kiszka
2012-02-14  7:54           ` Gleb Natapov
2012-02-14  7:54             ` [Qemu-devel] " Gleb Natapov
2012-02-14  8:55             ` Jan Kiszka
2012-02-14  8:55               ` [Qemu-devel] " Jan Kiszka
2012-02-14  8:59               ` Gleb Natapov
2012-02-14  8:59                 ` [Qemu-devel] " Gleb Natapov
2012-02-10 18:31 ` [PATCH v2 6/8] kvmvapic: Simplify mp/up_set_tpr Jan Kiszka
2012-02-10 18:31   ` [Qemu-devel] " Jan Kiszka
2012-02-10 18:31 ` [PATCH v2 7/8] optionsrom: Reserve space for checksum Jan Kiszka
2012-02-10 18:31   ` [Qemu-devel] " Jan Kiszka
2012-02-11 11:46   ` Andreas Färber
2012-02-11 11:46     ` [Qemu-devel] " Andreas Färber
2012-02-11 12:45     ` Jan Kiszka
2012-02-11 12:45       ` [Qemu-devel] " Jan Kiszka
2012-02-11 12:51       ` Andreas Färber
2012-02-11 12:51         ` [Qemu-devel] " Andreas Färber
2012-02-11 12:57         ` Jan Kiszka
2012-02-11 12:57           ` [Qemu-devel] " Jan Kiszka
2012-02-10 18:31 ` [PATCH v2 8/8] kvmvapic: Use optionrom helpers Jan Kiszka
2012-02-10 18:31   ` [Qemu-devel] " Jan Kiszka

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=4F3678A8.60406@web.de \
    --to=jan.kiszka@web.de \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.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.