From: Linus Torvalds Date: Mon, 13 Aug 2018 20:31:08 +0000 (-0700) Subject: Merge branch 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git... X-Git-Tag: v5.15~8296 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66e22087bdf65c6bdea0a2994fbf7e16995f19f0;p=platform%2Fkernel%2Flinux-starfive.git Merge branch 'x86-apic-for-linus' of git://git./linux/kernel/git/tip/tip Pull x86 apic update from Thomas Gleixner: "Trivial cleanups of the APIC related code" * 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/apic: Trivial coding style fixes x86/vector: Merge allocate_vector() into assign_vector_locked() --- 66e22087bdf65c6bdea0a2994fbf7e16995f19f0 diff --cc arch/x86/kernel/apic/vector.c index 35aaee4f,c943499..0954315 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c @@@ -235,32 -236,13 +236,22 @@@ assign_vector_locked(struct irq_data *i if (vector && cpu_online(cpu) && cpumask_test_cpu(cpu, dest)) return 0; + /* + * Careful here. @apicd might either have move_in_progress set or + * be enqueued for cleanup. Assigning a new vector would either + * leave a stale vector on some CPU around or in case of a pending + * cleanup corrupt the hlist. + */ + if (apicd->move_in_progress || !hlist_unhashed(&apicd->clist)) + return -EBUSY; + vector = irq_matrix_alloc(vector_matrix, dest, resvd, &cpu); - if (vector > 0) - apic_update_vector(irqd, vector, cpu); trace_vector_alloc(irqd->irq, vector, resvd, vector); - return vector; - } - - static int assign_vector_locked(struct irq_data *irqd, - const struct cpumask *dest) - { - struct apic_chip_data *apicd = apic_chip_data(irqd); - int vector = allocate_vector(irqd, dest); - if (vector < 0) return vector; + apic_update_vector(irqd, vector, cpu); + apic_update_irq_cfg(irqd, vector, cpu); - apic_update_irq_cfg(irqd, apicd->vector, apicd->cpu); return 0; }