Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3218244pxb; Sat, 9 Oct 2021 05:05:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6VYu2P6nrKHWU5bMxHCZryImwyKXqJrSEA6uYRiSdqWEnXi2Wt9WP1ZzZ26wQ/0hr8kIh X-Received: by 2002:a50:d50c:: with SMTP id u12mr23344694edi.118.1633781147114; Sat, 09 Oct 2021 05:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633781147; cv=none; d=google.com; s=arc-20160816; b=Ny7HvQXnQNnrAJbF8el1sR/IMhdaQb7wa24HMBZfRwypPqEySh3+0r1JwvKo/pYvcG N4FZLzQ26WnsJ432+lWp82ih755bFKKRCt6Ofai2ytqBqKV6c8VvsL5aOH3TClt0FUnq F68/LB6UR0917W00/PhDNvfxl8Xj+DHwOAJJkhS0rahfdL7qwVTX3nYOtLnKxaJV3ncW UT8Mjz3BKk72YcGWec7pH7X5hBk4arUskFH2MGhNy0VdZYqH3oVSn9xNyaKomny3Wf5y LeYB5eGSr3sqVMPz/h2rlEi53Qd1LJBb9Y3xGeoI2p9g4YFCYFQC8Jsj1F9xwO9VdBDm IPvA== 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=bek9xWETMTlFBMAhdun6whzi3TlXlBEYg4y3sK1uEHc=; b=bMRBymjFdQ2mDDWE1fTEYh2CAnwePGQFa+fbolrih2QRvzfVKkuj8fEwANTce2gHQx 6kDUxJYxzQ6IoekxmMe2fYuWA5lRPH2282jCsFx2pYP6E/m4nv+nrbUgSeD+vr+/gIi0 qufxhQ1HQy7YUPPQLfCYeYeaSOfWLWn0cep+c002XtryoPiQhbsBXZTA6AZlqjvG5wCv CgPZDO3TtosYNMqs1G11Af08NbBlZpl4L06EuKNbVPvHQ544OnDE5s8/YoNt0k+Kij22 Yz/sR2ULG+bi1D2+7aMDqinQxYKRReEsP24DxieXYR+DHgvxF0m2YHXDEnsEi/LsQ84+ ytcw== 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 mp24si4281416ejc.731.2021.10.09.05.05.19; Sat, 09 Oct 2021 05:05:47 -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 S233101AbhJIMFC (ORCPT + 99 others); Sat, 9 Oct 2021 08:05:02 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:13887 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbhJIMFB (ORCPT ); Sat, 9 Oct 2021 08:05:01 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HRNqX01vPz8ypN; Sat, 9 Oct 2021 19:58:16 +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 20:03:02 +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 20:03:02 +0800 Subject: Re: [PATCH] RDMA/hns: Use dma_alloc_coherent() instead of kmalloc/dma_map_single() To: Cai Huoqing References: <20210926061116.282-1-caihuoqing@baidu.com> <20210927115913.GA3544071@ziepe.ca> <20211004195224.GA2576309@nvidia.com> <07922740-2d3d-50dc-7239-421e39c42142@huawei.com> <20211009104246.GA1205@LAPTOP-UKSR4ENP.internal.baidu.com> CC: Jason Gunthorpe , Lijun Ou , "Weihang Li" , Doug Ledford , , From: Wenpeng Liang Message-ID: <28e67298-7ed5-399c-9052-d8c172e65062@huawei.com> Date: Sat, 9 Oct 2021 20:03:02 +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: <20211009104246.GA1205@LAPTOP-UKSR4ENP.internal.baidu.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.40.238.78] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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/9 18:42, Cai Huoqing wrote: > On 09 10月 21 17:50:50, Wenpeng Liang wrote: >> >> >> 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 > > > Hi Liang > > Thanks for your feedback. > > If you think my patch is correct, you can give a Reviewed-by: to it. > You can also give a Tested-by: to it, if the test on hardware was made. > > Thanks > Cai > . > Hi, Cai After testing, it seems ok to me. Reviewed-by: Wenpeng Liang Tested-by: Wenpeng Liang Thanks, Wenpeng