Re: [PATCH v3 1/3] KVM: arm/arm64: vgic: Make vgic_irq->irq_lock a raw_spinlock

From: Julien Grall
Date: Fri Feb 01 2019 - 12:55:49 EST

Hi Julia,

On 01/02/2019 17:36, Julia Cartwright wrote:
On Fri, Feb 01, 2019 at 03:30:58PM +0000, Julien Grall wrote:
Hi Julien,

On 07/01/2019 15:06, Julien Thierry wrote:
vgic_irq->irq_lock must always be taken with interrupts disabled as
it is used in interrupt context.

I am a bit confused with the reason here. The code mention that ap_list_lock
could be taken from the timer interrupt handler interrupt. I assume it
speaks about the handler kvm_arch_timer_handler. Looking at the
configuration of the interrupt, the flag IRQF_NO_THREAD is not set, so the
interrupt should be threaded when CONFIG_PREEMPT_FULL is set. If my
understanding is correct, this means the interrupt thread would sleep if it
takes the spinlock.

Did I miss anything? Do you have an exact path where the vGIC is actually
called from an interrupt context?

The part you're missing is that percpu interrupts are not force

static int irq_setup_forced_threading(struct irqaction *new)
if (!force_irqthreads)
return 0;
return 0;

/* ...*/

Thank you for the pointer! I think it would be worth mentioning in the commit message that per-cpu interrupts are not threaded.

Best regards,

Julien Grall