Re: [PATCH 1/3] arch/tile: implement user_regset interface on tilegx
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/
Re: [PATCH 1/3] arch/tile: implement user_regset interface on tilegx
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. 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. -- 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
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
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 :-) 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? -- 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 1/3] arch/tile: implement user_regset interface on tilegx
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, ®s); + + return user_regset_copyout(&pos, &count, &kbuf, &ubuf, ®s, 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, ®s, 0, +sizeof(regs)); + if (ret) + return ret; + + putregs(target, ®s); + + 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/