Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1018732imm; Wed, 8 Aug 2018 09:22:43 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwwNw0dE0/bgUZv85pTK6rbBA4zcKxlayLLQmjjSgBW8riSf8E+rIU+9EbtbWoCpyY4GAww X-Received: by 2002:a65:4344:: with SMTP id k4-v6mr3167119pgq.409.1533745363071; Wed, 08 Aug 2018 09:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533745363; cv=none; d=google.com; s=arc-20160816; b=0Ruo2jIYJMCjr1Cl6acFmP3eV8BNqNeTGiJqFIrObjMzFo5BNIeM+iqw+/nOnf5Vft QY5cqLXYm3xaMutlLFqyFTZ/sZpuLJJo/o1H215ghlQKIZtPzz6t2Xl0kSyvreDiASps zaqkLGem9UxD5sWYNui24k/bK2WicX0aV8PRUfgY0LHYF6a9wlo/5b/tyyysVtjmx9iy QX572OEdAIYcAmzdjOCSA/ruA13WcWZ90KUfxbbeQfcBfhYfe+1FU99i5900J4rly3RV X0hadVR9vxWUHPq499PA27mkbFXX/q0vy7C8ZaydIqFMUnKdlxwi2VeTdE+yFJBIwSmY OVyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=X2oAmn9Qa9ExFyPn3+zQwc/5UsJGuSAnCaPGpsSkTFc=; b=O7UxCXVMThX8hhHj5RLQnvX5vPN41EgLhCN9+Sh8RrJP9171NhwY8ViD0ogN7oTjIK 9C8z98TejQ/UBwRD/sQE6OYydpXSvXoIiOy2XX4tc3h27pwuQ/KjEa+PprG4XY15p6rF oLAmgY/KHXSv28SyP/mQeWrgOV+yoVCjS08peUKZn4dAd2DTcPF1tP92PJi7xS9C6AYi +P3duOv4s4AiSRTqnovVgKfaRqHJaif8urFehojcTf3+MIkhSv1viF/LsGPQAb6PWlbR Spchea8mcZgndadWCFTvT5xDi1WZV1gs4RXuSinTzkv1Cs9sj8aZJ9Eu5JdA21/Xa878 w4pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=q7QtVpAE; 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 q3-v6si4094989pgf.40.2018.08.08.09.22.27; Wed, 08 Aug 2018 09:22: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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=q7QtVpAE; 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 S1728232AbeHHSmA (ORCPT + 99 others); Wed, 8 Aug 2018 14:42:00 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:33252 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727062AbeHHSl7 (ORCPT ); Wed, 8 Aug 2018 14:41:59 -0400 Received: from avalon.localnet (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0A25557; Wed, 8 Aug 2018 18:21:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1533745293; bh=/3myg5xUrmSFzG9a/oPesvPjvFr3ieIotKsfToqE6xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q7QtVpAEIw96gKYk348XdEpXNEbTPGk3qI4MtJ2iRYLEqU0cFgrMcj38H0x45ricN zlExzU5a97xF6rVAhbZRmtpYJ+S/cZxjp+kwtTgyumvZ9Yow2KO2EktDg0RNGigNJk 5g1UB5Ke3xmpUV4jqJby8S6tSLoezPdtzZw1+aDk= From: Laurent Pinchart To: Alan Stern Cc: Keiichi Watanabe , Tomasz Figa , Linux Kernel Mailing List , Mauro Carvalho Chehab , Linux Media Mailing List , kieran.bingham@ideasonboard.com, Douglas Anderson , ezequiel@collabora.com, matwey@sai.msu.ru Subject: Re: [RFC PATCH v1] media: uvcvideo: Cache URB header data before processing Date: Wed, 08 Aug 2018 19:22:16 +0300 Message-ID: <1959555.Z0pJAWgXVZ@avalon> Organization: Ideas on Board Oy In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Wednesday, 8 August 2018 17:20:21 EEST Alan Stern wrote: > On Wed, 8 Aug 2018, Keiichi Watanabe wrote: > > Hi Laurent, Kieran, Tomasz, > > > > Thank you for reviews and suggestions. > > I want to do additional measurements for improving the performance. > > > > Let me clarify my understanding: > > Currently, if the platform doesn't support coherent-DMA (e.g. ARM), > > urb_buffer is allocated by usb_alloc_coherent with > > URB_NO_TRANSFER_DMA_MAP flag instead of using kmalloc. > > Not exactly. You are mixing up allocation with mapping. The speed of > the allocation doesn't matter; all that matters is whether the memory > is cached and when it gets mapped/unmapped. > > > This is because we want to avoid frequent DMA mappings, which are > > generally expensive. However, memories allocated in this way are not > > cached. > > > > So, we wonder if using usb_alloc_coherent is really fast. > > In other words, we want to know which is better: > > "No DMA mapping/Uncached memory" v.s. "Frequent DMA mapping/Cached > > memory". The second option should also be split in two: - cached memory with DMA mapping/unmapping around each transfer - cached memory with DMA mapping/unmapping at allocation/free time, and DMA sync around each transfer The second option should in theory lead to at least slightly better performances, but tests with the pwc driver have reported contradictory results. I'd like to know whether that's also the case with the uvcvideo driver, and if so, why. > There is no need to wonder. "Frequent DMA mapping/Cached memory" is > always faster than "No DMA mapping/Uncached memory". Is it really, doesn't it depend on the CPU access pattern ? > The only issue is that on some platform (such as x86) but not others, > there is a third option: "No DMA mapping/Cached memory". On platforms > which support it, this is the fastest option. -- Regards, Laurent Pinchart