diff mbox series

[v9,5/5] xen/riscv: test basic handling stuff

Message ID 62cce91351f00f80cb1c7701906e2d8cd3301ec1.1719918148.git.oleksii.kurochko@gmail.com (mailing list archive)
State Superseded
Headers show
Series RISCV basic exception handling implementation | expand

Commit Message

Oleksii Kurochko July 2, 2024, 11:23 a.m. UTC
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/setup.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Jan Beulich July 10, 2024, 10:06 a.m. UTC | #1
On 02.07.2024 13:23, Oleksii Kurochko wrote:
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> Acked-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  xen/arch/riscv/setup.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
> index a6a29a1508..4f06203b46 100644
> --- a/xen/arch/riscv/setup.c
> +++ b/xen/arch/riscv/setup.c
> @@ -19,6 +19,20 @@ void arch_get_xen_caps(xen_capabilities_info_t *info)
>  unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
>      __aligned(STACK_SIZE);
>  
> +static void test_run_in_exception(const struct cpu_user_regs *regs)
> +{
> +    printk("If you see this message, ");
> +    printk("run_in_exception_handler is most likely working\n");
> +}
> +
> +static void test_macros_from_bug_h(void)
> +{
> +    run_in_exception_handler(test_run_in_exception);
> +    WARN();
> +    printk("If you see this message, ");
> +    printk("WARN is most likely working\n");
> +}

While for the moment this may be okay, in the longer run WARN() will cause
quite a bit of output that you don't want on every boot. The further plans
here will want mentioning in the description.

Additionally as part of re-basing I think you would have wanted to put this
under the (relatively new) SELF_TESTS Kconfig control.

Jan

> @@ -26,6 +40,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
>  
>      trap_init();
>  
> +    test_macros_from_bug_h();
> +
>      printk("All set up\n");
>  
>      for ( ;; )
Jan Beulich July 10, 2024, 10:07 a.m. UTC | #2
On 10.07.2024 12:06, Jan Beulich wrote:
> On 02.07.2024 13:23, Oleksii Kurochko wrote:
>> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
>> Acked-by: Alistair Francis <alistair.francis@wdc.com>
>> ---
>>  xen/arch/riscv/setup.c | 16 ++++++++++++++++
>>  1 file changed, 16 insertions(+)
>>
>> diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
>> index a6a29a1508..4f06203b46 100644
>> --- a/xen/arch/riscv/setup.c
>> +++ b/xen/arch/riscv/setup.c
>> @@ -19,6 +19,20 @@ void arch_get_xen_caps(xen_capabilities_info_t *info)
>>  unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
>>      __aligned(STACK_SIZE);
>>  
>> +static void test_run_in_exception(const struct cpu_user_regs *regs)
>> +{
>> +    printk("If you see this message, ");
>> +    printk("run_in_exception_handler is most likely working\n");
>> +}
>> +
>> +static void test_macros_from_bug_h(void)
>> +{
>> +    run_in_exception_handler(test_run_in_exception);
>> +    WARN();
>> +    printk("If you see this message, ");
>> +    printk("WARN is most likely working\n");
>> +}
> 
> While for the moment this may be okay, in the longer run WARN() will cause
> quite a bit of output that you don't want on every boot. The further plans
> here will want mentioning in the description.
> 
> Additionally as part of re-basing I think you would have wanted to put this
> under the (relatively new) SELF_TESTS Kconfig control.

Oh, and: Is it possible there's a word ("exception"?) missing from the title?

Jan
Oleksii Kurochko July 11, 2024, 8:53 a.m. UTC | #3
On Wed, 2024-07-10 at 12:07 +0200, Jan Beulich wrote:
> On 10.07.2024 12:06, Jan Beulich wrote:
> > On 02.07.2024 13:23, Oleksii Kurochko wrote:
> > > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> > > Acked-by: Alistair Francis <alistair.francis@wdc.com>
> > > ---
> > >  xen/arch/riscv/setup.c | 16 ++++++++++++++++
> > >  1 file changed, 16 insertions(+)
> > > 
> > > diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
> > > index a6a29a1508..4f06203b46 100644
> > > --- a/xen/arch/riscv/setup.c
> > > +++ b/xen/arch/riscv/setup.c
> > > @@ -19,6 +19,20 @@ void arch_get_xen_caps(xen_capabilities_info_t
> > > *info)
> > >  unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
> > >      __aligned(STACK_SIZE);
> > >  
> > > +static void test_run_in_exception(const struct cpu_user_regs
> > > *regs)
> > > +{
> > > +    printk("If you see this message, ");
> > > +    printk("run_in_exception_handler is most likely working\n");
> > > +}
> > > +
> > > +static void test_macros_from_bug_h(void)
> > > +{
> > > +    run_in_exception_handler(test_run_in_exception);
> > > +    WARN();
> > > +    printk("If you see this message, ");
> > > +    printk("WARN is most likely working\n");
> > > +}
> > 
> > While for the moment this may be okay, in the longer run WARN()
> > will cause
> > quite a bit of output that you don't want on every boot. The
> > further plans
> > here will want mentioning in the description.
> > 
> > Additionally as part of re-basing I think you would have wanted to
> > put this
> > under the (relatively new) SELF_TESTS Kconfig control.
I will consider SELF_TESTS Kconfig, there is not a lot of sense to
print that every boot.

> 
> Oh, and: Is it possible there's a word ("exception"?) missing from
> the title?
Yes, I missed that. I will update the title to: " test basic exception
handling stuff ". Thanks.

~ Oleksii
diff mbox series

Patch

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index a6a29a1508..4f06203b46 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -19,6 +19,20 @@  void arch_get_xen_caps(xen_capabilities_info_t *info)
 unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
     __aligned(STACK_SIZE);
 
+static void test_run_in_exception(const struct cpu_user_regs *regs)
+{
+    printk("If you see this message, ");
+    printk("run_in_exception_handler is most likely working\n");
+}
+
+static void test_macros_from_bug_h(void)
+{
+    run_in_exception_handler(test_run_in_exception);
+    WARN();
+    printk("If you see this message, ");
+    printk("WARN is most likely working\n");
+}
+
 void __init noreturn start_xen(unsigned long bootcpu_id,
                                paddr_t dtb_addr)
 {
@@ -26,6 +40,8 @@  void __init noreturn start_xen(unsigned long bootcpu_id,
 
     trap_init();
 
+    test_macros_from_bug_h();
+
     printk("All set up\n");
 
     for ( ;; )