Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2751200imm; Fri, 20 Jul 2018 04:23:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdZGmQ2hCuEuzB0ZsmYREURu7IysYyLDYegxT7T+M48TGx+TlgdQpCAaP1NLFKHvjUuuZ+e X-Received: by 2002:a17:902:9345:: with SMTP id g5-v6mr1754455plp.10.1532085826168; Fri, 20 Jul 2018 04:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532085826; cv=none; d=google.com; s=arc-20160816; b=aIED7E4HGx3TVoS3tXw2T6zDgNbKXUwBcDir2Dj4QLdNgFRpziEXSiy+4Aix5zgR+O 1nZKzUeqxyXic4X0PUD4CzuNd1ela234rmeNt7x321K0tqkHLOG9GICMd9OQ1V75Ny3n lg5TpF2Gv9a7rwIG0hH/Bh5e+8WLKLjN7x1gF2K88iPCbxKIO/8j0AwVw2DjaBpWUduc X5DZVEFEHtBN78XXO76nP9DDzL4kqK6RDXVDSITB3qOBKDCryJoVW7PBPyJqobLUQLVu qZhQ0Trkjqi5mKvQQDWG7NArofpwIMVwleN8PvGlMzstZioEwDS2ifdRz9w77gVzmpOC FkmQ== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=hmlFjRSN1lLYAfCp5SbzCipavaP2bWtK0CDJjVLo+ws=; b=FjdpZLLDfxg1jSsqMvFIq11HHv/Vlx61zhbRBcZW1YzlCp/zCjjUXeIcKHO3p+M7MZ h09659HSwMzTKmQDayYmqNswK5Ivh2qHmrkn+29VY1Z8IHldtdB8AJwm7QaOtaT9Yokg OqZ1MgirdG1FCn3CPZuo2ht+/R4VR+MZGCznsH51NPf2rdwWQwKX1mmxQyjlt8ag0Kkt 9xgCiL224vKuuZCpsEBdKa6pqKzNW69QpEjCYdi/gQGQUhOxBkbb2lsYoLxcUlSXHmUN ROcOUXrXKmla7jH7p62vUiMvs7cuDeOqJCixxlw/YyeVYTzVIxguxaCLslc/3NcMsvZy joHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JMrabFM2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 25-v6si1678253pfp.108.2018.07.20.04.23.31; Fri, 20 Jul 2018 04:23:46 -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=fail header.i=@gmail.com header.s=20161025 header.b=JMrabFM2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728362AbeGTMKp (ORCPT + 99 others); Fri, 20 Jul 2018 08:10:45 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:37844 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727675AbeGTMKp (ORCPT ); Fri, 20 Jul 2018 08:10:45 -0400 Received: by mail-oi0-f67.google.com with SMTP id k81-v6so20696993oib.4; Fri, 20 Jul 2018 04:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=hmlFjRSN1lLYAfCp5SbzCipavaP2bWtK0CDJjVLo+ws=; b=JMrabFM2mEDXOEuZJp8APUNjY+ec+aggS/3ATem0sFLRFOe97GF1xlvaHCan7B+IQF rRJaEJmIzoIJRcoxrSZqcLXIOjASm3ZJHbsSqYz/bJYFFomcuyGAyve8YJJlRsFMuWvq cJY+D5ZgLnnaNDKEc0NNgNDBHNyteVDAiA7bpdK7Y7ccPy6gfW6D7/4J0ZS/E446fv7m PPuxddVdl1wB5/ITF2vLBz5ABwZZv9o9oYcODZM3ZhxbJD2nQvEV8w1HcmKsrQx1dWzn cIeAp5j9bP4EYI+A0WuiORmPAT87BOlEtV8EkS+FO570oO49tZ0qNRZtZyNHMpEchIQp Vnrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=hmlFjRSN1lLYAfCp5SbzCipavaP2bWtK0CDJjVLo+ws=; b=A7gEbFPHs63ZRAVKctLipfV93OaIQkwEQUuas/QYWOSpvUVkqNayM/SOwV6tUo1pEJ 6RG8Bc5p1BAhYmakwOQF/W/yjaGlum4jfZMvEChidDsHoSwZcgx6uKyy5AevGrm18PsD 9aBtKLzTDAk3wXI4DZvHSdb31DS4gUNFfp8pQSGPnva7Gk4F99ZkCe6FwA39lKkZNqpV RKlaEwx90Ri+Y0ev2Hs0KGo1Dklavr7bwdJCrIBs39S/YvnPjZriotzcO0h2Ua0vgG5H aqxehSzUqEYjEDUlrK4wNrFpqEFcd8TUNMcaiDYIIwvlHdTHHwNSbQxpZ6G71Je9Ruka UWJw== X-Gm-Message-State: AOUpUlFrMnG4fhzVjsxh0uM7zKH/ivCtReM4OwYBbcZ6VJf/kSvw6c10 ovYyempymH+KXL6/O8cHchcNVsNJTBOc77jBw44= X-Received: by 2002:aca:c514:: with SMTP id v20-v6mr1761880oif.153.1532085777885; Fri, 20 Jul 2018 04:22:57 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:734:0:0:0:0:0 with HTTP; Fri, 20 Jul 2018 04:22:37 -0700 (PDT) In-Reply-To: References: From: "Matwey V. Kornilov" Date: Fri, 20 Jul 2018 14:22:37 +0300 X-Google-Sender-Auth: N6q0ZUIu0WDLVQZr7kd_CO47FKw Message-ID: Subject: Re: [PATCH 2/2] media: usb: pwc: Don't use coherent DMA buffers for ISO transfer To: Tomasz Figa Cc: Alan Stern , Ezequiel Garcia , Hans de Goede , Hans Verkuil , Mauro Carvalho Chehab , Laurent Pinchart , Steven Rostedt , mingo@redhat.com, Mike Isely , Bhumika Goyal , Colin King , 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 2018-07-20 13:55 GMT+03:00 Tomasz Figa : > 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 Yes, this is what exactly happens at armv7l platforms. > 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 > -- With best regards, Matwey V. Kornilov. Sternberg Astronomical Institute, Lomonosov Moscow State University, Russia 119234, Moscow, Universitetsky pr-k 13, +7 (495) 9392382