All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH REPOST 0/5] Simplify setting thread flags to a particular value
@ 2018-05-11 15:04 Dave Martin
  2018-05-11 15:05 ` [PATCH REPOST 1/5] thread_info: Port core code to use update_thread_flag() helpers Dave Martin
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Dave Martin @ 2018-05-11 15:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ralf Baechle, James Hogan, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, David S. Miller, Ingo Molnar,
	Peter Zijlstra, Steven Rostedt, Oleg Nesterov, linux-arch

There are a number of bits of code sprinkled around the kernel to
set a thread flag if a certain condition is true, and clear it
otherwise.

This series ports relevant bits of code to use the new
update_thread_flag() helpers implemented in [2].


Note: This is a repost of a previous RFC [1].  Part of patch 1, and
all of patch 4 of that series have been split out and reviewed
separately ([2], [3] respectively).  I currently expect them to merge
via Marc's KVM tree.

The remainder of the patches from [1] are reposted here.

Patch 1 ports some core code that to use the update_thread_flag()
helpers.

The remaining patches port relevant bits of arch code.

Build-tested on the affected architectures; some context switch stress
testing done on arm64, which exercises a few call sites for the new
helpers.

Comments welcome.

Cheers
---Dave


[1] [RFC PATCH 0/6] Simplify setting thread flags to a particular value
https://lkml.org/lkml/2018/4/19/225

[2] [PATCH v7 01/16] thread_info: Add update_thread_flag() helpers
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/576596.html

[3] [PATCH v7 02/16] arm64: Use update{,_tsk}_thread_flag()
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/576597.html

Dave Martin (5):
  thread_info: Port core code to use update_thread_flag() helpers
  ARM: Use update_thread_flag()
  MIPS: Use update{,_tsk}_thread_flag()
  powerpc: Use update_thread_flag()
  sparc: Use update_thread_flag()

 arch/arm/kernel/elf.c           |  9 +++------
 arch/mips/kernel/elf.c          | 10 ++--------
 arch/mips/kernel/process.c      | 15 ++++++---------
 arch/mips/kernel/ptrace.c       |  5 +----
 arch/mips/kernel/syscall.c      | 10 ++--------
 arch/powerpc/include/asm/elf.h  | 10 ++--------
 arch/sparc/include/asm/elf_64.h |  5 +----
 include/trace/syscall.h         |  6 ++----
 kernel/ptrace.c                 | 13 +++++--------
 9 files changed, 24 insertions(+), 59 deletions(-)

-- 
2.1.4

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

* [PATCH REPOST 1/5] thread_info: Port core code to use update_thread_flag() helpers
  2018-05-11 15:04 [PATCH REPOST 0/5] Simplify setting thread flags to a particular value Dave Martin
@ 2018-05-11 15:05 ` Dave Martin
  2018-05-11 15:33   ` Steven Rostedt
  2018-05-13 16:12   ` Oleg Nesterov
  2018-05-11 15:05 ` [PATCH REPOST 2/5] ARM: Use update_thread_flag() Dave Martin
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 10+ messages in thread
From: Dave Martin @ 2018-05-11 15:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ralf Baechle, James Hogan, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, David S. Miller, Ingo Molnar,
	Peter Zijlstra, Steven Rostedt, Oleg Nesterov, linux-arch

This patch ports a couple of relevant bits of the core kernel to
use the new update_thread_flag() helpers.

No functional change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Oleg Nesterov <oleg@redhat.com>
---
 include/trace/syscall.h |  6 ++----
 kernel/ptrace.c         | 13 +++++--------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index dc8ac27..dcc9bdf 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -37,10 +37,8 @@ struct syscall_metadata {
 #if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
 static inline void syscall_tracepoint_update(struct task_struct *p)
 {
-	if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
-		set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
-	else
-		clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
+	update_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT,
+			       test_thread_flag(TIF_SYSCALL_TRACEPOINT));
 }
 #else
 static inline void syscall_tracepoint_update(struct task_struct *p)
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 21fec73..7a2bd8d 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -785,16 +785,13 @@ static int ptrace_resume(struct task_struct *child, long request,
 	if (!valid_signal(data))
 		return -EIO;
 
-	if (request == PTRACE_SYSCALL)
-		set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-	else
-		clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
+	update_tsk_thread_flag(child, TIF_SYSCALL_TRACE,
+			       request == PTRACE_SYSCALL);
 
 #ifdef TIF_SYSCALL_EMU
-	if (request == PTRACE_SYSEMU || request == PTRACE_SYSEMU_SINGLESTEP)
-		set_tsk_thread_flag(child, TIF_SYSCALL_EMU);
-	else
-		clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
+	update_tsk_thread_flag(child, TIF_SYSCALL_EMU,
+			       request == PTRACE_SYSEMU ||
+			       request == PTRACE_SYSEMU_SINGLESTEP);
 #endif
 
 	if (is_singleblock(request)) {
-- 
2.1.4

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

* [PATCH REPOST 2/5] ARM: Use update_thread_flag()
  2018-05-11 15:04 [PATCH REPOST 0/5] Simplify setting thread flags to a particular value Dave Martin
  2018-05-11 15:05 ` [PATCH REPOST 1/5] thread_info: Port core code to use update_thread_flag() helpers Dave Martin
