[GIT PULL] sched.h split-up fixes for MIPS

2017-03-08 Thread Ingo Molnar
Linus,

Please pull the latest core-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
core-urgent-for-linus

   # HEAD: fc69910f329d61821897871e0e957eda39beb3d8 MIPS: Add missing include 
files

These are the fixes for MIPS build failures due to the sched.h split-up, from
Arnd Bergmann.

 Thanks,

Ingo

-->
Arnd Bergmann (1):
  MIPS: Add missing include files


 arch/mips/cavium-octeon/cpu.c  | 2 ++
 arch/mips/cavium-octeon/crypto/octeon-crypto.c | 1 +
 arch/mips/cavium-octeon/smp.c  | 1 +
 arch/mips/include/asm/fpu.h| 1 +
 arch/mips/kernel/smp-bmips.c   | 1 +
 arch/mips/kernel/smp-mt.c  | 1 +
 arch/mips/loongson64/loongson-3/cop2-ex.c  | 1 +
 arch/mips/netlogic/common/smp.c| 1 +
 arch/mips/netlogic/xlp/cop2-ex.c   | 3 +++
 arch/mips/sgi-ip22/ip28-berr.c | 1 +
 arch/mips/sgi-ip27/ip27-berr.c | 2 ++
 arch/mips/sgi-ip27/ip27-smp.c  | 3 +++
 arch/mips/sgi-ip32/ip32-berr.c | 1 +
 arch/mips/sgi-ip32/ip32-reset.c| 1 +
 14 files changed, 20 insertions(+)

diff --git a/arch/mips/cavium-octeon/cpu.c b/arch/mips/cavium-octeon/cpu.c
index a5b427909b5c..036d56cc4591 100644
--- a/arch/mips/cavium-octeon/cpu.c
+++ b/arch/mips/cavium-octeon/cpu.c
@@ -10,7 +10,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/arch/mips/cavium-octeon/crypto/octeon-crypto.c 
b/arch/mips/cavium-octeon/crypto/octeon-crypto.c
index 4d22365844af..cfb4a146cf17 100644
--- a/arch/mips/cavium-octeon/crypto/octeon-crypto.c
+++ b/arch/mips/cavium-octeon/crypto/octeon-crypto.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "octeon-crypto.h"
 
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 4b94b7fbafa3..3de786545ded 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index 321752bcbab6..f94455f964ec 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 3daa2cae50b0..1b070a76fcdd 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index e077ea3e11fb..e398cbc3d776 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/arch/mips/loongson64/loongson-3/cop2-ex.c 
b/arch/mips/loongson64/loongson-3/cop2-ex.c
index ea13764d0a03..621d6af5f6eb 100644
--- a/arch/mips/loongson64/loongson-3/cop2-ex.c
+++ b/arch/mips/loongson64/loongson-3/cop2-ex.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c
index 10d86d54880a..bddf1ef553a4 100644
--- a/arch/mips/netlogic/common/smp.c
+++ b/arch/mips/netlogic/common/smp.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/arch/mips/netlogic/xlp/cop2-ex.c b/arch/mips/netlogic/xlp/cop2-ex.c
index 52bc5de42005..21e439b3db70 100644
--- a/arch/mips/netlogic/xlp/cop2-ex.c
+++ b/arch/mips/netlogic/xlp/cop2-ex.c
@@ -9,11 +9,14 @@
  * Copyright (C) 2009 Wind River Systems,
  *   written by Ralf Baechle 
  */
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/arch/mips/sgi-ip22/ip28-berr.c b/arch/mips/sgi-ip22/ip28-berr.c
index 1f2a5bc4779e..75460e1e106b 100644
--- a/arch/mips/sgi-ip22/ip28-berr.c
+++ b/arch/mips/sgi-ip22/ip28-berr.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/arch/mips/sgi-ip27/ip27-berr.c b/arch/mips/sgi-ip27/ip27-berr.c
index d12879eb2b1f..83efe03d5c60 100644
--- a/arch/mips/sgi-ip27/ip27-berr.c
+++ b/arch/mips/sgi-ip27/ip27-berr.c
@@ -12,7 +12,9 @@
 #include   /* for SIGBUS */
 #include/* schow_regs(), force_sig() */
 #include 
