[PATCH v1 03/11] KVM: arm64: Use guard()/scoped_guard() in arm64 KVM EL1 code

Marc Zyngier maz at kernel.org
Thu Jun 18 02:23:08 PDT 2026


On Fri, 12 Jun 2026 07:59:17 +0100,
tabba at google.com wrote:
> 
> Convert the manual mutex_lock()/spin_lock() pairs in
> arch/arm64/kvm/{pkvm,arm,mmu,reset,psci}.c to guard(mutex),
> guard(spinlock) and scoped_guard(), dropping unlock-only goto labels in
> favour of direct returns. Centralised cleanup gotos that still serve
> other resources are preserved.
> 
> reset.c uses scoped_guard() rather than guard() so the lock covers only
> the small read/update window inside kvm_reset_vcpu(), leaving the rest
> of the function outside the critical section.

To be brutally honest, I don't think this sort of widespread changes
bring us anything. This is just churn.

Sure, if you are reworking a particular bit of code that is goto-heavy
for the purpose of error handling, this has the potential to cleanup
the code *while you are changing it*.

But doing it for the sake of doing it? I think we have bigger fish to
fry right now.

	M.

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



More information about the linux-arm-kernel mailing list