All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>, roger.pau@citrix.com
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Al Stone <al.stone@linaro.org>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	Anshul Makkar <anshul.makkar@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	xen-devel@lists.xenproject.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: PVH CPU hotplug design document
Date: Fri, 13 Jan 2017 08:27:30 -0700	[thread overview]
Message-ID: <5878FFF2020000780012FF2B@prv-mh.provo.novell.com> (raw)
In-Reply-To: <b4af7a68-4fd3-e83a-c30c-2d9fbcdbf8a8@citrix.com>

>>> On 12.01.17 at 20:00, <andrew.cooper3@citrix.com> wrote:
> On 12/01/17 12:13, Roger Pau Monné wrote:
>> ## Proposed solution using the STAO
>>
>> The general idea of this method is to use the STAO in order to hide the pCPUs
>> from the hardware domain, and provide processor objects for vCPUs in an extra
>> SSDT table.
>>
>> This method requires one change to the STAO, in order to be able to notify the
>> hardware domain of which processors found in ACPI tables are pCPUs. The
>> description of the new STAO field is as follows:
>>
>>  |   Field            | Byte Length | Byte Offset |     Description          |
>>  |--------------------|:-----------:|:-----------:|--------------------------|
>>  | Processor List [n] |      -      |      -      | A list of ACPI numbers,  |
>>  |                    |             |             | where each number is the |
>>  |                    |             |             | Processor UID of a       |
>>  |                    |             |             | physical CPU, and should |
>>  |                    |             |             | be treated specially by  |
>>  |                    |             |             | the OSPM                 |
>>
>> The list of UIDs in this new field would be matched against the ACPI Processor
>> UID field found in local/x2 APIC MADT structs and Processor objects in the ACPI
>> namespace, and the OSPM should either ignore those objects, or in case it
>> implements pCPU hotplug, it should notify Xen of changes to these objects.
>>
>> The contents of the MADT provided to the hardware domain are also going to be
>> different from the contents of the MADT as found in native ACPI. The local/x2
>> APIC entries for all the pCPUs are going to be marked as disabled.
>>
>> Extra entries are going to be added for each vCPU available to the hardware
>> domain, up to the maximum number of supported vCPUs. Note that supported vCPUs
>> might be different than enabled vCPUs, so it's possible that some of these
>> entries are also going to be marked as disabled. The entries for vCPUs on the
>> MADT are going to use a processor local x2 APIC structure, and the ACPI
>> processor ID of the first vCPU is going to be UINT32_MAX - HVM_MAX_VCPUS, in
>> order to avoid clashes with IDs of pCPUs.
> 
> This is slightly problematic.  There is no restriction (so far as I am
> aware) on which ACPI IDs the firmware picks for its objects.  They need
> not be consecutive, logical, or start from 0.
> 
> If STAO is being extended to list the IDs of the physical processor
> objects, we should go one step further and explicitly list the IDs of
> the virtual processor objects.  This leaves us flexibility if we have to
> avoid awkward firmware ID layouts.

I don't think we should do this - vCPU IDs are already in MADT. I do,
however, think that we shouldn't name any specific IDs we mean to
use for the vCPU-s, but rather merely guarantee that there won't be
any overlap with the pCPU ones.

>> In order to be able to perform vCPU hotplug, the vCPUs must have an ACPI
>> processor object in the ACPI namespace, so that the OSPM can request
>> notifications and get the value of the \_STA and \_MAT methods. This can be
>> problematic because Xen doesn't know the ACPI name of the other processor
>> objects, so blindly adding new ones can create namespace clashes.
>>
>> This can be solved by using a different ACPI name in order to describe vCPUs in
>> the ACPI namespace. Most hardware vendors tend to use CPU or PR prefixes for
>> the processor objects, so using a 'VP' (ie: Virtual Processor) prefix should
>> prevent clashes.
> 
> One system I have to hand (with more than 255 pcpus) uses Cxxx
> 
> To avoid namespace collisions, I can't see any option but to parse the
> DSDT/SSDTs to at least confirm that VPxx is available to use.

And additionally using a two character name prefix would significantly
limit the number of vCPU-s we would be able to support going forward.
Just like above, I don't think we should specify the name here at all,
allowing dynamic picking of suitable ones.

