All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] iommu: Add iommu_error class event to iommu trace
@ 2013-09-24 21:21 ` Shuah Khan
  0 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2013-09-24 21:21 UTC (permalink / raw)
  To: joro, alex.williamson, Varun.Sethi, udknight, aik, rostedt,
	fweisbec, mingo
  Cc: Shuah Khan, linux-kernel, iommu, shuahkhan

This patch set adds iommu_error class event to iommu trace. iommu_error class
event can be enabled to trigger when an iommu error occurs. This trace event
is intended to be called to report the error information. Trace information
includes driver name, device name, iova, and flags.

iommu_error:io_page_fault

This patch set depends on the previous patch set that added iommu tracing
feature. Reference:

http://www.kernelhub.org/?msg=313155&p=2
http://www.kernelhub.org/?msg=313156&p=2

Shuah Khan (2):
  iommu: Add iommu_error class event to iommu trace
  iommu: Change iommu driver to call io_page_fault trace event

 drivers/iommu/iommu-traces.c |  3 +++
 include/linux/iommu.h        |  2 ++
 include/trace/events/iommu.h | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+)

-- 
1.8.1.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v4 0/2] iommu: Add iommu_error class event to iommu trace
@ 2013-09-24 21:21 ` Shuah Khan
  0 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2013-09-24 21:21 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A,
	alex.williamson-H+wXaHxf7aLQT0dZR+AlfA,
	Varun.Sethi-KZfg59tc24xl57MIdRCFDg,
	udknight-Re5JQEeQqe8AvxtiuMwx3w, aik-sLpHqDYs0B2HXe+LvDLADg,
	rostedt-nx8X9YLhiw1AfugRpC6u6w, fweisbec-Re5JQEeQqe8AvxtiuMwx3w,
	mingo-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Shuah Khan, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	shuahkhan-Re5JQEeQqe8AvxtiuMwx3w

This patch set adds iommu_error class event to iommu trace. iommu_error class
event can be enabled to trigger when an iommu error occurs. This trace event
is intended to be called to report the error information. Trace information
includes driver name, device name, iova, and flags.

iommu_error:io_page_fault

This patch set depends on the previous patch set that added iommu tracing
feature. Reference:

http://www.kernelhub.org/?msg=313155&p=2
http://www.kernelhub.org/?msg=313156&p=2

Shuah Khan (2):
  iommu: Add iommu_error class event to iommu trace
  iommu: Change iommu driver to call io_page_fault trace event

 drivers/iommu/iommu-traces.c |  3 +++
 include/linux/iommu.h        |  2 ++
 include/trace/events/iommu.h | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+)

-- 
1.8.1.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v4 1/2] iommu: Add iommu_error class event to iommu trace
@ 2013-09-24 21:21   ` Shuah Khan
  0 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2013-09-24 21:21 UTC (permalink / raw)
  To: joro, alex.williamson, Varun.Sethi, udknight, aik, rostedt,
	fweisbec, mingo
  Cc: Shuah Khan, linux-kernel, iommu, shuahkhan

iommu_error class event can be enabled to trigger when an iommu
error occurs. This trace event is intended to be called to report the
error information. Trace information includes driver name, device name,
iova, and flags.

iommu_error:io_page_fault

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/iommu/iommu-traces.c |  3 +++
 include/trace/events/iommu.h | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/drivers/iommu/iommu-traces.c b/drivers/iommu/iommu-traces.c
index a2af60f..71ac5fa 100644
--- a/drivers/iommu/iommu-traces.c
+++ b/drivers/iommu/iommu-traces.c
@@ -22,3 +22,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(detach_device_from_domain);
 /* iommu_map_unmap */
 EXPORT_TRACEPOINT_SYMBOL_GPL(map);
 EXPORT_TRACEPOINT_SYMBOL_GPL(unmap);
+
+/* iommu_error */
+EXPORT_TRACEPOINT_SYMBOL_GPL(io_page_fault);
diff --git a/include/trace/events/iommu.h b/include/trace/events/iommu.h
index 86bcc5a..a8f5c32 100644
--- a/include/trace/events/iommu.h
+++ b/include/trace/events/iommu.h
@@ -123,6 +123,39 @@ DEFINE_EVENT_PRINT(iommu_map_unmap, unmap,
 			__entry->iova, __entry->size
 	)
 );
+
+DECLARE_EVENT_CLASS(iommu_error,
+
+	TP_PROTO(struct device *dev, unsigned long iova, int flags),
+
+	TP_ARGS(dev, iova, flags),
+
+	TP_STRUCT__entry(
+		__string(device, dev_name(dev))
+		__string(driver, dev_driver_string(dev))
+		__field(u64, iova)
+		__field(int, flags)
+	),
+
+	TP_fast_assign(
+		__assign_str(device, dev_name(dev));
+		__assign_str(driver, dev_driver_string(dev));
+		__entry->iova = iova;
+		__entry->flags = flags;
+	),
+
+	TP_printk("IOMMU:%s %s iova=0x%016llx flags=0x%04x",
+			__get_str(driver), __get_str(device),
+			__entry->iova, __entry->flags
+	)
+);
+
+DEFINE_EVENT(iommu_error, io_page_fault,
+
+	TP_PROTO(struct device *dev, unsigned long iova, int flags),
+
+	TP_ARGS(dev, iova, flags)
+);
 #endif /* _TRACE_IOMMU_H */
 
 /* This part must be outside protection */
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v4 1/2] iommu: Add iommu_error class event to iommu trace
@ 2013-09-24 21:21   ` Shuah Khan
  0 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2013-09-24 21:21 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A,
	alex.williamson-H+wXaHxf7aLQT0dZR+AlfA,
	Varun.Sethi-KZfg59tc24xl57MIdRCFDg,
	udknight-Re5JQEeQqe8AvxtiuMwx3w, aik-sLpHqDYs0B2HXe+LvDLADg,
	rostedt-nx8X9YLhiw1AfugRpC6u6w, fweisbec-Re5JQEeQqe8AvxtiuMwx3w,
	mingo-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Shuah Khan, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	shuahkhan-Re5JQEeQqe8AvxtiuMwx3w

