Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2304719ybh; Sun, 4 Aug 2019 22:25:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNSwJ8lndYNsFNlytyN35WC5ruDIqHRMTLnNnmnyJ5T/YfGa5oLsuT24Zw7BvhNm6QgSKk X-Received: by 2002:a17:902:f46:: with SMTP id 64mr143877477ply.235.1564982727553; Sun, 04 Aug 2019 22:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564982727; cv=none; d=google.com; s=arc-20160816; b=YEBIY531W63rlaZRwDcuKug9w0ttJLJN0UgGSU8LXM+8eFvgLozZL36UmZEiYPn8E3 8+ty/l9+WUM4kZ/Evx+37FoWOXdChgzq26XlmevnxC8zyu4wX4QrgkrGpf73tuhIIHh8 BhD/6ZQheIeqK8V9s0BXfrmGtedF33U7kLUOpDy4XxUCZMSnTnsJyqK63ghIMGCQhd9l CP/mkIHpI0CDHYkH11eZPcF9uh38qAYN6dyEO2rTK3xMeRGq0j6QK2EqhhM/xMQ+AHIS UGZp0NIIRjv4TKymsjzYTarMXsHrzNlRzpSIjPdxJ+Mmin/wrwuPnGE3JUn093b3r4wX Wm0Q== 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=kwMEz+087NG71UJ43Y4PF8iaz73tFFj8XFrCYqheyzM=; b=eP151BWDaEqEKTKsmpVy8x4U7QvXw2TT7EaBUYHqsxuJK0rGjEcu9MaI5LRsbNK4lb lZ5hriuvY0KwQl6o9wCJmwhS/WVcApb1S1ni+XHCToQ8WGedmI/qKdisTo1g7SuEytuw YrYO/4hGzXc/p2Jrbrzfz1mJcg4l/+0icFLyDfsYoPBdvU3QE2m2z0if9tzvwwb9LV29 6QIHgb58n9VW09sQta5t633bxuXZQcf1X3B63X9/VFXtSvzEKJwvt5d/1n6AIj/PPNLK GGPH7wAcjk5UgSZVzPU+wuQvpR9JpDD2reeyToK78VGPQlfNrfIoBNmCXkeeS17XUk02 djog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RYStpXRd; 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 w188si45593433pfb.175.2019.08.04.22.25.12; Sun, 04 Aug 2019 22:25:27 -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=RYStpXRd; 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 S1727504AbfHEFYF (ORCPT + 99 others); Mon, 5 Aug 2019 01:24:05 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41765 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725976AbfHEFYE (ORCPT ); Mon, 5 Aug 2019 01:24:04 -0400 Received: by mail-pl1-f194.google.com with SMTP id m9so35861391pls.8; Sun, 04 Aug 2019 22:24:04 -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=kwMEz+087NG71UJ43Y4PF8iaz73tFFj8XFrCYqheyzM=; b=RYStpXRdJ6l1TB5wKrJU7HiL/1JFuert86TTPAt7bqfUAgmkKErLM2V7eOfh80Dt2X z7zdYP5OzQEjRfg6GxLfMGJx5i8X3s+g//iYCtV2yZNKceD6Ya66xqmj8jEJZ0x4z3OQ 43TQ1PL+flTx9iYukVvXCXiibP5xo1OjP9SbWR1oZbkY1uY6zZGLDoEN0/r6wsIRVgzU 3Noiq/QHVUllGwiToLVLy27y4uG1aCixTU4rLvpGd8YxUaPuwP/ba/CLQxcjYW586fb6 1W/dT88fozfMlEJD/QgB/3tin2mbI5vBE/RSIhH9/hQtob0Oxs1EXz4vbgjetDZz0uCm Yf/w== 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=kwMEz+087NG71UJ43Y4PF8iaz73tFFj8XFrCYqheyzM=; b=a3e0P6queC2BxB2HatvRW+Tl2BSUftyauGl3en0d9ygPijfEb4nyPRZBvDXHztzaFR qW7ru7yIa27Aabyc8yy1KW6m4xU6mgczXNluP6QEeFUCHzZ/pLcjml3K3i1c1mYNFuzo ofIWi91zFaV7yx2PRWR1Idafs/Dw8Q6Owp0KKwCHVo2IBO4jt6HRjYWhB1Cj4vSlzrWE DGl639uXL9HWipk4XNb0DHoioyuIkEvA40gWmoUrdaQcYnMY8vuGAEgENes3Vu0M79pL TXSFdp5gPGiZmCmJCc1p4Jxd3qkaQDp+qI1y6YP0BjFFTDAKyrby6CRzhaL0qWMgvFhu A+Vw== X-Gm-Message-State: APjAAAW33hCF+FQq01ulgLEGErk1RFNU7hfMRsr9PBnXynN2UNbCtA5W rJ96SZrOX648uSKa/ITlh1Q= X-Received: by 2002:a17:902:ba96:: with SMTP id k22mr146166694pls.44.1564982644123; Sun, 04 Aug 2019 22:24:04 -0700 (PDT) Received: from localhost.localdomain ([163.152.162.125]) by smtp.gmail.com with ESMTPSA id o12sm12798313pjr.22.2019.08.04.22.24.01 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 04 Aug 2019 22:24:03 -0700 (PDT) Date: Mon, 5 Aug 2019 14:23:58 +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 v3 1/2] usbip: Skip DMA mapping and unmapping for urb at vhci Message-ID: <20190805052358.GA8904@localhost.localdomain> References: <20190802173651.22247-1-suwan.kim027@gmail.com> <20190802173651.22247-2-suwan.kim027@gmail.com> 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 Fri, Aug 02, 2019 at 04:22:27PM -0600, shuah wrote: > On 8/2/19 11:36 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 > > --- > > 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..c62f7fa8118c 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) { > > + WARN_ON(1); > > Don't add WARN_ON. I cleaned them all up recently and don't want new > ones added. Ok. I will remove it and resend v4. Regards Suwan Kim