Re: [RFC PATCH] ptrace: make ptrace() fail if the tracee changed its pid unexpectedly

2020-12-19 Thread Simon Marchi
On 2020-12-19 2:33 p.m., Oleg Nesterov wrote:
> OOPS! Sorry Simon, yes I forgot to add reported-by. Andrew, or Eric, if
> you take this patch, could you also add
> 
>   Reported-by: Simon Marchi 

I tried the original reproducer on a patched kernel, and it looks good.
GDB's behavior is still not super clean when this situation happens: a
PTRACE_GETREGS on the (disappeared) leader now fails with ESRCH (that's
what we want), and that interrupts the "continue" command and
unexpectedly brings back the prompt while leaving the other thread
running.  But that is all logic that will have to be fixed inside GDB.

So, feel free to add

  Acked-by: Simon Marchi 

too.

Thanks!

Simon


Re: Possible race between PTRACE_SETVFPREGS and PTRACE_CONT on ARM?

2016-06-02 Thread Simon Marchi
On 16-06-02 09:15 AM, Russell King - ARM Linux wrote:
> Hi, can I add a:
> 
> Tested-by: Simon Marchi <simon.mar...@ericsson.com>
> 
> tag to the commit please?

Yes, of course.





Re: Possible race between PTRACE_SETVFPREGS and PTRACE_CONT on ARM?

2016-06-02 Thread Simon Marchi
On 16-06-02 09:15 AM, Russell King - ARM Linux wrote:
> Hi, can I add a:
> 
> Tested-by: Simon Marchi 
> 
> tag to the commit please?

Yes, of course.





Re: Possible race between PTRACE_SETVFPREGS and PTRACE_CONT on ARM?

2016-06-01 Thread Simon Marchi
On 16-05-30 05:35 PM, Russell King - ARM Linux wrote:
> So, the gdb verisons I have here seem to be particularly poor - but with
> some modifications, I can test out on iMX6 by forcing gdb to do the right
> thing - by inserting a couple of "mov r0, r0" instructions after the
> "break_here" label.

I see that problem too with older versions, bisecting shows it has been fixed
in commit

  6e22494e5076 Do not skip prologue for asm (.S) files

in gdb, which is included in gdb 7.10 and up.

> With that, on a single CPU, it seems to work correctly every time, but
> if I bring up a secondary CPU I start seeing the same problems you've
> reported - which seems to need the following patch to solve.  Please can
> you check whether this resolves your problem?

Yes that fixes the problem, the test case succeeds every time.  I have stared
at those lines in ptrace.c for some time, but couldn't find the problem.  Thanks
for looking into it!


Re: Possible race between PTRACE_SETVFPREGS and PTRACE_CONT on ARM?

2016-06-01 Thread Simon Marchi
On 16-05-30 05:35 PM, Russell King - ARM Linux wrote:
> So, the gdb verisons I have here seem to be particularly poor - but with
> some modifications, I can test out on iMX6 by forcing gdb to do the right
> thing - by inserting a couple of "mov r0, r0" instructions after the
> "break_here" label.

I see that problem too with older versions, bisecting shows it has been fixed
in commit

  6e22494e5076 Do not skip prologue for asm (.S) files

in gdb, which is included in gdb 7.10 and up.

> With that, on a single CPU, it seems to work correctly every time, but
> if I bring up a secondary CPU I start seeing the same problems you've
> reported - which seems to need the following patch to solve.  Please can
> you check whether this resolves your problem?

Yes that fixes the problem, the test case succeeds every time.  I have stared
at those lines in ptrace.c for some time, but couldn't find the problem.  Thanks
for looking into it!


Possible race between PTRACE_SETVFPREGS and PTRACE_CONT on ARM?

2016-05-30 Thread Simon Marchi
Hello knowledgeable ARM people!