>> A Xen GPE device block will be used in order to deliver events related to the
>> vCPUs available to the guest, since Xen doesn't know if there are any bits
>> available in the native GPEs. A SCI interrupt will be injected into the guest
>> in order to trigger the event.
>>
>> The following snippet is a representation of the ASL SSDT code that is proposed
>> for the hardware domain:
>>
>>     DefinitionBlock ("SSDT.aml", "SSDT", 5, "Xen", "HVM", 0)
>>     {
>>         Scope (\_SB)
>>         {
>>            OperationRegion(XEN, SystemMemory, 0xDEADBEEF, 40)
>>            Field(XEN, ByteAcc, NoLock, Preserve) {
>>                NCPU, 16, /* Number of vCPUs */
>>                MSUA, 32, /* MADT checksum address */
>>                MAPA, 32, /* MADT LAPIC0 address */
>>            }
[...]
>> Since the position of the XEN data memory area is not know, the hypervisor will
>> have to replace the address 0xdeadbeef with the actual memory address where
>> this structure has been copied. This will involve a memory search of the AML
>> code resulting from the compilation of the above ASL snippet.
> 
> This is also slightly risky.  If we need to do this, can we get a
> relocation list from the compiled table from iasl?

I expect iasl can't do that, the more that there's not actually any
relocation involved here. I guess we'd need a double compilation
approach, where for both a different address is being specified.
The diff of the two would then allow to create a relocation list.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-01-13 15:27 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12 12:13 PVH CPU hotplug design document Roger Pau Monné
2017-01-12 19:00 ` Andrew Cooper
2017-01-13  3:06   ` Boris Ostrovsky
2017-01-13 15:27   ` Jan Beulich [this message]
2017-01-16 14:59     ` Roger Pau Monné
2017-01-16 14:50   ` Roger Pau Monné
2017-01-13 15:51 ` Jan Beulich
2017-01-13 19:41   ` Stefano Stabellini
2017-01-14  1:44   ` Boris Ostrovsky
2017-01-16 11:03     ` Jan Beulich
2017-01-16 15:14   ` Roger Pau Monné
2017-01-16 16:09     ` Jan Beulich
2017-01-16 16:31       ` Roger Pau Monné
2017-01-16 16:50         ` Jan Beulich
2017-01-16 17:44           ` Roger Pau Monné
2017-01-16 18:16             ` Stefano Stabellini
2017-01-17  9:12             ` Jan Beulich
2017-01-17 11:43               ` Roger Pau Monné
2017-01-17 12:33                 ` Jan Beulich
2017-01-17 14:13                   ` Roger Pau Monné
2017-01-17 14:44                     ` Jan Beulich
2017-01-17 15:27                       ` Boris Ostrovsky
2017-01-17 15:33                         ` Jan Beulich
2017-01-17 15:50                           ` Boris Ostrovsky
2017-01-17 17:45                             ` Roger Pau Monné
2017-01-17 18:50                               ` Boris Ostrovsky
2017-01-18 10:34                                 ` Roger Pau Monné
2017-01-18 10:44                                   ` Jan Beulich
2017-01-18 11:54                                     ` Roger Pau Monné
2017-01-18 13:25                                       ` Jan Beulich
2017-01-22 18:39                                         ` Boris Ostrovsky
2017-01-23 10:35                                           ` Jan Beulich
2017-01-23 14:28                                             ` Boris Ostrovsky
2017-01-23 15:17                                               ` Jan Beulich
2017-01-23 15:43                                                 ` Boris Ostrovsky
2017-01-23 15:49                                                   ` Boris Ostrovsky
2017-01-23 15:58                                                     ` Jan Beulich
2017-01-23 16:24                                                       ` Boris Ostrovsky
2017-01-23 16:50                                                         ` Roger Pau Monné
2017-01-23 17:05                                                           ` Boris Ostrovsky
2017-01-23 17:14                                                             ` Roger Pau Monné
2017-01-23 18:36                                                               ` Boris Ostrovsky
2017-01-24  7:43                                                                 ` Jan Beulich
2017-01-24 14:15                                                                   ` Boris Ostrovsky
2017-01-23 15:49                                                   ` Jan Beulich
2017-01-18 13:34                                       ` Boris Ostrovsky

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=5878FFF2020000780012FF2B@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=al.stone@linaro.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=anshul.makkar@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=graeme.gregory@linaro.org \
    --cc=julien.grall@arm.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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.