Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp7315649imm; Tue, 24 Jul 2018 11:57:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf3WtIEjHeLyE/Ny6A3mkA5K/gQ8B6GvXy9X+fjtFeSwdwnrz1Lxb6mkKfdPKLuVjjnefpv X-Received: by 2002:a63:115e:: with SMTP id 30-v6mr17560481pgr.53.1532458655655; Tue, 24 Jul 2018 11:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532458655; cv=none; d=google.com; s=arc-20160816; b=0e6s1e6Mns46eGWed9yhk6XOlKU2fARjcU45gd7SnHbNAblLXAi8066oI+IZQ/lg/b d1JDUVgDa6wQpEHGLIojSA1K2gX4hfdeuJyxgnqgMT0KOwp1RnHyKtQzqYhYzHSfbRab YgTpO8y0SovJu4Ky5KOzvMn3OlP6BzgZN+AMhVrwpLHlvJ09XAt+B7w8Sr2DlsK6ErRl Ggkv4C0e91B926Qinb+9v8y0ugJkbwtynqJw/awxmqmDPPuyWkrK3Z7ZtQHdqyHLXjxs Llydc+W6Ju2tX7eLpgtuXtTZB5gd4ZLHcWr3EdwsDKm8/GH6xASYLD7x2VoCAB7NU0cL WRYA== 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=fxqKepJb2RiPNe+Z61HOZv5+tXaL71PJhWLvpeAgRmY=; b=geZ69XKsz5t+OSV5Q+dlbpOvpl2mSBGrymdZmPte0UFyYW2unNIERByYBT5xgzYYMT UiAKvezTtVG6Czs3PiJJ3Kpmrjr2Bk1QUr52DEMgXz/rL0q33sxQc5M6F9Tro7SnXKpt NKeWyx3ixKjzRUoeNWSQ8ovifkt1n/2hKKML4ddRLZFlXkTjg2uMSWRG+1s1zOzfZqkW D7pYaHoUhKL76tlmPV3nFBA8FyNUYvciQictEdNPqqDL0BbuAH4JU2sptWrBfpagSbOY NGNjAtD4y0/w6kKis1HRW/kMYvPDrHJZoYkPFjDo0dLBBzIQU6X3MMWrCRuSpeg2Ena0 icmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=hshK14Ee; 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 t66-v6si12028588pfg.292.2018.07.24.11.57.20; Tue, 24 Jul 2018 11:57:35 -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=hshK14Ee; 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 S2388538AbeGXUEV (ORCPT + 99 others); Tue, 24 Jul 2018 16:04:21 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:46944 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388402AbeGXUEV (ORCPT ); Tue, 24 Jul 2018 16:04:21 -0400 Received: by mail-oi0-f67.google.com with SMTP id y207-v6so9398768oie.13; Tue, 24 Jul 2018 11:56:30 -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=fxqKepJb2RiPNe+Z61HOZv5+tXaL71PJhWLvpeAgRmY=; b=hshK14EeEUeXcK6G+WIcOf1SoU+P47oyHq31XHu+6ardWoJFPTHJWO2/++NE+YzTKB 3bf8Yl2zgbd91G6AH7N5/ZwE2uNjz2km+fEkgEafvtXuzZK6xCadhMgDDJyHCi/reG/G KvIR+rRDCvkGRFBXiaCcnAtLQvWlxrJQE76B0ihOpSoe7GGJF+PvxCUECKSVHQhA5hGB M/U+cQdxRDUfbmRfViNUoU97xynWj0to0+ySvR5TkEH1hZbcuw0Fl/T+0ht9fz19HBN/ dXgNRZDCMU0mgql3qM743S8PK05uPQ0kprvenA5ll4kbOstca4dpFAIPVDGY9rlmZ2Jp qh3A== 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=fxqKepJb2RiPNe+Z61HOZv5+tXaL71PJhWLvpeAgRmY=; b=cqa3P3lYQQWEM+NheClY7A1nR2rkHCzNeQsgBUMLm3JWd1afhG6K+lTVyp1hD0pDTa EoqZtEj++bhtpof3kafZc0NaxBEZ3ujCNJieMFtAupFvJyo6fRz0c/r91CABBYgriJ+J KQ/pSprSlXh4blNJxVUrJwkaaHaYHERa+2enA4n7R3vodr0bsMY1uWKw01UblAF4Klhf FU4QuL8svxSGdBd8hzzd2BGEZIRW1Gu7kYZA4biuvJsQzZ2MRJOVZPgURoB6bJjCpCCc FdnlqfjG5KpUV9fcuLkyTpylU4M48tkHFyxxE/x/3Hm3c8ZpHdrNQz57LeYcOCKVsmsL PF2A== X-Gm-Message-State: AOUpUlFtL4rMKGm2qbIQzMC14m0ugROTyUy6Ly4psrPPy/hrTDxsnL4K UUICYmRkyXhC4uejbc7TI5whqzLrRqZMxUZApQQ= X-Received: by 2002:aca:4455:: with SMTP id r82-v6mr86395oia.260.1532458590263; Tue, 24 Jul 2018 11:56:30 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:734:0:0:0:0:0 with HTTP; Tue, 24 Jul 2018 11:56:09 -0700 (PDT) In-Reply-To: References: From: "Matwey V. Kornilov" Date: Tue, 24 Jul 2018 21:56:09 +0300 X-Google-Sender-Auth: __iqG8QUM870rK3_J2OV1syo2OE Message-ID: Subject: Re: [PATCH 2/2] media: usb: pwc: Don't use coherent DMA buffers for ISO transfer To: Alan Stern Cc: Tomasz Figa , 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 , Kieran Bingham , keiichiw@chromium.org 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-23 21:57 GMT+03:00 Alan Stern : > On Mon, 23 Jul 2018, Matwey V. Kornilov wrote: > >> I've tried to strategies: >> >> 1) Use dma_unmap and dma_map inside the handler (I suppose this is >> similar to how USB core does when there is no URB_NO_TRANSFER_DMA_MAP) > > Yes. > >> 2) Use sync_cpu and sync_device inside the handler (and dma_map only >> once at memory allocation) >> >> It is interesting that dma_unmap/dma_map pair leads to the lower >> overhead (+1us) than sync_cpu/sync_device (+2us) at x86_64 platform. >> At armv7l platform using dma_unmap/dma_map leads to ~50 usec in the >> handler, and sync_cpu/sync_device - ~65 usec. >> >> However, I am not sure is it mandatory to call >> dma_sync_single_for_device for FROM_DEVICE direction? > > According to Documentation/DMA-API-HOWTO.txt, the CPU should not write > to a DMA_FROM_DEVICE-mapped area, so dma_sync_single_for_device() is > not needed. Well, I measured the following at armv7l. The handler execution time (URB_NO_TRANSFER_DMA_MAP is used for all cases): 1) coherent DMA: ~3000 usec (pwc is not functional) 2) explicit dma_unmap and dma_map in the handler: ~52 usec 3) explicit dma_sync_single_for_cpu (no dma_sync_single_for_device): ~56 usec So, I suppose that unfortunately Tomasz suggestion doesn't work. There is no performance improvement when dma_sync_single is used. At x86_64 the following happens: 1) coherent DMA: ~2 usec 2) explicit dma_unmap and dma_map in the handler: ~3.5 usec 3) explicit dma_sync_single_for_cpu (no dma_sync_single_for_device): ~4 usec So, whats to do next? Personally, I think that DMA streaming API introduces not so great overhead. Does anybody happy with turning to streaming DMA or I'll introduce module-level switch as Ezequiel suggested? > > Alan Stern > -- With best regards, Matwey V. Kornilov. Sternberg Astronomical Institute, Lomonosov Moscow State University, Russia 119234, Moscow, Universitetsky pr-k 13, +7 (495) 9392382