+#include 
 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index f5ed45e8f442..4cd47d23d81a 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -8,10 +8,13 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
+
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/mips/sgi-ip32/ip32-berr.c 

[GIT PULL] sched.h split-up fixes for MIPS

2017-03-08 Thread Ingo Molnar
Linus,

Please pull the latest core-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
core-urgent-for-linus

   # HEAD: fc69910f329d61821897871e0e957eda39beb3d8 MIPS: Add missing include 
files

These are the fixes for MIPS build failures due to the sched.h split-up, from
Arnd Bergmann.

 Thanks,

Ingo

-->
Arnd Bergmann (1):
  MIPS: Add missing include files


 arch/mips/cavium-octeon/cpu.c  | 2 ++
 arch/mips/cavium-octeon/crypto/octeon-crypto.c | 1 +
 arch/mips/cavium-octeon/smp.c  | 1 +
 arch/mips/include/asm/fpu.h| 1 +
 arch/mips/kernel/smp-bmips.c   | 1 +
 arch/mips/kernel/smp-mt.c  | 1 +
 arch/mips/loongson64/loongson-3/cop2-ex.c  | 1 +
 arch/mips/netlogic/common/smp.c| 1 +
 arch/mips/netlogic/xlp/cop2-ex.c   | 3 +++
 arch/mips/sgi-ip22/ip28-berr.c | 1 +
 arch/mips/sgi-ip27/ip27-berr.c | 2 ++
 arch/mips/sgi-ip27/ip27-smp.c  | 3 +++
 arch/mips/sgi-ip32/ip32-berr.c | 1 +
 arch/mips/sgi-ip32/ip32-reset.c| 1 +
 14 files changed, 20 insertions(+)

diff --git a/arch/mips/cavium-octeon/cpu.c b/arch/mips/cavium-octeon/cpu.c
index a5b427909b5c..036d56cc4591 100644
--- a/arch/mips/cavium-octeon/cpu.c
+++ b/arch/mips/cavium-octeon/cpu.c
@@ -10,7 +10,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/arch/mips/cavium-octeon/crypto/octeon-crypto.c 
b/arch/mips/cavium-octeon/crypto/octeon-crypto.c
index 4d22365844af..cfb4a146cf17 100644
--- a/arch/mips/cavium-octeon/crypto/octeon-crypto.c
+++ b/arch/mips/cavium-octeon/crypto/octeon-crypto.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "octeon-crypto.h"
 
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 4b94b7fbafa3..3de786545ded 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index 321752bcbab6..f94455f964ec 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 3daa2cae50b0..1b070a76fcdd 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index e077ea3e11fb..e398cbc3d776 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/arch/mips/loongson64/loongson-3/cop2-ex.c 
b/arch/mips/loongson64/loongson-3/cop2-ex.c
index ea13764d0a03..621d6af5f6eb 100644
--- a/arch/mips/loongson64/loongson-3/cop2-ex.c
+++ b/arch/mips/loongson64/loongson-3/cop2-ex.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c
index 10d86d54880a..bddf1ef553a4 100644
--- a/arch/mips/netlogic/common/smp.c
+++ b/arch/mips/netlogic/common/smp.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/arch/mips/netlogic/xlp/cop2-ex.c b/arch/mips/netlogic/xlp/cop2-ex.c
index 52bc5de42005..21e439b3db70 100644
--- a/arch/mips/netlogic/xlp/cop2-ex.c
+++ b/arch/mips/netlogic/xlp/cop2-ex.c
@@ -9,11 +9,14 @@
  * Copyright (C) 2009 Wind River Systems,
  *   written by Ralf Baechle 
  */
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/arch/mips/sgi-ip22/ip28-berr.c b/arch/mips/sgi-ip22/ip28-berr.c
index 1f2a5bc4779e..75460e1e106b 100644
--- a/arch/mips/sgi-ip22/ip28-berr.c
+++ b/arch/mips/sgi-ip22/ip28-berr.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/arch/mips/sgi-ip27/ip27-berr.c b/arch/mips/sgi-ip27/ip27-berr.c
index d12879eb2b1f..83efe03d5c60 100644
--- a/arch/mips/sgi-ip27/ip27-berr.c
+++ b/arch/mips/sgi-ip27/ip27-berr.c
@@ -12,7 +12,9 @@
 #include   /* for SIGBUS */
 #include/* schow_regs(), force_sig() */
 #include 