(Background: https://sourceware.org/ml/gdb/2016-05/msg00020.html )

Debugging a flaky GDB test case on ARM lead me to think there might
be race between PTRACE_SETVFPREGS and PTRACE_CONT on ARM
(PTRACE_SETVFPREGS is ARM-specific anyway).  The test case (and the
reproducer below) changes the value of a VFP register (let's say d0)
using PTRACE_SETVFPREGS and resumes the thread with PTRACE_CONT.  It
happens intermittently that the thread resumes execution with the
old value in d0 instead of the new one.

Here is a minimal reproducing example.

test.S:

  .global _start
  _start:
  vldr.64 d0, constant
  vldr.64 d1, constant

  break_here:
  vcmp.f64 d0, d1
  vmrs APSR_nzcv, fpscr

  # Exit code
  moveq r0, #1
  movne r0, #0

  # Exit syscall
  mov r7, #1
  svc 0

  .align 8
  constant:
  .word 0xc8b43958
  .word 0x40594676

Built with:

  $ gcc -g3 -O0 -o test test.S -nostdlib

And the gdb script, test.gdb:

  file test
  b break_here
  run
  p $d0 = 4.0
  c

The test is ran with

  $ ./gdb -nx -x test.gdb -batch

The test loads the same constant in d0 and d1.  It then does a comparison 
between
them and exits with 1 (failure) if they are the same, 0 (success) if they are 
different.
The GDB script breaks at "break_here", tries to change the value of d0 to some 
other
constant (4.0) and lets the program continue and exit.  If our register write 
succeeded,
the program should exit with 0 (values are different).  If our register write 
failed, the
program will exit with 1 (values are still the same).

The result is that I randomly see both cases, hinting to a race between the 
register write
and the time where the kernel restores the thread's vfp registers.  Note that 
when GDB's
affinity is pinned to a single core, I do not see the failure.  Also, note that 
when I
remove the vldr.64 instructions, I can't seem to reproduce the problem, so it 
looks
like they are somehow important.

I see this behavior on 3 different boards:

- ODroid XU-4, kernel 3.10.96
- Firefly RK3288, kernel 3.10.0
- Raspberry Pi 2, kernel 4.4.8

Any ideas about this problem?

Thanks,

Simon


Possible race between PTRACE_SETVFPREGS and PTRACE_CONT on ARM?

2016-05-30 Thread Simon Marchi
Hello knowledgeable ARM people!

(Background: https://sourceware.org/ml/gdb/2016-05/msg00020.html )

Debugging a flaky GDB test case on ARM lead me to think there might
be race between PTRACE_SETVFPREGS and PTRACE_CONT on ARM
(PTRACE_SETVFPREGS is ARM-specific anyway).  The test case (and the
reproducer below) changes the value of a VFP register (let's say d0)
using PTRACE_SETVFPREGS and resumes the thread with PTRACE_CONT.  It
happens intermittently that the thread resumes execution with the
old value in d0 instead of the new one.

Here is a minimal reproducing example.

test.S:

  .global _start
  _start:
  vldr.64 d0, constant
  vldr.64 d1, constant

  break_here:
  vcmp.f64 d0, d1
  vmrs APSR_nzcv, fpscr

  # Exit code
  moveq r0, #1
  movne r0, #0

  # Exit syscall
  mov r7, #1
  svc 0

  .align 8
  constant:
  .word 0xc8b43958
  .word 0x40594676

Built with:

  $ gcc -g3 -O0 -o test test.S -nostdlib

And the gdb script, test.gdb:

  file test
  b break_here
  run
  p $d0 = 4.0
  c

The test is ran with

  $ ./gdb -nx -x test.gdb -batch

The test loads the same constant in d0 and d1.  It then does a comparison 
between
them and exits with 1 (failure) if they are the same, 0 (success) if they are 
different.
The GDB script breaks at "break_here", tries to change the value of d0 to some 
other
constant (4.0) and lets the program continue and exit.  If our register write 
succeeded,
the program should exit with 0 (values are different).  If our register write 
failed, the
program will exit with 1 (values are still the same).

The result is that I randomly see both cases, hinting to a race between the 
register write
and the time where the kernel restores the thread's vfp registers.  Note that 
when GDB's
affinity is pinned to a single core, I do not see the failure.  Also, note that 
when I
remove the vldr.64 instructions, I can't seem to reproduce the problem, so it 
looks
like they are somehow important.

I see this behavior on 3 different boards:

- ODroid XU-4, kernel 3.10.96
- Firefly RK3288, kernel 3.10.0
- Raspberry Pi 2, kernel 4.4.8

Any ideas about this problem?

Thanks,

Simon


[PATCH] arch/tile: Fix syscall return value passed to tracepoint

2013-04-17 Thread Simon Marchi
Currently the syscall number is passed, but it should be the return
value, which is kept in r0.

Signed-off-by: Simon Marchi 
---
This patch applies on Chris Metcalf's tree:
  http://git.kernel.org/cgit/linux/kernel/git/cmetcalf/linux-tile.git

arch/tile/include/uapi/arch/abi.h |2 ++
 arch/tile/kernel/ptrace.c |2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/tile/include/uapi/arch/abi.h 
b/arch/tile/include/uapi/arch/abi.h
index c55a3d4..400401b 100644
--- a/arch/tile/include/uapi/arch/abi.h
+++ b/arch/tile/include/uapi/arch/abi.h
@@ -119,6 +119,8 @@ typedef __int_reg_t int_reg_t;
 /** Name of register that holds the syscall number, for use in assembly. */
 #define TREG_SYSCALL_NR_NAME r10
 
+/** Register that holds the return value for system calls. */
+#define TREG_SYSCALL_RET_NR  0
 
 /**
  * The ABI requires callers to allocate a caller state save area of
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 363b2dd..91fd3af 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -269,7 +269,7 @@ void do_syscall_trace_exit(struct pt_regs *regs)
tracehook_report_syscall_exit(regs, 0);
 
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
-   trace_sys_exit(regs, regs->regs[TREG_SYSCALL_NR]);
+   trace_sys_exit(regs, regs->regs[TREG_SYSCALL_RET_NR]);
 }
 
 void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int 
error_code)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] arch/tile: Fix syscall return value passed to tracepoint

2013-04-17 Thread Simon Marchi
Currently the syscall number is passed, but it should be the return
value, which is kept in r0.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
This patch applies on Chris Metcalf's tree:
  http://git.kernel.org/cgit/linux/kernel/git/cmetcalf/linux-tile.git

arch/tile/include/uapi/arch/abi.h |2 ++
 arch/tile/kernel/ptrace.c |2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/tile/include/uapi/arch/abi.h 
b/arch/tile/include/uapi/arch/abi.h
index c55a3d4..400401b 100644
--- a/arch/tile/include/uapi/arch/abi.h
+++ b/arch/tile/include/uapi/arch/abi.h
@@ -119,6 +119,8 @@ typedef __int_reg_t int_reg_t;
 /** Name of register that holds the syscall number, for use in assembly. */
 #define TREG_SYSCALL_NR_NAME r10
 
+/** Register that holds the return value for system calls. */
+#define TREG_SYSCALL_RET_NR  0
 
 /**
  * The ABI requires callers to allocate a caller state save area of
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 363b2dd..91fd3af 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -269,7 +269,7 @@ void do_syscall_trace_exit(struct pt_regs *regs)
tracehook_report_syscall_exit(regs, 0);
 
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
-   trace_sys_exit(regs, regs-regs[TREG_SYSCALL_NR]);
+   trace_sys_exit(regs, regs-regs[TREG_SYSCALL_RET_NR]);
 }
 
 void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int 
error_code)
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] tile: move declaration of sys_call_table to

2013-01-21 Thread Simon Marchi
When activating syscall tracing, kernel/trace/trace_syscalls.c doesn't
find sys_call_table because it includes , not
. Also, looking at the other architectures, that is
probably where it should be.

Signed-off-by: Simon Marchi 
---
 arch/tile/include/asm/syscall.h  |6 ++
 arch/tile/include/asm/syscalls.h |6 --
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/tile/include/asm/syscall.h b/arch/tile/include/asm/syscall.h
index d35e0dc..9644b88 100644
--- a/arch/tile/include/asm/syscall.h
+++ b/arch/tile/include/asm/syscall.h
@@ -22,6 +22,12 @@
 #include 
 #include 
 
+/* The array of function pointers for syscalls. */
+extern void *sys_call_table[];
+#ifdef CONFIG_COMPAT
+extern void *compat_sys_call_table[];
+#endif
+
 /*
  * Only the low 32 bits of orig_r0 are meaningful, so we return int.
  * This importantly ignores the high bits on 64-bit, so comparisons
diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h
index 4c8462a..3b18317 100644
--- a/arch/tile/include/asm/syscalls.h
+++ b/arch/tile/include/asm/syscalls.h
@@ -24,12 +24,6 @@
 #include 
 #include 
 
-/* The array of function pointers for syscalls. */
-extern void *sys_call_table[];
-#ifdef CONFIG_COMPAT
-extern void *compat_sys_call_table[];
-#endif
-
 /*
  * Note that by convention, any syscall which requires the current
  * register set takes an additional "struct pt_regs *" pointer; a
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] tile: Add support for TIF_SYSCALL_TRACEPOINT

2013-01-21 Thread Simon Marchi
This patch adds support for the TIF_SYSCALL_TRACEPOINT on the tile
architecture. Basically, it calls the appropriate tracepoints on syscall
entry and exit.

Signed-off-by: Simon Marchi 
---
 arch/tile/include/asm/thread_info.h |8 
 arch/tile/kernel/intvec_64.S|   14 ++
 arch/tile/kernel/ptrace.c   |   17 ++---
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/arch/tile/include/asm/thread_info.h 
b/arch/tile/include/asm/thread_info.h
index e9c670d..c96331e 100644
--- a/arch/tile/include/asm/thread_info.h
+++ b/arch/tile/include/asm/thread_info.h
@@ -124,6 +124,7 @@ extern void _cpu_idle(void);
 #define TIF_SECCOMP6   /* secure computing */
 #define TIF_MEMDIE 7   /* OOM killer at work */
 #define TIF_NOTIFY_RESUME  8   /* callback before returning to user */
+#define TIF_SYSCALL_TRACEPOINT 9   /* syscall tracepoint instrumentation */
 
 #define _TIF_SIGPENDING(1<
 #include 
 
+#define CREATE_TRACE_POINTS
+#include 
+
 void user_enable_single_step(struct task_struct *child)
 {
set_tsk_thread_flag(child, TIF_SINGLESTEP);
@@ -249,16 +252,24 @@ long compat_arch_ptrace(struct task_struct *child, 
compat_long_t request,
 
 int do_syscall_trace_enter(struct pt_regs *regs)
 {
-   if (tracehook_report_syscall_entry(regs)) {
-   regs->regs[TREG_SYSCALL_NR] = -1;
+   if (test_thread_flag(TIF_SYSCALL_TRACE)) {
+   if (tracehook_report_syscall_entry(regs))
+   regs->regs[TREG_SYSCALL_NR] = -1;
}
 
+   if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
+   trace_sys_enter(regs, regs->regs[TREG_SYSCALL_NR]);
+
return regs->regs[TREG_SYSCALL_NR];
 }
 
 void do_syscall_trace_exit(struct pt_regs *regs)
 {
-   tracehook_report_syscall_exit(regs, 0);
+   if (test_thread_flag(TIF_SYSCALL_TRACE))
+   tracehook_report_syscall_exit(regs, 0);
+
+   if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
+   trace_sys_exit(regs, regs->regs[TREG_SYSCALL_NR]);
 }
 
 void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int 
error_code)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] tile: select HAVE_SYSCALL_TRACEPOINTS

2013-01-21 Thread Simon Marchi
Signed-off-by: Simon Marchi 
---
 arch/tile/Kconfig |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 8cab409..1adb853 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -22,6 +22,7 @@ config TILE
select GENERIC_CLOCKEVENTS
select MODULES_USE_ELF_RELA
select HAVE_ARCH_TRACEHOOK
+   select HAVE_SYSCALL_TRACEPOINTS
 
 # FIXME: investigate whether we need/want these options.
 #  select HAVE_IOREMAP_PROT
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] tile: Add definition of NR_syscalls

2013-01-21 Thread Simon Marchi
It is required by the syscall tracepoint mechanism.

Signed-off-by: Simon Marchi 
---
 arch/tile/include/uapi/asm/unistd.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/uapi/asm/unistd.h 
b/arch/tile/include/uapi/asm/unistd.h
index cd7b6dd..c763c86 100644
--- a/arch/tile/include/uapi/asm/unistd.h
+++ b/arch/tile/include/uapi/asm/unistd.h
@@ -20,6 +20,8 @@
 /* Use the standard ABI for syscalls. */
 #include 
 
+#define NR_syscalls (__NR_syscalls)
+
 /* Additional Tilera-specific syscalls. */
 #define __NR_cacheflush(__NR_arch_specific_syscall + 1)
 __SYSCALL(__NR_cacheflush, sys_cacheflush)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] tile: Add definition of NR_syscalls

2013-01-21 Thread Simon Marchi
It is required by the syscall tracepoint mechanism.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/include/uapi/asm/unistd.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/uapi/asm/unistd.h 
b/arch/tile/include/uapi/asm/unistd.h
index cd7b6dd..c763c86 100644
--- a/arch/tile/include/uapi/asm/unistd.h
+++ b/arch/tile/include/uapi/asm/unistd.h
@@ -20,6 +20,8 @@
 /* Use the standard ABI for syscalls. */
 #include asm-generic/unistd.h
 
+#define NR_syscalls (__NR_syscalls)
+
 /* Additional Tilera-specific syscalls. */
 #define __NR_cacheflush(__NR_arch_specific_syscall + 1)
 __SYSCALL(__NR_cacheflush, sys_cacheflush)
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] tile: select HAVE_SYSCALL_TRACEPOINTS

2013-01-21 Thread Simon Marchi
Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/Kconfig |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 8cab409..1adb853 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -22,6 +22,7 @@ config TILE
select GENERIC_CLOCKEVENTS
select MODULES_USE_ELF_RELA
select HAVE_ARCH_TRACEHOOK
+   select HAVE_SYSCALL_TRACEPOINTS
 
 # FIXME: investigate whether we need/want these options.
 #  select HAVE_IOREMAP_PROT
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] tile: move declaration of sys_call_table to asm/syscall.h

2013-01-21 Thread Simon Marchi
When activating syscall tracing, kernel/trace/trace_syscalls.c doesn't
find sys_call_table because it includes asm/syscall.h, not
asm/syscalls.h. Also, looking at the other architectures, that is
probably where it should be.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/include/asm/syscall.h  |6 ++
 arch/tile/include/asm/syscalls.h |6 --
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/tile/include/asm/syscall.h b/arch/tile/include/asm/syscall.h
index d35e0dc..9644b88 100644
--- a/arch/tile/include/asm/syscall.h
+++ b/arch/tile/include/asm/syscall.h
@@ -22,6 +22,12 @@
 #include linux/err.h
 #include arch/abi.h
 
+/* The array of function pointers for syscalls. */
+extern void *sys_call_table[];
+#ifdef CONFIG_COMPAT
+extern void *compat_sys_call_table[];
+#endif
+
 /*
  * Only the low 32 bits of orig_r0 are meaningful, so we return int.
  * This importantly ignores the high bits on 64-bit, so comparisons
diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h
index 4c8462a..3b18317 100644
--- a/arch/tile/include/asm/syscalls.h
+++ b/arch/tile/include/asm/syscalls.h
@@ -24,12 +24,6 @@
 #include linux/types.h
 #include linux/compat.h
 
-/* The array of function pointers for syscalls. */
-extern void *sys_call_table[];
-#ifdef CONFIG_COMPAT
-extern void *compat_sys_call_table[];
-#endif
-
 /*
  * Note that by convention, any syscall which requires the current
  * register set takes an additional struct pt_regs * pointer; a
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] tile: Add support for TIF_SYSCALL_TRACEPOINT

2013-01-21 Thread Simon Marchi
This patch adds support for the TIF_SYSCALL_TRACEPOINT on the tile
architecture. Basically, it calls the appropriate tracepoints on syscall
entry and exit.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/include/asm/thread_info.h |8 
 arch/tile/kernel/intvec_64.S|   14 ++
 arch/tile/kernel/ptrace.c   |   17 ++---
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/arch/tile/include/asm/thread_info.h 
b/arch/tile/include/asm/thread_info.h
index e9c670d..c96331e 100644
--- a/arch/tile/include/asm/thread_info.h
+++ b/arch/tile/include/asm/thread_info.h
@@ -124,6 +124,7 @@ extern void _cpu_idle(void);
 #define TIF_SECCOMP6   /* secure computing */
 #define TIF_MEMDIE 7   /* OOM killer at work */
 #define TIF_NOTIFY_RESUME  8   /* callback before returning to user */
+#define TIF_SYSCALL_TRACEPOINT 9   /* syscall tracepoint instrumentation */
 
 #define _TIF_SIGPENDING(1TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED  (1TIF_NEED_RESCHED)
@@ -134,12 +135,19 @@ extern void _cpu_idle(void);
 #define _TIF_SECCOMP   (1TIF_SECCOMP)
 #define _TIF_MEMDIE(1TIF_MEMDIE)
 #define _TIF_NOTIFY_RESUME (1TIF_NOTIFY_RESUME)
+#define _TIF_SYSCALL_TRACEPOINT(1TIF_SYSCALL_TRACEPOINT)
 
 /* Work to do on any return to user space. */
 #define _TIF_ALLWORK_MASK \
   (_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SINGLESTEP|\
_TIF_ASYNC_TLB|_TIF_NOTIFY_RESUME)
 
+/* Work to do at syscall entry. */
+#define _TIF_SYSCALL_ENTRY_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT)
+
+/* Work to do at syscall exit. */
+#define _TIF_SYSCALL_EXIT_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT)
+
 /*
  * Thread-synchronous status.
  *
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index fd78cd4..505e6d4 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -1000,8 +1000,11 @@ handle_syscall:
 
/* Trace syscalls, if requested. */
addir31, r31, THREAD_INFO_FLAGS_OFFSET
-   ld  r30, r31
-   andir30, r30, _TIF_SYSCALL_TRACE
+   {
+ld r30, r31
+moveli r32, _TIF_SYSCALL_ENTRY_WORK
+   }
+   and r30, r30, r32
{
 addi   r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET
 beqzt  r30, .Lrestore_syscall_regs
@@ -1070,8 +1073,11 @@ handle_syscall:
FEEDBACK_REENTER(handle_syscall)
 
/* Do syscall trace again, if requested. */
-   ld  r30, r31
-   andir0, r30, _TIF_SYSCALL_TRACE
+   {
+ld  r30, r31
+moveli  r32, _TIF_SYSCALL_EXIT_WORK
+   }
+   and  r0, r30, r32
{
 andir0, r30, _TIF_SINGLESTEP
 beqzt   r0, 1f
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 0ab8b76..363b2dd 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -25,6 +25,9 @@
 #include asm/traps.h
 #include arch/chip.h
 
+#define CREATE_TRACE_POINTS
+#include trace/events/syscalls.h
+
 void user_enable_single_step(struct task_struct *child)
 {
set_tsk_thread_flag(child, TIF_SINGLESTEP);
@@ -249,16 +252,24 @@ long compat_arch_ptrace(struct task_struct *child, 
compat_long_t request,
 
 int do_syscall_trace_enter(struct pt_regs *regs)
 {
-   if (tracehook_report_syscall_entry(regs)) {
-   regs-regs[TREG_SYSCALL_NR] = -1;
+   if (test_thread_flag(TIF_SYSCALL_TRACE)) {
+   if (tracehook_report_syscall_entry(regs))
+   regs-regs[TREG_SYSCALL_NR] = -1;
}
 
+   if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
+   trace_sys_enter(regs, regs-regs[TREG_SYSCALL_NR]);
+
return regs-regs[TREG_SYSCALL_NR];
 }
 
 void do_syscall_trace_exit(struct pt_regs *regs)
 {
-   tracehook_report_syscall_exit(regs, 0);
+   if (test_thread_flag(TIF_SYSCALL_TRACE))
+   tracehook_report_syscall_exit(regs, 0);
+
+   if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
+   trace_sys_exit(regs, regs-regs[TREG_SYSCALL_NR]);
 }
 
 void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int 
error_code)
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] arch/tile: Enable HAVE_ARCH_TRACEHOOK

2012-12-21 Thread Simon Marchi
Looks like we have everything needed for that.

Signed-off-by: Simon Marchi 
---
 arch/tile/Kconfig |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 875d008..8cab409 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -21,6 +21,7 @@ config TILE
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_CLOCKEVENTS
select MODULES_USE_ELF_RELA
+   select HAVE_ARCH_TRACEHOOK
 
 # FIXME: investigate whether we need/want these options.
 #  select HAVE_IOREMAP_PROT
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] arch/tile: Call tracehook_report_syscall_{entry,exit} in syscall trace

2012-12-21 Thread Simon Marchi
Call tracehook functions for syscall tracing.

The check for TIF_SYSCALL_TRACE was removed, because the same check is
done right before in the assembly file.

Signed-off-by: Simon Marchi 
---
 arch/tile/kernel/intvec_32.S |6 --
 arch/tile/kernel/intvec_64.S |6 --
 arch/tile/kernel/ptrace.c|   30 ++
 3 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index 6943515..6c3f597 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -1201,7 +1201,8 @@ handle_syscall:
lw  r30, r31
andir30, r30, _TIF_SYSCALL_TRACE
bzt r30, .Lrestore_syscall_regs
-   jal do_syscall_trace
+   PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
+   jal do_syscall_trace_enter
FEEDBACK_REENTER(handle_syscall)
 
/*
@@ -1252,7 +1253,8 @@ handle_syscall:
lw  r30, r31
andir30, r30, _TIF_SYSCALL_TRACE
bzt r30, 1f
-   jal do_syscall_trace
+   PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
+   jal do_syscall_trace_exit
FEEDBACK_REENTER(handle_syscall)
 1: {
 movei  r30, 0   /* not an NMI */
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index 7c06d59..a717279 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -1006,7 +1006,8 @@ handle_syscall:
 addi   r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET
 beqzt  r30, .Lrestore_syscall_regs
}
-   jal do_syscall_trace
+   PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
+   jal do_syscall_trace_enter
FEEDBACK_REENTER(handle_syscall)
 
/*
@@ -1075,7 +1076,8 @@ handle_syscall:
 andir0, r30, _TIF_SINGLESTEP
 beqzt   r0, 1f
}
-   jal do_syscall_trace
+   PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
+   jal do_syscall_trace_exit
FEEDBACK_REENTER(handle_syscall)
andir0, r30, _TIF_SINGLESTEP
 
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 9835312..0ab8b76 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -246,29 +247,18 @@ long compat_arch_ptrace(struct task_struct *child, 
compat_long_t request,
 }
 #endif
 
-void do_syscall_trace(void)
+int do_syscall_trace_enter(struct pt_regs *regs)
 {
-   if (!test_thread_flag(TIF_SYSCALL_TRACE))
-   return;
-
-   if (!(current->ptrace & PT_PTRACED))
-   return;
+   if (tracehook_report_syscall_entry(regs)) {
+   regs->regs[TREG_SYSCALL_NR] = -1;
+   }
 
-   /*
-* The 0x80 provides a way for the tracing parent to distinguish
-* between a syscall stop and SIGTRAP delivery
-*/
-   ptrace_notify(SIGTRAP|((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
+   return regs->regs[TREG_SYSCALL_NR];
+}
 
-   /*
-* this isn't the same as continuing with a signal, but it will do
-* for normal use.  strace only continues with a signal if the
-* stopping signal is not SIGTRAP.  -brl
-*/
-   if (current->exit_code) {
-   send_sig(current->exit_code, current, 1);
-   current->exit_code = 0;
-   }
+void do_syscall_trace_exit(struct pt_regs *regs)
+{
+   tracehook_report_syscall_exit(regs, 0);
 }
 
 void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int 
error_code)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] arch/tile: Implement user_stack_pointer

2012-12-21 Thread Simon Marchi
It is needed when we turn on HAVE_ARCH_TRACEHOOK.

Signed-off-by: Simon Marchi 
---
 arch/tile/include/asm/ptrace.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/asm/ptrace.h b/arch/tile/include/asm/ptrace.h
index 5ce052e..4be42fb 100644
--- a/arch/tile/include/asm/ptrace.h
+++ b/arch/tile/include/asm/ptrace.h
@@ -80,6 +80,11 @@ struct task_struct;
 extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
 int error_code);
 
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+   return regs->sp;
+}
+
 #ifdef __tilegx__
 /* We need this since sigval_t has a user pointer in it, for GETSIGINFO etc. */
 #define __ARCH_WANT_COMPAT_SYS_PTRACE
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] arch/tile: Implement user_stack_pointer

2012-12-21 Thread Simon Marchi
It is needed when we turn on HAVE_ARCH_TRACEHOOK.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/include/asm/ptrace.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/asm/ptrace.h b/arch/tile/include/asm/ptrace.h
index 5ce052e..4be42fb 100644
--- a/arch/tile/include/asm/ptrace.h
+++ b/arch/tile/include/asm/ptrace.h
@@ -80,6 +80,11 @@ struct task_struct;
 extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
 int error_code);
 
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+   return regs-sp;
+}
+
 #ifdef __tilegx__
 /* We need this since sigval_t has a user pointer in it, for GETSIGINFO etc. */
 #define __ARCH_WANT_COMPAT_SYS_PTRACE
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] arch/tile: Enable HAVE_ARCH_TRACEHOOK

2012-12-21 Thread Simon Marchi
Looks like we have everything needed for that.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/Kconfig |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 875d008..8cab409 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -21,6 +21,7 @@ config TILE
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_CLOCKEVENTS
select MODULES_USE_ELF_RELA
+   select HAVE_ARCH_TRACEHOOK
 
 # FIXME: investigate whether we need/want these options.
 #  select HAVE_IOREMAP_PROT
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] arch/tile: Call tracehook_report_syscall_{entry,exit} in syscall trace

2012-12-21 Thread Simon Marchi
Call tracehook functions for syscall tracing.

The check for TIF_SYSCALL_TRACE was removed, because the same check is
done right before in the assembly file.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/kernel/intvec_32.S |6 --
 arch/tile/kernel/intvec_64.S |6 --
 arch/tile/kernel/ptrace.c|   30 ++
 3 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index 6943515..6c3f597 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -1201,7 +1201,8 @@ handle_syscall:
lw  r30, r31
andir30, r30, _TIF_SYSCALL_TRACE
bzt r30, .Lrestore_syscall_regs
-   jal do_syscall_trace
+   PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
+   jal do_syscall_trace_enter
FEEDBACK_REENTER(handle_syscall)
 
/*
@@ -1252,7 +1253,8 @@ handle_syscall:
lw  r30, r31
andir30, r30, _TIF_SYSCALL_TRACE
bzt r30, 1f
-   jal do_syscall_trace
+   PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
+   jal do_syscall_trace_exit
FEEDBACK_REENTER(handle_syscall)
 1: {
 movei  r30, 0   /* not an NMI */
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index 7c06d59..a717279 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -1006,7 +1006,8 @@ handle_syscall:
 addi   r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET
 beqzt  r30, .Lrestore_syscall_regs
}
-   jal do_syscall_trace
+   PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
+   jal do_syscall_trace_enter
FEEDBACK_REENTER(handle_syscall)
 
/*
@@ -1075,7 +1076,8 @@ handle_syscall:
 andir0, r30, _TIF_SINGLESTEP
 beqzt   r0, 1f
}
-   jal do_syscall_trace
+   PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
+   jal do_syscall_trace_exit
FEEDBACK_REENTER(handle_syscall)
andir0, r30, _TIF_SINGLESTEP
 
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 9835312..0ab8b76 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -21,6 +21,7 @@
 #include linux/uaccess.h
 #include linux/regset.h
 #include linux/elf.h
+#include linux/tracehook.h
 #include asm/traps.h
 #include arch/chip.h
 
@@ -246,29 +247,18 @@ long compat_arch_ptrace(struct task_struct *child, 
compat_long_t request,
 }
 #endif
 
-void do_syscall_trace(void)
+int do_syscall_trace_enter(struct pt_regs *regs)
 {
-   if (!test_thread_flag(TIF_SYSCALL_TRACE))
-   return;
-
-   if (!(current-ptrace  PT_PTRACED))
-   return;
+   if (tracehook_report_syscall_entry(regs)) {
+   regs-regs[TREG_SYSCALL_NR] = -1;
+   }
 
-   /*
-* The 0x80 provides a way for the tracing parent to distinguish
-* between a syscall stop and SIGTRAP delivery
-*/
-   ptrace_notify(SIGTRAP|((current-ptrace  PT_TRACESYSGOOD) ? 0x80 : 0));
+   return regs-regs[TREG_SYSCALL_NR];
+}
 
-   /*
-* this isn't the same as continuing with a signal, but it will do
-* for normal use.  strace only continues with a signal if the
-* stopping signal is not SIGTRAP.  -brl
-*/
-   if (current-exit_code) {
-   send_sig(current-exit_code, current, 1);
-   current-exit_code = 0;
-   }
+void do_syscall_trace_exit(struct pt_regs *regs)
+{
+   tracehook_report_syscall_exit(regs, 0);
 }
 
 void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int 
error_code)
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 1/3] arch/tile: implement user_regset interface on tile

2012-12-17 Thread Simon Marchi
This is a basic implementation of user_regset for the tile
architecture. It reuses the basic blocks that were already there.

Signed-off-by: Simon Marchi 
---
v2 included change for all tile architectures (not just tilegx)
v3 changed #include  to 

 arch/tile/kernel/ptrace.c |   62 +
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index b32bc3f..882e381 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -19,7 +19,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
 
 void user_enable_single_step(struct task_struct *child)
 {
@@ -80,6 +83,65 @@ static void putregs(struct task_struct *child, struct 
pt_regs *uregs)
*regs = *uregs;
 }
 
+enum tile_regset {
+   REGSET_GPR,
+};
+
+static int tile_gpr_get(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ void *kbuf, void __user *ubuf)
+{
+   struct pt_regs regs;
+
+   getregs(target, );
+
+   return user_regset_copyout(, , , , , 0,
+  sizeof(regs));
+}
+
+static int tile_gpr_set(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ const void *kbuf, const void __user *ubuf)
+{
+   int ret;
+   struct pt_regs regs;
+
+   ret = user_regset_copyin(, , , , , 0,
+sizeof(regs));
+   if (ret)
+   return ret;
+
+   putregs(target, );
+
+   return 0;
+}
+
+static const struct user_regset tile_user_regset[] = {
+   [REGSET_GPR] = {
+   .core_note_type = NT_PRSTATUS,
+   .n = ELF_NGREG,
+   .size = sizeof(elf_greg_t),
+   .align = sizeof(elf_greg_t),
+   .get = tile_gpr_get,
+   .set = tile_gpr_set,
+   },
+};
+
+static const struct user_regset_view tile_user_regset_view = {
+   .name = CHIP_ARCH_NAME,
+   .e_machine = ELF_ARCH,
+   .ei_osabi = ELF_OSABI,
+   .regsets = tile_user_regset,
+   .n = ARRAY_SIZE(tile_user_regset),
+};
+
+const struct user_regset_view *task_user_regset_view(struct task_struct *task)
+{
+   return _user_regset_view;
+}
+
 long arch_ptrace(struct task_struct *child, long request,
 unsigned long addr, unsigned long data)
 {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/3] arch/tile: implement arch_ptrace using user_regset on tile

2012-12-17 Thread Simon Marchi
This patch changes arch_ptrace on tile so that it uses user_regset
to implement the PTRACE_GETREGS and PTRACE_SETREGS operations.

Signed-off-by: Simon Marchi 
---
 arch/tile/kernel/ptrace.c |   15 ++-
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 882e381..9835312 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -193,18 +193,15 @@ long arch_ptrace(struct task_struct *child, long request,
break;
 
case PTRACE_GETREGS:  /* Get all registers from the child. */
-   if (copy_to_user(datap, getregs(child, ),
-sizeof(struct pt_regs)) == 0) {
-   ret = 0;
-   }
+   ret = copy_regset_to_user(child, _user_regset_view,
+ REGSET_GPR, 0,
+ sizeof(struct pt_regs), datap);
break;
 
case PTRACE_SETREGS:  /* Set all registers in the child. */
-   if (copy_from_user(, datap,
-  sizeof(struct pt_regs)) == 0) {
-   putregs(child, );
-   ret = 0;
-   }
+   ret = copy_regset_from_user(child, _user_regset_view,
+   REGSET_GPR, 0,
+   sizeof(struct pt_regs), datap);
break;
 
case PTRACE_GETFPREGS:  /* Get the child FPU state. */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 3/3] arch/tile: set CORE_DUMP_USE_REGSET on tile

2012-12-17 Thread Simon Marchi
Following the previous patch which adds support for user_regset, tile
can now use this feature.

Signed-off-by: Simon Marchi 
---
 arch/tile/include/asm/elf.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index f8ccf08..2b43fa0 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -169,4 +169,6 @@ do { \
 
 #endif /* CONFIG_COMPAT */
 
+#define CORE_DUMP_USE_REGSET
+
 #endif /* _ASM_TILE_ELF_H */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] arch/tile: implement user_regset interface on tilegx

2012-12-17 Thread Simon Marchi
On Mon, Dec 17, 2012 at 5:59 PM, Chris Metcalf  wrote:
> On 12/17/2012 5:07 PM, Simon Marchi wrote:
>>> I think with this support added, we have all the prerequisites to add 
>>> "select HAVE_ARCH_TRACEHOOK" under "config TILE" in arch/tile/Kconfig, so 
>>> we might as well do that too.  That will enable PTRACE_GETREGSET and 
>>> PTRACE_SETREGSET, as well as /proc/PID/syscall, so why not?
>> This is indeed my objective ;), and it is an intermediate objective to
>> add support for HAVE_SYSCALL_TRACEPOINTS. If we look at arch/Kconfig,
>> just above HAVE_ARCH_TRACEHOOK, we still have
>>
>> TIF_SYSCALL_TRACE   calls tracehook_report_syscall_{entry,exit}
>> TIF_NOTIFY_RESUME   calls tracehook_notify_resume()
>> signal delivery calls tracehook_signal_handler()
>
> I believe we do properly support TIF_SYSCALL_TRACE; see 
> arch/tile/kernel/intvec_64.S.  Likewise TIF_NOTIFY_RESUME; see 
> do_work_pending() in arch/tile/kernel/process.c.  And signal delivery seems 
> to be handled in a platform-independent way now; see kernel/signal.c.

TIF_SYSCALL_TRACE is handled, but it doesn't call
tracehook_report_syscall_{entry,exit} as specified. The two others
seem handled like you said.

> My only comment on the revised patch is that I believe you should #include 
> , not .  Source code (.c files) doesn't seem 
> to use the  prefix.

Oh, I didn't know the include path contained arch/tile/include/uapi
directly. Fixing it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/3] arch/tile: set CORE_DUMP_USE_REGSET on tile

2012-12-17 Thread Simon Marchi
Following the previous patch which adds support for user_regset, tile
can now use this feature.

Signed-off-by: Simon Marchi 
---
 arch/tile/include/asm/elf.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index f8ccf08..2b43fa0 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -169,4 +169,6 @@ do { \
 
 #endif /* CONFIG_COMPAT */
 
+#define CORE_DUMP_USE_REGSET
+
 #endif /* _ASM_TILE_ELF_H */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/3] arch/tile: implement user_regset interface on tile

2012-12-17 Thread Simon Marchi
This is a basic implementation of user_regset for the tile
architecture. It reuses the basic blocks that were already there.

Signed-off-by: Simon Marchi 
---
 arch/tile/kernel/ptrace.c |   62 +
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index b32bc3f..222d9fc 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -19,7 +19,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
 
 void user_enable_single_step(struct task_struct *child)
 {
@@ -80,6 +83,65 @@ static void putregs(struct task_struct *child, struct 
pt_regs *uregs)
*regs = *uregs;
 }
 
+enum tile_regset {
+   REGSET_GPR,
+};
+
+static int tile_gpr_get(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ void *kbuf, void __user *ubuf)
+{
+   struct pt_regs regs;
+
+   getregs(target, );
+
+   return user_regset_copyout(, , , , , 0,
+  sizeof(regs));
+}
+
+static int tile_gpr_set(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ const void *kbuf, const void __user *ubuf)
+{
+   int ret;
+   struct pt_regs regs;
+
+   ret = user_regset_copyin(, , , , , 0,
+sizeof(regs));
+   if (ret)
+   return ret;
+
+   putregs(target, );
+
+   return 0;
+}
+
+static const struct user_regset tile_user_regset[] = {
+   [REGSET_GPR] = {
+   .core_note_type = NT_PRSTATUS,
+   .n = ELF_NGREG,
+   .size = sizeof(elf_greg_t),
+   .align = sizeof(elf_greg_t),
+   .get = tile_gpr_get,
+   .set = tile_gpr_set,
+   },
+};
+
+static const struct user_regset_view tile_user_regset_view = {
+   .name = CHIP_ARCH_NAME,
+   .e_machine = ELF_ARCH,
+   .ei_osabi = ELF_OSABI,
+   .regsets = tile_user_regset,
+   .n = ARRAY_SIZE(tile_user_regset),
+};
+
+const struct user_regset_view *task_user_regset_view(struct task_struct *task)
+{
+   return _user_regset_view;
+}
+
 long arch_ptrace(struct task_struct *child, long request,
 unsigned long addr, unsigned long data)
 {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/3] arch/tile: implement arch_ptrace using user_regset on tile

2012-12-17 Thread Simon Marchi
This patch changes arch_ptrace on tile so that it uses user_regset
to implement the PTRACE_GETREGS and PTRACE_SETREGS operations.

Signed-off-by: Simon Marchi 
---
 arch/tile/kernel/ptrace.c |   15 ++-
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 222d9fc..d11661f 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -193,18 +193,15 @@ long arch_ptrace(struct task_struct *child, long request,
break;
 
case PTRACE_GETREGS:  /* Get all registers from the child. */
-   if (copy_to_user(datap, getregs(child, ),
-sizeof(struct pt_regs)) == 0) {
-   ret = 0;
-   }
+   ret = copy_regset_to_user(child, _user_regset_view,
+ REGSET_GPR, 0,
+ sizeof(struct pt_regs), datap);
break;
 
case PTRACE_SETREGS:  /* Set all registers in the child. */
-   if (copy_from_user(, datap,
-  sizeof(struct pt_regs)) == 0) {
-   putregs(child, );
-   ret = 0;
-   }
+   ret = copy_regset_from_user(child, _user_regset_view,
+   REGSET_GPR, 0,
+   sizeof(struct pt_regs), datap);
break;
 
case PTRACE_GETFPREGS:  /* Get the child FPU state. */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] arch/tile: implement user_regset interface on tilegx

2012-12-17 Thread Simon Marchi
On Mon, Dec 17, 2012 at 12:06 PM, Chris Metcalf  wrote:
> On 12/14/2012 11:34 PM, Simon Marchi wrote:
>> This is an implementation of user_regset for the tilegx architecture. It
>> reuses the basic blocks that were already there.
>
> Thanks, Simon!  A couple of comments:
>
> I encourage you to respin this for tilepro as well as tilegx, since it's 
> going to be trivial to make it happen.  Just take away all yours ifdefs, and 
> use #include  and CHIP_ARCH_NAME instead of the string "tilegx". 
>  It's worth it just to avoid the ifdefs in the code :-)

Ok, I will send a v2 with this soon.

> I think with this support added, we have all the prerequisites to add "select 
> HAVE_ARCH_TRACEHOOK" under "config TILE" in arch/tile/Kconfig, so we might as 
> well do that too.  That will enable PTRACE_GETREGSET and PTRACE_SETREGSET, as 
> well as /proc/PID/syscall, so why not?

This is indeed my objective ;), and it is an intermediate objective to
add support for HAVE_SYSCALL_TRACEPOINTS. If we look at arch/Kconfig,
just above HAVE_ARCH_TRACEHOOK, we still have

TIF_SYSCALL_TRACE   calls tracehook_report_syscall_{entry,exit}
TIF_NOTIFY_RESUME   calls tracehook_notify_resume()
signal delivery calls tracehook_signal_handler()

that we need to implement.

> --
> Chris Metcalf, Tilera Corp.
> http://www.tilera.com
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] arch/tile: implement user_regset interface on tilegx

2012-12-17 Thread Simon Marchi
On Mon, Dec 17, 2012 at 12:06 PM, Chris Metcalf cmetc...@tilera.com wrote:
 On 12/14/2012 11:34 PM, Simon Marchi wrote:
 This is an implementation of user_regset for the tilegx architecture. It
 reuses the basic blocks that were already there.

 Thanks, Simon!  A couple of comments:

 I encourage you to respin this for tilepro as well as tilegx, since it's 
 going to be trivial to make it happen.  Just take away all yours ifdefs, and 
 use #include arch/chip.h and CHIP_ARCH_NAME instead of the string tilegx. 
  It's worth it just to avoid the ifdefs in the code :-)

Ok, I will send a v2 with this soon.

 I think with this support added, we have all the prerequisites to add select 
 HAVE_ARCH_TRACEHOOK under config TILE in arch/tile/Kconfig, so we might as 
 well do that too.  That will enable PTRACE_GETREGSET and PTRACE_SETREGSET, as 
 well as /proc/PID/syscall, so why not?

This is indeed my objective ;), and it is an intermediate objective to
add support for HAVE_SYSCALL_TRACEPOINTS. If we look at arch/Kconfig,
just above HAVE_ARCH_TRACEHOOK, we still have

TIF_SYSCALL_TRACE   calls tracehook_report_syscall_{entry,exit}
TIF_NOTIFY_RESUME   calls tracehook_notify_resume()
signal delivery calls tracehook_signal_handler()

that we need to implement.

 --
 Chris Metcalf, Tilera Corp.
 http://www.tilera.com

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/3] arch/tile: implement user_regset interface on tile

2012-12-17 Thread Simon Marchi
This is a basic implementation of user_regset for the tile
architecture. It reuses the basic blocks that were already there.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/kernel/ptrace.c |   62 +
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index b32bc3f..222d9fc 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -19,7 +19,10 @@
 #include linux/kprobes.h
 #include linux/compat.h
 #include linux/uaccess.h
+#include linux/regset.h
+#include linux/elf.h
 #include asm/traps.h
+#include uapi/arch/chip.h
 
 void user_enable_single_step(struct task_struct *child)
 {
@@ -80,6 +83,65 @@ static void putregs(struct task_struct *child, struct 
pt_regs *uregs)
*regs = *uregs;
 }
 
+enum tile_regset {
+   REGSET_GPR,
+};
+
+static int tile_gpr_get(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ void *kbuf, void __user *ubuf)
+{
+   struct pt_regs regs;
+
+   getregs(target, regs);
+
+   return user_regset_copyout(pos, count, kbuf, ubuf, regs, 0,
+  sizeof(regs));
+}
+
+static int tile_gpr_set(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ const void *kbuf, const void __user *ubuf)
+{
+   int ret;
+   struct pt_regs regs;
+
+   ret = user_regset_copyin(pos, count, kbuf, ubuf, regs, 0,
+sizeof(regs));
+   if (ret)
+   return ret;
+
+   putregs(target, regs);
+
+   return 0;
+}
+
+static const struct user_regset tile_user_regset[] = {
+   [REGSET_GPR] = {
+   .core_note_type = NT_PRSTATUS,
+   .n = ELF_NGREG,
+   .size = sizeof(elf_greg_t),
+   .align = sizeof(elf_greg_t),
+   .get = tile_gpr_get,
+   .set = tile_gpr_set,
+   },
+};
+
+static const struct user_regset_view tile_user_regset_view = {
+   .name = CHIP_ARCH_NAME,
+   .e_machine = ELF_ARCH,
+   .ei_osabi = ELF_OSABI,
+   .regsets = tile_user_regset,
+   .n = ARRAY_SIZE(tile_user_regset),
+};
+
+const struct user_regset_view *task_user_regset_view(struct task_struct *task)
+{
+   return tile_user_regset_view;
+}
+
 long arch_ptrace(struct task_struct *child, long request,
 unsigned long addr, unsigned long data)
 {
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/3] arch/tile: implement arch_ptrace using user_regset on tile

2012-12-17 Thread Simon Marchi
This patch changes arch_ptrace on tile so that it uses user_regset
to implement the PTRACE_GETREGS and PTRACE_SETREGS operations.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/kernel/ptrace.c |   15 ++-
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 222d9fc..d11661f 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -193,18 +193,15 @@ long arch_ptrace(struct task_struct *child, long request,
break;
 
case PTRACE_GETREGS:  /* Get all registers from the child. */
-   if (copy_to_user(datap, getregs(child, copyregs),
-sizeof(struct pt_regs)) == 0) {
-   ret = 0;
-   }
+   ret = copy_regset_to_user(child, tile_user_regset_view,
+ REGSET_GPR, 0,
+ sizeof(struct pt_regs), datap);
break;
 
case PTRACE_SETREGS:  /* Set all registers in the child. */
-   if (copy_from_user(copyregs, datap,
-  sizeof(struct pt_regs)) == 0) {
-   putregs(child, copyregs);
-   ret = 0;
-   }
+   ret = copy_regset_from_user(child, tile_user_regset_view,
+   REGSET_GPR, 0,
+   sizeof(struct pt_regs), datap);
break;
 
case PTRACE_GETFPREGS:  /* Get the child FPU state. */
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/3] arch/tile: set CORE_DUMP_USE_REGSET on tile

2012-12-17 Thread Simon Marchi
Following the previous patch which adds support for user_regset, tile
can now use this feature.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/include/asm/elf.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index f8ccf08..2b43fa0 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -169,4 +169,6 @@ do { \
 
 #endif /* CONFIG_COMPAT */
 
+#define CORE_DUMP_USE_REGSET
+
 #endif /* _ASM_TILE_ELF_H */
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] arch/tile: implement user_regset interface on tilegx

2012-12-17 Thread Simon Marchi
On Mon, Dec 17, 2012 at 5:59 PM, Chris Metcalf cmetc...@tilera.com wrote:
 On 12/17/2012 5:07 PM, Simon Marchi wrote:
 I think with this support added, we have all the prerequisites to add 
 select HAVE_ARCH_TRACEHOOK under config TILE in arch/tile/Kconfig, so 
 we might as well do that too.  That will enable PTRACE_GETREGSET and 
 PTRACE_SETREGSET, as well as /proc/PID/syscall, so why not?
 This is indeed my objective ;), and it is an intermediate objective to
 add support for HAVE_SYSCALL_TRACEPOINTS. If we look at arch/Kconfig,
 just above HAVE_ARCH_TRACEHOOK, we still have

 TIF_SYSCALL_TRACE   calls tracehook_report_syscall_{entry,exit}
 TIF_NOTIFY_RESUME   calls tracehook_notify_resume()
 signal delivery calls tracehook_signal_handler()

 I believe we do properly support TIF_SYSCALL_TRACE; see 
 arch/tile/kernel/intvec_64.S.  Likewise TIF_NOTIFY_RESUME; see 
 do_work_pending() in arch/tile/kernel/process.c.  And signal delivery seems 
 to be handled in a platform-independent way now; see kernel/signal.c.

TIF_SYSCALL_TRACE is handled, but it doesn't call
tracehook_report_syscall_{entry,exit} as specified. The two others
seem handled like you said.

 My only comment on the revised patch is that I believe you should #include 
 arch/chip.h, not uapi/arch/chip.h.  Source code (.c files) doesn't seem 
 to use the uapi/ prefix.

Oh, I didn't know the include path contained arch/tile/include/uapi
directly. Fixing it.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 3/3] arch/tile: set CORE_DUMP_USE_REGSET on tile

2012-12-17 Thread Simon Marchi
Following the previous patch which adds support for user_regset, tile
can now use this feature.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/include/asm/elf.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index f8ccf08..2b43fa0 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -169,4 +169,6 @@ do { \
 
 #endif /* CONFIG_COMPAT */
 
+#define CORE_DUMP_USE_REGSET
+
 #endif /* _ASM_TILE_ELF_H */
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/3] arch/tile: implement arch_ptrace using user_regset on tile

2012-12-17 Thread Simon Marchi
This patch changes arch_ptrace on tile so that it uses user_regset
to implement the PTRACE_GETREGS and PTRACE_SETREGS operations.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/kernel/ptrace.c |   15 ++-
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 882e381..9835312 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -193,18 +193,15 @@ long arch_ptrace(struct task_struct *child, long request,
break;
 
case PTRACE_GETREGS:  /* Get all registers from the child. */
-   if (copy_to_user(datap, getregs(child, copyregs),
-sizeof(struct pt_regs)) == 0) {
-   ret = 0;
-   }
+   ret = copy_regset_to_user(child, tile_user_regset_view,
+ REGSET_GPR, 0,
+ sizeof(struct pt_regs), datap);
break;
 
case PTRACE_SETREGS:  /* Set all registers in the child. */
-   if (copy_from_user(copyregs, datap,
-  sizeof(struct pt_regs)) == 0) {
-   putregs(child, copyregs);
-   ret = 0;
-   }
+   ret = copy_regset_from_user(child, tile_user_regset_view,
+   REGSET_GPR, 0,
+   sizeof(struct pt_regs), datap);
break;
 
case PTRACE_GETFPREGS:  /* Get the child FPU state. */
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 1/3] arch/tile: implement user_regset interface on tile

2012-12-17 Thread Simon Marchi
This is a basic implementation of user_regset for the tile
architecture. It reuses the basic blocks that were already there.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
v2 included change for all tile architectures (not just tilegx)
v3 changed #include uapi/arch/chip.h to arch/chip.h

 arch/tile/kernel/ptrace.c |   62 +
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index b32bc3f..882e381 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -19,7 +19,10 @@
 #include linux/kprobes.h
 #include linux/compat.h
 #include linux/uaccess.h
+#include linux/regset.h
+#include linux/elf.h
 #include asm/traps.h
+#include arch/chip.h
 
 void user_enable_single_step(struct task_struct *child)
 {
@@ -80,6 +83,65 @@ static void putregs(struct task_struct *child, struct 
pt_regs *uregs)
*regs = *uregs;
 }
 
+enum tile_regset {
+   REGSET_GPR,
+};
+
+static int tile_gpr_get(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ void *kbuf, void __user *ubuf)
+{
+   struct pt_regs regs;
+
+   getregs(target, regs);
+
+   return user_regset_copyout(pos, count, kbuf, ubuf, regs, 0,
+  sizeof(regs));
+}
+
+static int tile_gpr_set(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ const void *kbuf, const void __user *ubuf)
+{
+   int ret;
+   struct pt_regs regs;
+
+   ret = user_regset_copyin(pos, count, kbuf, ubuf, regs, 0,
+sizeof(regs));
+   if (ret)
+   return ret;
+
+   putregs(target, regs);
+
+   return 0;
+}
+
+static const struct user_regset tile_user_regset[] = {
+   [REGSET_GPR] = {
+   .core_note_type = NT_PRSTATUS,
+   .n = ELF_NGREG,
+   .size = sizeof(elf_greg_t),
+   .align = sizeof(elf_greg_t),
+   .get = tile_gpr_get,
+   .set = tile_gpr_set,
+   },
+};
+
+static const struct user_regset_view tile_user_regset_view = {
+   .name = CHIP_ARCH_NAME,
+   .e_machine = ELF_ARCH,
+   .ei_osabi = ELF_OSABI,
+   .regsets = tile_user_regset,
+   .n = ARRAY_SIZE(tile_user_regset),
+};
+
+const struct user_regset_view *task_user_regset_view(struct task_struct *task)
+{
+   return tile_user_regset_view;
+}
+
 long arch_ptrace(struct task_struct *child, long request,
 unsigned long addr, unsigned long data)
 {
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] arch/tile: implement arch_ptrace using user_regset on tilegx

2012-12-14 Thread Simon Marchi
This patch changes arch_ptrace on tilegx so that it uses the user_regset
to implement the PTRACE_GETREGS and PTRACE_SETREGS operations.

The ifdefs and the old code can be removed when user_regset support for
the older architectures is there.

Signed-off-by: Simon Marchi 
---
 arch/tile/kernel/ptrace.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 0e68d06..9435dd1 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -196,18 +196,28 @@ long arch_ptrace(struct task_struct *child, long request,
break;
 
case PTRACE_GETREGS:  /* Get all registers from the child. */
+#ifdef __tilegx__
+   ret = copy_regset_to_user(child, _user_regset_view, 
REGSET_GPR,
+ 0, sizeof(struct pt_regs), datap);
+#else /* __tilegx__ */
if (copy_to_user(datap, getregs(child, ),
 sizeof(struct pt_regs)) == 0) {
ret = 0;
}
+#endif /* __tilegx__ */
break;
 
case PTRACE_SETREGS:  /* Set all registers in the child. */
+#ifdef __tilegx__
+   ret = copy_regset_from_user(child, _user_regset_view, 
REGSET_GPR,
+   0, sizeof(struct pt_regs), datap);
+#else /* __tilegx__ */
if (copy_from_user(, datap,
   sizeof(struct pt_regs)) == 0) {
putregs(child, );
ret = 0;
}
+#endif /* __tilegx__ */
break;
 
case PTRACE_GETFPREGS:  /* Get the child FPU state. */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] arch/tile: implement user_regset interface on tilegx

2012-12-14 Thread Simon Marchi
This is an implementation of user_regset for the tilegx architecture. It
reuses the basic blocks that were already there.

Signed-off-by: Simon Marchi 
---
I only tested these patches on a 3.0 kernel, as this is what my current
setup allows me. Some testing on more recent versions would be
appreciated, although I don't think the user_regset framework changed
much since then.

Also, I put some ifdefs so that these patches only affect tilegx and not
the older tile architectures, which I don't have access to. Hopefully
someone else can finish the work for those, it's probably not much.

 arch/tile/kernel/ptrace.c |   65 +
 1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index b32bc3f..0e68d06 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -19,6 +19,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 void user_enable_single_step(struct task_struct *child)
@@ -80,6 +82,69 @@ static void putregs(struct task_struct *child, struct 
pt_regs *uregs)
*regs = *uregs;
 }
 
+#ifdef __tilegx__
+
+enum tile_regset {
+   REGSET_GPR,
+};
+
+static int tile_gpr_get(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ void *kbuf, void __user *ubuf)
+{
+   struct pt_regs regs;
+
+   getregs(target, );
+
+   return user_regset_copyout(, , , , , 0,
+  sizeof(regs));
+}
+
+static int tile_gpr_set(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ const void *kbuf, const void __user *ubuf)
+{
+   int ret;
+   struct pt_regs regs;
+
+   ret = user_regset_copyin(, , , , , 0,
+sizeof(regs));
+   if (ret)
+   return ret;
+
+   putregs(target, );
+
+   return 0;
+}
+
+static const struct user_regset tile_user_regset[] = {
+   [REGSET_GPR] = {
+   .core_note_type = NT_PRSTATUS,
+   .n = ELF_NGREG,
+   .size = sizeof(elf_greg_t),
+   .align = sizeof(elf_greg_t),
+   .get = tile_gpr_get,
+   .set = tile_gpr_set,
+   },
+};
+
+static const struct user_regset_view tile_user_regset_view = {
+   .name = "tilegx",
+   .e_machine = ELF_ARCH,
+   .ei_osabi = ELF_OSABI,
+   .regsets = tile_user_regset,
+   .n = ARRAY_SIZE(tile_user_regset),
+};
+
+const struct user_regset_view *task_user_regset_view(struct task_struct *task)
+{
+   return _user_regset_view;
+}
+
+#endif /* __tilegx__ */
+
 long arch_ptrace(struct task_struct *child, long request,
 unsigned long addr, unsigned long data)
 {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] arch/tile: set CORE_DUMP_USE_REGSET on tilegx

2012-12-14 Thread Simon Marchi
Following the previous patch which adds support for user_regset, tilegx
can now use this feature.

Signed-off-by: Simon Marchi 
---
 arch/tile/include/asm/elf.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index f8ccf08..7a793c7 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -169,4 +169,8 @@ do { \
 
 #endif /* CONFIG_COMPAT */
 
+#ifdef __tilegx__
+#define CORE_DUMP_USE_REGSET
+#endif /* __tilegx__ */
+
 #endif /* _ASM_TILE_ELF_H */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] arch/tile: implement user_regset interface on tilegx

2012-12-14 Thread Simon Marchi
This is an implementation of user_regset for the tilegx architecture. It
reuses the basic blocks that were already there.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
I only tested these patches on a 3.0 kernel, as this is what my current
setup allows me. Some testing on more recent versions would be
appreciated, although I don't think the user_regset framework changed
much since then.

Also, I put some ifdefs so that these patches only affect tilegx and not
the older tile architectures, which I don't have access to. Hopefully
someone else can finish the work for those, it's probably not much.

 arch/tile/kernel/ptrace.c |   65 +
 1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index b32bc3f..0e68d06 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -19,6 +19,8 @@
 #include linux/kprobes.h
 #include linux/compat.h
 #include linux/uaccess.h
+#include linux/regset.h
+#include linux/elf.h
 #include asm/traps.h
 
 void user_enable_single_step(struct task_struct *child)
@@ -80,6 +82,69 @@ static void putregs(struct task_struct *child, struct 
pt_regs *uregs)
*regs = *uregs;
 }
 
+#ifdef __tilegx__
+
+enum tile_regset {
+   REGSET_GPR,
+};
+
+static int tile_gpr_get(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ void *kbuf, void __user *ubuf)
+{
+   struct pt_regs regs;
+
+   getregs(target, regs);
+
+   return user_regset_copyout(pos, count, kbuf, ubuf, regs, 0,
+  sizeof(regs));
+}
+
+static int tile_gpr_set(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ const void *kbuf, const void __user *ubuf)
+{
+   int ret;
+   struct pt_regs regs;
+
+   ret = user_regset_copyin(pos, count, kbuf, ubuf, regs, 0,
+sizeof(regs));
+   if (ret)
+   return ret;
+
+   putregs(target, regs);
+
+   return 0;
+}
+
+static const struct user_regset tile_user_regset[] = {
+   [REGSET_GPR] = {
+   .core_note_type = NT_PRSTATUS,
+   .n = ELF_NGREG,
+   .size = sizeof(elf_greg_t),
+   .align = sizeof(elf_greg_t),
+   .get = tile_gpr_get,
+   .set = tile_gpr_set,
+   },
+};
+
+static const struct user_regset_view tile_user_regset_view = {
+   .name = tilegx,
+   .e_machine = ELF_ARCH,
+   .ei_osabi = ELF_OSABI,
+   .regsets = tile_user_regset,
+   .n = ARRAY_SIZE(tile_user_regset),
+};
+
+const struct user_regset_view *task_user_regset_view(struct task_struct *task)
+{
+   return tile_user_regset_view;
+}
+
+#endif /* __tilegx__ */
+
 long arch_ptrace(struct task_struct *child, long request,
 unsigned long addr, unsigned long data)
 {
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] arch/tile: set CORE_DUMP_USE_REGSET on tilegx

2012-12-14 Thread Simon Marchi
Following the previous patch which adds support for user_regset, tilegx
can now use this feature.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/include/asm/elf.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index f8ccf08..7a793c7 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -169,4 +169,8 @@ do { \
 
 #endif /* CONFIG_COMPAT */
 
+#ifdef __tilegx__
+#define CORE_DUMP_USE_REGSET
+#endif /* __tilegx__ */
+
 #endif /* _ASM_TILE_ELF_H */
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] arch/tile: implement arch_ptrace using user_regset on tilegx

2012-12-14 Thread Simon Marchi
This patch changes arch_ptrace on tilegx so that it uses the user_regset
to implement the PTRACE_GETREGS and PTRACE_SETREGS operations.

The ifdefs and the old code can be removed when user_regset support for
the older architectures is there.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 arch/tile/kernel/ptrace.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 0e68d06..9435dd1 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -196,18 +196,28 @@ long arch_ptrace(struct task_struct *child, long request,
break;
 
case PTRACE_GETREGS:  /* Get all registers from the child. */
+#ifdef __tilegx__
+   ret = copy_regset_to_user(child, tile_user_regset_view, 
REGSET_GPR,
+ 0, sizeof(struct pt_regs), datap);
+#else /* __tilegx__ */
if (copy_to_user(datap, getregs(child, copyregs),
 sizeof(struct pt_regs)) == 0) {
ret = 0;
}
+#endif /* __tilegx__ */
break;
 
case PTRACE_SETREGS:  /* Set all registers in the child. */
+#ifdef __tilegx__
+   ret = copy_regset_from_user(child, tile_user_regset_view, 
REGSET_GPR,
+   0, sizeof(struct pt_regs), datap);
+#else /* __tilegx__ */
if (copy_from_user(copyregs, datap,
   sizeof(struct pt_regs)) == 0) {
putregs(child, copyregs);
ret = 0;
}
+#endif /* __tilegx__ */
break;
 
case PTRACE_GETFPREGS:  /* Get the child FPU state. */
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tilegx: request_irq with a non-null device name

2012-11-15 Thread Simon Marchi
This patch simply makes the tilegx net driver call request_irq with a
non-null name. It makes the output in /proc/interrupts more obvious, but
also helps tools that don't expect to find null there.

Signed-off-by: Simon Marchi 
Acked-by: Chris Metcalf 
---
I am not sure if this patch will get picked up directly by David Miller
of it should go through Chris Metcalf's tree first. Hopefully it is
simple enough that it can get merged directly.

 drivers/net/ethernet/tile/tilegx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/tile/tilegx.c 
b/drivers/net/ethernet/tile/tilegx.c
index 4e98100..66e025a 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -917,7 +917,7 @@ static int tile_net_setup_interrupts(struct net_device *dev)
ingress_irq = rc;
tile_irq_activate(ingress_irq, TILE_IRQ_PERCPU);
rc = request_irq(ingress_irq, tile_net_handle_ingress_irq,
-0, NULL, NULL);
+0, "tile_net", NULL);
if (rc != 0) {
netdev_err(dev, "request_irq failed: %d\n", rc);
destroy_irq(ingress_irq);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tilegx: request_irq with a non-null device name

2012-11-15 Thread Simon Marchi
This patch simply makes the tilegx net driver call request_irq with a
non-null name. It makes the output in /proc/interrupts more obvious, but
also helps tools that don't expect to find null there.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
Acked-by: Chris Metcalf cmetc...@tilera.com
---
I am not sure if this patch will get picked up directly by David Miller
of it should go through Chris Metcalf's tree first. Hopefully it is
simple enough that it can get merged directly.

 drivers/net/ethernet/tile/tilegx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/tile/tilegx.c 
b/drivers/net/ethernet/tile/tilegx.c
index 4e98100..66e025a 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -917,7 +917,7 @@ static int tile_net_setup_interrupts(struct net_device *dev)
ingress_irq = rc;
tile_irq_activate(ingress_irq, TILE_IRQ_PERCPU);
rc = request_irq(ingress_irq, tile_net_handle_ingress_irq,
-0, NULL, NULL);
+0, tile_net, NULL);
if (rc != 0) {
netdev_err(dev, request_irq failed: %d\n, rc);
destroy_irq(ingress_irq);
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tilegx: request_irq with a non-null device name

2012-11-13 Thread Simon Marchi
On Tue, Nov 13, 2012 at 1:37 PM, Chris Metcalf  wrote:
> On 11/13/2012 3:58 PM, Simon Marchi wrote:
>> This patch simply makes the tilegx net driver call request_irq with a
>> non-null name. It makes the output in /proc/interrupts more obvious, but
>> also helps tools that don't expect to find null there.
>>
>> Signed-off-by: Simon Marchi 
>> ---
>>  drivers/net/ethernet/tile/tilegx.c |2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/tile/tilegx.c 
>> b/drivers/net/ethernet/tile/tilegx.c
>> index 4e98100..66e025a 100644
>> --- a/drivers/net/ethernet/tile/tilegx.c
>> +++ b/drivers/net/ethernet/tile/tilegx.c
>> @@ -917,7 +917,7 @@ static int tile_net_setup_interrupts(struct net_device 
>> *dev)
>>   ingress_irq = rc;
>>   tile_irq_activate(ingress_irq, TILE_IRQ_PERCPU);
>>   rc = request_irq(ingress_irq, tile_net_handle_ingress_irq,
>> -  0, NULL, NULL);
>> +  0, "tile_net", NULL);
>
> Good catch.  If you can change it to dev->name instead of "tile_net", feel
> free to add my:

I thought about that first, but it wouldn't be very logical. This
module is loaded once and for all when the first network device is
brought up, so this request_irq is for all the tile network
interfaces. Suppose you "up" gbe0, "up" gbe1 and "down" gbe0, the
device name would still be gbe0, even though it's down. That's why I
opted for a generic name instead.

If you still want to go with dev->name I have no problem with that.

> Acked-by: Chris Metcalf 
>
> --
> Chris Metcalf, Tilera Corp.
> http://www.tilera.com
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tilegx: request_irq with a non-null device name

2012-11-13 Thread Simon Marchi
This patch simply makes the tilegx net driver call request_irq with a
non-null name. It makes the output in /proc/interrupts more obvious, but
also helps tools that don't expect to find null there.

Signed-off-by: Simon Marchi 
---
 drivers/net/ethernet/tile/tilegx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/tile/tilegx.c 
b/drivers/net/ethernet/tile/tilegx.c
index 4e98100..66e025a 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -917,7 +917,7 @@ static int tile_net_setup_interrupts(struct net_device *dev)
ingress_irq = rc;
tile_irq_activate(ingress_irq, TILE_IRQ_PERCPU);
rc = request_irq(ingress_irq, tile_net_handle_ingress_irq,
-0, NULL, NULL);
+0, "tile_net", NULL);
if (rc != 0) {
netdev_err(dev, "request_irq failed: %d\n", rc);
destroy_irq(ingress_irq);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tilegx: request_irq with a non-null device name

2012-11-13 Thread Simon Marchi
This patch simply makes the tilegx net driver call request_irq with a
non-null name. It makes the output in /proc/interrupts more obvious, but
also helps tools that don't expect to find null there.

Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
---
 drivers/net/ethernet/tile/tilegx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/tile/tilegx.c 
b/drivers/net/ethernet/tile/tilegx.c
index 4e98100..66e025a 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -917,7 +917,7 @@ static int tile_net_setup_interrupts(struct net_device *dev)
ingress_irq = rc;
tile_irq_activate(ingress_irq, TILE_IRQ_PERCPU);
rc = request_irq(ingress_irq, tile_net_handle_ingress_irq,
-0, NULL, NULL);
+0, tile_net, NULL);
if (rc != 0) {
netdev_err(dev, request_irq failed: %d\n, rc);
destroy_irq(ingress_irq);
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tilegx: request_irq with a non-null device name

2012-11-13 Thread Simon Marchi
On Tue, Nov 13, 2012 at 1:37 PM, Chris Metcalf cmetc...@tilera.com wrote:
 On 11/13/2012 3:58 PM, Simon Marchi wrote:
 This patch simply makes the tilegx net driver call request_irq with a
 non-null name. It makes the output in /proc/interrupts more obvious, but
 also helps tools that don't expect to find null there.

 Signed-off-by: Simon Marchi simon.mar...@polymtl.ca
 ---
  drivers/net/ethernet/tile/tilegx.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/drivers/net/ethernet/tile/tilegx.c 
 b/drivers/net/ethernet/tile/tilegx.c
 index 4e98100..66e025a 100644
 --- a/drivers/net/ethernet/tile/tilegx.c
 +++ b/drivers/net/ethernet/tile/tilegx.c
 @@ -917,7 +917,7 @@ static int tile_net_setup_interrupts(struct net_device 
 *dev)
   ingress_irq = rc;
   tile_irq_activate(ingress_irq, TILE_IRQ_PERCPU);
   rc = request_irq(ingress_irq, tile_net_handle_ingress_irq,
 -  0, NULL, NULL);
 +  0, tile_net, NULL);

 Good catch.  If you can change it to dev-name instead of tile_net, feel
 free to add my:

I thought about that first, but it wouldn't be very logical. This
module is loaded once and for all when the first network device is
brought up, so this request_irq is for all the tile network
interfaces. Suppose you up gbe0, up gbe1 and down gbe0, the
device name would still be gbe0, even though it's down. That's why I
opted for a generic name instead.

If you still want to go with dev-name I have no problem with that.

 Acked-by: Chris Metcalf cmetc...@tilera.com

 --
 Chris Metcalf, Tilera Corp.
 http://www.tilera.com

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/