qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount
@ 2023-05-29 12:43 Zhao Liu
  2023-06-13  7:49 ` Zhao Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Zhao Liu @ 2023-05-29 12:43 UTC (permalink / raw)
  To: Sunil Muthuswamy; +Cc: qemu-devel, Zhenyu Wang, Zhao Liu

From: Zhao Liu <zhao1.liu@intel.com>

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 <sunilmut@microsoft.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 target/i386/whpx/whpx-all.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index 52af81683c1e..5882bf22d0a1 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -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;
     }
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount
  2023-05-29 12:43 [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount Zhao Liu
@ 2023-06-13  7:49 ` Zhao Liu
  2023-06-28  1:31 ` Zhao Liu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Zhao Liu @ 2023-06-13  7:49 UTC (permalink / raw)
  To: Sunil Muthuswamy; +Cc: qemu-devel, Zhenyu Wang, Zhao Liu

Just a ping...

Hi Sunil, could you please take some time to look at this patch? Thank
you!

Regards,
Zhao

On Mon, May 29, 2023 at 08:43:31PM +0800, Zhao Liu wrote:
> Date: Mon, 29 May 2023 20:43:31 +0800
> From: Zhao Liu <zhao1.liu@linux.intel.com>
> Subject: [PATCH] i386/WHPX: Fix error message when fail to set
>  ProcessorCount
> X-Mailer: git-send-email 2.34.1
> 
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> 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 <sunilmut@microsoft.com>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>  target/i386/whpx/whpx-all.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
> index 52af81683c1e..5882bf22d0a1 100644
> --- a/target/i386/whpx/whpx-all.c
> +++ b/target/i386/whpx/whpx-all.c
> @@ -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;
>      }
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount
  2023-05-29 12:43 [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount Zhao Liu
  2023-06-13  7:49 ` Zhao Liu
@ 2023-06-28  1:31 ` Zhao Liu
  2023-06-28  6:19 ` Philippe Mathieu-Daudé
  2023-06-28 11:59 ` Philippe Mathieu-Daudé
  3 siblings, 0 replies; 6+ messages in thread
From: Zhao Liu @ 2023-06-28  1:31 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Sunil Muthuswamy, qemu-devel, Zhenyu Wang, Zhao Liu

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

On Mon, May 29, 2023 at 08:43:31PM +0800, Zhao Liu wrote:
> Date: Mon, 29 May 2023 20:43:31 +0800
> From: Zhao Liu <zhao1.liu@linux.intel.com>
> Subject: [PATCH] i386/WHPX: Fix error message when fail to set
>  ProcessorCount
> X-Mailer: git-send-email 2.34.1
> 
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> 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 <sunilmut@microsoft.com>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>  target/i386/whpx/whpx-all.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
> index 52af81683c1e..5882bf22d0a1 100644
> --- a/target/i386/whpx/whpx-all.c
> +++ b/target/i386/whpx/whpx-all.c
> @@ -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;
>      }
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount
  2023-05-29 12:43 [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount Zhao Liu
  2023-06-13  7:49 ` Zhao Liu
  2023-06-28  1:31 ` Zhao Liu
@ 2023-06-28  6:19 ` Philippe Mathieu-Daudé
  2023-06-28 11:59 ` Philippe Mathieu-Daudé
  3 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-28  6:19 UTC (permalink / raw)
  To: Zhao Liu, Sunil Muthuswamy; +Cc: qemu-devel, Zhenyu Wang, Zhao Liu

On 29/5/23 14:43, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> 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 <sunilmut@microsoft.com>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   target/i386/whpx/whpx-all.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
> index 52af81683c1e..5882bf22d0a1 100644
> --- a/target/i386/whpx/whpx-all.c
> +++ b/target/i386/whpx/whpx-all.c
> @@ -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:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

>           ret = -EINVAL;
>           goto error;
>       }



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount
  2023-05-29 12:43 [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount Zhao Liu
                   ` (2 preceding siblings ...)
  2023-06-28  6:19 ` Philippe Mathieu-Daudé
@ 2023-06-28 11:59 ` Philippe Mathieu-Daudé
  2023-06-28 13:04   ` Zhao Liu
  3 siblings, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-28 11:59 UTC (permalink / raw)
  To: Zhao Liu, Sunil Muthuswamy; +Cc: qemu-devel, Zhenyu Wang, Zhao Liu

On 29/5/23 14:43, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> 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 <sunilmut@microsoft.com>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   target/i386/whpx/whpx-all.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Patch queued (fixing the unsigned format), thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount
  2023-06-28 11:59 ` Philippe Mathieu-Daudé
@ 2023-06-28 13:04   ` Zhao Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Zhao Liu @ 2023-06-28 13:04 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Sunil Muthuswamy, qemu-devel, Zhenyu Wang, Zhao Liu

On Wed, Jun 28, 2023 at 01:59:56PM +0200, Philippe Mathieu-Daudé wrote:
> Date: Wed, 28 Jun 2023 13:59:56 +0200
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: Re: [PATCH] i386/WHPX: Fix error message when fail to set
>  ProcessorCount
> 
> On 29/5/23 14:43, Zhao Liu wrote:
> > From: Zhao Liu <zhao1.liu@intel.com>
> > 
> > 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 <sunilmut@microsoft.com>
> > Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> > ---
> >   target/i386/whpx/whpx-all.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Patch queued (fixing the unsigned format), thanks.
>

Many thanks!

-Zhao


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-28 12:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-29 12:43 [PATCH] i386/WHPX: Fix error message when fail to set ProcessorCount Zhao Liu
2023-06-13  7:49 ` Zhao Liu
2023-06-28  1:31 ` Zhao Liu
2023-06-28  6:19 ` Philippe Mathieu-Daudé
2023-06-28 11:59 ` Philippe Mathieu-Daudé
2023-06-28 13:04   ` Zhao Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).