All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: mhklinux@outlook.com
Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	James.Bottomley@hansenpartnership.com,
	martin.petersen@oracle.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-scsi@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net 2/5] hv_netvsc: Use vmbus_sendpacket_mpb_desc() to send VMBus messages
Date: Wed, 14 May 2025 10:37:51 +0100	[thread overview]
Message-ID: <20250514093751.GF3339421@horms.kernel.org> (raw)
In-Reply-To: <20250513000604.1396-3-mhklinux@outlook.com>

On Mon, May 12, 2025 at 05:06:01PM -0700, mhkelley58@gmail.com wrote:
> From: Michael Kelley <mhklinux@outlook.com>
> 
> netvsc currently uses vmbus_sendpacket_pagebuffer() to send VMBus
> messages. This function creates a series of GPA ranges, each of which
> contains a single PFN. However, if the rndis header in the VMBus
> message crosses a page boundary, the netvsc protocol with the host
> requires that both PFNs for the rndis header must be in a single "GPA
> range" data structure, which isn't possible with
> vmbus_sendpacket_pagebuffer(). As the first step in fixing this, add a
> new function netvsc_build_mpb_array() to build a VMBus message with
> multiple GPA ranges, each of which may contain multiple PFNs. Use
> vmbus_sendpacket_mpb_desc() to send this VMBus message to the host.
> 
> There's no functional change since higher levels of netvsc don't
> maintain or propagate knowledge of contiguous PFNs. Based on its
> input, netvsc_build_mpb_array() still produces a separate GPA range
> for each PFN and the behavior is the same as with
> vmbus_sendpacket_pagebuffer(). But the groundwork is laid for a
> subsequent patch to provide the necessary grouping.
> 
> Cc: <stable@vger.kernel.org> # 6.1.x
> Signed-off-by: Michael Kelley <mhklinux@outlook.com>
> ---
>  drivers/net/hyperv/netvsc.c | 50 +++++++++++++++++++++++++++++++++----
>  1 file changed, 45 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
> index d6f5b9ea3109..6d1705f87682 100644
> --- a/drivers/net/hyperv/netvsc.c
> +++ b/drivers/net/hyperv/netvsc.c
> @@ -1055,6 +1055,42 @@ static int netvsc_dma_map(struct hv_device *hv_dev,
>  	return 0;
>  }
>  
> +/* Build an "array" of mpb entries describing the data to be transferred
> + * over VMBus. After the desc header fields, each "array" entry is variable
> + * size, and each entry starts after the end of the previous entry. The
> + * "offset" and "len" fields for each entry imply the size of the entry.
> + *
> + * The pfns are in HV_HYP_PAGE_SIZE, because all communication with Hyper-V
> + * uses that granularity, even if the system page size of the guest is larger.
> + * Each entry in the input "pb" array must describe a contiguous range of
> + * guest physical memory so that the pfns are sequential if the range crosses
> + * a page boundary. The offset field must be < HV_HYP_PAGE_SIZE.

Hi Michael,

Is there a guarantee that this constraint is met. And moreover, is there a
guarantee that all of the entries will fit in desc? I am slightly concerned
that there may be an overrun lurking here.

...

  reply	other threads:[~2025-05-14  9:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13  0:05 [PATCH net 0/5] hv_netvsc: Fix error "nvsp_rndis_pkt_complete error status: 2" mhkelley58
2025-05-13  0:06 ` [PATCH net 1/5] Drivers: hv: Allow vmbus_sendpacket_mpb_desc() to create multiple ranges mhkelley58
2025-05-15 10:51   ` Simon Horman
2025-05-13  0:06 ` [PATCH net 2/5] hv_netvsc: Use vmbus_sendpacket_mpb_desc() to send VMBus messages mhkelley58
2025-05-14  9:37   ` Simon Horman [this message]
2025-05-14 15:44     ` Michael Kelley
2025-05-15 10:50       ` Simon Horman
2025-05-13  0:06 ` [PATCH net 3/5] hv_netvsc: Preserve contiguous PFN grouping in the page buffer array mhkelley58
2025-05-14  9:34   ` Simon Horman
2025-05-14 15:42     ` Michael Kelley
2025-05-15 10:40       ` Simon Horman
2025-05-13  0:06 ` [PATCH net 4/5] hv_netvsc: Remove rmsg_pgcnt mhkelley58
2025-05-15 10:55   ` Simon Horman
2025-05-13  0:06 ` [PATCH net 5/5] Drivers: hv: vmbus: Remove vmbus_sendpacket_pagebuffer() mhkelley58
2025-05-15  3:00 ` [PATCH net 0/5] hv_netvsc: Fix error "nvsp_rndis_pkt_complete error status: 2" patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250514093751.GF3339421@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=edumazet@google.com \
    --cc=haiyangz@microsoft.com \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mhklinux@outlook.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.