Re: [PATCH 20/20] ARC: pt_regs: create seperate type for ecr
On 8/17/23 05:09, pavel.koz...@synopsys.com wrote: Hi Vineet, I'm testing your updates and ran into the same build issue reported by the build robot. http://lists.infradead.org/pipermail/linux-snps-arc/2023-August/007522.html #define MAX_REG_OFFSET offsetof(struct pt_regs, event) This change causes a build issue for ARC700, as the event field has been removed and the MAX_REG_OFFSET macro hasn't been updated. I've posted v2 for 3 patches. Please reapply/retest the whole series. Thx, -Vineet ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH 20/20] ARC: pt_regs: create seperate type for ecr
Hi Vineet, I'm testing your updates and ran into the same build issue reported by the build robot. http://lists.infradead.org/pipermail/linux-snps-arc/2023-August/007522.html > #ifdef CONFIG_ISA_ARCOMPACT > @@ -40,18 +51,7 @@ struct pt_regs { > *Last word used by Linux for extra state mgmt > (syscall-restart) > * For interrupts, use artificial ECR values to note current > prio-level > */ > - union { > - struct { > -#ifdef CONFIG_CPU_BIG_ENDIAN > - unsigned long state:8, ecr_vec:8, > - ecr_cause:8, ecr_param:8; > -#else > - unsigned long ecr_param:8, ecr_cause:8, > - ecr_vec:8, state:8; > -#endif > - }; > - unsigned long event; > - }; > + ecr_reg ecr; > } > > #define MAX_REG_OFFSET offsetof(struct pt_regs, event) This change causes a build issue for ARC700, as the event field has been removed and the MAX_REG_OFFSET macro hasn't been updated. Regards, Pavel ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH 20/20] ARC: pt_regs: create seperate type for ecr
Hi Vineet, kernel test robot noticed the following build errors: [auto build test ERROR on vgupta-arc/for-curr] [cannot apply to vgupta-arc/for-next linus/master v6.5-rc6 next-20230809] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Vineet-Gupta/ARC-uaccess-remove-arc-specific-out-of-line-handles-for-Os/20230815-085308 base: https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git for-curr patch link: https://lore.kernel.org/r/20230815004813.555115-21-vgupta%40kernel.org patch subject: [PATCH 20/20] ARC: pt_regs: create seperate type for ecr config: arc-randconfig-r043-20230815 (https://download.01.org/0day-ci/archive/20230815/202308151342.roq9urvv-...@intel.com/config) compiler: arc-elf-gcc (GCC) 12.3.0 reproduce: (https://download.01.org/0day-ci/archive/20230815/202308151342.roq9urvv-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202308151342.roq9urvv-...@intel.com/ All errors (new ones prefixed by >>): In file included from arch/arc/include/asm/ptrace.h:11, from arch/arc/include/asm/bug.h:11, from include/linux/bug.h:5, from include/linux/page-flags.h:10, from kernel/bounds.c:10: arch/arc/include/asm/ptrace.h: In function 'regs_get_register': >> include/linux/stddef.h:16:33: error: 'struct pt_regs' has no member named >> 'event' 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) | ^~ include/linux/compiler.h:77:45: note: in definition of macro 'unlikely' 77 | # define unlikely(x)__builtin_expect(!!(x), 0) | ^ arch/arc/include/asm/ptrace.h:57:24: note: in expansion of macro 'offsetof' 57 | #define MAX_REG_OFFSET offsetof(struct pt_regs, event) |^~~~ arch/arc/include/asm/ptrace.h:164:31: note: in expansion of macro 'MAX_REG_OFFSET' 164 | if (unlikely(offset > MAX_REG_OFFSET)) | ^~ make[3]: *** [scripts/Makefile.build:116: kernel/bounds.s] Error 1 shuffle=716081594 make[3]: Target 'prepare' not remade because of errors. make[2]: *** [Makefile:1287: prepare0] Error 2 shuffle=716081594 make[2]: Target 'prepare' not remade because of errors. make[1]: *** [Makefile:234: __sub-make] Error 2 shuffle=716081594 make[1]: Target 'prepare' not remade because of errors. make: *** [Makefile:234: __sub-make] Error 2 shuffle=716081594 make: Target 'prepare' not remade because of errors. vim +16 include/linux/stddef.h 6e218287432472 Richard Knutsson 2006-09-30 14 ^1da177e4c3f41 Linus Torvalds 2005-04-16 15 #undef offsetof 14e83077d55ff4 Rasmus Villemoes 2022-03-23 @16 #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) 3876488444e712 Denys Vlasenko 2015-03-09 17 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH 20/20] ARC: pt_regs: create seperate type for ecr
Reduces duplication in each ISA specific pt_regs Signed-off-by: Vineet Gupta --- arch/arc/include/asm/ptrace.h | 45 +- arch/arc/kernel/asm-offsets.c | 2 +- arch/arc/kernel/kgdb.c | 2 +- arch/arc/kernel/ptrace.c | 4 +-- arch/arc/kernel/traps.c| 4 +-- arch/arc/kernel/troubleshoot.c | 13 +- arch/arc/mm/fault.c| 6 ++--- 7 files changed, 32 insertions(+), 44 deletions(-) diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h index 3a054b695f28..724e3fe31ed5 100644 --- a/arch/arc/include/asm/ptrace.h +++ b/arch/arc/include/asm/ptrace.h @@ -12,6 +12,17 @@ #ifndef __ASSEMBLY__ +typedef union { + struct { +#ifdef CONFIG_CPU_BIG_ENDIAN + unsigned long state:8, vec:8, cause:8, param:8; +#else + unsigned long param:8, cause:8, vec:8, state:8; +#endif + }; + unsigned long full; +} ecr_reg; + /* THE pt_regs: Defines how regs are saved during entry into kernel */ #ifdef CONFIG_ISA_ARCOMPACT @@ -40,18 +51,7 @@ struct pt_regs { * Last word used by Linux for extra state mgmt (syscall-restart) * For interrupts, use artificial ECR values to note current prio-level */ - union { - struct { -#ifdef CONFIG_CPU_BIG_ENDIAN - unsigned long state:8, ecr_vec:8, - ecr_cause:8, ecr_param:8; -#else - unsigned long ecr_param:8, ecr_cause:8, - ecr_vec:8, state:8; -#endif - }; - unsigned long event; - }; + ecr_reg ecr; }; #define MAX_REG_OFFSET offsetof(struct pt_regs, event) @@ -62,18 +62,7 @@ struct pt_regs { unsigned long orig_r0; - union { - struct { -#ifdef CONFIG_CPU_BIG_ENDIAN - unsigned long state:8, ecr_vec:8, - ecr_cause:8, ecr_param:8; -#else - unsigned long ecr_param:8, ecr_cause:8, - ecr_vec:8, state:8; -#endif - }; - unsigned long event; - }; + ecr_reg ecr;/* Exception Cause Reg */ unsigned long bta; /* erbta */ @@ -131,13 +120,13 @@ struct callee_regs { /* return 1 if PC in delay slot */ #define delay_mode(regs) ((regs->status32 & STATUS_DE_MASK) == STATUS_DE_MASK) -#define in_syscall(regs)((regs->ecr_vec == ECR_V_TRAP) && !regs->ecr_param) -#define in_brkpt_trap(regs) ((regs->ecr_vec == ECR_V_TRAP) && regs->ecr_param) +#define in_syscall(regs)((regs->ecr.vec == ECR_V_TRAP) && !regs->ecr.param) +#define in_brkpt_trap(regs) ((regs->ecr.vec == ECR_V_TRAP) && regs->ecr.param) #define STATE_SCALL_RESTARTED 0x01 -#define syscall_wont_restart(reg) (reg->state |= STATE_SCALL_RESTARTED) -#define syscall_restartable(reg) !(reg->state & STATE_SCALL_RESTARTED) +#define syscall_wont_restart(regs) (regs->ecr.state |= STATE_SCALL_RESTARTED) +#define syscall_restartable(regs) !(regs->ecr.state & STATE_SCALL_RESTARTED) #define current_pt_regs() \ ({ \ diff --git a/arch/arc/kernel/asm-offsets.c b/arch/arc/kernel/asm-offsets.c index 478768c88f46..f77deb799175 100644 --- a/arch/arc/kernel/asm-offsets.c +++ b/arch/arc/kernel/asm-offsets.c @@ -46,7 +46,7 @@ int main(void) BLANK(); DEFINE(PT_status32, offsetof(struct pt_regs, status32)); - DEFINE(PT_event, offsetof(struct pt_regs, event)); + DEFINE(PT_event, offsetof(struct pt_regs, ecr)); DEFINE(PT_bta, offsetof(struct pt_regs, bta)); DEFINE(PT_sp, offsetof(struct pt_regs, sp)); DEFINE(PT_r0, offsetof(struct pt_regs, r0)); diff --git a/arch/arc/kernel/kgdb.c b/arch/arc/kernel/kgdb.c index 345a554c..4f2b5951454f 100644 --- a/arch/arc/kernel/kgdb.c +++ b/arch/arc/kernel/kgdb.c @@ -175,7 +175,7 @@ void kgdb_trap(struct pt_regs *regs) * with trap_s 4 (compiled) breakpoints, continuation needs to * start after the breakpoint. */ - if (regs->ecr_param == 3) + if (regs->ecr.param == 3) instruction_pointer(regs) -= BREAK_INSTR_SIZE; kgdb_handle_exception(1, SIGTRAP, 0, regs); diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c index 14ea7406f5cd..e0c233c178b1 100644 --- a/arch/arc/kernel/ptrace.c +++ b/arch/arc/kernel/ptrace.c @@ -46,7 +46,7 @@ static const struct pt_regs_offset regoffset_table[] = { REG_OFFSET_NAME(r0), REG_OFFSET_NAME(sp), REG_OFFSET_NAME(orig_r0), - REG_OFFSET_NAME(event), + REG_OFFSET_NAME(ecr), REG_OFFSET_END, }; @@ -54,7 +54,7 @@ static const struct pt_regs_offset regoffset_table[] = { static const struct pt_regs_offset regoffset_table[] = { REG_OFFSET_NAME(orig_r0), -