Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4268696ybh; Tue, 6 Aug 2019 08:54:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4PbmTqfSKZJdtefyro2PXSRHUXStTokJRV/AQZi9e/bseY3LdFfTRWJimSWKQkeTw7hEP X-Received: by 2002:a63:4c0d:: with SMTP id z13mr3683150pga.28.1565106840863; Tue, 06 Aug 2019 08:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565106840; cv=none; d=google.com; s=arc-20160816; b=xMtGaw/Y3vP6Ek1KaIq2DbKTWyQC6RGi+GUPhgDALjUKyGsInvrBTddce02uReL+Ce DnWbGPYrOPgiOrGTJjMt5SpsawvExObX+b6KUgfipySiDMNP3syUVrCWjEkN9wqK+Kal exr6EkLSIFgAoWPRKLlVUF60JNsmALvxlkFKz46JwV+w777s0wDePqcxTPm/57qbQYr/ ceih5b1Fw8S9AETgZ2eh56iESe5VBA/2b2rkE63RB2BSRzuXAn7zBKUMEWBD9zm7bp8x e6K30jLR2wD+zouBCbbVlMovz4N0sBGy4IsH4pp+VaKGkKjHVShjHDG729Z9OXRztiob DTkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jfzEOZ5rHqiPG3I14G2VFXx2UVCDNmo50hSta/tpyio=; b=RcaRQ6jv96yMRhsABqppdiDWviCbYmhFQVYQLqljuI3QLUqCgZV0xNFImJxrFcXCLX jPl/e2S1LFIHPv48oTFX4xSmE8IcMj5P7zCTXGo+C4cKs10FkjVzXCXyJpxKu3qPhnv3 e/VPUx9Z3CG3iQdKNMTK7ayA07IaMw7SJ2OSfjgErXh/yHe0QpPl7IUTOITZOAOdNeow 8CqcTkQdjwcMWzz0ouNSw/+BgoXz3PHnY6sLHXrPy/av6ymRz9L57fwBhStVWLMWXVA8 pU63PVW5hb9PThm69F/pFDQcVM3JBSXTMX63eY1PPgcWdavZv69uF0lig5cKHpgK3q/f K/Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tWspXk3B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e30si47848647pfm.78.2019.08.06.08.53.44; Tue, 06 Aug 2019 08:54:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tWspXk3B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733158AbfHFPwp (ORCPT + 99 others); Tue, 6 Aug 2019 11:52:45 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44857 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729161AbfHFPwp (ORCPT ); Tue, 6 Aug 2019 11:52:45 -0400 Received: by mail-pg1-f194.google.com with SMTP id i18so41815586pgl.11; Tue, 06 Aug 2019 08:52:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=jfzEOZ5rHqiPG3I14G2VFXx2UVCDNmo50hSta/tpyio=; b=tWspXk3BfSxgbI2f0ulWibLmdQ02GrosL1PS8zVFzux94T6iZp4QTukfX+bNsCIqrv vBBzPN2Xs7DFTTJf9eIqCH2273IsFsU2hOEY8MjXF9OQiA1k0GMCZAIPxTp/SfY7VjeO 6WV8gQIgf6H6vhbygYPJYa6Ae8Vx6hvH7i3N00cc6U0Sgzdmti+NscIsZYTNa74KudQW XuvMjZa+YUaaEQ/9s4Hjq3uhp3DtBsRHjNMK6nXzI+3anazpyrcrGoJsWFsdQryYS4dH 6b8F71Fjwlmf09TInPIMDhWSmC96Bts6C7SI9OKpm7FmSfM7n/gmbbNCL+T0IMRT9xs6 v3pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=jfzEOZ5rHqiPG3I14G2VFXx2UVCDNmo50hSta/tpyio=; b=XY2TdqrXiYkNE1GPpZIJ07a1mP/QyCU68Oiv5kQEyMhNaUv03jR2pvkcE34Wa227Vz 5yBnLl7uVhau1ak8oM2VWazvLrJJZV49CvGpFu9vCAD0e9cnI8YIwf1OR4EyTQwD/pPn 0pNAnvmgwl1537iKlLX2JU7D9d/5oXu8vpfZK7Yi/2gL1vtPpcI2DX6O3P7uoIjkZIt5 24y4IKy5+yYNyHDchpX2vUTpqPncenWH+gbJXHBizgcupH66yJbmnEaSbY5BaTqT4dxp UJLHF7HkuBeRpxRt3/3roUGv9ahsIEMNFNa0f3SVnq72Ab36IyCTp6sJ/Uddywfq5lED 0lSg== X-Gm-Message-State: APjAAAXtrnHoTT/3dwr2dJDfeofv7c1TKLCOM/Y8d268PL+AzY6qG89b Vukzx/VGtPxM9mwyGKzx7K0= X-Received: by 2002:a62:be0c:: with SMTP id l12mr4415570pff.224.1565106764377; Tue, 06 Aug 2019 08:52:44 -0700 (PDT) Received: from localhost.localdomain ([125.142.23.13]) by smtp.gmail.com with ESMTPSA id f7sm85385329pfd.43.2019.08.06.08.52.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 06 Aug 2019 08:52:43 -0700 (PDT) Date: Wed, 7 Aug 2019 00:52:38 +0900 From: Suwan Kim To: shuah Cc: valentina.manea.m@gmail.com, gregkh@linuxfoundation.org, stern@rowland.harvard.edu, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/2] usbip: Skip DMA mapping and unmapping for urb at vhci Message-ID: <20190806155238.GC3738@localhost.localdomain> References: <20190806123154.23798-1-suwan.kim027@gmail.com> <20190806123154.23798-2-suwan.kim027@gmail.com> <20190806153241.GA3738@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 06, 2019 at 09:38:54AM -0600, shuah wrote: > On 8/6/19 9:32 AM, Suwan Kim wrote: > > On Tue, Aug 06, 2019 at 09:11:30AM -0600, shuah wrote: > > > On 8/6/19 6:31 AM, Suwan Kim wrote: > > > > vhci doesn’t do DMA for remote device. Actually, the real DMA > > > > operation is done by network card driver. vhci just passes virtual > > > > address of the buffer to the network stack, so vhci doesn’t use and > > > > need dma address of the buffer of the URB. > > > > > > > > But HCD provides DMA mapping and unmapping function by default. > > > > Moreover, it causes unnecessary DMA mapping and unmapping which > > > > will be done again at the NIC driver and it wastes CPU cycles. > > > > So, implement map_urb_for_dma and unmap_urb_for_dma function for > > > > vhci in order to skip the DMA mapping and unmapping procedure. > > > > > > > > When it comes to supporting SG for vhci, it is useful to use native > > > > SG list (urb->num_sgs) instead of mapped SG list because DMA mapping > > > > fnuction can adjust the number of SG list (urb->num_mapped_sgs). > > > > And vhci_map_urb_for_dma() prevents isoc pipe from using SG as > > > > hcd_map_urb_for_dma() does. > > > > > > > > Signed-off-by: Suwan Kim > > > > --- > > > > v3 - v4: > > > > - Replace WARN_ON() with pr_err() in the error path. > > > > > > > > v2 - v3 > > > > - Move setting URB_DMA_MAP_SG flag to the patch 2. > > > > - Prevent isoc pipe from using SG buffer. > > > > > > > > v1 - v2 > > > > - Add setting URB_DMA_MAP_SG flag in urb->transfer_flags to tell > > > > stub driver to use SG buffer. > > > > --- > > > > drivers/usb/usbip/vhci_hcd.c | 19 +++++++++++++++++++ > > > > 1 file changed, 19 insertions(+) > > > > > > > > diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c > > > > index 000ab7225717..429e4e989f38 100644 > > > > --- a/drivers/usb/usbip/vhci_hcd.c > > > > +++ b/drivers/usb/usbip/vhci_hcd.c > > > > @@ -1288,6 +1288,22 @@ static int vhci_free_streams(struct usb_hcd *hcd, struct usb_device *udev, > > > > return 0; > > > > } > > > > +static int vhci_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, > > > > + gfp_t mem_flags) > > > > +{ > > > > + if (usb_endpoint_xfer_isoc(&urb->ep->desc) && urb->num_sgs) { > > > > + pr_err("SG is not supported for isochronous transfer\n"); > > > > > > Any reason to not use dev_err()? > > > > Because some codes in vhci_hcd.c use pr_err().There is no other > > reason. However, dev_err() seems more appropriate than pr_err(). > > I will replace pr_err() with dev_err(urb->dev->dev, "SG is ...") > > Is it ok? > > > > Please. This way we will have the device information. pr_err() > won't us that. In general I prefer dev_* if dev is available in > the code path, which is the case here. Ok. I will resend v5. Regards Suwan Kim