diff options
author | Christoph Hellwig <hch@lst.de> | 2010-03-10 18:22:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:38 -0500 |
commit | dacbe41f776db0a5a9aee1e41594f405c95778a5 (patch) | |
tree | f6cb1436bd50a2572b7c5b44d44044be0e8005bd /arch | |
parent | b3c1e01a09d6af2dd7811a066ffcfc5171be2bed (diff) |
ptrace: move user_enable_single_step & co prototypes to linux/ptrace.h
While in theory user_enable_single_step/user_disable_single_step/
user_enable_blockstep could also be provided as an inline or macro there's
no good reason to do so, and having the prototype in one places keeps code
size and confusion down.
Roland said:
The original thought there was that user_enable_single_step() et al
might well be only an instruction or three on a sane machine (as if we
have any of those!), and since there is only one call site inlining
would be beneficial. But I agree that there is no strong reason to care
about inlining it.
As to the arch changes, there is only one thought I'd add to the
record. It was always my thinking that for an arch where
PTRACE_SINGLESTEP does text-modifying breakpoint insertion,
user_enable_single_step() should not be provided. That is,
arch_has_single_step()=>true means that there is an arch facility with
"pure" semantics that does not have any unexpected side effects.
Inserting a breakpoint might do very unexpected strange things in
multi-threaded situations. Aside from that, it is a peculiar side
effect that user_{enable,disable}_single_step() should cause COW
de-sharing of text pages and so forth. For PTRACE_SINGLESTEP, all these
peculiarities are the status quo ante for that arch, so having
arch_ptrace() itself do those is one thing. But for building other
things in the future, it is nicer to have a uniform "pure" semantics
that arch-independent code can expect.
OTOH, all such arch issues are really up to the arch maintainer. As
of today, there is nothing but ptrace using user_enable_single_step() et
al so it's a distinction without a practical difference. If/when there
are other facilities that use user_enable_single_step() and might care,
the affected arch's can revisit the question when someone cares about
the quality of the arch support for said new facility.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/frv/include/asm/ptrace.h | 2 | ||||
-rw-r--r-- | arch/ia64/include/asm/ptrace.h | 4 | ||||
-rw-r--r-- | arch/m68k/include/asm/ptrace.h | 8 | ||||
-rw-r--r-- | arch/mn10300/include/asm/ptrace.h | 2 | ||||
-rw-r--r-- | arch/parisc/include/asm/ptrace.h | 5 | ||||
-rw-r--r-- | arch/powerpc/include/asm/ptrace.h | 7 | ||||
-rw-r--r-- | arch/s390/include/asm/ptrace.h | 3 | ||||
-rw-r--r-- | arch/score/include/asm/ptrace.h | 3 | ||||
-rw-r--r-- | arch/sh/include/asm/ptrace.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/ptrace.h | 7 |
10 files changed, 1 insertions, 42 deletions
diff --git a/arch/frv/include/asm/ptrace.h b/arch/frv/include/asm/ptrace.h index a54b535c9e49..6bfad4cf1907 100644 --- a/arch/frv/include/asm/ptrace.h +++ b/arch/frv/include/asm/ptrace.h | |||
@@ -84,8 +84,6 @@ extern void show_regs(struct pt_regs *); | |||
84 | #define task_pt_regs(task) ((task)->thread.frame0) | 84 | #define task_pt_regs(task) ((task)->thread.frame0) |
85 | 85 | ||
86 | #define arch_has_single_step() (1) | 86 | #define arch_has_single_step() (1) |
87 | extern void user_enable_single_step(struct task_struct *); | ||
88 | extern void user_disable_single_step(struct task_struct *); | ||
89 | 87 | ||
90 | #endif /* !__ASSEMBLY__ */ | 88 | #endif /* !__ASSEMBLY__ */ |
91 | #endif /* __KERNEL__ */ | 89 | #endif /* __KERNEL__ */ |
diff --git a/arch/ia64/include/asm/ptrace.h b/arch/ia64/include/asm/ptrace.h index 14055c636adf..7ae9c3f15a1c 100644 --- a/arch/ia64/include/asm/ptrace.h +++ b/arch/ia64/include/asm/ptrace.h | |||
@@ -319,11 +319,7 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs) | |||
319 | ptrace_attach_sync_user_rbs(child) | 319 | ptrace_attach_sync_user_rbs(child) |
320 | 320 | ||
321 | #define arch_has_single_step() (1) | 321 | #define arch_has_single_step() (1) |
322 | extern void user_enable_single_step(struct task_struct *); | ||
323 | extern void user_disable_single_step(struct task_struct *); | ||
324 | |||
325 | #define arch_has_block_step() (1) | 322 | #define arch_has_block_step() (1) |
326 | extern void user_enable_block_step(struct task_struct *); | ||
327 | 323 | ||
328 | #endif /* !__KERNEL__ */ | 324 | #endif /* !__KERNEL__ */ |
329 | 325 | ||
diff --git a/arch/m68k/include/asm/ptrace.h b/arch/m68k/include/asm/ptrace.h index 21605c736f69..6e6e3ac1d913 100644 --- a/arch/m68k/include/asm/ptrace.h +++ b/arch/m68k/include/asm/ptrace.h | |||
@@ -87,18 +87,10 @@ struct switch_stack { | |||
87 | #define profile_pc(regs) instruction_pointer(regs) | 87 | #define profile_pc(regs) instruction_pointer(regs) |
88 | extern void show_regs(struct pt_regs *); | 88 | extern void show_regs(struct pt_regs *); |
89 | 89 | ||
90 | /* | ||
91 | * These are defined as per linux/ptrace.h. | ||
92 | */ | ||
93 | struct task_struct; | ||
94 | |||
95 | #define arch_has_single_step() (1) | 90 | #define arch_has_single_step() (1) |
96 | extern void user_enable_single_step(struct task_struct *); | ||
97 | extern void user_disable_single_step(struct task_struct *); | ||
98 | 91 | ||
99 | #ifdef CONFIG_MMU | 92 | #ifdef CONFIG_MMU |
100 | #define arch_has_block_step() (1) | 93 | #define arch_has_block_step() (1) |
101 | extern void user_enable_block_step(struct task_struct *); | ||
102 | #endif | 94 | #endif |
103 | 95 | ||
104 | #endif /* __KERNEL__ */ | 96 | #endif /* __KERNEL__ */ |
diff --git a/arch/mn10300/include/asm/ptrace.h b/arch/mn10300/include/asm/ptrace.h index 1b0ba5e182b0..7c2e911052b6 100644 --- a/arch/mn10300/include/asm/ptrace.h +++ b/arch/mn10300/include/asm/ptrace.h | |||
@@ -99,8 +99,6 @@ struct task_struct; | |||
99 | extern void show_regs(struct pt_regs *); | 99 | extern void show_regs(struct pt_regs *); |
100 | 100 | ||
101 | #define arch_has_single_step() (1) | 101 | #define arch_has_single_step() (1) |
102 | extern void user_enable_single_step(struct task_struct *); | ||
103 | extern void user_disable_single_step(struct task_struct *); | ||
104 | 102 | ||
105 | #endif /* !__ASSEMBLY */ | 103 | #endif /* !__ASSEMBLY */ |
106 | 104 | ||
diff --git a/arch/parisc/include/asm/ptrace.h b/arch/parisc/include/asm/ptrace.h index aead40b16dd8..7f09533da771 100644 --- a/arch/parisc/include/asm/ptrace.h +++ b/arch/parisc/include/asm/ptrace.h | |||
@@ -47,13 +47,8 @@ struct pt_regs { | |||
47 | 47 | ||
48 | #define task_regs(task) ((struct pt_regs *) ((char *)(task) + TASK_REGS)) | 48 | #define task_regs(task) ((struct pt_regs *) ((char *)(task) + TASK_REGS)) |
49 | 49 | ||
50 | struct task_struct; | ||
51 | #define arch_has_single_step() 1 | 50 | #define arch_has_single_step() 1 |
52 | void user_disable_single_step(struct task_struct *task); | ||
53 | void user_enable_single_step(struct task_struct *task); | ||
54 | |||
55 | #define arch_has_block_step() 1 | 51 | #define arch_has_block_step() 1 |
56 | void user_enable_block_step(struct task_struct *task); | ||
57 | 52 | ||
58 | /* XXX should we use iaoq[1] or iaoq[0] ? */ | 53 | /* XXX should we use iaoq[1] or iaoq[0] ? */ |
59 | #define user_mode(regs) (((regs)->iaoq[0] & 3) ? 1 : 0) | 54 | #define user_mode(regs) (((regs)->iaoq[0] & 3) ? 1 : 0) |
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index b45108126562..9e2d84c06b74 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h | |||
@@ -137,15 +137,8 @@ do { \ | |||
137 | } while (0) | 137 | } while (0) |
138 | #endif /* __powerpc64__ */ | 138 | #endif /* __powerpc64__ */ |
139 | 139 | ||
140 | /* | ||
141 | * These are defined as per linux/ptrace.h, which see. | ||
142 | */ | ||
143 | #define arch_has_single_step() (1) | 140 | #define arch_has_single_step() (1) |
144 | #define arch_has_block_step() (!cpu_has_feature(CPU_FTR_601)) | 141 | #define arch_has_block_step() (!cpu_has_feature(CPU_FTR_601)) |
145 | extern void user_enable_single_step(struct task_struct *); | ||
146 | extern void user_enable_block_step(struct task_struct *); | ||
147 | extern void user_disable_single_step(struct task_struct *); | ||
148 | |||
149 | #define ARCH_HAS_USER_SINGLE_STEP_INFO | 142 | #define ARCH_HAS_USER_SINGLE_STEP_INFO |
150 | 143 | ||
151 | #endif /* __ASSEMBLY__ */ | 144 | #endif /* __ASSEMBLY__ */ |
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h index dd2d913afcae..fef9b33cdd59 100644 --- a/arch/s390/include/asm/ptrace.h +++ b/arch/s390/include/asm/ptrace.h | |||
@@ -489,9 +489,6 @@ struct user_regs_struct | |||
489 | * These are defined as per linux/ptrace.h, which see. | 489 | * These are defined as per linux/ptrace.h, which see. |
490 | */ | 490 | */ |
491 | #define arch_has_single_step() (1) | 491 | #define arch_has_single_step() (1) |
492 | struct task_struct; | ||
493 | extern void user_enable_single_step(struct task_struct *); | ||
494 | extern void user_disable_single_step(struct task_struct *); | ||
495 | extern void show_regs(struct pt_regs * regs); | 492 | extern void show_regs(struct pt_regs * regs); |
496 | 493 | ||
497 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) | 494 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) |
diff --git a/arch/score/include/asm/ptrace.h b/arch/score/include/asm/ptrace.h index d40e691f23e2..e89dc9b1ef49 100644 --- a/arch/score/include/asm/ptrace.h +++ b/arch/score/include/asm/ptrace.h | |||
@@ -90,8 +90,7 @@ extern int read_tsk_short(struct task_struct *, unsigned long, | |||
90 | unsigned short *); | 90 | unsigned short *); |
91 | 91 | ||
92 | #define arch_has_single_step() (1) | 92 | #define arch_has_single_step() (1) |
93 | extern void user_enable_single_step(struct task_struct *); | 93 | |
94 | extern void user_disable_single_step(struct task_struct *); | ||
95 | #endif /* __KERNEL__ */ | 94 | #endif /* __KERNEL__ */ |
96 | 95 | ||
97 | #endif /* _ASM_SCORE_PTRACE_H */ | 96 | #endif /* _ASM_SCORE_PTRACE_H */ |
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h index e11b14ea2c43..2168fde25611 100644 --- a/arch/sh/include/asm/ptrace.h +++ b/arch/sh/include/asm/ptrace.h | |||
@@ -123,8 +123,6 @@ extern void show_regs(struct pt_regs *); | |||
123 | struct task_struct; | 123 | struct task_struct; |
124 | 124 | ||
125 | #define arch_has_single_step() (1) | 125 | #define arch_has_single_step() (1) |
126 | extern void user_enable_single_step(struct task_struct *); | ||
127 | extern void user_disable_single_step(struct task_struct *); | ||
128 | 126 | ||
129 | struct perf_event; | 127 | struct perf_event; |
130 | struct perf_sample_data; | 128 | struct perf_sample_data; |
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h index 20102808b191..69a686a7dff0 100644 --- a/arch/x86/include/asm/ptrace.h +++ b/arch/x86/include/asm/ptrace.h | |||
@@ -274,14 +274,7 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, | |||
274 | return 0; | 274 | return 0; |
275 | } | 275 | } |
276 | 276 | ||
277 | /* | ||
278 | * These are defined as per linux/ptrace.h, which see. | ||
279 | */ | ||
280 | #define arch_has_single_step() (1) | 277 | #define arch_has_single_step() (1) |
281 | extern void user_enable_single_step(struct task_struct *); | ||
282 | extern void user_disable_single_step(struct task_struct *); | ||
283 | |||
284 | extern void user_enable_block_step(struct task_struct *); | ||
285 | #ifdef CONFIG_X86_DEBUGCTLMSR | 278 | #ifdef CONFIG_X86_DEBUGCTLMSR |
286 | #define arch_has_block_step() (1) | 279 | #define arch_has_block_step() (1) |
287 | #else | 280 | #else |