Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3138978pxb; Sat, 9 Oct 2021 02:52:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPWd+j6LE64KmHLSkf9iOOpwBdeL4ir9sgDcXmW9DigGrS++1+n0cQxszydsT72VeqycOn X-Received: by 2002:a17:90a:c08d:: with SMTP id o13mr757633pjs.181.1633773160367; Sat, 09 Oct 2021 02:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633773160; cv=none; d=google.com; s=arc-20160816; b=ZTgs3MPemq709Waz4cEyfu2BD4juxY9pW1TfhZq1gnwgCBld+wE4DttrhqMi91VGsl U1C6Di3ZMUasqNvYyEza1k67CJgJPgkVGYTvlZeI7fosW7lHNnvm3TqJY2HCuXlUcjwb emZB8W/dXnx1AVLwg6zfmhgi2xaA4wVQLxNAJ/TE5G6EJRWZi6vO6QPI6NqCjuNfzCGr qfL8R8x7JEw4igGWqqH8MUGdekEkdn3VJJ77zqYzhsO7R4Xp1pcXInCpYOMJYyCEE40V pXf8eNE6s/OUCTFpbjNJjvw8bBDJyxifpFLW5uQh5Kn68edH65aEQkjI2+yKRuJ4BXHU CXmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=53G4maoJVq3eWFUK5oPJFe98SD5zZW4CxLv3iOIZURs=; b=YQhA5gydbT2kYvxowsogjsYchiwWrebkZR4vPDxzksoRDQYnqNRZTRrYdxSn1uhaf7 nDoHzHqjzrYDxqBWrLX/Yoh36u5/BjNnr2uxfkhe8LdKbJB3q1d9cPcsO9fuvEQz4/09 yiKDiS8xbUxJMY63r/a7jimEx9AeLakyDcfjCQX1ShaXT75RmQbYatRzG6IUUIbuPuAD +zkYCS1KNnFbw7ij5EGt4dd4yVAzpihnc+twRGS4z/zBiqStqvYUm9bmjhf09+WLWGoN Ex8wsi7JF6VdxasZD1Qydr3m/jXK58TK0imzGbzjAUiWzmeW7JRsVPJJ/Ys1FY5TBO1C Je8w== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v9si2324124pgs.14.2021.10.09.02.52.25; Sat, 09 Oct 2021 02:52:40 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232146AbhJIJwv (ORCPT + 99 others); Sat, 9 Oct 2021 05:52:51 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:23360 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbhJIJwu (ORCPT ); Sat, 9 Oct 2021 05:52:50 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HRKvQ4vd9zbcx4; Sat, 9 Oct 2021 17:46:26 +0800 (CST) Received: from dggpeml500017.china.huawei.com (7.185.36.243) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Sat, 9 Oct 2021 17:50:51 +0800 Received: from [10.40.238.78] (10.40.238.78) by dggpeml500017.china.huawei.com (7.185.36.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Sat, 9 Oct 2021 17:50:50 +0800 Subject: Re: [PATCH] RDMA/hns: Use dma_alloc_coherent() instead of kmalloc/dma_map_single() To: Jason Gunthorpe , Cai Huoqing References: <20210926061116.282-1-caihuoqing@baidu.com> <20210927115913.GA3544071@ziepe.ca> <20211004195224.GA2576309@nvidia.com> CC: Lijun Ou , Weihang Li , "Doug Ledford" , , From: Wenpeng Liang Message-ID: <07922740-2d3d-50dc-7239-421e39c42142@huawei.com> Date: Sat, 9 Oct 2021 17:50:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20211004195224.GA2576309@nvidia.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.40.238.78] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500017.china.huawei.com (7.185.36.243) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/10/5 3:52, Jason Gunthorpe wrote: > On Mon, Sep 27, 2021 at 08:59:13AM -0300, Jason Gunthorpe wrote: >> On Sun, Sep 26, 2021 at 02:11:15PM +0800, Cai Huoqing wrote: >>> Replacing kmalloc/kfree/dma_map_single/dma_unmap_single() >>> with dma_alloc_coherent/dma_free_coherent() helps to reduce >>> code size, and simplify the code, and coherent DMA will not >>> clear the cache every time. >>> >>> Signed-off-by: Cai Huoqing >>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 20 +++++--------------- >>> 1 file changed, 5 insertions(+), 15 deletions(-) >> >> Given I don't see any dma_sync_single calls for this mapping, isn't >> this a correctness fix too? > > HNS folks? > > Jason > . > Our SoC can keep cache coherent, so there is no exception even if dma_sync_single* is not called, but the driver should not make assumptions about SoC. So using dma_alloc_coherent() instead of kmalloc/dma_map_single() can simplify the code and achieve the same purpose. Wenpeng Liang