Re: [Xen-devel] [PATCH 1/2] hvmloader: limit CPUs exposed to guests

2016-06-17 Thread Andrew Cooper
On 16/06/16 10:40, Jan Beulich wrote:
> Various Linux versions allocate (partial) per-CPU data for all of them,
> as there is no indication in MADT whether they're hotpluggable. That's
> a little wasteful in terms of resource consumption especially for
> - guests with not overly much memory assigned,
> - 32-bit guests not having overly much address space available.
> Therefore limit what we put into MADT to the "maxvcpus" value, and make
> sure AML doesn't touch memory addresses corresponding to CPUs beyond
> that value (we can't reasonably make the respective processor objects
> disappear).
>
> Signed-off-by: Jan Beulich 

I don't feel that I know AML well enough to review, but the C looks ok
and this seems like a sensible change.

Acked-by: Andrew Cooper 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 1/2] hvmloader: limit CPUs exposed to guests

2016-06-16 Thread Jan Beulich
>>> On 16.06.16 at 17:37,  wrote:
> On 06/16/2016 11:25 AM, Jan Beulich wrote:
> On 16.06.16 at 17:09,  wrote:
>>> On 06/16/2016 05:40 AM, Jan Beulich wrote:
>>>
>>> --- a/tools/firmware/hvmloader/acpi/mk_dsdt.c
>>> +++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c
>>> @@ -150,6 +150,14 @@ int main(int argc, char **argv)
>>>  indent(); printf("MSU, 8\n");
>>>  pop_block();
>>>  
>>> +/* Processor object helpers. */
>>> +push_block("Method", "PMAT, 2");
>>> +push_block("If", "LLess(Arg0, NCPU)");
>>> +stmt("Return", "ToBuffer(Arg1)");
>>> +pop_block();
>>> +stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
>>>
>>>
>>> Could you explain what this is? (I suspect  this is related to MAT
>>> object and I don't think I understand what it is).
>> This is a helper routine for _MAT(), helping greatly to reduce
>> overall size of the DSDT. It checks whether the CPU is within the
>> range of available ones (online or offline), and if it isn't returns a
>> static buffer instead of data read from MADT (as it's the purpose
>> of this patch to remove these MADT entries for not present CPUs).
> 
> I meant just the last line (I understand what the routine is --- I am
> not clear where MAT format is defined).

That's a MADT entry of type ACPI_MADT_TYPE_LOCAL_APIC. Basically
an equivalent of the ToBuffer(MAT) used previously (and now still used
for CPU0).

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 1/2] hvmloader: limit CPUs exposed to guests

2016-06-16 Thread Boris Ostrovsky
On 06/16/2016 11:25 AM, Jan Beulich wrote:
 On 16.06.16 at 17:09,  wrote:
>> On 06/16/2016 05:40 AM, Jan Beulich wrote:
>>
>> --- a/tools/firmware/hvmloader/acpi/mk_dsdt.c
>> +++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c
>> @@ -150,6 +150,14 @@ int main(int argc, char **argv)
>>  indent(); printf("MSU, 8\n");
>>  pop_block();
>>  
>> +/* Processor object helpers. */
>> +push_block("Method", "PMAT, 2");
>> +push_block("If", "LLess(Arg0, NCPU)");
>> +stmt("Return", "ToBuffer(Arg1)");
>> +pop_block();
>> +stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
>>
>>
>> Could you explain what this is? (I suspect  this is related to MAT
>> object and I don't think I understand what it is).
> This is a helper routine for _MAT(), helping greatly to reduce
> overall size of the DSDT. It checks whether the CPU is within the
> range of available ones (online or offline), and if it isn't returns a
> static buffer instead of data read from MADT (as it's the purpose
> of this patch to remove these MADT entries for not present CPUs).

I meant just the last line (I understand what the routine is --- I am
not clear where MAT format is defined).

-boris

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 1/2] hvmloader: limit CPUs exposed to guests

2016-06-16 Thread Jan Beulich
>>> On 16.06.16 at 17:09,  wrote:
> On 06/16/2016 05:40 AM, Jan Beulich wrote:
> 
> --- a/tools/firmware/hvmloader/acpi/mk_dsdt.c
> +++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c
> @@ -150,6 +150,14 @@ int main(int argc, char **argv)
>  indent(); printf("MSU, 8\n");
>  pop_block();
>  
> +/* Processor object helpers. */
> +push_block("Method", "PMAT, 2");
> +push_block("If", "LLess(Arg0, NCPU)");
> +stmt("Return", "ToBuffer(Arg1)");
> +pop_block();
> +stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
> 
> 
> Could you explain what this is? (I suspect  this is related to MAT
> object and I don't think I understand what it is).

This is a helper routine for _MAT(), helping greatly to reduce
overall size of the DSDT. It checks whether the CPU is within the
range of available ones (online or offline), and if it isn't returns a
static buffer instead of data read from MADT (as it's the purpose
of this patch to remove these MADT entries for not present CPUs).

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 1/2] hvmloader: limit CPUs exposed to guests

2016-06-16 Thread Boris Ostrovsky
On 06/16/2016 05:40 AM, Jan Beulich wrote:

--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c
+++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c
@@ -150,6 +150,14 @@ int main(int argc, char **argv)
 indent(); printf("MSU, 8\n");
 pop_block();
 
+/* Processor object helpers. */
+push_block("Method", "PMAT, 2");
+push_block("If", "LLess(Arg0, NCPU)");
+stmt("Return", "ToBuffer(Arg1)");
+pop_block();
+stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");


Could you explain what this is? (I suspect  this is related to MAT
object and I don't think I understand what it is).

-boris



___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel