Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp344179rdb; Mon, 29 Jan 2024 04:15:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnQWxuflq0aXgdED0hVoGXwLUobyidDSnvgRWJalS4wFBFhH3+7n8sYDuToWo765ZPc5D9 X-Received: by 2002:a17:906:f14f:b0:a35:ee95:7e69 with SMTP id gw15-20020a170906f14f00b00a35ee957e69mr603874ejb.28.1706530533730; Mon, 29 Jan 2024 04:15:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706530533; cv=pass; d=google.com; s=arc-20160816; b=NJWXXuBHdgW+Ix27IQe8+2SG8BFiXbgb8D6Q5aG68BgK1DkW0RFABNZr/kJvn/RthT yVsZww06NKAlVdarANngrJp12pVp/PqTVx2cbuFHIsNEsMJRUFI3nlbT0eMSVSnRCS74 JY4tMsEXRU4PClj9XXdnl9vKTdkqR2DUkLQhqgHuKaeGlyiJ2BPugA9l637Sm5aZrhHj iUtqEX9pkrMu9Xml/CrvPzo7IjzGqj8sLDqAiJpAqG74niIMMIFTFm1UsO4Fw6NUbND0 47DPrK7g4KO7+/K8qhNkFoXcyZ5DHkx+HxRgdSlwtuJHXs25INsytjc25iRLARlf6OGl xNeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=/ZZolbxJgtZduNcEWHtXVQHu2cCc2hxYzdGHywo7ft8=; fh=ttHlJh0cCu9MohqjT1OG1tBjALO4D8Prh7Jr+FqxCzw=; b=n3DEmBngS95t9v7ViYlWFkoT4+DXTGAf7S+m7v7ckueeQv9go+F2XtGP5qwpwQnvix ndXNkQpDyJwqlgpH5yWhHr44c7j4tnqzzEiSG4QWC/AkJh2rtNt09X4s59xaCloCj78m 2XWl8FwVaIuO7mADak8CYjv6J926RI3kljLpJ8rK2RI/ok59mn6oIaQKCMWXKk65pSUt cfl6xlCkB5FMvUnxb5qbRS7RR3s5iSBdaGXZZVGtm5OO48t/hSl9AoxO/o896clcMSUn NV6XwPDLx2UkjZgJT+C6AjQTxNA2Fucxm3M7PiO9ClXdEQWZ8hpYzKdDE327CUNz3dME TsnA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-42675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42675-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k24-20020a170906a39800b00a3551fb1384si2158390ejz.787.2024.01.29.04.15.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 04:15:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-42675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42675-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7BA391F23962 for ; Mon, 29 Jan 2024 12:15:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47E86605AB; Mon, 29 Jan 2024 12:15:15 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3D4F604AA; Mon, 29 Jan 2024 12:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706530514; cv=none; b=J3+TrflixdwayOLQQV81P2iEqIXTIZVQAFoeFv0URYieRtUEfrSIq5vH/5ino5GuM91/S+2yc6eltviaxj1yilstCd4x1QET1bRl8nykYFKrXlW74tgGQBhjuMQLngcKSOPINrYFSIYzGKYengoBP5zm+1EfnvwemRNBk13r0Jc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706530514; c=relaxed/simple; bh=CI2SITbEyDMK/SnfUcFawfQgI/5HdPELOd7hdQeM9Fw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=uRD69cEOQSMzB7OMSXmKXP/6aOB+tyGHxs/g+1kBa7qPWsLBScS+Gm7mCz7NoJ/Cpz957Zalcmq/vwKBQ+pB+1w5BPsSA6VW+pRrAfOmv+TiPRRk67AMYsQsOuv9UOg47vGFxwB9gG1Bt2H5s3LpaqHvoeqOi7Iuv14vHI+PBOQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 296821FB; Mon, 29 Jan 2024 04:15:56 -0800 (PST) Received: from [10.57.77.253] (unknown [10.57.77.253]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A8F643F5A1; Mon, 29 Jan 2024 04:15:09 -0800 (PST) Message-ID: Date: Mon, 29 Jan 2024 12:15:07 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next 1/7] dma: compile-out DMA sync op calls when not used Content-Language: en-GB To: Alexander Lobakin , Christoph Hellwig Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marek Szyprowski , Joerg Roedel , Will Deacon , Greg Kroah-Hartman , "Rafael J. Wysocki" , Magnus Karlsson , Maciej Fijalkowski , Alexander Duyck , bpf@vger.kernel.org, netdev@vger.kernel.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org References: <20240126135456.704351-1-aleksander.lobakin@intel.com> <20240126135456.704351-2-aleksander.lobakin@intel.com> <20240129061136.GD19258@lst.de> <4e23d103-ea1c-4fd3-852e-f7e2ec9170ad@intel.com> From: Robin Murphy In-Reply-To: <4e23d103-ea1c-4fd3-852e-f7e2ec9170ad@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-01-29 11:07 am, Alexander Lobakin wrote: > From: Christoph Hellwig > Date: Mon, 29 Jan 2024 07:11:36 +0100 > >> On Fri, Jan 26, 2024 at 02:54:50PM +0100, Alexander Lobakin wrote: >>> Some platforms do have DMA, but DMA there is always direct and coherent. >>> Currently, even on such platforms DMA sync operations are compiled and >>> called. >>> Add a new hidden Kconfig symbol, DMA_NEED_SYNC, and set it only when >>> either sync operations are needed or there is DMA ops or swiotlb >>> enabled. Set dma_need_sync() and dma_skip_sync() (stub for now) >>> depending on this symbol state and don't call sync ops when >>> dma_skip_sync() is true. >>> The change allows for future optimizations of DMA sync calls depending >>> on compile-time or runtime conditions. >> >> So the idea of compiling out the calls sounds fine to me. But what >> is the point of the extra indirection through the __-prefixed calls? > > Because dma_sync_* ops are external functions, not inlines, and in the > next patch I'm adding a check there. > >> >> And if we need that (please document it in the commit log), please >> make the wrappers proper inline functions and not macros. In fact those wrappers could perhaps subsume the existing stub definitions, by starting with a refactor along these lines: static inline dma_sync_x(...) { if (IS_ENABLED(CONFIG_NEED_DMA_SYNC)) __dma_sync_x(...); } Cheers, Robin.