Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp590676lqs; Thu, 13 Jun 2024 22:18:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXhJs40jDnZ7qN/7RKWDbenqzom8Pe/qoRsZAW2FH8QpS5fmN5cRatD09hy6+F0AeDA9NbIS9Tam9AtMgzjIJMpbGZ77bIbHf0FkOJEhg== X-Google-Smtp-Source: AGHT+IFSbdMJdorOkE595ArQxQlF4VEJJjRMFSClQSe/XG/KseV0QNBltXiO+eYIGaLx6tf81/oY X-Received: by 2002:a17:90a:528a:b0:2c2:f061:f583 with SMTP id 98e67ed59e1d1-2c4dc0288cfmr1768214a91.43.1718342301174; Thu, 13 Jun 2024 22:18:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718342301; cv=pass; d=google.com; s=arc-20160816; b=Jp6m3Q3PKsqvZuhD0wdh9KFYGhlItjtmyTDDzjmR9LdWcXmdmrBnGU9m2yaTe02NVQ mKo9k0Mv+Ls+n1NSLNa8yxQAtTVS2YxA8V+OeeyCTC80ZFgDYjU24GpEEfngyS2dM6ay YKqqBuNMLSYZt8RMGaMkjDYOTXyCavpBUQPKR2bCvKkvmCEY9fP8RyZFtg95npfRgzTp IT1+m4VPHYRF+5BTGrfhFqBxnWdgkUI+chULgfC0lypJ24IOsy+M6DhdHLUI3flypPSS mg5BHmAbF3lTMOTSsbEW2AH5UZtn+Mu5kkq/rHmTKTEug3hobvWKFluRaHypVZAPCVMt 480Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature:dkim-signature; bh=jw15wvUM0bUrXsSDBYWa6+RoE33b/QZPiR64fBVK6+Y=; fh=r28dj+HfKSOM3lPLqcMIabORnw42JliawujDqAOD3Zs=; b=YVLNdYuMn8flB1FwYryfjvIgnxwCDU0xgf1n1mQ1lyFuikoSODf7qLixj4S7tzoP/c q1k/gWrv5L1ILVK1wPFYclGdJc3Kn1vEKyGSnmFeuTnxoQSFowkoE+6vd3glinr3faNO rRIsiAtzOzP7s+ucKLTy6Sbu3uS3CNJYatiEYmoVTF2b3d3n/M7kJK81DascRrpkD2Hn zSNVTZ+T+m2Cf/2ixws/5+GvoYOswXZEZrdrXSe7l+IScEL0N6GoHhyWT6U5hnvXhjey 5X7V5mvwLIRoP2ppqKpFYbYG+PiW0XkC9eRAnbnpYc9BxTrip0K2+QIGj7LmpSn8NOru DhEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kroah.com header.s=fm1 header.b=pN48lbYw; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=NHXG2ldK; arc=pass (i=1 spf=pass spfdomain=kroah.com dkim=pass dkdomain=kroah.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=kroah.com); spf=pass (google.com: domain of linux-kernel+bounces-214361-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214361-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kroah.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4a75de5fesi5145362a91.10.2024.06.13.22.18.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 22:18:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214361-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kroah.com header.s=fm1 header.b=pN48lbYw; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=NHXG2ldK; arc=pass (i=1 spf=pass spfdomain=kroah.com dkim=pass dkdomain=kroah.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=kroah.com); spf=pass (google.com: domain of linux-kernel+bounces-214361-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214361-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kroah.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 91788282BCE for ; Fri, 14 Jun 2024 05:18:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 971A9146D6D; Fri, 14 Jun 2024 05:18:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="pN48lbYw"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="NHXG2ldK" Received: from wfout5-smtp.messagingengine.com (wfout5-smtp.messagingengine.com [64.147.123.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4076926ADE; Fri, 14 Jun 2024 05:18:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718342291; cv=none; b=kBXxSqQya5ChaLJkv3IkedTk4K2YxL+JnliaAmHX6X+uh2h25XapHJhkLUEbJ1j+ylPif8xJqTHKVFq7IdCnkJAGE05sg32JgC+AAOmZON2tmbhKV4yo4TKsAwqEJuraAopjer9dDYFIYphAwL/4Ymlm8QJdHv69rXOR5oYS1Rk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718342291; c=relaxed/simple; bh=juVv7rNlbtfr1exivJzn7GDEcB0KT6upcWHiyB1cYAw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lqn0kJ54cGRr8imHnAKuigel69ZaVjSRVelvg59iWPgXDNq8YFPGTG2wg92hLEqN7Fj89sXMSC5eQZHXi3zWlHSuv4bQallf37CV9XsExHvaY2zXz3rFSvM0Xd6cup1hz8JXvQbBHf4w25CDVOiYyhJhQ9MLF7LEs0pXGl3kkpk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kroah.com; spf=pass smtp.mailfrom=kroah.com; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b=pN48lbYw; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=NHXG2ldK; arc=none smtp.client-ip=64.147.123.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kroah.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kroah.com Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.west.internal (Postfix) with ESMTP id B9D7C1C000CE; Fri, 14 Jun 2024 01:18:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 14 Jun 2024 01:18:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1718342286; x=1718428686; bh=jw15wvUM0b UrXsSDBYWa6+RoE33b/QZPiR64fBVK6+Y=; b=pN48lbYw23Z5K391upOCzqWSYY WGbz/Fmuv1KnyTIXmx6E3E0ZUTF8TceVaTAat0vKTtokHBw3cqUpXF3XPFoKOy+Y qOsBth0dhNVoqwWNfeWZ6VnAs+gEi5LNzO3XXf/SpW0vyPJN2iwCbm4AhRVFWRHX gmQFSm51WZkIOQgnGx/zM2PlOjSzQU+k7L9cOvd0zWx8NZH3Oom4TWRNISPqXwMP YxnZKDpMTjqpp3qPf3DmrRu8rFsKMYsLzzUZq3XkHDyBqjKMRu0m8BpXk9hfgxpK aIh3WtfXYtCw4L2vbFTUVKcGO/K1H6wflcAT9pF48mGsZb9fGu/VlGTlLw3g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1718342286; x=1718428686; bh=jw15wvUM0bUrXsSDBYWa6+RoE33b /QZPiR64fBVK6+Y=; b=NHXG2ldKaj6rnp4/pCopGMZHdoWGK3zfiExhTXOru3wR SNHwMlXJMbot3HjgaYXxAt86fiA/Z+QqMvOl885BjsvuBWN67O/VoLt/P0TaGsm8 nUI4XaA102cbGl958b9+iNH4nfu8HV9x0sbBSsWrR9Z4OZBMj4ZWQlR5eZV4qfd3 cKoGboytqngbOjNMLtL/2BS69cf84rkJkN62T4H3ENHVLmqep1EwBnF8cjIhCcM/ rDHMDHhalfrMn5QtqYLlkfkm9c2iK2Ok0LITU3N19eBH/m+liDr9VycubtZHAz5Y dEDu85bYQTrg7IahoXixFOcX3gdhnJbFi/6uM1Gn9g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedukedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepifhrvghg ucfmjfcuoehgrhgvgheskhhrohgrhhdrtghomheqnecuggftrfgrthhtvghrnhepgeehue ehgfdtledutdelkeefgeejteegieekheefudeiffdvudeffeelvedttddvnecuffhomhgr ihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Jun 2024 01:18:04 -0400 (EDT) Date: Fri, 14 Jun 2024 07:18:01 +0200 From: Greg KH To: Bibek Kumar Patro Cc: "Isaac J. Manjarres" , stable@vger.kernel.org, Joerg Roedel , Will Deacon , Lu Baolu , Tom Murphy , Saravana Kannan , Joerg Roedel , kernel-team@android.com, iommu@lists.linux-foundation.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers Message-ID: <2024061450-pueblo-recipient-d4a6@gregkh> References: <2024012226-unmanned-marshy-5819@gregkh> <20240122203758.1435127-1-isaacmanjarres@google.com> <2024061311-washable-ranch-abc5@gregkh> <3c5034e9-d834-4ebe-a03d-1a222f8f22ac@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3c5034e9-d834-4ebe-a03d-1a222f8f22ac@quicinc.com> On Thu, Jun 13, 2024 at 11:10:57PM +0530, Bibek Kumar Patro wrote: > > > On 6/13/2024 4:45 PM, Greg KH wrote: > > On Thu, Jun 13, 2024 at 04:01:01PM +0530, Bibek Kumar Patro wrote: > > > On Mon, Jan 22, 2024 at 12:37:54PM -0800, Isaac J. Manjarres wrote: > > > > When commit 82612d66d51d ("iommu: Allow the dma-iommu api to > > > > use bounce buffers") was introduced, it did not add the logic > > > > for tracing the bounce buffer usage from iommu_dma_map_page(). > > > > > > > > All of the users of swiotlb_tbl_map_single() trace their bounce > > > > buffer usage, except iommu_dma_map_page(). This makes it difficult > > > > to track SWIOTLB usage from that function. Thus, trace bounce buffer > > > > usage from iommu_dma_map_page(). > > > > > > > > Fixes: 82612d66d51d ("iommu: Allow the dma-iommu api to use bounce buffers") > > > > Cc: stable@vger.kernel.org # v5.15+ > > > > Cc: Tom Murphy > > > > Cc: Lu Baolu > > > > Cc: Saravana Kannan > > > > Signed-off-by: Isaac J. Manjarres > > > > Link: https://lore.kernel.org/r/20231208234141.2356157-1-isaacmanjarres@google.com > > > > Signed-off-by: Joerg Roedel > > > > (cherry picked from commit a63c357b9fd56ad5fe64616f5b22835252c6a76a) > > > > Signed-off-by: Isaac J. Manjarres > > > > --- > > > > drivers/iommu/dma-iommu.c | 3 +++ > > > > 1 file changed, 3 insertions(+) > > > > > > > > diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c > > > > index 48c6f7ff4aef..8cd63e6ccd2c 100644 > > > > --- a/drivers/iommu/dma-iommu.c > > > > +++ b/drivers/iommu/dma-iommu.c > > > > @@ -25,6 +25,7 @@ > > > > #include > > > > #include > > > > #include > > > > +#include > > > > struct iommu_dma_msi_page { > > > > struct list_head list; > > > > @@ -817,6 +818,8 @@ static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page, > > > > void *padding_start; > > > > size_t padding_size, aligned_size; > > > > + trace_swiotlb_bounced(dev, phys, size, swiotlb_force); > > > > + > > > > > > Hi, this backported patch trying to access swiotlb_force variable is > > > causing a build conflict where CONFIG_SWIOTLB is not enabled. > > > > > > In file included from kernel/drivers/iommu/dma-iommu.c:28: > > > kernel/include/trace/events/swiotlb.h:15:9: error: declaration of 'enum SWIOTLB_NO_FORCE' will not be visible outside of this function [-Werror,-Wvisibility] > > > enum swiotlb_force swiotlb_force), > > > ^ > > > kernel/include/linux/swiotlb.h:143:23: note: expanded from macro 'swiotlb_force' > > > #define swiotlb_force SWIOTLB_NO_FORCE > > > ^ > > > In file included from kernel/drivers/iommu/dma-iommu.c:28: > > > kernel/include/trace/events/swiotlb.h:15:9: error: declaration of 'enum SWIOTLB_NO_FORCE' will not be visible outside of this function [-Werror,-Wvisibility] > > > kernel/include/linux/swiotlb.h:143:23: note: expanded from macro 'swiotlb_force' > > > #define swiotlb_force SWIOTLB_NO_FORCE > > > ^ > > > In file included from kernel/drivers/iommu/dma-iommu.c:28: > > > kernel/include/trace/events/swiotlb.h:15:9: error: declaration of 'enum SWIOTLB_NO_FORCE' will not be visible outside of this function [-Werror,-Wvisibility] > > > kernel/include/linux/swiotlb.h:143:23: note: expanded from macro 'swiotlb_force' > > > #define swiotlb_force SWIOTLB_NO_FORCE > > > ^ > > > In file included from kernel/drivers/iommu/dma-iommu.c:28: > > > kernel/include/trace/events/swiotlb.h:15:9: error: declaration of 'enum SWIOTLB_NO_FORCE' will not be visible outside of this function [-Werror,-Wvisibility] > > > kernel/include/linux/swiotlb.h:143:23: note: expanded from macro 'swiotlb_force' > > > #define swiotlb_force SWIOTLB_NO_FORCE > > > ^ > > > kernel/drivers/iommu/dma-iommu.c:865:42: error: argument type 'enum SWIOTLB_NO_FORCE' is incomplete > > > trace_swiotlb_bounced(dev, phys, size, swiotlb_force); > > > ^~~~~~~~~~~~~ > > > kernel/include/linux/swiotlb.h:143:23: note: expanded from macro 'swiotlb_force' > > > #define swiotlb_force SWIOTLB_NO_FORCE > > > ^~~~~~~~~~~~~~~~ > > > kernel/include/trace/events/swiotlb.h:15:9: note: forward declaration of 'enum SWIOTLB_NO_FORCE' > > > enum swiotlb_force swiotlb_force), > > > ^ > > > kernel/include/linux/swiotlb.h:143:23: note: expanded from macro 'swiotlb_force' > > > #define swiotlb_force SWIOTLB_NO_FORCE > > > > > > -------------------------------------------------------------------------------------------------------------------------------------------------- > > > > > > I have a simple proposed fix which can resolve this compile time conflict when CONFIG_SWIOTLB is disabled. > > > > > > --- a/include/trace/events/swiotlb.h > > > +++ b/include/trace/events/swiotlb.h > > > @@ -7,6 +7,7 @@ > > > > > > #include > > > > > > +#ifdef CONFIG_SWIOTLB > > > TRACE_EVENT(swiotlb_bounced, > > > > > > TP_PROTO(struct device *dev, > > > @@ -43,6 +44,9 @@ TRACE_EVENT(swiotlb_bounced, > > > { SWIOTLB_FORCE, "FORCE" }, > > > { SWIOTLB_NO_FORCE, "NO_FORCE" })) > > > ); > > > +#else > > > +#define trace_swiotlb_bounced(dev, phys, size, swiotlb_force) > > > +#endif /* CONFIG_SWIOTLB */ > > > > > > #endif /* _TRACE_SWIOTLB_H */ > > > > > > > > > > Why not just take whatever change upstream fixes this instead of a > > one-off change? > > > > I am currently checking the history on swiotlb_force and how it's > removed in latest kernel versions. If those changes are applicable on > this stable branch can we explore backporting those instead of this one- > off change ? Please backport what is in the tree already.