[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SA6PR21MB42310EAD1D095D16A6198467CEBA2@SA6PR21MB4231.namprd21.prod.outlook.com>
Date: Wed, 23 Apr 2025 18:49:06 +0000
From: Long Li <longli@...rosoft.com>
To: Michael Kelley <mhklinux@...look.com>, "longli@...uxonhyperv.com"
<longli@...uxonhyperv.com>, KY Srinivasan <kys@...rosoft.com>, Haiyang Zhang
<haiyangz@...rosoft.com>, Wei Liu <wei.liu@...nel.org>, Dexuan Cui
<decui@...rosoft.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH 2/2] uio_hv_generic: Use correct size for interrupt and
monitor pages
> Subject: [EXTERNAL] RE: [PATCH 2/2] uio_hv_generic: Use correct size for
> interrupt and monitor pages
>
> From: longli@...uxonhyperv.com <longli@...uxonhyperv.com>
> >
> > Interrupt and monitor pages should be in Hyper-V page size (4k bytes).
> > This can be different to the system page size.
>
> I'm curious about this change. Since Patch 1 of the series changes the allocations
> to be the full PAGE_SIZE, what does it mean to set the mapping size to less than a
> full page (in the case PAGE_SIZE > HV_HYP_PAGE_SIZE)? mmap can only map full
> PAGE_SIZE pages, so uio_mmap() rounds up the INT_PAGE_MAP and
> MON_PAGE_MAP sizes to PAGE_SIZE when checking the validity of the mmap
> parameters.
>
> The changes in this patch do ensure that the INT_PAGE_MAP and
> MON_PAGE_MAP "maps" entries in sysfs always show the size as
> 4096 even if the full PAGE_SIZE is actually mapped, but I'm not sure if that
> difference is good or bad.
Kernel needs to tell the user-mode the correct length of the map. In this case, 4096 bytes are usable data regardless of what is actual mapped as long as it's >4096.
The DPDK vmbus driver uses this length to setup checks for accessing the page.
Long
>
> Michael
>
> >
> > Cc: stable@...r.kernel.org
> > Fixes: 95096f2fbd10 ("uio-hv-generic: new userspace i/o driver for
> > VMBus")
> > Signed-off-by: Long Li <longli@...rosoft.com>
> > ---
> > drivers/uio/uio_hv_generic.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/uio/uio_hv_generic.c
> > b/drivers/uio/uio_hv_generic.c index 1b19b5647495..08385b04c4ab 100644
> > --- a/drivers/uio/uio_hv_generic.c
> > +++ b/drivers/uio/uio_hv_generic.c
> > @@ -287,13 +287,13 @@ hv_uio_probe(struct hv_device *dev,
> > pdata->info.mem[INT_PAGE_MAP].name = "int_page";
> > pdata->info.mem[INT_PAGE_MAP].addr
> > = (uintptr_t)vmbus_connection.int_page;
> > - pdata->info.mem[INT_PAGE_MAP].size = PAGE_SIZE;
> > + pdata->info.mem[INT_PAGE_MAP].size = HV_HYP_PAGE_SIZE;
> > pdata->info.mem[INT_PAGE_MAP].memtype = UIO_MEM_LOGICAL;
> >
> > pdata->info.mem[MON_PAGE_MAP].name = "monitor_page";
> > pdata->info.mem[MON_PAGE_MAP].addr
> > = (uintptr_t)vmbus_connection.monitor_pages[1];
> > - pdata->info.mem[MON_PAGE_MAP].size = PAGE_SIZE;
> > + pdata->info.mem[MON_PAGE_MAP].size = HV_HYP_PAGE_SIZE;
> > pdata->info.mem[MON_PAGE_MAP].memtype = UIO_MEM_LOGICAL;
> >
> > if (channel->device_id == HV_NIC) {
> > --
> > 2.34.1
> >
Powered by blists - more mailing lists