From: "Michael S. Tsirkin" <mst@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: drjones@redhat.com, ehabkost@redhat.com, rkrcmar@redhat.com,
armbru@redhat.com, qemu-devel@nongnu.org, marcel@redhat.com
Subject: Re: [Qemu-devel] [PATCH 15/33] docs: update ACPI CPU hotplug spec with new protocol
Date: Wed, 1 Jun 2016 00:09:57 +0300 [thread overview]
Message-ID: <20160531210957.GA22560@redhat.com> (raw)
In-Reply-To: <20160531170741.6f3c4472@nial.brq.redhat.com>
On Tue, May 31, 2016 at 05:07:41PM +0200, Igor Mammedov wrote:
> On Tue, 31 May 2016 07:49:16 +0300
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > On Tue, May 17, 2016 at 04:43:07PM +0200, Igor Mammedov wrote:
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > > docs/specs/acpi_cpu_hotplug.txt | 88 +++++++++++++++++++++++++++++++++++------
> > > 1 file changed, 76 insertions(+), 12 deletions(-)
> > >
> > > diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.txt
> > > index 340b751..c5bce6a 100644
> > > --- a/docs/specs/acpi_cpu_hotplug.txt
> > > +++ b/docs/specs/acpi_cpu_hotplug.txt
> > > @@ -4,21 +4,85 @@ QEMU<->ACPI BIOS CPU hotplug interface
> > > QEMU supports CPU hotplug via ACPI. This document
> > > describes the interface between QEMU and the ACPI BIOS.
> > >
> > > -ACPI GPE block (IO ports 0xafe0-0xafe3, byte access):
> > > ------------------------------------------
> > > -
> > > -Generic ACPI GPE block. Bit 2 (GPE.2) used to notify CPU
> > > -hot-add/remove event to ACPI BIOS, via SCI interrupt.
> > > +ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add
> > > +and hot-remove events.
> > >
> > > +============================================
> > > +Legacy ACPI CPU hotplug interface registers:
> > > +--------------------------------------------
> > > CPU present bitmap for:
> > > + One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only.
> > > ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access)
> > > PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access)
> > > ---------------------------------------------------------------
> > > -One bit per CPU. Bit position reflects corresponding CPU APIC ID.
> > > -Read-only.
> > > +QEMU sets corresponding CPU bit on hot-add event and issues SCI
> > > +with GPE.2 event set. CPU present map read by ACPI BIOS GPE.2 handler
> > > +to notify OS about CPU hot-add events. CPU hot-remove isn't supported.
> > > +
> > > +=====================================
> > > +ACPI CPU hotplug interface registers:
> > > +-------------------------------------
> > > +Register block base address:
> > > + ICH9-LPC IO port 0x0cd8
> > > + PIIX-PM IO port 0xaf00
> >
> > OK but this means we either use legacy or new one,
> > bot both, which is problematic for people using old seabios
> > without acpi loading support and with -M pc.
> >
> > I don't say we must support them with >255 CPUs,
> > but I do say we should make an effort for simple
> > setups with <255 CPUs.
>
>
> it works with QEMU provided(shipped) BIOS,
> it works for migration case as legacy stays enables because of -M src_legacy_machine
>
> more that 255 cpus will break old BIOS in different
> ways /corrupt/hang/ depending on BIOS version.
>
> I'm not sure we should care about using old BIOS
> with new QEMU+new machine type though and allow
> expectations to be beyond what hw vendors usually set.
> It's the same as real hw does i.e. new hardware
> shipped with new BIOS.
> If user insist on old BIOS+new machine type he still has
> property knob to force legacy mode.
>
> on the fist glance, it's probably not that very hard
> to switch IO ports handling from legacy to new interface
> by sending from new cpu-hotplug AML a command to do so,
> my concerns here is:
> * +1 more state to migrate
> * probably issues with migration as target started with
> different IO layout
> * IO window freed after switching from legacy to new,
> will not be available to guest as it started with
> legacy window consumed by CPUS.CRS.
> * that legacy switching business is only PC specific
> means having a knob to turn it on so it won't pollute ARM
>
> all in all it's probably too much headache to make sure
> that improbable usecase would work, so after considering
> this idea I've dropped it and did it the way it's now.
Well I think it's worth the effort. I agree it's tricky
to implement but we do maintain compatibility for years.
Being orthogonal with bios version is very helpful for
a variety of reasons such as debugging.
> > > +Register block size:
> > > + ACPI_CPU_HOTPLUG_REG_LEN = 12
> > > +
> > > +read access:
> >
> > So this implies acpi must scan all cpus on each event, and
> > this seems too aggressive.
> > I think we need something hierarchical where
> > you read one level and know which cpus to probe.
> That's what we do for mem-hotplug as it's not
> performance critical path.
>
> In addition to that depending on guest OS/version
> it will anyway do enumeration of all CPUs after
> our hotplug AML method scanned all CPUs and
> sent notifies.
>
> not that I'm in favor of complicating this protocol,
> but I wouldn't do it hierarchical,
> that's what Notify(BUS_CHECK) is supposed to do
> but it's broken on some guests.
Interesting. Which ones? Would they be easy to detect?
> So if I'd do a more complicated protocol,
> I'd do polling from AML side telling QEMU
> if (cpu = give_me_next_cpu_with_event())
> switch_to_cpu(cpu)
> ...
>
> that means adding extra state to migrate,
> probably ther might be other issues I'm not aware of yet.
>
> On the other hand mem-hotplug like interface
> so far hasn't caused any issues
> (that of cause doesn't mean that there aren't any).
>
> > > + offset:
> > > + [0x0-0x3] reserved
> > > + [0x4] CPU device status fields: (1 byte access)
> > > + bits:
> > > + 0: Device is enabled and may be used by guest
> > > + 1: Device insert event, used to distinguish device for which
> > > + no device check event to OSPM was issued.
> > > + It's valid only when bit 0 is set.
> > > + 2: Device remove event, used to distinguish device for which
> > > + no device eject request to OSPM was issued.
> > > + 3-7: reserved and should be ignored by OSPM
> > > + [0x5-0x7] reserved
> > > + [0x8] Command data: (DWORD access)
> > > + in case of error or unsupported command reads is 0xFFFFFFFF
> > > + current 'Command field' value:
> > > + 0: returns PXM value corresponding to device
> > > +
> > > +write access:
> > > + offset:
> > > + [0x0-0x3] CPU selector: (DWORD access)
> > > + selects active CPU device. All following accesses to other
> > > + registers will read/store data from/to selected CPU.
> >
> > I've been thinking - is it time to add an EmbeddedControl interface?
> > This way we have another namespace.
>
> There were patches on list with it some time ago
>
> "[PATCH RFC v2 0/7] coordinate cpu hotplug/unplug bewteen QEMU and kernel by EC"
>
> but we dropped it as bloatware because there weren't any
> real need for it as current IO port interfaces aren't
> going away any time soon and work just fine without EC.
Right. But now you are removing them for >255 CPUs
anyway.
> And if we were to move current interfaces into EC namespace
> we would have to do it only for new machines types
> and keep old code in place as well and a bunch of compat
> code for a company.
Hmm. Exactly like this current one?
> > Not insisting on it, just an idea.
> I wouldn't make it a necessary dependency and block this series.
> Might be worth to look at again when there is usecases for it
> without legacy stuff attached.
and then we'll have to maintain 3 interfaces?
> >
> > > + [0x4] CPU device control fields: (1 byte access)
> > > + bits:
> > > + 0: reserved, OSPM must clear it before writing to register.
> > > + 1: if set to 1 clears device insert event, set by OSPM
> > > + after it has emitted device check event for the
> > > + selected CPU device
> > > + 2: if set to 1 clears device remove event, set by OSPM
> > > + after it has emitted device eject request for the
> > > + selected CPU device
> > > + 3: if set to 1 initiates device eject, set by OSPM when it
> > > + triggers CPU device removal and calls _EJ0 method
> > > + 4-7: reserved, OSPM must clear them before writing to register
> > > + [0x5] Command field: (1 byte access)
> > > + value:
> > > + 0: following reads from 'Command data' register returns PXM
> > > + value of device
> > > + 1: following writes to 'Command data' register set OST event
> > > + register in QEMU
> > > + 2: following writes to 'Command data' register set OST status
> > > + register in QEMU
> > > + other values: reserved
> > > + [0x6-0x7] reserved
> > > + [0x8] Command data: (DWORD access)
> > > + current 'Command field' value:
> > > + 1: stores value into OST event register
> > > + 2: stores value into OST status register, triggers
> > > + ACPI_DEVICE_OST QMP event from QEMU to external applications
> > > + with current values of OST event and status registers.
> > > + other values: reserved
> > >
> > > -CPU hot-add/remove notification:
> > > ------------------------------------------------------
> > > -QEMU sets/clears corresponding CPU bit on hot-add/remove event.
> > > -CPU present map read by ACPI BIOS GPE.2 handler to notify OS of CPU
> > > -hot-(un)plug events.
> > > +Selecting CPU device beyond possible range has no effect on platform:
> > > + - write accesses to CPU hot-plug registers not documented above are
> > > + ignored
> > > + - read accesses to CPU hot-plug registers not documented above return
> > > + all bits set to 1.
> >
> > why not 0?
> isn't hardware usually return 1s on unhandled IO reads?
> (I even thought that's it was you who told me it)
PCI does but it's special.
>
> that's what has been done for memory hotplug, so I'm doing the same here.
>
> >
> > > --
> > > 1.8.3.1
> >
next prev parent reply other threads:[~2016-05-31 21:10 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 14:42 [Qemu-devel] [PATCH 00/33] ACPI CPU hotplug refactoring to support more than 255 CPUs and PXM/OST methods Igor Mammedov
2016-05-17 14:42 ` [Qemu-devel] [PATCH 01/33] tests: acpi: report names of expected files in verbose mode Igor Mammedov
2016-05-24 16:58 ` Marcel Apfelbaum
2016-05-26 9:46 ` [Qemu-devel] [PATCH v2 1/33] " Igor Mammedov
2016-05-30 18:14 ` Marcel Apfelbaum
2016-06-02 11:02 ` Marcel Apfelbaum
2016-05-17 14:42 ` [Qemu-devel] [PATCH 02/33] acpi: add aml_debug() Igor Mammedov
2016-05-24 16:59 ` Marcel Apfelbaum
2016-05-17 14:42 ` [Qemu-devel] [PATCH 03/33] acpi: add aml_refof() Igor Mammedov
2016-05-24 17:00 ` Marcel Apfelbaum
2016-05-17 14:42 ` [Qemu-devel] [PATCH 04/33] pc: acpi: remove AML for empty/not used GPE handlers Igor Mammedov
2016-05-25 9:11 ` Marcel Apfelbaum
2016-05-25 13:19 ` Igor Mammedov
2016-05-31 10:06 ` Marcel Apfelbaum
2016-05-17 14:42 ` [Qemu-devel] [PATCH 05/33] pc: acpi: consolidate CPU hotplug AML Igor Mammedov
2016-05-30 18:18 ` Marcel Apfelbaum
2016-05-31 7:50 ` Igor Mammedov
2016-05-31 10:18 ` Marcel Apfelbaum
2016-05-31 12:49 ` Igor Mammedov
2016-05-17 14:42 ` [Qemu-devel] [PATCH 06/33] pc: acpi: consolidate \GPE._E02 with the rest of " Igor Mammedov
2016-05-30 18:22 ` Marcel Apfelbaum
2016-05-17 14:42 ` [Qemu-devel] [PATCH 07/33] pc: acpi: cpu-hotplug: make AML CPU_foo defines local to cpu_hotplug_acpi_table.c Igor Mammedov
2016-05-30 18:23 ` Marcel Apfelbaum
2016-05-17 14:43 ` [Qemu-devel] [PATCH 08/33] pc: acpi: mark current CPU hotplug functions as legacy Igor Mammedov
2016-05-30 18:28 ` Marcel Apfelbaum
2016-05-17 14:43 ` [Qemu-devel] [PATCH 09/33] pc: acpi: consolidate legacy CPU hotplug in one file Igor Mammedov
2016-05-30 18:31 ` Marcel Apfelbaum
2016-05-17 14:43 ` [Qemu-devel] [PATCH 10/33] pc: acpi: simplify build_legacy_cpu_hotplug_aml() signature Igor Mammedov
2016-05-30 18:31 ` Marcel Apfelbaum
2016-05-17 14:43 ` [Qemu-devel] [PATCH 11/33] pc: acpi: cpuhp-legacy: switch ProcessorID to possible_cpus idx Igor Mammedov
2016-05-30 18:39 ` Marcel Apfelbaum
2016-05-31 13:03 ` Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 12/33] tests: acpi: update tables with consolidated legacy cpu-hotplug AML Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 13/33] acpi: extend ACPI interface to provide send_event hook Igor Mammedov
2016-05-30 18:45 ` Marcel Apfelbaum
2016-05-31 9:57 ` [Qemu-devel] [PATCH v2 " Igor Mammedov
2016-06-02 11:09 ` Marcel Apfelbaum
2016-06-02 11:19 ` Igor Mammedov
2016-06-02 11:21 ` Marcel Apfelbaum
2016-05-17 14:43 ` [Qemu-devel] [PATCH 14/33] pc: use AcpiDeviceIfClass.send_event to issue GPE events Igor Mammedov
2016-05-31 10:01 ` [Qemu-devel] [PATCH v2 " Igor Mammedov
2016-06-02 11:13 ` Marcel Apfelbaum
2016-06-02 11:29 ` Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 15/33] docs: update ACPI CPU hotplug spec with new protocol Igor Mammedov
2016-05-31 4:49 ` Michael S. Tsirkin
2016-05-31 15:07 ` Igor Mammedov
2016-05-31 21:09 ` Michael S. Tsirkin [this message]
2016-06-06 9:57 ` Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 16/33] acpi: hardware side of CPU hotplug Igor Mammedov
2016-05-30 18:50 ` Marcel Apfelbaum
2016-05-31 13:24 ` Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 17/33] pc: add generic CPU unplug callbacks Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 18/33] pc: add 2.7 machine Igor Mammedov
2016-05-30 18:53 ` Marcel Apfelbaum
2016-05-30 19:04 ` Eduardo Habkost
2016-05-17 14:43 ` [Qemu-devel] [PATCH 19/33] pc: piix4/ich9: add 'cpu-hotplug-legacy' property Igor Mammedov
2016-05-30 18:59 ` Marcel Apfelbaum
2016-05-17 14:43 ` [Qemu-devel] [PATCH 20/33] pc: q35: initialize new CPU hotplug hw Igor Mammedov
2016-05-30 19:02 ` Marcel Apfelbaum
2016-05-31 10:06 ` Igor Mammedov
2016-05-31 10:21 ` Marcel Apfelbaum
2016-05-31 12:51 ` Igor Mammedov
2016-05-31 12:52 ` Michael S. Tsirkin
2016-05-31 13:18 ` Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 21/33] pc: piix4: " Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 22/33] pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 23/33] acpi: add CPU devices AML to DSDT Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 24/33] acpi: add CPU hotplug methods " Igor Mammedov
2016-05-31 4:38 ` Michael S. Tsirkin
2016-05-31 8:45 ` Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 25/33] qdev: hotplug: Introduce HotplugHandler.pre_plug() callback Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 26/33] target-i386: add X86CPU.node property Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 27/33] pc: numa: replace node_cpu indexing by apic_id with possible_cpus index Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 28/33] pc: set X86CPU.node property if QEMU starts with numa enabled Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 29/33] acpi: cpuhp: provide cpu._PXM method if running in numa mode Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 30/33] acpi: cpuhp: add cpu._OST handling Igor Mammedov
2016-05-17 15:29 ` Eric Blake
2016-05-18 8:09 ` Igor Mammedov
2016-05-30 18:21 ` Michael S. Tsirkin
2016-05-31 12:53 ` Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 31/33] tests: acpi: update expected tables with new cpu-hotplug methods enabled by default Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 32/33] tests: acpi: add CPU hotplug testcase Igor Mammedov
2016-05-17 14:43 ` [Qemu-devel] [PATCH 33/33] tests: acpi: add DSDT/MADT expected tables for cpu-hotplug case 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=20160531210957.GA22560@redhat.com \
--to=mst@redhat.com \
--cc=armbru@redhat.com \
--cc=drjones@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.com \
/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).