KVM: Speed up MMIO registrations
v3 cover KVM: Speed up MMIO registrations
This is version 3 of the patches I previously posted here:
https://lore.kernel.org/all/[email protected]/
Changes since v2:
* Rebased to v6.17-rc2
Keir Fraser (4):
KVM: arm64: vgic-init: Remove vgic_ready() macro
KVM: arm64: vgic: Explicitly implement vgic_dist::ready ordering
KVM: Implement barriers before accessing kvm->buses[] on SRCU read
paths
KVM: Avoid synchronize_srcu() in kvm_io_bus_register_dev()
arch/arm64/kvm/vgic/vgic-init.c | 14 +++-------- arch/x86/kvm/vmx/vmx.c | 7 ++++++ include/kvm/arm_vgic.h | 1 - include/linux/kvm_host.h | 11 ++++++--- virt/kvm/kvm_main.c | 43 +++++++++++++++++++++++++++------ 5 files changed, 53 insertions(+), 23 deletions(-)
Signature · 1 line
2.51.0.rc1.193.gad69d77794-goog
PATCH v3 1/4 KVM: arm64: vgic-init: Remove vgic_ready() macro
It is now used only within kvm_vgic_map_resources(). vgic_dist::ready is already written directly by this function, so it is clearer to bypass the macro for reads as well.
--- arch/arm64/kvm/vgic/vgic-init.c | 5 ++--- include/kvm/arm_vgic.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-)
arch/arm64/kvm/vgic/vgic-init.c +2 -3
@@ -554,7 +554,6 @@ int vgic_lazy_init(struct kvm *kvm)* Also map the virtual CPU interface into the VM. * v2 calls vgic_init() if not already done. * v3 and derivatives return an error if the VGIC is not initialized. -* vgic_ready() returns true if this function has succeeded. */ int kvm_vgic_map_resources (struct kvm *kvm) {
@@ -563,12 +562,12 @@ int kvm_vgic_map_resources(struct kvm *kvm)gpa_t dist_base;int ret =0 ; -if (likely (vgic_ready (kvm))) +if (likely (dist->ready))return 0 ;mutex_lock (&kvm->slots_lock);mutex_lock (&kvm->arch.config_lock); -if (vgic_ready (kvm)) +if (dist->ready) goto out;if (!irqchip_in_kernel (kvm))
include/kvm/arm_vgic.h +0 -1
@@ -406,7 +406,6 @@ u64 vgic_v3_get_misr(struct kvm_vcpu *vcpu);#define irqchip_in_kernel (k) (!!((k)->arch.vgic.in_kernel))#define vgic_initialized (k) ((k)->arch.vgic.initialized) -#define vgic_ready (k) ((k)->arch.vgic.ready)#define vgic_valid_spi (k, i) (((i) >= VGIC_NR_PRIVATE_IRQS) && \ ((i) < (k)->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS))
Signature · 1 line
2.51.0.rc1.193.gad69d77794-goog
PATCH v3 2/4 KVM: arm64: vgic: Explicitly implement vgic_dist::ready ordering
In reply to Keir FraserIn preparation to remove synchronize_srcu() from MMIO registration, remove the distributor's dependency on this implicit barrier by direct acquire-release synchronization on the flag write and its lock-free check.
--- arch/arm64/kvm/vgic/vgic-init.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
arch/arm64/kvm/vgic/vgic-init.c +2 -9
@@ -562,7 +562,7 @@ int kvm_vgic_map_resources(struct kvm *kvm)gpa_t dist_base;int ret =0 ; -if (likely (dist->ready)) +if (likely (smp_load_acquire (&dist->ready)))return 0 ;mutex_lock (&kvm->slots_lock);
@@ -593,14 +593,7 @@ int kvm_vgic_map_resources(struct kvm *kvm) goto out_slots; } -/* -* kvm_io_bus_register_dev() guarantees all readers see the new MMIO -* registration before returning through synchronize_srcu(), which also -* implies a full memory barrier. As such, marking the distributor as -* 'ready' here is guaranteed to be ordered after all vCPUs having seen -* a completely configured distributor. -*/ - dist->ready = true; +smp_store_release (&dist->ready, true); goto out_slots; out:mutex_unlock (&kvm->arch.config_lock);
Signature · 1 line
2.51.0.rc1.193.gad69d77794-goog
PATCH v3 3/4 KVM: Implement barriers before accessing kvm->buses[] on SRCU read paths
In reply to Keir FraserThis ensures that, if a VCPU has "observed" that an IO registration has occurred, the instruction currently being trapped or emulated will also observe the IO registration.
At the same time, enforce that kvm_get_bus() is used only on the update side, ensuring that a long-term reference cannot be obtained by an SRCU reader.
--- arch/x86/kvm/vmx/vmx.c | 7 +++++++ include/linux/kvm_host.h | 10 +++++++--- virt/kvm/kvm_main.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 9 deletions(-)
arch/x86/kvm/vmx/vmx.c +7 -0
@@ -5785,6 +5785,13 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)if (kvm_test_request (KVM_REQ_EVENT , vcpu))return 1 ; +/* +* Ensure that any updates to kvm->buses[] observed by the +* previous instruction (emulated or otherwise) are also +* visible to the instruction we are about to emulate. +*/ +smp_rmb (); +if (!kvm_emulate_instruction (vcpu,0 ))return 0 ;
include/linux/kvm_host.h +7 -3
@@ -966,11 +966,15 @@ static inline bool kvm_dirty_log_manual_protect_and_init_set(struct kvm *kvm)return !!(kvm->manual_dirty_log_protect &KVM_DIRTY_LOG_INITIALLY_SET ); } +/* +* Get a bus reference under the update-side lock. No long-term SRCU reader +* references are permitted, to avoid stale reads vs concurrent IO +* registrations. +*/ static inline struct kvm_io_bus *kvm_get_bus (struct kvm *kvm,enum kvm_bus idx) { -return srcu_dereference_check (kvm->buses[idx], &kvm->srcu, -lockdep_is_held (&kvm->slots_lock) || - !refcount_read (&kvm->users_count)); +return rcu_dereference_protected (kvm->buses[idx], +lockdep_is_held (&kvm->slots_lock)); }static inline struct kvm_vcpu *kvm_get_vcpu (struct kvm *kvm,int i)
virt/kvm/kvm_main.c +27 -6
@@ -1103,6 +1103,15 @@ void __weak kvm_arch_create_vm_debugfs(struct kvm *kvm) { } +/* Called only on cleanup and destruction paths when there are no users. */ +static inline struct kvm_io_bus *kvm_get_bus_for_destruction (struct kvm *kvm, +enum kvm_bus idx) +{ +return rcu_dereference_protected (kvm->buses[idx], + !refcount_read (&kvm->users_count)); +} + +static struct kvm *kvm_create_vm (unsigned long type,const char *fdname) {struct kvm *kvm =kvm_arch_alloc_vm ();
@@ -1228,7 +1237,7 @@ static struct kvm *kvm_create_vm(unsigned long type, const char *fdname) out_err_no_arch_destroy_vm:WARN_ON_ONCE (!refcount_dec_and_test (&kvm->users_count));for (i =0 ; i <KVM_NR_BUSES ; i++) -kfree (kvm_get_bus (kvm, i)); +kfree (kvm_get_bus_for_destruction (kvm, i));kvm_free_irq_routing (kvm); out_err_no_irq_routing:cleanup_srcu_struct (&kvm->irq_srcu);
@@ -1276,7 +1285,7 @@ static void kvm_destroy_vm(struct kvm *kvm)kvm_free_irq_routing (kvm);for (i =0 ; i <KVM_NR_BUSES ; i++) { -struct kvm_io_bus *bus =kvm_get_bus (kvm, i); +struct kvm_io_bus *bus =kvm_get_bus_for_destruction (kvm, i);if (bus)kvm_io_bus_destroy (bus);
@@ -5843,6 +5852,18 @@ static int __kvm_io_bus_write(struct kvm_vcpu *vcpu, struct kvm_io_bus *bus,return -EOPNOTSUPP ; } +static struct kvm_io_bus *kvm_get_bus_srcu (struct kvm *kvm,enum kvm_bus idx) +{ +/* +* Ensure that any updates to kvm_buses[] observed by the previous VCPU +* machine instruction are also visible to the VCPU machine instruction +* that triggered this call. +*/ +smp_mb__after_srcu_read_lock (); + +return srcu_dereference (kvm->buses[idx], &kvm->srcu); +} +int kvm_io_bus_write (struct kvm_vcpu *vcpu,enum kvm_bus bus_idx,gpa_t addr,int len,const void *val) {
@@ -5855,7 +5876,7 @@ int kvm_io_bus_write(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr, .len = len, }; - bus =srcu_dereference (vcpu->kvm->buses[bus_idx], &vcpu->kvm->srcu); + bus =kvm_get_bus_srcu (vcpu->kvm, bus_idx);if (!bus)return -ENOMEM ; r =__kvm_io_bus_write (vcpu, bus, &range, val);
@@ -5874,7 +5895,7 @@ int kvm_io_bus_write_cookie(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, .len = len, }; - bus =srcu_dereference (vcpu->kvm->buses[bus_idx], &vcpu->kvm->srcu); + bus =kvm_get_bus_srcu (vcpu->kvm, bus_idx);if (!bus)return -ENOMEM ;
@@ -5924,7 +5945,7 @@ int kvm_io_bus_read(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr, .len = len, }; - bus =srcu_dereference (vcpu->kvm->buses[bus_idx], &vcpu->kvm->srcu); + bus =kvm_get_bus_srcu (vcpu->kvm, bus_idx);if (!bus)return -ENOMEM ; r =__kvm_io_bus_read (vcpu, bus, &range, val);
@@ -6033,7 +6054,7 @@ struct kvm_io_device *kvm_io_bus_get_dev(struct kvm *kvm, enum kvm_bus bus_idx, srcu_idx =srcu_read_lock (&kvm->srcu); - bus =srcu_dereference (kvm->buses[bus_idx], &kvm->srcu); + bus =kvm_get_bus_srcu (kvm, bus_idx);if (!bus) goto out_unlock;
Signature · 1 line
2.51.0.rc1.193.gad69d77794-goog
Sean Christopherson
maintainerRe: [PATCH v3 3/4] KVM: Implement barriers before accessing kvm->buses[] on SRCU read paths
Quoted 20 lines · Keir Fraser
This ensures that, if a VCPU has "observed" that an IO registration has occurred, the instruction currently being trapped or emulated will also observe the IO registration.
At the same time, enforce that
kvm_get_bus()is used only on the update side, ensuring that a long-term reference cannot be obtained by an SRCU reader.Signed-off-by Keir Fraser <[email protected]>--- arch/x86/kvm/vmx/vmx.c | 7 +++++++ include/linux/kvm_host.h | 10 +++++++--- virt/kvm/kvm_main.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 9 deletions(-)arch/x86/kvm/vmx/vmx.c +0
-0
arch/x86/kvm/vmx/vmx.c static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) · line 5791
Quoted 7 lines
arch/x86/kvm/vmx/vmx.c +4
-0@@ -5785,6 +5785,13 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)if (kvm_test_request (KVM_REQ_EVENT , vcpu))return 1 ; +/* +* Ensure that any updates to kvm->buses[] observed by the +* previous instruction (emulated or otherwise) are also +* visible to the instruction we are about to emulate.
Please avoid pronouns, e.g.
* visible to the instruction KVM is about to emulate.
Quoted 2 lines
arch/x86/kvm/vmx/vmx.c +2
-0+*/ +smp_rmb ();
...
Quoted 7 lines
static inline struct
kvm_vcpu*kvm_get_vcpu(struct kvm *kvm, int i)virt/kvm/kvm_main.c +0
-0@@ -1103,6 +1103,15 @@ void __weak kvm_arch_create_vm_debugfs(struct kvm *kvm) {
virt/kvm/kvm_main.c void __weak kvm_arch_create_vm_debugfs(struct kvm *kvm) · line 1113
Quoted 10 lines
virt/kvm/kvm_main.c +8
-0} +/* Called only on cleanup and destruction paths when there are no users. */ +static inline struct kvm_io_bus *kvm_get_bus_for_destruction (struct kvm *kvm, +enum kvm_bus idx) +{ +return rcu_dereference_protected (kvm->buses[idx], + !refcount_read (&kvm->users_count)); +} +
Extra newline.
Quoted 23 lines
virt/kvm/kvm_main.c +3
-2+static struct kvm *kvm_create_vm (unsigned long type,const char *fdname) {struct kvm *kvm =kvm_arch_alloc_vm ();@@ -1228,7 +1237,7 @@ static struct kvm *kvm_create_vm(unsigned long type, const char *fdname) out_err_no_arch_destroy_vm:WARN_ON_ONCE (!refcount_dec_and_test (&kvm->users_count));for (i =0 ; i <KVM_NR_BUSES ; i++) -kfree (kvm_get_bus (kvm, i)); +kfree (kvm_get_bus_for_destruction (kvm, i));kvm_free_irq_routing (kvm); out_err_no_irq_routing:cleanup_srcu_struct (&kvm->irq_srcu);@@ -1276,7 +1285,7 @@ static void kvm_destroy_vm(struct kvm *kvm)kvm_free_irq_routing (kvm);for (i =0 ; i <KVM_NR_BUSES ; i++) { -struct kvm_io_bus *bus =kvm_get_bus (kvm, i); +struct kvm_io_bus *bus =kvm_get_bus_for_destruction (kvm, i);if (bus)kvm_io_bus_destroy (bus);
virt/kvm/kvm_main.c static int __kvm_io_bus_write(struct kvm_vcpu *vcpu, struct kvm_io_bus *bus, · line 5858
Quoted 7 lines
virt/kvm/kvm_main.c +4
-0@@ -5843,6 +5852,18 @@ static int __kvm_io_bus_write(struct kvm_vcpu *vcpu, struct kvm_io_bus *bus,return -EOPNOTSUPP ; } +static struct kvm_io_bus *kvm_get_bus_srcu (struct kvm *kvm,enum kvm_bus idx) +{ +/* +* Ensure that any updates to kvm_buses[] observed by the previous VCPU
s/VCPU/vCPU to match KVM's preferred/typical style.
Quoted 7 lines
virt/kvm/kvm_main.c +7
-0+* machine instruction are also visible to the VCPU machine instruction +* that triggered this call. +*/ +smp_mb__after_srcu_read_lock (); + +return srcu_dereference (kvm->buses[idx], &kvm->srcu); +}
PATCH v3 4/4 KVM: Avoid synchronize_srcu() in kvm_io_bus_register_dev()
In reply to Keir FraserDevice MMIO registration may happen quite frequently during VM boot, and the SRCU synchronization each time has a measurable effect on VM startup time. In our experiments it can account for around 25% of a VM's startup time.
Replace the synchronization with a deferred free of the old kvm_io_bus structure.
--- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-)
include/linux/kvm_host.h +1 -0
@@ -206,6 +206,7 @@ struct kvm_io_range {struct kvm_io_bus {int dev_count;int ioeventfd_count; +struct rcu_head rcu;struct kvm_io_range range[]; };
virt/kvm/kvm_main.c +8 -2
@@ -5953,6 +5953,13 @@ int kvm_io_bus_read(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr, }EXPORT_SYMBOL_GPL (kvm_io_bus_read); +static void __free_bus (struct rcu_head *rcu) +{ + struct kvm_io_bus *bus = container_of(rcu, struct kvm_io_bus, rcu); + +kfree (bus); +} +int kvm_io_bus_register_dev (struct kvm *kvm,enum kvm_bus bus_idx,gpa_t addr,int len,struct kvm_io_device *dev) {
@@ -5991,8 +5998,7 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,memcpy (new_bus->range + i +1 , bus->range + i, (bus->dev_count - i) *sizeof (struct kvm_io_range ));rcu_assign_pointer (kvm->buses[bus_idx], new_bus); -synchronize_srcu_expedited (&kvm->srcu); -kfree (bus); +call_srcu (&kvm->srcu, &bus->rcu, __free_bus);return 0 ; }
Signature · 1 line
2.51.0.rc1.193.gad69d77794-goog
Sean Christopherson
maintainerRe: [PATCH v3 4/4] KVM: Avoid synchronize_srcu() in kvm_io_bus_register_dev()
Quoted 45 lines · Keir Fraser
Device MMIO registration may happen quite frequently during VM boot, and the SRCU synchronization each time has a measurable effect on VM startup time. In our experiments it can account for around 25% of a VM's startup time.
Replace the synchronization with a deferred free of the old
kvm_io_busstructure.Signed-off-by Keir Fraser <[email protected]>--- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-)include/linux/kvm_host.h +1
-0@@ -206,6 +206,7 @@ struct kvm_io_range {struct kvm_io_bus {int dev_count;int ioeventfd_count; +struct rcu_head rcu;struct kvm_io_range range[]; };virt/kvm/kvm_main.c +7
-0@@ -5953,6 +5953,13 @@ int kvm_io_bus_read(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr, }EXPORT_SYMBOL_GPL (kvm_io_bus_read); +static void __free_bus (struct rcu_head *rcu) +{ + struct kvm_io_bus *bus = container_of(rcu, struct kvm_io_bus, rcu); + +kfree (bus); +} +int kvm_io_bus_register_dev (struct kvm *kvm,enum kvm_bus bus_idx,gpa_t addr,int len,struct kvm_io_device *dev) {
virt/kvm/kvm_main.c int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, · line 6001
Quoted 6 lines
virt/kvm/kvm_main.c +1
-2@@ -5991,8 +5998,7 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,memcpy (new_bus->range + i +1 , bus->range + i, (bus->dev_count - i) *sizeof (struct kvm_io_range ));rcu_assign_pointer (kvm->buses[bus_idx], new_bus); -synchronize_srcu_expedited (&kvm->srcu); -kfree (bus); +call_srcu (&kvm->srcu, &bus->rcu, __free_bus);
To address the syzkaller splat, KVM needs to call srcu_barrier() prior to freeing the structure.
virt/kvm/kvm_main.c +1 -0
@@ -1321,6 +1321,7 @@ static void kvm_destroy_vm(struct kvm *kvm)kvm_free_memslots (kvm, &kvm->__memslots[i][1 ]); }cleanup_srcu_struct (&kvm->irq_srcu); +srcu_barrier (&kvm->srcu);cleanup_srcu_struct (&kvm->srcu);#ifdef CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES xa_destroy (&kvm->mem_attr_array);
syzbot ci has tested the following series
syzbot ci has tested the following series
[v3] KVM: Speed up MMIO registrations
https://lore.kernel.org/all/[email protected]
* [PATCH v3 1/4] KVM: arm64: vgic-init: Remove vgic_ready() macro
* [PATCH v3 2/4] KVM: arm64: vgic: Explicitly implement vgic_dist::ready ordering
* [PATCH v3 3/4] KVM: Implement barriers before accessing kvm->buses[] on SRCU read paths
* [PATCH v3 4/4] KVM: Avoid synchronize_srcu() in kvm_io_bus_register_dev()
and found the following issue:
WARNING in kvm_put_kvm
Full report is available here:
https://ci.syzbot.org/series/3dc60813-f155-4817-8552-1f86bd35f4e4
***
WARNING in kvm_put_kvm
tree: torvalds URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux base: dfc0f6373094dd88e1eaf76c44f2ff01b65db851 arch: amd64 compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7 config: https://ci.syzbot.org/builds/a80ce1fb-9721-4229-8c84-f01975da18a2/config C repro: https://ci.syzbot.org/findings/c7213edd-3666-4fca-886f-07477eb19900/c_repro syz repro: https://ci.syzbot.org/findings/c7213edd-3666-4fca-886f-07477eb19900/syz_repro
------------[ cut here ]------------ WARNING: CPU: 0 PID: 6003 at kernel/rcu/srcutree.c:697 cleanup_srcu_struct+0x4ea/0x5f0 kernel/rcu/srcutree.c:697 Modules linked in: CPU: 0 UID: 0 PID: 6003 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 RIP: 0010:cleanup_srcu_struct+0x4ea/0x5f0 kernel/rcu/srcutree.c:697 Code: 8b 5c 24 08 74 08 48 89 df e8 e2 30 7d 00 48 c7 03 00 00 00 00 48 83 c4 20 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc cc 90 <0f> 0b 90 eb e6 90 0f 0b 90 eb e0 90 0f 0b 90 eb 14 90 0f 0b 90 eb RSP: 0018:ffffc90003b0fc78 EFLAGS: 00010202 RAX: 1ffffd1fe28c5059 RBX: 1ffff1102341db2b RCX: b3fdaa5e0844b500 RDX: 0000000000000000 RSI: ffffffff8dba5bb5 RDI: ffff888022170000 RBP: ffffe8ff146282c8 R08: ffffe8ff14628367 R09: 1ffffd1fe28c506c R10: dffffc0000000000 R11: fffff91fe28c506d R12: ffff88811a0ed958 R13: 0000000000000000 R14: dffffc0000000000 R15: 1ffffffff1b7be74 FS: 000055557858e500(0000) GS:ffff8880b861c000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000c002fcff88 CR3: 000000003a46e000 CR4: 0000000000352ef0 Call Trace: <TASK> kvm_destroy_vm virt/kvm/kvm_main.c:1324 [inline] kvm_put_kvm+0x8ca/0xa70 virt/kvm/kvm_main.c:1353 kvm_vm_release+0x43/0x50 virt/kvm/kvm_main.c:1376 __fput+0x44c/0xa70 fs/file_table.c:468 task_work_run+0x1d1/0x260 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xec/0x110 kernel/entry/common.c:43 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline] do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f975198ebe9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fffbfd6bfd8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 000000000000ed88 RCX: 00007f975198ebe9 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000001 R09: 00000003bfd6c2cf R10: 0000001b2fa20000 R11: 0000000000000246 R12: 00007f9751bb5fac R13: 00007f9751bb5fa0 R14: ffffffffffffffff R15: 0000000000000003 </TASK>
***
If these findings have caused you to resend the series or submit a separate fix, please add the following tag to your commit message:
---
This report is generated by a bot. It may contain errors. syzbot ci engineers can be reached at [email protected].
Sean Christopherson
maintainerQuoted 7 lines · Keir Fraser
This is version 3 of the patches I previously posted here:
https://lore.kernel.org/all/[email protected]/
Changes since v2:
* Rebased to v6.17-rc2
Note, looks like you missed a tested tag from Li on patch 4:
https://lkml.kernel.org/r/b778c98abb4b425186bfeb1f9bed0c7a%40baidu.com
Nits aside, this looks good to my eyes (though I haven't tested yet).
Marc/Oliver,
Can you weigh in on the vgic changes when you get a chance? And a more expert set of eyeballs on the memory ordering side of things would be nice to have, too :-)
As for landing this, I'd be happy to take this through a dedicated kvm-x86 topic branch, or I can provide an ack on patches 3 and 4 (there's basically zero chance of this causing a conflict in x86).
Quoted 17 lines
Keir Fraser (4):
KVM: arm64: vgic-init: Removevgic_ready()macro
KVM: arm64: vgic: Explicitly implementvgic_dist::readyordering
KVM: Implement barriers before accessing kvm->buses[] on SRCU read
paths
KVM: Avoidsynchronize_srcu()inkvm_io_bus_register_dev()arch/arm64/kvm/vgic/vgic-init.c | 14 +++-------- arch/x86/kvm/vmx/vmx.c | 7 ++++++ include/kvm/arm_vgic.h | 1 - include/linux/kvm_host.h | 11 ++++++--- virt/kvm/kvm_main.c | 43 +++++++++++++++++++++++++++------ 5 files changed, 53 insertions(+), 23 deletions(-)Signature · 1 line
2.51.0.rc1.193.gad69d77794-goog