lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN8PR21MB128403BCF7A491E55F8E2B26CA709@BN8PR21MB1284.namprd21.prod.outlook.com>
Date:   Thu, 9 Dec 2021 20:40:02 +0000
From:   Haiyang Zhang <haiyangz@...rosoft.com>
To:     "Michael Kelley (LINUX)" <mikelley@...rosoft.com>,
        Tianyu Lan <ltykernel@...il.com>,
        KY Srinivasan <kys@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        "wei.liu@...nel.org" <wei.liu@...nel.org>,
        Dexuan Cui <decui@...rosoft.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "bp@...en8.de" <bp@...en8.de>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "x86@...nel.org" <x86@...nel.org>, "hpa@...or.com" <hpa@...or.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>,
        "arnd@...db.de" <arnd@...db.de>,
        "hch@...radead.org" <hch@...radead.org>,
        "m.szyprowski@...sung.com" <m.szyprowski@...sung.com>,
        "robin.murphy@....com" <robin.murphy@....com>,
        Tianyu Lan <Tianyu.Lan@...rosoft.com>,
        "thomas.lendacky@....com" <thomas.lendacky@....com>
CC:     "iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        vkuznets <vkuznets@...hat.com>,
        "brijesh.singh@....com" <brijesh.singh@....com>,
        "konrad.wilk@...cle.com" <konrad.wilk@...cle.com>,
        "hch@....de" <hch@....de>, "joro@...tes.org" <joro@...tes.org>,
        "parri.andrea@...il.com" <parri.andrea@...il.com>,
        "dave.hansen@...el.com" <dave.hansen@...el.com>
Subject: RE: [PATCH V6 5/5] net: netvsc: Add Isolation VM support for netvsc
 driver



> -----Original Message-----
> From: Michael Kelley (LINUX) <mikelley@...rosoft.com>
> Sent: Thursday, December 9, 2021 2:54 PM
> To: Haiyang Zhang <haiyangz@...rosoft.com>; Tianyu Lan <ltykernel@...il.com>; KY
> Srinivasan <kys@...rosoft.com>; Stephen Hemminger <sthemmin@...rosoft.com>;
> wei.liu@...nel.org; Dexuan Cui <decui@...rosoft.com>; tglx@...utronix.de; mingo@...hat.com;
> bp@...en8.de; dave.hansen@...ux.intel.com; x86@...nel.org; hpa@...or.com;
> davem@...emloft.net; kuba@...nel.org; jejb@...ux.ibm.com; martin.petersen@...cle.com;
> arnd@...db.de; hch@...radead.org; m.szyprowski@...sung.com; robin.murphy@....com; Tianyu
> Lan <Tianyu.Lan@...rosoft.com>; thomas.lendacky@....com
> Cc: iommu@...ts.linux-foundation.org; linux-arch@...r.kernel.org; linux-
> hyperv@...r.kernel.org; linux-kernel@...r.kernel.org; linux-scsi@...r.kernel.org;
> netdev@...r.kernel.org; vkuznets <vkuznets@...hat.com>; brijesh.singh@....com;
> konrad.wilk@...cle.com; hch@....de; joro@...tes.org; parri.andrea@...il.com;
> dave.hansen@...el.com
> Subject: RE: [PATCH V6 5/5] net: netvsc: Add Isolation VM support for netvsc driver
> 
> From: Haiyang Zhang <haiyangz@...rosoft.com> Sent: Wednesday, December 8, 2021 12:14 PM
> > > From: Tianyu Lan <ltykernel@...il.com>
> > > Sent: Tuesday, December 7, 2021 2:56 AM
> 
> [snip]
> 
> > >  static inline int netvsc_send_pkt(
> > >  	struct hv_device *device,
> > >  	struct hv_netvsc_packet *packet,
> > > @@ -986,14 +1105,24 @@ static inline int netvsc_send_pkt(
> > >
> > >  	trace_nvsp_send_pkt(ndev, out_channel, rpkt);
> > >
> > > +	packet->dma_range = NULL;
> > >  	if (packet->page_buf_cnt) {
> > >  		if (packet->cp_partial)
> > >  			pb += packet->rmsg_pgcnt;
> > >
> > > +		ret = netvsc_dma_map(ndev_ctx->device_ctx, packet, pb);
> > > +		if (ret) {
> > > +			ret = -EAGAIN;
> > > +			goto exit;
> > > +		}
> >
> > Returning EAGAIN will let the upper network layer busy retry,
> > which may make things worse.
> > I suggest to return ENOSPC here like another place in this
> > function, which will just drop the packet, and let the network
> > protocol/app layer decide how to recover.
> >
> > Thanks,
> > - Haiyang
> 
> I made the original suggestion to return -EAGAIN here.   A
> DMA mapping failure should occur only if swiotlb bounce
> buffer space is unavailable, which is a transient condition.
> The existing code already stops the queue and returns
> -EAGAIN when the ring buffer is full, which is also a transient
> condition.  My sense is that the two conditions should be
> handled the same way.  Or is there a reason why a ring
> buffer full condition should stop the queue and retry, while
> a mapping failure should drop the packet?

The netvsc_dma_map() fails in these two places. The dma_map_single() 
is doing the maping with swiotlb bounce buffer, correct? And it will 
become successful after the previous packets are unmapped?

+	packet->dma_range = kcalloc(page_count,
+				    sizeof(*packet->dma_range),
+				    GFP_KERNEL);

+		dma = dma_map_single(&hv_dev->device, src, len,
+				     DMA_TO_DEVICE);

I recalled your previous suggestion now, and agree with you that 
we can treat it the same way (return -EAGAIN) in this case. And 
the existing code will stop the queue temporarily.

Thanks,
- Haiyang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