lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241018150036.2878190-2-sean.anderson@linux.dev>
Date: Fri, 18 Oct 2024 11:00:34 -0400
From: Sean Anderson <sean.anderson@...ux.dev>
To: Christoph Hellwig <hch@....de>,
	iommu@...ts.linux.dev
Cc: Robin Murphy <robin.murphy@....com>,
	linux-trace-kernel@...r.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	linux-kernel@...r.kernel.org,
	Sean Anderson <sean.anderson@...ux.dev>
Subject: [PATCH v2 1/4] dma-mapping: Use macros to define events in a class

Use a macro to avoid repeating the parameters and arguments for each event
in a class.

Signed-off-by: Sean Anderson <sean.anderson@...ux.dev>
---

Changes in v2:
- New

 include/trace/events/dma.h | 60 ++++++++++++++++++--------------------
 1 file changed, 28 insertions(+), 32 deletions(-)

diff --git a/include/trace/events/dma.h b/include/trace/events/dma.h
index b0f41265191c..3d348cea4d7c 100644
--- a/include/trace/events/dma.h
+++ b/include/trace/events/dma.h
@@ -65,15 +65,14 @@ DECLARE_EVENT_CLASS(dma_map,
 		decode_dma_attrs(__entry->attrs))
 );
 
-DEFINE_EVENT(dma_map, dma_map_page,
-	TP_PROTO(struct device *dev, phys_addr_t phys_addr, dma_addr_t dma_addr,
-		 size_t size, enum dma_data_direction dir, unsigned long attrs),
-	TP_ARGS(dev, phys_addr, dma_addr, size, dir, attrs));
+#define DEFINE_MAP_EVENT(name) \
+DEFINE_EVENT(dma_map, name, \
+	TP_PROTO(struct device *dev, phys_addr_t phys_addr, dma_addr_t dma_addr, \
+		 size_t size, enum dma_data_direction dir, unsigned long attrs), \
+	TP_ARGS(dev, phys_addr, dma_addr, size, dir, attrs))
 
-DEFINE_EVENT(dma_map, dma_map_resource,
-	TP_PROTO(struct device *dev, phys_addr_t phys_addr, dma_addr_t dma_addr,
-		 size_t size, enum dma_data_direction dir, unsigned long attrs),
-	TP_ARGS(dev, phys_addr, dma_addr, size, dir, attrs));
+DEFINE_MAP_EVENT(dma_map_page);
+DEFINE_MAP_EVENT(dma_map_resource);
 
 DECLARE_EVENT_CLASS(dma_unmap,
 	TP_PROTO(struct device *dev, dma_addr_t addr, size_t size,
@@ -104,15 +103,14 @@ DECLARE_EVENT_CLASS(dma_unmap,
 		decode_dma_attrs(__entry->attrs))
 );
 
-DEFINE_EVENT(dma_unmap, dma_unmap_page,
-	TP_PROTO(struct device *dev, dma_addr_t addr, size_t size,
-		 enum dma_data_direction dir, unsigned long attrs),
-	TP_ARGS(dev, addr, size, dir, attrs));
+#define DEFINE_UNMAP_EVENT(name) \
+DEFINE_EVENT(dma_unmap, name, \
+	TP_PROTO(struct device *dev, dma_addr_t addr, size_t size, \
+		 enum dma_data_direction dir, unsigned long attrs), \
+	TP_ARGS(dev, addr, size, dir, attrs))
 
-DEFINE_EVENT(dma_unmap, dma_unmap_resource,
-	TP_PROTO(struct device *dev, dma_addr_t addr, size_t size,
-		 enum dma_data_direction dir, unsigned long attrs),
-	TP_ARGS(dev, addr, size, dir, attrs));
+DEFINE_UNMAP_EVENT(dma_unmap_page);
+DEFINE_UNMAP_EVENT(dma_unmap_resource);
 
 TRACE_EVENT(dma_alloc,
 	TP_PROTO(struct device *dev, void *virt_addr, dma_addr_t dma_addr,
@@ -279,15 +277,14 @@ DECLARE_EVENT_CLASS(dma_sync_single,
 		__entry->size)
 );
 
-DEFINE_EVENT(dma_sync_single, dma_sync_single_for_cpu,
-	TP_PROTO(struct device *dev, dma_addr_t dma_addr, size_t size,
-		 enum dma_data_direction dir),
-	TP_ARGS(dev, dma_addr, size, dir));
+#define DEFINE_SYNC_SINGLE_EVENT(name) \
+DEFINE_EVENT(dma_sync_single, name, \
+	TP_PROTO(struct device *dev, dma_addr_t dma_addr, size_t size, \
+		 enum dma_data_direction dir), \
+	TP_ARGS(dev, dma_addr, size, dir))
 
-DEFINE_EVENT(dma_sync_single, dma_sync_single_for_device,
-	TP_PROTO(struct device *dev, dma_addr_t dma_addr, size_t size,
-		 enum dma_data_direction dir),
-	TP_ARGS(dev, dma_addr, size, dir));
+DEFINE_SYNC_SINGLE_EVENT(dma_sync_single_for_cpu);
+DEFINE_SYNC_SINGLE_EVENT(dma_sync_single_for_device);
 
 DECLARE_EVENT_CLASS(dma_sync_sg,
 	TP_PROTO(struct device *dev, struct scatterlist *sgl, int nents,
@@ -326,15 +323,14 @@ DECLARE_EVENT_CLASS(dma_sync_sg,
 				sizeof(unsigned int), sizeof(unsigned int)))
 );
 
-DEFINE_EVENT(dma_sync_sg, dma_sync_sg_for_cpu,
-	TP_PROTO(struct device *dev, struct scatterlist *sg, int nents,
-		 enum dma_data_direction dir),
-	TP_ARGS(dev, sg, nents, dir));
+#define DEFINE_SYNC_SG_EVENT(name) \
+DEFINE_EVENT(dma_sync_sg, name, \
+	TP_PROTO(struct device *dev, struct scatterlist *sg, int nents, \
+		 enum dma_data_direction dir), \
+	TP_ARGS(dev, sg, nents, dir))
 
-DEFINE_EVENT(dma_sync_sg, dma_sync_sg_for_device,
-	TP_PROTO(struct device *dev, struct scatterlist *sg, int nents,
-		 enum dma_data_direction dir),
-	TP_ARGS(dev, sg, nents, dir));
+DEFINE_SYNC_SG_EVENT(dma_sync_sg_for_cpu);
+DEFINE_SYNC_SG_EVENT(dma_sync_sg_for_device);
 
 #endif /*  _TRACE_DMA_H */
 
-- 
2.35.1.1320.gc452695387.dirty


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