Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2110726pxb; Mon, 11 Oct 2021 22:24:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDb1nrWLRML8vbd4irv67xP6KhZdTr+IQMk1662aUd9JnldyAfglHwFSX03RncFAxyg+9+ X-Received: by 2002:a17:902:b218:b029:11a:bf7b:1a80 with SMTP id t24-20020a170902b218b029011abf7b1a80mr28091900plr.82.1634016246258; Mon, 11 Oct 2021 22:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634016246; cv=none; d=google.com; s=arc-20160816; b=Yprf0uV7zVpcU0iB6HnLkZBgpFA74j7tM8SCpJhAZpVH+OSfpmsUnoe4IgFb1UotYW s+TEOHyZ4okoBIbMxQn+fNPiluRe56XvOhc0qj7nsnqI5f29b1eOrqXqQxkzCma0eYs1 6qWwHXIA528qcLrVA2aFqTOZtdQTjUXGT9VohHk/j9gaUkeg7LzxEgdYK0vQLBIG8m07 eYbAnxPFaABi6bv+SI0S5kEtD5Rik79OiGHJ9o7J/r6V16G3ZJurvhULdeCzM/+IQxLf j1jqUnAspbi0G9OOm6kZLYrb3vJW7jVqN8Rj8mAxd7uebh3cUJ64FfyyIO2RNyGgFMqW hN3g== 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=XAz8rVhhb14wB+TibMDkEqhtITE0PMmuAuXWrjIvzRE=; b=zAaR95alWkjvjIHso2+nsxVbH14mIwlb0az8HbQDhJoG3RKwrzHFVrcrd6u8k+DkKj 9/8e3bY8AKvOtNb2EEs9211JJzdzUrGozoCo71YUaL+T/vPZQw3+i/JEY0FXGujJ1OTK KYWsuHLlzQVASpGg2wXmAt64cEs0f84AODtdXfqVuaxO7xUEskW7V3J9RtXZwtilVCCI RiyEDzMVQpS1taSsSVN34cxA2EfEe0Z2jnmOWUTZgMKWl/TKKJavRVwZZeZipPrWBrmc htHXUuFf4CcGdyy+/Af64lCjnScpPhBU3+s0gJsvKy73wo+pcir/291G7N5/Oo13PnRV qgaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=nP8WXylC; 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 n24si12199443pfv.145.2021.10.11.22.23.52; Mon, 11 Oct 2021 22:24:06 -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=nP8WXylC; 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 S232374AbhJLFYI (ORCPT + 99 others); Tue, 12 Oct 2021 01:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231254AbhJLFYH (ORCPT ); Tue, 12 Oct 2021 01:24:07 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80AF8C061570; Mon, 11 Oct 2021 22:22:06 -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=XAz8rVhhb14wB+TibMDkEqhtITE0PMmuAuXWrjIvzRE=; b=nP8WXylCSX4cMJHGeoDA1pQ048 pt3n9WkaswMXiIPFewA/CCeygsP2e/0U9jJFaUdQS5+ACk8U8QAeVkTmcoDeB/tmEDjr2k+VVgk+0 Jy6M+oGSW4t5mnR7veeXHXfokjYnwphfYNF0j3fU3uDGbK6cl/Wlos3a4T9FlE+8qmwTlj9+BxhMP O0CYzPF60mqNKH2z4hXPNJ8oVTW/+vsPNaWLe4yk1QXxi7F8ICeysJ2RPz421hSWyQ3dYBWb2fdQv aMh1+H1QsWbQIiZC0ktbeBz3Sk+PFCvgDRSEZ92lHHKjx/1i9NMQfGmQfobzUb7mSW54UM0U5/2E4 5t5BdtSA==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1maADI-006EV4-UB; Tue, 12 Oct 2021 05:20:45 +0000 Date: Tue, 12 Oct 2021 06:20:32 +0100 From: Christoph Hellwig To: Cai Huoqing Cc: hch@infradead.org, 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 v2] scsi: ibmvscsi_tgt: Use dma_alloc_noncoherent() instead of get_zeroed_page/dma_map_single() Message-ID: References: <20211012032110.2224-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211012032110.2224-1-caihuoqing@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 Tue, Oct 12, 2021 at 11:21:09AM +0800, Cai Huoqing wrote: > Replacing get_zeroed_page/free_page/dma_map_single/dma_unmap_single() > with dma_alloc_noncoherent/dma_free_noncoherent() helps to reduce > code size, and simplify the code, and the hardware keep DMA coherent > itself. It might also be worth to mention that this also avoids potential bounce buffering. Although for pseries vio devices this probably can't happen anyway. > + vscsi->cmd_q.base_addr = dma_alloc_noncoherent(&vdev->dev, PAGE_SIZE, > + &vscsi->cmd_q.crq_token, > + DMA_BIDIRECTIONAL, GFP_KERNEL); Please avoid the overly long line. The same comments also apply to the other patch.