Skip to content

Commit 3409258

Browse files
committed
chore(linux_patches): use srcu_synchronize optimisation from sean
See: https://lore.kernel.org/kvm/aZS8XXOW7vhMkNWQ@google.com Signed-off-by: Nikita Kalyazin <kalyazin@amazon.com>
1 parent 32c706a commit 3409258

2 files changed

Lines changed: 61 additions & 68 deletions

File tree

resources/hiding_ci/linux_patches/90-temp/0001-Revert-KVM-Avoid-synchronize_srcu-in-kvm_io_bus_regi.patch

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
From a11839dc97a704285db8772392bf74d4134292bf Mon Sep 17 00:00:00 2001
2+
From: Nikita Kalyazin <kalyazin@amazon.com>
3+
Date: Wed, 18 Feb 2026 14:15:16 +0000
4+
Subject: [PATCH] poc for synchronize_srcu from sean
5+
6+
See: https://lore.kernel.org/kvm/aZS8XXOW7vhMkNWQ@google.com
7+
8+
Signed-off-by: Nikita Kalyazin <kalyazin@amazon.com>
9+
---
10+
include/linux/srcu.h | 2 ++
11+
kernel/rcu/srcutree.c | 7 +++++++
12+
virt/kvm/kvm_main.c | 2 +-
13+
3 files changed, 10 insertions(+), 1 deletion(-)
14+
15+
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
16+
index ada65b58bc4c..6d60292de54f 100644
17+
--- a/include/linux/srcu.h
18+
+++ b/include/linux/srcu.h
19+
@@ -65,6 +65,8 @@ void __srcu_read_unlock(struct srcu_struct *ssp, int idx) __releases(ssp);
20+
21+
void call_srcu(struct srcu_struct *ssp, struct rcu_head *head,
22+
void (*func)(struct rcu_head *head));
23+
+void call_srcu_expedited(struct srcu_struct *ssp, struct rcu_head *rhp,
24+
+ rcu_callback_t func);
25+
void cleanup_srcu_struct(struct srcu_struct *ssp);
26+
void synchronize_srcu(struct srcu_struct *ssp);
27+
28+
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
29+
index 1ff94b76d91f..b103b9e19346 100644
30+
--- a/kernel/rcu/srcutree.c
31+
+++ b/kernel/rcu/srcutree.c
32+
@@ -1557,6 +1557,13 @@ unsigned long get_state_synchronize_srcu(struct srcu_struct *ssp)
33+
}
34+
EXPORT_SYMBOL_GPL(get_state_synchronize_srcu);
35+
36+
+void call_srcu_expedited(struct srcu_struct *ssp, struct rcu_head *rhp,
37+
+ rcu_callback_t func)
38+
+{
39+
+ __call_srcu(ssp, rhp, func, rcu_gp_is_normal());
40+
+}
41+
+EXPORT_SYMBOL_GPL(call_srcu_expedited);
42+
+
43+
/**
44+
* start_poll_synchronize_srcu - Provide cookie and start grace period
45+
* @ssp: srcu_struct to provide cookie for.
46+
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
47+
index a634e8f59ccc..60a8b7ca8ab4 100644
48+
--- a/virt/kvm/kvm_main.c
49+
+++ b/virt/kvm/kvm_main.c
50+
@@ -6027,7 +6027,7 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
51+
memcpy(new_bus->range + i + 1, bus->range + i,
52+
(bus->dev_count - i) * sizeof(struct kvm_io_range));
53+
rcu_assign_pointer(kvm->buses[bus_idx], new_bus);
54+
- call_srcu(&kvm->srcu, &bus->rcu, __free_bus);
55+
+ call_srcu_expedited(&kvm->srcu, &bus->rcu, __free_bus);
56+
57+
return 0;
58+
}
59+
--
60+
2.50.1
61+

0 commit comments

Comments
 (0)