All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: vgic: fix incorrect spinlock API usage
@ 2025-09-07 20:14 Alok Tiwari
  2025-09-08  8:16 ` Marc Zyngier
  0 siblings, 1 reply; 3+ messages in thread
From: Alok Tiwari @ 2025-09-07 20:14 UTC (permalink / raw)
  To: julien.thierry, marc.zyngier, jintack, christoffer.dall, maz,
	oliver.upton, joey.gouly, suzuki.poulose, yuzenghui,
	catalin.marinas, will, linux-arm-kernel, kvmarm
  Cc: alok.a.tiwari, linux-kernel

The function vgic_flush_lr_state() was calling _raw_spin_unlock()
instead of the proper raw_spin_unlock().

_raw_spin_unlock() is an internal low-level API and should not
be used directly; using raw_spin_unlock() ensures proper locking
semantics in the vgic code.

This change replaces low-level API usage with the general kernel
spinlock API, avoiding misuse of internal functions and aligning
with kernel locking conventions.

Fixes: 8fa3adb8c6be ("KVM: arm/arm64: vgic: Make vgic_irq->irq_lock a raw_spinlock")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 arch/arm64/kvm/vgic/vgic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c
index f5148b38120a..c74d6120a12c 100644
--- a/arch/arm64/kvm/vgic/vgic.c
+++ b/arch/arm64/kvm/vgic/vgic.c
@@ -818,7 +818,7 @@ static void vgic_flush_lr_state(struct kvm_vcpu *vcpu)
 		 * the AP list has been sorted already.
 		 */
 		if (multi_sgi && irq->priority > prio) {
-			_raw_spin_unlock(&irq->irq_lock);
+			raw_spin_unlock(&irq->irq_lock);
 			break;
 		}
 
-- 
2.50.1


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

* Re: [PATCH] KVM: arm64: vgic: fix incorrect spinlock API usage
  2025-09-07 20:14 [PATCH] KVM: arm64: vgic: fix incorrect spinlock API usage Alok Tiwari
@ 2025-09-08  8:16 ` Marc Zyngier
  2025-09-08 13:06   ` [External] : " ALOK TIWARI
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2025-09-08  8:16 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: jintack, christoffer.dall, oliver.upton, joey.gouly,
	suzuki.poulose, yuzenghui, catalin.marinas, will,
	linux-arm-kernel, kvmarm, linux-kernel

[removing @arm.com addresses that haven't been in use for a very long
time]

On Sun, 07 Sep 2025 21:14:13 +0100,
Alok Tiwari <alok.a.tiwari@oracle.com> wrote:
> 
> The function vgic_flush_lr_state() was calling _raw_spin_unlock()

s/was/is/

> instead of the proper raw_spin_unlock().
>
> _raw_spin_unlock() is an internal low-level API and should not
> be used directly; using raw_spin_unlock() ensures proper locking
> semantics in the vgic code.
> 
> This change replaces low-level API usage with the general kernel
> spinlock API, avoiding misuse of internal functions and aligning
> with kernel locking conventions.

This paragraph doesn't add much, please drop it.

> 
> Fixes: 8fa3adb8c6be ("KVM: arm/arm64: vgic: Make vgic_irq->irq_lock a raw_spinlock")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
> ---
>  arch/arm64/kvm/vgic/vgic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c
> index f5148b38120a..c74d6120a12c 100644
> --- a/arch/arm64/kvm/vgic/vgic.c
> +++ b/arch/arm64/kvm/vgic/vgic.c
> @@ -818,7 +818,7 @@ static void vgic_flush_lr_state(struct kvm_vcpu *vcpu)
>  		 * the AP list has been sorted already.
>  		 */
>  		if (multi_sgi && irq->priority > prio) {
> -			_raw_spin_unlock(&irq->irq_lock);
> +			raw_spin_unlock(&irq->irq_lock);
>  			break;
>  		}
>  

With the above fixed:

Acked-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

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

* Re: [External] : Re: [PATCH] KVM: arm64: vgic: fix incorrect spinlock API usage
  2025-09-08  8:16 ` Marc Zyngier
@ 2025-09-08 13:06   ` ALOK TIWARI
  0 siblings, 0 replies; 3+ messages in thread
From: ALOK TIWARI @ 2025-09-08 13:06 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: jintack, christoffer.dall, oliver.upton, joey.gouly,
	suzuki.poulose, yuzenghui, catalin.marinas, will,
	linux-arm-kernel, kvmarm, linux-kernel



On 9/8/2025 1:46 PM, Marc Zyngier wrote:
>> diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c
>> index f5148b38120a..c74d6120a12c 100644
>> --- a/arch/arm64/kvm/vgic/vgic.c
>> +++ b/arch/arm64/kvm/vgic/vgic.c
>> @@ -818,7 +818,7 @@ static void vgic_flush_lr_state(struct kvm_vcpu *vcpu)
>>   		 * the AP list has been sorted already.
>>   		 */
>>   		if (multi_sgi && irq->priority > prio) {
>> -			_raw_spin_unlock(&irq->irq_lock);
>> +			raw_spin_unlock(&irq->irq_lock);
>>   			break;
>>   		}
>>   
> With the above fixed:
> 
> Acked-by: Marc Zyngier<maz@kernel.org>


Thanks Marc, I will send v2 with your suggestions.

Thanks,
Alok

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

end of thread, other threads:[~2025-09-08 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-07 20:14 [PATCH] KVM: arm64: vgic: fix incorrect spinlock API usage Alok Tiwari
2025-09-08  8:16 ` Marc Zyngier
2025-09-08 13:06   ` [External] : " ALOK TIWARI

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.