linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH -v2] sched/wait: Add <linux/sched/signal.h> dependency for now
Date: Wed, 8 Mar 2017 11:11:18 +0100	[thread overview]
Message-ID: <20170308101118.GA6775@gmail.com> (raw)
In-Reply-To: <20170308091712.GA18149@gmail.com>


* Ingo Molnar <mingo@kernel.org> wrote:

> I'll do more testing over the day to see how well this approach works. Not yet 
> signed off by me. I'll post updated versions over the day if there's any 
> changes.
> 
> This removes the time pressure to untangle the wait.h mess for v4.11.

I've completed a full [allno|def|allmod|allyes]config test on x86, plus 
[allno|def]config builds on 20+ architectures, and beyond a single obvious
Alpha build fix, the patch held up pretty well.

So if we can live with the ugliness temporarily, this approach might work as a 
stop-gap measure. I'll push out the patch to get the various build bots active
as well.

I've attached -v2 below.

Also as a test I removed the <linux/sched/signal.h> from fs/overlayfs/util.c, and 
the build failure you saw originally does not trigger anymore.

Since I'm not aware of this particular dependency bug having appeared in anything 
else but the overlayfs bug you worked around in the merge window (there's some 
pending build fixes but they are unrelated), I could also wait for a linux-next 
test iteration to get more cross-arch build coverage of this patch and send this 
fix to you in about two days.

But feel free to apply it from email as well.

Thoughts?

Thanks,

	Ingo

====================>
>From 65eb2b3976f1b78563a8be7120c7fe3de27a1258 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@kernel.org>
Date: Wed, 8 Mar 2017 09:42:52 +0100
Subject: [PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now

The wait_event_interruptible*() APIs are using signal_pending(), so
include its header to not build-break users of those APIs.

Note that this is overkill as most wait_event*() users don't care
about signals - but solving that problem turned out to be more
complex.

Note two dependency quirks:

- the <linux/sched/signal.h> include line needs to be last in
  wait.h, because that header itself depends on wait-queue types.

- we shouldn't include cred.h from sched/signal.h, because cred.h is
  a complex header that will create a circular dependency if we do so.
  Instead we include wait.h to gain the waitqueue types, plus we
  predeclare 'struct cred' for a function prototype.

Note that the cred.h change has some knock-on effects.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/alpha/kernel/asm-offsets.c | 2 ++
 include/linux/audit.h           | 2 ++
 include/linux/fs.h              | 1 +
 include/linux/sched/signal.h    | 8 +++++---
 include/linux/wait.h            | 3 +++
 kernel/tsacct.c                 | 1 +
 6 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/alpha/kernel/asm-offsets.c b/arch/alpha/kernel/asm-offsets.c
index 6ff8886e7e22..357632578142 100644
--- a/arch/alpha/kernel/asm-offsets.c
+++ b/arch/alpha/kernel/asm-offsets.c
@@ -9,6 +9,8 @@
 #include <linux/sched.h>
 #include <linux/ptrace.h>
 #include <linux/kbuild.h>
+#include <linux/cred.h>
+
 #include <asm/io.h>
 
 void foo(void)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 504e784b7ffa..57b3d6c07875 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -25,6 +25,8 @@
 
 #include <linux/sched.h>
 #include <linux/ptrace.h>
+#include <linux/cred.h>
+
 #include <uapi/linux/audit.h>
 
 #define AUDIT_INO_UNSET ((unsigned long)-1)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index aad3fd0ff5f8..bf51dc2dc14a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3,6 +3,7 @@
 
 #include <linux/linkage.h>
 #include <linux/wait.h>
+#include <linux/cred.h>
 #include <linux/kdev_t.h>
 #include <linux/dcache.h>
 #include <linux/path.h>
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 2cf446704cd4..0a5abc3dc937 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -6,7 +6,7 @@
 #include <linux/sched.h>
 #include <linux/sched/jobctl.h>
 #include <linux/sched/task.h>
-#include <linux/cred.h>
+#include <linux/wait.h>
 
 /*
  * Types defining task->signal and task->sighand and APIs using them:
@@ -289,8 +289,10 @@ extern int force_sigsegv(int, struct task_struct *);
 extern int force_sig_info(int, struct siginfo *, struct task_struct *);
 extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
 extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid);
-extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *,
-				const struct cred *, u32);
+
+struct cred;
+extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *, const struct cred *, u32);
+
 extern int kill_pgrp(struct pid *pid, int sig, int priv);
 extern int kill_pid(struct pid *pid, int sig, int priv);
 extern int kill_proc_info(int, struct siginfo *, pid_t);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index aacb1282d19a..e8e5a2ea3bbd 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -1224,4 +1224,7 @@ int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
 	return out_of_line_wait_on_atomic_t(val, action, mode);
 }
 
+/* NOTE: this is temporary, and it needs to come last, due to type dependencies: */
+#include <linux/sched/signal.h>
+
 #endif /* _LINUX_WAIT_H */
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 370724b45391..63834bd86639 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -23,6 +23,7 @@
 #include <linux/tsacct_kern.h>
 #include <linux/acct.h>
 #include <linux/jiffies.h>
+#include <linux/cred.h>
 #include <linux/mm.h>
 
 /*

  reply	other threads:[~2017-03-08 10:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03  1:36 [GIT PULL] sched.h split-up Ingo Molnar
2017-03-03 20:13 ` Linus Torvalds
2017-03-04  7:30   ` Ingo Molnar
2017-03-07 23:33   ` Linus Torvalds
2017-03-08  0:04     ` Linus Torvalds
2017-03-08 17:24       ` Ingo Molnar
2017-03-08  8:37     ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
2017-03-08  9:17       ` [RFC PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now Ingo Molnar
2017-03-08 10:11         ` Ingo Molnar [this message]
2017-03-08 11:55       ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
2017-03-08 12:10       ` [RFC PATCH, -v2] " Ingo Molnar
2017-03-09 16:25         ` Peter Zijlstra
2017-03-08 16:37       ` [RFC PATCH] " Linus Torvalds
2017-03-08 17:16         ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170308101118.GA6775@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).