Extend resources to support more vcpus in single VM
v2 cover Extend resources to support more vcpus in single VM
Change since v1:
1) Increase hap page pool according vcpu number
2) Use "Processor" syntax to define vcpus with APIC id < 255
in dsdt and use "Device" syntax for other vcpus in ACPI DSDT table.
3) Use XAPIC structure for vcpus with APIC id < 255
in dsdt and use x2APIC structure for other vcpus in the ACPI MADT table.
This patchset is to extend some resources(i.e, event channel, hap and so) to support more vcpus for single VM.
Chao Gao (1):
xl/libacpi: extend lapic_id() to uint32_t
Lan Tianyu (3):
xen/hap: Increase hap size for more vcpus support Tool/ACPI: DSDT extension to support more vcpus
hvmload: Add x2apic entry support in the MADT build
tools/firmware/hvmloader/util.c | 2 +- tools/libacpi/acpi2_0.h | 10 +++++++ tools/libacpi/build.c | 59 +++++++++++++++++++++++++++++------------ tools/libacpi/libacpi.h | 2 +- tools/libacpi/mk_dsdt.c | 18 ++++++++----- tools/libxl/libxl_x86_acpi.c | 2 +- xen/arch/x86/mm/hap/hap.c | 10 ++++++- 7 files changed, 76 insertions(+), 27 deletions(-)
Signature · 7 lines
1.8.3.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH v2 1/4 xen/hap: Increase hap page pool size for more vcpus support
This patch is to increase hap page pool size to support more vcpus in single VM.
--- xen/arch/x86/mm/hap/hap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
xen/arch/x86/mm/hap/hap.c +9 -1
@@ -464,6 +464,7 @@ void hap_domain_init(struct domain *d)int hap_enable (struct domain *d,u32 mode) {unsigned int old_pages; +unsigned int pages;unsigned int i;int rv =0 ;
@@ -473,7 +474,14 @@ int hap_enable(struct domain *d, u32 mode)if ( old_pages ==0 ) {paging_lock (d); - rv =hap_set_allocation (d,256 ,NULL ); + +/* Increase hap page pool with max vcpu number. */ +if ( d->max_vcpus >128 ) + pages =256 ; +else + pages =512 ; + + rv =hap_set_allocation (d, pages,NULL );if ( rv !=0 ) {hap_set_allocation (d,0 ,NULL );
Signature · 7 lines
1.8.3.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH v2 2/4 Tool/ACPI: DSDT extension to support more vcpus
In reply to Lan TianyuThis patch is to change DSDT table for processor object to support >128 vcpus accroding to ACPI spec 8.4 Declaring Processors
--- tools/libacpi/mk_dsdt.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
tools/libacpi/mk_dsdt.c +12 -6
@@ -24,6 +24,8 @@#include <xen/arch-arm.h> #endif +#define CPU_NAME_FMT "P%.03X" +static unsigned int indent_level;static bool debug = false;
@@ -196,10 +198,14 @@ int main(int argc, char **argv)/* Define processor objects and control methods. */ for ( cpu =0 ; cpu < max_cpus; cpu++) { -push_block ("Processor" ,"PR%02X, %d, 0x0000b010, 0x06" , cpu, cpu); +unsigned int apic_id = cpu *2 ; -stmt ("Name" ,"_HID, \"ACPI0007\"" ); +if ( apic_id >255 ) +push_block ("Device" ,CPU_NAME_FMT , cpu); +else +push_block ("Processor" ,CPU_NAME_FMT ", %d, 0x0000b010, 0x06" , cpu, cpu); +stmt ("Name" ,"_HID, \"ACPI0007\"" );stmt ("Name" ,"_UID, %d" , cpu);#ifdef CONFIG_ARM_64 pop_block ();
@@ -268,15 +274,15 @@ int main(int argc, char **argv)/* Extract current CPU's status: 0=offline; 1=online. */ stmt ("And" ,"Local1, 1, Local2" );/* Check if status is up-to-date in the relevant MADT LAPIC entry... */ -push_block ("If" ,"LNotEqual(Local2, \\_SB.PR%02X.FLG)" , cpu); +push_block ("If" ,"LNotEqual(Local2, \\_SB." CPU_NAME_FMT ".FLG)" , cpu);/* ...If not, update it and the MADT checksum, and notify OSPM. */ -stmt ("Store" ,"Local2, \\_SB.PR%02X.FLG" , cpu); +stmt ("Store" ,"Local2, \\_SB." CPU_NAME_FMT ".FLG" , cpu);push_block ("If" ,"LEqual(Local2, 1)" ); -stmt ("Notify" ,"PR%02X, 1" , cpu);/* Notify: Device Check */ +stmt ("Notify" ,CPU_NAME_FMT ", 1" , cpu);/* Notify: Device Check */ stmt ("Subtract" ,"\\_SB.MSU, 1, \\_SB.MSU" );/* Adjust MADT csum */ pop_block ();push_block ("Else" ,NULL ); -stmt ("Notify" ,"PR%02X, 3" , cpu);/* Notify: Eject Request */ +stmt ("Notify" ,CPU_NAME_FMT ", 3" , cpu);/* Notify: Eject Request */ stmt ("Add" ,"\\_SB.MSU, 1, \\_SB.MSU" );/* Adjust MADT csum */ pop_block ();pop_block ();
Signature · 7 lines
1.8.3.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH v2 3/4 hvmload: Add x2apic entry support in the MADT build
In reply to Lan TianyuThis patch is to add x2apic entry support for ACPI MADT table according to ACPI spec 5.2.12.12 Processor Local x2APIC Structure
--- tools/libacpi/acpi2_0.h | 10 +++++++++ tools/libacpi/build.c | 59 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 52 insertions(+), 17 deletions(-)
tools/libacpi/acpi2_0.h +10 -0
@@ -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 */ +}; +/* * Local APIC Flags. All other bits are reserved and must be 0. */
tools/libacpi/build.c +42 -17
92 lines not on this page · raw message
Signature · 7 lines
1.8.3.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH v2 4/4 xl/libacpi: extend lapic_id() to uint32_t
In reply to Lan TianyuFrom: Chao Gao <[email protected]>
This patch is to extend lapic_id() to support more vcpus.
--- tools/firmware/hvmloader/util.c | 2 +- tools/libacpi/libacpi.h | 2 +- tools/libxl/libxl_x86_acpi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
tools/firmware/hvmloader/util.c +1 -1
@@ -883,7 +883,7 @@ static void acpi_mem_free(struct acpi_ctxt *ctxt,/* ACPI builder currently doesn't free memory so this is just a stub */ } -static uint8_t acpi_lapic_id (unsigned cpu) +static uint32_t acpi_lapic_id (unsigned cpu) {return LAPIC_ID (cpu); }
tools/libacpi/libacpi.h +1 -1
@@ -93,7 +93,7 @@ struct acpi_config {unsigned long rsdp;/* x86-specific parameters */ -uint8_t (*lapic_id)(unsigned cpu); +uint32_t (*lapic_id)(unsigned cpu);uint32_t lapic_base_address;uint32_t ioapic_base_address;uint16_t pci_isa_irq_mask;
tools/libxl/libxl_x86_acpi.c +1 -1
@@ -85,7 +85,7 @@ static void acpi_mem_free(struct acpi_ctxt *ctxt, { } -static uint8_t acpi_lapic_id (unsigned cpu) +static uint32_t acpi_lapic_id (unsigned cpu) {return cpu *2 ; }
Signature · 7 lines
1.8.3.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 1/4] xen/hap: Increase hap page pool size for more vcpus support
In reply to Lan TianyuQuoted 22 lines · Lan Tianyu
This patch is to increase hap page pool size to support more vcpus in single VM.
Signed-off-by Lan Tianyu <[email protected]>--- xen/arch/x86/mm/hap/hap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)xen/arch/x86/mm/hap/hap.c +1
-0@@ -464,6 +464,7 @@ void hap_domain_init(struct domain *d)int hap_enable (struct domain *d,u32 mode) {unsigned int old_pages; +unsigned int pages;unsigned int i;int rv =0 ;@@ -473,7 +474,14 @@ int hap_enable(struct domain *d, u32 mode)if ( old_pages ==0 ) {
xen/arch/x86/mm/hap/hap.c int hap_enable(struct domain *d, u32 mode) · line 484
Quoted 10 lines
xen/arch/x86/mm/hap/hap.c +8
-1paging_lock (d); - rv =hap_set_allocation (d,256 ,NULL ); + +/* Increase hap page pool with max vcpu number. */ +if ( d->max_vcpus >128 ) + pages =256 ; +else + pages =512 ; + + rv =hap_set_allocation (d, pages,NULL );
What effect is this intended to have? hap_enable() is always called when d->max_vcpus is 0.
d->max_vcpus isn't chosen until a subsequent hypercall. (This is one of many unexpected surprised from multi-vcpu support having been hacked on the side of existing Xen support, rather than being built in to the createdomain hypercall).
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 4/4] xl/libacpi: extend lapic_id() to uint32_t
In reply to Lan TianyuQuoted 6 lines · Lan Tianyu
From: Chao Gao <[email protected]>
This patch is to extend
lapic_id()to support more vcpus.Signed-off-by Chao Gao <[email protected]>Signed-off-by Lan Tianyu <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 2/4] Tool/ACPI: DSDT extension to support more vcpus
In reply to Lan TianyuQuoted 22 lines · Lan Tianyu
This patch is to change DSDT table for processor object to support >128 vcpus accroding to ACPI spec 8.4 Declaring Processors
Signed-off-by Lan Tianyu <[email protected]>--- tools/libacpi/mk_dsdt.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)tools/libacpi/mk_dsdt.c +2
-0@@ -24,6 +24,8 @@#include <xen/arch-arm.h> #endif +#define CPU_NAME_FMT "P%.03X" +static unsigned int indent_level;static bool debug = false;
tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 201
Quoted 5 lines
tools/libacpi/mk_dsdt.c +1
-1@@ -196,10 +198,14 @@ int main(int argc, char **argv)/* Define processor objects and control methods. */ for ( cpu =0 ; cpu < max_cpus; cpu++) { -push_block ("Processor" ,"PR%02X, %d, 0x0000b010, 0x06" , cpu, cpu); +unsigned int apic_id = cpu *2 ;
This is fragile, ideally there should be a single point where the APIC ID is calculated. Although there are already two places where the APIC ID is calculated, in hvmloader and libxl.
And I'm not sure how to use any of those here in order to avoid introducing a third one.
tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 203
Quoted 3 lines
tools/libacpi/mk_dsdt.c +1
-1-stmt ("Name" ,"_HID, \"ACPI0007\"" ); +if ( apic_id >255 )
We need to be careful with this. This is not a problem ATM because the ACPI ID is the CPU ID, but care should be taken to not create a Processor object with ACPI ID 255, because that's the broadcast ACPI ID...
tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 205
Quoted 2 lines
tools/libacpi/mk_dsdt.c +2
-0+push_block ("Device" ,CPU_NAME_FMT , cpu); + else
... IMHO an assert(cpu < 255); should be added here.
tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 206
Quoted 1 line
tools/libacpi/mk_dsdt.c +1
-0+push_block ("Processor" ,CPU_NAME_FMT ", %d, 0x0000b010, 0x06" , cpu, cpu);
^ space (here and below)
Please leave a space between the string literals and the defines, it makes it easier to read. And this line needs to be split.
Quoted 28 lines
tools/libacpi/mk_dsdt.c +5
-4+stmt ("Name" ,"_HID, \"ACPI0007\"" );stmt ("Name" ,"_UID, %d" , cpu);#ifdef CONFIG_ARM_64 pop_block ();@@ -268,15 +274,15 @@ int main(int argc, char **argv)/* Extract current CPU's status: 0=offline; 1=online. */ stmt ("And" ,"Local1, 1, Local2" );/* Check if status is up-to-date in the relevant MADT LAPIC entry... */ -push_block ("If" ,"LNotEqual(Local2, \\_SB.PR%02X.FLG)" , cpu); +push_block ("If" ,"LNotEqual(Local2, \\_SB." CPU_NAME_FMT ".FLG)" , cpu);/* ...If not, update it and the MADT checksum, and notify OSPM. */ -stmt ("Store" ,"Local2, \\_SB.PR%02X.FLG" , cpu); +stmt ("Store" ,"Local2, \\_SB." CPU_NAME_FMT ".FLG" , cpu);push_block ("If" ,"LEqual(Local2, 1)" ); -stmt ("Notify" ,"PR%02X, 1" , cpu);/* Notify: Device Check */ +stmt ("Notify" ,CPU_NAME_FMT ", 1" , cpu);/* Notify: Device Check */ stmt ("Subtract" ,"\\_SB.MSU, 1, \\_SB.MSU" );/* Adjust MADT csum */ pop_block ();push_block ("Else" ,NULL ); -stmt ("Notify" ,"PR%02X, 3" , cpu);/* Notify: Eject Request */ +stmt ("Notify" ,CPU_NAME_FMT ", 3" , cpu);/* Notify: Eject Request */ stmt ("Add" ,"\\_SB.MSU, 1, \\_SB.MSU" );/* Adjust MADT csum */ pop_block ();pop_block ();Signature · 1 line
1.8.3.1
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 2/4] Tool/ACPI: DSDT extension to support more vcpus
Quoted 33 lines · Roger Pau Monné
Quoted 22 lines · Lan Tianyu
This patch is to change DSDT table for processor object to support >128 vcpus accroding to ACPI spec 8.4 Declaring Processors
Signed-off-by Lan Tianyu <[email protected]>--- tools/libacpi/mk_dsdt.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)tools/libacpi/mk_dsdt.c +2
-0@@ -24,6 +24,8 @@#include <xen/arch-arm.h> #endif +#define CPU_NAME_FMT "P%.03X" +static unsigned int indent_level;static bool debug = false;tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 201
Quoted 5 lines
tools/libacpi/mk_dsdt.c +1
-1@@ -196,10 +198,14 @@ int main(int argc, char **argv)/* Define processor objects and control methods. */ for ( cpu =0 ; cpu < max_cpus; cpu++) { -push_block ("Processor" ,"PR%02X, %d, 0x0000b010, 0x06" , cpu, cpu); +unsigned int apic_id = cpu *2 ;This is fragile, ideally there should be a single point where the APIC ID is calculated. Although there are already two places where the APIC ID is calculated, in hvmloader and libxl.
Quoted 2 lines
And I'm not sure how to use any of those here in order to avoid introducing a third one.
The mk_dsdt is independent tool to build dsdt table. It wasn't linked with libxl and hvmloader. We can't reuse old function to do that.
But I think we may introduce a new LAPIC_ID(vcpu) in the arch head file(i.e, #include <xen/arch-x86/xen.h>) and replace old ones.
Quoted 9 lines
tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 203
Quoted 4 lines
tools/libacpi/mk_dsdt.c +1
-1-stmt ("Name" ,"_HID, \"ACPI0007\"" ); +if ( apic_id >255 )We need to be careful with this. This is not a problem ATM because the ACPI ID is the CPU ID, but care should be taken to not create a Processor object with ACPI ID 255, because that's the broadcast ACPI ID...
Yes.
Quoted 5 lines
tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 205
Quoted 3 lines
tools/libacpi/mk_dsdt.c +2
-0+push_block ("Device" ,CPU_NAME_FMT , cpu); + else... IMHO an assert(cpu < 255); should be added here.
OK.
Quoted 7 lines
tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 206
Quoted 2 lines
tools/libacpi/mk_dsdt.c +1
-0+push_block ("Processor" ,CPU_NAME_FMT ", %d, 0x0000b010, 0x06" , cpu, cpu);^ space (here and below)
Please leave a space between the string literals and the defines, it makes it easier to read. And this line needs to be split.
OK. Will update.
Signature · 7 lines
Best regards Tianyu Lan _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 1/4] xen/hap: Increase hap page pool size for more vcpus support
In reply to Andrew CooperQuoted 20 lines · Andrew Cooper
Quoted 19 lines · Lan Tianyu
This patch is to increase hap page pool size to support more vcpus in single VM.
Signed-off-by Lan Tianyu <[email protected]>--- xen/arch/x86/mm/hap/hap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)xen/arch/x86/mm/hap/hap.c +1
-0@@ -464,6 +464,7 @@ void hap_domain_init(struct domain *d)int hap_enable (struct domain *d,u32 mode) {unsigned int old_pages; +unsigned int pages;unsigned int i;int rv =0 ;
Quoted 16 lines
xen/arch/x86/mm/hap/hap.c int hap_enable(struct domain *d, u32 mode) · line 484
Quoted 13 lines
xen/arch/x86/mm/hap/hap.c +8
-1@@ -473,7 +474,14 @@ int hap_enable(struct domain *d, u32 mode)if ( old_pages ==0 ) {paging_lock (d); - rv =hap_set_allocation (d,256 ,NULL ); + +/* Increase hap page pool with max vcpu number. */ +if ( d->max_vcpus >128 ) + pages =256 ; +else + pages =512 ; + + rv =hap_set_allocation (d, pages,NULL );What effect is this intended to have?
hap_enable()is always called whend->max_vcpusis 0.
Sorry. I didn't notice that max_vcpus wasn't set at that point.I hope to allocate hap pages according vcpu number. This means we don't know how many vcpu will be used when allocate hap pages during creating domain, right? If that, we have to increase page number unconditionally.
Quoted 8 lines
d->max_vcpusisn't chosen until a subsequent hypercall. (This is one of many unexpected surprised from multi-vcpu support having been hacked on the side of existing Xen support, rather than being built in to the createdomain hypercall).~Andrew
Signature · 7 lines
Best regards Tianyu Lan _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 1/4] xen/hap: Increase hap page pool size for more vcpus support
Quoted 40 lines
Quoted 1 line
Quoted 1 line · On 01.09.17 at 10:19, <[email protected]> wrote:
Quoted 2 lines · Andrew Cooper
Quoted 1 line · Lan Tianyu
This patch is to increase hap page pool size to support more vcpus in single
VM.
Quoted 18 lines
Quoted 18 lines
Signed-off-by Lan Tianyu <[email protected]>--- xen/arch/x86/mm/hap/hap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)xen/arch/x86/mm/hap/hap.c +1
-0@@ -464,6 +464,7 @@ void hap_domain_init(struct domain *d)int hap_enable (struct domain *d,u32 mode) {unsigned int old_pages; +unsigned int pages;unsigned int i;int rv =0 ;Quoted 16 lines
xen/arch/x86/mm/hap/hap.c int hap_enable(struct domain *d, u32 mode) · line 484
Quoted 13 lines
xen/arch/x86/mm/hap/hap.c +8
-1@@ -473,7 +474,14 @@ int hap_enable(struct domain *d, u32 mode)if ( old_pages ==0 ) {paging_lock (d); - rv =hap_set_allocation (d,256 ,NULL ); + +/* Increase hap page pool with max vcpu number. */ +if ( d->max_vcpus >128 ) + pages =256 ; +else + pages =512 ; + + rv =hap_set_allocation (d, pages,NULL );What effect is this intended to have?
hap_enable()is always called whend->max_vcpusis 0.
Quoted 4 lines
Sorry. I didn't notice that
max_vcpuswasn't set at that point.I hope to allocate hap pages according vcpu number. This means we don't know how many vcpu will be used when allocate hap pages during creating domain, right? If that, we have to increase page number unconditionally.
But that you were already told isn't really acceptable. Did you consider calling hap_set_allocation() another time once vCPU count was set?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 1/4] xen/hap: Increase hap page pool size for more vcpus support
Quoted 40 lines · Jan Beulich
Quoted 40 lines
Quoted 1 line
Quoted 1 line · On 01.09.17 at 10:19, <[email protected]> wrote:
Quoted 2 lines · Andrew Cooper
Quoted 1 line · Lan Tianyu
This patch is to increase hap page pool size to support more vcpus in single
VM.
Quoted 34 lines
Quoted 21 lines
Signed-off-by Lan Tianyu <[email protected]>--- xen/arch/x86/mm/hap/hap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)xen/arch/x86/mm/hap/hap.c +1
-0@@ -464,6 +464,7 @@ void hap_domain_init(struct domain *d)int hap_enable (struct domain *d,u32 mode) {unsigned int old_pages; +unsigned int pages;unsigned int i;int rv =0 ;@@ -473,7 +474,14 @@ int hap_enable(struct domain *d, u32 mode)if ( old_pages ==0 ) {xen/arch/x86/mm/hap/hap.c int hap_enable(struct domain *d, u32 mode) · line 484
Quoted 10 lines
xen/arch/x86/mm/hap/hap.c +8
-1paging_lock (d); - rv =hap_set_allocation (d,256 ,NULL ); + +/* Increase hap page pool with max vcpu number. */ +if ( d->max_vcpus >128 ) + pages =256 ; +else + pages =512 ; + + rv =hap_set_allocation (d, pages,NULL );What effect is this intended to have?
hap_enable()is always called whend->max_vcpusis 0.
Quoted 9 lines
Quoted 4 lines
Sorry. I didn't notice that
max_vcpuswasn't set at that point.I hope to allocate hap pages according vcpu number. This means we don't know how many vcpu will be used when allocate hap pages during creating domain, right? If that, we have to increase page number unconditionally.But that you were already told isn't really acceptable. Did you consider calling
hap_set_allocation()another time once vCPU count was set?
That sounds feasible. I will try it. Thanks.
Signature · 7 lines
Best regards Tianyu Lan _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 2/4] Tool/ACPI: DSDT extension to support more vcpus
In reply to Lan TianyuQuoted 34 lines · Lan Tianyu
Quoted 33 lines · Roger Pau Monné
Quoted 22 lines · Lan Tianyu
This patch is to change DSDT table for processor object to support >128 vcpus accroding to ACPI spec 8.4 Declaring Processors
Signed-off-by Lan Tianyu <[email protected]>--- tools/libacpi/mk_dsdt.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)tools/libacpi/mk_dsdt.c +2
-0@@ -24,6 +24,8 @@#include <xen/arch-arm.h> #endif +#define CPU_NAME_FMT "P%.03X" +static unsigned int indent_level;static bool debug = false;tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 201
Quoted 5 lines
tools/libacpi/mk_dsdt.c +1
-1@@ -196,10 +198,14 @@ int main(int argc, char **argv)/* Define processor objects and control methods. */ for ( cpu =0 ; cpu < max_cpus; cpu++) { -push_block ("Processor" ,"PR%02X, %d, 0x0000b010, 0x06" , cpu, cpu); +unsigned int apic_id = cpu *2 ;This is fragile, ideally there should be a single point where the APIC ID is calculated. Although there are already two places where the APIC ID is calculated, in hvmloader and libxl.
Quoted 8 lines
Quoted 2 lines
And I'm not sure how to use any of those here in order to avoid introducing a third one.
The
mk_dsdtis independent tool to build dsdt table. It wasn't linked with libxl and hvmloader. We can't reuse old function to do that.But I think we may introduce a new
LAPIC_ID(vcpu)in the arch headfile(i.e, #include <xen/arch-x86/xen.h>)and replace old ones.
There's already a LAPIC_ID macro in hvmloader headers which should be placed somewhere suitable. What about removing the lapic_id hook from acpi_config and placing the LAPIC_ID macro in the libacpi.h header?
I'm not sure why lapic_id needs to be a hook in any case, both it's callers use the same exact formula (cpu_id * 2).
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 3/4] hvmload: Add x2apic entry support in the MADT build
In reply to Lan TianyuQuoted 54 lines · Lan Tianyu
This patch is to add x2apic entry support for ACPI MADT table according to ACPI spec 5.2.12.12 Processor Local x2APIC Structure
Signed-off-by Chao Gao <[email protected]>Signed-off-by Lan Tianyu <[email protected]>--- tools/libacpi/acpi2_0.h | 10 +++++++++ tools/libacpi/build.c | 59 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 52 insertions(+), 17 deletions(-)tools/libacpi/acpi2_0.h +10
-0@@ -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 */ +}; +/* * Local APIC Flags. All other bits are reserved and must be 0. */ tools/libacpi/build.c +1
-1@@ -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 ;
tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 96
Quoted 6 lines
tools/libacpi/build.c +2
-1@@ -92,7 +92,12 @@ 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 <128 )
This should be done based on APIC ID.
tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 117
Quoted 13 lines
tools/libacpi/build.c +5
-1+ sz +=sizeof (struct acpi_20_madt_lapic ) * hvminfo->nr_vcpus; + else + sz += sizeof(struct acpi_20_madt_lapic) * 128 + +sizeof (struct acpi_20_madt_x2apic ) * (hvminfo->nr_vcpus -128 ); madt = ctxt->mem_ops.alloc (ctxt, sz,16 );if (!madt)return NULL ;@@ -109,7 +114,7 @@ static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, madt->flags =ACPI_PCAT_COMPAT ;if ( config->table_flags &ACPI_HAS_IOAPIC ) - { + {
Spurious cleanup?
Quoted 7 lines
tools/libacpi/build.c +0
-0intsrcovr = (struct acpi_20_madt_intsrcovr *)(madt +1 );for ( i =0 ; i <16 ; i++ ) {@@ -146,27 +151,47 @@ static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, io_apic->ioapic_id = config->ioapic_id; io_apic->ioapic_addr = config->ioapic_base_address;
tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 154
Quoted 10 lines
tools/libacpi/build.c +4
-3- lapic = (struct acpi_20_madt_lapic *)(io_apic +1 ); + end = (struct acpi_20_madt_lapic *)(io_apic +1 ); }else - lapic = (struct acpi_20_madt_lapic *)(madt +1 ); + end = (struct acpi_20_madt_lapic *)(madt +1 ); + + info->madt_lapic0_addr = ctxt->mem_ops.v2p (ctxt, end); - info->nr_cpus = hvminfo->nr_vcpus;
Why are you moving this? AFAICT the value of nr_vpcus is not changed, so you might as well leave it as-is.
Quoted 14 lines
tools/libacpi/build.c +2
-10- info->madt_lapic0_addr = ctxt->mem_ops.v2p (ctxt, lapic);for ( i =0 ; i < hvminfo->nr_vcpus; i++ ) { -memset (lapic,0 ,sizeof (*lapic)); - lapic->type =ACPI_PROCESSOR_LOCAL_APIC ; - lapic->length =sizeof (*lapic); -/* Processor ID must match processor-object IDs in the DSDT. */ - lapic->acpi_processor_id = i; - lapic->apic_id = config->lapic_id (i); - lapic->flags = (test_bit (i, hvminfo->vcpu_online) - ?ACPI_LOCAL_APIC_ENABLED :0 ); - lapic++; +unsigned int apic_id = config->lapic_id (i); +
tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 174
Quoted 10 lines
tools/libacpi/build.c +10
-0+if ( apic_id <255 ) { +struct acpi_20_madt_lapic *lapic = end; + +memset (lapic,0 ,sizeof (*lapic)); + lapic->type =ACPI_PROCESSOR_LOCAL_APIC ; + lapic->length =sizeof (*lapic); +/* Processor ID must match processor-object IDs in the DSDT. */ + lapic->acpi_processor_id = i; + lapic->apic_id = config->lapic_id (i); + lapic->flags = ((i < hvminfo->nr_vcpus) &&
I don't understand why you have added this.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 2/4] Tool/ACPI: DSDT extension to support more vcpus
In reply to Roger Pau MonnéQuoted 3 lines
Quoted 1 line
Quoted 1 line · On 01.09.17 at 11:41, <[email protected]> wrote:
I'm not sure why
lapic_idneeds to be a hook in any case, both it's callers use the same exact formula (cpu_id* 2).
You're aware that this is meant to be improved rather sooner than later. At that point I'm then not sure a suitable LAPIC_ID() macro could be created, as the potential users of this may not have available all necessary inputs. I'd strongly suggest finding a way to dynamically insert the APIC IDs (as found while booting) into the ACPI tables. That's pretty likely how real BIOSes have to do it too.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 2/4] Tool/ACPI: DSDT extension to support more vcpus
Quoted 11 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 01.09.17 at 11:41, <[email protected]> wrote:
I'm not sure why
lapic_idneeds to be a hook in any case, both it's callers use the same exact formula (cpu_id* 2).You're aware that this is meant to be improved rather sooner than later. At that point I'm then not sure a suitable
LAPIC_ID()macro could be created, as the potential users of this may not have available all necessary inputs. I'd strongly suggest finding a way to dynamically insert the APIC IDs (as found while booting) into the ACPI tables. That's pretty likely how real BIOSes have to do it too.
There's a further problem here, which is that the DSDT is created at tools compilation time, there's no way to know the APIC IDs at that point in order to decide whether a CPU gets a Processor or a Device object.
Leaving the DSDT issue aside, there's also the problem that the MADT for PVH guests is build by the toolstack, not the firmware (because there's none), so it's impossible to do it like real BIOSes.
So AFAICT we either remove the hook and code the logic to get the ACPI ID inside libacpi, or we introduce yet another open coded one in order to generate the DSDT from mk_dsdt.c
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 4/4] xl/libacpi: extend lapic_id() to uint32_t
In reply to Lan TianyuQuoted 6 lines · Lan Tianyu
From: Chao Gao <[email protected]>
This patch is to extend
lapic_id()to support more vcpus.Signed-off-by Chao Gao <[email protected]>Signed-off-by Lan Tianyu <[email protected]>
Please remember to pick up my ack next time around -- I believed I already acked this in the previous version.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 2/4] Tool/ACPI: DSDT extension to support more vcpus
In reply to Roger Pau MonnéQuoted 38 lines · Roger Pau Monné
Quoted 37 lines · Lan Tianyu
Quoted 35 lines · Roger Pau Monné
Quoted 22 lines · Lan Tianyu
This patch is to change DSDT table for processor object to support >128 vcpus accroding to ACPI spec 8.4 Declaring Processors
Signed-off-by Lan Tianyu <[email protected]>--- tools/libacpi/mk_dsdt.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)tools/libacpi/mk_dsdt.c +2
-0@@ -24,6 +24,8 @@#include <xen/arch-arm.h> #endif +#define CPU_NAME_FMT "P%.03X" +static unsigned int indent_level;static bool debug = false;tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 201
Quoted 5 lines
tools/libacpi/mk_dsdt.c +1
-1@@ -196,10 +198,14 @@ int main(int argc, char **argv)/* Define processor objects and control methods. */ for ( cpu =0 ; cpu < max_cpus; cpu++) { -push_block ("Processor" ,"PR%02X, %d, 0x0000b010, 0x06" , cpu, cpu); +unsigned int apic_id = cpu *2 ;This is fragile, ideally there should be a single point where the APIC ID is calculated. Although there are already two places where the APIC ID is calculated, in hvmloader and libxl.
And I'm not sure how to use any of those here in order to avoid introducing a third one.
Quoted 8 lines
Quoted 5 lines
The
mk_dsdtis independent tool to build dsdt table. It wasn't linked with libxl and hvmloader. We can't reuse old function to do that.But I think we may introduce a new
LAPIC_ID(vcpu)in the arch headfile(i.e, #include <xen/arch-x86/xen.h>)and replace old ones.There's already a
LAPIC_IDmacro in hvmloader headers which should be placed somewhere suitable.
Yes, this is what I mentioned.
Quoted 2 lines
What about removing the
lapic_idhook fromacpi_configand placing theLAPIC_IDmacro in thelibacpi.hheader?
I think this should be ARCH specific. I am not sure whether ARM follows rule of "apic_id = vcpu_id *2".
Julien, could you give some inputs? Thanks.
Quoted 6 lines
I'm not sure why
lapic_idneeds to be a hook in any case, both it's callers use the same exact formula (cpu_id* 2).Thanks, Roger.
Signature · 7 lines
Best regards Tianyu Lan _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 4/4] xl/libacpi: extend lapic_id() to uint32_t
In reply to Wei LiuQuoted 5 lines · Wei Liu
Quoted 4 lines · Lan Tianyu
From: Chao Gao <[email protected]>
This patch is to extend
lapic_id()to support more vcpus.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Chao Gao <[email protected]>Signed-off-by Lan Tianyu <[email protected]>Acked-by Wei Liu <[email protected]>Please remember to pick up my ack next time around -- I believed I already acked this in the previous version.
No, my memory messed up, I didn't actually give my ack. Sorry for the noise.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 2/4] Tool/ACPI: DSDT extension to support more vcpus
In reply to Lan TianyuQuoted 42 lines · Lan Tianyu
Quoted 41 lines · Roger Pau Monné
Quoted 40 lines · Lan Tianyu
Quoted 33 lines · Roger Pau Monné
Quoted 22 lines · Lan Tianyu
This patch is to change DSDT table for processor object to support >128 vcpus accroding to ACPI spec 8.4 Declaring Processors
Signed-off-by Lan Tianyu <[email protected]>--- tools/libacpi/mk_dsdt.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)tools/libacpi/mk_dsdt.c +2
-0@@ -24,6 +24,8 @@#include <xen/arch-arm.h> #endif +#define CPU_NAME_FMT "P%.03X" +static unsigned int indent_level;static bool debug = false;tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 201
Quoted 5 lines
tools/libacpi/mk_dsdt.c +1
-1@@ -196,10 +198,14 @@ int main(int argc, char **argv)/* Define processor objects and control methods. */ for ( cpu =0 ; cpu < max_cpus; cpu++) { -push_block ("Processor" ,"PR%02X, %d, 0x0000b010, 0x06" , cpu, cpu); +unsigned int apic_id = cpu *2 ;This is fragile, ideally there should be a single point where the APIC ID is calculated. Although there are already two places where the APIC ID is calculated, in hvmloader and libxl.
Quoted 2 lines
And I'm not sure how to use any of those here in order to avoid introducing a third one.
The
mk_dsdtis independent tool to build dsdt table. It wasn't linked with libxl and hvmloader. We can't reuse old function to do that.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
But I think we may introduce a new
LAPIC_ID(vcpu)in the arch headfile(i.e, #include <xen/arch-x86/xen.h>)and replace old ones.There's already a
LAPIC_IDmacro in hvmloader headers which should be placed somewhere suitable.Yes, this is what I mentioned.
Jan has expressed some concerns with removing the hook, see:
Quoted 7 lines
Quoted 2 lines
What about removing the
lapic_idhook fromacpi_configand placing theLAPIC_IDmacro in thelibacpi.hheader?I think this should be ARCH specific. I am not sure whether ARM follows rule of "
apic_id=vcpu_id*2".Julien, could you give some inputs? Thanks.
AFAIK ARM doesn't have a local APIC, so there are no xAPIC/x2APIC entries in the ARM MADT.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 3/4] hvmload: Add x2apic entry support in the MADT build
In reply to Roger Pau MonnéQuoted 52 lines · Roger Pau Monné
Quoted 51 lines · Lan Tianyu
This patch is to add x2apic entry support for ACPI MADT table according to ACPI spec 5.2.12.12 Processor Local x2APIC Structure
Signed-off-by Chao Gao <[email protected]>Signed-off-by Lan Tianyu <[email protected]>--- tools/libacpi/acpi2_0.h | 10 +++++++++ tools/libacpi/build.c | 59 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 52 insertions(+), 17 deletions(-)tools/libacpi/acpi2_0.h +10
-0@@ -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 */ +}; +/* * Local APIC Flags. All other bits are reserved and must be 0. */ tools/libacpi/build.c +1
-1@@ -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;
Quoted 11 lines
tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 96
Quoted 9 lines
tools/libacpi/build.c +2
-1if ( config->lapic_id ==NULL )return NULL ;@@ -92,7 +92,12 @@ 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 <128 )This should be done based on APIC ID.
There will be a problem how to get max apic id. Should we use the max vcpu index to get max APIC id?
Quoted 33 lines
Quoted 9 lines
tools/libacpi/build.c +4
-0+ sz +=sizeof (struct acpi_20_madt_lapic ) * hvminfo->nr_vcpus; + else + sz += sizeof(struct acpi_20_madt_lapic) * 128 + +sizeof (struct acpi_20_madt_x2apic ) * (hvminfo->nr_vcpus -128 ); madt = ctxt->mem_ops.alloc (ctxt, sz,16 );if (!madt)return NULL ;tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 117
Quoted 5 lines
tools/libacpi/build.c +1
-1@@ -109,7 +114,7 @@ static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, madt->flags =ACPI_PCAT_COMPAT ;if ( config->table_flags &ACPI_HAS_IOAPIC ) - { + {Spurious cleanup?
Quoted 16 lines
tools/libacpi/build.c +4
-2intsrcovr = (struct acpi_20_madt_intsrcovr *)(madt +1 );for ( i =0 ; i <16 ; i++ ) {@@ -146,27 +151,47 @@ static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, io_apic->ioapic_id = config->ioapic_id; io_apic->ioapic_addr = config->ioapic_base_address; - lapic = (struct acpi_20_madt_lapic *)(io_apic +1 ); + end = (struct acpi_20_madt_lapic *)(io_apic +1 ); }else - lapic = (struct acpi_20_madt_lapic *)(madt +1 ); + end = (struct acpi_20_madt_lapic *)(madt +1 ); + + info->madt_lapic0_addr = ctxt->mem_ops.v2p (ctxt, end);
Quoted 4 lines
tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 154
Quoted 1 line
tools/libacpi/build.c +0
-1- info->nr_cpus = hvminfo->nr_vcpus;Why are you moving this? AFAICT the value of
nr_vpcusis not changed, so you might as well leave it as-is.
OK.
Quoted 19 lines
Quoted 19 lines
tools/libacpi/build.c +6
-10- info->madt_lapic0_addr = ctxt->mem_ops.v2p (ctxt, lapic);for ( i =0 ; i < hvminfo->nr_vcpus; i++ ) { -memset (lapic,0 ,sizeof (*lapic)); - lapic->type =ACPI_PROCESSOR_LOCAL_APIC ; - lapic->length =sizeof (*lapic); -/* Processor ID must match processor-object IDs in the DSDT. */ - lapic->acpi_processor_id = i; - lapic->apic_id = config->lapic_id (i); - lapic->flags = (test_bit (i, hvminfo->vcpu_online) - ?ACPI_LOCAL_APIC_ENABLED :0 ); - lapic++; +unsigned int apic_id = config->lapic_id (i); + +if ( apic_id <255 ) { +struct acpi_20_madt_lapic *lapic = end; + +memset (lapic,0 ,sizeof (*lapic));
Quoted 8 lines
tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 174
Quoted 6 lines
tools/libacpi/build.c +6
-0+ lapic->type =ACPI_PROCESSOR_LOCAL_APIC ; + lapic->length =sizeof (*lapic); +/* Processor ID must match processor-object IDs in the DSDT. */ + lapic->acpi_processor_id = i; + lapic->apic_id = config->lapic_id (i); + lapic->flags = ((i < hvminfo->nr_vcpus) &&I don't understand why you have added this.
If apic_id < 255, still use xapic structure and use x2apic structure for others. I think this is following your comment on last version.
Quoted 3 lines
Roger.
Signature · 4 lines
_______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 3/4] hvmload: Add x2apic entry support in the MADT build
Quoted 12 lines · Lan Tianyu
Quoted 10 lines · Roger Pau Monné
tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 96
Quoted 7 lines · Lan Tianyu
tools/libacpi/build.c +2
-1@@ -92,7 +92,12 @@ 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 <128 )This should be done based on APIC ID.
Quoted 2 lines
There will be a problem how to get max apic id. Should we use the max vcpu index to get max APIC id?
IMHO, this should become a loop that iterates over each vCPU getting it's APIC ID, and add either a lapic or x2apic struct size to sz.
Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
tools/libacpi/build.c +6
-10- info->madt_lapic0_addr = ctxt->mem_ops.v2p (ctxt, lapic);for ( i =0 ; i < hvminfo->nr_vcpus; i++ ) { -memset (lapic,0 ,sizeof (*lapic)); - lapic->type =ACPI_PROCESSOR_LOCAL_APIC ; - lapic->length =sizeof (*lapic); -/* Processor ID must match processor-object IDs in the DSDT. */ - lapic->acpi_processor_id = i; - lapic->apic_id = config->lapic_id (i); - lapic->flags = (test_bit (i, hvminfo->vcpu_online) - ?ACPI_LOCAL_APIC_ENABLED :0 ); - lapic++; +unsigned int apic_id = config->lapic_id (i); + +if ( apic_id <255 ) { +struct acpi_20_madt_lapic *lapic = end; + +memset (lapic,0 ,sizeof (*lapic));Quoted 8 lines
tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 174
Quoted 6 lines
tools/libacpi/build.c +6
-0+ lapic->type =ACPI_PROCESSOR_LOCAL_APIC ; + lapic->length =sizeof (*lapic); +/* Processor ID must match processor-object IDs in the DSDT. */ + lapic->acpi_processor_id = i; + lapic->apic_id = config->lapic_id (i); + lapic->flags = ((i < hvminfo->nr_vcpus) &&I don't understand why you have added this.
Quoted 2 lines
If
apic_id< 255, still use xapic structure and use x2apic structure for others. I think this is following your comment on last version.
I'm complaining about the (i < hvminfo->nr_vcpus) check, from the loop above i is bounded to hvminfo->nr_vpcu, so this check is useless AFAICT.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 2/4] Tool/ACPI: DSDT extension to support more vcpus
In reply to Roger Pau MonnéQuoted 46 lines · Roger Pau Monné
Quoted 45 lines · Lan Tianyu
Quoted 44 lines · Roger Pau Monné
Quoted 42 lines · Lan Tianyu
Quoted 33 lines · Roger Pau Monné
Quoted 22 lines · Lan Tianyu
This patch is to change DSDT table for processor object to support >128 vcpus accroding to ACPI spec 8.4 Declaring Processors
Signed-off-by Lan Tianyu <[email protected]>--- tools/libacpi/mk_dsdt.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)tools/libacpi/mk_dsdt.c +2
-0@@ -24,6 +24,8 @@#include <xen/arch-arm.h> #endif +#define CPU_NAME_FMT "P%.03X" +static unsigned int indent_level;static bool debug = false;tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 201
Quoted 5 lines
tools/libacpi/mk_dsdt.c +1
-1@@ -196,10 +198,14 @@ int main(int argc, char **argv)/* Define processor objects and control methods. */ for ( cpu =0 ; cpu < max_cpus; cpu++) { -push_block ("Processor" ,"PR%02X, %d, 0x0000b010, 0x06" , cpu, cpu); +unsigned int apic_id = cpu *2 ;This is fragile, ideally there should be a single point where the APIC ID is calculated. Although there are already two places where the APIC ID is calculated, in hvmloader and libxl.
Quoted 2 lines
And I'm not sure how to use any of those here in order to avoid introducing a third one.
The
mk_dsdtis independent tool to build dsdt table. It wasn't linked with libxl and hvmloader. We can't reuse old function to do that.But I think we may introduce a new
LAPIC_ID(vcpu)in the arch headfile(i.e, #include <xen/arch-x86/xen.h>)and replace old ones.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
There's already a
LAPIC_IDmacro in hvmloader headers which should be placed somewhere suitable.Yes, this is what I mentioned.
Jan has expressed some concerns with removing the hook, see:
So we still need to introduce LAPIC_ID() here, right?
Quoted 12 lines
Quoted 8 lines
Quoted 3 lines
What about removing the
lapic_idhook fromacpi_configand placing theLAPIC_IDmacro in thelibacpi.hheader?I think this should be ARCH specific. I am not sure whether ARM follows rule of "
apic_id=vcpu_id*2".Julien, could you give some inputs? Thanks.
AFAIK ARM doesn't have a local APIC, so there are no xAPIC/x2APIC entries in the ARM MADT.
Signature · 7 lines
Best regards Tianyu Lan _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 3/4] hvmload: Add x2apic entry support in the MADT build
In reply to Roger Pau MonnéQuoted 14 lines
Quoted 1 line
Quoted 1 line · On 04.09.17 at 13:12, <[email protected]> wrote:
Quoted 12 lines · Lan Tianyu
Quoted 10 lines · Roger Pau Monné
tools/libacpi/build.c static struct acpi_20_madt *construct_madt(struct acpi_ctxt *ctxt, · line 96
Quoted 7 lines · Lan Tianyu
tools/libacpi/build.c +2
-1@@ -92,7 +92,12 @@ 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 <128 )This should be done based on APIC ID.
Quoted 5 lines
Quoted 2 lines
There will be a problem how to get max apic id. Should we use the max vcpu index to get max APIC id?
IMHO, this should become a loop that iterates over each vCPU getting it's APIC ID, and add either a lapic or x2apic struct size to sz.
Indeed.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [RFC PATCH V2 2/4] Tool/ACPI: DSDT extension to support more vcpus
In reply to Roger Pau MonnéHi,
Sorry for the late reply.
Quoted 58 lines · Roger Pau Monné
Quoted 42 lines · Lan Tianyu
Quoted 41 lines · Roger Pau Monné
Quoted 40 lines · Lan Tianyu
Quoted 33 lines · Roger Pau Monné
Quoted 22 lines · Lan Tianyu
This patch is to change DSDT table for processor object to support >128 vcpus accroding to ACPI spec 8.4 Declaring Processors
Signed-off-by Lan Tianyu <[email protected]>--- tools/libacpi/mk_dsdt.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)tools/libacpi/mk_dsdt.c +2
-0@@ -24,6 +24,8 @@#include <xen/arch-arm.h> #endif +#define CPU_NAME_FMT "P%.03X" +static unsigned int indent_level;static bool debug = false;tools/libacpi/mk_dsdt.c int main(int argc, char **argv) · line 201
Quoted 5 lines
tools/libacpi/mk_dsdt.c +1
-1@@ -196,10 +198,14 @@ int main(int argc, char **argv)/* Define processor objects and control methods. */ for ( cpu =0 ; cpu < max_cpus; cpu++) { -push_block ("Processor" ,"PR%02X, %d, 0x0000b010, 0x06" , cpu, cpu); +unsigned int apic_id = cpu *2 ;This is fragile, ideally there should be a single point where the APIC ID is calculated. Although there are already two places where the APIC ID is calculated, in hvmloader and libxl.
Quoted 2 lines
And I'm not sure how to use any of those here in order to avoid introducing a third one.
The
mk_dsdtis independent tool to build dsdt table. It wasn't linked with libxl and hvmloader. We can't reuse old function to do that.Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
But I think we may introduce a new
LAPIC_ID(vcpu)in the arch headfile(i.e, #include <xen/arch-x86/xen.h>)and replace old ones.There's already a
LAPIC_IDmacro in hvmloader headers which should be placed somewhere suitable.Yes, this is what I mentioned.
Jan has expressed some concerns with removing the hook, see:
Quoted 3 lines
Quoted 2 lines
What about removing the
lapic_idhook fromacpi_configand placing theLAPIC_IDmacro in thelibacpi.hheader?
Quoted 7 lines
Quoted 4 lines
I think this should be ARCH specific. I am not sure whether ARM follows rule of "
apic_id=vcpu_id*2".Julien, could you give some inputs? Thanks.
AFAIK ARM doesn't have a local APIC, so there are no xAPIC/x2APIC entries in the ARM MADT.
That's correct. ARM does not use xAPIC/x2APIC tables.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel