THREAD_INFO_IN_TASK prep work for arm64+s390
v2 cover THREAD_INFO_IN_TASK prep work for arm64+s390
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
Signature · 1 line
1.9.1
PATCH v2 1/2 thread_info: factor out restart_block
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.
--- 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
include/linux/restart_block.h new file +51 -0
@@ -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 */
include/linux/thread_info.h +1 -40
52 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v2 2/2 thread_info: include <current.h> for THREAD_INFO_IN_TASK
In reply to Mark RutlandWhen 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.
--- include/linux/thread_info.h | 1 + 1 file changed, 1 insertion(+)
include/linux/thread_info.h +1 -0
@@ -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
Signature · 1 line
1.9.1
Quoted 6 lines · Mark Rutland
Heiko and I have been working on
THREAD_INFO_IN_TASKfor 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
Hi Heiko,
Quoted 8 lines · Mark Rutland
Quoted 6 lines · Mark Rutland
Heiko and I have been working on
THREAD_INFO_IN_TASKfor 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.
Quoted 8 lines
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.gitcore-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.
Hi Mark,
Quoted 16 lines · Mark Rutland
Quoted 15 lines · Mark Rutland
Quoted 6 lines
Heiko and I have been working on
THREAD_INFO_IN_TASKfor 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.
Quoted 6 lines
Quoted 1 line
[1]
git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.gitcore-ti-stack-splitI 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...
Quoted 32 lines · On Fri, 11 Nov 2016 10:16:22 +0100 Heiko Carstens <[email protected]>…
Hi Mark,
Quoted 16 lines · Mark Rutland
Quoted 15 lines · Mark Rutland
Quoted 6 lines
Heiko and I have been working on
THREAD_INFO_IN_TASKfor 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.Quoted 6 lines
Quoted 1 line
[1]
git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.gitcore-ti-stack-splitI 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
Quoted 7 lines
git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.gitfeaturesbranch soon.
In result we will have a struct
thread_infothat 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.
Signature · 4 lines
blue skies, Martin. "Reality continues to ruin my life." - Calvin.
Quoted 16 lines · Martin Schwidefsky
Quoted 14 lines · On Fri, 11 Nov 2016 10:16:22 +0100 Heiko Carstens <[email protected]>…
Quoted 9 lines · Mark Rutland
Quoted 3 lines · Mark Rutland
[1]
git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.gitcore-ti-stack-splitI 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.
Quoted 7 lines
Quoted 4 lines
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.gitfeaturesJust 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.