On 14.03.2023 15:27, Michal Orzel wrote:
> At the moment, we direct serial input to hardware domain by default.
> This does not make any sense when running in true dom0less mode, since
> such domain does not exist. As a result, users wishing to write to
> an emulated UART of a domU are always forced to execute CTRL-AAA first.
> The same issue is when rotating among serial inputs, where we always
> have to go through hardware domain case.
> 
> Modify switch_serial_input() so that, if there is no hardware domain
> (i.e. true dom0less case) and console_rx is 1 (i.e. input to hwdom),
> we skip it and move to the next serial input.
> 
> Signed-off-by: Michal Orzel <michal.or...@amd.com>

Makes sense, but I think there are more things to consider.

> --- a/xen/drivers/char/console.c
> +++ b/xen/drivers/char/console.c
> @@ -491,6 +491,14 @@ static void switch_serial_input(void)
>      else
>      {
>          console_rx++;
> +
> +        /*
> +         * Skip switching serial input to hardware domain if it does not 
> exist
> +         * (i.e. true dom0less mode).
> +         */
> +        if ( !hardware_domain && (console_rx == 1) )
> +            console_rx++;

The consumers of this variable aren't really serialized with this
updating. That's probably okay-ish prior to your change, but now
there can be two updates in rapid succession. I think it would be
better if the variable was written only once here.

>          printk("*** Serial input to DOM%d", console_rx - 1);

When invoked from console_endboot() this will now switch to Dom1,
i.e. that domain becomes kind of "preferred", which I think is
wrong. Instead I think in such a case we should direct input to
Xen by default.

And then I have a question about Dom<N> lifetime in dom0less: Can
such domains be short-lived? If yes, what you do here for Dom0
would likely want generalizing, to skip any domain that doesn't
exist (anymore).

Jan

Reply via email to