qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()
@ 2023-06-20  7:48 Philippe Mathieu-Daudé
  2023-06-20  7:55 ` Claudio Fontana
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-20  7:48 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, Cédric Le Goater,
	Daniel Henrique Barboza, David Gibson, Greg Kurz, qemu-ppc,
	Philippe Mathieu-Daudé

Although the PPC target only supports the TCG and KVM
accelerators, QEMU supports more. We can no assume that
'!kvm == tcg', so test for the correct accelerator. This
also eases code review, because here we don't care about
KVM, we really want to test for TCG.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/spapr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index dcb7f1c70a..c4b666587b 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
     int ret;
     unsigned int smp_threads = ms->smp.threads;
 
-    if (!kvm_enabled() && (smp_threads > 1)) {
+    if (tcg_enabled() && (smp_threads > 1)) {
         error_setg(errp, "TCG cannot support more than 1 thread/core "
                    "on a pseries machine");
         return;
-- 
2.38.1



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

* Re: [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()
  2023-06-20  7:48 [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled() Philippe Mathieu-Daudé
@ 2023-06-20  7:55 ` Claudio Fontana
  2023-06-20 14:48   ` Greg Kurz
  2023-06-20  7:59 ` Harsh Prateek Bora
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Claudio Fontana @ 2023-06-20  7:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Harsh Prateek Bora, Cédric Le Goater,
	Daniel Henrique Barboza, David Gibson, Greg Kurz, qemu-ppc

On 6/20/23 09:48, Philippe Mathieu-Daudé wrote:
> Although the PPC target only supports the TCG and KVM
> accelerators, QEMU supports more. We can no assume that
> '!kvm == tcg', so test for the correct accelerator. This
> also eases code review, because here we don't care about
> KVM, we really want to test for TCG.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

I don't remember anymore, but what about qtest ? It is usually the forgotten case in these kind of tests... so much complexity :-)

Ciao,

Claudio