iommu_error class event can be enabled to trigger when an iommu
error occurs. This trace event is intended to be called to report the
error information. Trace information includes driver name, device name,
iova, and flags.

iommu_error:io_page_fault

Signed-off-by: Shuah Khan <shuah.kh-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 drivers/iommu/iommu-traces.c |  3 +++
 include/trace/events/iommu.h | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/drivers/iommu/iommu-traces.c b/drivers/iommu/iommu-traces.c
index a2af60f..71ac5fa 100644
--- a/drivers/iommu/iommu-traces.c
+++ b/drivers/iommu/iommu-traces.c
@@ -22,3 +22,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(detach_device_from_domain);
 /* iommu_map_unmap */
 EXPORT_TRACEPOINT_SYMBOL_GPL(map);
 EXPORT_TRACEPOINT_SYMBOL_GPL(unmap);
+
+/* iommu_error */
+EXPORT_TRACEPOINT_SYMBOL_GPL(io_page_fault);
diff --git a/include/trace/events/iommu.h b/include/trace/events/iommu.h
index 86bcc5a..a8f5c32 100644
--- a/include/trace/events/iommu.h
+++ b/include/trace/events/iommu.h
@@ -123,6 +123,39 @@ DEFINE_EVENT_PRINT(iommu_map_unmap, unmap,
 			__entry->iova, __entry->size
 	)
 );
+
+DECLARE_EVENT_CLASS(iommu_error,
+
+	TP_PROTO(struct device *dev, unsigned long iova, int flags),
+
+	TP_ARGS(dev, iova, flags),
+
+	TP_STRUCT__entry(
+		__string(device, dev_name(dev))
+		__string(driver, dev_driver_string(dev))
+		__field(u64, iova)
+		__field(int, flags)
+	),
+
+	TP_fast_assign(
+		__assign_str(device, dev_name(dev));
+		__assign_str(driver, dev_driver_string(dev));
+		__entry->iova = iova;
+		__entry->flags = flags;
+	),
+
+	TP_printk("IOMMU:%s %s iova=0x%016llx flags=0x%04x",
+			__get_str(driver), __get_str(device),
+			__entry->iova, __entry->flags
+	)
+);
+
+DEFINE_EVENT(iommu_error, io_page_fault,
+
+	TP_PROTO(struct device *dev, unsigned long iova, int flags),
+
+	TP_ARGS(dev, iova, flags)
+);
 #endif /* _TRACE_IOMMU_H */
 
 /* This part must be outside protection */
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v4 2/2] iommu: Change iommu driver to call io_page_fault trace event
@ 2013-09-24 21:21   ` Shuah Khan
  0 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2013-09-24 21:21 UTC (permalink / raw)
  To: joro, alex.williamson, Varun.Sethi, udknight, aik, rostedt,
	fweisbec, mingo
  Cc: Shuah Khan, linux-kernel, iommu, shuahkhan

Change iommu driver call io_page_fault trace event. This iommu_error class
event can be enabled to trigger when an iommu error occurs. Trace information
includes driver name, device name, iova, and flags.

Testing:
Added trace calls to iommu_prepare_identity_map() for testing some of the
conditions that are hard to trigger. Here is the trace from the testing:

       swapper/0-1     [003] ....     2.003774: io_page_fault: IOMMU:pci 0000:00:02.0 iova=0x00000000cb800000 flags=0x0002
       swapper/0-1     [003] ....     2.004098: io_page_fault: IOMMU:pci 0000:00:1d.0 iova=0x00000000cadc6000 flags=0x0002
       swapper/0-1     [003] ....     2.004115: io_page_fault: IOMMU:pci 0000:00:1a.0 iova=0x00000000cadc6000 flags=0x0002
       swapper/0-1     [003] ....     2.004129: io_page_fault: IOMMU:pci 0000:00:1f.0 iova=0x0000000000000000 flags=0x0002

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 include/linux/iommu.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 7ea319e..a444c79 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -22,6 +22,7 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/types.h>
+#include <trace/events/iommu.h>
 
 #define IOMMU_READ	(1)
 #define IOMMU_WRITE	(2)
@@ -227,6 +228,7 @@ static inline int report_iommu_fault(struct iommu_domain *domain,
 		ret = domain->handler(domain, dev, iova, flags,
 						domain->handler_token);
 
+	trace_io_page_fault(dev, iova, flags);
 	return ret;
 }
 
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v4 2/2] iommu: Change iommu driver to call io_page_fault trace event
@ 2013-09-24 21:21   ` Shuah Khan
  0 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2013-09-24 21:21 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A,
	alex.williamson-H+wXaHxf7aLQT0dZR+AlfA,
	Varun.Sethi-KZfg59tc24xl57MIdRCFDg,
	udknight-Re5JQEeQqe8AvxtiuMwx3w, aik-sLpHqDYs0B2HXe+LvDLADg,
	rostedt-nx8X9YLhiw1AfugRpC6u6w, fweisbec-Re5JQEeQqe8AvxtiuMwx3w,
	mingo-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Shuah Khan, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	shuahkhan-Re5JQEeQqe8AvxtiuMwx3w

