[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 02/29] numa: Allow setting NUMA distance for diff
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PULL 02/29] numa: Allow setting NUMA distance for different NUMA nodes |
Date: |
Tue, 30 May 2017 13:21:04 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
On 05/30/2017 01:10 PM, Eduardo Habkost wrote:
> On Tue, May 30, 2017 at 10:28:21AM -0500, Eric Blake wrote:
>> On 05/30/2017 09:01 AM, Eduardo Habkost wrote:
>>
>>>> The OSX compiler is pickier about format strings than gcc,
>>>> and neither "MAX_NODES" nor "MAX(anything)" are uint16_t type.
>>>
>>> src and dst are both uint16_t, so MAX(src, dst) is also uint16_t,
>>> isn't it? It looks like MAX_NODES is the problem.
>>
>> No. MAX() invokes arithmetic (both ?: and > operators), and arithmetic
>> involves default promotion (anything shorter than int becomes 'int').
>
> Oh, I didn't know that.
And the fact that var-arg passing REQUIRES promotion means you CAN'T
tell the difference from a true uint16_t argument and an int argument
which resulted from arithmetic promotion. Which is why Paolo has argued
that the MacOS compiler warning is bogus because it is overly picky.
But we obviously are in no position to get it changed.
>
>>
>>> +++ b/numa.c
>>> @@ -232,7 +232,7 @@ static void parse_numa_distance(NumaDistOptions *dist,
>>> Error **errp)
>>> if (src >= MAX_NODES || dst >= MAX_NODES) {
>>> error_setg(errp,
>>> "Invalid node %" PRIu16
>>> - ", max possible could be %" PRIu16,
>>> + ", max possible could be %d",
>>
>> Don't you want %u to match PRIu16, rather than %d?
>
> Can't this (using %u with an int argument) make more pedantic
> compilers complain?
Yes, gcc's -Wformat-signedness would (probably) flag it. But we don't
use that. At any rate, ALL uint16_t values are formatted identically
for both %u and %d, so as long as we have a formula for keeping picky
compilers silent, I don't care beyond that point.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PULL 03/29] numa: equally distribute memory on nodes, Eduardo Habkost, 2017/05/11
[Qemu-devel] [PULL 04/29] tests: acpi: extend cphp and memhp testcase with numa distance check, Eduardo Habkost, 2017/05/11
[Qemu-devel] [PULL 05/29] tests: add CPUs to numa node mapping test, Eduardo Habkost, 2017/05/11
[Qemu-devel] [PULL 06/29] hw/arm/virt: extract mp-affinity calculation in separate function, Eduardo Habkost, 2017/05/11
[Qemu-devel] [PULL 07/29] hw/arm/virt: use machine->possible_cpus for storing possible topology info, Eduardo Habkost, 2017/05/11
[Qemu-devel] [PULL 08/29] hw/arm/virt: explicitly allocate cpu_index for cpus, Eduardo Habkost, 2017/05/11
[Qemu-devel] [PULL 09/29] numa: move source of default CPUs to NUMA node mapping into boards, Eduardo Habkost, 2017/05/11
[Qemu-devel] [PULL 11/29] pc: add node-id property to CPU, Eduardo Habkost, 2017/05/11