[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1706221620120.1885@nanos>
Date: Thu, 22 Jun 2017 16:23:16 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: root <yang.zhang.wz@...il.com>
cc: mingo@...hat.com, hpa@...or.com, pbonzini@...hat.com,
x86@...nel.org, corbet@....net, tony.luck@...el.com, bp@...en8.de,
peterz@...radead.org, mchehab@...nel.org,
akpm@...ux-foundation.org, krzk@...nel.org, jpoimboe@...hat.com,
luto@...nel.org, borntraeger@...ibm.com, thgarnie@...gle.com,
rgerst@...il.com, minipli@...glemail.com,
douly.fnst@...fujitsu.com, nicstange@...il.com, fweisbec@...il.com,
dvlasenk@...hat.com, bristot@...hat.com,
yamada.masahiro@...ionext.com, mika.westerberg@...ux.intel.com,
yu.c.chen@...el.com, aaron.lu@...el.com, rostedt@...dmis.org,
me@...ehuey.com, len.brown@...el.com, prarit@...hat.com,
hidehiro.kawai.ez@...achi.com, fengtiantian@...wei.com,
pmladek@...e.com, jeyu@...hat.com, Larry.Finger@...inger.net,
zijun_hu@....com, luisbg@....samsung.com, johannes.berg@...el.com,
niklas.soderlund+renesas@...natech.se, zlpnobody@...il.com,
adobriyan@...il.com, fgao@...ai8.com, ebiederm@...ssion.com,
subashab@...eaurora.org, arnd@...db.de, matt@...eblueprint.co.uk,
mgorman@...hsingularity.net, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-edac@...r.kernel.org,
kvm@...r.kernel.org
Subject: Re: [PATCH 1/2] x86/idle: add halt poll for halt idle
On Thu, 22 Jun 2017, root wrote:
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -39,6 +39,10 @@
> #include <asm/desc.h>
> #include <asm/prctl.h>
>
> +#ifdef CONFIG_HYPERVISOR_GUEST
> +unsigned long poll_threshold_ns;
> +#endif
> +
> /*
> * per-CPU TSS segments. Threads are completely 'soft' on Linux,
> * no more per-task TSS's. The TSS size is kept cacheline-aligned
> @@ -313,6 +317,23 @@ static inline void play_dead(void)
> }
> #endif
>
> +#ifdef CONFIG_HYPERVISOR_GUEST
> +void arch_cpu_idle_poll(void)
> +{
> + ktime_t start, cur, stop;
> +
> + if (poll_threshold_ns) {
> + start = cur = ktime_get();
> + stop = ktime_add_ns(ktime_get(), poll_threshold_ns);
> + do {
> + if (need_resched())
> + break;
> + cur = ktime_get();
> + } while (ktime_before(cur, stop));
> + }
> +}
> +#endif
Aside of the whole approach being debatable, what's the reason to make this
depend on CONFIG_HYPERVISOR_GUEST and to move it into x86. If that
mechanism is worthwhile then it should go into the generic code and not
into x86. There is absolutely nothing x86 specific in that patch.
Also the CONFIG_HYPERVISOR_GUEST dependency is silly. Distro kernels ship
with CONFIG_HYPERVISOR_GUEST=y so this also gets into affect on bare metal.
Thanks,
tglx
Powered by blists - more mailing lists