Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1320252

Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT

From Hanjun Guo <guohanjun@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT
Date 2016-01-28 04:20 +0100
Message-ID <qVLhL-5vZ-5@gated-at.bofh.it> (permalink)
References <qU2Zr-K2-5@gated-at.bofh.it> <qU2Zs-K2-23@gated-at.bofh.it> <qUMzg-2um-5@gated-at.bofh.it> <qVsyt-8nX-1@gated-at.bofh.it> <qVzqi-4RW-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2016/1/27 22:01, Robert Richter wrote:
> On 27.01.16 15:12:15, Hanjun Guo wrote:
>> On 2016/1/25 18:21, Robert Richter wrote:
>>> On 23.01.16 17:39:20, Hanjun Guo wrote:
>>>> diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c
>>>> new file mode 100644
>>>> index 0000000..f7f7533
>>>> --- /dev/null
>>>> +++ b/arch/arm64/kernel/acpi_numa.c
>>>> +/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
>>>> +int __init acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
>>>> +{
>>>> +	u64 start, end;
>>>> +	int node, pxm;
>>>> +
>>>> +	if (srat_disabled())
>>>> +		return -EINVAL;
>>>> +
>>>> +	if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) {
>>> Must be:
>>>
>>> 	ma->header.length < sizeof(struct acpi_srat_mem_affinity)) {
>>>
>>> Allow extensions to struct acpi_srat_mem_affinity in newer versions.
>> Hmm, I think we need to remove the check here now.
> No, we might have an out-of-bound access then.
>
>> There are three cases:
>>
>>  - firmware ACPI version is consistent with the ACPICA one, then
>>    ma->header.length == sizeof(struct acpi_srat_mem_affinity )
>>
>>  - firmware ACPI version is not consistent with the ACPICA one,
>>    for example, struct acpi_srat_mem_affinity is extended in
>>    new ACI version, but the formware is using the older one,
>>   then it's ok to use
>>   ma->header.length < sizeof(struct acpi_srat_mem_affinity )
> The check above is ok as we need at least struct
> acpi_srat_mem_affinity as it is now.
>
> If we later change the kernel to support multiple versions of struct
> acpi_srat_mem_affinity, i.e. use data from an extended section, we
> will need to add code to handle that. This will include support of
> data with length < acpi_srat_mem_affinity, in this case we may not use
> extended data.

I checked the ACPI spec about memory affinity structure, it still have 10 bytes
reserved for future use, so I think it's safe as you suggested for next few years.

>
>>  - but if we use the older kernel + updated new firmware,
>>    then
>>    ma->header.length > sizeof(struct acpi_srat_mem_affinity )
>>   will be the case, right?
> Right, and this is a valid case not resulting in an error with my
> suggestion above.

Yes, I just mixed up those two cases.

I will sync with Ganapat to prepare a new version and test it on x86 and
IA64 to make sure this patch set don't break anything.

Thanks
Hanjun

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/12] ACPI NUMA support for ARM64 Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
  [PATCH v3 08/12] arm64, numa: rework numa_add_memblk() Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
    Re: [PATCH v3 08/12] arm64, numa: rework numa_add_memblk() Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-25 11:10 +0100
      Re: [PATCH v3 08/12] arm64, numa: rework numa_add_memblk() Hanjun Guo <guohanjun@huawei.com> - 2016-01-27 07:30 +0100
  [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
    Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT  and SLIT Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-25 11:30 +0100
      Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT  and SLIT Hanjun Guo <guohanjun@huawei.com> - 2016-01-27 08:20 +0100
        Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT  and SLIT Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-27 15:40 +0100
          Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT  and SLIT Hanjun Guo <guohanjun@huawei.com> - 2016-01-28 04:20 +0100
    Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT  and SLIT Robert Richter <robert.richter@caviumnetworks.com> - 2016-02-01 19:20 +0100
      Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT  and SLIT Hanjun Guo <hanjun.guo@linaro.org> - 2016-02-02 12:40 +0100
        Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT  and SLIT Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-02-02 18:00 +0100
  [PATCH v3 12/12] acpi, numa: reuse acpi_numa_memory_affinity_init() Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
    Re: [PATCH v3 12/12] acpi, numa: reuse  acpi_numa_memory_affinity_init() Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-25 11:30 +0100
      Re: [PATCH v3 12/12] acpi, numa: reuse  acpi_numa_memory_affinity_init() Hanjun Guo <guohanjun@huawei.com> - 2016-01-27 07:20 +0100
        Re: [PATCH v3 12/12] acpi, numa: reuse  acpi_numa_memory_affinity_init() Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-27 15:20 +0100
          Re: [PATCH v3 12/12] acpi, numa: reuse  acpi_numa_memory_affinity_init() Hanjun Guo <guohanjun@huawei.com> - 2016-01-28 03:50 +0100
            Re: [PATCH v3 12/12] acpi, numa: reuse  acpi_numa_memory_affinity_init() Robert Richter <robert.richter@caviumnetworks.com> - 2016-01-28 14:40 +0100
  [PATCH v3 10/12] acpi, numa: move bad_srat() and srat_disabled() to common place Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
  [PATCH v3 02/12] acpi, numa: Replace ACPI_DEBUG_PRINT() with pr_debug() Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100
  [PATCH v3 07/12] acpi, numa: move acpi_numa_slit_init() to common place Hanjun Guo <guohanjun@huawei.com> - 2016-01-23 10:50 +0100

csiph-web