aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/mutex.c
diff options
context:
space:
mode:
authorPaolo Bonzini <[email protected]>2025-05-27 16:17:06 +0000
committerPaolo Bonzini <[email protected]>2025-05-28 10:29:17 +0000
commit8e86e73626527e5a69bf5263d6bbe9c2a86b4319 (patch)
treed56a6bc701bded71bf3befc233df4f73bd0589a9 /rust/helpers/mutex.c
parentMerge tag 'kvm-x86-svm-6.16' of https://github.com/kvm-x86/linux into HEAD (diff)
parentrust: add helper for mutex_trylock (diff)
downloadkernel-8e86e73626527e5a69bf5263d6bbe9c2a86b4319.tar.gz
kernel-8e86e73626527e5a69bf5263d6bbe9c2a86b4319.zip
Merge branch 'kvm-lockdep-common' into HEAD
Introduce new mutex locking functions mutex_trylock_nest_lock() and mutex_lock_killable_nest_lock() and use them to clean up locking of all vCPUs for a VM. For x86, this removes some complex code that was used instead of lockdep's "nest_lock" feature. For ARM and RISC-V, this removes a lockdep warning when the VM is configured to have more than MAX_LOCK_DEPTH vCPUs, and removes a fair amount of duplicate code by sharing the logic across all architectures. Signed-off-by: Paolo BOnzini <[email protected]>
Diffstat (limited to 'rust/helpers/mutex.c')
-rw-r--r--rust/helpers/mutex.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/helpers/mutex.c b/rust/helpers/mutex.c
index 06575553eda5..9ab29104bee1 100644
--- a/rust/helpers/mutex.c
+++ b/rust/helpers/mutex.c
@@ -7,6 +7,11 @@ void rust_helper_mutex_lock(struct mutex *lock)
mutex_lock(lock);
}
+int rust_helper_mutex_trylock(struct mutex *lock)
+{
+ return mutex_trylock(lock);
+}
+
void rust_helper___mutex_init(struct mutex *mutex, const char *name,
struct lock_class_key *key)
{