Subject: Re: linux-next: build failure after merge of the tip tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 17 Jan 2014 14:45:18 +1100

Hi all,

On Thu, 16 Jan 2014 14:51:08 -0800 "H. Peter Anvin" <[email-masked]> wrote:
>
> On 01/16/2014 02:34 PM, Stephen Rothwell wrote:
> > 
> > On Thu, 16 Jan 2014 23:25:36 +0100 Peter Zijlstra
> > <[email-masked]> wrote:
> >> 
> >> On Fri, Jan 17, 2014 at 07:46:28AM +1100, Stephen Rothwell
> >> wrote:
> >>> 
> >>> On Thu, 16 Jan 2014 13:19:55 +0100 Peter Zijlstra
> >>> <[email-masked]> wrote:
> >>>> 
> >>>> I think the below ought to work
> >>> 
> >>> To be clear, all you did was replace the body of mwait_idle()
> >>> with
> >>> 
> >>> mwait_idle_with_hints(0, 0);
> >> 
> >> Pretty much, and add the asm/mwait.h include, otherwise you'll
> >> end up with a compile fail.
> >> 
> >>> (and the comment above it)?  I need to apply in incremental
> >>> patch in the merge commit.
> >> 
> >> I don't think I touched the comment at all.
> > 
> 
> In retrospect this bit probably should have gone through the idle
> tree.  That was my bad, I need to coordinate with Len better.

So this is what I added as a merge fix patch.  Someone just needs to make
sure Linus gets this when the latter of the tow trees gets merged.

From: Stephen Rothwell <[email-masked]>
Date: Fri, 17 Jan 2014 14:42:06 +1100
Subject: [PATCH] x86 idle: mwait_idle merge update

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 arch/x86/kernel/process.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index db471a87fdd8..4da840f01561 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -28,6 +28,7 @@
 #include <asm/fpu-internal.h>
 #include <asm/debugreg.h>
 #include <asm/nmi.h>
+#include <asm/mwait.h>
 
 /*
  * per-CPU TSS segments. Threads are completely 'soft' on Linux,
@@ -427,18 +428,7 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
 
 static void mwait_idle(void)
 {
-	if (!need_resched()) {
-		if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR))
-			clflush((void *)&current_thread_info()->flags);
-
-		__monitor((void *)&current_thread_info()->flags, 0, 0);
-		smp_mb();
-		if (!need_resched())
-			__sti_mwait(0, 0);
-		else
-			local_irq_enable();
-	} else
-		local_irq_enable();
+	mwait_idle_with_hints(0, 0);
 }
 
 void select_idle_routine(const struct cpuinfo_x86 *c)
-- 
1.8.5.2

-- 
Cheers,
Stephen Rothwell                    [email-masked]