[Patch v3 0/5] Fix uio_hv_generic on systems with >4k page sizes

longli@linuxonhyperv.com posted 5 patches 7 months, 1 week ago
drivers/hv/connection.c        | 23 ++++++++++++-----
drivers/hv/hv_common.c         | 45 +++-------------------------------
drivers/uio/uio_hv_generic.c   |  7 ++++--
include/asm-generic/mshyperv.h |  4 ---
4 files changed, 25 insertions(+), 54 deletions(-)
[Patch v3 0/5] Fix uio_hv_generic on systems with >4k page sizes
Posted by longli@linuxonhyperv.com 7 months, 1 week ago
From: Long Li <longli@microsoft.com>

UIO framework requires the device memory aligned to page boundary.
Hyper-V may allocate some memory that is Hyper-V page aligned (4k)
but not system page aligned.

Fix this by having Hyper-V always allocate those pages on system page
boundary and expose them to user-mode.

Change in v2:
Added two more patches to the series:
"uio_hv_generic: Adjust ring size according to system page alignment"
"Drivers: hv: Remove hv_free/alloc_* helpers"

Added more details in the commit message of
"uio_hv_generic: Use correct size for interrupt and monitor pages"

Change in v3:
Rearranged the patch on removing hv_alloc/free* helpers
Added "Drivers: hv: Use kzalloc for panic page allocation"
Fixed typos.

Long Li (5):
  Drivers: hv: Allocate interrupt and monitor pages aligned to system
    page boundary
  uio_hv_generic: Use correct size for interrupt and monitor pages
  uio_hv_generic: Align ring size to system page
  Drivers: hv: Use kzalloc for panic page allocation
  Drivers: hv: Remove hv_alloc/free_* helpers

 drivers/hv/connection.c        | 23 ++++++++++++-----
 drivers/hv/hv_common.c         | 45 +++-------------------------------
 drivers/uio/uio_hv_generic.c   |  7 ++++--
 include/asm-generic/mshyperv.h |  4 ---
 4 files changed, 25 insertions(+), 54 deletions(-)

-- 
2.34.1
Re: [Patch v3 0/5] Fix uio_hv_generic on systems with >4k page sizes
Posted by Wei Liu 7 months, 1 week ago
On Mon, May 05, 2025 at 05:56:32PM -0700, longli@linuxonhyperv.com wrote:
> From: Long Li <longli@microsoft.com>
> 
> UIO framework requires the device memory aligned to page boundary.
> Hyper-V may allocate some memory that is Hyper-V page aligned (4k)
> but not system page aligned.
> 
> Fix this by having Hyper-V always allocate those pages on system page
> boundary and expose them to user-mode.
> 
> Change in v2:
> Added two more patches to the series:
> "uio_hv_generic: Adjust ring size according to system page alignment"
> "Drivers: hv: Remove hv_free/alloc_* helpers"
> 
> Added more details in the commit message of
> "uio_hv_generic: Use correct size for interrupt and monitor pages"
> 
> Change in v3:
> Rearranged the patch on removing hv_alloc/free* helpers
> Added "Drivers: hv: Use kzalloc for panic page allocation"
> Fixed typos.
> 
> Long Li (5):
>   Drivers: hv: Allocate interrupt and monitor pages aligned to system
>     page boundary
>   uio_hv_generic: Use correct size for interrupt and monitor pages
>   uio_hv_generic: Align ring size to system page

These patches to UIO look like small bug fixes to me.

Greg, let me know if you care enough to review them.

Given the patches surround these bug fixes, I propose to let me take
them via the Hyper-V tree.

Thanks,
Wei.

>   Drivers: hv: Use kzalloc for panic page allocation
>   Drivers: hv: Remove hv_alloc/free_* helpers
> 
>  drivers/hv/connection.c        | 23 ++++++++++++-----
>  drivers/hv/hv_common.c         | 45 +++-------------------------------
>  drivers/uio/uio_hv_generic.c   |  7 ++++--
>  include/asm-generic/mshyperv.h |  4 ---
>  4 files changed, 25 insertions(+), 54 deletions(-)
> 
> -- 
> 2.34.1
>
Re: [Patch v3 0/5] Fix uio_hv_generic on systems with >4k page sizes
Posted by Wei Liu 7 months ago
On Thu, May 08, 2025 at 06:48:28PM +0000, Wei Liu wrote:
> On Mon, May 05, 2025 at 05:56:32PM -0700, longli@linuxonhyperv.com wrote:
> > From: Long Li <longli@microsoft.com>
> > 
> > UIO framework requires the device memory aligned to page boundary.
> > Hyper-V may allocate some memory that is Hyper-V page aligned (4k)
> > but not system page aligned.
> > 
> > Fix this by having Hyper-V always allocate those pages on system page
> > boundary and expose them to user-mode.
> > 
> > Change in v2:
> > Added two more patches to the series:
> > "uio_hv_generic: Adjust ring size according to system page alignment"
> > "Drivers: hv: Remove hv_free/alloc_* helpers"
> > 
> > Added more details in the commit message of
> > "uio_hv_generic: Use correct size for interrupt and monitor pages"
> > 
> > Change in v3:
> > Rearranged the patch on removing hv_alloc/free* helpers
> > Added "Drivers: hv: Use kzalloc for panic page allocation"
> > Fixed typos.
> > 
> > Long Li (5):
> >   Drivers: hv: Allocate interrupt and monitor pages aligned to system
> >     page boundary
> >   uio_hv_generic: Use correct size for interrupt and monitor pages
> >   uio_hv_generic: Align ring size to system page
> 
> These patches to UIO look like small bug fixes to me.
> 
> Greg, let me know if you care enough to review them.
> 
> Given the patches surround these bug fixes, I propose to let me take
> them via the Hyper-V tree.

Series applied to hyperv-next-staging. Thanks.