public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>,
	Carsten Otte <cotte-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 3 of 3] [POWERPC] Implement an ioctl that creates a vcpu of a	particular type
Date: Tue, 05 Feb 2008 13:52:25 +0100	[thread overview]
Message-ID: <47A85C09.5070609@linux.vnet.ibm.com> (raw)
In-Reply-To: <e6e0239e8df55c6af4e0.1202189674@basalt>

Hollis Blanchard wrote:
> The ioctl accepts a core name as input and calls kvm_vm_ioctl_create_vcpu()
> with the corresponding "guest operations" structure. That structure, which
> will be extended with additional core-specific function pointers, is saved into
> the new vcpu by kvm_arch_vcpu_create().
> 
> Signed-off-by: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> 
[..]
> +static struct kvmppc_core_spec kvmppc_supported_guests[] = {
> +	{
> +		.name = "ppc440",
> +		.vcpu_size = sizeof(struct kvm_vcpu),

Just for clarification, here you want to add other configuration settings you want to imply with the set of the cpu core right ?
E.g. we have discussed the pvr initialization on kvm-powerpc-devel and #kvm, do you intend to define the ppv440-pvr we want to set here in this struct?

[...]

> +
> +	if (type.typelen > 32) {
> +		r = -E2BIG;
> +		goto out;
> +	}
> +
> +	coretype = vmalloc(type.typelen);
> +	if (!coretype) {
> +		r = -ENOMEM;
> +		goto out;
> +	}

If I don't overlook something we could use strnlen here instead of type.typelen and not trust userspace in any way (which is always good) that it passes us a good value.


> +	if (copy_from_user(coretype, type.type, type.typelen)) {
> +		r = -EFAULT;
> +		goto out_free;
> +	}
> +	coretype[type.typelen-1] = '\0';
> +

Alltogether I like your patch even if I would have done details very different (and worse) and the main question about all that I wanted to point out is in your [0/3] mail:
"... is this approach acceptable?"
And if not what what would be alternative suggestions to pass information needed for vcpu_create?

> +struct kvm_vcpu_create_type {
> +	__u32 id;
> +	__u32 typelen;
> +	char type[0];
> +};

This should work for other architectures too. While we need to specify cpu cores here others might specify something completely different with the same interface.
So kvm_vcpu_create_type might be misleading while something like kvm_vcpu_create_info might be more generic.
Just to get some background - do anyone else see the need to specify a detail on vcpu_create for their implementation in future ?



Finally I wanted to add something more to think about while we discuss this interface. The approach itself looks good to me, but it might somewhen need an extension we should discuss and decide by now.
Think of the following situation:
a) In two years we might have some generic features which are part of the shared vcpu struct and we would need to specify sometihng for these features on vcpu_create
b) At the same time we would still have our need to specify arch dependent information on vcpu create.
Because the KVM_CREATE_VCPU_TYPE ioctl implies a vcpu create, we would need to set up these new stuff prior to that create in another new call. I think it might be much better if we would think now of how to specify multiple things in this extended vcpu_create.

This might either be done by removing the implicit vcpu creation for a workflow like that:
  1. set generic feature a enabled
  2. set generic feature b disabled
  3. set arch specific core type to foo
  4. create_vcpu (using all that)
Or on the other Hand we might think of a encapsulated or chained information that allows us to pass a variable number of settings with KVM_CREATE_VCPU_TYPE.

-- 

Grüsse / regards, 
Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  reply	other threads:[~2008-02-05 12:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05  5:34 [PATCH 0 of 3] RFC: creating a particular vcpu type Hollis Blanchard
2008-02-05  5:34 ` [PATCH 1 of 3] Pass an opaque parameter through kvm_vm_ioctl_vcpu_create() to kvm_arch_vcpu_create() Hollis Blanchard
2008-02-05  5:34 ` [PATCH 2 of 3] Export kvm_vm_ioctl_create_vcpu() to be called from architecture modules Hollis Blanchard
2008-02-05  5:34 ` [PATCH 3 of 3] [POWERPC] Implement an ioctl that creates a vcpu of a particular type Hollis Blanchard
2008-02-05 12:52   ` Christian Ehrhardt [this message]
     [not found]     ` <47A85C09.5070609-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2008-02-05 13:41       ` Carsten Otte
     [not found]         ` <47A86794.4020408-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2008-02-05 14:03           ` Carsten Otte
2008-02-05 15:13       ` Hollis Blanchard
2008-02-05 16:44 ` [PATCH 0 of 3] RFC: creating a particular vcpu type Anthony Liguori
     [not found]   ` <47A89285.40802-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-02-05 17:53     ` Hollis Blanchard
2008-02-05 18:05       ` Anthony Liguori
     [not found]         ` <47A8A582.5060502-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-02-05 19:23           ` Hollis Blanchard
2008-02-05 19:32             ` Anthony Liguori
2008-02-11  8:23               ` Avi Kivity

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=47A85C09.5070609@linux.vnet.ibm.com \
    --to=ehrhardt-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=cotte-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org \
    --cc=hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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