linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle
@ 2022-12-07 12:41 lirongqing
  2022-12-07 12:41 ` [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default lirongqing
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: lirongqing @ 2022-12-07 12:41 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, x86, rafael, daniel.lezcano,
	peterz, akpm, tony.luck, jpoimboe, linux-kernel, linux-pm

From: Li RongQing <lirongqing@baidu.com>

When KVM guest has MWAIT and mwait_idle is used as default idle function,
but once cpuidle-haltpoll is loaded, default_idle in default_enter_idle is
used, which is using HLT, and cause a performance regression. As the commit
aebef63cf7ff ("x86: Remove vendor checks from prefer_mwait_c1_over_halt")
explains that mwait is preferred

so replace default_idle with arch_cpu_idle which can using MWAIT
optimization.

latency of sockperf ping-pong localhost test is reduced by more 20%
unixbench has 5% performance improvements for single core

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 arch/x86/kernel/process.c          | 1 +
 drivers/cpuidle/cpuidle-haltpoll.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index c21b734..303afad 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -721,6 +721,7 @@ void arch_cpu_idle(void)
 {
 	x86_idle();
 }
+EXPORT_SYMBOL(arch_cpu_idle);
 
 /*
  * We use this if we don't have any better idle routine..
diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c
index 3a39a7f..e66df22 100644
--- a/drivers/cpuidle/cpuidle-haltpoll.c
+++ b/drivers/cpuidle/cpuidle-haltpoll.c
@@ -32,7 +32,7 @@ static int default_enter_idle(struct cpuidle_device *dev,
 		local_irq_enable();
 		return index;
 	}
-	default_idle();
+	arch_cpu_idle();
 	return index;
 }
 
-- 
2.9.4


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

* [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default
  2022-12-07 12:41 [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle lirongqing
@ 2022-12-07 12:41 ` lirongqing
  2022-12-07 14:39   ` Rafael J. Wysocki
       [not found]   ` <080936016634.CAJZ5v0i9J2YimfQsqJiZjFMR9MLG0fdBf+Regr+_PcsYrAE=SQ@mail.gmail.com>
  2022-12-07 14:37 ` [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle Rafael J. Wysocki
       [not found] ` <080936167059.CAJZ5v0g5kTRE+x-8xC2WwQr11j01ox=Nk0aguiC1_HGPU8W=Rw@mail.gmail.com>
  2 siblings, 2 replies; 14+ messages in thread
From: lirongqing @ 2022-12-07 12:41 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, x86, rafael, daniel.lezcano,
	peterz, akpm, tony.luck, jpoimboe, linux-kernel, linux-pm

From: Li RongQing <lirongqing@baidu.com>

Allow user to unload it in running

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/cpuidle/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
index ff71dd6..43ddb84 100644
--- a/drivers/cpuidle/Kconfig
+++ b/drivers/cpuidle/Kconfig
@@ -74,7 +74,7 @@ endmenu
 config HALTPOLL_CPUIDLE
 	tristate "Halt poll cpuidle driver"
 	depends on X86 && KVM_GUEST
