Skip to contentSkip to conversation

kvm/svm: disable KCSAN for svm_vcpu_run()

PATCH Applied Qian Cai 3 participants 5 messages Apr 15, 2020 – Apr 17, 2020

Subsystems (3)
lore
Share & tools
lore

Qian Cai

author
#0 lore raw

PATCH 1/1 kvm/svm: disable KCSAN for svm_vcpu_run()

For some reasons, running a simple qemu-kvm command with KCSAN will reset AMD hosts. It turns out svm_vcpu_run() could not be instrumented. Disable it for now.

 # /usr/libexec/qemu-kvm -name ubuntu-18.04-server-cloudimg -cpu host
	-smp 2 -m 2G -hda ubuntu-18.04-server-cloudimg.qcow2

=== console output ===
Kernel 5.6.0-next-20200408+ on an x86_64

hp-dl385g10-05 login:

<...host reset...>

HPE ProLiant System BIOS A40 v1.20 (03/09/2018)
(C) Copyright 1982-2018 Hewlett Packard Enterprise Development LP Early system initialization, please wait...

---
 arch/x86/kvm/svm/svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/svm.c +1 -1
index 2be5bbae3a40..1fdb300e9337 100644
@@ -3278,7 +3278,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
 
 bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
 
-static void svm_vcpu_run(struct kvm_vcpu *vcpu)
+static __no_kcsan void svm_vcpu_run(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 
Signature · 1 line
2.21.0 (Apple Git-122.2)
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 29 lines · Qian Cai

For some reasons, running a simple qemu-kvm command with KCSAN will reset AMD hosts. It turns out svm_vcpu_run() could not be instrumented. Disable it for now.

 # /usr/libexec/qemu-kvm -name ubuntu-18.04-server-cloudimg -cpu host
	-smp 2 -m 2G -hda ubuntu-18.04-server-cloudimg.qcow2

=== console output ===
Kernel 5.6.0-next-20200408+ on an x86_64

hp-dl385g10-05 login:

<...host reset...>

HPE ProLiant System BIOS A40 v1.20 (03/09/2018)
(C) Copyright 1982-2018 Hewlett Packard Enterprise Development LP Early system initialization, please wait...

---
 arch/x86/kvm/svm/svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/svm.c +0 -0
index 2be5bbae3a40..1fdb300e9337 100644

arch/x86/kvm/svm/svm.c static void svm_cancel_injection(struct kvm_vcpu *vcpu) · line 3284

Quoted 8 lines
arch/x86/kvm/svm/svm.c +1 -1
@@ -3278,7 +3278,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
 
 bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
 
-static void svm_vcpu_run(struct kvm_vcpu *vcpu)
+static __no_kcsan void svm_vcpu_run(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 

I suppose you tested the patch to move cli/sti into the .S file. Anyway:

Thanks,

Paolo

author
#2 lore raw
Quoted 36 lines · Paolo Bonzini
Quoted 31 lines · Qian Cai

For some reasons, running a simple qemu-kvm command with KCSAN will reset AMD hosts. It turns out svm_vcpu_run() could not be instrumented. Disable it for now.

# /usr/libexec/qemu-kvm -name ubuntu-18.04-server-cloudimg -cpu host
	-smp 2 -m 2G -hda ubuntu-18.04-server-cloudimg.qcow2

=== console output ===
Kernel 5.6.0-next-20200408+ on an x86_64

hp-dl385g10-05 login:

<...host reset...>

HPE ProLiant System BIOS A40 v1.20 (03/09/2018)
(C) Copyright 1982-2018 Hewlett Packard Enterprise Development LP Early system initialization, please wait...

---
arch/x86/kvm/svm/svm.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/svm.c +0 -0
index 2be5bbae3a40..1fdb300e9337 100644
@@ -3278,7 +3278,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
 
 bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
 
Quoted 8 lines

arch/x86/kvm/svm/svm.c static void svm_cancel_injection(struct kvm_vcpu *vcpu) · line 3284

Quoted 6 lines
arch/x86/kvm/svm/svm.c +1 -1
-static void svm_vcpu_run(struct kvm_vcpu *vcpu)
+static __no_kcsan void svm_vcpu_run(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 

I suppose you tested the patch to move cli/sti into the .S file. Anyway:

Yes, tested that without any luck.

author
#3 lore raw
In reply to Paolo Bonzini
Quoted 45 lines · Paolo Bonzini
Quoted 29 lines · Qian Cai

For some reasons, running a simple qemu-kvm command with KCSAN will reset AMD hosts. It turns out svm_vcpu_run() could not be instrumented. Disable it for now.

# /usr/libexec/qemu-kvm -name ubuntu-18.04-server-cloudimg -cpu host
	-smp 2 -m 2G -hda ubuntu-18.04-server-cloudimg.qcow2

=== console output ===
Kernel 5.6.0-next-20200408+ on an x86_64

hp-dl385g10-05 login:

<...host reset...>

HPE ProLiant System BIOS A40 v1.20 (03/09/2018)
(C) Copyright 1982-2018 Hewlett Packard Enterprise Development LP Early system initialization, please wait...

---
arch/x86/kvm/svm/svm.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/svm.c +0 -0
index 2be5bbae3a40..1fdb300e9337 100644

arch/x86/kvm/svm/svm.c static void svm_cancel_injection(struct kvm_vcpu *vcpu) · line 3284

Quoted 8 lines
arch/x86/kvm/svm/svm.c +1 -1
@@ -3278,7 +3278,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
 
 bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
 
-static void svm_vcpu_run(struct kvm_vcpu *vcpu)
+static __no_kcsan void svm_vcpu_run(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 

I suppose you tested the patch to move cli/sti into the .S file. Anyway:

Quoted 1 line

Paul, can you pick this up along with other KCSAN fixes?

#4 lore raw
Quoted 45 lines · Qian Cai
Quoted 45 lines · Paolo Bonzini
Quoted 29 lines · Qian Cai

For some reasons, running a simple qemu-kvm command with KCSAN will reset AMD hosts. It turns out svm_vcpu_run() could not be instrumented. Disable it for now.

# /usr/libexec/qemu-kvm -name ubuntu-18.04-server-cloudimg -cpu host
	-smp 2 -m 2G -hda ubuntu-18.04-server-cloudimg.qcow2

=== console output ===
Kernel 5.6.0-next-20200408+ on an x86_64

hp-dl385g10-05 login:

<...host reset...>

HPE ProLiant System BIOS A40 v1.20 (03/09/2018)
(C) Copyright 1982-2018 Hewlett Packard Enterprise Development LP Early system initialization, please wait...

---
arch/x86/kvm/svm/svm.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/svm.c +0 -0
index 2be5bbae3a40..1fdb300e9337 100644

arch/x86/kvm/svm/svm.c static void svm_cancel_injection(struct kvm_vcpu *vcpu) · line 3284

Quoted 8 lines
arch/x86/kvm/svm/svm.c +1 -1
@@ -3278,7 +3278,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
 
 bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
 
-static void svm_vcpu_run(struct kvm_vcpu *vcpu)
+static __no_kcsan void svm_vcpu_run(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 

I suppose you tested the patch to move cli/sti into the .S file. Anyway:

Quoted 3 lines
Quoted 1 line

Paul, can you pick this up along with other KCSAN fixes?

Queued and pushed, thank you both!

Thanx, Paul