* [PATCH 1/4] s390: let exit_thread_runtime_instr accept a task
@ 2016-03-24 12:57 Jiri Slaby
2016-03-24 12:57 ` [PATCH 2/4] mn10300: let exit_fpu " Jiri Slaby
2016-03-24 16:38 ` [PATCH 1/4] s390: let exit_thread_runtime_instr " Heiko Carstens
0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby @ 2016-03-24 12:57 UTC (permalink / raw)
To: akpm
Cc: linux-kernel, Jiri Slaby, Martin Schwidefsky, Heiko Carstens,
David Hildenbrand, linux-s390
We need to call exit_thread from copy_process in a fail path. Since
exit_thread on s390 calls exit_thread_runtime_instr, make it accept
task_struct as a parameter now.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: linux-s390@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/s390/include/asm/runtime_instr.h | 2 +-
arch/s390/kernel/process.c | 2 +-
arch/s390/kernel/runtime_instr.c | 6 ++----
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/s390/include/asm/runtime_instr.h b/arch/s390/include/asm/runtime_instr.h
index 402ad6df4897..6ecfadccd5f5 100644
--- a/arch/s390/include/asm/runtime_instr.h
+++ b/arch/s390/include/asm/runtime_instr.h
@@ -85,6 +85,6 @@ static inline void restore_ri_cb(struct runtime_instr_cb *cb_next,
load_runtime_instr_cb(&runtime_instr_empty_cb);
}
-void exit_thread_runtime_instr(void);
+void exit_thread_runtime_instr(struct task_struct *task);
#endif /* _RUNTIME_INSTR_H */
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 2bba7df4ac51..7fabc985a7dd 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -72,7 +72,7 @@ extern void kernel_thread_starter(void);
*/
void exit_thread(void)
{
- exit_thread_runtime_instr();
+ exit_thread_runtime_instr(current);
}
void flush_thread(void)
diff --git a/arch/s390/kernel/runtime_instr.c b/arch/s390/kernel/runtime_instr.c
index fffa0e5462af..f76973888479 100644
--- a/arch/s390/kernel/runtime_instr.c
+++ b/arch/s390/kernel/runtime_instr.c
@@ -43,10 +43,8 @@ static void init_runtime_instr_cb(struct runtime_instr_cb *cb)
cb->valid = 1;
}
-void exit_thread_runtime_instr(void)
+void exit_thread_runtime_instr(struct task_struct *task)
{
- struct task_struct *task = current;
-
if (!task->thread.ri_cb)
return;
disable_runtime_instr();
@@ -63,7 +61,7 @@ SYSCALL_DEFINE1(s390_runtime_instr, int, command)
if (command == S390_RUNTIME_INSTR_STOP) {
preempt_disable();
- exit_thread_runtime_instr();
+ exit_thread_runtime_instr(current);
preempt_enable();
return 0;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/4] mn10300: let exit_fpu accept a task
2016-03-24 12:57 [PATCH 1/4] s390: let exit_thread_runtime_instr accept a task Jiri Slaby
@ 2016-03-24 12:57 ` Jiri Slaby
2016-03-24 16:38 ` [PATCH 1/4] s390: let exit_thread_runtime_instr " Heiko Carstens
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2016-03-24 12:57 UTC (permalink / raw)
To: akpm
Cc: linux-kernel, Jiri Slaby, David Howells, Koichi Yasutake,
linux-am33-list
We need to call exit_thread from copy_process in a fail path. Since
exit_thread on mn10300 calls exit_thread_runtime_instr, make it accept
task_struct as a parameter now.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: David Howells <dhowells@redhat.com>
Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Cc: linux-am33-list@redhat.com
---
arch/mn10300/include/asm/fpu.h | 6 ++----
arch/mn10300/kernel/process.c | 2 +-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/mn10300/include/asm/fpu.h b/arch/mn10300/include/asm/fpu.h
index 738ff72659d5..a47e995d45f3 100644
--- a/arch/mn10300/include/asm/fpu.h
+++ b/arch/mn10300/include/asm/fpu.h
@@ -76,11 +76,9 @@ static inline void unlazy_fpu(struct task_struct *tsk)
preempt_enable();
}
-static inline void exit_fpu(void)
+static inline void exit_fpu(struct task_struct *tsk)
{
#ifdef CONFIG_LAZY_SAVE_FPU
- struct task_struct *tsk = current;
-
preempt_disable();
if (fpu_state_owner == tsk)
fpu_state_owner = NULL;
@@ -123,7 +121,7 @@ static inline void fpu_init_state(void) {}
static inline void fpu_save(struct fpu_state_struct *s) {}
static inline void fpu_kill_state(struct task_struct *tsk) {}
static inline void unlazy_fpu(struct task_struct *tsk) {}
-static inline void exit_fpu(void) {}
+static inline void exit_fpu(struct task_struct *tsk) {}
static inline void flush_fpu(void) {}
static inline int fpu_setup_sigcontext(struct fpucontext *buf) { return 0; }
static inline int fpu_restore_sigcontext(struct fpucontext *buf) { return 0; }
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index 3707da583d05..74a96ccf7451 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -105,7 +105,7 @@ void show_regs(struct pt_regs *regs)
*/
void exit_thread(void)
{
- exit_fpu();
+ exit_fpu(current);
}
void flush_thread(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/4] s390: let exit_thread_runtime_instr accept a task
2016-03-24 12:57 [PATCH 1/4] s390: let exit_thread_runtime_instr accept a task Jiri Slaby
2016-03-24 12:57 ` [PATCH 2/4] mn10300: let exit_fpu " Jiri Slaby
@ 2016-03-24 16:38 ` Heiko Carstens
1 sibling, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2016-03-24 16:38 UTC (permalink / raw)
To: Jiri Slaby
Cc: akpm, linux-kernel, Martin Schwidefsky, David Hildenbrand,
linux-s390
On Thu, Mar 24, 2016 at 01:57:17PM +0100, Jiri Slaby wrote:
> We need to call exit_thread from copy_process in a fail path. Since
> exit_thread on s390 calls exit_thread_runtime_instr, make it accept
> task_struct as a parameter now.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
> Cc: linux-s390@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
> arch/s390/include/asm/runtime_instr.h | 2 +-
> arch/s390/kernel/process.c | 2 +-
> arch/s390/kernel/runtime_instr.c | 6 ++----
> 3 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/arch/s390/include/asm/runtime_instr.h b/arch/s390/include/asm/runtime_instr.h
> index 402ad6df4897..6ecfadccd5f5 100644
> --- a/arch/s390/include/asm/runtime_instr.h
> +++ b/arch/s390/include/asm/runtime_instr.h
> @@ -85,6 +85,6 @@ static inline void restore_ri_cb(struct runtime_instr_cb *cb_next,
> load_runtime_instr_cb(&runtime_instr_empty_cb);
> }
>
> -void exit_thread_runtime_instr(void);
> +void exit_thread_runtime_instr(struct task_struct *task);
>
> #endif /* _RUNTIME_INSTR_H */
> diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
> index 2bba7df4ac51..7fabc985a7dd 100644
> --- a/arch/s390/kernel/process.c
> +++ b/arch/s390/kernel/process.c
> @@ -72,7 +72,7 @@ extern void kernel_thread_starter(void);
> */
> void exit_thread(void)
> {
> - exit_thread_runtime_instr();
> + exit_thread_runtime_instr(current);
> }
>
> void flush_thread(void)
> diff --git a/arch/s390/kernel/runtime_instr.c b/arch/s390/kernel/runtime_instr.c
> index fffa0e5462af..f76973888479 100644
> --- a/arch/s390/kernel/runtime_instr.c
> +++ b/arch/s390/kernel/runtime_instr.c
> @@ -43,10 +43,8 @@ static void init_runtime_instr_cb(struct runtime_instr_cb *cb)
> cb->valid = 1;
> }
>
> -void exit_thread_runtime_instr(void)
> +void exit_thread_runtime_instr(struct task_struct *task)
> {
> - struct task_struct *task = current;
> -
> if (!task->thread.ri_cb)
> return;
Calling exit_thread_runtime_instr() with anything else than current doesn't
make sense. However exactly that happens with one of your later patches.
Even though for your specific use case it will work, I'd prefer if you
would add something like
if (task != current)
return;
To make it a bit more obvious (within this patch or later - I don't care ;)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-24 16:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 12:57 [PATCH 1/4] s390: let exit_thread_runtime_instr accept a task Jiri Slaby
2016-03-24 12:57 ` [PATCH 2/4] mn10300: let exit_fpu " Jiri Slaby
2016-03-24 16:38 ` [PATCH 1/4] s390: let exit_thread_runtime_instr " Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox