* [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers [not found] <2024012226-unmanned-marshy-5819@gregkh> @ 2024-01-22 20:37 ` Isaac J. Manjarres 2024-01-22 20:44 ` Greg KH 2024-06-13 10:31 ` Bibek Kumar Patro 0 siblings, 2 replies; 6+ messages in thread From: Isaac J. Manjarres @ 2024-01-22 20:37 UTC (permalink / raw) To: stable, Joerg Roedel, Will Deacon, Lu Baolu, Tom Murphy Cc: Isaac J. Manjarres, Saravana Kannan, Joerg Roedel, kernel-team, iommu, iommu, linux-kernel 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 <murphyt7@tcd.ie> Cc: Lu Baolu <baolu.lu@linux.intel.com> Cc: Saravana Kannan <saravanak@google.com> Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> Link: https://lore.kernel.org/r/20231208234141.2356157-1-isaacmanjarres@google.com Signed-off-by: Joerg Roedel <jroedel@suse.de> (cherry picked from commit a63c357b9fd56ad5fe64616f5b22835252c6a76a) Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> --- 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 <linux/vmalloc.h> #include <linux/crash_dump.h> #include <linux/dma-direct.h> +#include <trace/events/swiotlb.h> 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); + aligned_size = iova_align(iovad, size); phys = swiotlb_tbl_map_single(dev, phys, size, aligned_size, iova_mask(iovad), dir, attrs); -- 2.43.0.429.g432eaa2c6b-goog ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers 2024-01-22 20:37 ` [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers Isaac J. Manjarres @ 2024-01-22 20:44 ` Greg KH 2024-06-13 10:31 ` Bibek Kumar Patro 1 sibling, 0 replies; 6+ messages in thread From: Greg KH @ 2024-01-22 20:44 UTC (permalink / raw) To: Isaac J. Manjarres Cc: stable, Joerg Roedel, Will Deacon, Lu Baolu, Tom Murphy, Saravana Kannan, Joerg Roedel, kernel-team, iommu, iommu, linux-kernel 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 <murphyt7@tcd.ie> > Cc: Lu Baolu <baolu.lu@linux.intel.com> > Cc: Saravana Kannan <saravanak@google.com> > Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> > Link: https://lore.kernel.org/r/20231208234141.2356157-1-isaacmanjarres@google.com > Signed-off-by: Joerg Roedel <jroedel@suse.de> > (cherry picked from commit a63c357b9fd56ad5fe64616f5b22835252c6a76a) > Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> Now queued up, thanks. greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers 2024-01-22 20:37 ` [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers Isaac J. Manjarres 2024-01-22 20:44 ` Greg KH @ 2024-06-13 10:31 ` Bibek Kumar Patro 2024-06-13 11:15 ` Greg KH 1 sibling, 1 reply; 6+ messages in thread From: Bibek Kumar Patro @ 2024-06-13 10:31 UTC (permalink / raw) To: Isaac J. Manjarres Cc: stable, Joerg Roedel, Will Deacon, Lu Baolu, Tom Murphy, Saravana Kannan, Joerg Roedel, kernel-team, iommu, iommu, linux-kernel 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 <murphyt7@tcd.ie> > Cc: Lu Baolu <baolu.lu@linux.intel.com> > Cc: Saravana Kannan <saravanak@google.com> > Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> > Link: https://lore.kernel.org/r/20231208234141.2356157-1-isaacmanjarres@google.com > Signed-off-by: Joerg Roedel <jroedel@suse.de> > (cherry picked from commit a63c357b9fd56ad5fe64616f5b22835252c6a76a) > Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> > --- > 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 <linux/vmalloc.h> > #include <linux/crash_dump.h> > #include <linux/dma-direct.h> > +#include <trace/events/swiotlb.h> > > 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 <linux/tracepoint.h> +#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 */ Thanks & regards, Bibek > aligned_size = iova_align(iovad, size); > phys = swiotlb_tbl_map_single(dev, phys, size, aligned_size, > iova_mask(iovad), dir, attrs); > -- > 2.43.0.429.g432eaa2c6b-goog > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers 2024-06-13 10:31 ` Bibek Kumar Patro @ 2024-06-13 11:15 ` Greg KH 2024-06-13 17:40 ` Bibek Kumar Patro 0 siblings, 1 reply; 6+ messages in thread From: Greg KH @ 2024-06-13 11:15 UTC (permalink / raw) To: Bibek Kumar Patro Cc: Isaac J. Manjarres, stable, Joerg Roedel, Will Deacon, Lu Baolu, Tom Murphy, Saravana Kannan, Joerg Roedel, kernel-team, iommu, iommu, linux-kernel 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 <murphyt7@tcd.ie> > > Cc: Lu Baolu <baolu.lu@linux.intel.com> > > Cc: Saravana Kannan <saravanak@google.com> > > Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> > > Link: https://lore.kernel.org/r/20231208234141.2356157-1-isaacmanjarres@google.com > > Signed-off-by: Joerg Roedel <jroedel@suse.de> > > (cherry picked from commit a63c357b9fd56ad5fe64616f5b22835252c6a76a) > > Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> > > --- > > 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 <linux/vmalloc.h> > > #include <linux/crash_dump.h> > > #include <linux/dma-direct.h> > > +#include <trace/events/swiotlb.h> > > > > 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 <linux/tracepoint.h> > > +#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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers 2024-06-13 11:15 ` Greg KH @ 2024-06-13 17:40 ` Bibek Kumar Patro 2024-06-14 5:18 ` Greg KH 0 siblings, 1 reply; 6+ messages in thread From: Bibek Kumar Patro @ 2024-06-13 17:40 UTC (permalink / raw) To: Greg KH Cc: Isaac J. Manjarres, stable, Joerg Roedel, Will Deacon, Lu Baolu, Tom Murphy, Saravana Kannan, Joerg Roedel, kernel-team, iommu, iommu, linux-kernel 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 <murphyt7@tcd.ie> >>> Cc: Lu Baolu <baolu.lu@linux.intel.com> >>> Cc: Saravana Kannan <saravanak@google.com> >>> Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> >>> Link: https://lore.kernel.org/r/20231208234141.2356157-1-isaacmanjarres@google.com >>> Signed-off-by: Joerg Roedel <jroedel@suse.de> >>> (cherry picked from commit a63c357b9fd56ad5fe64616f5b22835252c6a76a) >>> Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> >>> --- >>> 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 <linux/vmalloc.h> >>> #include <linux/crash_dump.h> >>> #include <linux/dma-direct.h> >>> +#include <trace/events/swiotlb.h> >>> >>> 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 <linux/tracepoint.h> >> >> +#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 ? Thanks & regards, Bibek > thanks > > greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers 2024-06-13 17:40 ` Bibek Kumar Patro @ 2024-06-14 5:18 ` Greg KH 0 siblings, 0 replies; 6+ messages in thread From: Greg KH @ 2024-06-14 5:18 UTC (permalink / raw) To: Bibek Kumar Patro Cc: Isaac J. Manjarres, stable, Joerg Roedel, Will Deacon, Lu Baolu, Tom Murphy, Saravana Kannan, Joerg Roedel, kernel-team, iommu, iommu, linux-kernel 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 <murphyt7@tcd.ie> > > > > Cc: Lu Baolu <baolu.lu@linux.intel.com> > > > > Cc: Saravana Kannan <saravanak@google.com> > > > > Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> > > > > Link: https://lore.kernel.org/r/20231208234141.2356157-1-isaacmanjarres@google.com > > > > Signed-off-by: Joerg Roedel <jroedel@suse.de> > > > > (cherry picked from commit a63c357b9fd56ad5fe64616f5b22835252c6a76a) > > > > Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> > > > > --- > > > > 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 <linux/vmalloc.h> > > > > #include <linux/crash_dump.h> > > > > #include <linux/dma-direct.h> > > > > +#include <trace/events/swiotlb.h> > > > > 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 <linux/tracepoint.h> > > > > > > +#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. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-14 5:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <2024012226-unmanned-marshy-5819@gregkh>
2024-01-22 20:37 ` [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers Isaac J. Manjarres
2024-01-22 20:44 ` Greg KH
2024-06-13 10:31 ` Bibek Kumar Patro
2024-06-13 11:15 ` Greg KH
2024-06-13 17:40 ` Bibek Kumar Patro
2024-06-14 5:18 ` Greg KH
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox