qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Glauber Costa <glommer@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Anthony Liguori <aliguori@linux.vnet.ibm.com>,
	Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 28/35] kvm: x86: Introduce kvmclock device to save/restore its state
Date: Thu, 20 Jan 2011 22:53:59 +0100	[thread overview]
Message-ID: <4D38AEF7.8030506@web.de> (raw)
In-Reply-To: <AANLkTi=pHKSgpJb7k8b2aGY5zggwcut=VCEouqhnS9LE@mail.gmail.com>

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

On 2011-01-20 22:40, Blue Swirl wrote:
> On Thu, Jan 20, 2011 at 9:22 PM, Jan Kiszka <jan.kiszka@web.de> wrote:
>> On 2011-01-20 20:27, Blue Swirl wrote:
>>> On Thu, Jan 20, 2011 at 9:33 AM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>>> On 2011-01-19 20:32, Blue Swirl wrote:
>>>>> On Wed, Jan 19, 2011 at 4:57 PM, Anthony Liguori
>>>>> <aliguori@linux.vnet.ibm.com> wrote:
>>>>>> On 01/19/2011 07:15 AM, Markus Armbruster wrote:
>>>>>>>
>>>>>>> So they interact with KVM (need kvm_state), and they interact with the
>>>>>>> emulated PCI bus.  Could you elaborate on the fundamental difference
>>>>>>> between the two interactions that makes you choose the (hypothetical)
>>>>>>> KVM bus over the PCI bus as device parent?
>>>>>>>
>>>>>>
>>>>>> It's almost arbitrary, but I would say it's the direction that I/Os flow.
>>>>>>
>>>>>> But if the underlying observation is that the device tree is not really a
>>>>>> tree, you're 100% correct.  This is part of why a factory interface that
>>>>>> just takes a parent bus is too simplistic.
>>>>>>
>>>>>> I think we ought to introduce a -pci-device option that is specifically for
>>>>>> creating PCI devices that doesn't require a parent bus argument but provides
>>>>>> a way to specify stable addressing (for instancing, using a linear index).
>>>>>
>>>>> I think kvm_state should not be a property of any device or bus. It
>>>>> should be split to more logical pieces.
>>>>>
>>>>> Some parts of it could remain in CPUState, because they are associated
>>>>> with a VCPU.
>>>>>
>>>>> Also, for example irqfd could be considered to be similar object to
>>>>> char or block devices provided by QEMU to devices. Would it make sense
>>>>> to introduce new host types for passing parts of kvm_state to devices?
>>>>>
>>>>> I'd also make coalesced MMIO stuff part of memory object. We are not
>>>>> passing any state references when using cpu_physical_memory_rw(), but
>>>>> that could be changed.
>>>>
>>>> There are currently no VCPU-specific bits remaining in kvm_state.
>>>
>>> I think fields vcpu_events, robust_singlestep, debugregs,
>>> kvm_sw_breakpoints, xsave, xcrs belong to CPUX86State. They may be the
>>> same for all VCPUs but still they are sort of CPU properties. I'm not
>>> sure about fd field.
>>
>> They are all properties of the currently loaded KVM subsystem in the
>> host kernel. They can't change while KVM's root fd is opened.
>> Replicating this static information into each and every VCPU state would
>> be crazy.
> 
> Then each CPUX86State could have a pointer to common structure.

That already exists.

> 
>> In fact, services like kvm_has_vcpu_events() already encode this: they
>> are static functions without any kvm_state reference that simply return
>> the content of those fields. Totally inconsistent to this, we force the
>> caller of kvm_check_extension to pass a handle. This is part of my
>> problem with the current situation and any halfhearted steps in this
>> context. Either we work towards eliminating "static KVMState *kvm_state"
>> in kvm-all.c or eliminating KVMState.
> 
> If the CPU related fields are accessible through CPUState, the handle
> should be available.
> 
>>>> It may
>>>> be a good idea to introduce an arch-specific kvm_state and move related
>>>> bits over.
>>>
>>> This should probably contain only irqchip_in_kernel, pit_in_kernel and
>>> many_ioeventfds, maybe fd.
>>
>> fd is that root file descriptor you need for a few KVM services that are
>> not bound to a specific VM - e.g. feature queries. It's not arch
>> specific. Arch specific are e.g. robust_singlestep or xsave feature states.
> 
> By arch you mean guest CPU architecture? They are not machine features.

