Message ID | 20190411115623.5749-8-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/9] riscv: use asm-generic/extable.h | expand |
Στις 2019-04-11 14:56, Christoph Hellwig έγραψε: > No need to have two names for the same thing. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > arch/riscv/include/asm/ptrace.h | 21 ++++++--------------- > arch/riscv/kernel/stacktrace.c | 8 ++++---- > arch/riscv/kernel/traps.c | 2 +- > 3 files changed, 11 insertions(+), 20 deletions(-) > > diff --git a/arch/riscv/include/asm/ptrace.h > b/arch/riscv/include/asm/ptrace.h > index d35ec2f41381..9c867a4bac83 100644 > --- a/arch/riscv/include/asm/ptrace.h > +++ b/arch/riscv/include/asm/ptrace.h > @@ -70,47 +70,38 @@ struct pt_regs { > > > /* Helpers for working with the instruction pointer */ > -#define GET_IP(regs) ((regs)->sepc) > -#define SET_IP(regs, val) (GET_IP(regs) = (val)) > - > static inline unsigned long instruction_pointer(struct pt_regs *regs) > { > - return GET_IP(regs); > + return regs->sepc; > } > static inline void instruction_pointer_set(struct pt_regs *regs, > unsigned long val) > { > - SET_IP(regs, val); > + regs->sepc = val; > } > > #define profile_pc(regs) instruction_pointer(regs) > > /* Helpers for working with the user stack pointer */ > -#define GET_USP(regs) ((regs)->sp) > -#define SET_USP(regs, val) (GET_USP(regs) = (val)) > - > static inline unsigned long user_stack_pointer(struct pt_regs *regs) > { > - return GET_USP(regs); > + return regs->sp; > } > static inline void user_stack_pointer_set(struct pt_regs *regs, > unsigned long val) > { > - SET_USP(regs, val); > + regs->sp = val; > } > > /* Helpers for working with the frame pointer */ > -#define GET_FP(regs) ((regs)->s0) > -#define SET_FP(regs, val) (GET_FP(regs) = (val)) > - > static inline unsigned long frame_pointer(struct pt_regs *regs) > { > - return GET_FP(regs); > + return regs->s0; > } > static inline void frame_pointer_set(struct pt_regs *regs, > unsigned long val) > { > - SET_FP(regs, val); > + regs->s0 = val; > } > > static inline unsigned long regs_return_value(struct pt_regs *regs) > diff --git a/arch/riscv/kernel/stacktrace.c > b/arch/riscv/kernel/stacktrace.c > index a4b1d94371a0..25fe0ff81f9e 100644 > --- a/arch/riscv/kernel/stacktrace.c > +++ b/arch/riscv/kernel/stacktrace.c > @@ -33,9 +33,9 @@ static void notrace walk_stackframe(struct > task_struct *task, > unsigned long fp, sp, pc; > > if (regs) { > - fp = GET_FP(regs); > - sp = GET_USP(regs); > - pc = GET_IP(regs); > + fp = frame_pointer(regs); > + sp = user_stack_pointer(regs); > + pc = instruction_pointer(regs); > } else if (task == NULL || task == current) { > const register unsigned long current_sp __asm__ ("sp"); > fp = (unsigned long)__builtin_frame_address(0); > @@ -83,7 +83,7 @@ static void notrace walk_stackframe(struct > task_struct *task, > > if (regs) { > sp = GET_USP(regs); > - pc = GET_IP(regs); > + pc = instruction_pointer(regs); > } else if (task == NULL || task == current) { > const register unsigned long current_sp __asm__ ("sp"); > sp = current_sp; > diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c > index 24a9333dda2c..86731a2fa218 100644 > --- a/arch/riscv/kernel/traps.c > +++ b/arch/riscv/kernel/traps.c > @@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int > code, > && printk_ratelimit()) { > pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT, > tsk->comm, task_pid_nr(tsk), signo, code, addr); > - print_vma_addr(KERN_CONT " in ", GET_IP(regs)); > + print_vma_addr(KERN_CONT " in ", instruction_pointer(regs)); > pr_cont("\n"); > show_regs(regs); > } Reviewed-by: Nick Kossifidis <mick@ics.forth.gr>
Στις 2019-04-11 18:46, Nick Kossifidis έγραψε: > Στις 2019-04-11 14:56, Christoph Hellwig έγραψε: >> No need to have two names for the same thing. >> >> Signed-off-by: Christoph Hellwig <hch@lst.de> >> --- >> arch/riscv/include/asm/ptrace.h | 21 ++++++--------------- >> arch/riscv/kernel/stacktrace.c | 8 ++++---- >> arch/riscv/kernel/traps.c | 2 +- >> 3 files changed, 11 insertions(+), 20 deletions(-) >> >> diff --git a/arch/riscv/include/asm/ptrace.h >> b/arch/riscv/include/asm/ptrace.h >> index d35ec2f41381..9c867a4bac83 100644 >> --- a/arch/riscv/include/asm/ptrace.h >> +++ b/arch/riscv/include/asm/ptrace.h >> @@ -70,47 +70,38 @@ struct pt_regs { >> >> >> /* Helpers for working with the instruction pointer */ >> -#define GET_IP(regs) ((regs)->sepc) >> -#define SET_IP(regs, val) (GET_IP(regs) = (val)) >> - >> static inline unsigned long instruction_pointer(struct pt_regs *regs) >> { >> - return GET_IP(regs); >> + return regs->sepc; >> } >> static inline void instruction_pointer_set(struct pt_regs *regs, >> unsigned long val) >> { >> - SET_IP(regs, val); >> + regs->sepc = val; >> } >> >> #define profile_pc(regs) instruction_pointer(regs) >> >> /* Helpers for working with the user stack pointer */ >> -#define GET_USP(regs) ((regs)->sp) >> -#define SET_USP(regs, val) (GET_USP(regs) = (val)) >> - >> static inline unsigned long user_stack_pointer(struct pt_regs *regs) >> { >> - return GET_USP(regs); >> + return regs->sp; >> } >> static inline void user_stack_pointer_set(struct pt_regs *regs, >> unsigned long val) >> { >> - SET_USP(regs, val); >> + regs->sp = val; >> } >> >> /* Helpers for working with the frame pointer */ >> -#define GET_FP(regs) ((regs)->s0) >> -#define SET_FP(regs, val) (GET_FP(regs) = (val)) >> - >> static inline unsigned long frame_pointer(struct pt_regs *regs) >> { >> - return GET_FP(regs); >> + return regs->s0; >> } >> static inline void frame_pointer_set(struct pt_regs *regs, >> unsigned long val) >> { >> - SET_FP(regs, val); >> + regs->s0 = val; >> } >> >> static inline unsigned long regs_return_value(struct pt_regs *regs) >> diff --git a/arch/riscv/kernel/stacktrace.c >> b/arch/riscv/kernel/stacktrace.c >> index a4b1d94371a0..25fe0ff81f9e 100644 >> --- a/arch/riscv/kernel/stacktrace.c >> +++ b/arch/riscv/kernel/stacktrace.c >> @@ -33,9 +33,9 @@ static void notrace walk_stackframe(struct >> task_struct *task, >> unsigned long fp, sp, pc; >> >> if (regs) { >> - fp = GET_FP(regs); >> - sp = GET_USP(regs); >> - pc = GET_IP(regs); >> + fp = frame_pointer(regs); >> + sp = user_stack_pointer(regs); >> + pc = instruction_pointer(regs); >> } else if (task == NULL || task == current) { >> const register unsigned long current_sp __asm__ ("sp"); >> fp = (unsigned long)__builtin_frame_address(0); >> @@ -83,7 +83,7 @@ static void notrace walk_stackframe(struct >> task_struct *task, >> >> if (regs) { >> sp = GET_USP(regs); Ah just noticed this, it should be user_stack_pointer(regs) instead since you removed GET_USP. >> - pc = GET_IP(regs); >> + pc = instruction_pointer(regs); >> } else if (task == NULL || task == current) { >> const register unsigned long current_sp __asm__ ("sp"); >> sp = current_sp; >> diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c >> index 24a9333dda2c..86731a2fa218 100644 >> --- a/arch/riscv/kernel/traps.c >> +++ b/arch/riscv/kernel/traps.c >> @@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int >> code, >> && printk_ratelimit()) { >> pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT, >> tsk->comm, task_pid_nr(tsk), signo, code, addr); >> - print_vma_addr(KERN_CONT " in ", GET_IP(regs)); >> + print_vma_addr(KERN_CONT " in ", instruction_pointer(regs)); >> pr_cont("\n"); >> show_regs(regs); >> } > > Reviewed-by: Nick Kossifidis <mick@ics.forth.gr> > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
Στις 2019-04-11 18:55, Nick Kossifidis έγραψε: > Στις 2019-04-11 18:46, Nick Kossifidis έγραψε: >> Στις 2019-04-11 14:56, Christoph Hellwig έγραψε: >>> No need to have two names for the same thing. >>> >>> Signed-off-by: Christoph Hellwig <hch@lst.de> >>> --- >>> arch/riscv/include/asm/ptrace.h | 21 ++++++--------------- >>> arch/riscv/kernel/stacktrace.c | 8 ++++---- >>> arch/riscv/kernel/traps.c | 2 +- >>> 3 files changed, 11 insertions(+), 20 deletions(-) >>> >>> diff --git a/arch/riscv/include/asm/ptrace.h >>> b/arch/riscv/include/asm/ptrace.h >>> index d35ec2f41381..9c867a4bac83 100644 >>> --- a/arch/riscv/include/asm/ptrace.h >>> +++ b/arch/riscv/include/asm/ptrace.h >>> @@ -70,47 +70,38 @@ struct pt_regs { >>> >>> >>> /* Helpers for working with the instruction pointer */ >>> -#define GET_IP(regs) ((regs)->sepc) >>> -#define SET_IP(regs, val) (GET_IP(regs) = (val)) >>> - >>> static inline unsigned long instruction_pointer(struct pt_regs >>> *regs) >>> { >>> - return GET_IP(regs); >>> + return regs->sepc; >>> } >>> static inline void instruction_pointer_set(struct pt_regs *regs, >>> unsigned long val) >>> { >>> - SET_IP(regs, val); >>> + regs->sepc = val; >>> } >>> >>> #define profile_pc(regs) instruction_pointer(regs) >>> >>> /* Helpers for working with the user stack pointer */ >>> -#define GET_USP(regs) ((regs)->sp) >>> -#define SET_USP(regs, val) (GET_USP(regs) = (val)) >>> - >>> static inline unsigned long user_stack_pointer(struct pt_regs *regs) >>> { >>> - return GET_USP(regs); >>> + return regs->sp; >>> } >>> static inline void user_stack_pointer_set(struct pt_regs *regs, >>> unsigned long val) >>> { >>> - SET_USP(regs, val); >>> + regs->sp = val; >>> } >>> >>> /* Helpers for working with the frame pointer */ >>> -#define GET_FP(regs) ((regs)->s0) >>> -#define SET_FP(regs, val) (GET_FP(regs) = (val)) >>> - >>> static inline unsigned long frame_pointer(struct pt_regs *regs) >>> { >>> - return GET_FP(regs); >>> + return regs->s0; >>> } >>> static inline void frame_pointer_set(struct pt_regs *regs, >>> unsigned long val) >>> { >>> - SET_FP(regs, val); >>> + regs->s0 = val; >>> } >>> >>> static inline unsigned long regs_return_value(struct pt_regs *regs) >>> diff --git a/arch/riscv/kernel/stacktrace.c >>> b/arch/riscv/kernel/stacktrace.c >>> index a4b1d94371a0..25fe0ff81f9e 100644 >>> --- a/arch/riscv/kernel/stacktrace.c >>> +++ b/arch/riscv/kernel/stacktrace.c >>> @@ -33,9 +33,9 @@ static void notrace walk_stackframe(struct >>> task_struct *task, >>> unsigned long fp, sp, pc; >>> >>> if (regs) { >>> - fp = GET_FP(regs); >>> - sp = GET_USP(regs); >>> - pc = GET_IP(regs); >>> + fp = frame_pointer(regs); >>> + sp = user_stack_pointer(regs); >>> + pc = instruction_pointer(regs); >>> } else if (task == NULL || task == current) { >>> const register unsigned long current_sp __asm__ ("sp"); >>> fp = (unsigned long)__builtin_frame_address(0); >>> @@ -83,7 +83,7 @@ static void notrace walk_stackframe(struct >>> task_struct *task, >>> >>> if (regs) { >>> sp = GET_USP(regs); > > Ah just noticed this, it should be user_stack_pointer(regs) instead > since you removed > GET_USP. > >>> - pc = GET_IP(regs); >>> + pc = instruction_pointer(regs); >>> } else if (task == NULL || task == current) { >>> const register unsigned long current_sp __asm__ ("sp"); >>> sp = current_sp; >>> diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c >>> index 24a9333dda2c..86731a2fa218 100644 >>> --- a/arch/riscv/kernel/traps.c >>> +++ b/arch/riscv/kernel/traps.c >>> @@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int >>> code, >>> && printk_ratelimit()) { >>> pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT, >>> tsk->comm, task_pid_nr(tsk), signo, code, addr); >>> - print_vma_addr(KERN_CONT " in ", GET_IP(regs)); >>> + print_vma_addr(KERN_CONT " in ", instruction_pointer(regs)); >>> pr_cont("\n"); >>> show_regs(regs); >>> } >> >> Reviewed-by: Nick Kossifidis <mick@ics.forth.gr> >> >> _______________________________________________ >> linux-riscv mailing list >> linux-riscv@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-riscv I'm sorry I added the Reviewed-by tag too soon, I'm all in for the cleanup but I believe it's much simpler, all of these are re-defined on include/asm-generic/ptrace.h anyway, all we have to do is define GET_FP and GET_USP (or rename regs->sp to regs->usp).
On Thu, Apr 11, 2019 at 06:55:09PM +0300, Nick Kossifidis wrote: >>> @@ -83,7 +83,7 @@ static void notrace walk_stackframe(struct task_struct >>> *task, >>> >>> if (regs) { >>> sp = GET_USP(regs); > > Ah just noticed this, it should be user_stack_pointer(regs) instead since > you removed > GET_USP. It should. And given that at least my full nommu tree had plenty of buildbot exposure that made me wonder why it didn't blow up. It turns out RISC-V unconditionally selects ARCH_WANT_FRAME_POINTERS, which then turns on the FRAME_POINTER option unconditonally. So this branch is entirely dead code and I should just remove it with the next respin of the series.
On Thu, Apr 11, 2019 at 07:03:48PM +0300, Nick Kossifidis wrote: > I'm sorry I added the Reviewed-by tag too soon, I'm all in for the cleanup > but I > believe it's much simpler, all of these are re-defined on > include/asm-generic/ptrace.h anyway, all we have to do is define GET_FP and > GET_USP > (or rename regs->sp to regs->usp). We don't use include/asm-generic/ptrace.h on RISC-V, and I don't really see a good reason to start using it. Quite to the contrary, I think we can remove that file and apply a similar cleanup as in this patch to the few architectures currently using it.
Στις 2019-04-11 19:17, Christoph Hellwig έγραψε: > On Thu, Apr 11, 2019 at 07:03:48PM +0300, Nick Kossifidis wrote: >> I'm sorry I added the Reviewed-by tag too soon, I'm all in for the >> cleanup >> but I >> believe it's much simpler, all of these are re-defined on >> include/asm-generic/ptrace.h anyway, all we have to do is define >> GET_FP and >> GET_USP >> (or rename regs->sp to regs->usp). > > We don't use include/asm-generic/ptrace.h on RISC-V, and I don't really > see a good reason to start using it. Quite to the contrary, I think we > can remove that file and apply a similar cleanup as in this patch to > the > few architectures currently using it. I think the point is to avoid code-duplication and enforce a standard way of accessing these registers (these static inline functions are also used outside arch/, e.g. on syscall.c, signal.c uprobes etc). I agree that at this point what we have is not good, IMHO we should just have define macros for the register names on the arch-specific ptrace.h instead of GET/SET macros + the static inline functions should have get_ an set_ prefixes because e.g. frame_pointer can also be a variable.
On Thu, 11 Apr 2019, Christoph Hellwig wrote: > No need to have two names for the same thing. > > Signed-off-by: Christoph Hellwig <hch@lst.de> This is probably worth cleaning up across the entire tree. asm-{generic,x86,arm64,powerpc}/ptrace.h all define similar GET_IP/SET_IP macros - although it seems that arch/riscv is the only architecture that uses them. - Paul > --- > arch/riscv/include/asm/ptrace.h | 21 ++++++--------------- > arch/riscv/kernel/stacktrace.c | 8 ++++---- > arch/riscv/kernel/traps.c | 2 +- > 3 files changed, 11 insertions(+), 20 deletions(-) > > diff --git a/arch/riscv/include/asm/ptrace.h b/arch/riscv/include/asm/ptrace.h > index d35ec2f41381..9c867a4bac83 100644 > --- a/arch/riscv/include/asm/ptrace.h > +++ b/arch/riscv/include/asm/ptrace.h > @@ -70,47 +70,38 @@ struct pt_regs { > > > /* Helpers for working with the instruction pointer */ > -#define GET_IP(regs) ((regs)->sepc) > -#define SET_IP(regs, val) (GET_IP(regs) = (val)) > - > static inline unsigned long instruction_pointer(struct pt_regs *regs) > { > - return GET_IP(regs); > + return regs->sepc; > } > static inline void instruction_pointer_set(struct pt_regs *regs, > unsigned long val) > { > - SET_IP(regs, val); > + regs->sepc = val; > } > > #define profile_pc(regs) instruction_pointer(regs) > > /* Helpers for working with the user stack pointer */ > -#define GET_USP(regs) ((regs)->sp) > -#define SET_USP(regs, val) (GET_USP(regs) = (val)) > - > static inline unsigned long user_stack_pointer(struct pt_regs *regs) > { > - return GET_USP(regs); > + return regs->sp; > } > static inline void user_stack_pointer_set(struct pt_regs *regs, > unsigned long val) > { > - SET_USP(regs, val); > + regs->sp = val; > } > > /* Helpers for working with the frame pointer */ > -#define GET_FP(regs) ((regs)->s0) > -#define SET_FP(regs, val) (GET_FP(regs) = (val)) > - > static inline unsigned long frame_pointer(struct pt_regs *regs) > { > - return GET_FP(regs); > + return regs->s0; > } > static inline void frame_pointer_set(struct pt_regs *regs, > unsigned long val) > { > - SET_FP(regs, val); > + regs->s0 = val; > } > > static inline unsigned long regs_return_value(struct pt_regs *regs) > diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c > index a4b1d94371a0..25fe0ff81f9e 100644 > --- a/arch/riscv/kernel/stacktrace.c > +++ b/arch/riscv/kernel/stacktrace.c > @@ -33,9 +33,9 @@ static void notrace walk_stackframe(struct task_struct *task, > unsigned long fp, sp, pc; > > if (regs) { > - fp = GET_FP(regs); > - sp = GET_USP(regs); > - pc = GET_IP(regs); > + fp = frame_pointer(regs); > + sp = user_stack_pointer(regs); > + pc = instruction_pointer(regs); > } else if (task == NULL || task == current) { > const register unsigned long current_sp __asm__ ("sp"); > fp = (unsigned long)__builtin_frame_address(0); > @@ -83,7 +83,7 @@ static void notrace walk_stackframe(struct task_struct *task, > > if (regs) { > sp = GET_USP(regs); > - pc = GET_IP(regs); > + pc = instruction_pointer(regs); > } else if (task == NULL || task == current) { > const register unsigned long current_sp __asm__ ("sp"); > sp = current_sp; > diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c > index 24a9333dda2c..86731a2fa218 100644 > --- a/arch/riscv/kernel/traps.c > +++ b/arch/riscv/kernel/traps.c > @@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int code, > && printk_ratelimit()) { > pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT, > tsk->comm, task_pid_nr(tsk), signo, code, addr); > - print_vma_addr(KERN_CONT " in ", GET_IP(regs)); > + print_vma_addr(KERN_CONT " in ", instruction_pointer(regs)); > pr_cont("\n"); > show_regs(regs); > } > -- > 2.20.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv >
On Thu, Apr 25, 2019 at 12:13:18PM -0700, Paul Walmsley wrote: > > > On Thu, 11 Apr 2019, Christoph Hellwig wrote: > > > No need to have two names for the same thing. > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > This is probably worth cleaning up across the entire tree. > > asm-{generic,x86,arm64,powerpc}/ptrace.h all define similar GET_IP/SET_IP > macros - although it seems that arch/riscv is the only architecture that > uses them. Yes, we had that discussion before. I've started on a series for that, but it is unlikely to touch riscv.
On Thu, 25 Apr 2019, Christoph Hellwig wrote: > On Thu, Apr 25, 2019 at 12:13:18PM -0700, Paul Walmsley wrote: > > > > > > On Thu, 11 Apr 2019, Christoph Hellwig wrote: > > > > > No need to have two names for the same thing. > > > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > > > This is probably worth cleaning up across the entire tree. > > > > asm-{generic,x86,arm64,powerpc}/ptrace.h all define similar GET_IP/SET_IP > > macros - although it seems that arch/riscv is the only architecture that > > uses them. > > Yes, we had that discussion before. I've started on a series for that, > but it is unlikely to touch riscv. OK, if you're planning to post a separate series for that across the tree, then: Reviewed-by: Paul Walmsley <paul.walmsley@sifive.com> for this RISC-V patch. - Paul
diff --git a/arch/riscv/include/asm/ptrace.h b/arch/riscv/include/asm/ptrace.h index d35ec2f41381..9c867a4bac83 100644 --- a/arch/riscv/include/asm/ptrace.h +++ b/arch/riscv/include/asm/ptrace.h @@ -70,47 +70,38 @@ struct pt_regs { /* Helpers for working with the instruction pointer */ -#define GET_IP(regs) ((regs)->sepc) -#define SET_IP(regs, val) (GET_IP(regs) = (val)) - static inline unsigned long instruction_pointer(struct pt_regs *regs) { - return GET_IP(regs); + return regs->sepc; } static inline void instruction_pointer_set(struct pt_regs *regs, unsigned long val) { - SET_IP(regs, val); + regs->sepc = val; } #define profile_pc(regs) instruction_pointer(regs) /* Helpers for working with the user stack pointer */ -#define GET_USP(regs) ((regs)->sp) -#define SET_USP(regs, val) (GET_USP(regs) = (val)) - static inline unsigned long user_stack_pointer(struct pt_regs *regs) { - return GET_USP(regs); + return regs->sp; } static inline void user_stack_pointer_set(struct pt_regs *regs, unsigned long val) { - SET_USP(regs, val); + regs->sp = val; } /* Helpers for working with the frame pointer */ -#define GET_FP(regs) ((regs)->s0) -#define SET_FP(regs, val) (GET_FP(regs) = (val)) - static inline unsigned long frame_pointer(struct pt_regs *regs) { - return GET_FP(regs); + return regs->s0; } static inline void frame_pointer_set(struct pt_regs *regs, unsigned long val) { - SET_FP(regs, val); + regs->s0 = val; } static inline unsigned long regs_return_value(struct pt_regs *regs) diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index a4b1d94371a0..25fe0ff81f9e 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -33,9 +33,9 @@ static void notrace walk_stackframe(struct task_struct *task, unsigned long fp, sp, pc; if (regs) { - fp = GET_FP(regs); - sp = GET_USP(regs); - pc = GET_IP(regs); + fp = frame_pointer(regs); + sp = user_stack_pointer(regs); + pc = instruction_pointer(regs); } else if (task == NULL || task == current) { const register unsigned long current_sp __asm__ ("sp"); fp = (unsigned long)__builtin_frame_address(0); @@ -83,7 +83,7 @@ static void notrace walk_stackframe(struct task_struct *task, if (regs) { sp = GET_USP(regs); - pc = GET_IP(regs); + pc = instruction_pointer(regs); } else if (task == NULL || task == current) { const register unsigned long current_sp __asm__ ("sp"); sp = current_sp; diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c index 24a9333dda2c..86731a2fa218 100644 --- a/arch/riscv/kernel/traps.c +++ b/arch/riscv/kernel/traps.c @@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int code, && printk_ratelimit()) { pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT, tsk->comm, task_pid_nr(tsk), signo, code, addr); - print_vma_addr(KERN_CONT " in ", GET_IP(regs)); + print_vma_addr(KERN_CONT " in ", instruction_pointer(regs)); pr_cont("\n"); show_regs(regs); }
No need to have two names for the same thing. Signed-off-by: Christoph Hellwig <hch@lst.de> --- arch/riscv/include/asm/ptrace.h | 21 ++++++--------------- arch/riscv/kernel/stacktrace.c | 8 ++++---- arch/riscv/kernel/traps.c | 2 +- 3 files changed, 11 insertions(+), 20 deletions(-)