Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1384251pxb; Mon, 11 Oct 2021 05:01:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu7F9Hkhe+z6sGS5g1AZzGuFxFY2wMED4VDDsxNhjiksWd+T4YGHGVzSfnJ/m8MzcGDI5/ X-Received: by 2002:a17:906:a0c9:: with SMTP id bh9mr25229763ejb.51.1633953691733; Mon, 11 Oct 2021 05:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633953691; cv=none; d=google.com; s=arc-20160816; b=SS90WakhQrsjodj4c5lxqhNOyubr7pS8mN0ibJIfRrlwvZkCQ07hIqRhT2+/w3AdpK TXafzT/HS7WixPWl43GW+wf6BduievO4hdSr8K0CnRnGvyGpkz1ZkGxZiiIC9+x6CMtH RiYiVogwEPFYfkCW/j2eL0pSXCgOnj6WPlLB3oj78R1RhaFW/kkhXaftcaWqKTX64N83 eGOh1lwDHV/ICnPtwQPl9kU/xsR9EkkS5OUx06UHHFuKv7T/qK4ZE5v3ZEb52XkUksLY jyZ58K5Q30iWGjJB+koWyIBdHtZXl5IVYufkPP3dxFMbq7tw3xO1SWN9EsuUOjtYbGB+ gTPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mGfht1UBsrZ6UvqcMv5Eu2bpjh1jOOi8jBo+//3ydJs=; b=LR3KS0vJmlgDDZD8YEc334EIouS7h1yx03TQ961AmzaoD9Z25iAQkixNNjFgoPE6DJ ZIYWEnKBqmDjlqeYvF7lK+FJ70jjGlyA8nyqTuRkrE3KNEKyIabiv50okqFfN267Yx1i akN4GFCtZ/DueL/mgR4i8zh/h/E5QWNSa7iyxlz9Yg8yriCTmSyz9QQuOYGzj+4ZUGLK QerKZsTQPIJZmTBdz+hTKiiBqQLq3CkNXDW5gRIIwvZS0adBtwkA3Jwj3/tjDSkVweHk m8AasBw/rO41ChXcgSmgDtuNqIpFX5B/EUUbu+gxr/fdFB0/a1mR0cWvari/mIIHu8aV iy8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=K7bn7LTL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si14660128ejj.198.2021.10.11.05.01.04; Mon, 11 Oct 2021 05:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=K7bn7LTL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234437AbhJKHbF (ORCPT + 99 others); Mon, 11 Oct 2021 03:31:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231974AbhJKHbE (ORCPT ); Mon, 11 Oct 2021 03:31:04 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494F2C061570; Mon, 11 Oct 2021 00:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mGfht1UBsrZ6UvqcMv5Eu2bpjh1jOOi8jBo+//3ydJs=; b=K7bn7LTL9gKXJSTNyy3bQ6DhsQ ywyR+DXdblSEowwb0Hj2rJ0gBh/okn2c1ODysK6uwJQzOh+ixJZyiZSCnaPjmE40/kRwHkA2dMraC q22Zewe7J5HaB89XenhzCexsVv0aniVyT49UUQ0bpBGF6pitSRU6KEIuYP30x/Eo2GUfpSitLQ6oD h5e3xinKiCJrohTG6MqxUHrqWewpfcV4R0j2/qT+yC/ncsLZ2t5wv6otljwfGSJBQTN3aQGkcQQQU QxppPZNIySwGfHHgD1qUlSG0ucEGJ/XYj6gSyULl9/SNFtsILF5ynXNnBx0fokdaCpAcBBoGf1FhA f8xtqLCQ==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZphE-005KVJ-53; Mon, 11 Oct 2021 07:26:26 +0000 Date: Mon, 11 Oct 2021 08:26:04 +0100 From: Christoph Hellwig To: Cai Huoqing Cc: Christoph Hellwig , Michael Cyr , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] scsi: ibmvscsi_tgt: Use dma_alloc_coherent() instead of get_zeroed_page/dma_map_single() Message-ID: References: <20211010160055.488-1-caihuoqing@baidu.com> <20211011070405.GA173@LAPTOP-UKSR4ENP.internal.baidu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211011070405.GA173@LAPTOP-UKSR4ENP.internal.baidu.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 11, 2021 at 03:04:05PM +0800, Cai Huoqing wrote: > dma_sync_ API is not called, I think the hardware may keep cache coherent > directly or is a no cache system. No need to make perfermance compare. On a device that is not attached in a cache coherent way (and that is the only one that matters here), dma_alloc_coherent will force every access to the memory to be uncached, while using dma_sync will only do a cache maintainance operation for each dma submission and completion. So yes, it matters. And Bart who has actually looked into the number has seen the sync case to be faster consistently for a SCSI ULP. Note that you can simplify and improve this case by using dma_alloc_noncoherent instead of a kernel allocator + dma_map_*.