* [PATCH] KVM: SVM: move kfree() out of critical zone protected by spin_lock_irqsave
@ 2025-04-22 12:08 lirongqing
2025-04-22 13:57 ` Sean Christopherson
0 siblings, 1 reply; 2+ messages in thread
From: lirongqing @ 2025-04-22 12:08 UTC (permalink / raw)
To: seanjc, pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, kvm
Cc: Li RongQing, xuwenjie
From: Li RongQing <lirongqing@baidu.com>
Although kfree is a non-sleep function, it is possible to enter a long
chain of calls probabilistically, so it looks better to move kfree out
of the critical zone.
Signed-off-by: xuwenjie <xuwenjie04@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
arch/x86/kvm/svm/avic.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index 65fd245..2520247 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -783,8 +783,9 @@ static void svm_ir_list_del(struct vcpu_svm *svm, struct amd_iommu_pi_data *pi)
if (cur->data != pi->ir_data)
continue;
list_del(&cur->node);
+ spin_unlock_irqrestore(&svm->ir_list_lock, flags);
kfree(cur);
- break;
+ return;
}
spin_unlock_irqrestore(&svm->ir_list_lock, flags);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: SVM: move kfree() out of critical zone protected by spin_lock_irqsave
2025-04-22 12:08 [PATCH] KVM: SVM: move kfree() out of critical zone protected by spin_lock_irqsave lirongqing
@ 2025-04-22 13:57 ` Sean Christopherson
0 siblings, 0 replies; 2+ messages in thread
From: Sean Christopherson @ 2025-04-22 13:57 UTC (permalink / raw)
To: lirongqing
Cc: pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, kvm, xuwenjie
On Tue, Apr 22, 2025, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> Although kfree is a non-sleep function, it is possible to enter a long
> chain of calls probabilistically, so it looks better to move kfree out
> of the critical zone.
Even better, drop the the dynamic allocation entirely :-)
Any testing you can provide on this series would be much appreciated:
https://lore.kernel.org/all/20250404193923.1413163-10-seanjc@google.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-22 13:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-22 12:08 [PATCH] KVM: SVM: move kfree() out of critical zone protected by spin_lock_irqsave lirongqing
2025-04-22 13:57 ` Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox