|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] xen/riscv: look up exception table entries by faulting address
> fixup_exception() searched the exception table with a key built on its
> own stack: key.insn = pc - &key.insn, the distance from the key.insn
> field to pc. key.insn is an int32_t, so this only works while the stack
> is within 2 GiB of Xen's text. Today that holds, as Xen runs on
> cpu0_boot_stack, which is part of the Xen image, and the existing users
> (csr_read_safe() and the A/D update probe) run at boot.
>
> It stops holding once Xen runs on vCPU stacks: these are allocated with
> vzalloc() in arch_vcpu_create() and sit in the VMAP area, far more than
> 2 GiB away from Xen's text. The distance is then truncated, the address
> the key decodes to lands next to the stack rather than in Xen's text,
> and bsearch() misses the entry, so a fault that is meant to be recovered
> from reaches the BUG_ON() or do_unexpected_trap() in do_trap() and stops
> Xen.
>
> Pass the faulting address itself as the key, with a comparator that
> takes it as such. The entries keep their relative encoding.
>
> Fixes: a651dabf873d ("xen/riscv: add exception table support")
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Bruno Verachten <gounthar@xxxxxxxxx>
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
I think you are more like a Co-developer of this patches rather than a
submitter based on our internal review. A Co-developer trailer + your
Signed-off-by would fit better imo.
> [ ... 12 lines skipped ... ]
> --- a/xen/arch/riscv/extable.c
> +++ b/xen/arch/riscv/extable.c
> @@ -42,6 +42,20 @@ static int cf_check cmp_ex(const void *a, const void *b)
> return (insn_a > insn_b) - (insn_a < insn_b);
> }
>
> +/*
> + * bsearch() comparator looking up an exception table entry by address.
> + *
> + * pc_ptr - pointer to the faulting address
> + * ex - exception table entry to compare it with
Arguments in Xen comments follow the kernel-doc form, "@name:
description" (e.g. asm/bitops.h). The "name - description" form is only
used for the function name on the first line. That first line is also
over 80 columns. Something like:
/*
* cmp_ex_addr - bsearch() comparator finding an extable entry by address
* @pc_ptr: pointer to the faulting address
* @ex: exception table entry to compare it with
*/
would fit better imo.
--
Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx>
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |