From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 2/4] KVM: Add unified KVM_GET/SET_VCPU_STATE IOCTL
Date: Thu, 15 Oct 2009 11:22:28 +0200 [thread overview]
Message-ID: <4AD6E9D4.9050109@siemens.com> (raw)
In-Reply-To: <4AD6D69E.3030408@redhat.com>
Avi Kivity wrote:
> On 10/14/2009 01:06 AM, Jan Kiszka wrote:
>> Add a new IOCTL pair to retrieve or set the VCPU state in one chunk.
>> More precisely, the IOCTL is able to process a list of substates to be
>> read or written. This list is easily extensible without breaking the
>> existing ABI, thus we will no longer have to add new IOCTLs when we
>> discover a missing VCPU state field or want to support new hardware
>> features.
>>
>> This patch establishes the generic infrastructure for KVM_GET/
>> SET_VCPU_STATE and adds support for the generic substates REGS, SREGS,
>> FPU, and MP. To avoid code duplication, the entry point for the
>> corresponding original IOCTLs are converted to make use of the new
>> infrastructure internally, too.
>>
>>
>>
>> +/* for KVM_GET_VCPU_STATE and KVM_SET_VCPU_STATE */
>> +#define KVM_VCPU_REGS 0
>> +#define KVM_VCPU_SREGS 1
>> +#define KVM_VCPU_FPU 2
>> +#define KVM_VCPU_MP 3
>>
>
> KVM_VCPU_STATE_*, to avoid collisions.
OK.
>
> Better to split sse from fpu since we already know it is about to be
> replaced.
The idea is to reuse the existing state structures, including struct
kvm_fpu. This allows to provide the avoid substates for all archs and
simplifies the migration (see my qemu conversion patch). I think, once
we need support for new/wider registers in x86, we can introduce new
KVM_X86_VCPU_STATE_FPU_WHATEVER substates that are able to replace the
old one.
>
>> +
>> +struct kvm_vcpu_substate {
>> + __u32 type;
>> + __u32 pad;
>> + __s64 offset;
>> +};
>> +
>> +#define KVM_MAX_VCPU_SUBSTATES 64
>> +
>> +struct kvm_vcpu_state {
>> + __u32 nsubstates; /* number of elements in substates */
>> + __u32 nprocessed; /* return value: successfully processed substates */
>> + struct kvm_vcpu_substate substates[0];
>> +};
>> +
>>
>
> Wouldn't having an ordinary struct with lots of reserved space be
> simpler? If we add a bitmask, we can even selectively get/set the
> fields we want (important if new state extends old state: avx vs sse).
Simpler - hmm, maybe. But also less flexible. This would establish a
static order inside this constantly growing mega struct. And a user only
interested in something small at its end would still have to allocate
memory for the whole thing (maybe megabytes in the future, who knows?).
And this mega struct will always carry all the legacy substates, even if
they aren't used anymore in practice.
Jan
--
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2009-10-15 9:23 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-13 16:06 [PATCH 0/4] Extensible VCPU state IOCTL Jan Kiszka
2009-10-13 16:06 ` [PATCH 1/4] KVM: Reorder IOCTLs in main kvm.h Jan Kiszka
2009-10-13 16:06 ` [PATCH 3/4] KVM: x86: Add support for KVM_GET/SET_VCPU_STATE Jan Kiszka
2009-10-13 16:06 ` [PATCH 4/4] KVM: x86: Add VCPU substate for NMI states Jan Kiszka
2009-10-15 8:09 ` Avi Kivity
2009-10-15 9:22 ` Jan Kiszka
2009-10-15 9:29 ` Avi Kivity
2009-10-15 11:27 ` Jan Kiszka
2009-10-25 13:11 ` Avi Kivity
2009-10-26 7:40 ` Jan Kiszka
2009-10-13 16:06 ` [PATCH 2/4] KVM: Add unified KVM_GET/SET_VCPU_STATE IOCTL Jan Kiszka
2009-10-15 8:00 ` Avi Kivity
2009-10-15 9:22 ` Jan Kiszka [this message]
2009-10-15 9:33 ` Avi Kivity
2009-10-15 8:07 ` Avi Kivity
2009-10-15 9:22 ` Jan Kiszka
2009-10-15 8:11 ` Avi Kivity
2009-10-15 9:22 ` Jan Kiszka
2009-10-15 14:54 ` Glauber Costa
2009-10-15 15:57 ` Glauber Costa
2009-10-15 16:06 ` Jan Kiszka
2009-10-15 16:23 ` Glauber Costa
2009-10-13 16:18 ` [RFC][PATCH] kvm: x86: Add support for KVM_GET/PUT_VCPU_STATE Jan Kiszka
2009-10-14 8:52 ` [PATCH] qemu-kvm: x86: Add support for NMI states 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=4AD6E9D4.9050109@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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 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).