135-ahci-fix-threaded-interrupt-setup.patch 5.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. From 4bfd40ed0046299e4a5ffba31bfbbcc39cf74e03 Mon Sep 17 00:00:00 2001
  2. From: Marc Zyngier <marc.zyngier@arm.com>
  3. Date: Thu, 23 Oct 2014 17:49:30 +0100
  4. Subject: [PATCH] AHCI: Fix threaded interrupt setup
  5. Commit 18dcf433f3de (AHCI: Optimize single IRQ interrupt processing)
  6. switched the single IRQ case of the AHCI driver to use threaded
  7. threaded interrupts.
  8. During this conversion, only the IRQF_SHARED flag was provided. The net
  9. effect of this in the presence of level interrupts is that the
  10. interrupt will not be masked during the execution of the treaded
  11. handler, leading to a screaming interrupt if the thread is not
  12. scheduled quickly enough, specially in error conditions:
  13. [ 2.728051] ahci-sunxi 1c18000.sata: controller can't do PMP, turning off CAP_PMP
  14. [ 2.735578] ahci-sunxi 1c18000.sata: SSS flag set, parallel bus scan disabled
  15. [ 2.742792] ahci-sunxi 1c18000.sata: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode
  16. [ 2.751789] ahci-sunxi 1c18000.sata: flags: ncq sntf stag pm led clo only pio slum part ccc
  17. [ 2.761539] scsi host0: ahci_platform
  18. [ 2.765754] ata1: SATA max UDMA/133 mmio [mem 0x01c18000-0x01c18fff] port 0x100 irq 88
  19. [...]
  20. [ 3.127977] ata1: SATA link down (SStatus 0 SControl 300)
  21. [...]
  22. [ 3.162035] Waiting for root device /dev/sda1...
  23. [ 3.163700] random: nonblocking pool is initialized
  24. [ 3.326593] irq 88: nobody cared (try booting with the "irqpoll" option)
  25. [ 3.333296] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc1+ #3077
  26. [ 3.339936] [<c002b318>] (unwind_backtrace) from [<c0026980>] (show_stack+0x20/0x24)
  27. [ 3.347681] [<c0026980>] (show_stack) from [<c067dd18>] (dump_stack+0x9c/0xd4)
  28. [ 3.354904] [<c067dd18>] (dump_stack) from [<c007ac08>] (__report_bad_irq+0x38/0xd4)
  29. [ 3.362643] [<c007ac08>] (__report_bad_irq) from [<c007b1dc>] (note_interrupt+0x280/0x2d0)
  30. [ 3.370903] [<c007b1dc>] (note_interrupt) from [<c0078a70>] (handle_irq_event_percpu+0x210/0x27c)
  31. [ 3.379771] [<c0078a70>] (handle_irq_event_percpu) from [<c0078b28>] (handle_irq_event+0x4c/0x6c)
  32. [ 3.388636] [<c0078b28>] (handle_irq_event) from [<c007b860>] (handle_fasteoi_irq+0xbc/0x1a0)
  33. [ 3.397156] [<c007b860>] (handle_fasteoi_irq) from [<c0077f5c>] (generic_handle_irq+0x3c/0x4c)
  34. [ 3.405764] [<c0077f5c>] (generic_handle_irq) from [<c0078220>] (__handle_domain_irq+0x6c/0xb4)
  35. [ 3.414456] [<c0078220>] (__handle_domain_irq) from [<c0008754>] (gic_handle_irq+0x34/0x6c)
  36. [ 3.422802] [<c0008754>] (gic_handle_irq) from [<c0027540>] (__irq_svc+0x40/0x74)
  37. [ 3.430274] Exception stack(0xc09c1df8 to 0xc09c1e40)
  38. [ 3.435321] 1de0: 00000001 c0a27ec0
  39. [ 3.443491] 1e00: 00000000 00000000 c09c0028 0000001e 00000282 00000000 ee00c400 c0a239f8
  40. [ 3.451660] 1e20: c09c0000 c09c1ea4 c0a27ec0 c09c1e40 00200000 c003c7cc 20000113 ffffffff
  41. [ 3.459835] [<c0027540>] (__irq_svc) from [<c003c7cc>] (__do_softirq+0xbc/0x34c)
  42. [ 3.467229] [<c003c7cc>] (__do_softirq) from [<c003cd44>] (irq_exit+0xbc/0x104)
  43. [ 3.474536] [<c003cd44>] (irq_exit) from [<c0078224>] (__handle_domain_irq+0x70/0xb4)
  44. [ 3.482362] [<c0078224>] (__handle_domain_irq) from [<c0008754>] (gic_handle_x74)
  45. [ 3.498169] Exception stack(0xc09c1f10 to 0xc09c1f58)
  46. [ 3.503216] 1f00: ee7ca310 00000000 00000ab4 c0035560
  47. [ 3.511386] 1f20: c09c0000 00000000 c0a23f84 c09c8474 c09c84bc c09c0000 c0688bf8 c09c1f64
  48. [ 3.519554] 1f40: c09c1f68 c09c1f58 c00235d8 c00235dc 60000113 ffffffff
  49. [ 3.526165] [<c0027540>] (__irq_svc) from [<c00235dc>] (arch_cpu_idle+0x48/0x4c)
  50. [ 3.533557] [<c00235dc>] (arch_cpu_idle) from [<c00701fc>] (cpu_startup_entry+0x13c/0x27c)
  51. [ 3.541816] [<c00701fc>] (cpu_startup_entry) from [<c067af1c>] (rest_init+0x94/0x98)
  52. [ 3.549557] [<c067af1c>] (rest_init) from [<c093dd38>] (start_kernel+0x3f0/0x3fc)
  53. [ 3.557036] [<c093dd38>] (start_kernel) from [<40008084>] (0x40008084)
  54. [ 3.563555] handlers:
  55. [ 3.565830] [<c03a1a80>] ahci_single_irq_intr threaded [<c03a223c>] ahci_thread_fn
  56. [ 3.573415] Disabling IRQ #88
  57. [ 3.576532] ata1: exception Emask 0x10 SAct 0x0 SErr 0x4050002 action 0xe frozen
  58. [ 3.583977] ata1: irq_stat 0x00400040, connection status changed
  59. [ 3.590006] ata1: SError: { RecovComm PHYRdyChg CommWake DevExch }
  60. [ 3.596209] ata1: hard resetting link
  61. [...]
  62. Not good. The culprit is a missing IRQF_ONESHOT flag, which addition
  63. solves the problem entierly. The number of interrupts drops radically:
  64. [Booting Debian Jessie to a prompt]
  65. Before fix:
  66. 88: 3562 0 GIC 88 ahci-sunxi
  67. After fix:
  68. 88: 1992 0 GIC 88 ahci-sunxi
  69. Tested on a A20 board (ahci-sunxi).
  70. Cc: Alexander Gordeev <agordeev@redhat.com>
  71. Cc: Tejun Heo <tj@kernel.org>
  72. Cc: linux-ide@vger.kernel.org
  73. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
  74. ---
  75. drivers/ata/libahci.c | 2 +-
  76. 1 file changed, 1 insertion(+), 1 deletion(-)
  77. diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
  78. index 5eb61c9..49c649f 100644
  79. --- a/drivers/ata/libahci.c
  80. +++ b/drivers/ata/libahci.c
  81. @@ -2492,7 +2492,7 @@ static int ahci_host_activate_single_irq(struct ata_host *host, int irq,
  82. return rc;
  83. rc = devm_request_threaded_irq(host->dev, irq, ahci_single_irq_intr,
  84. - ahci_thread_fn, IRQF_SHARED,
  85. + ahci_thread_fn, IRQF_SHARED | IRQF_ONESHOT,
  86. dev_driver_string(host->dev), host);
  87. if (rc)
  88. return rc;