qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Greg Kurz <groug@kaod.org>,
	qemu-devel@nongnu.org, mst@redhat.com, pbonzini@redhat.com,
	david@redhat.com, cohuck@redhat.com
Subject: Re: [Qemu-devel] [PATCH] pc: make sure that guest isn't able to unplug the first cpu
Date: Tue, 28 Aug 2018 15:18:48 +0200	[thread overview]
Message-ID: <20180828151848.3d09ca06@redhat.com> (raw)
In-Reply-To: <20180828005237.GC2222@umbus.fritz.box>

On Tue, 28 Aug 2018 10:52:37 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:

> On Mon, Aug 27, 2018 at 04:02:39PM +0200, Greg Kurz wrote:
> > On Mon, 27 Aug 2018 13:07:10 +0200
> > Igor Mammedov <imammedo@redhat.com> wrote:
> >   
> > > The first cpu unplug wasn't ever supported and corresponding
> > > monitor/qmp commands refuse to unplug it. However guest is able
> > > to issue eject request either using following command:
> > >   # echo 1 >/sys/devices/system/cpu/cpu0/firmware_node/eject  
> > 
> > I can't reproduce the issue with a pc guest and current master...
> > 
> > All I seem to get is an error in dmesg:
> > 
> > [   97.435446] processor cpu0: Offline failed.
> >   
> > > or directly writing to cpu hotplug registers, which makes
> > > qemu crash with SIGSEGV following back trace:
> > > 
> > >    kvm_flush_coalesced_mmio_buffer ()
> > >        while (ring->first != ring->last)
> > >    ...
> > >    qemu_flush_coalesced_mmio_buffer
> > >    prepare_mmio_access
> > >    flatview_read_continue
> > >    flatview_read
> > >    address_space_read_full
> > >    address_space_rw
> > >    kvm_cpu_exec(cpu!0)
> > >    qemu_kvm_cpu_thread_fn
> > > 
> > > the reason for which is that ring == KVMState::coalesced_mmio_ring
> > > happens to be a part of 1st CPU that was uplugged by guest.
> > > 
> > > Fix it by forbidding 1st cpu unplug from guest side and in addition
> > > remove CPU0._EJ0 ACPI method to make clear that unplug of the first
> > > CPU is not supported.
> > > 
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > > CCing spapr and s390x folks in case targets need to prevent 1st CPU unplug as well
> > >   
> > 
> > A spapr guest can _release_ the first cpu by doing something like:
> > 
> > # echo -n "/cpus/PowerPC,POWER8@0" > /sys/devices/system/cpu/release
> > 
> > But AFAIK, this doesn't unplug the cpu from a QEMU standpoint.  
> 
> Unplugging CPU 0 with device_del should be ok too.
Do you mean real unplugging (cpu0 object freed) or just remove request?

  reply	other threads:[~2018-08-28 13:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27 11:07 [Qemu-devel] [PATCH] pc: make sure that guest isn't able to unplug the first cpu Igor Mammedov
2018-08-27 11:10 ` David Hildenbrand
2018-08-27 14:02 ` Greg Kurz
2018-08-27 14:25   ` Igor Mammedov
2018-08-28  0:52   ` David Gibson
2018-08-28 13:18     ` Igor Mammedov [this message]
2018-08-29  2:54       ` David Gibson
2018-08-29  8:43         ` Igor Mammedov
2018-08-29 13:15           ` Michael S. Tsirkin
2018-08-29 13:51             ` Igor Mammedov
2018-08-29 15:23               ` Laszlo Ersek
2018-09-07 20:52               ` Michael S. Tsirkin
2018-09-10  8:21                 ` Igor Mammedov

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=20180828151848.3d09ca06@redhat.com \
    --to=imammedo@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=groug@kaod.org \
    --cc=mst@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 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).