|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v1 1/4] xen: introduce CONFIG_GENERIC_BUG_FRAME
On 13/02/2023 13:30, Jan Beulich wrote: On 13.02.2023 14:19, Julien Grall wrote:On 13/02/2023 12:24, Jan Beulich wrote:On 03.02.2023 18:05, Oleksii Kurochko wrote:--- /dev/null +++ b/xen/common/bug.c @@ -0,0 +1,88 @@ +#include <xen/bug.h> +#include <xen/errno.h> +#include <xen/types.h> +#include <xen/kernel.h>Please order headers alphabetically unless there's anything preventing that from being done.+#include <xen/string.h> +#include <xen/virtual_region.h> + +#include <asm/processor.h> + +int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc)I know Arm is using vaddr_t and RISC-V now also has it, but in UNIX-like environments that's redundant with "unsigned long", and it's also redundant with C99's uintptr_t. Hence when seeing the type I always wonder whether it's really a host virtual address which is meant (and not perhaps a guest one, which in principle could differ from the host one for certain guest types). In any event the existence of this type should imo not be a prereq to using this generic piece of infrastructureC spec aside, the use "unsigned long" is quite overloaded within Xen. Although, this has improved since we introduced mfn_t/gfn_t. In the future, I could imagine us to also introduce typesafe for vaddr_t, reducing further the risk to mix different meaning of unsigned long. Therefore, I think the introduction of vaddr_t should be a prereq for using the generic piece of infrastructure.Would be nice if other maintainers could share their thoughts here. I, for one, would view a typesafe gaddr_t as reasonable, and perhaps also a typesafe gvaddr_t, but hypervisor addresses should be fine as void * or unsigned long. See my answer to Andrew. --- /dev/null +++ b/xen/include/xen/bug.h @@ -0,0 +1,127 @@ +#ifndef __XEN_BUG_H__ +#define __XEN_BUG_H__ + +#define BUG_DISP_WIDTH 24 +#define BUG_LINE_LO_WIDTH (31 - BUG_DISP_WIDTH) +#define BUG_LINE_HI_WIDTH (31 - BUG_DISP_WIDTH) + +#define BUGFRAME_run_fn 0 +#define BUGFRAME_warn 1 +#define BUGFRAME_bug 2 +#define BUGFRAME_assert 3 + +#define BUGFRAME_NR 4 + +#ifndef __ASSEMBLY__ + +#include <xen/errno.h> +#include <xen/stringify.h> +#include <xen/types.h> +#include <xen/lib.h>Again - please sort headers. It makes clear of the padding (which would have been hidden) when using .p2align 2. Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |