Message ID | b2f6ed2cd9f02c9f21b716595a158906499a22eb.1675441720.git.oleksii.kurochko@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | introduce generic implementation of macros from bug.h | expand |
On 03.02.2023 18:05, Oleksii Kurochko wrote:
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Is there anything keeping x86 from also using the generic do_bug_frame()?
If not, switching over would then likely mean no need for the new Kconfig
control.
Jan
On Mon, 2023-02-13 at 14:10 +0100, Jan Beulich wrote: > On 03.02.2023 18:05, Oleksii Kurochko wrote: > > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> > > Is there anything keeping x86 from also using the generic > do_bug_frame()? > If not, switching over would then likely mean no need for the new > Kconfig > control. > Actually, it seems that it is possible to re-use bug_frame in x86 code too. Looking at lines 1188 - 1264 [1] they are mostly the same [2] except for updating of eip [3], processing of BUGFRAME_bug - was added debugger_trap_fatal [4] and multiple usages of fixup_exception_return() [5]. But all this stuff can be processed outside do_bug_frame() function... [1] https://gitlab.com/xen-project/people/olkur/xen/-/blob/staging/xen/arch/x86/traps.c#L1188 [2] https://gitlab.com/xen-project/people/olkur/xen/-/blob/generic-bug-h/xen/common/bug.c#L10 [3]https://gitlab.com/xen-project/people/olkur/xen/-/blob/staging/xen/arch/x86/traps.c#L1211 [4] https://gitlab.com/xen-project/people/olkur/xen/-/blob/staging/xen/arch/x86/traps.c#L1244 [5] https://gitlab.com/xen-project/people/olkur/xen/-/blob/staging/xen/arch/x86/traps.c#L1217 > Jan
diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c index c27cbb2304..18ff2a443b 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -27,6 +27,7 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +#include <xen/bug.h> #include <xen/types.h> #include <xen/errno.h> #include <xen/delay.h> @@ -35,7 +36,6 @@ #include <xen/sched.h> #include <xen/timer.h> #include <xen/xmalloc.h> -#include <asm/bug.h> #include <asm/msr.h> #include <asm/io.h> #include <asm/processor.h> diff --git a/xen/arch/x86/include/asm/asm_defns.h b/xen/arch/x86/include/asm/asm_defns.h index d9431180cf..a8526cf36c 100644 --- a/xen/arch/x86/include/asm/asm_defns.h +++ b/xen/arch/x86/include/asm/asm_defns.h @@ -6,7 +6,7 @@ /* NB. Auto-generated from arch/.../asm-offsets.c */ #include <asm/asm-offsets.h> #endif -#include <asm/bug.h> +#include <xen/bug.h> #include <asm/x86-defns.h> #include <xen/stringify.h> #include <asm/cpufeature.h> diff --git a/xen/arch/x86/include/asm/bug.h b/xen/arch/x86/include/asm/bug.h index b7265bdfbe..6ead21d9fe 100644 --- a/xen/arch/x86/include/asm/bug.h +++ b/xen/arch/x86/include/asm/bug.h @@ -1,19 +1,10 @@ #ifndef __X86_BUG_H__ #define __X86_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__ +#define BUG_FRAME_STUFF + struct bug_frame { signed int loc_disp:BUG_DISP_WIDTH; unsigned int line_hi:BUG_LINE_HI_WIDTH; @@ -58,13 +49,6 @@ struct bug_frame { :: _ASM_BUGFRAME_INFO(type, line, ptr, msg) ); \ } while (0) - -#define WARN() BUG_FRAME(BUGFRAME_warn, __LINE__, __FILE__, 0, NULL) -#define BUG() do { \ - BUG_FRAME(BUGFRAME_bug, __LINE__, __FILE__, 0, NULL); \ - unreachable(); \ -} while (0) - /* * TODO: untangle header dependences, break BUILD_BUG_ON() out of xen/lib.h, * and use a real static inline here to get proper type checking of fn(). @@ -75,19 +59,7 @@ struct bug_frame { BUG_FRAME(BUGFRAME_run_fn, 0, fn, 0, NULL); \ } while ( 0 ) -#define assert_failed(msg) do { \ - BUG_FRAME(BUGFRAME_assert, __LINE__, __FILE__, 1, msg); \ - unreachable(); \ -} while (0) - -extern const struct bug_frame __start_bug_frames[], - __stop_bug_frames_0[], - __stop_bug_frames_1[], - __stop_bug_frames_2[], - __stop_bug_frames_3[]; - #else /* !__ASSEMBLY__ */ - /* * Construct a bugframe, suitable for using in assembly code. Should always * match the C version above. One complication is having to stash the strings
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> --- xen/arch/x86/acpi/cpufreq/cpufreq.c | 2 +- xen/arch/x86/include/asm/asm_defns.h | 2 +- xen/arch/x86/include/asm/bug.h | 32 ++-------------------------- 3 files changed, 4 insertions(+), 32 deletions(-)