-	default y
+	default m
 	help
 	 This option enables halt poll cpuidle driver, which allows to poll
 	 before halting in the guest (more efficient than polling in the
-- 
2.9.4


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

* Re: [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle
  2022-12-07 12:41 [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle lirongqing
  2022-12-07 12:41 ` [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default lirongqing
@ 2022-12-07 14:37 ` Rafael J. Wysocki
       [not found] ` <080936167059.CAJZ5v0g5kTRE+x-8xC2WwQr11j01ox=Nk0aguiC1_HGPU8W=Rw@mail.gmail.com>
  2 siblings, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2022-12-07 14:37 UTC (permalink / raw)
  To: lirongqing
  Cc: tglx, mingo, bp, dave.hansen, x86, rafael, daniel.lezcano,
	peterz, akpm, tony.luck, jpoimboe, linux-kernel, linux-pm

On Wed, Dec 7, 2022 at 1:42 PM <lirongqing@baidu.com> wrote:
>
> From: Li RongQing <lirongqing@baidu.com>
>
> When KVM guest has MWAIT and mwait_idle is used as default idle function,
> but once cpuidle-haltpoll is loaded, default_idle in default_enter_idle is
> used, which is using HLT, and cause a performance regression. As the commit
> aebef63cf7ff ("x86: Remove vendor checks from prefer_mwait_c1_over_halt")
> explains that mwait is preferred
>
> so replace default_idle with arch_cpu_idle which can using MWAIT
> optimization.
>
> latency of sockperf ping-pong localhost test is reduced by more 20%
> unixbench has 5% performance improvements for single core
>
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>  arch/x86/kernel/process.c          | 1 +
>  drivers/cpuidle/cpuidle-haltpoll.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index c21b734..303afad 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -721,6 +721,7 @@ void arch_cpu_idle(void)
>  {
>         x86_idle();
>  }
> +EXPORT_SYMBOL(arch_cpu_idle);

Why do you need this export at all?

>
>  /*
>   * We use this if we don't have any better idle routine..
> diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c
> index 3a39a7f..e66df22 100644
> --- a/drivers/cpuidle/cpuidle-haltpoll.c
> +++ b/drivers/cpuidle/cpuidle-haltpoll.c
> @@ -32,7 +32,7 @@ static int default_enter_idle(struct cpuidle_device *dev,
>                 local_irq_enable();
>                 return index;
>         }
> -       default_idle();
> +       arch_cpu_idle();
>         return index;
>  }
>
> --
> 2.9.4
>

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

* Re: [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default
  2022-12-07 12:41 ` [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default lirongqing
@ 2022-12-07 14:39   ` Rafael J. Wysocki
       [not found]   ` <080936016634.CAJZ5v0i9J2YimfQsqJiZjFMR9MLG0fdBf+Regr+_PcsYrAE=SQ@mail.gmail.com>
  1 sibling, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2022-12-07 14:39 UTC (permalink / raw)
  To: lirongqing
  Cc: tglx, mingo, bp, dave.hansen, x86, rafael, daniel.lezcano,
	peterz, akpm, tony.luck, jpoimboe, linux-kernel, linux-pm

On Wed, Dec 7, 2022 at 1:41 PM <lirongqing@baidu.com> wrote:
>
> From: Li RongQing <lirongqing@baidu.com>
>
> Allow user to unload it in running

Just like that?  And corrupt things left and right while at it?

No way.

And why do you need this?

> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>  drivers/cpuidle/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
> index ff71dd6..43ddb84 100644
> --- a/drivers/cpuidle/Kconfig
> +++ b/drivers/cpuidle/Kconfig
> @@ -74,7 +74,7 @@ endmenu
>  config HALTPOLL_CPUIDLE
>         tristate "Halt poll cpuidle driver"
>         depends on X86 && KVM_GUEST
> -       default y
> +       default m
>         help
>          This option enables halt poll cpuidle driver, which allows to poll
>          before halting in the guest (more efficient than polling in the
> --

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

* RE: [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle
       [not found] ` <080936167059.CAJZ5v0g5kTRE+x-8xC2WwQr11j01ox=Nk0aguiC1_HGPU8W=Rw@mail.gmail.com>
@ 2022-12-08  1:46   ` Li,Rongqing
  2022-12-08 11:39     ` Rafael J. Wysocki
  2022-12-09 13:44   ` Li,Rongqing
  1 sibling, 1 reply; 14+ messages in thread
From: Li,Rongqing @ 2022-12-08  1:46 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: tglx, mingo, bp, dave.hansen, x86, daniel.lezcano, peterz, akpm,
	tony.luck, jpoimboe, linux-kernel, linux-pm



> -----Original Message-----
> From: Rafael J. Wysocki <rafael@kernel.org>
> Sent: Wednesday, December 7, 2022 10:38 PM
> To: Li,Rongqing <lirongqing@baidu.com>
> Cc: tglx@linutronix.de; mingo@redhat.com; bp@alien8.de;
> dave.hansen@linux.intel.com; x86@kernel.org; rafael@kernel.org;
> daniel.lezcano@linaro.org; peterz@infradead.org; akpm@linux-foundation.org;
> tony.luck@intel.com; jpoimboe@kernel.org; linux-kernel@vger.kernel.org;
> linux-pm@vger.kernel.org
> Subject: Re: [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with
> arch_cpu_idle
> 
> On Wed, Dec 7, 2022 at 1:42 PM <lirongqing@baidu.com> wrote:
> >
> > From: Li RongQing <lirongqing@baidu.com>
> >
> > When KVM guest has MWAIT and mwait_idle is used as default idle
> > function, but once cpuidle-haltpoll is loaded, default_idle in
> > default_enter_idle is used, which is using HLT, and cause a
> > performance regression. As the commit aebef63cf7ff ("x86: Remove
> > vendor checks from prefer_mwait_c1_over_halt") explains that mwait is
> > preferred
> >
> > so replace default_idle with arch_cpu_idle which can using MWAIT
> > optimization.
> >
> > latency of sockperf ping-pong localhost test is reduced by more 20%
> > unixbench has 5% performance improvements for single core
> >
> > Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> > Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > ---
> >  arch/x86/kernel/process.c          | 1 +
> >  drivers/cpuidle/cpuidle-haltpoll.c | 2 +-
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> > index c21b734..303afad 100644
> > --- a/arch/x86/kernel/process.c
> > +++ b/arch/x86/kernel/process.c
> > @@ -721,6 +721,7 @@ void arch_cpu_idle(void)  {
> >         x86_idle();
> >  }
> > +EXPORT_SYMBOL(arch_cpu_idle);
> 
> Why do you need this export at all?
> 

When cpuidle-haltpoll is built as module, if arch_cpu_idle is not export, cpuidle-haltpoll will complain "arch_cpu_idle" undefined

Like

ERROR: modpost: "arch_cpu_idle" [drivers/cpuidle/cpuidle-haltpoll.ko] undefined!
make[1]: *** [scripts/Makefile.modpost:126: Module.symvers] Error 1
make: *** [Makefile:1944: modpost] Error 2
Error: Make failed!

I will add the reason to v3 
Thanks

-Li



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

* RE: [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default
       [not found]   ` <080936016634.CAJZ5v0i9J2YimfQsqJiZjFMR9MLG0fdBf+Regr+_PcsYrAE=SQ@mail.gmail.com>
@ 2022-12-08  2:32     ` Li,Rongqing
  2022-12-08 11:42       ` Rafael J. Wysocki
  2022-12-16 15:01       ` Peter Zijlstra
  0 siblings, 2 replies; 14+ messages in thread
From: Li,Rongqing @ 2022-12-08  2:32 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: tglx, mingo, bp, dave.hansen, x86, daniel.lezcano, peterz, akpm,
	tony.luck, jpoimboe, linux-kernel, linux-pm


> > Allow user to unload it in running
> 
> Just like that?  And corrupt things left and right while at it?
> 
> No way.
> 
> And why do you need this?

Cpuidle-haltpoll can not improve performance for all cases, like when guest has mwait, unixbench shows a small performance drop; 
So change it as module, user can insmod this drivers and rmmod this driver at run time

And some downstream os, centos and ubuntu build it module

Of cause, it will cause performance drop since it is not installed by default, but user insmod this module, this performance can restore, so I think this is acceptable
If this reasom is acceptable, I will add v3; or drop this patch.

Thanks

-Li

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

* Re: [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle
  2022-12-08  1:46   ` Li,Rongqing
@ 2022-12-08 11:39     ` Rafael J. Wysocki
  2022-12-08 12:41       ` Li,Rongqing
  0 siblings, 1 reply; 14+ messages in thread
From: Rafael J. Wysocki @ 2022-12-08 11:39 UTC (permalink / raw)
  To: Li,Rongqing
  Cc: Rafael J. Wysocki, tglx, mingo, bp, dave.hansen, x86,
	daniel.lezcano, peterz, akpm, tony.luck, jpoimboe, linux-kernel,
	linux-pm

On Thu, Dec 8, 2022 at 2:48 AM Li,Rongqing <lirongqing@baidu.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Rafael J. Wysocki <rafael@kernel.org>
> > Sent: Wednesday, December 7, 2022 10:38 PM
> > To: Li,Rongqing <lirongqing@baidu.com>
> > Cc: tglx@linutronix.de; mingo@redhat.com; bp@alien8.de;
> > dave.hansen@linux.intel.com; x86@kernel.org; rafael@kernel.org;
> > daniel.lezcano@linaro.org; peterz@infradead.org; akpm@linux-foundation.org;
> > tony.luck@intel.com; jpoimboe@kernel.org; linux-kernel@vger.kernel.org;
> > linux-pm@vger.kernel.org
> > Subject: Re: [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with
> > arch_cpu_idle
> >
> > On Wed, Dec 7, 2022 at 1:42 PM <lirongqing@baidu.com> wrote:
> > >
> > > From: Li RongQing <lirongqing@baidu.com>
> > >
> > > When KVM guest has MWAIT and mwait_idle is used as default idle
> > > function, but once cpuidle-haltpoll is loaded, default_idle in
> > > default_enter_idle is used, which is using HLT, and cause a
> > > performance regression. As the commit aebef63cf7ff ("x86: Remove
> > > vendor checks from prefer_mwait_c1_over_halt") explains that mwait is
> > > preferred
> > >
> > > so replace default_idle with arch_cpu_idle which can using MWAIT
> > > optimization.
> > >
> > > latency of sockperf ping-pong localhost test is reduced by more 20%
> > > unixbench has 5% performance improvements for single core
> > >
> > > Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> > > Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > > ---
> > >  arch/x86/kernel/process.c          | 1 +
> > >  drivers/cpuidle/cpuidle-haltpoll.c | 2 +-
> > >  2 files changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> > > index c21b734..303afad 100644
> > > --- a/arch/x86/kernel/process.c
> > > +++ b/arch/x86/kernel/process.c
> > > @@ -721,6 +721,7 @@ void arch_cpu_idle(void)  {
> > >         x86_idle();
> > >  }
> > > +EXPORT_SYMBOL(arch_cpu_idle);
> >
> > Why do you need this export at all?
> >
>
> When cpuidle-haltpoll is built as module,

But it isn't now.

> if arch_cpu_idle is not export, cpuidle-haltpoll will complain "arch_cpu_idle" undefined

So no, this won't happen.

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

* Re: [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default
  2022-12-08  2:32     ` Li,Rongqing
@ 2022-12-08 11:42       ` Rafael J. Wysocki
  2022-12-08 12:42         ` Li,Rongqing
  2022-12-16 15:01       ` Peter Zijlstra
  1 sibling, 1 reply; 14+ messages in thread
From: Rafael J. Wysocki @ 2022-12-08 11:42 UTC (permalink / raw)
  To: Li,Rongqing
  Cc: Rafael J. Wysocki, tglx, mingo, bp, dave.hansen, x86,
	daniel.lezcano, peterz, akpm, tony.luck, jpoimboe, linux-kernel,
	linux-pm

On Thu, Dec 8, 2022 at 3:32 AM Li,Rongqing <lirongqing@baidu.com> wrote:
>
>
> > > Allow user to unload it in running
> >
> > Just like that?  And corrupt things left and right while at it?
> >
> > No way.
> >
> > And why do you need this?
>
> Cpuidle-haltpoll can not improve performance for all cases, like when guest has mwait, unixbench shows a small performance drop;
> So change it as module, user can insmod this drivers and rmmod this driver at run time

That is problematic, because in the mainline Linux kernel (which is
what we are talking about here) there is no support for modular
cpuidle governors.

Also, there is an interface for switching cpuidle governors at run
time already, so why can 't it be used to address this case?

> And some downstream os, centos and ubuntu build it module

Well, it's their problem.

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

* RE: [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle
  2022-12-08 11:39     ` Rafael J. Wysocki
@ 2022-12-08 12:41       ` Li,Rongqing
  2022-12-08 13:01         ` Rafael J. Wysocki
  0 siblings, 1 reply; 14+ messages in thread
From: Li,Rongqing @ 2022-12-08 12:41 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: tglx, mingo, bp, dave.hansen, x86, daniel.lezcano, peterz, akpm,
	tony.luck, jpoimboe, linux-kernel, linux-pm

> >
> > When cpuidle-haltpoll is built as module,
> 
> But it isn't now.

Centos is compiling it as module, it will fail;
Other user wants to compile it as module, they will fail, 
Syzbot random configuration building will fail

Unless prohibit to build it as module as below:

config HALTPOLL_CPUIDLE
-        tristate "Halt poll cpuidle driver"
+        bool "Halt poll cpuidle driver"
        depends on X86 && KVM_GUEST
        default y
        help


thanks

-Li



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

* RE: [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default
  2022-12-08 11:42       ` Rafael J. Wysocki
@ 2022-12-08 12:42         ` Li,Rongqing
  2022-12-08 13:11           ` Rafael J. Wysocki
  0 siblings, 1 reply; 14+ messages in thread
From: Li,Rongqing @ 2022-12-08 12:42 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: tglx, mingo, bp, dave.hansen, x86, daniel.lezcano, peterz, akpm,
	tony.luck, jpoimboe, linux-kernel, linux-pm

> Also, there is an interface for switching cpuidle governors at run time already, so
> why can 't it be used to address this case?


I will study this interface, thanks

-Li

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

* Re: [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle
  2022-12-08 12:41       ` Li,Rongqing
@ 2022-12-08 13:01         ` Rafael J. Wysocki
  0 siblings, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2022-12-08 13:01 UTC (permalink / raw)
  To: Li,Rongqing
  Cc: Rafael J. Wysocki, tglx, mingo, bp, dave.hansen, x86,
	daniel.lezcano, peterz, akpm, tony.luck, jpoimboe, linux-kernel,
	linux-pm

On Thu, Dec 8, 2022 at 1:43 PM Li,Rongqing <lirongqing@baidu.com> wrote:
>
> > >
> > > When cpuidle-haltpoll is built as module,
> >
> > But it isn't now.
>
> Centos is compiling it as module, it will fail;
> Other user wants to compile it as module, they will fail,
> Syzbot random configuration building will fail
>
> Unless prohibit to build it as module as below:
>
> config HALTPOLL_CPUIDLE
> -        tristate "Halt poll cpuidle driver"
> +        bool "Halt poll cpuidle driver"
>         depends on X86 && KVM_GUEST
>         default y
>         help

Ah, OK.  Sorry about the confusion.

Yes, the driver (not the governor, though), can be modular, so yes you
need the export, but please change it to EXPORT_SYMBOL_GPL().

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

* Re: [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default
  2022-12-08 12:42         ` Li,Rongqing
@ 2022-12-08 13:11           ` Rafael J. Wysocki
  0 siblings, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2022-12-08 13:11 UTC (permalink / raw)
  To: Li,Rongqing
  Cc: Rafael J. Wysocki, tglx, mingo, bp, dave.hansen, x86,
	daniel.lezcano, peterz, akpm, tony.luck, jpoimboe, linux-kernel,
	linux-pm

On Thu, Dec 8, 2022 at 1:45 PM Li,Rongqing <lirongqing@baidu.com> wrote:
>
> > Also, there is an interface for switching cpuidle governors at run time already, so
> > why can 't it be used to address this case?
>
>
> I will study this interface, thanks

Sorry, this patch series is about the haltpoll driver, not the
haltpoll governor (which is there too), so you are right, it can be
modular, but it is not modular by default.

I guess it would be fine to make it modular by default, unless there
are expectations regarding it being present on system startup in the
field and that part is unclear.  I think it would be better to defer
this change until it can be clarified.

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

* RE: [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle
       [not found] ` <080936167059.CAJZ5v0g5kTRE+x-8xC2WwQr11j01ox=Nk0aguiC1_HGPU8W=Rw@mail.gmail.com>
  2022-12-08  1:46   ` Li,Rongqing
@ 2022-12-09 13:44   ` Li,Rongqing
  1 sibling, 0 replies; 14+ messages in thread
From: Li,Rongqing @ 2022-12-09 13:44 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: tglx, mingo, bp, dave.hansen, x86, daniel.lezcano, peterz, akpm,
	tony.luck, jpoimboe, linux-kernel, linux-pm

> > latency of sockperf ping-pong localhost test is reduced by more 20%
> > unixbench has 5% performance improvements for single core
> >

Sorry, The upper data are wrong since wrong governor is used

when guest has mwait, and haltpoll driver is loaded and haltpoll governor is used.

on Intel cpu, unixbench score are nearly same, but sockperf has 20% low latency 
on AMD milan cpu, the sockperf latency are similar , but unixbench single core score has 10% loss, because AMD cpu maybe has weak smt capability 

Replace default idle with arch cpu idle has little effect


Thanks

-Li


I

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

* Re: [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default
  2022-12-08  2:32     ` Li,Rongqing
  2022-12-08 11:42       ` Rafael J. Wysocki
@ 2022-12-16 15:01       ` Peter Zijlstra
  1 sibling, 0 replies; 14+ messages in thread
From: Peter Zijlstra @ 2022-12-16 15:01 UTC (permalink / raw)
  To: Li,Rongqing
  Cc: Rafael J. Wysocki, tglx, mingo, bp, dave.hansen, x86,
	daniel.lezcano, akpm, tony.luck, jpoimboe, linux-kernel,
	linux-pm

On Thu, Dec 08, 2022 at 02:32:15AM +0000, Li,Rongqing wrote:
> 
> > > Allow user to unload it in running
> > 
> > Just like that?  And corrupt things left and right while at it?
> > 
> > No way.
> > 
> > And why do you need this?
> 
> Cpuidle-haltpoll can not improve performance for all cases, like when
> guest has mwait, unixbench shows a small performance drop; So change
> it as module, user can insmod this drivers and rmmod this driver at
> run time

I'm thinking all this can be achieved by a small change to
haltpoll_want().

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

end of thread, other threads:[~2022-12-16 15:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 12:41 [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle lirongqing
2022-12-07 12:41 ` [PATCH 2/2][v2] cpuidle-haltpoll: Build as module by default lirongqing
2022-12-07 14:39   ` Rafael J. Wysocki
     [not found]   ` <080936016634.CAJZ5v0i9J2YimfQsqJiZjFMR9MLG0fdBf+Regr+_PcsYrAE=SQ@mail.gmail.com>
2022-12-08  2:32     ` Li,Rongqing
2022-12-08 11:42       ` Rafael J. Wysocki
2022-12-08 12:42         ` Li,Rongqing
2022-12-08 13:11           ` Rafael J. Wysocki
2022-12-16 15:01       ` Peter Zijlstra
2022-12-07 14:37 ` [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle Rafael J. Wysocki
     [not found] ` <080936167059.CAJZ5v0g5kTRE+x-8xC2WwQr11j01ox=Nk0aguiC1_HGPU8W=Rw@mail.gmail.com>
2022-12-08  1:46   ` Li,Rongqing
2022-12-08 11:39     ` Rafael J. Wysocki
2022-12-08 12:41       ` Li,Rongqing
2022-12-08 13:01         ` Rafael J. Wysocki
2022-12-09 13:44   ` Li,Rongqing

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