On 13/03/2025 3:30 pm, Roger Pau Monne wrote:
> diff --git a/xen/common/wait.c b/xen/common/wait.c
> index cb6f5ff3c20a..2fcbbe8d0c71 100644
> --- a/xen/common/wait.c
> +++ b/xen/common/wait.c
> @@ -170,6 +162,54 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
> : "0" (0), "1" (cpu_info), "2" (wqv->stack),
> [sz] "i" (PAGE_SIZE)
> : "memory", "rax", "rdx", "r8", "r9", "r10", "r11" );
> +}
> +
> +/*
> + * Since context_save() is noinline, context_restore() must also be noinline,
> + * to balance the RET vs CALL instructions.
Why are you caring about balancing CALLs and RETs?
This infrastructure exists for cases which don't.
> +#ifdef CONFIG_SELF_TESTS
> +static void __init __constructor test_save_restore_ctx(void)
> +{
> + static unsigned int __initdata count;
> + struct waitqueue_vcpu wqv = {};
> +
> + wqv.stack = alloc_xenheap_page();
> + if ( !wqv.stack )
> + panic("unable to allocate memory for context selftest\n");
> +
> + context_save(&wqv);
> + if ( !count++ )
> + context_restore(&wqv);
> +
> + if ( count != 2 )
> + panic("context save and restore not working as expected\n");
> +
> + free_xenheap_page(wqv.stack);
> +}
> +#endif
The wait infrastructure is incompatible with CET-SS. (yet another
reason why I want to delete it.)
The only reason this wont blow up in CI because shadow stacks are
enabled later in boot, but I was hoping to change this with FRED.
~Andrew