No, they are practically static host features.

> 
>>>
>>>> It may also once be feasible to carve out memory management
>>>> related fields if we have proper abstractions for that, but I'm not
>>>> completely sure here.
>>>
>>> I'd put slots, vmfd, coalesced_mmio, broken_set_mem_region,
>>> migration_log into the memory object.
>>
>> vmfd is the VM-scope file descriptor you need at machine-level. The rest
>> logically belongs to a memory object, but I haven't looked at technical
>> details yet.
>>
>>>
>>>> Anyway, all these things are secondary. The primary topic here is how to
>>>> deal with kvm_state and its fields that have VM-global scope.
>>>
>>> If it is an opaque blob which contains various unrelated stuff, no
>>> clear place will be found.
>>
>> We aren't moving fields yet (and we shouldn't). We first of all need to
>> establish the handle distribution (which apparently requires quite some
>> work in areas beyond KVM).
> 
> But I think this is exactly  the problem. If the handle is for the
> current KVMState, you'll indeed need it in various places and passing
> it around will be cumbersome. By moving the fields around, the
> information should  be available more naturally.

Yeah, if we had a MachineState or if we could agree on introducing it,
I'm with you again. Improving the currently cumbersome KVM API
interaction was the main motivation for my original patch.

Jan


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

  reply	other threads:[~2011-01-20 21:54 UTC|newest]

Thread overview: 152+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06 17:56 [Qemu-devel] [PATCH 00/35] [PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 01/35] kvm: Enable user space NMI injection for kvm guest Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 02/35] kvm: convert kvm_ioctl(KVM_CHECK_EXTENSION) to kvm_check_extension() Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 03/35] Clean up cpu_inject_x86_mce() Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 04/35] Add "broadcast" option for mce command Marcelo Tosatti
2011-01-09 18:51   ` [Qemu-devel] " Jan Kiszka
2011-01-15 16:24     ` Jan Kiszka
2011-01-06 17:56 ` [Qemu-devel] [PATCH 05/35] Add function for checking mca broadcast of CPU Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 06/35] kvm: introduce kvm_mce_in_progress Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 07/35] kvm: kvm_mce_inj_* subroutines for templated error injections Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 08/35] kvm: introduce kvm_inject_x86_mce_on Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 09/35] kvm: x86: Fix DPL write back of segment registers Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 10/35] kvm: x86: Remove obsolete SS.RPL/DPL aligment Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 11/35] kvm: x86: Prevent sign extension of DR7 in guest debugging mode Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 12/35] kvm: x86: Fix a few coding style violations Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 13/35] kvm: Fix " Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 14/35] kvm: Drop return value of kvm_cpu_exec Marcelo Tosatti
2011-01-08 13:09   ` [Qemu-devel] " Jan Kiszka
2011-01-06 17:56 ` [Qemu-devel] [PATCH 15/35] kvm: Stop on all fatal exit reasons Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 16/35] kvm: Improve reporting of fatal errors Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 17/35] x86: Optionally dump code bytes on cpu_dump_state Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 18/35] kvm: x86: Align kvm_arch_put_registers code with comment Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 19/35] kvm: x86: Prepare kvm_get_mp_state for in-kernel irqchip Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 20/35] kvm: x86: Remove redundant mp_state initialization Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 21/35] kvm: x86: Fix xcr0 reset mismerge Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 22/35] kvm: x86: Refactor msr_star/hsave_pa setup and checks Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 23/35] kvm: x86: Reset paravirtual MSRs Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 24/35] Synchronize VCPU states before reset Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 25/35] kvm: x86: Drop MCE MSRs write back restrictions Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 26/35] kvm: Eliminate KVMState arguments Marcelo Tosatti
2011-01-06 19:24   ` [Qemu-devel] " Anthony Liguori
2011-01-07  9:03     ` Jan Kiszka
2011-01-07 23:27       ` Anthony Liguori
2011-01-08  8:47         ` Jan Kiszka
2011-01-10 19:59           ` Anthony Liguori
2011-01-10 20:12             ` Jan Kiszka
2011-01-10 20:23               ` Anthony Liguori
2011-01-10 20:34                 ` Jan Kiszka
2011-01-11  9:01                 ` Avi Kivity
2011-01-11 14:00                   ` Anthony Liguori
2011-01-11 14:06                     ` Alexander Graf
2011-01-11 14:09                       ` Anthony Liguori
2011-01-11 14:22                         ` Avi Kivity
2011-01-11 14:36                           ` Anthony Liguori
2011-01-11 14:56                             ` Avi Kivity
2011-01-11 15:12                               ` Anthony Liguori
2011-01-11 15:17                                 ` Alexander Graf
2011-01-11 15:37                                 ` Avi Kivity
2011-01-11 15:55                                   ` Anthony Liguori
2011-01-11 16:03                                     ` Avi Kivity
2011-01-11 16:26                                       ` Anthony Liguori
2011-01-11 17:05                                         ` Avi Kivity
2011-01-11 14:24                         ` Alexander Graf
2011-01-11 14:18                     ` Avi Kivity
2011-01-11 14:28                       ` Anthony Liguori
2011-01-11 14:52                         ` Avi Kivity
2011-01-10 20:11           ` Anthony Liguori
2011-01-10 20:15             ` Jan Kiszka
2011-01-11  9:17             ` Avi Kivity
2011-01-06 17:56 ` [Qemu-devel] [PATCH 27/35] kvm: x86: Fix !CONFIG_KVM_PARA build Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 28/35] kvm: x86: Introduce kvmclock device to save/restore its state Marcelo Tosatti
2011-01-10 20:31   ` Anthony Liguori
2011-01-10 21:06     ` Jan Kiszka
2011-01-10 22:21       ` Jan Kiszka
2011-01-10 23:02         ` Anthony Liguori
2011-01-11  5:54           ` Jan Kiszka
2011-01-11  8:00         ` Paolo Bonzini
2011-01-11  8:53         ` Gerd Hoffmann
2011-01-11 17:13           ` Jan Kiszka
2011-01-11  9:31         ` Markus Armbruster
2011-01-11 13:54           ` Anthony Liguori
2011-01-12 10:22             ` Avi Kivity
2011-01-12 10:31               ` Jan Kiszka
2011-01-18 14:28                 ` Jan Kiszka
2011-01-18 15:04                   ` Anthony Liguori
2011-01-18 15:43                     ` Jan Kiszka
2011-01-18 15:48                       ` Anthony Liguori
2011-01-18 15:54                         ` Jan Kiszka
2011-01-18 17:02                           ` Alex Williamson
2011-01-18 17:08                             ` Jan Kiszka
2011-01-18 17:39                               ` Alex Williamson
2011-01-18 15:50                       ` Anthony Liguori
2011-01-18 16:01                         ` Jan Kiszka
2011-01-18 16:04                           ` Anthony Liguori
2011-01-18 16:17                             ` Jan Kiszka
2011-01-18 16:37                               ` Anthony Liguori
2011-01-18 16:56                                 ` Jan Kiszka
2011-01-18 17:09                                   ` Anthony Liguori
2011-01-18 17:20                                     ` Jan Kiszka
2011-01-18 17:31                                       ` Anthony Liguori
2011-01-18 17:45                                         ` Jan Kiszka
2011-01-19  9:48                                     ` Gerd Hoffmann
2011-01-19 13:11                                       ` Markus Armbruster
2011-01-19 16:54                                         ` Anthony Liguori
2011-01-19 17:19                                           ` Daniel P. Berrange
2011-01-19 17:43                                             ` Anthony Liguori
2011-01-20  8:44                                               ` Gerd Hoffmann
2011-01-20 10:33                                                 ` Daniel P. Berrange
2011-01-20 19:42                                                   ` Anthony Liguori
2011-01-20 19:39                                                 ` Anthony Liguori
2011-01-21  8:35                                                   ` Gerd Hoffmann
2011-01-21 10:03                                                     ` Markus Armbruster
2011-01-19 16:53                                       ` Anthony Liguori
2011-01-19 17:01                                         ` Daniel P. Berrange
2011-01-19 17:51                                           ` Anthony Liguori
2011-01-19 18:52                                             ` Daniel P. Berrange
2011-01-19 18:58                                               ` Anthony Liguori
2011-01-19 17:35                                         ` Daniel P. Berrange
2011-01-19 17:42                                           ` Anthony Liguori
2011-01-19 18:53                                             ` Daniel P. Berrange
2011-01-19 13:09                                     ` Markus Armbruster
2011-01-24  8:45                                     ` Gleb Natapov
2011-01-19 13:15                         ` Markus Armbruster
2011-01-19 16:57                           ` Anthony Liguori
2011-01-19 17:25                             ` Jan Kiszka
2011-01-19 19:32                             ` Blue Swirl
2011-01-20  9:33                               ` Jan Kiszka
2011-01-20 19:27                                 ` Blue Swirl
2011-01-20 21:22                                   ` Jan Kiszka
2011-01-20 21:40                                     ` Blue Swirl
2011-01-20 21:53                                       ` Jan Kiszka [this message]
2011-01-25 11:10                                     ` Avi Kivity
2011-01-21  8:46                                   ` Gerd Hoffmann
2011-01-21 10:05                                     ` Markus Armbruster
2011-01-21 16:37                                     ` Blue Swirl
2011-01-21 17:21                                       ` Jan Kiszka
2011-01-21 18:04                                         ` Blue Swirl
2011-01-21 18:17                                           ` Jan Kiszka
2011-01-21 18:49                                             ` Blue Swirl
2011-01-24 14:08                                               ` Jan Kiszka
2011-01-24 21:35                                                 ` Blue Swirl
2011-01-24 21:57                                                   ` Jan Kiszka
2011-01-20 19:37                                 ` Anthony Liguori
2011-01-20 20:02                                   ` Blue Swirl
2011-01-20 21:42                                     ` Jan Kiszka
2011-01-20 21:27                                   ` Jan Kiszka
2011-01-25 11:06                             ` Avi Kivity
2011-01-25 14:30                               ` Anthony Liguori
2011-01-25 10:34                         ` Avi Kivity
2011-01-25 10:27                   ` Avi Kivity
2011-01-25 13:58                     ` Anthony Liguori
2011-01-12 12:04               ` Markus Armbruster
2011-01-10 23:04       ` Anthony Liguori
2011-01-11  5:55         ` Jan Kiszka
2011-01-06 17:56 ` [Qemu-devel] [PATCH 29/35] kvm: Drop smp_cpus argument from init functions Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 30/35] kvm: Consolidate must-have capability checks Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 31/35] kvm: x86: Rework identity map and TSS setup for larger BIOS sizes Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 32/35] kvm: Flush coalesced mmio buffer on IO window exits Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 33/35] kvm: Do not use qemu_fair_mutex Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 34/35] kvm: x86: Implicitly clear nmi_injected/pending on reset Marcelo Tosatti
2011-01-06 17:56 ` [Qemu-devel] [PATCH 35/35] kvm: x86: Only read/write MSR_KVM_ASYNC_PF_EN if supported Marcelo Tosatti
2011-01-27 14:39 ` [Qemu-devel] [PATCH] kvm: x86: Fix build in absence of KVM_CAP_ASYNC_PF 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=4D38AEF7.8030506@web.de \
    --to=jan.kiszka@web.de \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=armbru@redhat.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=glommer@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 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).