@ 2018-05-11 15:05 ` Dave Martin
  2018-05-11 15:05 ` [PATCH REPOST 3/5] MIPS: Use update{,_tsk}_thread_flag() Dave Martin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Dave Martin @ 2018-05-11 15:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ralf Baechle, James Hogan, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, David S. Miller, Ingo Molnar,
	Peter Zijlstra, Steven Rostedt, Oleg Nesterov, linux-arch,
	Russell King

This patch uses the new update_thread_flag() helper to simplify an
if () set; else clear; construct.

No functional change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
---
 arch/arm/kernel/elf.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/arm/kernel/elf.c b/arch/arm/kernel/elf.c
index 1824229..aade393 100644
--- a/arch/arm/kernel/elf.c
+++ b/arch/arm/kernel/elf.c
@@ -68,12 +68,9 @@ void elf_set_personality(const struct elf32_hdr *x)
 	 * binary is EABI or softfloat (and thus, guaranteed not to use
 	 * FPA instructions.)
 	 */
-	if (elf_hwcap & HWCAP_IWMMXT &&
-	    eflags & (EF_ARM_EABI_MASK | EF_ARM_SOFT_FLOAT)) {
-		set_thread_flag(TIF_USING_IWMMXT);
-	} else {
-		clear_thread_flag(TIF_USING_IWMMXT);
-	}
+	update_thread_flag(TIF_USING_IWMMXT,
+			   elf_hwcap & HWCAP_IWMMXT &&
+			   eflags & (EF_ARM_EABI_MASK | EF_ARM_SOFT_FLOAT));
 }
 EXPORT_SYMBOL(elf_set_personality);
 
-- 
2.1.4

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

* [PATCH REPOST 3/5] MIPS: Use update{,_tsk}_thread_flag()
  2018-05-11 15:04 [PATCH REPOST 0/5] Simplify setting thread flags to a particular value Dave Martin
  2018-05-11 15:05 ` [PATCH REPOST 1/5] thread_info: Port core code to use update_thread_flag() helpers Dave Martin
  2018-05-11 15:05 ` [PATCH REPOST 2/5] ARM: Use update_thread_flag() Dave Martin
@ 2018-05-11 15:05 ` Dave Martin
  2018-05-11 15:05 ` [PATCH REPOST 4/5] powerpc: Use update_thread_flag() Dave Martin
  2018-05-11 15:05 ` [PATCH REPOST 5/5] sparc: " Dave Martin
  4 siblings, 0 replies; 10+ messages in thread
From: Dave Martin @ 2018-05-11 15:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ralf Baechle, James Hogan, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, David S. Miller, Ingo Molnar,
	Peter Zijlstra, Steven Rostedt, Oleg Nesterov, linux-arch

This patch uses the new update_thread_flag() helpers to simplify a
couple of if () set; else clear; constructs.

No functional change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
---
 arch/mips/kernel/elf.c     | 10 ++--------
 arch/mips/kernel/process.c | 15 ++++++---------
 arch/mips/kernel/ptrace.c  |  5 +----
 arch/mips/kernel/syscall.c | 10 ++--------
 4 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/arch/mips/kernel/elf.c b/arch/mips/kernel/elf.c
index 731325a..2351509 100644
--- a/arch/mips/kernel/elf.c
+++ b/arch/mips/kernel/elf.c
@@ -267,14 +267,8 @@ int arch_check_elf(void *_ehdr, bool has_interpreter, void *_interp_ehdr,
 
 static inline void set_thread_fp_mode(int hybrid, int regs32)
 {
-	if (hybrid)
-		set_thread_flag(TIF_HYBRID_FPREGS);
-	else
-		clear_thread_flag(TIF_HYBRID_FPREGS);
-	if (regs32)
-		set_thread_flag(TIF_32BIT_FPREGS);
-	else
-		clear_thread_flag(TIF_32BIT_FPREGS);
+	update_thread_flag(TIF_HYBRID_FPREGS, hybrid);
+	update_thread_flag(TIF_32BIT_FPREGS, regs32);
 }
 
 void mips_set_personality_fp(struct arch_elf_state *state)
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index b9e9bf6..4bdecb6 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -763,18 +763,15 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)
 	 */
 	for_each_thread(task, t) {
 		/* Update desired FP register width */
-		if (value & PR_FP_MODE_FR) {
-			clear_tsk_thread_flag(t, TIF_32BIT_FPREGS);
-		} else {
-			set_tsk_thread_flag(t, TIF_32BIT_FPREGS);
+		update_tsk_thread_flag(t, TIF_32BIT_REGS,
+				       !(value & PR_FP_MODE_FR));
+
+		if (!(value & PR_FP_MODE_FR))
 			clear_tsk_thread_flag(t, TIF_MSA_CTX_LIVE);
-		}
 
 		/* Update desired FP single layout */
-		if (value & PR_FP_MODE_FRE)
-			set_tsk_thread_flag(t, TIF_HYBRID_FPREGS);
-		else
-			clear_tsk_thread_flag(t, TIF_HYBRID_FPREGS);
+		update_tsk_thread_flag(t, TIF_HYBRID_FPREGS,
+				       value & PR_FP_MODE_FRE);
 	}
 
 	/* Allow threads to use FP again */
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 0b23b1a..b218812 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -279,10 +279,7 @@ int ptrace_set_watch_regs(struct task_struct *child,
 		child->thread.watch.mips3264.watchhi[i] = ht[i];
 	}
 
-	if (watch_active)
-		set_tsk_thread_flag(child, TIF_LOAD_WATCH);
-	else
-		clear_tsk_thread_flag(child, TIF_LOAD_WATCH);
+	update_tsk_thread_flag(child, TIF_LOAD_WATCH, watch_active);
 
 	return 0;
 }
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 69c17b5..e9fa130 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -209,14 +209,8 @@ SYSCALL_DEFINE3(sysmips, long, cmd, long, arg1, long, arg2)
 		if (arg1 & ~3)
 			return -EINVAL;
 
-		if (arg1 & 1)
-			set_thread_flag(TIF_FIXADE);
-		else
-			clear_thread_flag(TIF_FIXADE);
-		if (arg1 & 2)
-			set_thread_flag(TIF_LOGADE);
-		else
-			clear_thread_flag(TIF_LOGADE);
+		update_thread_flag(TIF_FIXADE, arg1 & 1);
+		update_thread_flag(TIF_LOGADE, arg1 & 2);
 
 		return 0;
 
-- 
2.1.4

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

* [PATCH REPOST 4/5] powerpc: Use update_thread_flag()
  2018-05-11 15:04 [PATCH REPOST 0/5] Simplify setting thread flags to a particular value Dave Martin
                   ` (2 preceding siblings ...)
  2018-05-11 15:05 ` [PATCH REPOST 3/5] MIPS: Use update{,_tsk}_thread_flag() Dave Martin
@ 2018-05-11 15:05 ` Dave Martin
  2018-05-15  3:13   ` Michael Ellerman
  2018-05-11 15:05 ` [PATCH REPOST 5/5] sparc: " Dave Martin
  4 siblings, 1 reply; 10+ messages in thread
