i386/WHPX: Fix error message when fail to set ProcessorCount
PATCH 1/1 i386/WHPX: Fix error message when fail to set ProcessorCount
From: Zhao Liu <[email protected]>
003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology") changes the meaning of MachineState.smp.cores from "the number of cores in one package" to "the number of cores in one die" and doesn't fix other uses of MachineState.smp.cores. And because of the introduction of cluster, now smp.cores just means "the number of cores in one cluster". This clearly does not fit the semantics here.
And before this error message, WHvSetPartitionProperty() is called to set prop.ProcessorCount.
So the error message should show the prop.ProcessorCount other than "cores per cluster" or "cores per package".
--- target/i386/whpx/whpx-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/i386/whpx/whpx-all.c +2 -2
@@ -2613,8 +2613,8 @@ static int whpx_accel_init(MachineState *ms) sizeof(WHV_PARTITION_PROPERTY));if (FAILED (hr)) { -error_report ("WHPX: Failed to set partition core count to %d," -" hr=%08lx" , ms->smp.cores, hr); +error_report ("WHPX: Failed to set partition processor count to %d," +" hr=%08lx" , prop.ProcessorCount, hr); ret = -EINVAL ; goto error; }
Signature · 1 line
2.34.1
Just a ping...
Hi Sunil, could you please take some time to look at this patch? Thank you!
Regards,
Zhao
Quoted 45 lines · Zhao Liu
Date: Mon, 29 May 2023 20:43:31 +0800
From: Zhao Liu <[email protected]>
Subject: [PATCH] i386/WHPX: Fix error message when fail to set
ProcessorCount
X-Mailer: git-send-email 2.34.1From: Zhao Liu <[email protected]>
003f230e37d7("machine: Tweak the order of topology members in struct CpuTopology") changes the meaning of MachineState.smp.cores from "the number of cores in one package" to "the number of cores in one die" and doesn't fix other uses of MachineState.smp.cores. And because of the introduction of cluster, now smp.cores just means "the number of cores in one cluster". This clearly does not fit the semantics here.And before this error message,
WHvSetPartitionProperty()is called to set prop.ProcessorCount.So the error message should show the prop.ProcessorCount other than "cores per cluster" or "cores per package".
Cc Sunil Muthuswamy <[email protected]>Signed-off-by Zhao Liu <[email protected]>--- target/i386/whpx/whpx-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/whpx/whpx-all.c +2
-2@@ -2613,8 +2613,8 @@ static int whpx_accel_init(MachineState *ms) sizeof(WHV_PARTITION_PROPERTY));if (FAILED (hr)) { -error_report ("WHPX: Failed to set partition core count to %d," -" hr=%08lx" , ms->smp.cores, hr); +error_report ("WHPX: Failed to set partition processor count to %d," +" hr=%08lx" , prop.ProcessorCount, hr); ret = -EINVAL ; goto error; }Signature · 1 line
2.34.1
Hi Paolo
Could I add you for this patch's review?
Let me add more background of this cleanup:
This patch is one of my cleanups of smp.cores.
I am trying to introduce hybrid topology. in hybrid topology, different clusters will have different number of cores, so calling smp.cores directly in i386 code will have problems. So that's what I'm preparing before trying hybrid topology.
I split this cleanup from my previous hybrid topology v1 RFC [1] to facilitate review.
[1]: https://mail.gnu.org/archive/html/qemu-devel/2023-02/msg03205.html
Thanks,
Zhao
Quoted 45 lines · Zhao Liu
Date: Mon, 29 May 2023 20:43:31 +0800
From: Zhao Liu <[email protected]>
Subject: [PATCH] i386/WHPX: Fix error message when fail to set
ProcessorCount
X-Mailer: git-send-email 2.34.1From: Zhao Liu <[email protected]>
003f230e37d7("machine: Tweak the order of topology members in struct CpuTopology") changes the meaning of MachineState.smp.cores from "the number of cores in one package" to "the number of cores in one die" and doesn't fix other uses of MachineState.smp.cores. And because of the introduction of cluster, now smp.cores just means "the number of cores in one cluster". This clearly does not fit the semantics here.And before this error message,
WHvSetPartitionProperty()is called to set prop.ProcessorCount.So the error message should show the prop.ProcessorCount other than "cores per cluster" or "cores per package".
Cc Sunil Muthuswamy <[email protected]>Signed-off-by Zhao Liu <[email protected]>--- target/i386/whpx/whpx-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/whpx/whpx-all.c +2
-2@@ -2613,8 +2613,8 @@ static int whpx_accel_init(MachineState *ms) sizeof(WHV_PARTITION_PROPERTY));if (FAILED (hr)) { -error_report ("WHPX: Failed to set partition core count to %d," -" hr=%08lx" , ms->smp.cores, hr); +error_report ("WHPX: Failed to set partition processor count to %d," +" hr=%08lx" , prop.ProcessorCount, hr); ret = -EINVAL ; goto error; }Signature · 1 line
2.34.1
Quoted 26 lines · Zhao Liu
From: Zhao Liu <[email protected]>
003f230e37d7("machine: Tweak the order of topology members in struct CpuTopology") changes the meaning of MachineState.smp.cores from "the number of cores in one package" to "the number of cores in one die" and doesn't fix other uses of MachineState.smp.cores. And because of the introduction of cluster, now smp.cores just means "the number of cores in one cluster". This clearly does not fit the semantics here.And before this error message,
WHvSetPartitionProperty()is called to set prop.ProcessorCount.So the error message should show the prop.ProcessorCount other than "cores per cluster" or "cores per package".
Cc Sunil Muthuswamy <[email protected]>Signed-off-by Zhao Liu <[email protected]>--- target/i386/whpx/whpx-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/whpx/whpx-all.c +0
-0
target/i386/whpx/whpx-all.c static int whpx_accel_init(MachineState *ms) · line 2617
Quoted 7 lines
target/i386/whpx/whpx-all.c +2
-2@@ -2613,8 +2613,8 @@ static int whpx_accel_init(MachineState *ms) sizeof(WHV_PARTITION_PROPERTY));if (FAILED (hr)) { -error_report ("WHPX: Failed to set partition core count to %d," -" hr=%08lx" , ms->smp.cores, hr); +error_report ("WHPX: Failed to set partition processor count to %d," +" hr=%08lx" , prop.ProcessorCount, hr);
ProcessorCount is UINT32, so '%d' -> '%u'. Otherwise:
Quoted 3 lines
target/i386/whpx/whpx-all.c +0
-0ret = -EINVAL ; goto error; }
Quoted 12 lines · Zhao Liu
From: Zhao Liu <[email protected]>
003f230e37d7("machine: Tweak the order of topology members in struct CpuTopology") changes the meaning of MachineState.smp.cores from "the number of cores in one package" to "the number of cores in one die" and doesn't fix other uses of MachineState.smp.cores. And because of the introduction of cluster, now smp.cores just means "the number of cores in one cluster". This clearly does not fit the semantics here.And before this error message,
WHvSetPartitionProperty()is called to set prop.ProcessorCount.
Quoted 8 lines
So the error message should show the prop.ProcessorCount other than "cores per cluster" or "cores per package".
Cc Sunil Muthuswamy <[email protected]>Signed-off-by Zhao Liu <[email protected]>--- target/i386/whpx/whpx-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Patch queued (fixing the unsigned format), thanks.
Quoted 21 lines · Philippe Mathieu-Daudé
Date: Wed, 28 Jun 2023 13:59:56 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: Re: [PATCH] i386/WHPX: Fix error message when fail to set
ProcessorCountQuoted 15 lines · Zhao Liu
From: Zhao Liu <[email protected]>
003f230e37d7("machine: Tweak the order of topology members in struct CpuTopology") changes the meaning of MachineState.smp.cores from "the number of cores in one package" to "the number of cores in one die" and doesn't fix other uses of MachineState.smp.cores. And because of the introduction of cluster, now smp.cores just means "the number of cores in one cluster". This clearly does not fit the semantics here.And before this error message,
WHvSetPartitionProperty()is called to set prop.ProcessorCount.So the error message should show the prop.ProcessorCount other than "cores per cluster" or "cores per package".
Quoted 8 lines
Quoted 5 lines
Cc Sunil Muthuswamy <[email protected]>Signed-off-by Zhao Liu <[email protected]>--- target/i386/whpx/whpx-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Patch queued (fixing the unsigned format), thanks.
Many thanks!
-Zhao