From: "Michael S. Tsirkin" <mst@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, armbru@redhat.com,
afaerber@suse.de, ehabkost@redhat.com
Subject: Re: [Qemu-devel] [PATCH] pc: fix crash in rtc_set_memory() if initial cpu is marked as hotplugged
Date: Tue, 10 Jan 2017 05:15:32 +0200 [thread overview]
Message-ID: <20170110051515-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1483108391-199542-1-git-send-email-imammedo@redhat.com>
On Fri, Dec 30, 2016 at 03:33:11PM +0100, Igor Mammedov wrote:
> 'hotplugged' propperty is meant to be used on migration side when migrating
> source with hotplugged devices.
> However though it not exacly correct usage of 'hotplugged' property
> it's possible to set generic hotplugged property for CPU using
> -cpu foo,hotplugged=on
> or
> -global foo.hotplugged=on
>
> in this case qemu crashes with following backtrace:
>
> ...
>
> because pc_cpu_plug() assumes that hotplugged CPU could appear only after
> rtc/fw_cfg are initialized.
> Fix crash by replacing assumption with explicit checks of rtc/fw_cfg
> and updating them only if they were initialized.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> Reported-by: Eduardo Habkost <ehabkost@redhat.com>
Looks like Paolo is merging this.
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/i386/pc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index f3d7ad4..7b7e126 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1810,8 +1810,10 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev,
>
> /* increment the number of CPUs */
> pcms->boot_cpus++;
> - if (dev->hotplugged) {
> + if (pcms->rtc) {
> rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus);
> + }
> + if (pcms->fw_cfg) {
> fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus);
> }
>
> --
> 2.7.4
prev parent reply other threads:[~2017-01-10 3:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-30 14:33 [Qemu-devel] [PATCH] pc: fix crash in rtc_set_memory() if initial cpu is marked as hotplugged Igor Mammedov
2016-12-30 18:34 ` Eduardo Habkost
2017-01-02 17:04 ` Paolo Bonzini
2017-01-10 3:15 ` Michael S. Tsirkin [this message]
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=20170110051515-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@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 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.