+#include 
 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index f5ed45e8f442..4cd47d23d81a 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -8,10 +8,13 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
+
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/mips/sgi-ip32/ip32-berr.c b/arch/mips/sgi-ip32/ip32-berr.c

Re: [GIT PULL] sched.h split-up

2017-03-08 Thread Ingo Molnar

* Linus Torvalds  wrote:

> On Tue, Mar 7, 2017 at 3:33 PM, Linus Torvalds
>  wrote:
> >
> > But as mentioned - this is untested. It seems to build, and it looks
> > "ObviouslyCorrect(tm)", but I didn't actually try to boot it.
> 
> Well, it boots, but it's not like there are all that many users of the
> wait_event_interruptible*_locked*() interfaces, so it's dubious that I
> actually exercised the changes all that much (if at all).
> 
> Of course, that's just more reason to *not* have it be some big macro
> expansion in a header file that requires other includes. Basically,
> this interface isn't worth the header inclusion pain.
> 
> And no, I didn't try to see how many
> 
>#include 
> 
> I could try to remove with this.
> 
> But I *did* verify that I could now build that fs/overlayfs/util.c
> file with that #include removed.
> 
> That's the case that caused a semantic merge issue for me - but I
> don't know how many others Ingo added as part of the split-up.

I suspect wait_event_hrtimeout*() has a similar conceptual problem with 
linux/hrtimer.h, because it uses hrtimer APIs but doesn't include the header - 
but 
fortunately that API variant does not appear to be used much at the moment: 
only 
fs/aio.c uses wait_event_interruptible_hrtimeout(), but it includes sched.h 
which 
includes hrtimer.h.

So Ack on your patch.

Also, to be honest I'm also not looking forward to converting 20+ wait_event*() 
macros to a fragile state machine, so I wouldn't mind it if your patch was the 
final solution to this problem! ;-)

Thanks,

Ingo


Re: [GIT PULL] sched.h split-up

2017-03-08 Thread Ingo Molnar

* Linus Torvalds  wrote:

> On Tue, Mar 7, 2017 at 3:33 PM, Linus Torvalds
>  wrote:
> >
> > But as mentioned - this is untested. It seems to build, and it looks
> > "ObviouslyCorrect(tm)", but I didn't actually try to boot it.
> 
> Well, it boots, but it's not like there are all that many users of the
> wait_event_interruptible*_locked*() interfaces, so it's dubious that I
> actually exercised the changes all that much (if at all).
> 
> Of course, that's just more reason to *not* have it be some big macro
> expansion in a header file that requires other includes. Basically,
> this interface isn't worth the header inclusion pain.
> 
> And no, I didn't try to see how many
> 
>#include 
> 
> I could try to remove with this.
> 
> But I *did* verify that I could now build that fs/overlayfs/util.c
> file with that #include removed.
> 
> That's the case that caused a semantic merge issue for me - but I
> don't know how many others Ingo added as part of the split-up.

I suspect wait_event_hrtimeout*() has a similar conceptual problem with 
linux/hrtimer.h, because it uses hrtimer APIs but doesn't include the header - 
but 
fortunately that API variant does not appear to be used much at the moment: 
only 
fs/aio.c uses wait_event_interruptible_hrtimeout(), but it includes sched.h 
which 
includes hrtimer.h.

So Ack on your patch.

Also, to be honest I'm also not looking forward to converting 20+ wait_event*() 
macros to a fragile state machine, so I wouldn't mind it if your patch was the 
final solution to this problem! ;-)

Thanks,

Ingo


Re: [GIT PULL] sched.h split-up

2017-03-07 Thread Linus Torvalds
On Tue, Mar 7, 2017 at 3:33 PM, Linus Torvalds
 wrote:
>
> But as mentioned - this is untested. It seems to build, and it looks
> "ObviouslyCorrect(tm)", but I didn't actually try to boot it.

Well, it boots, but it's not like there are all that many users of the
wait_event_interruptible*_locked*() interfaces, so it's dubious that I
actually exercised the changes all that much (if at all).

