Message ID | 1551349891-22683-1-git-send-email-vincentc@andestech.com (mailing list archive) |
---|---|
Headers | show |
Series | riscv: Fix debug instruction check and support trap-based WARN() | expand |
On Thu, 28 Feb 2019 02:31:28 PST (-0800), vincentc@andestech.com wrote: > The handler for the debug exception will call is_valid_bugaddr(bugaddr) to > check if the instruction in bugaddr is a real debug instruction. However, > the expected instruction, ebreak, is possibly translated to c.ebreak by > assmebler when C extension is supported. This patchset will add c.ebreak > into the check mechanism. In addition, BUG() is currently unable to work in > the kernel module due to an inappropriated condition in is_valid_bugaddr(). > This issue will be fixed in this patchset. Finally, this patchset enables > WARN() related functions to trap the code to help developers debug it. > > > > > > Vincent Chen (3): > riscv: Add the support for c.ebreak check in is_valid_bugaddr() > riscv: Support BUG() in kernel module > riscv: Make WARN() related functions able to trigger a trap exception I'm finding this patch set a bit hard to follow, and I think it has more diff than is necessary. For example, the first patch introduces a new die() only to have it removed by the third patch. There's also some unnecessary non-functional diff, like @@ -149,12 +161,13 @@ int is_valid_bugaddr(unsigned long pc) if (probe_kernel_address((bug_insn_t *)pc, insn)) return 0; if ((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) - return insn == __BUG_INSN_32; + return (insn == __BUG_INSN_32); else - return (insn & __COMPRESSED_INSN_MASK) == __BUG_INSN_16; + return ((insn & __COMPRESSED_INSN_MASK) == __BUG_INSN_16); } #endif /* CONFIG_GENERIC_BUG */ + void __init trap_init(void) { /* I like the idea of the patch set, though. Do you have time to clean it up and submit a v2?
On Tue, Mar 05, 2019 at 04:35:08AM +0800, Palmer Dabbelt wrote: > On Thu, 28 Feb 2019 02:31:28 PST (-0800), vincentc@andestech.com wrote: > > The handler for the debug exception will call is_valid_bugaddr(bugaddr) to > > check if the instruction in bugaddr is a real debug instruction. However, > > the expected instruction, ebreak, is possibly translated to c.ebreak by > > assmebler when C extension is supported. This patchset will add c.ebreak > > into the check mechanism. In addition, BUG() is currently unable to work in > > the kernel module due to an inappropriated condition in is_valid_bugaddr(). > > This issue will be fixed in this patchset. Finally, this patchset enables > > WARN() related functions to trap the code to help developers debug it. > > > > > > > > > > > > Vincent Chen (3): > > riscv: Add the support for c.ebreak check in is_valid_bugaddr() > > riscv: Support BUG() in kernel module > > riscv: Make WARN() related functions able to trigger a trap exception > > I'm finding this patch set a bit hard to follow, and I think it has more diff > than is necessary. For example, the first patch introduces a new die() only to > have it removed by the third patch. There's also some unnecessary > non-functional diff, like > > @@ -149,12 +161,13 @@ int is_valid_bugaddr(unsigned long pc) > if (probe_kernel_address((bug_insn_t *)pc, insn)) > return 0; > if ((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) > - return insn == __BUG_INSN_32; > + return (insn == __BUG_INSN_32); > else > - return (insn & __COMPRESSED_INSN_MASK) == __BUG_INSN_16; > + return ((insn & __COMPRESSED_INSN_MASK) == __BUG_INSN_16); > } > #endif /* CONFIG_GENERIC_BUG */ > > + > void __init trap_init(void) > { > /* > > I like the idea of the patch set, though. Do you have time to clean it up and > submit a v2? OK, I will improve it and submit a v2 patch.