All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Glauber Costa <glommer@redhat.com>
Cc: kvm@vger.kernel.org, aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [PATCH] return default values for apic probe functions.
Date: Sun, 19 Apr 2009 11:45:13 +0300	[thread overview]
Message-ID: <49EAE499.4010203@redhat.com> (raw)
In-Reply-To: <1239945321-3903-1-git-send-email-glommer@redhat.com>

Glauber Costa wrote:
> As KVM cpus runs on threads, it is possible that
> we call kvm_load_registers() from a cpu thread, while the
> apic has not yet fully initialized. kvm_load_registers() is called
> from ap_main_loop.
>
> This is not a problem when we're starting the whole machine together,
> but is a problem for hotplug, since we don't have the protection
> of the locks that protect machine initialization. Currently, some executions
> of cpu hotplug on rainy sundays fail with a segfault.
>
> Moving apic initialization to before kvm_init_vpcu proved fruitful,
> as there are some dependencies involved. (kvm irqchip would fail to
> initialize).
>   

I presume you mean unfruitful (or perhaps a nasty kind of fruit).

> This patch provides default values to be used for tpr and apic_base,
> that will be returned when the apic is not yet properly initialized.
> It is aimed at kvm, where the problem exists, but it could equally be
> used for qemu too, if there is agreement.
>   

Seems like a hack... can you try not to make the vcpu visible until it 
is completely initialized?

(and what is the problem exactly - someone accessing the registers from 
a different thread? that shouldn't happen)

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


WARNING: multiple messages have this Message-ID (diff)
From: Avi Kivity <avi@redhat.com>
To: Glauber Costa <glommer@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] Re: [PATCH] return default values for apic probe functions.
Date: Sun, 19 Apr 2009 11:45:13 +0300	[thread overview]
Message-ID: <49EAE499.4010203@redhat.com> (raw)
In-Reply-To: <1239945321-3903-1-git-send-email-glommer@redhat.com>

Glauber Costa wrote:
> As KVM cpus runs on threads, it is possible that
> we call kvm_load_registers() from a cpu thread, while the
> apic has not yet fully initialized. kvm_load_registers() is called
> from ap_main_loop.
>
> This is not a problem when we're starting the whole machine together,
> but is a problem for hotplug, since we don't have the protection
> of the locks that protect machine initialization. Currently, some executions
> of cpu hotplug on rainy sundays fail with a segfault.
>
> Moving apic initialization to before kvm_init_vpcu proved fruitful,
> as there are some dependencies involved. (kvm irqchip would fail to
> initialize).
>   

I presume you mean unfruitful (or perhaps a nasty kind of fruit).

> This patch provides default values to be used for tpr and apic_base,
> that will be returned when the apic is not yet properly initialized.
> It is aimed at kvm, where the problem exists, but it could equally be
> used for qemu too, if there is agreement.
>   

Seems like a hack... can you try not to make the vcpu visible until it 
is completely initialized?

(and what is the problem exactly - someone accessing the registers from 
a different thread? that shouldn't happen)

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

  parent reply	other threads:[~2009-04-19  8:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17  5:15 [PATCH] return default values for apic probe functions Glauber Costa
2009-04-17  5:15 ` [Qemu-devel] " Glauber Costa
2009-04-17  6:56 ` Jan Kiszka
2009-04-17  6:56   ` [Qemu-devel] " Jan Kiszka
2009-04-17 13:22   ` Glauber Costa
2009-04-17 13:22     ` [Qemu-devel] " Glauber Costa
2009-04-17 13:40     ` Glauber Costa
2009-04-17 13:40       ` [Qemu-devel] " Glauber Costa
2009-04-17 14:15       ` Jan Kiszka
2009-04-17 14:15         ` [Qemu-devel] " Jan Kiszka
2009-04-17 13:53 ` Marcelo Tosatti
2009-04-17 13:53   ` [Qemu-devel] " Marcelo Tosatti
2009-04-17 13:59   ` Glauber Costa
2009-04-17 13:59     ` [Qemu-devel] " Glauber Costa
2009-04-17 14:18     ` Marcelo Tosatti
2009-04-17 14:18       ` [Qemu-devel] " Marcelo Tosatti
2009-04-19  8:45 ` Avi Kivity [this message]
2009-04-19  8:45   ` 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=49EAE499.4010203@redhat.com \
    --to=avi@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=glommer@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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.