Of course, that's just more reason to *not* have it be some big macro
expansion in a header file that requires other includes. Basically,
this interface isn't worth the header inclusion pain.

And no, I didn't try to see how many

   #include 

I could try to remove with this.

But I *did* verify that I could now build that fs/overlayfs/util.c
file with that #include removed.

That's the case that caused a semantic merge issue for me - but I
don't know how many others Ingo added as part of the split-up.

   Linus


Re: [GIT PULL] sched.h split-up

2017-03-07 Thread Linus Torvalds
On Tue, Mar 7, 2017 at 3:33 PM, Linus Torvalds
 wrote:
>
> But as mentioned - this is untested. It seems to build, and it looks
> "ObviouslyCorrect(tm)", but I didn't actually try to boot it.

Well, it boots, but it's not like there are all that many users of the
wait_event_interruptible*_locked*() interfaces, so it's dubious that I
actually exercised the changes all that much (if at all).

Of course, that's just more reason to *not* have it be some big macro
expansion in a header file that requires other includes. Basically,
this interface isn't worth the header inclusion pain.

And no, I didn't try to see how many

   #include 

I could try to remove with this.

But I *did* verify that I could now build that fs/overlayfs/util.c
file with that #include removed.

That's the case that caused a semantic merge issue for me - but I
don't know how many others Ingo added as part of the split-up.

   Linus


Re: [GIT PULL] sched.h split-up

2017-03-07 Thread Linus Torvalds
On Fri, Mar 3, 2017 at 12:13 PM, Linus Torvalds
 wrote:
>
> The fact that you can include , and then cannot use the
> wait event functions because you're missing "signal_pending()" is
> complete garbage. This needs to be fixed.

Here's a (totally untested) patch that tries to do exactly that.

It moves the stuff inside the wait-loop into two helper functions -
one for "interrupts off" and one for "interrupts on" case - and does
the meat of the whole __wait_event_interruptible_locked() out of line.

NOTE! This is all the slow case, when we will schedule and mess around
with spinlocks. The fast case will have been taken care of by the
macros that then use the whole "__wait_event_interruptible_locked()"
machinery.

So moving it out of line not only makes the build simpler (no need for
 for the "signal_pending()" thing), but seems to
be the right thing to do from a code size standpoint too.

But as mentioned - this is untested. It seems to build, and it looks
"ObviouslyCorrect(tm)", but I didn't actually try to boot it.

Comments?

 Linus
 include/linux/wait.h | 31 ++-
 kernel/sched/wait.c  | 39 +++
 2 files changed, 49 insertions(+), 21 deletions(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index aacb1282d19a..db076ca7f11d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -620,30 +620,19 @@ do {  
\
__ret;  \
 })
 
+extern int do_wait_intr(wait_queue_head_t *, wait_queue_t *);
+extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_t *);
 
