alistair23-linux/drivers/iommu
Dmitry Safonov 6c50d79f66 iommu/vt-d: Ratelimit each dmar fault printing
There is a ratelimit for printing, but it's incremented each time the
cpu recives dmar fault interrupt. While one interrupt may signal about
*many* faults.
So, measuring the impact it turns out that reading/clearing one fault
takes < 1 usec, and printing info about the fault takes ~170 msec.

Having in mind that maximum number of fault recording registers per
remapping hardware unit is 256.. IRQ handler may run for (170*256) msec.
And as fault-serving loop runs without a time limit, during servicing
new faults may occur..

Ratelimit each fault printing rather than each irq printing.

Fixes: commit c43fce4eeb ("iommu/vt-d: Ratelimit fault handler")

BUG: spinlock lockup suspected on CPU#0, CliShell/9903
 lock: 0xffffffff81a47440, .magic: dead4ead, .owner: kworker/u16:2/8915, .owner_cpu: 6
CPU: 0 PID: 9903 Comm: CliShell
Call Trace:$\n'
[..] dump_stack+0x65/0x83$\n'
[..] spin_dump+0x8f/0x94$\n'
[..] do_raw_spin_lock+0x123/0x170$\n'
[..] _raw_spin_lock_irqsave+0x32/0x3a$\n'
[..] uart_chars_in_buffer+0x20/0x4d$\n'
[..] tty_chars_in_buffer+0x18/0x1d$\n'
[..] n_tty_poll+0x1cb/0x1f2$\n'
[..] tty_poll+0x5e/0x76$\n'
[..] do_select+0x363/0x629$\n'
[..] compat_core_sys_select+0x19e/0x239$\n'
[..] compat_SyS_select+0x98/0xc0$\n'
[..] sysenter_dispatch+0x7/0x25$\n'
[..]
NMI backtrace for cpu 6
CPU: 6 PID: 8915 Comm: kworker/u16:2
Workqueue: dmar_fault dmar_fault_work
Call Trace:$\n'
[..] wait_for_xmitr+0x26/0x8f$\n'
[..] serial8250_console_putchar+0x1c/0x2c$\n'
[..] uart_console_write+0x40/0x4b$\n'
[..] serial8250_console_write+0xe6/0x13f$\n'
[..] call_console_drivers.constprop.13+0xce/0x103$\n'
[..] console_unlock+0x1f8/0x39b$\n'
[..] vprintk_emit+0x39e/0x3e6$\n'
[..] printk+0x4d/0x4f$\n'
[..] dmar_fault+0x1a8/0x1fc$\n'
[..] dmar_fault_work+0x15/0x17$\n'
[..] process_one_work+0x1e8/0x3a9$\n'
[..] worker_thread+0x25d/0x345$\n'
[..] kthread+0xea/0xf2$\n'
[..] ret_from_fork+0x58/0x90$\n'

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Lu Baolu <baolu.lu@linux.intel.com>
Cc: iommu@lists.linux-foundation.org
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2018-05-03 14:38:58 +02:00
..
amd_iommu.c IOMMU Updates for Linux v4.17 2018-04-11 18:50:41 -07:00
amd_iommu_init.c iommu/amd: Use raw locks on atomic context paths 2018-02-13 14:18:06 +01:00
amd_iommu_proto.h IOMMU Updates for Linux v4.14 2017-09-09 15:03:24 -07:00
amd_iommu_types.h iommu/amd: Turn dev_data_list into a lock less list 2018-03-29 10:38:14 +02:00
amd_iommu_v2.c pci-v4.16-changes 2018-02-06 09:59:40 -08:00
arm-smmu-regs.h
arm-smmu-v3.c iommu/arm-smmu-v3: Support 52-bit virtual address 2018-03-27 14:12:06 +01:00
arm-smmu.c iommu: Clean up of_iommu_init_fn 2018-01-17 15:25:50 +01:00
dma-iommu.c iommu/dma: Add HW MSI(GICv3 ITS) address regions reservation 2018-02-14 15:15:41 +01:00
dmar.c iommu/vt-d: Ratelimit each dmar fault printing 2018-05-03 14:38:58 +02:00
exynos-iommu.c IOMMU Updates for Linux v4.17 2018-04-11 18:50:41 -07:00
fsl_pamu.c Merge branches 'arm/exynos', 'arm/renesas', 'arm/rockchip', 'arm/omap', 'arm/mediatek', 'arm/tegra', 'arm/qcom', 'arm/smmu', 'ppc/pamu', 'x86/vt-d', 'x86/amd', 's390' and 'core' into next 2017-09-01 11:31:42 +02:00
fsl_pamu.h
fsl_pamu_domain.c Merge branches 'arm/exynos', 'arm/renesas', 'arm/rockchip', 'arm/omap', 'arm/mediatek', 'arm/tegra', 'arm/qcom', 'arm/smmu', 'ppc/pamu', 'x86/vt-d', 'x86/amd', 's390' and 'core' into next 2017-09-01 11:31:42 +02:00
fsl_pamu_domain.h
intel-iommu.c IOMMU Updates for Linux v4.17 2018-04-11 18:50:41 -07:00
intel-svm.c Merge branches 'x86/amd', 'x86/vt-d', 'arm/rockchip', 'arm/omap', 'arm/mediatek', 'arm/exynos', 'arm/renesas', 'arm/smmu' and 'core' into next 2018-03-29 15:24:40 +02:00
intel_irq_remapping.c genirq/irqdomain: Rename early argument of irq_domain_activate_irq() 2017-12-29 21:13:04 +01:00
io-pgtable-arm-v7s.c iommu/io-pgtable: Use size_t return type for all foo_unmap 2018-02-13 19:31:32 +01:00
io-pgtable-arm.c Merge branches 'x86/amd', 'x86/vt-d', 'arm/rockchip', 'arm/omap', 'arm/mediatek', 'arm/exynos', 'arm/renesas', 'arm/smmu' and 'core' into next 2018-03-29 15:24:40 +02:00
io-pgtable.c
io-pgtable.h iommu/io-pgtable: Use size_t return type for all foo_unmap 2018-02-13 19:31:32 +01:00
iommu-sysfs.c
iommu-traces.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
iommu.c iommu: Do not return error code for APIs with size_t return type 2018-02-13 19:31:20 +01:00
iova.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
ipmmu-vmsa.c iommu: Clean up of_iommu_init_fn 2018-01-17 15:25:50 +01:00
irq_remapping.c x86/apic: Rename variables and functions related to x86_io_apic_ops 2018-02-17 11:47:45 +01:00
irq_remapping.h
Kconfig iommu/intel-iommu: Enable CONFIG_DMA_DIRECT_OPS=y and clean up intel_{alloc,free}_coherent() 2018-03-20 10:01:58 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
msm_iommu.c iommu: Clean up of_iommu_init_fn 2018-01-17 15:25:50 +01:00
msm_iommu.h
msm_iommu_hw-8xxx.h
mtk_iommu.c iommu/mediatek: Fix protect memory setting 2018-03-21 06:13:57 -05:00
mtk_iommu.h iommu/mediatek: Fix protect memory setting 2018-03-21 06:13:57 -05:00
mtk_iommu_v1.c IOMMU Updates for Linux v4.17 2018-04-11 18:50:41 -07:00
of_iommu.c iommu: Clean up of_iommu_init_fn 2018-01-17 15:25:50 +01:00
omap-iommu-debug.c iommu/omap: Fix debugfs_create_*() usage 2018-01-17 14:23:33 +01:00
omap-iommu.c iommu/omap: Increase group ref in .device_group() 2018-03-15 15:54:52 +01:00
omap-iommu.h iommu/omap: Add support to program multiple iommus 2017-09-19 11:32:05 +02:00
omap-iopgtable.h
qcom_iommu.c iommu: Clean up of_iommu_init_fn 2018-01-17 15:25:50 +01:00
rockchip-iommu.c iommu/rockchip: Support sharing IOMMU between masters 2018-03-29 12:22:29 +02:00
s390-iommu.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tegra-gart.c
tegra-smmu.c iommu/tegra-smmu: Fix return value check in tegra_smmu_group_get() 2017-12-20 18:32:08 +01:00