Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3168469pxb; Sat, 9 Oct 2021 03:44:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm4xtm+MXRz/i5PUnpIatwbpNH+iM0QAlbWWK79CP5A5reqKFPYh07VGoAQyHEh3RPAdfP X-Received: by 2002:a17:90b:3901:: with SMTP id ob1mr18119611pjb.12.1633776293879; Sat, 09 Oct 2021 03:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633776293; cv=none; d=google.com; s=arc-20160816; b=YmLO4PnokEea0/pQ+ZonUokqtmOtkEsf2iyPhgglqdU4MHKEX0/xpSf9hpzuY/ghBO D0LLkw19t9esD+KIlUQF6gJK8eo/iNouibGsPd8ynazoLYla57h2hQny9IMCo63Kqh2N H2092BFlycdvnVfnsj4DrXcpQUerIyhK3fKJI+ZDbbbqSSv/gXbp2fsSbmkEeLGrPwCG ww/9rIg28CV61G8FPE+76zOtopV7d6AfYIz5KN5f98h786fYXsczFBhZHVw/HlfVR9FT lHpTr6ec6fUVwNPnF8WnxICE9C732j5n0u07zCEKosjvCHmlzK8GYeoHAU7NHs/PPyv3 wY8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=A8xZYq5BsCX73lsC0vNBxNPdwJuA3QFIA7hF6gdzc2E=; b=khAV5dMg2JoR+jL2ISVP8LqrWfTKD/0h53UQvPHsbF/p2WHlv4Us0j4WIJV5lYQzD8 l/15HALzGCrxErHld0mkHuk6X5KRDMiCSnCwWtH4dC6Dw+XrxPW7t2H9AZdDbM/NOEqE dUa5psxDizGM6ame8Ga7GnmBHJdaCKYYxzUp72E+uqctdlw+BYCjxICBt3c4NMvWEzny 0W+nE3+IMCE4DQN177rOKAuaiJZVBkt8TKXiajzKlGxL2Jbi8aTaRSxjvaxhAeIeVpGJ qwTwiHrQJcWYwVjtGKgAuRNMpUKuV/dHBGvdATUeDoBMOxb9TjlgGr31Sy97Nac7ybM2 Rczw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq23si2532962pjb.66.2021.10.09.03.44.40; Sat, 09 Oct 2021 03:44:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244412AbhJIKok (ORCPT + 99 others); Sat, 9 Oct 2021 06:44:40 -0400 Received: from mx24.baidu.com ([111.206.215.185]:35264 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232564AbhJIKoj (ORCPT ); Sat, 9 Oct 2021 06:44:39 -0400 Received: from BC-Mail-EX08.internal.baidu.com (unknown [172.31.51.48]) by Forcepoint Email with ESMTPS id 8F164A796E2FAAF1384F; Sat, 9 Oct 2021 18:42:40 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-EX08.internal.baidu.com (172.31.51.48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Sat, 9 Oct 2021 18:42:40 +0800 Received: from localhost (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Sat, 9 Oct 2021 18:42:40 +0800 Date: Sat, 9 Oct 2021 18:42:46 +0800 From: Cai Huoqing To: Wenpeng Liang CC: Jason Gunthorpe , Lijun Ou , "Weihang Li" , Doug Ledford , , Subject: Re: [PATCH] RDMA/hns: Use dma_alloc_coherent() instead of kmalloc/dma_map_single() Message-ID: <20211009104246.GA1205@LAPTOP-UKSR4ENP.internal.baidu.com> References: <20210926061116.282-1-caihuoqing@baidu.com> <20210927115913.GA3544071@ziepe.ca> <20211004195224.GA2576309@nvidia.com> <07922740-2d3d-50dc-7239-421e39c42142@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <07922740-2d3d-50dc-7239-421e39c42142@huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex21.internal.baidu.com (172.31.51.15) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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