Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp68934lqs; Thu, 13 Jun 2024 04:15:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW0Eru8bXLEIXISE2WePN+pBRsreF9jtnYUP/agYG/ge4lzykcjito1a2XERZ/VFIJRW/z2PbFuJqOq5KfUx4RFBZe8KLEVggLD+hd9Hw== X-Google-Smtp-Source: AGHT+IEhj2fFqkcJS2M/S1xyZNMng8x70JzWKTuhxb4Z7I0kNWHnC+xT+5OZsDwzo2TfLFr7BPjm X-Received: by 2002:a17:907:72d6:b0:a6e:fc0f:5b61 with SMTP id a640c23a62f3a-a6f4801c1aemr369915866b.76.1718277344034; Thu, 13 Jun 2024 04:15:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718277344; cv=pass; d=google.com; s=arc-20160816; b=r+f4tEIaA3dz61QqjsLQbQWKgMkR6MKF5MugZZix1bFOJfYaodu/M9gT0hghuEaMsM reX2RfbqCjatwUcaMpE5/ZfYoZd+OveR/7Y3JEkL8ZGtxS6Aki9aLt2cqXJgGVUxwuA1 X0T39zWKqyWjpNMrvQCYxxUE6x1RrYPt6URG95dRIZhIwCv+pEyb83jwp/kgdftHWSYT FLd082+bj5itL6C5iLUd7fVyxr/9SFPv4TB3hiPnjmV3Z7mhj/wCigWGdSYd/NDrqvkf T002ZMH9WR+dJfyIXv8fUqEdIS/+bpdgGxwOBrwwW/p2mRhX5+FOZTgePVD1sNHEe45m aARw== 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=0Wxo1KWcaI+Qb9/p5w1SxDBWK8h/US2u4Q60jeymu50=; fh=r28dj+HfKSOM3lPLqcMIabORnw42JliawujDqAOD3Zs=; b=r4V8I1GKi+9zXIiCaPiLmjMi7pukhC/3iQRnKWshScqr6RndCJbveNxxs/bXSpWZ21 pIT20InhG3JM35zHGuowKEeyZE+MWVBpgJ4kR8Ko6QRCRurwgVcDkdKi7fCGU68iJOGG 2ocWiwi75/QdCsvnOCid3xhsABleu63TYm8cj2CAEjOTrAcJBYvRBzn5n7c348EMTuum bdWPS+u9WLh8pcSI3C+6MHUhmpWTvKkWpSao4B/TsnEZXdNAl6gSaRJUowICYIwpZCAK Irhg9PGCxfMBLoSMCGFk0YSAuasVRpGbm1KL846xBzS170RrR8/Hyulzy0K4cBbo9Y+4 Cw+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kroah.com header.s=fm1 header.b="fP9ojm/D"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=TaMZADIa; 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-213079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213079-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kroah.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56d21369si59400866b.90.2024.06.13.04.15.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 04:15:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kroah.com header.s=fm1 header.b="fP9ojm/D"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=TaMZADIa; 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-213079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213079-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 903A81F21E2E for ; Thu, 13 Jun 2024 11:15:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 30E19142E99; Thu, 13 Jun 2024 11:15:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="fP9ojm/D"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TaMZADIa" Received: from fout5-smtp.messagingengine.com (fout5-smtp.messagingengine.com [103.168.172.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 C121813C9C0; Thu, 13 Jun 2024 11:15:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718277334; cv=none; b=Ud2+dqIm1Yk6BInrYIgzsOtb0oc2874TtkxvBFpj+Azfa2ZfQzH7242P8BZJtJxFPUdHXXlXyawJ+zjVmQe0783YF7/TPb/GJe5SJFPljyNM5id7PnSw+zJUl5l3UOCChKH5KS4KH07B4JBFS55WtVmQbgMKS8nSnoVn8o+M3Ic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718277334; c=relaxed/simple; bh=0rqa/fHwKGmnIoA1MtAA/yL/+W5i/RGmhNKvuI9ctHg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gp/DJ/wITRstiOfMtPvzu2Y/wD6AXw789KpWke3qXyovFRcdvKTOdRYzRQAsOL+qUvByQ8Em4BvegJpoEr3+U08Ieoz1zy3yIC5yoK4/jnID4V0HsbScZOs4PPTAnyWHj3yrHD165vIhMwv3usmchXP4NuMKZKlRIdRLGPK4ybY= 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=fP9ojm/D; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TaMZADIa; arc=none smtp.client-ip=103.168.172.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.nyi.internal (Postfix) with ESMTP id EDD461380518; Thu, 13 Jun 2024 07:15:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 13 Jun 2024 07:15:30 -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=1718277330; x=1718363730; bh=0Wxo1KWcaI +Qb9/p5w1SxDBWK8h/US2u4Q60jeymu50=; b=fP9ojm/DwGMBXctq/uO9wegv76 RzY7j06fgUwARiysF8orJZGzEPSVmfNezQa5WHITvUG013du2Z0c+5H2y352QEzF V1Jk5Ff7XwrKDLmdWrFppkJlZzy8Vmsqe9OFMvBrxCyBjMs4QKwqopTldilQ8ZEy a8UsHXsm3Tj828Ma41C7tKxBLDnr66qBay/lv5Yu4YSknJn50CdkPQq0KPDT4kui d+pimju3AbaAedbTdzBItePj7EazVPxwvspYtVAn9dtolMdJUXwcUa9fBnSqDKg1 6/2aPfSZWwtWuoEbFzin2GjEToxpbO6OO20C4ee8nWqOGFnH3riDTr276LxQ== 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=1718277330; x=1718363730; bh=0Wxo1KWcaI+Qb9/p5w1SxDBWK8h/ US2u4Q60jeymu50=; b=TaMZADIaDJzwTWJsRLoJfHNJkNC4PLbPjwEnEIb9HlUb xUTLW+1n76zW1KG4xMgUk7BTP9BUHsQejV3iWxSQBEA67Qph7xw6BNnUaYcdELGM Ag/mtIc+icHNmJQC3Ho0ZbdbBBD7Ix2TPNNTJ1dkpcYcdFb3JoFf7dPsSlmeQHDx OOzBvSfhghNivYzFi6Meqiq5VOQdVAvM20KFcB1TLoq40O+d5HMwnrQ2ZHQ4Artm u5yTOgJ5svDygC84KTnS+g4RU4IaN3UcDrL2blW3GkLA2aUuqNheH4sN0JJ4qFE+ BX/dEKNDQyX5lYTY/uZPQlyiu7R2KUOmcxvb0bZQQQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedujedgfeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepifhrvghg ucfmjfcuoehgrhgvgheskhhrohgrhhdrtghomheqnecuggftrfgrthhtvghrnhepgeehue ehgfdtledutdelkeefgeejteegieekheefudeiffdvudeffeelvedttddvnecuffhomhgr ihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Jun 2024 07:15:29 -0400 (EDT) Date: Thu, 13 Jun 2024 13:15:27 +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: <2024061311-washable-ranch-abc5@gregkh> References: <2024012226-unmanned-marshy-5819@gregkh> <20240122203758.1435127-1-isaacmanjarres@google.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: 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? thanks greg k-h