]> git.hungrycats.org Git - linux/commitdiff
x86: Conditionally update time when ack-ing pending irqs
authorShai Fultheim <shai@scalemp.com>
Thu, 19 Apr 2012 22:12:32 +0000 (01:12 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 14 Dec 2014 16:23:50 +0000 (16:23 +0000)
commit 42fa4250436304d4650fa271f37671f6cee24e08 upstream.

On virtual environments, apic_read could take a long time. As a
result, under certain conditions the ack pending loop may exit
without any queued irqs left, but after more than one second. A
warning will be printed needlessly in this case.

If the loop is about to exit regardless of max_loops, don't
update it.

Signed-off-by: Shai Fultheim <shai@scalemp.com>
[ rebased and reworded the commit message]
Signed-off-by: Ido Yariv <ido@wizery.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1334873552-31346-1-git-send-email-ido@wizery.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/kernel/apic/apic.c

index c4e3581a1566e5573861f120b0ee1948500ff4b1..039292719222c60e7bdcb5fde3000b881e4d3763 100644 (file)
@@ -1309,11 +1309,13 @@ void __cpuinit setup_local_APIC(void)
                               acked);
                        break;
                }
-               if (cpu_has_tsc) {
-                       rdtscll(ntsc);
-                       max_loops = (cpu_khz << 10) - (ntsc - tsc);
-               } else
-                       max_loops--;
+               if (queued) {
+                       if (cpu_has_tsc) {
+                               rdtscll(ntsc);
+                               max_loops = (cpu_khz << 10) - (ntsc - tsc);
+                       } else
+                               max_loops--;
+               }
        } while (queued && max_loops > 0);
        WARN_ON(max_loops <= 0);