[PATCH v2] riscv: fix oops caused by irq on/off tracer
Jisheng Zhang
jszhang at kernel.org
Thu Feb 10 07:37:06 PST 2022
On Thu, Feb 10, 2022 at 11:27:21PM +0800, Jisheng Zhang wrote:
> On Thu, Feb 10, 2022 at 09:37:58PM +0800, Changbin Du wrote:
> > On Thu, Feb 10, 2022 at 01:32:59AM +0800, Jisheng Zhang wrote:
> > [snip]
> > > Hi Changbin,
> > >
> > > I read the code and find that current riscv frame records during
> > > exception isn't as completed as other architectures. riscv only
> > > records frames from the ret_from_exception(). If we add completed
> > What do you mean for 'record'?
> >
>
> stack frame record.
>
> > > frame records as other arch do, then the issue you saw can also
> > > be fixed at the same time.
> > >
> > I don't think so. The problem is __builtin_return_address(1) trigger page fault
> > here.
>
> There's misunderstanding here. I interpret this bug as incomplete
> stackframes.
>
> This is current riscv stackframe during exception:
>
> high
> ----------------
> top | | <- ret_from_exception
> ----------------
> | | <- trace_hardirqs_on
> -----------------
> low
sorry, the "top" is wrongly placed.
high
----------------
| | <- ret_from_exception
----------------
| | <- trace_hardirqs_on
-----------------
top
low
>
> As you said, the CALLER_ADDR1 a.k.a __builtin_return_address(1) needs
> at least two parent call frames.
>
> If we complete the stackframes during exception as other arch does:
>
> high
> ----------------
> top | | <- the synthetic stackframe from the interrupted point
> ----------------
> .....
> ----------------
> | | <- ret_from_exception
> ----------------
> | | <- trace_hardirqs_on
> -----------------
> low
ditto
>
>
> Then we meet the "at least two parent call frames" requirement. IOW, my
> solution solve the problem from the entry.S side. One of the advantages
> would be we let interrupted point show up in dump_stack() as other arch
> do. What I'm not sure is whether it's safe to do so now since rc3 is
> released.
>
More information about the linux-riscv
mailing list