> ---
>  hw/ppc/spapr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index dcb7f1c70a..c4b666587b 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
>      int ret;
>      unsigned int smp_threads = ms->smp.threads;
>  
> -    if (!kvm_enabled() && (smp_threads > 1)) {
> +    if (tcg_enabled() && (smp_threads > 1)) {
>          error_setg(errp, "TCG cannot support more than 1 thread/core "
>                     "on a pseries machine");
>          return;



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

* Re: [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()
  2023-06-20  7:48 [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled() Philippe Mathieu-Daudé
  2023-06-20  7:55 ` Claudio Fontana
@ 2023-06-20  7:59 ` Harsh Prateek Bora
  2023-06-20  8:06 ` Cédric Le Goater
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Harsh Prateek Bora @ 2023-06-20  7:59 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Cédric Le Goater, Daniel Henrique Barboza, David Gibson,
	Greg Kurz, qemu-ppc



On 6/20/23 13:18, Philippe Mathieu-Daudé wrote:
> Although the PPC target only supports the TCG and KVM
> accelerators, QEMU supports more. We can no assume that
> '!kvm == tcg', so test for the correct accelerator. This
> also eases code review, because here we don't care about
> KVM, we really want to test for TCG.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/ppc/spapr.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index dcb7f1c70a..c4b666587b 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
>       int ret;
>       unsigned int smp_threads = ms->smp.threads;
>   
> -    if (!kvm_enabled() && (smp_threads > 1)) {
> +    if (tcg_enabled() && (smp_threads > 1)) {
>           error_setg(errp, "TCG cannot support more than 1 thread/core "
>                      "on a pseries machine");

Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>

>           return;


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

* Re: [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()
  2023-06-20  7:48 [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled() Philippe Mathieu-Daudé
  2023-06-20  7:55 ` Claudio Fontana
  2023-06-20  7:59 ` Harsh Prateek Bora
@ 2023-06-20  8:06 ` Cédric Le Goater
  2023-06-20  8:33 ` David Gibson
  2023-06-20 11:09 ` BALATON Zoltan
  4 siblings, 0 replies; 8+ messages in thread
From: Cédric Le Goater @ 2023-06-20  8:06 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Harsh Prateek Bora, Daniel Henrique Barboza, David Gibson,
	Greg Kurz, qemu-ppc, Nicholas Piggin

On 6/20/23 09:48, Philippe Mathieu-Daudé wrote:
> Although the PPC target only supports the TCG and KVM
> accelerators, QEMU supports more. We can no assume that
> '!kvm == tcg', so test for the correct accelerator. This
> also eases code review, because here we don't care about
> KVM, we really want to test for TCG.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Cédric Le Goater <clg@kaod.org>

> ---
>   hw/ppc/spapr.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index dcb7f1c70a..c4b666587b 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
>       int ret;
>       unsigned int smp_threads = ms->smp.threads;
>   
> -    if (!kvm_enabled() && (smp_threads > 1)) {
> +    if (tcg_enabled() && (smp_threads > 1)) {
>           error_setg(errp, "TCG cannot support more than 1 thread/core "
>                      "on a pseries machine");
>           return;

Nick,

You might want to include this patch in the series adding SMT support
to pseries/spapr :

   https://patchew.org/QEMU/20230605112323.179259-1-npiggin@gmail.com/

C.


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

* Re: [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()
  2023-06-20  7:48 [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled() Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2023-06-20  8:06 ` Cédric Le Goater
@ 2023-06-20  8:33 ` David Gibson
  2023-06-20 11:09 ` BALATON Zoltan
  4 siblings, 0 replies; 8+ messages in thread
From: David Gibson @ 2023-06-20  8:33 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Harsh Prateek Bora, Cédric Le Goater,
	Daniel Henrique Barboza, Greg Kurz, qemu-ppc

[-- Attachment #1: Type: text/plain, Size: 1308 bytes --]

On Tue, Jun 20, 2023 at 09:48:02AM +0200, Philippe Mathieu-Daudé wrote:
> Although the PPC target only supports the TCG and KVM
> accelerators, QEMU supports more. We can no assume that
> '!kvm == tcg', so test for the correct accelerator. This
> also eases code review, because here we don't care about
> KVM, we really want to test for TCG.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/ppc/spapr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index dcb7f1c70a..c4b666587b 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
>      int ret;
>      unsigned int smp_threads = ms->smp.threads;
>  
> -    if (!kvm_enabled() && (smp_threads > 1)) {
> +    if (tcg_enabled() && (smp_threads > 1)) {
>          error_setg(errp, "TCG cannot support more than 1 thread/core "
>                     "on a pseries machine");
>          return;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()
  2023-06-20  7:48 [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled() Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2023-06-20  8:33 ` David Gibson
@ 2023-06-20 11:09 ` BALATON Zoltan
  4 siblings, 0 replies; 8+ messages in thread
From: BALATON Zoltan @ 2023-06-20 11:09 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Harsh Prateek Bora, Cédric Le Goater,
	Daniel Henrique Barboza, David Gibson, Greg Kurz, qemu-ppc

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

On Tue, 20 Jun 2023, Philippe Mathieu-Daudé wrote:
> Although the PPC target only supports the TCG and KVM
> accelerators, QEMU supports more. We can no assume that

Typo: -> can not assume

Regards,
BALATON Zoltan

> '!kvm == tcg', so test for the correct accelerator. This
> also eases code review, because here we don't care about
> KVM, we really want to test for TCG.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/ppc/spapr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index dcb7f1c70a..c4b666587b 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
>     int ret;
>     unsigned int smp_threads = ms->smp.threads;
>
> -    if (!kvm_enabled() && (smp_threads > 1)) {
> +    if (tcg_enabled() && (smp_threads > 1)) {
>         error_setg(errp, "TCG cannot support more than 1 thread/core "
>                    "on a pseries machine");
>         return;
>

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

* Re: [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()
  2023-06-20  7:55 ` Claudio Fontana
@ 2023-06-20 14:48   ` Greg Kurz
  2023-06-20 15:26     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 8+ messages in thread
From: Greg Kurz @ 2023-06-20 14:48 UTC (permalink / raw)
  To: Claudio Fontana
  Cc: Philippe Mathieu-Daudé, qemu-devel, Harsh Prateek Bora,
	Cédric Le Goater, Daniel Henrique Barboza, David Gibson,
	qemu-ppc

On Tue, 20 Jun 2023 09:55:49 +0200
Claudio Fontana <cfontana@suse.de> wrote:

> On 6/20/23 09:48, Philippe Mathieu-Daudé wrote:
> > Although the PPC target only supports the TCG and KVM
> > accelerators, QEMU supports more. We can no assume that
> > '!kvm == tcg', so test for the correct accelerator. This
> > also eases code review, because here we don't care about
> > KVM, we really want to test for TCG.
> > 
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> I don't remember anymore, but what about qtest ? It is usually the forgotten case in these kind of tests... so much complexity :-)
> 

This check was added with TCG in mind because it is a known limitation.
I don't see any reason to prevent qtest from being used with the rest
of this function though.

> Ciao,
> 
> Claudio
> 
> 
> > ---
> >  hw/ppc/spapr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index dcb7f1c70a..c4b666587b 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
> >      int ret;
> >      unsigned int smp_threads = ms->smp.threads;
> >  
> > -    if (!kvm_enabled() && (smp_threads > 1)) {
> > +    if (tcg_enabled() && (smp_threads > 1)) {

Bonjour Philippe,

Please drop the unneeded parens in the second check.

With this fixed,

Reviewed-by: Greg Kurz <groug@kaod.org>

Cheers,

--
Greg

> >          error_setg(errp, "TCG cannot support more than 1 thread/core "
> >                     "on a pseries machine");
> >          return;
> 



-- 
Greg


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

* Re: [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()
  2023-06-20 14:48   ` Greg Kurz
@ 2023-06-20 15:26     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-20 15:26 UTC (permalink / raw)
  To: Greg Kurz, Claudio Fontana
  Cc: qemu-devel, Harsh Prateek Bora, Cédric Le Goater,
	Daniel Henrique Barboza, David Gibson, qemu-ppc

On 20/6/23 16:48, Greg Kurz wrote:
> On Tue, 20 Jun 2023 09:55:49 +0200
> Claudio Fontana <cfontana@suse.de> wrote:
> 
>> On 6/20/23 09:48, Philippe Mathieu-Daudé wrote:
>>> Although the PPC target only supports the TCG and KVM
>>> accelerators, QEMU supports more. We can no assume that
>>> '!kvm == tcg', so test for the correct accelerator. This
>>> also eases code review, because here we don't care about
>>> KVM, we really want to test for TCG.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>
>> I don't remember anymore, but what about qtest ? It is usually the forgotten case in these kind of tests... so much complexity :-)

Good to think about this, since such changes indeed usually break,
qtests :)

> This check was added with TCG in mind because it is a known limitation.
> I don't see any reason to prevent qtest from being used with the rest
> of this function though.

We don't have any CPU core when using qtest accelerator, so this
check is irrelevant IMHO (not reachable with '-accel qtest').

>>> ---
>>>   hw/ppc/spapr.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>>> index dcb7f1c70a..c4b666587b 100644
>>> --- a/hw/ppc/spapr.c
>>> +++ b/hw/ppc/spapr.c
>>> @@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
>>>       int ret;
>>>       unsigned int smp_threads = ms->smp.threads;
>>>   
>>> -    if (!kvm_enabled() && (smp_threads > 1)) {
>>> +    if (tcg_enabled() && (smp_threads > 1)) {
> 
> Bonjour Philippe,
> 
> Please drop the unneeded parens in the second check.

I wanted to do that but then thought someone would ask me to do one
change at once ;)

> With this fixed,
> 
> Reviewed-by: Greg Kurz <groug@kaod.org>

Thanks!




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

end of thread, other threads:[~2023-06-20 15:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-20  7:48 [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled() Philippe Mathieu-Daudé
2023-06-20  7:55 ` Claudio Fontana
2023-06-20 14:48   ` Greg Kurz
2023-06-20 15:26     ` Philippe Mathieu-Daudé
2023-06-20  7:59 ` Harsh Prateek Bora
2023-06-20  8:06 ` Cédric Le Goater
2023-06-20  8:33 ` David Gibson
2023-06-20 11:09 ` BALATON Zoltan

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).