On Wed, Feb 04, 2026 at 03:37:11PM -0800, Stefano Stabellini wrote:
> Allow multiple dom0less domains to use the console_io hypercalls to
> print to the console. Handle them in a similar way to vpl011: only the
> domain which has focus can read from the console. All domains can write
> to the console but the ones without focus have a prefix. In this case
> the prefix is applied by using guest_printk instead of printk or
> console_puts which is what the original code was already doing.
> 
> When switching focus using Ctrl-AAA, discard any unread data in the
> input buffer. Input is read quickly and the user would be aware of it
> being slow or stuck as they use Ctrl-AAA to switch focus domain.
> In that situation, it is to be expected that the unread input is lost.
> 
> The domain writes are buffered when the domain is not in focus. Push out
> the buffer after the domain enters focus on the first guest write.
> 
> Locking updates:
> 
> - Discard unread input under the lock when switching focus (including
>   when returning to Xen) so that cross-domain reads can't see stale data
> 
> - Require is_focus_domain() callers to hold console_lock, and re-check
>   focus after each chunk in the CONSOLEIO_read loop so a focus change
>   simply stops further copies without duplicating or leaking input
> 
> - Hold cons->lock while flushing buffered writes in the focus path so
>   the direct-write fast path does not race buffered guests or HVM debug
>   output
> 
> Signed-off-by: Stefano Stabellini <[email protected]>

Reviewed-by: Denis Mukhin <[email protected]> 

Reply via email to