public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [QUESTION] is vector_lock needed in apic_retrigger_irq() ?
       [not found] <CAMOZA0Kp29dCbj2KsX3XcuA77ghoxR1ANiOGdW-jDttFrYaKGw@mail.gmail.com>
@ 2026-02-16 20:47 ` Luigi Rizzo
  2026-02-17 21:08 ` Thomas Gleixner
  1 sibling, 0 replies; 4+ messages in thread
From: Luigi Rizzo @ 2026-02-16 20:47 UTC (permalink / raw)
  To: Thomas Gleixner, Marc Zyngier, Luigi Rizzo; +Cc: linux-kernel, linux-arch

apic_retrigger_irq() grabs vector_lock, see code below.

I am not sure if this is needed, because the function
is called with a lock held on irqdesc, so I think the CPU and
vector should be stable.

Comments ?

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;
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [QUESTION] is vector_lock needed in apic_retrigger_irq() ?
       [not found] <CAMOZA0Kp29dCbj2KsX3XcuA77ghoxR1ANiOGdW-jDttFrYaKGw@mail.gmail.com>
  2026-02-16 20:47 ` [QUESTION] is vector_lock needed in apic_retrigger_irq() ? Luigi Rizzo
@ 2026-02-17 21:08 ` Thomas Gleixner
  2026-02-18 20:49   ` Thomas Gleixner
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2026-02-17 21:08 UTC (permalink / raw)
  To: Luigi Rizzo, Marc Zyngier, Luigi Rizzo; +Cc: linux-kernel, linux-arch

On Mon, Feb 16 2026 at 21:44, Luigi Rizzo wrote:
> apic_retrigger_irq() grabs vector_lock, see code below.
>
> I am not sure if this is needed, because the function
> is called with a lock held on irqdesc, so I think the CPU and
> vector should be stable.
>
> Comments ?

You're right. Any action which would change apcid->vector has to hold
the descriptor lock.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [QUESTION] is vector_lock needed in apic_retrigger_irq() ?
  2026-02-17 21:08 ` Thomas Gleixner
@ 2026-02-18 20:49   ` Thomas Gleixner
  2026-02-18 21:14     ` Luigi Rizzo
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2026-02-18 20:49 UTC (permalink / raw)
  To: Luigi Rizzo, Marc Zyngier, Luigi Rizzo; +Cc: linux-kernel, linux-arch

On Tue, Feb 17 2026 at 22:08, Thomas Gleixner wrote:
> On Mon, Feb 16 2026 at 21:44, Luigi Rizzo wrote:
>> apic_retrigger_irq() grabs vector_lock, see code below.
>>
>> I am not sure if this is needed, because the function
>> is called with a lock held on irqdesc, so I think the CPU and
>> vector should be stable.
>>
>> Comments ?
>
> You're right. Any action which would change apcid->vector has to hold
> the descriptor lock.

I did some archaeology. This is a leftover from the v2.6 times where it
was truly required. That never got cleaned up after the whole vector
management got rewritten and the reason for the locking went away in
v4.15. Nobody noticed :)

How did you find that?

Thanks,

        tglx




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [QUESTION] is vector_lock needed in apic_retrigger_irq() ?
  2026-02-18 20:49   ` Thomas Gleixner
@ 2026-02-18 21:14     ` Luigi Rizzo
  0 siblings, 0 replies; 4+ messages in thread
From: Luigi Rizzo @ 2026-02-18 21:14 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Marc Zyngier, Luigi Rizzo, linux-kernel, linux-arch

On Wed, Feb 18, 2026 at 9:49 PM Thomas Gleixner <tglx@linutronix.de> wrote:
>
> On Tue, Feb 17 2026 at 22:08, Thomas Gleixner wrote:
> > On Mon, Feb 16 2026 at 21:44, Luigi Rizzo wrote:
> >> apic_retrigger_irq() grabs vector_lock, see code below.
> >>
> >> I am not sure if this is needed, because the function
> >> is called with a lock held on irqdesc, so I think the CPU and
> >> vector should be stable.
> >>
> >> Comments ?
> >
> > You're right. Any action which would change apcid->vector has to hold
> > the descriptor lock.
>
> I did some archaeology. This is a leftover from the v2.6 times where it
> was truly required. That never got cleaned up after the whole vector
> management got rewritten and the reason for the locking went away in
> v4.15. Nobody noticed :)
>
> How did you find that?

perf showed high lock contention while stress testing moderation with 12SSD
(96 vectors and a total of 20 MIOPs).  Then it was just a matter of
understanding
whether that global lock was really needed.

As for why my test caused high contention:
NVME does not self disable interrupts, unlike NICs, so by the time the
handler runs
there is a high probability that another interrupt has arrived,
requiring a reinject.
When moderation timers fire (they are independent, but  probably they end up
being relatively close in time) all these reinject are called close to
each other.

cheers
luigi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-18 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAMOZA0Kp29dCbj2KsX3XcuA77ghoxR1ANiOGdW-jDttFrYaKGw@mail.gmail.com>
2026-02-16 20:47 ` [QUESTION] is vector_lock needed in apic_retrigger_irq() ? Luigi Rizzo
2026-02-17 21:08 ` Thomas Gleixner
2026-02-18 20:49   ` Thomas Gleixner
2026-02-18 21:14     ` Luigi Rizzo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox