Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2724638imm; Fri, 20 Jul 2018 03:56:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeSAcEN1bnHBhqFpq5DtEg5mtIVSCYJOHjWS6aDUMfss5fOgkuCoSqk6d+AD5jE/d7+fdyy X-Received: by 2002:a62:398c:: with SMTP id u12-v6mr1692683pfj.9.1532084203826; Fri, 20 Jul 2018 03:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532084203; cv=none; d=google.com; s=arc-20160816; b=UW2WheYGhx1U7DVD8MDWPcWPJbKXjZO1IA1/lADg8enPF7HKqocC/DRLwJiMHIYvfD CRirIlPDnVLj6rSVPIFcXK96TtesgzIv1/aPAj8BHpyxagngRXGX+EoE+oRuOd9V97iA xP9crYD4rCJtI8DC+4rMlikvGOt7Hfh/U6vhTbPrSVVzLYaL9QNC6qFZxBP9KfRpT5LI OSoLW6arYlq49CVkz7xjjyFwbPAUL61sULkbeF6QlGXlqEZM17gIOtoLssqqzoN8lusw iLWfsAjuZhMXlGheySk+oPQIaRIKNA6LYGc/2e3o9fZYh92Yrsgwg5UIGNmy8wEilgPA zxSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=9KzDb9stgx9l2CJByrnMYfMZEin6YTqcaj9BIPOPqdU=; b=h1WxLnslzYcuuWWrd6AoiVOx5fw4pts7ZEfBeSYiKyI6NCWmY9i01AzfmGVMjUVDWM wcoxnL9LKlPOl5XkDCnMom14+s5ENTuFcUZxKnDZUlwAlUtXfMzP7dxTNTyhFzZY0RGn dmWAc1cj7dIpB6RV0iXIKZ7Gxq1cQpfvWqyJrWyfCbxiRffOhg0dMw4dARhFIUDwHkVW jeiJx1UNXhlCeQAQ+y45itW97jLuG+e3N/+o9xlfAxo2/38BK4t+gQviqUhX8+r/RcQw IxaqqJxERkoFtdqhIOKjtxMm5YE5XYMHiBQB1IYCT9TVrpqUQu6QzBfMe4ThvTb8uAg7 thXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gKh9EB79; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10-v6si1404755plp.328.2018.07.20.03.56.28; Fri, 20 Jul 2018 03:56:43 -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=@chromium.org header.s=google header.b=gKh9EB79; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728566AbeGTLnZ (ORCPT + 99 others); Fri, 20 Jul 2018 07:43:25 -0400 Received: from mail-yb0-f195.google.com ([209.85.213.195]:37100 "EHLO mail-yb0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727983AbeGTLnZ (ORCPT ); Fri, 20 Jul 2018 07:43:25 -0400 Received: by mail-yb0-f195.google.com with SMTP id r3-v6so4463488ybo.4 for ; Fri, 20 Jul 2018 03:55:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9KzDb9stgx9l2CJByrnMYfMZEin6YTqcaj9BIPOPqdU=; b=gKh9EB79tT9HY87oJ/7W7DxOtfRhBjPOSwBYDddtlieNtyZhkqDjH72H+nKNR4Z1US DVG2rb2/elrliGpZpyxg2sMOPwbj2IN26UDKj4WTXXvYWtJnjKmqojk+fBB3x35oVmBl jp7Fah5aTnKpN88BTWM0KEbcvATLWShycTQi0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9KzDb9stgx9l2CJByrnMYfMZEin6YTqcaj9BIPOPqdU=; b=fmw34Azy8QTa/qEc1ZTpS92ezAwKxuAxUR0lZ8e+RuW8VZrbtacxmMm3QpQF4LLU1U IGnMcP3pCfwBP3uxG7y4TQ9O58QK27J3JUTOKExhPUP0gEqdcLurTQ8zqSQNm2Vvkgsf N4pZwv0ZeWL0J5rjeLRgAbYUK8FSc9pSALXhvtl5hW9Tt8dkNzlhwKofbWf/Afgs5qqy HhtvlxpVwYeE1z9DYhrDchH+U/TZE5dXt6ErDvFS402YJr8Fza8gHjbZTHqZ3MN0Jk6l JhvP5CLY9hQPAv+iqvLnWHQKpwSjNt66rQxuHoLh2VQRUSOpU5MuutrboMeYS3RdM0Rv DO2A== X-Gm-Message-State: AOUpUlE9kvLkUY/F/Vdrx+Melojvt63QwPwNEkKb4GhfzeyQ8Oe5aVIn hFnFR6GvC09EpBiBOEjeJ8xVxiYExCE= X-Received: by 2002:a25:3105:: with SMTP id x5-v6mr710186ybx.468.1532084143511; Fri, 20 Jul 2018 03:55:43 -0700 (PDT) Received: from mail-yb0-f178.google.com (mail-yb0-f178.google.com. [209.85.213.178]) by smtp.gmail.com with ESMTPSA id f64-v6sm747762ywd.58.2018.07.20.03.55.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 03:55:41 -0700 (PDT) Received: by mail-yb0-f178.google.com with SMTP id c3-v6so4453089ybi.13 for ; Fri, 20 Jul 2018 03:55:41 -0700 (PDT) X-Received: by 2002:a25:4b01:: with SMTP id y1-v6mr675748yba.344.1532084140544; Fri, 20 Jul 2018 03:55:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Tomasz Figa Date: Fri, 20 Jul 2018 19:55:29 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] media: usb: pwc: Don't use coherent DMA buffers for ISO transfer To: stern@rowland.harvard.edu Cc: Ezequiel Garcia , matwey@sai.msu.ru, hdegoede@redhat.com, Hans Verkuil , Mauro Carvalho Chehab , Laurent Pinchart , rostedt@goodmis.org, mingo@redhat.com, isely@pobox.com, bhumirks@gmail.com, colin.king@canonical.com, Linux Media Mailing List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 18, 2018 at 5:51 AM Alan Stern wrote: > > On Tue, 17 Jul 2018, Ezequiel Garcia wrote: > > > Hi Matwey, > > > > First of all, sorry for the delay. > > > > Adding Alan and Hans. Guys, do you have any feedback here? > > ... > > > > > So, what is the benefit of using consistent > > > > for these URBs, as opposed to streaming? > > > > > > I don't know, I think there is no real benefit and all we see is a > > > consequence of copy-pasta when some webcam drivers were inspired by > > > others and development priparily was going at x86 platforms. > > > > You are probably right about the copy-pasta. > > > > > It would > > > be great if somebody corrected me here. DMA Coherence is quite strong > > > property and I cannot figure out how can it help when streaming video. > > > The CPU host always reads from the buffer and never writes to. > > > Hardware perepherial always writes to and never reads from. Moreover, > > > buffer access is mutually exclusive and separated in time by Interrupt > > > fireing and URB starting (when we reuse existing URB for new request). > > > Only single one memory barrier is really required here. > > > > > > > Yeah, and not setting URB_NO_TRANSFER_DMA_MAP makes the USB core > > create DMA mappings and use the streaming API. Which makes more > > sense in hardware without hardware coherency. > > As far as I know, the _only_ advantage to using coherent DMA in this > situation is that you then do not have to pay the overhead of > constantly setting up and tearing down the streaming mappings. So it > depends very much on the platform: If coherent buffers are cached then > it's a slight win and otherwise it's a big lose. Isn't it about usb_alloc_coherent() being backed by DMA coherent API (dma_alloc_coherent/attrs()) and ending up allocating uncached (or write-combine) memory for devices with non-coherent DMAs? I'm not sure how this memory is used by this driver, but if it reads from it using CPU, uncached mapping might be significantly slower than cached mapping of memory allocated with kmalloc(). Best regards, Tomasz