-#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \
+#define __wait_event_interruptible_locked(wq, condition, exclusive, fn) \
 ({ \
-   int __ret = 0;  \
+   int __ret;  \
DEFINE_WAIT(__wait);\
if (exclusive)  \
__wait.flags |= WQ_FLAG_EXCLUSIVE;  \
do {\
-   if (likely(list_empty(&__wait.task_list)))  \
-   __add_wait_queue_tail(&(wq), &__wait);  \
-   set_current_state(TASK_INTERRUPTIBLE);  \
-   if (signal_pending(current)) {  \
-   __ret = -ERESTARTSYS;   \
+   __ret = fn(&(wq), &__wait); \
+   if (__ret)  \
break;  \
-   }   \
-   if (irq)\
-   spin_unlock_irq(&(wq).lock);\
-   else\
-   spin_unlock(&(wq).lock);\
-   schedule(); \
-   if (irq)\
-   spin_lock_irq(&(wq).lock);  \
-   else\
-   spin_lock(&(wq).lock);  \
} while (!(condition)); \
__remove_wait_queue(&(wq), &__wait);\
__set_current_state(TASK_RUNNING);  \
@@ -676,7 +665,7 @@ do {
\
  */
 #define wait_event_interruptible_locked(wq, condition) \
((condition)\
-? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0))
+? 0 : __wait_event_interruptible_locked(wq, condition, 0, 
do_wait_intr))
 
 /**
  * wait_event_interruptible_locked_irq - sleep until a condition gets true
@@ -703,7 +692,7 @@ do {
\
  */
 #define wait_event_interruptible_locked_irq(wq, condition) \
((condition)\
-? 0 : __wait_event_interruptible_locked(wq, condition, 0, 1))
+? 0 : __wait_event_interruptible_locked(wq, condition, 0, 
do_wait_intr_irq))
 
 /**
  * wait_event_interruptible_exclusive_locked - sleep exclusively until a 
condition gets true
@@ -734,7 +723,7 @@ do {

Re: [GIT PULL] sched.h split-up

2017-03-07 Thread Linus Torvalds
On Fri, Mar 3, 2017 at 12:13 PM, Linus Torvalds
 wrote:
>
> The fact that you can include , and then cannot use the
> wait event functions because you're missing "signal_pending()" is
> complete garbage. This needs to be fixed.

Here's a (totally untested) patch that tries to do exactly that.

It moves the stuff inside the wait-loop into two helper functions -
one for "interrupts off" and one for "interrupts on" case - and does
the meat of the whole __wait_event_interruptible_locked() out of line.

NOTE! This is all the slow case, when we will schedule and mess around
with spinlocks. The fast case will have been taken care of by the
macros that then use the whole "__wait_event_interruptible_locked()"
machinery.

So moving it out of line not only makes the build simpler (no need for
 for the "signal_pending()" thing), but seems to
be the right thing to do from a code size standpoint too.

But as mentioned - this is untested. It seems to build, and it looks
"ObviouslyCorrect(tm)", but I didn't actually try to boot it.

Comments?

 Linus
 include/linux/wait.h | 31 ++-
 kernel/sched/wait.c  | 39 +++
 2 files changed, 49 insertions(+), 21 deletions(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index aacb1282d19a..db076ca7f11d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -620,30 +620,19 @@ do {  
\
__ret;  \
 })
 
+extern int do_wait_intr(wait_queue_head_t *, wait_queue_t *);
+extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_t *);
 
-#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \
+#define __wait_event_interruptible_locked(wq, condition, exclusive, fn) \
 ({ \
-   int __ret = 0;  \
+   int __ret;  \
DEFINE_WAIT(__wait);\
if (exclusive)  \
__wait.flags |= WQ_FLAG_EXCLUSIVE;  \
do {\
-   if (likely(list_empty(&__wait.task_list)))  \
-   __add_wait_queue_tail(&(wq), &__wait);  \
-   set_current_state(TASK_INTERRUPTIBLE);  \
-   if (signal_pending(current)) {  \
-   __ret = -ERESTARTSYS;   \
+   __ret = fn(&(wq), &__wait); \
+   if (__ret)  \
break;  \
-   }   \
-   if (irq)\
-   spin_unlock_irq(&(wq).lock);\
-   else\
-   spin_unlock(&(wq).lock);\
-   schedule(); \
-   if (irq)\
-   spin_lock_irq(&(wq).lock);  \
-   else\
-   spin_lock(&(wq).lock);  \
} while (!(condition)); \
__remove_wait_queue(&(wq), &__wait);\
__set_current_state(TASK_RUNNING);  \
@@ -676,7 +665,7 @@ do {
\
  */
 #define wait_event_interruptible_locked(wq, condition) \
((condition)\
-? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0))
+? 0 : __wait_event_interruptible_locked(wq, condition, 0, 
do_wait_intr))
 
 /**
  * wait_event_interruptible_locked_irq - sleep until a condition gets true
@@ -703,7 +692,7 @@ do {
\
  */
 #define wait_event_interruptible_locked_irq(wq, condition) \
