Re: [PATCH 1/2] Drivers: hv: vmbus: Wait for offers during boot
From: Easwar Hariharan
Date: Fri Oct 18 2024 - 18:53:07 EST
On 10/18/2024 4:58 AM, Naman Jain wrote:
> Channels offers are requested during vmbus initialization and resume
> from hibernation. Add support to wait for all channel offers to be
> delivered and processed before returning from vmbus_request_offers.
> This is to support user mode (VTL0) in OpenHCL (A Linux based
> paravisor for Confidential VMs) to ensure that all channel offers
> are present when init begins in VTL0, and it knows which channels
> the host has offered and which it has not.
>
> This is in analogy to a PCI bus not returning from probe until it has
> scanned all devices on the bus.
>
> Without this, user mode can race with vmbus initialization and miss
> channel offers. User mode has no way to work around this other than
> sleeping for a while, since there is no way to know when vmbus has
> finished processing offers.
>
> With this added functionality, remove earlier logic which keeps track
> of count of offered channels post resume from hibernation. Once all
> offers delivered message is received, no further offers are going to
> be received. Consequently, logic to prevent suspend from happening
> after previous resume had missing offers, is also removed.
>
> Co-developed-by: John Starks <jostarks@xxxxxxxxxxxxx>
> Signed-off-by: John Starks <jostarks@xxxxxxxxxxxxx>
> Signed-off-by: Naman Jain <namjain@xxxxxxxxxxxxxxxxxxx>
> ---
> drivers/hv/channel_mgmt.c | 38 +++++++++++++++++++++++---------------
> drivers/hv/connection.c | 4 ++--
> drivers/hv/hyperv_vmbus.h | 14 +++-----------
> drivers/hv/vmbus_drv.c | 16 ----------------
> 4 files changed, 28 insertions(+), 44 deletions(-)
Looks good to me.
Reviewed-by: Easwar Hariharan <eahariha@xxxxxxxxxxxxxxxxxxx>