Skip to content

KVM: SEV: use mutex guards for simpler error handling

Carlos López kvm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 1 replyIn review
  2. v16 patches 5 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6KVM: SEV: use mutex guard in snp_launch_update()arch/x86/kvm/svm/sev.c+12 -190 replies
2/6KVM: SEV: use mutex guard in sev_mem_enc_ioctl()arch/x86/kvm/svm/sev.c+8 -170 replies
3/6KVM: SEV: use mutex guard in sev_mem_enc_register_region()arch/x86/kvm/svm/sev.c+3 -80 replies
4/6KVM: SEV: use mutex guard in sev_mem_enc_unregister_region()arch/x86/kvm/svm/sev.c+5 -150 replies
5/6KVM: SEV: use mutex guard in snp_handle_guest_req()arch/x86/kvm/svm/sev.c+8 -150 replies
6/6KVM: SEV: use scoped mutex guard in sev_asid_new()arch/x86/kvm/svm/sev.c+10 -141 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/6] KVM: SEV: use mutex guards for simpler error handling

Replace several uses of mutex_lock() / mutex_unlock() pairs with mutex guards, which are less error-prone and help simplify error paths, allowing removal of all gotos in some functions. This removes around 40 lines of code in total.

This does not remove all uses of the manual lock APIs, only those that have their error handling improved by switching to the newer API.

Changes are separated per-function for ease of review.

---
v2: Removed an unnecessary include.

Carlos López (6):
KVM: SEV: use mutex guard in snp_launch_update()
KVM: SEV: use mutex guard in sev_mem_enc_ioctl()
KVM: SEV: use mutex guard in sev_mem_enc_register_region()
KVM: SEV: use mutex guard in sev_mem_enc_unregister_region()
KVM: SEV: use mutex guard in snp_handle_guest_req()
KVM: SEV: use scoped mutex guard in sev_asid_new()

 arch/x86/kvm/svm/sev.c | 134 ++++++++++++++---------------------------
 1 file changed, 46 insertions(+), 88 deletions(-)

base-commit: 0499add8efd72456514c6218c062911ccc922a99

Signature · 1 line
2.51.0