((condition)\
-? 0 : __wait_event_interruptible_locked(wq, condition, 0, 1))
+? 0 : __wait_event_interruptible_locked(wq, condition, 0, 
do_wait_intr_irq))
 
 /**
  * wait_event_interruptible_exclusive_locked - sleep exclusively until a 
condition gets true
@@ -734,7 +723,7 @@ do {   

Re: [GIT PULL] sched.h split-up

2017-03-03 Thread Ingo Molnar

* Linus Torvalds  wrote:

> Anyway, I fixed the semantic merge error by just including thar
>  file, but this is just not acceptable.
> 
> Having to have files know that if they use the wait-event functins
> (well, _some_ of them), they not only need to include ,
> they need to completely illogically also include
>  is just not maintainable.

Absolutely and agreed, will fix this ASAP!

wait.h generates too large functions anyway, so uninlining parts of it will be 
an 
improvement anyway.

> And who knows what similar semantic cases I _won't_ notice, because
> they occur in code I don't build even with my allmodconfig builds?

I did a fair amount of allyes/allno/allmod plus randconfig testing on x86, and 
caught and fixed a number of cases, so that angle should be covered to a fair 
degree.

On non-x86 I did allyes/allno/allmod testing as well, but not randconfig 
testing - 
plus some of the architectures have a large amount of defconfigs which I 
couldn't 
all test through.

So I'd expect build breakages to be concentrated into newly upstreamed code 
(such 
as this one) - which risk I tried to reduce by re-testing them on the 
almost-last 
day of the merge window.

Thanks,

Ingo


Re: [GIT PULL] sched.h split-up

2017-03-03 Thread Ingo Molnar

* Linus Torvalds  wrote:

> Anyway, I fixed the semantic merge error by just including thar
>  file, but this is just not acceptable.
> 
> Having to have files know that if they use the wait-event functins
> (well, _some_ of them), they not only need to include ,
> they need to completely illogically also include
>  is just not maintainable.

Absolutely and agreed, will fix this ASAP!

wait.h generates too large functions anyway, so uninlining parts of it will be 
an 
improvement anyway.

> And who knows what similar semantic cases I _won't_ notice, because
> they occur in code I don't build even with my allmodconfig builds?

I did a fair amount of allyes/allno/allmod plus randconfig testing on x86, and 
caught and fixed a number of cases, so that angle should be covered to a fair 
degree.

On non-x86 I did allyes/allno/allmod testing as well, but not randconfig 
testing - 
plus some of the architectures have a large amount of defconfigs which I 
couldn't 
all test through.

So I'd expect build breakages to be concentrated into newly upstreamed code 
(such 
as this one) - which risk I tried to reduce by re-testing them on the 
almost-last 
day of the merge window.

Thanks,

Ingo


Re: [GIT PULL] sched.h split-up

2017-03-03 Thread Linus Torvalds
On Thu, Mar 2, 2017 at 5:36 PM, Ingo Molnar  wrote:
>
> I tried to test as many build configurations as possible, but some build 
> breakage
> is probably still left - but it should be mostly limited to architectures that
> have no cross-compiler binaries available on kernel.org, and non-default
> configurations.

So I merged this, and it's pushed out, but it showed a real annoyance
almost immediately.

That annoyance is also pushed out - it's the pull of the overlayfs
updates. And the reason that was annoying was that that pull caused
this build error due to a subtle semantic clash:

   fs/overlayfs/util.c: In function ‘ovl_copy_up_start’:
   ./include/linux/wait.h:634:7: error: implicit declaration of
function ‘signal_pending’ [-Werror=implicit-function-declaration]
  if (signal_pending(current)) {\
  ^
   ./include/linux/wait.h:679:9: note: in expansion of macro
‘__wait_event_interruptible_locked’
  ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0))
^
   fs/overlayfs/util.c:275:8: note: in expansion of macro
‘wait_event_interruptible_locked’
 err = wait_event_interruptible_locked(ofs->copyup_wq, !oe->copying);
   ^~~

and that's just complete bullshit.

The thing is, fs/overlayfs/util.c included , which in turn
includes 

So using "wait_event_interruptible_locked()" should damn well have worked.

The fact that you can include , and then cannot use the
wait event functions because you're missing "signal_pending()" is
complete garbage. This needs to be fixed.

The most obvious way to fix it is likely to just shrink that
__wait_event_interruptible_locked() macro.

Yes, yes, some of it absolutely does need to remain as a macro,
because it has that

   do { .. } while (condition);

part of it, but I think the stuff inside that while loop could be made
into a function of its own. Actually, maybe two different functions
(for the "irq" case on/off).

Anyway, I fixed the semantic merge error by just including thar
 file, but this is just not acceptable.

Having to have files know that if they use the wait-event functins
(well, _some_ of them), they not only need to include ,
they need to completely illogically also include
 is just not maintainable.

And who knows what similar semantic cases I _won't_ notice, because
they occur in code I don't build even with my allmodconfig builds?

 Linus


Re: [GIT PULL] sched.h split-up

2017-03-03 Thread Linus Torvalds
On Thu, Mar 2, 2017 at 5:36 PM, Ingo Molnar  wrote:
>
> I tried to test as many build configurations as possible, but some build 
> breakage
> is probably still left - but it should be mostly limited to architectures that
> have no cross-compiler binaries available on kernel.org, and non-default
> configurations.

So I merged this, and it's pushed out, but it showed a real annoyance
almost immediately.

That annoyance is also pushed out - it's the pull of the overlayfs
updates. And the reason that was annoying was that that pull caused
this build error due to a subtle semantic clash:

   fs/overlayfs/util.c: In function ‘ovl_copy_up_start’:
   ./include/linux/wait.h:634:7: error: implicit declaration of
function ‘signal_pending’ [-Werror=implicit-function-declaration]
  if (signal_pending(current)) {\
  ^
   ./include/linux/wait.h:679:9: note: in expansion of macro
‘__wait_event_interruptible_locked’
  ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0))
^
   fs/overlayfs/util.c:275:8: note: in expansion of macro
‘wait_event_interruptible_locked’
 err = wait_event_interruptible_locked(ofs->copyup_wq, !oe->copying);
   ^~~

and that's just complete bullshit.

The thing is, fs/overlayfs/util.c included , which in turn
includes 

So using "wait_event_interruptible_locked()" should damn well have worked.

The fact that you can include , and then cannot use the
wait event functions because you're missing "signal_pending()" is
complete garbage. This needs to be fixed.

The most obvious way to fix it is likely to just shrink that
__wait_event_interruptible_locked() macro.

Yes, yes, some of it absolutely does need to remain as a macro,
because it has that

   do { .. } while (condition);

part of it, but I think the stuff inside that while loop could be made
into a function of its own. Actually, maybe two different functions
(for the "irq" case on/off).

Anyway, I fixed the semantic merge error by just including thar
 file, but this is just not acceptable.

Having to have files know that if they use the wait-event functins
(well, _some_ of them), they not only need to include ,
they need to completely illogically also include
 is just not maintainable.

And who knows what similar semantic cases I _won't_ notice, because
they occur in code I don't build even with my allmodconfig builds?

 Linus


[GIT PULL] sched.h split-up

2017-03-02 Thread Ingo Molnar
Linus,

Please pull the sched.h splitup git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
WIP.sched-core-for-linus

   # HEAD: 5eca1c10cbaa9c366c18ca79f81f21c731e3dcc7 sched/headers: Clean up 


The point of these changes is to significantly reduce the  
header 
footprint, to speed up the kernel build and to have a cleaner header structure.

After these changes the new 's typical preprocessed size goes 
down 
from a previous ~0.68 MB (~22K lines) to ~0.45 MB (~15K lines), which is around 
40% faster to build on typical configs.

Not much changed from the last version (-v2) posted three weeks ago: I 
eliminated 
quirks, backmerged fixes plus I rebased it to an upstream SHA1 from yesterday 
that 
includes most changes queued up in -next plus all sched.h changes that were 
pending from Andrew.

I've re-tested the series both on x86 and on cross-arch defconfigs, and did a 
bisectability test at a number of random points.

I tried to test as many build configurations as possible, but some build 
breakage 
is probably still left - but it should be mostly limited to architectures that 
have no cross-compiler binaries available on kernel.org, and non-default 
configurations.

 Thanks,

Ingo

-->
Ingo Molnar (146):
  sched/headers: Make all include/linux/sched/*.h headers build standalone
  sched/core: Convert ___assert_task_state() link time assert to 
BUILD_BUG_ON()
  sched/core: Move the get_preempt_disable_ip() inline to sched/core.c
  sched/core: Remove the tsk_cpus_allowed() wrapper
  sched/core: Remove the tsk_nr_cpus_allowed() wrapper
  rcu: Separate the RCU synchronization types and APIs into 

  sched/headers, cgroups: Remove the threadgroup_change_*() wrappery
  mm/vmacache, sched/headers: Introduce 'struct vmacache' and move it from 
 to 
  kasan, sched/headers: Uninline kasan_enable/disable_current()
  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving more 
code to 
  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare header dependency changes, move the 
 include to kernel/sched/sched.h
  sched/headers: Prepare to remove  inclusion from 

  sched/headers: Prepare for the removal of  from 

  sched/headers: Prepare for the removal of  from 

  sched/headers: Prepare for the removal of various unrelated headers from 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare to move signal wakeup & sigpending methods from 
 into 
  sched/headers: Prepare to move the memalloc_noio_*() APIs to 

  sched/headers: Prepare to remove the  include from 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare to move the 'root_task_group' declaration to 

  signals: Prepare to split out  from 
  sched/headers: Prepare for the reduction of 's signal API 
dependency
  mm/headers, sched/headers: Prepare to split  out 
of 
  sched/headers: Prepare to remove the  dependency from 

  sched/headers: Prepare to move 'init_task' and 'init_thread_union' from 
 to 
  sched/headers: Prepare to use  instead of 
 in 
  sched/headers: Prepare to move the task_lock()/unlock() APIs to 

  sched/headers: Prepare to move cputime functionality from  
into 
  sched/headers: Prepare to move 

[GIT PULL] sched.h split-up

2017-03-02 Thread Ingo Molnar
Linus,

Please pull the sched.h splitup git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
WIP.sched-core-for-linus

   # HEAD: 5eca1c10cbaa9c366c18ca79f81f21c731e3dcc7 sched/headers: Clean up 


The point of these changes is to significantly reduce the  
header 
footprint, to speed up the kernel build and to have a cleaner header structure.

After these changes the new 's typical preprocessed size goes 
down 
from a previous ~0.68 MB (~22K lines) to ~0.45 MB (~15K lines), which is around 
40% faster to build on typical configs.

Not much changed from the last version (-v2) posted three weeks ago: I 
eliminated 
quirks, backmerged fixes plus I rebased it to an upstream SHA1 from yesterday 
that 
includes most changes queued up in -next plus all sched.h changes that were 
pending from Andrew.

I've re-tested the series both on x86 and on cross-arch defconfigs, and did a 
bisectability test at a number of random points.

I tried to test as many build configurations as possible, but some build 
breakage 
is probably still left - but it should be mostly limited to architectures that 
have no cross-compiler binaries available on kernel.org, and non-default 
configurations.

 Thanks,

Ingo

-->
Ingo Molnar (146):
  sched/headers: Make all include/linux/sched/*.h headers build standalone
  sched/core: Convert ___assert_task_state() link time assert to 
BUILD_BUG_ON()
  sched/core: Move the get_preempt_disable_ip() inline to sched/core.c
  sched/core: Remove the tsk_cpus_allowed() wrapper
  sched/core: Remove the tsk_nr_cpus_allowed() wrapper
  rcu: Separate the RCU synchronization types and APIs into 

  sched/headers, cgroups: Remove the threadgroup_change_*() wrappery
  mm/vmacache, sched/headers: Introduce 'struct vmacache' and move it from 
 to 
  kasan, sched/headers: Uninline kasan_enable/disable_current()
  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving more 
code to 
  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare header dependency changes, move the 
 include to kernel/sched/sched.h
  sched/headers: Prepare to remove  inclusion from 

  sched/headers: Prepare for the removal of  from 

  sched/headers: Prepare for the removal of  from 

  sched/headers: Prepare for the removal of various unrelated headers from 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare to move signal wakeup & sigpending methods from 
 into 
  sched/headers: Prepare to move the memalloc_noio_*() APIs to 

  sched/headers: Prepare to remove the  include from 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare for new header dependencies before moving code to 

  sched/headers: Prepare to move the 'root_task_group' declaration to 

  signals: Prepare to split out  from 
  sched/headers: Prepare for the reduction of 's signal API 
dependency
  mm/headers, sched/headers: Prepare to split  out 
of 
  sched/headers: Prepare to remove the  dependency from 

  sched/headers: Prepare to move 'init_task' and 'init_thread_union' from 
 to 
  sched/headers: Prepare to use  instead of 
 in 
  sched/headers: Prepare to move the task_lock()/unlock() APIs to 

  sched/headers: Prepare to move cputime functionality from  
into 
  sched/headers: Prepare to move