linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390
@ 2016-10-26 17:43 Mark Rutland
  2016-10-26 17:43 ` [PATCHv2 1/2] thread_info: factor out restart_block Mark Rutland
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mark Rutland @ 2016-10-26 17:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, akpm, heiko.carstens, keescook, luto, mark.rutland

Hi all,

[resending for linux-arch, apologies for spam]

Heiko and I have been working on THREAD_INFO_IN_TASK for s390 and arm64
respectively, and we're both targetting v4.10.

These are the common core changes which we both require. I've put together a
branch [1,2] based on v4.9-rc2. I intend to tag this at some point next week so
that Heiko and I have a stable base.

Until then, any and all acks appreciated. ;)

Thanks,
Mark.

Since v1:
* Rebase to v4.9-rc2
* Drop Heiko's patch that was merged before -rc2
* Add Heiko's Acked-by
* Add Andy's Reviewed-by

[1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git core/ti-stack-split
[2] https://git.kernel.org/cgit/linux/kernel/git/mark/linux.git/log/?h=core/ti-stack-split

Mark Rutland (2):
  thread_info: factor out restart_block
  thread_info: include <current.h> for THREAD_INFO_IN_TASK

 include/linux/restart_block.h | 51 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/thread_info.h   | 42 ++---------------------------------
 2 files changed, 53 insertions(+), 40 deletions(-)
 create mode 100644 include/linux/restart_block.h

-- 
1.9.1

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

* [PATCHv2 1/2] thread_info: factor out restart_block
  2016-10-26 17:43 [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390 Mark Rutland
@ 2016-10-26 17:43 ` Mark Rutland
  2016-10-26 17:43 ` [PATCHv2 2/2] thread_info: include <current.h> for THREAD_INFO_IN_TASK Mark Rutland
  2016-11-02 15:56 ` [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390 Mark Rutland
  2 siblings, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2016-10-26 17:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, akpm, heiko.carstens, keescook, luto, mark.rutland

Since commit f56141e3e2d9aabf ("all arches, signal: move restart_block
to struct task_struct"), thread_info and restart_block have been
logically distinct, yet struct restart_block is still defined in
<linux/thread_info.h>.

At least one architecture (erroneously) uses restart_block as part of
its thread_info, and thus the definition of restart_block must come
before the include of <asm/thread_info>. Subsequent patches in this
series need to shuffle the order of includes and definitions in
<linux/thread_info.h>, and will make this ordering fragile.

This patch moves the definition of restart_block out to its own header.
This serves as generic cleanup, logically separating thread_info and
restart_block, and also makes it easier to avoid fragility.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Andy Lutomirski <luto@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 include/linux/restart_block.h | 51 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/thread_info.h   | 41 +---------------------------------
 2 files changed, 52 insertions(+), 40 deletions(-)
 create mode 100644 include/linux/restart_block.h

diff --git a/include/linux/restart_block.h b/include/linux/restart_block.h
new file mode 100644
index 0000000..0d905d8
--- /dev/null
+++ b/include/linux/restart_block.h
@@ -0,0 +1,51 @@
+/*
+ * Common syscall restarting data
+ */
+#ifndef __LINUX_RESTART_BLOCK_H
+#define __LINUX_RESTART_BLOCK_H
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+
+struct timespec;
+struct compat_timespec;
+struct pollfd;
+
+/*
+ * System call restart block.
+ */
+struct restart_block {
+	long (*fn)(struct restart_block *);
+	union {
+		/* For futex_wait and futex_wait_requeue_pi */
+		struct {
+			u32 __user *uaddr;
+			u32 val;
+			u32 flags;
+			u32 bitset;
+			u64 time;
+			u32 __user *uaddr2;
+		} futex;
+		/* For nanosleep */
+		struct {
+			clockid_t clockid;
+			struct timespec __user *rmtp;
+#ifdef CONFIG_COMPAT
+			struct compat_timespec __user *compat_rmtp;
+#endif
+			u64 expires;
+		} nanosleep;
+		/* For poll */
+		struct {
+			struct pollfd __user *ufds;
+			int nfds;
+			int has_timeout;
+			unsigned long tv_sec;
+			unsigned long tv_nsec;
+		} poll;
+	};
+};
+
+extern long do_no_restart_syscall(struct restart_block *parm);
+
+#endif /* __LINUX_RESTART_BLOCK_H */
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 2873baf..c75c6ab 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -9,51 +9,12 @@
 
 #include <linux/types.h>
 #include <linux/bug.h>
-
-struct timespec;
-struct compat_timespec;
+#include <linux/restart_block.h>
 
 #ifdef CONFIG_THREAD_INFO_IN_TASK
 #define current_thread_info() ((struct thread_info *)current)
 #endif
 
-/*
- * System call restart block.
- */
-struct restart_block {
-	long (*fn)(struct restart_block *);
-	union {
-		/* For futex_wait and futex_wait_requeue_pi */
-		struct {
-			u32 __user *uaddr;
-			u32 val;
-			u32 flags;
-			u32 bitset;
-			u64 time;
-			u32 __user *uaddr2;
-		} futex;
-		/* For nanosleep */
-		struct {
-			clockid_t clockid;
-			struct timespec __user *rmtp;
-#ifdef CONFIG_COMPAT
-			struct compat_timespec __user *compat_rmtp;
-#endif
-			u64 expires;
-		} nanosleep;
-		/* For poll */
-		struct {
-			struct pollfd __user *ufds;
-			int nfds;
-			int has_timeout;
-			unsigned long tv_sec;
-			unsigned long tv_nsec;
-		} poll;
-	};
-};
-
-extern long do_no_restart_syscall(struct restart_block *parm);
-
 #include <linux/bitops.h>
 #include <asm/thread_info.h>
 
-- 
1.9.1

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

* [PATCHv2 2/2] thread_info: include <current.h> for THREAD_INFO_IN_TASK
  2016-10-26 17:43 [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390 Mark Rutland
  2016-10-26 17:43 ` [PATCHv2 1/2] thread_info: factor out restart_block Mark Rutland
@ 2016-10-26 17:43 ` Mark Rutland
  2016-11-02 15:56 ` [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390 Mark Rutland
  2 siblings, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2016-10-26 17:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, akpm, heiko.carstens, keescook, luto, mark.rutland

When CONFIG_THREAD_INFO_IN_TASK is selected, the current_thread_info()
macro relies on current having been defined prior to its use. However,
not all users of current_thread_info() include <asm/current.h>, and thus
current is not guaranteed to be defined.

When CONFIG_THREAD_INFO_IN_TASK is not selected, it's possible that
get_current() / current are based upon current_thread_info(), and
<asm/current.h> includes <asm/thread_info.h>. Thus always including
<asm/current.h> would result in circular dependences on some platforms.

To ensure both cases work, this patch includes <asm/current.h>, but only
when CONFIG_THREAD_INFO_IN_TASK is selected.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 include/linux/thread_info.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index c75c6ab..ef1f4b0 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -12,6 +12,7 @@
 #include <linux/restart_block.h>
 
 #ifdef CONFIG_THREAD_INFO_IN_TASK
+#include <asm/current.h>
 #define current_thread_info() ((struct thread_info *)current)
 #endif
 
-- 
1.9.1

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

* Re: [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390
  2016-10-26 17:43 [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390 Mark Rutland
  2016-10-26 17:43 ` [PATCHv2 1/2] thread_info: factor out restart_block Mark Rutland
  2016-10-26 17:43 ` [PATCHv2 2/2] thread_info: include <current.h> for THREAD_INFO_IN_TASK Mark Rutland
@ 2016-11-02 15:56 ` Mark Rutland
  2016-11-10 18:13   ` Mark Rutland
  2 siblings, 1 reply; 9+ messages in thread
From: Mark Rutland @ 2016-11-02 15:56 UTC (permalink / raw)
  To: linux-kernel, heiko.carstens; +Cc: linux-arch, akpm, keescook, luto

On Wed, Oct 26, 2016 at 06:43:05PM +0100, Mark Rutland wrote:
> Heiko and I have been working on THREAD_INFO_IN_TASK for s390 and arm64
> respectively, and we're both targetting v4.10.
> 
> These are the common core changes which we both require. I've put together a
> branch [1,2] based on v4.9-rc2. I intend to tag this at some point next week so
> that Heiko and I have a stable base.

As a heads-up, I've collated the tags I've received in the last few days, along
with the comment Andy requested in the v1 thread, and tagged this as
core-ti-stack-split [1].

Thanks,
Mark.

[1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git core-ti-stack-split

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

* Re: [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390
  2016-11-02 15:56 ` [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390 Mark Rutland
@ 2016-11-10 18:13   ` Mark Rutland
  2016-11-11  9:16     ` Heiko Carstens
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Rutland @ 2016-11-10 18:13 UTC (permalink / raw)
  To: heiko.carstens, catalin.marinas
  Cc: linux-arch, akpm, keescook, luto, linux-kernel

Hi Heiko,

On Wed, Nov 02, 2016 at 03:56:26PM +0000, Mark Rutland wrote:
> On Wed, Oct 26, 2016 at 06:43:05PM +0100, Mark Rutland wrote:
> > Heiko and I have been working on THREAD_INFO_IN_TASK for s390 and arm64
> > respectively, and we're both targetting v4.10.
> > 
> > These are the common core changes which we both require. I've put together a
> > branch [1,2] based on v4.9-rc2. I intend to tag this at some point next week so
> > that Heiko and I have a stable base.
> 
> As a heads-up, I've collated the tags I've received in the last few days, along
> with the comment Andy requested in the v1 thread, and tagged this as
> core-ti-stack-split [1].
> 
> Thanks,
> Mark.
> 
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git core-ti-stack-split

I believe that Catalin's hoping to take my arm64 patches for v4.10,
using the above tag as a base.

What's the plan for s390? Are you happy to do the same?

Thanks,
Mark.

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

* Re: [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390
  2016-11-10 18:13   ` Mark Rutland
@ 2016-11-11  9:16     ` Heiko Carstens
  2016-11-11 15:42       ` Martin Schwidefsky
  0 siblings, 1 reply; 9+ messages in thread
From: Heiko Carstens @ 2016-11-11  9:16 UTC (permalink / raw)
  To: Mark Rutland
  Cc: catalin.marinas, linux-arch, akpm, keescook, luto, linux-kernel,
	Martin Schwidefsky

Hi Mark,

> On Wed, Nov 02, 2016 at 03:56:26PM +0000, Mark Rutland wrote:
> > On Wed, Oct 26, 2016 at 06:43:05PM +0100, Mark Rutland wrote:
> > > Heiko and I have been working on THREAD_INFO_IN_TASK for s390 and arm64
> > > respectively, and we're both targetting v4.10.
> > > 
> > > These are the common core changes which we both require. I've put together a
> > > branch [1,2] based on v4.9-rc2. I intend to tag this at some point next week so
> > > that Heiko and I have a stable base.
> > 
> > As a heads-up, I've collated the tags I've received in the last few days, along
> > with the comment Andy requested in the v1 thread, and tagged this as
> > core-ti-stack-split [1].
> > 
> > Thanks,
> > Mark.
> > 
> > [1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git core-ti-stack-split
> 
> I believe that Catalin's hoping to take my arm64 patches for v4.10,
> using the above tag as a base.
> 
> What's the plan for s390? Are you happy to do the same?

We intend to merge the s390 variant also for v4.10. Our approach has
changed however: we came to the conclusion that having a per-cpu preempt
count will generate better code on s390; so Martin implemented that.

And while being at it he also moved the rest of the s390 specific stuff out
of our struct thread_info. The corresponding patches will be pushed to

git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features

branch soon.

In result we will have a struct thread_info that only contains the flags
field like x86 does.
So we don't depend an any other patches anymore...

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

* Re: [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390
  2016-11-11  9:16     ` Heiko Carstens
@ 2016-11-11 15:42       ` Martin Schwidefsky
  2016-11-11 16:23         ` Mark Rutland
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Schwidefsky @ 2016-11-11 15:42 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Mark Rutland, catalin.marinas, linux-arch, akpm, keescook, luto,
	linux-kernel

On Fri, 11 Nov 2016 10:16:22 +0100
Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

> Hi Mark,
> 
> > On Wed, Nov 02, 2016 at 03:56:26PM +0000, Mark Rutland wrote:
> > > On Wed, Oct 26, 2016 at 06:43:05PM +0100, Mark Rutland wrote:
> > > > Heiko and I have been working on THREAD_INFO_IN_TASK for s390 and arm64
> > > > respectively, and we're both targetting v4.10.
> > > > 
> > > > These are the common core changes which we both require. I've put together a
> > > > branch [1,2] based on v4.9-rc2. I intend to tag this at some point next week so
> > > > that Heiko and I have a stable base.
> > > 
> > > As a heads-up, I've collated the tags I've received in the last few days, along
> > > with the comment Andy requested in the v1 thread, and tagged this as
> > > core-ti-stack-split [1].
> > > 
> > > Thanks,
> > > Mark.
> > > 
> > > [1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git core-ti-stack-split
> > 
> > I believe that Catalin's hoping to take my arm64 patches for v4.10,
> > using the above tag as a base.
> > 
> > What's the plan for s390? Are you happy to do the same?
> 
> We intend to merge the s390 variant also for v4.10. Our approach has
> changed however: we came to the conclusion that having a per-cpu preempt
> count will generate better code on s390; so Martin implemented that.
> 
> And while being at it he also moved the rest of the s390 specific stuff out
> of our struct thread_info. The corresponding patches will be pushed to
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
> 
> branch soon.
> 
> In result we will have a struct thread_info that only contains the flags
> field like x86 does.
> So we don't depend an any other patches anymore...

Just pushed our collected works to the features branch, in case you are
interested.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

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

* Re: [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390
  2016-11-11 15:42       ` Martin Schwidefsky
@ 2016-11-11 16:23         ` Mark Rutland
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2016-11-11 16:23 UTC (permalink / raw)
  To: Martin Schwidefsky
  Cc: Heiko Carstens, catalin.marinas, linux-arch, akpm, keescook,
	luto, linux-kernel

On Fri, Nov 11, 2016 at 04:42:37PM +0100, Martin Schwidefsky wrote:
> On Fri, 11 Nov 2016 10:16:22 +0100
> Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
> > > On Wed, Nov 02, 2016 at 03:56:26PM +0000, Mark Rutland wrote:
> > > > On Wed, Oct 26, 2016 at 06:43:05PM +0100, Mark Rutland wrote:

> > > > [1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git core-ti-stack-split
> > > 
> > > I believe that Catalin's hoping to take my arm64 patches for v4.10,
> > > using the above tag as a base.
> > > 
> > > What's the plan for s390? Are you happy to do the same?
> > 
> > We intend to merge the s390 variant also for v4.10. Our approach has
> > changed however: we came to the conclusion that having a per-cpu preempt
> > count will generate better code on s390; so Martin implemented that.
> > 
> > And while being at it he also moved the rest of the s390 specific stuff out
> > of our struct thread_info. The corresponding patches will be pushed to
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features

> Just pushed our collected works to the features branch, in case you are
> interested.

Thanks for the heads-up!

It doesn't look like we can do similar for arm64 (we don't have anything
akin to the lowcore stuff), but it certainly seems nicer for s390.

Thanks,
Mark.

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

* [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390
@ 2016-10-26 17:42 Mark Rutland
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2016-10-26 17:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, heiko.carstens, keescook, luto, mark.rutland

Hi all,

Heiko and I have been working on THREAD_INFO_IN_TASK for s390 and arm64
respectively, and we're both targetting v4.10.

These are the common core changes which we both require. I've put together a
branch [1,2] based on v4.9-rc2. I intend to tag this at some point next week so
that Heiko and I have a stable base.

Until then, any and all acks appreciated. ;)

Thanks,
Mark.

Since v1:
* Rebase to v4.9-rc2
* Drop Heiko's patch that was merged before -rc2
* Add Heiko's Acked-by
* Add Andy's Reviewed-by

[1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git core/ti-stack-split
[2] https://git.kernel.org/cgit/linux/kernel/git/mark/linux.git/log/?h=core/ti-stack-split

Mark Rutland (2):
  thread_info: factor out restart_block
  thread_info: include <current.h> for THREAD_INFO_IN_TASK

 include/linux/restart_block.h | 51 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/thread_info.h   | 42 ++---------------------------------
 2 files changed, 53 insertions(+), 40 deletions(-)
 create mode 100644 include/linux/restart_block.h

-- 
1.9.1

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

end of thread, other threads:[~2016-11-11 16:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-26 17:43 [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390 Mark Rutland
2016-10-26 17:43 ` [PATCHv2 1/2] thread_info: factor out restart_block Mark Rutland
2016-10-26 17:43 ` [PATCHv2 2/2] thread_info: include <current.h> for THREAD_INFO_IN_TASK Mark Rutland
2016-11-02 15:56 ` [PATCHv2 0/2] THREAD_INFO_IN_TASK prep work for arm64+s390 Mark Rutland
2016-11-10 18:13   ` Mark Rutland
2016-11-11  9:16     ` Heiko Carstens
2016-11-11 15:42       ` Martin Schwidefsky
2016-11-11 16:23         ` Mark Rutland
  -- strict thread matches above, loose matches on Subject: below --
2016-10-26 17:42 Mark Rutland

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