From: Marcelo Tosatti <mtosatti@redhat.com>
To: Carsten Otte <cotte@de.ibm.com>
Cc: Avi Kivity <avi@redhat.com>, KVM mailing list <kvm@vger.kernel.org>
Subject: Re: [PATCH 3/3] kvm common: verify that cpu slot is available when creating new vcpu
Date: Sun, 8 Feb 2009 04:26:16 -0200 [thread overview]
Message-ID: <20090208062616.GD4437@amt.cnet> (raw)
In-Reply-To: <20090205170501.2a964172@cotte.boeblingen.de.ibm.com>
On Thu, Feb 05, 2009 at 05:05:01PM +0100, Carsten Otte wrote:
> KVM common code should'nt try to create the same virtual cpu twice.
> In case of s390, it crashes badly in kvm_arch_vcpu_create.
>
> Reported-by: Mijo Safradin <mijo@linux.vnet.ibm.com>
> Signed-off-by: Carsten Otte <cotte@de.ibm.com>
> ---
> virt/kvm/kvm_main.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> Index: kvm/virt/kvm/kvm_main.c
> ===================================================================
> --- kvm.orig/virt/kvm/kvm_main.c
> +++ kvm/virt/kvm/kvm_main.c
> @@ -1605,6 +1605,9 @@ static int kvm_vm_ioctl_create_vcpu(stru
> if (!valid_vcpu(n))
> return -EINVAL;
>
> + if (kvm->vcpus[i])
> + return -EEXIST;
> +
> vcpu = kvm_arch_vcpu_create(kvm, n);
> if (IS_ERR(vcpu))
> return PTR_ERR(vcpu);
Its confusing that there is the exact same check below, with kvm->lock
held, and that both are needed since assignment happens under the lock.
Can you also make it straightforward while fixing the bug please.
Probably just hold it all the way through kvm_vm_ioctl_create_vcpu? Or
is that not possible?
next prev parent reply other threads:[~2009-02-08 6:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 16:01 [PATCH 1/3] kvm-s390: fix registering memory regions while vcpus do exist Carsten Otte
2009-02-05 16:03 ` [PATCH 2/3] kvm-s390: verify that memory slot is present for vm in kvm_run Carsten Otte
2009-02-05 16:05 ` [PATCH 3/3] kvm common: verify that cpu slot is available when creating new vcpu Carsten Otte
2009-02-05 16:32 ` Carsten Otte
2009-02-05 16:40 ` [PATCH 3/3 v2] " Carsten Otte
2009-02-08 6:26 ` Marcelo Tosatti [this message]
2009-02-08 9:47 ` [PATCH 3/3] " Avi Kivity
2009-02-09 10:26 ` Carsten Otte
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=20090208062616.GD4437@amt.cnet \
--to=mtosatti@redhat.com \
--cc=avi@redhat.com \
--cc=cotte@de.ibm.com \
--cc=kvm@vger.kernel.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