RE: [PATCH v3 03/11] Drivers: hv: vmbus: Introduce types of GPADL

From: Michael Kelley
Date: Sat Sep 12 2020 - 15:29:50 EST

From: Boqun Feng <boqun.feng@xxxxxxxxx> Sent: Thursday, September 10, 2020 7:35 AM

> This patch introduces two types of GPADL: HV_GPADL_{BUFFER, RING}. The
> types of GPADL are purely the concept in the guest, IOW the hypervisor
> treat them as the same.
> The reason of introducing the types for GPADL is to support guests whose
> page size is not 4k (the page size of Hyper-V hypervisor). In these
> guests, both the headers and the data parts of the ringbuffers need to
> be aligned to the PAGE_SIZE, because 1) some of the ringbuffers will be
> mapped into userspace and 2) we use "double mapping" mechanism to
> support fast wrap-around, and "double mapping" relies on ringbuffers
> being page-aligned. However, the Hyper-V hypervisor only uses 4k
> (HV_HYP_PAGE_SIZE) headers. Our solution to this is that we always make
> the headers of ringbuffers take one guest page and when GPADL is
> established between the guest and hypervisor, the only first 4k of
> header is used. To handle this special case, we need the types of GPADL
> to differ different guest memory usage for GPADL.
> Type enum is introduced along with several general interfaces to
> describe the differences between normal buffer GPADL and ringbuffer
> Signed-off-by: Boqun Feng <boqun.feng@xxxxxxxxx>
> ---
> drivers/hv/channel.c | 160 +++++++++++++++++++++++++++++++++++------
> include/linux/hyperv.h | 44 +++++++++++-
> 2 files changed, 183 insertions(+), 21 deletions(-)

Reviewed-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>