Skip to contentSkip to conversation

x86/apic: remove vector_lock from apic_retrigger_irq()

PATCH In review Luigi Rizzo 1 participant 3 messages Feb 20 – Aug 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/apic: remove vector_lock from apic_retrigger_irq()

apic_retrigger_irq() grabs vector_lock, but this is not needed because any caller of this function holds the irqdesc lock, and that suffices to protect apicd->vector.

Remove the unnecessary lock.

Thomas found this is a leftover from v2.6 when it was truly needed.

---
 arch/x86/kernel/apic/vector.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/apic/vector.c +0 -3
index bddc544653999..fd0f133b379fd 100644
@@ -1002,11 +1002,8 @@ static void apic_force_complete_move(struct irq_data *irqd)
 static int apic_retrigger_irq(struct irq_data *irqd)
 {
 	struct apic_chip_data *apicd = apic_chip_data(irqd);
-	unsigned long flags;
 
-	raw_spin_lock_irqsave(&vector_lock, flags);
 	__apic_send_IPI(apicd->cpu, apicd->vector);
-	raw_spin_unlock_irqrestore(&vector_lock, flags);
 
 	return 1;
 }
Signature · 1 line
2.53.0.345.g96ddfc5eaa-goog
#1 lore raw
Quoted 31 lines · Luigi Rizzo

apic_retrigger_irq() grabs vector_lock, but this is not needed because any caller of this function holds the irqdesc lock, and that suffices to protect apicd->vector.

Remove the unnecessary lock.

Thomas found this is a leftover from v2.6 when it was truly needed.

---
 arch/x86/kernel/apic/vector.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/apic/vector.c +0 -4
index bddc544653999..fd0f133b379fd 100644
@@ -1002,11 +1002,8 @@ static void apic_force_complete_move(struct irq_data *irqd)
 static int apic_retrigger_irq(struct irq_data *irqd)
 {
        struct apic_chip_data *apicd = apic_chip_data(irqd);
-       unsigned long flags;
 
-       raw_spin_lock_irqsave(&vector_lock, flags);
        __apic_send_IPI(apicd->cpu, apicd->vector);
-       raw_spin_unlock_irqrestore(&vector_lock, flags);
 
        return 1;
 }
--
Quoted 2 lines

2.53.0.345.g96ddfc5eaa-goog

Is there any concern with this proposed patch?

cheers
luigi

#2 lore raw
In reply to Luigi Rizzo
Quoted 10 lines · Luigi Rizzo

apic_retrigger_irq() grabs vector_lock, but this is not needed because any caller of this function holds the irqdesc lock, and that suffices to protect apicd->vector.

Remove the unnecessary lock.

Thomas found this is a leftover from v2.6 when it was truly needed.

Ping..
Is there any concern with this patch? We discussed it back in February, see https://lore.kernel.org/all/87o6llwzd8.ffs@tglx/
and tgx confirmed the lock is not needed.

thanks
luigi

Quoted 23 lines
---
 arch/x86/kernel/apic/vector.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/apic/vector.c +0 -4
index bddc544653999..fd0f133b379fd 100644
@@ -1002,11 +1002,8 @@ static void apic_force_complete_move(struct irq_data *irqd)
 static int apic_retrigger_irq(struct irq_data *irqd)
 {
        struct apic_chip_data *apicd = apic_chip_data(irqd);
-       unsigned long flags;
 
-       raw_spin_lock_irqsave(&vector_lock, flags);
        __apic_send_IPI(apicd->cpu, apicd->vector);
-       raw_spin_unlock_irqrestore(&vector_lock, flags);
 
        return 1;
 }
--

2.53.0.345.g96ddfc5eaa-goog