Linux-MIPS Archive on lore.kernel.org
 help / color / Atom feed
* remove asm-generic/ptrace.h v2
@ 2019-05-20  6:00 Christoph Hellwig
  2019-05-20  6:00 ` [PATCH 1/5] arm64: don't use asm-generic/ptrace.h Christoph Hellwig
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Christoph Hellwig @ 2019-05-20  6:00 UTC (permalink / raw)
  To: Oleg Nesterov, Arnd Bergmann
  Cc: x86, linux-arm-kernel, linux-mips, linuxppc-dev, linux-sh,
	linux-arch, linux-kernel

Hi all,

asm-generic/ptrace.h is a little weird in that it doesn't actually
implement any functionality, but it provided multiple layers of macros
that just implement trivial inline functions.  We implement those
directly in the few architectures and be off with a much simpler
design.

Changes since v1:
 - add a missing empty line between functions

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

* [PATCH 1/5] arm64: don't use asm-generic/ptrace.h
  2019-05-20  6:00 remove asm-generic/ptrace.h v2 Christoph Hellwig
@ 2019-05-20  6:00 ` Christoph Hellwig
  2019-05-20  6:00 ` [PATCH 2/5] powerpc: " Christoph Hellwig
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2019-05-20  6:00 UTC (permalink / raw)
  To: Oleg Nesterov, Arnd Bergmann
  Cc: x86, linux-arm-kernel, linux-mips, linuxppc-dev, linux-sh,
	linux-arch, linux-kernel, Catalin Marinas

Doing the indirection through macros for the regs accessors just
makes them harder to read, so implement the helpers directly.

Note that only the helpers actually used are implemented now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/include/asm/ptrace.h | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index b2de32939ada..584261e00619 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -228,11 +228,12 @@ static inline void forget_syscall(struct pt_regs *regs)
 #define fast_interrupts_enabled(regs) \
 	(!((regs)->pstate & PSR_F_BIT))
 
-#define GET_USP(regs) \
-	(!compat_user_mode(regs) ? (regs)->sp : (regs)->compat_sp)
-
-#define SET_USP(ptregs, value) \
-	(!compat_user_mode(regs) ? ((regs)->sp = value) : ((regs)->compat_sp = value))
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+	if (compat_user_mode(regs))
+		return regs->compat_sp;
+	return regs->sp;
+}
 
 extern int regs_query_register_offset(const char *name);
 extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
@@ -331,13 +332,20 @@ static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs,
 struct task_struct;
 int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task);
 
-#define GET_IP(regs)		((unsigned long)(regs)->pc)
-#define SET_IP(regs, value)	((regs)->pc = ((u64) (value)))
-
-#define GET_FP(ptregs)		((unsigned long)(ptregs)->regs[29])
-#define SET_FP(ptregs, value)	((ptregs)->regs[29] = ((u64) (value)))
+static inline unsigned long instruction_pointer(struct pt_regs *regs)
+{
+	return regs->pc;
+}
+static inline void instruction_pointer_set(struct pt_regs *regs,
+		unsigned long val)
+{
+	regs->pc = val;
+}
 
-#include <asm-generic/ptrace.h>
+static inline unsigned long frame_pointer(struct pt_regs *regs)
+{
+	return regs->regs[29];
+}
 
 #define procedure_link_pointer(regs)	((regs)->regs[30])
 
@@ -347,7 +355,6 @@ static inline void procedure_link_pointer_set(struct pt_regs *regs,
 	procedure_link_pointer(regs) = val;
 }
 
-#undef profile_pc
 extern unsigned long profile_pc(struct pt_regs *regs);
 
 #endif /* __ASSEMBLY__ */
-- 
2.20.1


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

* [PATCH 2/5] powerpc: don't use asm-generic/ptrace.h
  2019-05-20  6:00 remove asm-generic/ptrace.h v2 Christoph Hellwig
  2019-05-20  6:00 ` [PATCH 1/5] arm64: don't use asm-generic/ptrace.h Christoph Hellwig
@ 2019-05-20  6:00 ` " Christoph Hellwig
  2019-05-20  6:00 ` [PATCH 3/5] sh: " Christoph Hellwig
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2019-05-20  6:00 UTC (permalink / raw)
  To: Oleg Nesterov, Arnd Bergmann
  Cc: x86, linux-arm-kernel, linux-mips, linuxppc-dev, linux-sh,
	linux-arch, linux-kernel

Doing the indirection through macros for the regs accessors just
makes them harder to read, so implement the helpers directly.

Note that only the helpers actually used are implemented now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/powerpc/include/asm/ptrace.h | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 6f047730e642..fc007d186a82 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -115,18 +115,33 @@ struct pt_regs
 
 #ifndef __ASSEMBLY__
 
-#define GET_IP(regs)		((regs)->nip)
-#define GET_USP(regs)		((regs)->gpr[1])
-#define GET_FP(regs)		(0)
-#define SET_FP(regs, val)
+static inline unsigned long instruction_pointer(struct pt_regs *regs)
+{
+	return regs->nip;
+}
+
+static inline void instruction_pointer_set(struct pt_regs *regs,
+		unsigned long val)
+{
+	regs->nip = val;
+}
+
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+	return regs->gpr[1];
+}
+
+static inline unsigned long frame_pointer(struct pt_regs *regs)
+{
+	return 0;
+}
 
 #ifdef CONFIG_SMP
 extern unsigned long profile_pc(struct pt_regs *regs);
-#define profile_pc profile_pc
+#else
+#define profile_pc(regs) instruction_pointer(regs)
 #endif
 
-#include <asm-generic/ptrace.h>
-
 #define kernel_stack_pointer(regs) ((regs)->gpr[1])
 static inline int is_syscall_success(struct pt_regs *regs)
 {
-- 
2.20.1


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

* [PATCH 3/5] sh: don't use asm-generic/ptrace.h
  2019-05-20  6:00 remove asm-generic/ptrace.h v2 Christoph Hellwig
  2019-05-20  6:00 ` [PATCH 1/5] arm64: don't use asm-generic/ptrace.h Christoph Hellwig
  2019-05-20  6:00 ` [PATCH 2/5] powerpc: " Christoph Hellwig
@ 2019-05-20  6:00 ` " Christoph Hellwig
  2019-05-20  6:00 ` [PATCH 4/5] x86: " Christoph Hellwig
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2019-05-20  6:00 UTC (permalink / raw)
  To: Oleg Nesterov, Arnd Bergmann
  Cc: x86, linux-arm-kernel, linux-mips, linuxppc-dev, linux-sh,
	linux-arch, linux-kernel

Doing the indirection through macros for the regs accessors just
makes them harder to read, so implement the helpers directly.

Note that only the helpers actually used are implemented now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/ptrace.h | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index 9143c7babcbe..6c89e3e04cee 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -16,8 +16,31 @@
 #define user_mode(regs)			(((regs)->sr & 0x40000000)==0)
 #define kernel_stack_pointer(_regs)	((unsigned long)(_regs)->regs[15])
 
-#define GET_FP(regs)	((regs)->regs[14])
-#define GET_USP(regs)	((regs)->regs[15])
+static inline unsigned long instruction_pointer(struct pt_regs *regs)
+{
+	return regs->pc;
+}
+static inline void instruction_pointer_set(struct pt_regs *regs,
+		unsigned long val)
+{
+	regs->pc = val;
+}
+
+static inline unsigned long frame_pointer(struct pt_regs *regs)
+{
+	return regs->regs[14];
+}
+
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+	return regs->regs[15];
+}
+
+static inline void user_stack_pointer_set(struct pt_regs *regs,
+		unsigned long val)
+{
+	regs->regs[15] = val;
+}
 
 #define arch_has_single_step()	(1)
 
@@ -112,7 +135,5 @@ static inline unsigned long profile_pc(struct pt_regs *regs)
 
 	return pc;
 }
-#define profile_pc profile_pc
 
-#include <asm-generic/ptrace.h>
 #endif /* __ASM_SH_PTRACE_H */
-- 
2.20.1


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

* [PATCH 4/5] x86: don't use asm-generic/ptrace.h
  2019-05-20  6:00 remove asm-generic/ptrace.h v2 Christoph Hellwig
                   ` (2 preceding siblings ...)
  2019-05-20  6:00 ` [PATCH 3/5] sh: " Christoph Hellwig
@ 2019-05-20  6:00 ` " Christoph Hellwig
  2019-05-20 16:02   ` Oleg Nesterov
  2019-05-20  6:00 ` [PATCH 5/5] asm-generic: remove ptrace.h Christoph Hellwig
  2019-06-04  7:02 ` remove asm-generic/ptrace.h v2 Christoph Hellwig
  5 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2019-05-20  6:00 UTC (permalink / raw)
  To: Oleg Nesterov, Arnd Bergmann
  Cc: x86, linux-arm-kernel, linux-mips, linuxppc-dev, linux-sh,
	linux-arch, linux-kernel, Ingo Molnar

Doing the indirection through macros for the regs accessors just
makes them harder to read, so implement the helpers directly.

Note that only the helpers actually used are implemented now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/ptrace.h | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 8a7fc0cca2d1..e22816e865ca 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -98,7 +98,6 @@ struct cpuinfo_x86;
 struct task_struct;
 
 extern unsigned long profile_pc(struct pt_regs *regs);
-#define profile_pc profile_pc
 
 extern unsigned long
 convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
@@ -175,11 +174,32 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
 }
 #endif
 
-#define GET_IP(regs) ((regs)->ip)
-#define GET_FP(regs) ((regs)->bp)
-#define GET_USP(regs) ((regs)->sp)
+static inline unsigned long instruction_pointer(struct pt_regs *regs)
+{
+	return regs->ip;
+}
+
+static inline void instruction_pointer_set(struct pt_regs *regs,
+		unsigned long val)
+{
+	regs->ip = val;
+}
+
+static inline unsigned long frame_pointer(struct pt_regs *regs)
+{
+	return regs->bp;
+}
 
-#include <asm-generic/ptrace.h>
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+	return regs->sp;
+}
+
+static inline void user_stack_pointer_set(struct pt_regs *regs,
+		unsigned long val)
+{
+	regs->sp = val;
+}
 
 /* Query offset/name of register from its name/offset */
 extern int regs_query_register_offset(const char *name);
-- 
2.20.1


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

* [PATCH 5/5] asm-generic: remove ptrace.h
  2019-05-20  6:00 remove asm-generic/ptrace.h v2 Christoph Hellwig
                   ` (3 preceding siblings ...)
  2019-05-20  6:00 ` [PATCH 4/5] x86: " Christoph Hellwig
@ 2019-05-20  6:00 ` Christoph Hellwig
  2019-05-20 16:03   ` Oleg Nesterov
  2019-06-04  7:02 ` remove asm-generic/ptrace.h v2 Christoph Hellwig
  5 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2019-05-20  6:00 UTC (permalink / raw)
  To: Oleg Nesterov, Arnd Bergmann
  Cc: x86, linux-arm-kernel, linux-mips, linuxppc-dev, linux-sh,
	linux-arch, linux-kernel

No one is using this header anymore.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 MAINTAINERS                    |  1 -
 arch/mips/include/asm/ptrace.h |  5 ---
 include/asm-generic/ptrace.h   | 74 ----------------------------------
 3 files changed, 80 deletions(-)
 delete mode 100644 include/asm-generic/ptrace.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 5cfbea4ce575..f3392488ffaf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12769,7 +12769,6 @@ F:	include/linux/regset.h
 F:	include/linux/tracehook.h
 F:	include/uapi/linux/ptrace.h
 F:	include/uapi/linux/ptrace.h
-F:	include/asm-generic/ptrace.h
 F:	kernel/ptrace.c
 F:	arch/*/ptrace*.c
 F:	arch/*/*/ptrace*.c
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index b6578611dddb..1e76774b36dd 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -56,11 +56,6 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
 	return regs->regs[31];
 }
 
-/*
- * Don't use asm-generic/ptrace.h it defines FP accessors that don't make
- * sense on MIPS.  We rather want an error if they get invoked.
- */
-
 static inline void instruction_pointer_set(struct pt_regs *regs,
                                            unsigned long val)
 {
diff --git a/include/asm-generic/ptrace.h b/include/asm-generic/ptrace.h
deleted file mode 100644
index 82e674f6b337..000000000000
--- a/include/asm-generic/ptrace.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Common low level (register) ptrace helpers
- *
- * Copyright 2004-2011 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#ifndef __ASM_GENERIC_PTRACE_H__
-#define __ASM_GENERIC_PTRACE_H__
-
-#ifndef __ASSEMBLY__
-
-/* Helpers for working with the instruction pointer */
-#ifndef GET_IP
-#define GET_IP(regs) ((regs)->pc)
-#endif
-#ifndef SET_IP
-#define SET_IP(regs, val) (GET_IP(regs) = (val))
-#endif
-
-static inline unsigned long instruction_pointer(struct pt_regs *regs)
-{
-	return GET_IP(regs);
-}
-static inline void instruction_pointer_set(struct pt_regs *regs,
-                                           unsigned long val)
-{
-	SET_IP(regs, val);
-}
-
-#ifndef profile_pc
-#define profile_pc(regs) instruction_pointer(regs)
-#endif
-
-/* Helpers for working with the user stack pointer */
-#ifndef GET_USP
-#define GET_USP(regs) ((regs)->usp)
-#endif
-#ifndef SET_USP
-#define SET_USP(regs, val) (GET_USP(regs) = (val))
-#endif
-
-static inline unsigned long user_stack_pointer(struct pt_regs *regs)
-{
-	return GET_USP(regs);
-}
-static inline void user_stack_pointer_set(struct pt_regs *regs,
-                                          unsigned long val)
-{
-	SET_USP(regs, val);
-}
-
-/* Helpers for working with the frame pointer */
-#ifndef GET_FP
-#define GET_FP(regs) ((regs)->fp)
-#endif
-#ifndef SET_FP
-#define SET_FP(regs, val) (GET_FP(regs) = (val))
-#endif
-
-static inline unsigned long frame_pointer(struct pt_regs *regs)
-{
-	return GET_FP(regs);
-}
-static inline void frame_pointer_set(struct pt_regs *regs,
-                                     unsigned long val)
-{
-	SET_FP(regs, val);
-}
-
-#endif /* __ASSEMBLY__ */
-
-#endif
-- 
2.20.1


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

* Re: [PATCH 4/5] x86: don't use asm-generic/ptrace.h
  2019-05-20  6:00 ` [PATCH 4/5] x86: " Christoph Hellwig
@ 2019-05-20 16:02   ` Oleg Nesterov
  0 siblings, 0 replies; 14+ messages in thread
From: Oleg Nesterov @ 2019-05-20 16:02 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Arnd Bergmann, x86, linux-arm-kernel, linux-mips, linuxppc-dev,
	linux-sh, linux-arch, linux-kernel, Ingo Molnar

On 05/20, Christoph Hellwig wrote:
>
> Doing the indirection through macros for the regs accessors just
> makes them harder to read, so implement the helpers directly.

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


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

* Re: [PATCH 5/5] asm-generic: remove ptrace.h
  2019-05-20  6:00 ` [PATCH 5/5] asm-generic: remove ptrace.h Christoph Hellwig
@ 2019-05-20 16:03   ` Oleg Nesterov
  0 siblings, 0 replies; 14+ messages in thread
From: Oleg Nesterov @ 2019-05-20 16:03 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Arnd Bergmann, x86, linux-arm-kernel, linux-mips, linuxppc-dev,
	linux-sh, linux-arch, linux-kernel

On 05/20, Christoph Hellwig wrote:
>
> No one is using this header anymore.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  MAINTAINERS                    |  1 -
>  arch/mips/include/asm/ptrace.h |  5 ---
>  include/asm-generic/ptrace.h   | 74 ----------------------------------
>  3 files changed, 80 deletions(-)
>  delete mode 100644 include/asm-generic/ptrace.h

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


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

* Re: remove asm-generic/ptrace.h v2
  2019-05-20  6:00 remove asm-generic/ptrace.h v2 Christoph Hellwig
                   ` (4 preceding siblings ...)
  2019-05-20  6:00 ` [PATCH 5/5] asm-generic: remove ptrace.h Christoph Hellwig
@ 2019-06-04  7:02 ` Christoph Hellwig
  2019-06-14  7:49   ` Christoph Hellwig
  5 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2019-06-04  7:02 UTC (permalink / raw)
  To: Oleg Nesterov, Arnd Bergmann
  Cc: x86, linux-arm-kernel, linux-mips, linuxppc-dev, linux-sh,
	linux-arch, linux-kernel

Is anyone going to pick this series up?

On Mon, May 20, 2019 at 08:00:13AM +0200, Christoph Hellwig wrote:
> Hi all,
> 
> asm-generic/ptrace.h is a little weird in that it doesn't actually
> implement any functionality, but it provided multiple layers of macros
> that just implement trivial inline functions.  We implement those
> directly in the few architectures and be off with a much simpler
> design.
> 
> Changes since v1:
>  - add a missing empty line between functions
---end quoted text---

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

* Re: remove asm-generic/ptrace.h v2
  2019-06-04  7:02 ` remove asm-generic/ptrace.h v2 Christoph Hellwig
@ 2019-06-14  7:49   ` Christoph Hellwig
  0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2019-06-14  7:49 UTC (permalink / raw)
  To: Oleg Nesterov, Arnd Bergmann
  Cc: x86, linux-arm-kernel, linux-mips, linuxppc-dev, linux-sh,
	linux-arch, linux-kernel

On Tue, Jun 04, 2019 at 09:02:05AM +0200, Christoph Hellwig wrote:
> Is anyone going to pick this series up?

ping?  Arnd, this might be asm-generic tree material?

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

* Re: [PATCH 4/5] x86: don't use asm-generic/ptrace.h
  2019-06-24  5:47 ` [PATCH 4/5] x86: don't use asm-generic/ptrace.h Christoph Hellwig
@ 2019-06-24  7:22   ` Thomas Gleixner
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Gleixner @ 2019-06-24  7:22 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Oleg Nesterov, Arnd Bergmann, x86, linux-arm-kernel, linux-mips,
	linuxppc-dev, linux-sh, linux-arch, linux-kernel, Ingo Molnar

On Mon, 24 Jun 2019, Christoph Hellwig wrote:

> Doing the indirection through macros for the regs accessors just
> makes them harder to read, so implement the helpers directly.
> 
> Note that only the helpers actually used are implemented now.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Acked-by: Ingo Molnar <mingo@kernel.org>
> Acked-by: Oleg Nesterov <oleg@redhat.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

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

* [PATCH 4/5] x86: don't use asm-generic/ptrace.h
  2019-06-24  5:47 remove asm-generic/ptrace.h v3 Christoph Hellwig
@ 2019-06-24  5:47 ` Christoph Hellwig
  2019-06-24  7:22   ` Thomas Gleixner
  0 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2019-06-24  5:47 UTC (permalink / raw)
  To: Oleg Nesterov, Arnd Bergmann
  Cc: x86, linux-arm-kernel, linux-mips, linuxppc-dev, linux-sh,
	linux-arch, linux-kernel, Ingo Molnar

Doing the indirection through macros for the regs accessors just
makes them harder to read, so implement the helpers directly.

Note that only the helpers actually used are implemented now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>
---
 arch/x86/include/asm/ptrace.h | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 8a7fc0cca2d1..e22816e865ca 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -98,7 +98,6 @@ struct cpuinfo_x86;
 struct task_struct;
 
 extern unsigned long profile_pc(struct pt_regs *regs);
-#define profile_pc profile_pc
 
 extern unsigned long
 convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
@@ -175,11 +174,32 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
 }
 #endif
 
-#define GET_IP(regs) ((regs)->ip)
-#define GET_FP(regs) ((regs)->bp)
-#define GET_USP(regs) ((regs)->sp)
+static inline unsigned long instruction_pointer(struct pt_regs *regs)
+{
+	return regs->ip;
+}
+
+static inline void instruction_pointer_set(struct pt_regs *regs,
+		unsigned long val)
+{
+	regs->ip = val;
+}
+
+static inline unsigned long frame_pointer(struct pt_regs *regs)
+{
+	return regs->bp;
+}
 
-#include <asm-generic/ptrace.h>
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+	return regs->sp;
+}
+
+static inline void user_stack_pointer_set(struct pt_regs *regs,
+		unsigned long val)
+{
+	regs->sp = val;
+}
 
 /* Query offset/name of register from its name/offset */
 extern int regs_query_register_offset(const char *name);
-- 
2.20.1


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

* Re: [PATCH 4/5] x86: don't use asm-generic/ptrace.h
  2019-05-01 17:39 ` [PATCH 4/5] x86: don't use asm-generic/ptrace.h Christoph Hellwig
@ 2019-05-01 21:48   ` Ingo Molnar
  0 siblings, 0 replies; 14+ messages in thread
From: Ingo Molnar @ 2019-05-01 21:48 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Oleg Nesterov, Arnd Bergmann, x86, linux-arm-kernel, linux-mips,
	linuxppc-dev, linux-sh, linux-arch, linux-kernel


* Christoph Hellwig <hch@lst.de> wrote:

> Doing the indirection through macros for the regs accessors just
> makes them harder to read, so implement the helpers directly.
> 
> Note that only the helpers actually used are implemented now.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/x86/include/asm/ptrace.h | 29 ++++++++++++++++++++++++-----
>  1 file changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
> index 8a7fc0cca2d1..9b81ef539eb3 100644
> --- a/arch/x86/include/asm/ptrace.h
> +++ b/arch/x86/include/asm/ptrace.h
> @@ -98,7 +98,6 @@ struct cpuinfo_x86;
>  struct task_struct;
>  
>  extern unsigned long profile_pc(struct pt_regs *regs);
> -#define profile_pc profile_pc
>  
>  extern unsigned long
>  convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
> @@ -175,11 +174,31 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
>  }
>  #endif
>  
> -#define GET_IP(regs) ((regs)->ip)
> -#define GET_FP(regs) ((regs)->bp)
> -#define GET_USP(regs) ((regs)->sp)
> +static inline unsigned long instruction_pointer(struct pt_regs *regs)
> +{
> +	return regs->ip;
> +}
> +static inline void instruction_pointer_set(struct pt_regs *regs,

Nit: missing newline between inline functions.

> +		unsigned long val)
> +{
> +	regs->ip = val;
> +}
> +
> +static inline unsigned long frame_pointer(struct pt_regs *regs)
> +{
> +	return regs->bp;
> +}
>  
> -#include <asm-generic/ptrace.h>
> +static inline unsigned long user_stack_pointer(struct pt_regs *regs)
> +{
> +	return regs->sp;
> +}
> +
> +static inline void user_stack_pointer_set(struct pt_regs *regs,
> +		unsigned long val)
> +{
> +	regs->sp = val;
> +}

Other than that:

Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo

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

* [PATCH 4/5] x86: don't use asm-generic/ptrace.h
  2019-05-01 17:39 remove asm-generic/ptrace.h Christoph Hellwig
@ 2019-05-01 17:39 ` Christoph Hellwig
  2019-05-01 21:48   ` Ingo Molnar
  0 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2019-05-01 17:39 UTC (permalink / raw)
  To: Oleg Nesterov, Arnd Bergmann
  Cc: x86, linux-arm-kernel, linux-mips, linuxppc-dev, linux-sh,
	linux-arch, linux-kernel

Doing the indirection through macros for the regs accessors just
makes them harder to read, so implement the helpers directly.

Note that only the helpers actually used are implemented now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/x86/include/asm/ptrace.h | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 8a7fc0cca2d1..9b81ef539eb3 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -98,7 +98,6 @@ struct cpuinfo_x86;
 struct task_struct;
 
 extern unsigned long profile_pc(struct pt_regs *regs);
-#define profile_pc profile_pc
 
 extern unsigned long
 convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
@@ -175,11 +174,31 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
 }
 #endif
 
-#define GET_IP(regs) ((regs)->ip)
-#define GET_FP(regs) ((regs)->bp)
-#define GET_USP(regs) ((regs)->sp)
+static inline unsigned long instruction_pointer(struct pt_regs *regs)
+{
+	return regs->ip;
+}
+static inline void instruction_pointer_set(struct pt_regs *regs,
+		unsigned long val)
+{
+	regs->ip = val;
+}
+
+static inline unsigned long frame_pointer(struct pt_regs *regs)
+{
+	return regs->bp;
+}
 
-#include <asm-generic/ptrace.h>
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+	return regs->sp;
+}
+
+static inline void user_stack_pointer_set(struct pt_regs *regs,
+		unsigned long val)
+{
+	regs->sp = val;
+}
 
 /* Query offset/name of register from its name/offset */
 extern int regs_query_register_offset(const char *name);
-- 
2.20.1


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

end of thread, back to index

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20  6:00 remove asm-generic/ptrace.h v2 Christoph Hellwig
2019-05-20  6:00 ` [PATCH 1/5] arm64: don't use asm-generic/ptrace.h Christoph Hellwig
2019-05-20  6:00 ` [PATCH 2/5] powerpc: " Christoph Hellwig
2019-05-20  6:00 ` [PATCH 3/5] sh: " Christoph Hellwig
2019-05-20  6:00 ` [PATCH 4/5] x86: " Christoph Hellwig
2019-05-20 16:02   ` Oleg Nesterov
2019-05-20  6:00 ` [PATCH 5/5] asm-generic: remove ptrace.h Christoph Hellwig
2019-05-20 16:03   ` Oleg Nesterov
2019-06-04  7:02 ` remove asm-generic/ptrace.h v2 Christoph Hellwig
2019-06-14  7:49   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2019-06-24  5:47 remove asm-generic/ptrace.h v3 Christoph Hellwig
2019-06-24  5:47 ` [PATCH 4/5] x86: don't use asm-generic/ptrace.h Christoph Hellwig
2019-06-24  7:22   ` Thomas Gleixner
2019-05-01 17:39 remove asm-generic/ptrace.h Christoph Hellwig
2019-05-01 17:39 ` [PATCH 4/5] x86: don't use asm-generic/ptrace.h Christoph Hellwig
2019-05-01 21:48   ` Ingo Molnar

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org linux-mips@archiver.kernel.org
	public-inbox-index linux-mips


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/ public-inbox