From: David Cohen <hidden> Date: 2011-02-15 13:20:31
Hi,
This patch set adds fault callback support to allow IOMMU users to debug or
react when a fault happens.
IOMMU faults might be very difficult to reproduce and then to figure out
the source of the problem. Currently IOMMU driver prints not so useful
debug message and does not notice user about such issue.
With a fault callback, IOMMU user may debug much more useful information
and/or react to go back to a valid state.
Br,
David
---
David Cohen (2):
OMAP2+: IOMMU: change OMAP2+ error message to dev_dbg()
OMAP: IOMMU: add support to callback during fault handling
arch/arm/mach-omap2/iommu2.c | 27 ++++++++++++++++----
arch/arm/plat-omap/include/plat/iommu.h | 15 ++++++++++-
arch/arm/plat-omap/iommu.c | 41 ++++++++++++++++++++++++++++---
3 files changed, 72 insertions(+), 11 deletions(-)
--
1.7.2.3
Note that dev_dbg() will only print something if either DEBUG or
CONFIG_DYNAMIC_DEBUG are defined...
That's my plan.
quoted
quoted
for (i = 0; i < ARRAY_SIZE(err_msg); i++) {
if (stat& (1<< i))
- printk("%s ", err_msg[i]);
+ printk(KERN_DEBUG "%s ", err_msg[i]);
quoted
... unlike printk(KERN_DEBUG...). You probably want to use pr_debug()
instead.
quoted
quoted
}
- printk("\n");
+ printk(KERN_DEBUG "\n");
quoted
Here too... Although wait, it should be KERN_CONT instead! Debug levels
are only attributed to the whole lines.
But your observation is correct. I'll resend it with KERN_CONT instead.
This won't play out correctly anyway. If DEBUG is not #define'd, the
beginning of line won't be printed but the continuations will. You just can't
do it correctly with dev_dbg(), unless you break the single line into several
ones.
? Here too... Although wait, it should be KERN_CONT instead! Debug levels
are only attributed to the whole lines.
quoted
But your observation is correct. I'll resend it with KERN_CONT instead.
? This won't play out correctly anyway. If DEBUG is not #define'd, the
beginning of line won't be printed but the continuations will. You just
can't do it correctly with dev_dbg(), unless you break the single line into
several ones.
Yes, I got this situation. I'm coming with a proper solution on next version.
Br,
David
? Note that dev_dbg() will only print something if either DEBUG or
CONFIG_DYNAMIC_DEBUG are defined...
That's my plan.
So it's sure that a developer won't need these error dumps when
receiving an error report? I.e. IOMMU upper level errors give enough
information to start doing own debugging?
Just my 2 cents.
--
Jarkko
? Note that dev_dbg() will only print something if either DEBUG or
CONFIG_DYNAMIC_DEBUG are defined...
That's my plan.
So it's sure that a developer won't need these error dumps when
receiving an error report? I.e. IOMMU upper level errors give enough
information to start doing own debugging?
Yes, developers do need this information.
But it's a bit useless tell only we've got an iommu fault, due to many
places might be causing it. My purpose is to let the debug
responsibility to IOMMU users. They have access to the iovmm layer as
well and can provide a much more useful information.
e.g. OMAP3 ISP has many submodules using IOMMU. With a fault callback,
it can dump all the iovm areas and the faulty 'da' too. It might
indicate which submodule was responsible for the issue.
Of course we can just let this debug messages the way they are and
print this redundant information. But IMO it's not necessary.
Regards,
David
? Note that dev_dbg() will only print something if either DEBUG or
CONFIG_DYNAMIC_DEBUG are defined...
That's my plan.
So it's sure that a developer won't need these error dumps when
receiving an error report? I.e. IOMMU upper level errors give enough
information to start doing own debugging?
Yes, developers do need this information.
But it's a bit useless tell only we've got an iommu fault, due to many
places might be causing it. My purpose is to let the debug
responsibility to IOMMU users. They have access to the iovmm layer as
well and can provide a much more useful information.
e.g. OMAP3 ISP has many submodules using IOMMU. With a fault callback,
it can dump all the iovm areas and the faulty 'da' too. It might
indicate which submodule was responsible for the issue.
Of course we can just let this debug messages the way they are and
print this redundant information. But IMO it's not necessary.
Indeed, we can leave this discussion for future. My main purpose now
is the fault callback. I'll drop this patch 1/2 for now.
Regards,
David
From: Jarkko Nikula <hidden> Date: 2011-02-15 14:30:27
On Tue, 15 Feb 2011 16:08:32 +0200
David Cohen [off-list ref] wrote:
quoted
So it's sure that a developer won't need these error dumps when
receiving an error report? I.e. IOMMU upper level errors give enough
information to start doing own debugging?
Yes, developers do need this information.
But it's a bit useless tell only we've got an iommu fault, due to many
places might be causing it. My purpose is to let the debug
responsibility to IOMMU users. They have access to the iovmm layer as
well and can provide a much more useful information.
e.g. OMAP3 ISP has many submodules using IOMMU. With a fault callback,
it can dump all the iovm areas and the faulty 'da' too. It might
indicate which submodule was responsible for the issue.
Of course we can just let this debug messages the way they are and
print this redundant information. But IMO it's not necessary.
Sounds fair enough and if I understood correctly this is not something
what end user will hit but more like another developer. In that case
the debug messages are the right thing.
--
Jarkko
From: Russell King - ARM Linux <hidden> Date: 2011-02-15 14:44:57
On Tue, Feb 15, 2011 at 04:36:26PM +0200, David Cohen wrote:
But pr_cont() would be wrong in case of DEBUG isn't set, isn't it?
Yes. One other solution you could do is:
char buf[80], *p = buf;
buf[0] = '\0';
for (i = 0; i < ARRAY_SIZE(err_msg); i++)
if (stat & (1 << i))
p += scnprintf(p, sizeof(buf) - (p - buf),
" %s", err_msg[i]);
dev_dbg(obj->dev, "%s: da:%08x%s\n", __func__, da, buf);
which means that you're then printing the entire string in one go -
and there's no chance for another message to come in the middle of it.
Note that I've placed the ' ' at the beginning of the format string so
that we don't end up with useless trailing space in messages. Minor
point but it's easy to do here.
From: David Cohen <hidden> Date: 2011-02-15 14:50:29
On Tue, Feb 15, 2011 at 4:44 PM, Russell King - ARM Linux
[off-list ref] wrote:
On Tue, Feb 15, 2011 at 04:36:26PM +0200, David Cohen wrote:
quoted
But pr_cont() would be wrong in case of DEBUG isn't set, isn't it?
Yes. ?One other solution you could do is:
? ? ? ?char buf[80], *p = buf;
? ? ? ?buf[0] = '\0';
? ? ? ?for (i = 0; i < ARRAY_SIZE(err_msg); i++)
? ? ? ? ? ? ? ?if (stat & (1 << i))
? ? ? ? ? ? ? ? ? ? ? ?p += scnprintf(p, sizeof(buf) - (p - buf),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?" %s", err_msg[i]);
? ? ? ?dev_dbg(obj->dev, "%s: da:%08x%s\n", __func__, da, buf);
which means that you're then printing the entire string in one go -
and there's no chance for another message to come in the middle of it.
Note that I've placed the ' ' at the beginning of the format string so
that we don't end up with useless trailing space in messages. ?Minor
point but it's easy to do here.
That could be my choice.
I'm not planing to resend this patch, but how good/bad it sounds to
you to have dev_dbg_cont() for such situation?
Br,
David
From: Russell King - ARM Linux <hidden> Date: 2011-02-15 15:51:55
On Tue, Feb 15, 2011 at 04:50:29PM +0200, David Cohen wrote:
That could be my choice.
I'm not planing to resend this patch, but how good/bad it sounds to
you to have dev_dbg_cont() for such situation?
That doesn't help when the message gets corrupted by another thread,
so I'd much prefer the "format line then print" approach rather than
the blah_CONT stuff.
From: David Cohen <hidden> Date: 2011-02-15 13:20:33
Add support to register a callback for IOMMU fault situations. Drivers using
IOMMU module might want to be informed when such errors happen in order to
debug it or react.
Signed-off-by: David Cohen <redacted>
---
arch/arm/mach-omap2/iommu2.c | 21 +++++++++++++--
arch/arm/plat-omap/include/plat/iommu.h | 15 ++++++++++-
arch/arm/plat-omap/iommu.c | 41 ++++++++++++++++++++++++++++---
3 files changed, 69 insertions(+), 8 deletions(-)
@@ -31,6 +31,7 @@ struct iommu {structclk*clk;void__iomem*regbase;structdevice*dev;+void*fault_cb_priv;unsignedintrefcount;structmutexiommu_lock;/* global for this whole object */
@@ -796,13 +796,19 @@ static irqreturn_t iommu_fault_handler(int irq, void *data)returnIRQ_HANDLED;clk_enable(obj->clk);-stat=iommu_report_fault(obj,&da);+stat=iommu_report_fault(obj,&da,&errs);clk_disable(obj->clk);if(!stat)returnIRQ_HANDLED;iommu_disable(obj);+if(obj->fault_cb){+obj->fault_cb(obj,da,errs,obj->fault_cb_priv);+/* No need to print error message as callback is called */+returnIRQ_NONE;+}+iopgd=iopgd_offset(obj,da);if(!iopgd_is_table(*iopgd)){
From: David Cohen <hidden> Date: 2011-02-15 13:32:24
A missing prefix in the cover letter's subject. It's: OMAP: IOMMU:
Br,
David
On Tue, Feb 15, 2011 at 3:20 PM, David Cohen [off-list ref] wrote:
Hi,
This patch set adds fault callback support to allow IOMMU users to debug or
react when a fault happens.
IOMMU faults might be very difficult to reproduce and then to figure out
the source of the problem. Currently IOMMU driver prints not so useful
debug message and does not notice user about such issue.
With a fault callback, IOMMU user may debug much more useful information
and/or react to go back to a valid state.
Br,
David
---
David Cohen (2):
?OMAP2+: IOMMU: change OMAP2+ error message to dev_dbg()
?OMAP: IOMMU: add support to callback during fault handling
?arch/arm/mach-omap2/iommu2.c ? ? ? ? ? ?| ? 27 ++++++++++++++++----
?arch/arm/plat-omap/include/plat/iommu.h | ? 15 ++++++++++-
?arch/arm/plat-omap/iommu.c ? ? ? ? ? ? ?| ? 41 ++++++++++++++++++++++++++++---
?3 files changed, 72 insertions(+), 11 deletions(-)
--
1.7.2.3
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html