Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3890474pxb; Mon, 27 Sep 2021 05:06:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXuucgmlL8OQ3fyllHkRIhuc620QyN6iJ/RCXiP0wNUV5UaoLxM7EvntG55quM/S8X0LT1 X-Received: by 2002:a50:8226:: with SMTP id 35mr8387959edf.54.1632744383651; Mon, 27 Sep 2021 05:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632744383; cv=none; d=google.com; s=arc-20160816; b=NcwhBPMPgGkw1/R0/JUcpSMhh2JiHsEINkWwEqzOZrqOUVgQV/A/e0RAad2JDeNPnA 9cA0CZvm0dFWZxDunFRaG/PLmWVKj8frDiPohUzInFAZU2/KyKjIgPad4GakOO9B6iIm yOnFEMR6/T+94JnlNtalwylvuXmYlF2D0e5vaIaf8ijnFqplaeF88p2e6C6zGNsFLm8h hFF3HEeiRLX/GXjjuKooHihjEofYV2tMT89WNyLdzPpyL9FJlW9KrA84J83xU59aG0aP NxNQpSxD1aPQ66Vmb7DKkrmc0rQ47lcYBsYDGx7VcNyxq9LrRH1oDeoMxzcKOCMmC1Wv fY+Q== 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=qLGMzgcPQFDHN83z8jWEK1bxNWkGjHVB+skJQt3mBYM=; b=nsEoHGLl/eMhItVUFOLOuwkJevJEjYqXNll3zUuaStoFAoyhjCFSmYJUfdFxbG02aK VTcIiQ02TgORh8TG05WL6swpKx5I2t1bsnhp8xgNcb6+XaUCVzq8e0juWanXFVcvBsJP YM1Y/FZJPPQVu0Al4UoTUBiPARaUsUO1Pyu3C/Zp5yOqGPANS631pqJe1apV1i/4h3W0 ay6+avhJVpVMbqXHJDewE+t67Qhm10VO0XOIQbdgDISXQJTnHDH6VQaXoCjVv63BtNMh piQiczJth3LYtIKqIOmtBJDb9ATGadAfL3ZpvmsE7Fk+TOvpUl5ZGmxAaeXlqKRJX7Um 8iSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=SZY2ZrwP; 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 gn9si22041597ejc.136.2021.09.27.05.04.01; Mon, 27 Sep 2021 05:06:23 -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=@ziepe.ca header.s=google header.b=SZY2ZrwP; 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 S234134AbhI0MEP (ORCPT + 99 others); Mon, 27 Sep 2021 08:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234126AbhI0MEP (ORCPT ); Mon, 27 Sep 2021 08:04:15 -0400 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EA17C061575 for ; Mon, 27 Sep 2021 05:02:37 -0700 (PDT) Received: by mail-qv1-xf31.google.com with SMTP id jo30so10935596qvb.3 for ; Mon, 27 Sep 2021 05:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=qLGMzgcPQFDHN83z8jWEK1bxNWkGjHVB+skJQt3mBYM=; b=SZY2ZrwPe20b6a9vWLqE0BRLWU5FDF9P5daqr8K7SurQjxhf296eJQASmtduozOVqI l0oP1W18sDA45eA36zvQgku5Xn07XBeiQGWpll4l+Qntgc8RGrNB6CQhJ3W/JHBtjWER UatI4ehAV1GLfODmmvipXAH/XJ3cCnXlK+zvdFzyemLARSvJFBHJKRitjHQxDD92HNIv sBsMtEK+erfKRxztQU9F32Z0NDOqrN7Zslgw+zhbDRODvemvO3WeVzXAJArXNsNIMPDc UGxR1xXfJcQCHSu7NTcpI79Tmn3CdyJbt+c9tgpQz4mtJ/MjZa6iaZfSF5g3O3g/B9WO hDMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qLGMzgcPQFDHN83z8jWEK1bxNWkGjHVB+skJQt3mBYM=; b=c8nx/LcAaBPC6idjxGxGC+1nKhY6ofZTZLjezIldN7s/+Si8HvKpx/Sah7di+vK1Rd 5QfE39Nj5S6aaLxa9ae2wQGEfrLgWjlCsV+b7zx664sVtLcPf3NM5dG4EpKSpRXwu02y 1We/nbdM4e5i8lk4hCn5452qOhebNx9wM5mdnvXXM7CydKZ08A8qjFu0vTJVOBMgYEQ4 1vOYpdYtiG4nJoUAJECG6ROJIZmFMSon0yo6MxQZJK7Zszn+jEtRw3Rm4tSGShfYF5fk VpgGUN4/JvjN2MRIMpTDW0Oj1yHgpTro3VBvuZhDDfjlmxCdqyIggckaxku1SydtRjfX x3rA== X-Gm-Message-State: AOAM531zgi/xXoT3fsJ/TRw3EVSoX7+VhYCnJ9lpmjAMnYrChX5kLOTv N051mkoHifKNaLR0DhhLez6vWUhN3uzXzA== X-Received: by 2002:ad4:568f:: with SMTP id bc15mr658137qvb.44.1632744156813; Mon, 27 Sep 2021 05:02:36 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id s12sm12065144qkm.116.2021.09.27.05.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 05:02:36 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mUpL9-006J0p-OP; Mon, 27 Sep 2021 09:02:35 -0300 Date: Mon, 27 Sep 2021 09:02:35 -0300 From: Jason Gunthorpe To: Cai Huoqing Cc: Mustafa Ismail , Shiraz Saleem , Doug Ledford , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] RDMA/irdma: Use dma_alloc_coherent() instead of kmalloc/dma_map_single() Message-ID: <20210927120235.GB3544071@ziepe.ca> References: <20210926061124.335-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210926061124.335-1-caihuoqing@baidu.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 26, 2021 at 02:11:23PM +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/irdma/puda.c | 19 ++++--------------- > 1 file changed, 4 insertions(+), 15 deletions(-) This I'm not sure about, I see lots of calls to dma_sync_single_* for this memory and it is not unconditionally true that using coherent memory is better than doing the cache flushes. It depends very much on the access pattern. At the very least if you convert to coherent memory I expect to see the sync's removed too.. Jason