All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Lan Tianyu <tianyu.lan@intel.com>
Cc: kevin.tian@intel.com, wei.liu2@citrix.com,
	andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com,
	xen-devel@lists.xen.org, jbeulich@suse.com, chao.gao@intel.com
Subject: Re: [RFC PATCH 4/5] hvmload: Add x2apic entry support in the MADT build
Date: Fri, 25 Aug 2017 11:11:47 +0100	[thread overview]
Message-ID: <20170825101147.w2lkrqnbxb7o44wx@MacBook-Pro-de-Roger.local> (raw)
In-Reply-To: <1503629540-26053-5-git-send-email-tianyu.lan@intel.com>

On Thu, Aug 24, 2017 at 10:52:19PM -0400, Lan Tianyu wrote:
> This patch is to add x2apic entry support for ACPI MADT table.
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
> Signed-off-by: Chao Gao <chao.gao@intel.com>
> ---
>  tools/libacpi/acpi2_0.h | 10 ++++++++
>  tools/libacpi/build.c   | 61 ++++++++++++++++++++++++++++++++++---------------
>  2 files changed, 53 insertions(+), 18 deletions(-)
> 
> diff --git a/tools/libacpi/acpi2_0.h b/tools/libacpi/acpi2_0.h
> index 758a823..ff18b3e 100644
> --- a/tools/libacpi/acpi2_0.h
> +++ b/tools/libacpi/acpi2_0.h
> @@ -322,6 +322,7 @@ struct acpi_20_waet {
>  #define ACPI_IO_SAPIC                       0x06
>  #define ACPI_PROCESSOR_LOCAL_SAPIC          0x07
>  #define ACPI_PLATFORM_INTERRUPT_SOURCES     0x08
> +#define ACPI_PROCESSOR_LOCAL_X2APIC         0x09
>  
>  /*
>   * APIC Structure Definitions.
> @@ -338,6 +339,15 @@ struct acpi_20_madt_lapic {
>      uint32_t flags;
>  };
>  
> +struct acpi_20_madt_x2apic {
> +    uint8_t  type;
> +    uint8_t  length;
> +    uint16_t reserved;		    /* reserved - must be zero */
> +    uint32_t apic_id;           /* Processor x2APIC ID  */
> +    uint32_t flags;
> +    uint32_t acpi_processor_id;	/* ACPI processor UID */

There's a mix of tabs and spaces above.

> +};
> +
>  /*
>   * Local APIC Flags.  All other bits are reserved and must be 0.
>   */
> diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
> index c7cc784..36e582a 100644
> --- a/tools/libacpi/build.c
> +++ b/tools/libacpi/build.c
> @@ -82,9 +82,9 @@ static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt,
>      struct acpi_20_madt           *madt;
>      struct acpi_20_madt_intsrcovr *intsrcovr;
>      struct acpi_20_madt_ioapic    *io_apic;
> -    struct acpi_20_madt_lapic     *lapic;
>      const struct hvm_info_table   *hvminfo = config->hvminfo;
>      int i, sz;
> +    void *end;
>  
>      if ( config->lapic_id == NULL )
>          return NULL;
> @@ -92,7 +92,11 @@ static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt,
>      sz  = sizeof(struct acpi_20_madt);
>      sz += sizeof(struct acpi_20_madt_intsrcovr) * 16;
>      sz += sizeof(struct acpi_20_madt_ioapic);
> -    sz += sizeof(struct acpi_20_madt_lapic) * hvminfo->nr_vcpus;
> +
> +    if (hvminfo->nr_vcpus < 256)
> +        sz += sizeof(struct acpi_20_madt_lapic) * hvminfo->nr_vcpus;
> +    else
> +        sz += sizeof(struct acpi_20_madt_x2apic) * hvminfo->nr_vcpus;

This is wrong, APIC ID is cpu id * 2, so the limit here needs to be
128, not 256. Also this should be set as a constant somewhere.

Apart from that, although this is technically correct, I would rather
prefer the first 128 vCPUs to have xAPIC entries, and APIC IDs > 254
to use x2APIC entries. This will allow a guest without x2APIC support
to still boot on VMs > 128 vCPUs, although they won't be able to use
the extra CPUs. IIRC this is in line with what bare metal does.

Roger.

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

  parent reply	other threads:[~2017-08-25 10:11 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25  2:52 [RFC PATCH 0/5] Extend resources to support more vcpus in single VM Lan Tianyu
2017-08-25  2:52 ` [RFC PATCH 1/5] xen/hap: Increase hap size for more vcpus support Lan Tianyu
2017-08-25  9:14   ` Wei Liu
2017-08-28  8:53     ` Lan, Tianyu
2017-08-25  2:52 ` [RFC PATCH 2/5] XL: Increase event channels to support more vcpus Lan Tianyu
2017-08-25  9:18   ` Wei Liu
2017-08-25  9:57     ` Roger Pau Monné
2017-08-25 10:04       ` Wei Liu
2017-08-28  9:11         ` Lan, Tianyu
2017-08-28  9:21           ` Wei Liu
2017-08-28  9:22           ` Jan Beulich
2017-08-25  2:52 ` [RFC PATCH 3/5] Tool/ACPI: DSDT extension " Lan Tianyu
2017-08-25  9:25   ` Wei Liu
2017-08-28  9:12     ` Lan, Tianyu
2017-08-25 10:36   ` Roger Pau Monné
2017-08-25 12:01     ` Jan Beulich
2017-08-29  4:58       ` Lan Tianyu
2017-08-29  5:01     ` Lan Tianyu
2017-08-25  2:52 ` [RFC PATCH 4/5] hvmload: Add x2apic entry support in the MADT build Lan Tianyu
2017-08-25  9:26   ` Wei Liu
2017-08-25  9:43     ` Jan Beulich
2017-08-25 10:11   ` Roger Pau Monné [this message]
2017-08-29  3:14     ` Lan Tianyu
2017-08-25  2:52 ` [RFC PATCH 5/5] xl/libacpi: extend lapic_id() to uint32_t Lan Tianyu
2017-08-25  9:22   ` Wei Liu
2017-08-25 14:10 ` [RFC PATCH 0/5] Extend resources to support more vcpus in single VM Meng Xu
2017-08-29  4:38   ` Lan Tianyu
2017-08-29  8:49     ` Jan Beulich
2017-08-30  5:33       ` Lan Tianyu
2017-08-30  7:12         ` Jan Beulich
2017-08-30  9:18           ` George Dunlap

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=20170825101147.w2lkrqnbxb7o44wx@MacBook-Pro-de-Roger.local \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=chao.gao@intel.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=kevin.tian@intel.com \
    --cc=tianyu.lan@intel.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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.