Add new powerpc specific ELF core notes
Subsystems (4)
v5 cover Add new powerpc specific ELF core notes
This patch series adds five new ELF core note sections which can be
used with existing ptrace request PTRACE_GETREGSET-SETREGSET for accessing various transactional memory and miscellaneous debug register sets on powerpc platform.
Previous versions:
==================
RFC: https://lkml.org/lkml/2014/4/1/292 V1: https://lkml.org/lkml/2014/4/2/43 V2: https://lkml.org/lkml/2014/5/5/88 V3: https://lkml.org/lkml/2014/5/23/486 V4: https://lkml.org/lkml/2014/11/11/6
Changes in V5:
--------------
- Changed flush_tmregs_to_thread, so not to take into account self tracing
- Dropped the 3rd patch in the series which had merged two functions
- Fixed one build problem for the misc debug register patch
- Accommodated almost all the review comments from Suka on the 6th patch
- Minor changes to the self test program
- Changed commit messages for some of the patches
Changes in V4:
--------------
- Added one test program into the powerpc selftest bucket in this regard
- Split the 2nd patch in the previous series into four different patches
- Accommodated most of the review comments on the previous patch series
- Added a patch to merge functions __switch_to_tm and tm_reclaim_task
Changes in V3:
--------------
- Added two new error paths in every TM related get/set functions when regset support is not present on the system (ENODEV) or when the process does not have any transaction active (ENODATA) in the context
- Installed the active hooks for all the newly added regset core note types
Changes in V2:
--------------
- Removed all the power specific ptrace requests corresponding to new NT_PPC_* elf core note types. Now all the register sets can be accessed from ptrace through PTRACE_GETREGSET/PTRACE_SETREGSET using the individual NT_PPC* core note type instead
- Fixed couple of attribute values for REGSET_TM_CGPR register set
- Renamed flush_tmreg_to_thread as flush_tmregs_to_thread
- Fixed 32 bit checkpointed GPR support
- Changed commit messages accordingly
Test Result
-----------
The patch series has been verified both in 32 bit and 64 bit compiled test program. Test result for the selftest test (64 bit compiled) can be found here.
test: tm_ptrace
tags: git_version:v3.18-rc6-8-ge2aa4ce
===Testing TM based PTRACE Interface===
Testing TM specific SPR:
TFHAR: 10001098
TEXASR: de0000018c000001
TFIAR: c000000000041858
TM ORIG_MSR: 800000050000f032
TM CH DSCR: a (PASSED)
TM CH TAR: 14 (PASSED)
TM CH PPR: 8000000000000 (PASSED)
Testing TM checkpointed GPR:
TM CH NIP: 10001098
TM CH LINK: 10000ea0
TM CH CCR: 24000422
TM CH GPR[0]: 0 (PASSED)
TM CH GPR[1]: 1 (PASSED)
TM CH GPR[2]: 2 (PASSED)
TM CH GPR[3]: 3 (PASSED)
TM CH GPR[4]: 4 (PASSED)
TM CH GPR[5]: 5 (PASSED)
TM CH GPR[6]: 6 (PASSED)
TM CH GPR[7]: 7 (PASSED)
TM CH GPR[8]: 8 (PASSED)
TM CH GPR[9]: 9 (PASSED)
TM CH GPR[10]: a (PASSED)
TM CH GPR[11]: b (PASSED)
TM CH GPR[12]: c (PASSED)
TM CH GPR[13]: d (PASSED)
TM CH GPR[14]: e (PASSED)
TM CH GPR[15]: f (PASSED)
TM CH GPR[16]: 0 (PASSED)
TM CH GPR[17]: 1 (PASSED)
TM CH GPR[18]: 2 (PASSED)
TM CH GPR[19]: 3 (PASSED)
TM CH GPR[20]: 4 (PASSED)
TM CH GPR[21]: 5 (PASSED)
TM CH GPR[22]: 6 (PASSED)
TM CH GPR[23]: 7 (PASSED)
TM CH GPR[24]: 8 (PASSED)
TM CH GPR[25]: 9 (PASSED)
TM CH GPR[26]: a (PASSED)
TM CH GPR[27]: b (PASSED)
TM CH GPR[28]: c (PASSED)
TM CH GPR[29]: d (PASSED)
TM CH GPR[30]: e (PASSED)
TM CH GPR[31]: f (PASSED)
Testing TM checkpointed FPR:
TM CH FPSCR: 0
TM CH FPR[0]: 0 (PASSED)
TM CH FPR[1]: 1 (PASSED)
TM CH FPR[2]: 2 (PASSED)
TM CH FPR[3]: 3 (PASSED)
TM CH FPR[4]: 4 (PASSED)
TM CH FPR[5]: 5 (PASSED)
TM CH FPR[6]: 6 (PASSED)
TM CH FPR[7]: 7 (PASSED)
TM CH FPR[8]: 8 (PASSED)
TM CH FPR[9]: 9 (PASSED)
TM CH FPR[10]: a (PASSED)
TM CH FPR[11]: b (PASSED)
TM CH FPR[12]: c (PASSED)
TM CH FPR[13]: d (PASSED)
TM CH FPR[14]: e (PASSED)
TM CH FPR[15]: f (PASSED)
TM CH FPR[16]: 0 (PASSED)
TM CH FPR[17]: 1 (PASSED)
TM CH FPR[18]: 2 (PASSED)
TM CH FPR[19]: 3 (PASSED)
TM CH FPR[20]: 4 (PASSED)
TM CH FPR[21]: 5 (PASSED)
TM CH FPR[22]: 6 (PASSED)
TM CH FPR[23]: 7 (PASSED)
TM CH FPR[24]: 8 (PASSED)
TM CH FPR[25]: 9 (PASSED)
TM CH FPR[26]: a (PASSED)
TM CH FPR[27]: b (PASSED)
TM CH FPR[28]: c (PASSED)
TM CH FPR[29]: d (PASSED)
TM CH FPR[30]: e (PASSED)
TM CH FPR[31]: f (PASSED)
Testing TM running GPR:
TM RN NIP: 100011b0
TM RN LINK: 10000ea0
TM RN CCR: 4000422
TM RN GPR[0]: f (PASSED)
TM RN GPR[1]: e (PASSED)
TM RN GPR[2]: d (PASSED)
TM RN GPR[3]: c (PASSED)
TM RN GPR[4]: b (PASSED)
TM RN GPR[5]: a (PASSED)
TM RN GPR[6]: 9 (PASSED)
TM RN GPR[7]: 8 (PASSED)
TM RN GPR[8]: 7 (PASSED)
TM RN GPR[9]: 6 (PASSED)
TM RN GPR[10]: 5 (PASSED)
TM RN GPR[11]: 4 (PASSED)
TM RN GPR[12]: 3 (PASSED)
TM RN GPR[13]: 2 (PASSED)
TM RN GPR[14]: 1 (PASSED)
TM RN GPR[15]: 0 (PASSED)
TM RN GPR[16]: f (PASSED)
TM RN GPR[17]: e (PASSED)
TM RN GPR[18]: d (PASSED)
TM RN GPR[19]: c (PASSED)
TM RN GPR[20]: b (PASSED)
TM RN GPR[21]: a (PASSED)
TM RN GPR[22]: 9 (PASSED)
TM RN GPR[23]: 8 (PASSED)
TM RN GPR[24]: 7 (PASSED)
TM RN GPR[25]: 6 (PASSED)
TM RN GPR[26]: 5 (PASSED)
TM RN GPR[27]: 4 (PASSED)
TM RN GPR[28]: 3 (PASSED)
TM RN GPR[29]: 2 (PASSED)
TM RN GPR[30]: 1 (PASSED)
TM RN GPR[31]: 0 (PASSED)
Testing TM running FPR:
TM RN FPSCR: 0
TM RN FPR[0]: f (PASSED)
TM RN FPR[1]: e (PASSED)
TM RN FPR[2]: d (PASSED)
TM RN FPR[3]: c (PASSED)
TM RN FPR[4]: b (PASSED)
TM RN FPR[5]: a (PASSED)
TM RN FPR[6]: 9 (PASSED)
TM RN FPR[7]: 8 (PASSED)
TM RN FPR[8]: 7 (PASSED)
TM RN FPR[9]: 6 (PASSED)
TM RN FPR[10]: 5 (PASSED)
TM RN FPR[11]: 4 (PASSED)
TM RN FPR[12]: 3 (PASSED)
TM RN FPR[13]: 2 (PASSED)
TM RN FPR[14]: 1 (PASSED)
TM RN FPR[15]: 0 (PASSED)
TM RN FPR[16]: f (PASSED)
TM RN FPR[17]: e (PASSED)
TM RN FPR[18]: d (PASSED)
TM RN FPR[19]: c (PASSED)
TM RN FPR[20]: b (PASSED)
TM RN FPR[21]: a (PASSED)
TM RN FPR[22]: 9 (PASSED)
TM RN FPR[23]: 8 (PASSED)
TM RN FPR[24]: 7 (PASSED)
TM RN FPR[25]: 6 (PASSED)
TM RN FPR[26]: 5 (PASSED)
TM RN FPR[27]: 4 (PASSED)
TM RN FPR[28]: 3 (PASSED)
TM RN FPR[29]: 2 (PASSED)
TM RN FPR[30]: 1 (PASSED)
TM RN FPR[31]: 0 (PASSED)
Testing TM running MISC debug registers:
TM RN DSCR: 32 (PASSED)
TM RN TAR: 3c (PASSED)
TM RN PPR: 4000000000000 (PASSED)
success: tm_ptrace
Anshuman Khandual (7):
elf: Add new powerpc specifc core note sections
powerpc, process: Add the function flush_tmregs_to_thread powerpc, ptrace: Enable fpr_(get/set) for transactional memory powerpc, ptrace: Enable vr_(get/set) for transactional memory powerpc, ptrace: Enable support for transactional memory register sets powerpc, ptrace: Enable support for miscellaneous debug registers selftests, powerpc: Add test case for TM related ptrace interface
arch/powerpc/include/asm/switch_to.h | 8 + arch/powerpc/include/uapi/asm/elf.h | 3 + arch/powerpc/kernel/process.c | 20 + arch/powerpc/kernel/ptrace.c | 987 ++++++++++++++++++++++++- include/uapi/linux/elf.h | 5 + tools/testing/selftests/powerpc/tm/Makefile | 2 +- tools/testing/selftests/powerpc/tm/tm-ptrace.c | 542 ++++++++++++++ 7 files changed, 1542 insertions(+), 25 deletions(-) create mode 100644 tools/testing/selftests/powerpc/tm/tm-ptrace.c
Signature · 1 line
1.9.3
PATCH v5 1/7 elf: Add new powerpc specifc core note sections
This patch adds four new ELF core note sections for powerpc transactional memory and one new ELF core note section for powerpc general miscellaneous debug registers. These addition of new ELF core note sections extends the existing ELF ABI without affecting it in any manner.
--- include/uapi/linux/elf.h | 5 +++++ 1 file changed, 5 insertions(+)
include/uapi/linux/elf.h +5 -0
@@ -379,6 +379,11 @@ typedef struct elf64_shdr {#define NT_PPC_VMX 0x100/* PowerPC Altivec/VMX registers */ #define NT_PPC_SPE 0x101/* PowerPC SPE/EVR registers */ #define NT_PPC_VSX 0x102/* PowerPC VSX registers */ +#define NT_PPC_TM_SPR 0x103/* PowerPC TM special registers */ +#define NT_PPC_TM_CGPR 0x104/* PowerpC TM checkpointed GPR */ +#define NT_PPC_TM_CFPR 0x105/* PowerPC TM checkpointed FPR */ +#define NT_PPC_TM_CVMX 0x106/* PowerPC TM checkpointed VMX */ +#define NT_PPC_MISC 0x107/* PowerPC miscellaneous registers */ #define NT_386_TLS 0x200/* i386 TLS slots (struct user_desc) */ #define NT_386_IOPERM 0x201/* x86 io permission bitmap (1=deny) */ #define NT_X86_XSTATE 0x202/* x86 extended state using xsave */
Signature · 1 line
1.9.3
PATCH v5 2/7 powerpc, process: Add the function flush_tmregs_to_thread
In reply to Anshuman KhandualThis patch creates a function flush_tmregs_to_thread which will then be used by subsequent patches in this series. The function checks for self tracing ptrace interface attempts while in the TM context and logs appropriate warning message.
--- arch/powerpc/include/asm/switch_to.h | 8 ++++++++ arch/powerpc/kernel/process.c | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+)
arch/powerpc/include/asm/switch_to.h +8 -0
@@ -82,6 +82,14 @@ static inline void flush_spe_to_thread(struct task_struct *t) }#endif +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM +extern void flush_tmregs_to_thread (struct task_struct *); +#else +static inline void flush_tmregs_to_thread (struct task_struct *t) +{ +} +#endif +static inline void clear_task_ebb (struct task_struct *t) {#ifdef CONFIG_PPC_BOOK3S_64
arch/powerpc/kernel/process.c +20 -0
@@ -745,6 +745,26 @@ void restore_tm_state(struct pt_regs *regs)#define __switch_to_tm (prev)#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM +void flush_tmregs_to_thread (struct task_struct *tsk) +{ +/* +* Process self tracing is not yet supported through +* ptrace interface. Ptrace generic code should have +* prevented this from happening in the first place. +* Warn once here with the message, if some how it +* is attempted. +*/ +WARN_ONCE (tsk == current, +"Not expecting ptrace on self: TM regs may be incorrect\n" ); + +/* +* If task is not current, it should have been flushed +* already to it's thread_struct during __switch_to(). +*/ +} +#endif +struct task_struct *__switch_to (struct task_struct *prev,struct task_struct *new) {
Signature · 1 line
1.9.3
PATCH v5 3/7 powerpc, ptrace: Enable fpr_(get/set) for transactional memory
In reply to Anshuman KhandualThis patch enables the fpr_get which gets the running value of all the FPR registers and the fpr_set which sets the running value of of all the FPR registers to accommodate in transaction ptrace interface based requests.
--- arch/powerpc/kernel/ptrace.c | 103 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 97 insertions(+), 6 deletions(-)
arch/powerpc/kernel/ptrace.c +97 -6
@@ -357,6 +357,33 @@ static int gpr_set(struct task_struct *target, const struct user_regset *regset,return ret; } + +/* +* fpr_get +* +* When the transaction is active, 'transact_fp' holds the current running +* value of all FPR registers and 'fp_state' holds the last checkpointed +* value of all FPR registers for the current transaction. When transaction +* is not active 'fp_state' holds the current running state of all the FPR +* registers. So this function which returns the current running values of +* all the FPR registers, needs to know whether any transaction is active +* or not. +* +* Userspace interface buffer layout: +* +* struct data { +* u64 fpr[32]; +* u64 fpscr; +* }; +* +* There are two config options CONFIG_VSX and CONFIG_PPC_TRANSACTIONAL_MEM +* which determines the final code in this function. All the combinations of +* these two config options are possible except the one below as transactional +* memory config pulls in CONFIG_VSX automatically. +* +* !defined(CONFIG_VSX) && defined(CONFIG_PPC_TRANSACTIONAL_MEM) +* +*/ static int fpr_get (struct task_struct *target,const struct user_regset *regset,unsigned int pos,unsigned int count,void *kbuf,void __user *ubuf)
@@ -367,22 +394,64 @@ static int fpr_get(struct task_struct *target, const struct user_regset *regset,#endif flush_fp_to_thread (target); -#ifdef CONFIG_VSX +#if defined(CONFIG_VSX ) && defined(CONFIG_PPC_TRANSACTIONAL_MEM ) +/* copy to local buffer then write that out */ +if (MSR_TM_ACTIVE (target->thread.regs->msr)) { +flush_altivec_to_thread (target); +flush_tmregs_to_thread (target); +for (i =0 ; i <32 ; i++) + buf[i] = target->thread.TS_TRANS_FPR (i); + buf[32 ] = target->thread.transact_fp.fpscr; + }else { +for (i =0 ; i <32 ; i++) + buf[i] = target->thread.TS_FPR (i); + buf[32 ] = target->thread.fp_state.fpscr; + } +return user_regset_copyout (&pos, &count, &kbuf, &ubuf, buf,0 ,-1 ); +#endif + +#if defined(CONFIG_VSX ) && !defined(CONFIG_PPC_TRANSACTIONAL_MEM )/* copy to local buffer then write that out */ for (i =0 ; i <32 ; i++) buf[i] = target->thread.TS_FPR (i); buf[32 ] = target->thread.fp_state.fpscr;return user_regset_copyout (&pos, &count, &kbuf, &ubuf, buf,0 ,-1 ); +#endif -#else + +#if !defined(CONFIG_VSX ) && !defined(CONFIG_PPC_TRANSACTIONAL_MEM )BUILD_BUG_ON (offsetof(struct thread_fp_state , fpscr) != offsetof(struct thread_fp_state, fpr[32][0])); -return user_regset_copyout (&pos, &count, &kbuf, &ubuf, &target->thread.fp_state,0 ,-1 );#endif } +/* +* fpr_set +* +* When the transaction is active, 'transact_fp' holds the current running +* value of all FPR registers and 'fp_state' holds the last checkpointed +* value of all FPR registers for the current transaction. When transaction +* is not active 'fp_state' holds the current running state of all the FPR +* registers. So this function which setss the current running values of +* all the FPR registers, needs to know whether any transaction is active +* or not. +* +* Userspace interface buffer layout: +* +* struct data { +* u64 fpr[32]; +* u64 fpscr; +* }; +* +* There are two config options CONFIG_VSX and CONFIG_PPC_TRANSACTIONAL_MEM +* which determines the final code in this function. All the combinations of +* these two config options are possible except the one below as transactional +* memory config pulls in CONFIG_VSX automatically. +* +* !defined(CONFIG_VSX) && defined(CONFIG_PPC_TRANSACTIONAL_MEM) +*/ static int fpr_set (struct task_struct *target,const struct user_regset *regset,unsigned int pos,unsigned int count,const void *kbuf,const void __user *ubuf)
@@ -393,7 +462,27 @@ static int fpr_set(struct task_struct *target, const struct user_regset *regset,#endif flush_fp_to_thread (target); -#ifdef CONFIG_VSX +#if defined(CONFIG_VSX ) && defined(CONFIG_PPC_TRANSACTIONAL_MEM ) +/* copy to local buffer then write that out */ + i =user_regset_copyin (&pos, &count, &kbuf, &ubuf, buf,0 ,-1 ); +if (i) +return i; + +if (MSR_TM_ACTIVE (target->thread.regs->msr)) { +flush_altivec_to_thread (target); +flush_tmregs_to_thread (target); +for (i =0 ; i <32 ; i++) + target->thread.TS_TRANS_FPR (i) = buf[i]; + target->thread.transact_fp.fpscr = buf[32 ]; + }else { +for (i =0 ; i <32 ; i++) + target->thread.TS_FPR (i) = buf[i]; + target->thread.fp_state.fpscr = buf[32 ]; + } +return 0 ; +#endif + +#if defined(CONFIG_VSX ) && !defined(CONFIG_PPC_TRANSACTIONAL_MEM )/* copy to local buffer then write that out */ i =user_regset_copyin (&pos, &count, &kbuf, &ubuf, buf,0 ,-1 );if (i)
@@ -402,12 +491,14 @@ static int fpr_set(struct task_struct *target, const struct user_regset *regset, target->thread.TS_FPR (i) = buf[i]; target->thread.fp_state.fpscr = buf[32 ];return 0 ; -#else +#endif + +#if !defined(CONFIG_VSX ) && !defined(CONFIG_PPC_TRANSACTIONAL_MEM )BUILD_BUG_ON (offsetof(struct thread_fp_state , fpscr) != offsetof(struct thread_fp_state, fpr[32][0])); -return user_regset_copyin (&pos, &count, &kbuf, &ubuf, &target->thread.fp_state,0 ,-1 ); +#endif }
Signature · 1 line
1.9.3
PATCH v5 4/7 powerpc, ptrace: Enable vr_(get/set) for transactional memory
In reply to Anshuman KhandualThis patch enables the vr_get which gets the running value of all the VMX registers and the vr_set which sets the running value of of all the VMX registers to accommodate in transaction ptrace interface based requests.
--- arch/powerpc/kernel/ptrace.c | 94 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 3 deletions(-)
arch/powerpc/kernel/ptrace.c +91 -3
@@ -523,10 +523,30 @@ static int vr_active(struct task_struct *target,return target->thread.used_vr ? regset->n :0 ; } +/* +* vr_get +* +* When the transaction is active, 'transact_vr' holds the current running +* value of all the VMX registers and 'vr_state' holds the last checkpointed +* value of all the VMX registers for the current transaction to fall back +* on in case it aborts. When transaction is not active 'vr_state' holds +* the current running state of all the VMX registers. So this function which +* gets the current running values of all the VMX registers, needs to know +* whether any transaction is active or not. +* +* Userspace interface buffer layout: +* +* struct data { +* vector128 vr[32]; +* vector128 vscr; +* vector128 vrsave; +* }; +*/ static int vr_get (struct task_struct *target,const struct user_regset *regset,unsigned int pos,unsigned int count,void *kbuf,void __user *ubuf) { +struct thread_vr_state *addr;int ret;flush_altivec_to_thread (target);
@@ -534,8 +554,19 @@ static int vr_get(struct task_struct *target, const struct user_regset *regset,BUILD_BUG_ON (offsetof(struct thread_vr_state , vscr) != offsetof(struct thread_vr_state, vr[32])); +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM +if (MSR_TM_ACTIVE (target->thread.regs->msr)) { +flush_fp_to_thread (target); +flush_tmregs_to_thread (target); + addr = &target->thread.transact_vr; + }else { + addr = &target->thread.vr_state; + } +#else + addr = &target->thread.vr_state; +#endif ret =user_regset_copyout (&pos, &count, &kbuf, &ubuf, - &target->thread.vr_state,0 , + addr,0 ,33 *sizeof (vector128));if (!ret) {/*
@@ -546,7 +577,16 @@ static int vr_get(struct task_struct *target, const struct user_regset *regset,u32 word; } vrsave;memset (&vrsave,0 ,sizeof (vrsave)); + +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM +if (MSR_TM_ACTIVE (target->thread.regs->msr)) + vrsave.word = target->thread.transact_vrsave; +else + vrsave.word = target->thread.vrsave; +#else vrsave.word = target->thread.vrsave; +#endif + ret =user_regset_copyout (&pos, &count, &kbuf, &ubuf, &vrsave,33 *sizeof (vector128),-1 ); }
@@ -554,10 +594,30 @@ static int vr_get(struct task_struct *target, const struct user_regset *regset,return ret; } +/* +* vr_set +* +* When the transaction is active, 'transact_vr' holds the current running +* value of all the VMX registers and 'vr_state' holds the last checkpointed +* value of all the VMX registers for the current transaction to fall back +* on in case it aborts. When transaction is not active 'vr_state' holds +* the current running state of all the VMX registers. So this function which +* sets the current running values of all the VMX registers, needs to know +* whether any transaction is active or not. +* +* Userspace interface buffer layout: +* +* struct data { +* vector128 vr[32]; +* vector128 vscr; +* vector128 vrsave; +* }; +*/ static int vr_set (struct task_struct *target,const struct user_regset *regset,unsigned int pos,unsigned int count,const void *kbuf,const void __user *ubuf) { +struct thread_vr_state *addr;int ret;flush_altivec_to_thread (target);
@@ -565,8 +625,19 @@ static int vr_set(struct task_struct *target, const struct user_regset *regset,BUILD_BUG_ON (offsetof(struct thread_vr_state , vscr) != offsetof(struct thread_vr_state, vr[32])); +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM +if (MSR_TM_ACTIVE (target->thread.regs->msr)) { +flush_fp_to_thread (target); +flush_tmregs_to_thread (target); + addr = &target->thread.transact_vr; + }else { + addr = &target->thread.vr_state; + } +#else + addr = &target->thread.vr_state; +#endif ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, - &target->thread.vr_state,0 , + addr,0 ,33 *sizeof (vector128));if (!ret && count >0 ) {/*
@@ -577,11 +648,28 @@ static int vr_set(struct task_struct *target, const struct user_regset *regset,u32 word; } vrsave;memset (&vrsave,0 ,sizeof (vrsave)); + +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM +if (MSR_TM_ACTIVE (target->thread.regs->msr)) + vrsave.word = target->thread.transact_vrsave; +else + vrsave.word = target->thread.vrsave; +#else vrsave.word = target->thread.vrsave; +#endif ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, &vrsave,33 *sizeof (vector128),-1 ); -if (!ret) +if (!ret) { + +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM +if (MSR_TM_ACTIVE (target->thread.regs->msr)) + target->thread.transact_vrsave = vrsave.word; +else + target->thread.vrsave = vrsave.word; +#else target->thread.vrsave = vrsave.word; +#endif + } }return ret;
Signature · 1 line
1.9.3
PATCH v5 5/7 powerpc, ptrace: Enable support for transactional memory register sets
In reply to Anshuman KhandualThis patch enables get and set of transactional memory related register sets through PTRACE_GETREGSET-PTRACE_SETREGSET interface by implementing four new powerpc specific register sets i.e REGSET_TM_SPR, REGSET_TM_CGPR, REGSET_TM_CFPR, REGSET_CVMX support corresponding to these following new ELF core note types added previously in this regard.
(1) NT_PPC_TM_SPR (2) NT_PPC_TM_CGPR (3) NT_PPC_TM_CFPR (4) NT_PPC_TM_CVMX
--- arch/powerpc/include/uapi/asm/elf.h | 2 + arch/powerpc/kernel/ptrace.c | 667 +++++++++++++++++++++++++++++++++++- 2 files changed, 654 insertions(+), 15 deletions(-)
arch/powerpc/include/uapi/asm/elf.h +2 -0
@@ -91,6 +91,8 @@#define ELF_NGREG 48/* includes nip, msr, lr, etc. */ #define ELF_NFPREG 33/* includes fpscr */ +#define ELF_NVMX 34/* includes all vector registers */ +#define ELF_NTMSPRREG 7/* includes TM sprs, org_msr, dscr, tar, ppr */ typedef unsigned long elf_greg_t64 ;typedef elf_greg_t64 elf_gregset_t64 [ELF_NGREG ];
arch/powerpc/kernel/ptrace.c +652 -15
735 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH v5 6/7 powerpc, ptrace: Enable support for miscellaneous debug registers
In reply to Anshuman KhandualThis patch enables get and set of miscellaneous debug registers through ptrace PTRACE_GETREGSET-PTRACE_SETREGSET interface by implementing new powerpc specific register set REGSET_MISC support corresponding to the new ELF core note NT_PPC_MISC added previously in this regard.
--- arch/powerpc/include/uapi/asm/elf.h | 1 + arch/powerpc/kernel/ptrace.c | 123 ++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+)
arch/powerpc/include/uapi/asm/elf.h +1 -0
@@ -93,6 +93,7 @@#define ELF_NFPREG 33/* includes fpscr */ #define ELF_NVMX 34/* includes all vector registers */ #define ELF_NTMSPRREG 7/* includes TM sprs, org_msr, dscr, tar, ppr */ +#define ELF_NMISCREG 3/* includes dscr, tar, ppr */ typedef unsigned long elf_greg_t64 ;typedef elf_greg_t64 elf_gregset_t64 [ELF_NGREG ];
arch/powerpc/kernel/ptrace.c +123 -0
147 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH v5 7/7 selftests, powerpc: Add test case for TM related ptrace interface
In reply to Anshuman KhandualThis patch adds one more test case called 'tm-ptrace' targeting TM related ptrace interface. This test creates one child process to run some basic TM transactions and the parent process attaches the child to do some ptrace probing using the recently added regset interfaces. The parent process then compares the received values against the expected values to verify whether it has passed the given test or not.
--- tools/testing/selftests/powerpc/tm/Makefile | 2 +- tools/testing/selftests/powerpc/tm/tm-ptrace.c | 542 +++++++++++++++++++++++++ 2 files changed, 543 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/tm/tm-ptrace.c
tools/testing/selftests/powerpc/tm/Makefile +1 -1
@@ -1,4 +1,4 @@ -PROGS := tm-resched-dscr +PROGS := tm-resched-dscr tm-ptrace all: $(PROGS)
tools/testing/selftests/powerpc/tm/tm-ptrace.c new file +542 -0
542 lines not on this page · raw message
Signature · 1 line
1.9.3
Re: [V5 7/7] selftests, powerpc: Add test case for TM related ptrace interface
Quoted 20 lines · Anshuman Khandual
This patch adds one more test case called 'tm-ptrace' targeting TM related ptrace interface. This test creates one child process to run some basic TM transactions and the parent process attaches the child to do some ptrace probing using the recently added regset interfaces. The parent process then compares the received values against the expected values to verify whether it has passed the given test or not.
Signed-off-by Anshuman Khandual <[email protected]>--- tools/testing/selftests/powerpc/tm/Makefile | 2 +- tools/testing/selftests/powerpc/tm/tm-ptrace.c | 542 +++++++++++++++++++++++++ 2 files changed, 543 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/tm/tm-ptrace.ctools/testing/selftests/powerpc/tm/Makefile +0
-0
tools/testing/selftests/powerpc/tm/Makefile line 2
Quoted 3 lines
tools/testing/selftests/powerpc/tm/Makefile +1
-1@@ -1,4 +1,4 @@ -PROGS := tm-resched-dscr +PROGS := tm-resched-dscr tm-ptrace
Could you please add .gitignore for the binaries in this directory to avoid git status including the binaries it in its output.
thanks,
-- Shuah
Signature · 4 lines
Shuah Khan Sr. Linux Kernel Developer Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Re: [V5 7/7] selftests, powerpc: Add test case for TM related ptrace interface
Quoted 16 lines · Shuah Khan
Quoted 15 lines · Anshuman Khandual
Quoted 15 lines
This patch adds one more test case called 'tm-ptrace' targeting TM related ptrace interface. This test creates one child process to run some basic TM transactions and the parent process attaches the child to do some ptrace probing using the recently added regset interfaces. The parent process then compares the received values against the expected values to verify whether it has passed the given test or not.
Signed-off-by Anshuman Khandual <[email protected]>--- tools/testing/selftests/powerpc/tm/Makefile | 2 +- tools/testing/selftests/powerpc/tm/tm-ptrace.c | 542 +++++++++++++++++++++++++ 2 files changed, 543 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/tm/tm-ptrace.c
Quoted 10 lines
Quoted 8 lines
tools/testing/selftests/powerpc/tm/Makefile line 2
Quoted 8 lines
tools/testing/selftests/powerpc/tm/Makefile +1
-1@@ -1,4 +1,4 @@ -PROGS := tm-resched-dscr +PROGS := tm-resched-dscr tm-ptraceCould you please add .gitignore for the binaries in this directory to avoid git status including the binaries it in its output.
Sure, will add one.