From: Dave Martin @ 2018-05-11 15:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ralf Baechle, James Hogan, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, David S. Miller, Ingo Molnar,
	Peter Zijlstra, Steven Rostedt, Oleg Nesterov, linux-arch

This patch uses the new update_thread_flag() helper to simplify a
couple of if () set; else clear; constructs.

No functional change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/elf.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 548d9a4..136c9b1 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -88,14 +88,8 @@ typedef elf_vrregset_t elf_fpxregset_t;
 #ifdef __powerpc64__
 # define SET_PERSONALITY(ex)					\
 do {								\
-	if (((ex).e_flags & 0x3) == 2)				\
-		set_thread_flag(TIF_ELF2ABI);			\
-	else							\
-		clear_thread_flag(TIF_ELF2ABI);			\
-	if ((ex).e_ident[EI_CLASS] == ELFCLASS32)		\
-		set_thread_flag(TIF_32BIT);			\
-	else							\
-		clear_thread_flag(TIF_32BIT);			\
+	update_thread_flag(TIF_ELF2ABI, ((ex).e_flags & 0x3) == 2);	\
+	update_thread_flag(TIF_32BIT, (ex).e_ident[EI_CLASS] == ELFCLASS32); \
 	if (personality(current->personality) != PER_LINUX32)	\
 		set_personality(PER_LINUX |			\
 			(current->personality & (~PER_MASK)));	\
-- 
2.1.4

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

* [PATCH REPOST 5/5] sparc: Use update_thread_flag()
  2018-05-11 15:04 [PATCH REPOST 0/5] Simplify setting thread flags to a particular value Dave Martin
                   ` (3 preceding siblings ...)
  2018-05-11 15:05 ` [PATCH REPOST 4/5] powerpc: Use update_thread_flag() Dave Martin
@ 2018-05-11 15:05 ` Dave Martin
  2018-05-11 15:10   ` David Miller
  4 siblings, 1 reply; 10+ messages in thread
From: Dave Martin @ 2018-05-11 15:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ralf Baechle, James Hogan, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, David S. Miller, Ingo Molnar,
	Peter Zijlstra, Steven Rostedt, Oleg Nesterov, linux-arch

This patch uses the new update_thread_flag() helper to simplify an
if () set; else clear; construct.

No functional change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/include/asm/elf_64.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
index 7e078bc..f1ef89c 100644
--- a/arch/sparc/include/asm/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
@@ -202,10 +202,7 @@ extern unsigned long sparc64_elf_hwcap;
 #define ELF_PLATFORM	(NULL)
 
 #define SET_PERSONALITY(ex)				\
-do {	if ((ex).e_ident[EI_CLASS] == ELFCLASS32)	\
-		set_thread_flag(TIF_32BIT);		\
-	else						\
-		clear_thread_flag(TIF_32BIT);		\
+do {	update_thread_flag(TIF_32BIT, (ex).e_ident[EI_CLASS] == ELFCLASS32); \
 	/* flush_thread will update pgd cache */	\
 	if (personality(current->personality) != PER_LINUX32)	\
 		set_personality(PER_LINUX |		\
-- 
2.1.4

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

* Re: [PATCH REPOST 5/5] sparc: Use update_thread_flag()
  2018-05-11 15:05 ` [PATCH REPOST 5/5] sparc: " Dave Martin
@ 2018-05-11 15:10   ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2018-05-11 15:10 UTC (permalink / raw)
  To: Dave.Martin
  Cc: linux-kernel, ralf, jhogan, benh, paulus, mpe, mingo, peterz,
	rostedt, oleg, linux-arch

From: Dave Martin <Dave.Martin@arm.com>
Date: Fri, 11 May 2018 16:05:04 +0100

> This patch uses the new update_thread_flag() helper to simplify an
> if () set; else clear; construct.
> 
> No functional change.
> 
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCH REPOST 1/5] thread_info: Port core code to use update_thread_flag() helpers
  2018-05-11 15:05 ` [PATCH REPOST 1/5] thread_info: Port core code to use update_thread_flag() helpers Dave Martin
@ 2018-05-11 15:33   ` Steven Rostedt
  2018-05-13 16:12   ` Oleg Nesterov
  1 sibling, 0 replies; 10+ messages in thread
From: Steven Rostedt @ 2018-05-11 15:33 UTC (permalink / raw)
  To: Dave Martin
  Cc: linux-kernel, Ralf Baechle, James Hogan, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, David S. Miller, Ingo Molnar,
	Peter Zijlstra, Oleg Nesterov, linux-arch

On Fri, 11 May 2018 16:05:00 +0100
Dave Martin <Dave.Martin@arm.com> wrote:

> This patch ports a couple of relevant bits of the core kernel to
> use the new update_thread_flag() helpers.
> 
> No functional change.
> 
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Oleg Nesterov <oleg@redhat.com>
> ---
>  include/trace/syscall.h |  6 ++----
>  kernel/ptrace.c         | 13 +++++--------
>  2 files changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/include/trace/syscall.h b/include/trace/syscall.h
> index dc8ac27..dcc9bdf 100644
> --- a/include/trace/syscall.h
> +++ b/include/trace/syscall.h
> @@ -37,10 +37,8 @@ struct syscall_metadata {
>  #if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
>  static inline void syscall_tracepoint_update(struct task_struct *p)
>  {
> -	if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
> -		set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
> -	else
> -		clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
> +	update_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT,
> +			       test_thread_flag(TIF_SYSCALL_TRACEPOINT));
>  }

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

>  #else
>  static inline void syscall_tracepoint_update(struct task_struct *p)
> diff --git a/kernel/ptrace.c b/kernel/ptrace.c
> index 21fec73..7a2bd8d 100644
> --- a/kernel/ptrace.c
> +++ b/kernel/ptrace.c
> @@ -785,16 +785,13 @@ static int ptrace_resume(struct task_struct *child, long request,
>  	if (!valid_signal(data))
>  		return -EIO;
>  
> -	if (request == PTRACE_SYSCALL)
> -		set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
> -	else
> -		clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
> +	update_tsk_thread_flag(child, TIF_SYSCALL_TRACE,
> +			       request == PTRACE_SYSCALL);
>  
>  #ifdef TIF_SYSCALL_EMU
> -	if (request == PTRACE_SYSEMU || request == PTRACE_SYSEMU_SINGLESTEP)
> -		set_tsk_thread_flag(child, TIF_SYSCALL_EMU);
> -	else
> -		clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
> +	update_tsk_thread_flag(child, TIF_SYSCALL_EMU,
> +			       request == PTRACE_SYSEMU ||
> +			       request == PTRACE_SYSEMU_SINGLESTEP);
>  #endif
>  
>  	if (is_singleblock(request)) {

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

* Re: [PATCH REPOST 1/5] thread_info: Port core code to use update_thread_flag() helpers
  2018-05-11 15:05 ` [PATCH REPOST 1/5] thread_info: Port core code to use update_thread_flag() helpers Dave Martin
  2018-05-11 15:33   ` Steven Rostedt
@ 2018-05-13 16:12   ` Oleg Nesterov
  1 sibling, 0 replies; 10+ messages in thread
From: Oleg Nesterov @ 2018-05-13 16:12 UTC (permalink / raw)
  To: Dave Martin
  Cc: linux-kernel, Ralf Baechle, James Hogan, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, David S. Miller, Ingo Molnar,
	Peter Zijlstra, Steven Rostedt, linux-arch

On 05/11, Dave Martin wrote:
>
> This patch ports a couple of relevant bits of the core kernel to
> use the new update_thread_flag() helpers.
>
> No functional change.
>
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Oleg Nesterov <oleg@redhat.com>
> ---
>  include/trace/syscall.h |  6 ++----
>  kernel/ptrace.c         | 13 +++++--------
>  2 files changed, 7 insertions(+), 12 deletions(-)

Acked-by: Oleg Nesterov <oleg@redhat.com>

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

* Re: [PATCH REPOST 4/5] powerpc: Use update_thread_flag()
  2018-05-11 15:05 ` [PATCH REPOST 4/5] powerpc: Use update_thread_flag() Dave Martin
@ 2018-05-15  3:13   ` Michael Ellerman
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Ellerman @ 2018-05-15  3:13 UTC (permalink / raw)
  To: Dave Martin, linux-kernel
  Cc: Ralf Baechle, James Hogan, Benjamin Herrenschmidt,
	Paul Mackerras, David S. Miller, Ingo Molnar, Peter Zijlstra,
	Steven Rostedt, Oleg Nesterov, linux-arch

Dave Martin <Dave.Martin@arm.com> writes:

> This patch uses the new update_thread_flag() helper to simplify a
> couple of if () set; else clear; constructs.
>
> No functional change.
>
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  arch/powerpc/include/asm/elf.h | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
> index 548d9a4..136c9b1 100644
> --- a/arch/powerpc/include/asm/elf.h
> +++ b/arch/powerpc/include/asm/elf.h
> @@ -88,14 +88,8 @@ typedef elf_vrregset_t elf_fpxregset_t;
>  #ifdef __powerpc64__
>  # define SET_PERSONALITY(ex)					\
>  do {								\
> -	if (((ex).e_flags & 0x3) == 2)				\
> -		set_thread_flag(TIF_ELF2ABI);			\
> -	else							\
> -		clear_thread_flag(TIF_ELF2ABI);			\
> -	if ((ex).e_ident[EI_CLASS] == ELFCLASS32)		\
> -		set_thread_flag(TIF_32BIT);			\
> -	else							\
> -		clear_thread_flag(TIF_32BIT);			\
> +	update_thread_flag(TIF_ELF2ABI, ((ex).e_flags & 0x3) == 2);	\
> +	update_thread_flag(TIF_32BIT, (ex).e_ident[EI_CLASS] == ELFCLASS32); \
>  	if (personality(current->personality) != PER_LINUX32)	\
>  		set_personality(PER_LINUX |			\
>  			(current->personality & (~PER_MASK)));	\

Thanks for cleaning it up.

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

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

end of thread, other threads:[~2018-05-15  3:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-11 15:04 [PATCH REPOST 0/5] Simplify setting thread flags to a particular value Dave Martin
2018-05-11 15:05 ` [PATCH REPOST 1/5] thread_info: Port core code to use update_thread_flag() helpers Dave Martin
2018-05-11 15:33   ` Steven Rostedt
2018-05-13 16:12   ` Oleg Nesterov
2018-05-11 15:05 ` [PATCH REPOST 2/5] ARM: Use update_thread_flag() Dave Martin
2018-05-11 15:05 ` [PATCH REPOST 3/5] MIPS: Use update{,_tsk}_thread_flag() Dave Martin
2018-05-11 15:05 ` [PATCH REPOST 4/5] powerpc: Use update_thread_flag() Dave Martin
2018-05-15  3:13   ` Michael Ellerman
2018-05-11 15:05 ` [PATCH REPOST 5/5] sparc: " Dave Martin
2018-05-11 15:10   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.