Change iommu driver call io_page_fault trace event. This iommu_error class
event can be enabled to trigger when an iommu error occurs. Trace information
includes driver name, device name, iova, and flags.

Testing:
Added trace calls to iommu_prepare_identity_map() for testing some of the
conditions that are hard to trigger. Here is the trace from the testing:

       swapper/0-1     [003] ....     2.003774: io_page_fault: IOMMU:pci 0000:00:02.0 iova=0x00000000cb800000 flags=0x0002
       swapper/0-1     [003] ....     2.004098: io_page_fault: IOMMU:pci 0000:00:1d.0 iova=0x00000000cadc6000 flags=0x0002
       swapper/0-1     [003] ....     2.004115: io_page_fault: IOMMU:pci 0000:00:1a.0 iova=0x00000000cadc6000 flags=0x0002
       swapper/0-1     [003] ....     2.004129: io_page_fault: IOMMU:pci 0000:00:1f.0 iova=0x0000000000000000 flags=0x0002

Signed-off-by: Shuah Khan <shuah.kh-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 include/linux/iommu.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 7ea319e..a444c79 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -22,6 +22,7 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/types.h>
+#include <trace/events/iommu.h>
 
 #define IOMMU_READ	(1)
 #define IOMMU_WRITE	(2)
@@ -227,6 +228,7 @@ static inline int report_iommu_fault(struct iommu_domain *domain,
 		ret = domain->handler(domain, dev, iova, flags,
 						domain->handler_token);
 
+	trace_io_page_fault(dev, iova, flags);
 	return ret;
 }
 
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 0/2] iommu: Add iommu_error class event to iommu trace
@ 2013-09-25  9:11   ` Joerg Roedel
  0 siblings, 0 replies; 8+ messages in thread
From: Joerg Roedel @ 2013-09-25  9:11 UTC (permalink / raw)
  To: Shuah Khan
  Cc: alex.williamson, Varun.Sethi, udknight, aik, rostedt, fweisbec,
	mingo, linux-kernel, iommu, shuahkhan

On Tue, Sep 24, 2013 at 03:21:18PM -0600, Shuah Khan wrote:
> Shuah Khan (2):
>   iommu: Add iommu_error class event to iommu trace
>   iommu: Change iommu driver to call io_page_fault trace event

Applied to the tracing branch, thanks Shuah.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 0/2] iommu: Add iommu_error class event to iommu trace
@ 2013-09-25  9:11   ` Joerg Roedel
  0 siblings, 0 replies; 8+ messages in thread
From: Joerg Roedel @ 2013-09-25  9:11 UTC (permalink / raw)
  To: Shuah Khan
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	aik-sLpHqDYs0B2HXe+LvDLADg, fweisbec-Re5JQEeQqe8AvxtiuMwx3w,
	udknight-Re5JQEeQqe8AvxtiuMwx3w, rostedt-nx8X9YLhiw1AfugRpC6u6w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	mingo-H+wXaHxf7aLQT0dZR+AlfA, shuahkhan-Re5JQEeQqe8AvxtiuMwx3w,
	Varun.Sethi-KZfg59tc24xl57MIdRCFDg

On Tue, Sep 24, 2013 at 03:21:18PM -0600, Shuah Khan wrote:
> Shuah Khan (2):
>   iommu: Add iommu_error class event to iommu trace
>   iommu: Change iommu driver to call io_page_fault trace event

Applied to the tracing branch, thanks Shuah.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-09-25  9:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-24 21:21 [PATCH v4 0/2] iommu: Add iommu_error class event to iommu trace Shuah Khan
2013-09-24 21:21 ` Shuah Khan
2013-09-24 21:21 ` [PATCH v4 1/2] " Shuah Khan
2013-09-24 21:21   ` Shuah Khan
2013-09-24 21:21 ` [PATCH v4 2/2] iommu: Change iommu driver to call io_page_fault trace event Shuah Khan
2013-09-24 21:21   ` Shuah Khan
2013-09-25  9:11 ` [PATCH v4 0/2] iommu: Add iommu_error class event to iommu trace Joerg Roedel
2013-09-25  9:11   ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.