cpu: smp_wmb before lauching cpus.
PATCH 1/1 cpu: smp_wmb before lauching cpus.
Vcpu state must be set completely before receiving INIT-IPI,SIPI
--- kvm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
kvm.h +1 -0
@@ -198,6 +198,7 @@ static inline void cpu_synchronize_post_init(CPUArchState *env) {if (kvm_enabled ()) {kvm_cpu_synchronize_post_init (env); +smp_wmb (); } }
Signature · 1 line
1.7.4.4
Quoted 13 lines · Liu Ping Fan
Vcpu state must be set completely before receiving INIT-IPI,SIPI
Signed-off-by Liu Ping Fan <[email protected]>--- kvm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)kvm.h +0
-0
kvm.h static inline void cpu_synchronize_post_init(CPUArchState *env) · line 204
Quoted 7 lines
kvm.h +1
-0@@ -198,6 +198,7 @@ static inline void cpu_synchronize_post_init(CPUArchState *env) {if (kvm_enabled ()) {kvm_cpu_synchronize_post_init (env); +smp_wmb (); } }
In theory, there should be no vcpu kick-off after this without some locking operations involved that imply barriers. Did you see real inconsistencies without this explicit one?
Jan
Quoted 8 lines · Jan Kiszka
Quoted 7 lines · Liu Ping Fan
Vcpu state must be set completely before receiving INIT-IPI,SIPI
Signed-off-by Liu Ping Fan <[email protected]>--- kvm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
Quoted 16 lines
kvm.h static inline void cpu_synchronize_post_init(CPUArchState *env) · line 204
Quoted 13 lines
kvm.h +1
-0@@ -198,6 +198,7 @@ static inline void cpu_synchronize_post_init(CPUArchState *env) {if (kvm_enabled ()) {kvm_cpu_synchronize_post_init (env); +smp_wmb (); } }In theory, there should be no vcpu kick-off after this without some locking operations involved that imply barriers. Did you see real
Yeah, but what if it is non-x86?
Quoted 4 lines
inconsistencies without this explicit one?
Jan
Quoted 26 lines · liu ping fan
Quoted 8 lines · Jan Kiszka
Quoted 7 lines · Liu Ping Fan
Vcpu state must be set completely before receiving INIT-IPI,SIPI
Signed-off-by Liu Ping Fan <[email protected]>--- kvm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)Quoted 16 lines
kvm.h static inline void cpu_synchronize_post_init(CPUArchState *env) · line 204
Quoted 13 lines
kvm.h +1
-0@@ -198,6 +198,7 @@ static inline void cpu_synchronize_post_init(CPUArchState *env) {if (kvm_enabled ()) {kvm_cpu_synchronize_post_init (env); +smp_wmb (); } }In theory, there should be no vcpu kick-off after this without some locking operations involved that imply barriers. Did you see real
Quoted 1 line
Yeah, but what if it is non-x86?
The locking I'm referring to is arch independent.
Quoted 1 line
Quoted 1 line
inconsistencies without this explicit one?
Again: Did you see real issues or is this based on static analysis?
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux
Quoted 27 lines · Jan Kiszka
Quoted 26 lines · liu ping fan
Quoted 24 lines · Jan Kiszka
Quoted 13 lines · Liu Ping Fan
Vcpu state must be set completely before receiving INIT-IPI,SIPI
Signed-off-by Liu Ping Fan <[email protected]>--- kvm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)kvm.h +0
-0kvm.h static inline void cpu_synchronize_post_init(CPUArchState *env) · line 204
Quoted 7 lines
kvm.h +1
-0@@ -198,6 +198,7 @@ static inline void cpu_synchronize_post_init(CPUArchState *env) {if (kvm_enabled ()) {kvm_cpu_synchronize_post_init (env); +smp_wmb (); } }In theory, there should be no vcpu kick-off after this without some locking operations involved that imply barriers. Did you see real
Quoted 8 lines
Quoted 1 line
Yeah, but what if it is non-x86?
The locking I'm referring to is arch independent.
Quoted 1 line
Quoted 1 line
inconsistencies without this explicit one?
Again: Did you see real issues or is this based on static analysis?
Just on static analysis
Regards,
pingfan
Quoted 6 lines
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux
Quoted 30 lines · liu ping fan
Quoted 29 lines · Jan Kiszka
Quoted 27 lines · liu ping fan
Quoted 8 lines · Jan Kiszka
Quoted 7 lines · Liu Ping Fan
Vcpu state must be set completely before receiving INIT-IPI,SIPI
Signed-off-by Liu Ping Fan <[email protected]>--- kvm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)Quoted 16 lines
kvm.h static inline void cpu_synchronize_post_init(CPUArchState *env) · line 204
Quoted 13 lines
kvm.h +1
-0@@ -198,6 +198,7 @@ static inline void cpu_synchronize_post_init(CPUArchState *env) {if (kvm_enabled ()) {kvm_cpu_synchronize_post_init (env); +smp_wmb (); } }In theory, there should be no vcpu kick-off after this without some locking operations involved that imply barriers. Did you see real
Yeah, but what if it is non-x86?
Quoted 7 lines
Quoted 6 lines
The locking I'm referring to is arch independent.
Quoted 1 line
Quoted 1 line
inconsistencies without this explicit one?
Again: Did you see real issues or is this based on static analysis?
Just on static analysis
Then please describe - also for the changelog - at least one case in details where this is needed.
Thanks,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux
Quoted 33 lines · Jan Kiszka
Quoted 32 lines · liu ping fan
Quoted 31 lines · Jan Kiszka
Quoted 26 lines · liu ping fan
Quoted 8 lines · Jan Kiszka
Quoted 7 lines · Liu Ping Fan
Vcpu state must be set completely before receiving INIT-IPI,SIPI
Signed-off-by Liu Ping Fan <[email protected]>--- kvm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)Quoted 16 lines
kvm.h static inline void cpu_synchronize_post_init(CPUArchState *env) · line 204
Quoted 13 lines
kvm.h +1
-0@@ -198,6 +198,7 @@ static inline void cpu_synchronize_post_init(CPUArchState *env) {if (kvm_enabled ()) {kvm_cpu_synchronize_post_init (env); +smp_wmb (); } }In theory, there should be no vcpu kick-off after this without some locking operations involved that imply barriers. Did you see real
Quoted 1 line
Yeah, but what if it is non-x86?
The locking I'm referring to is arch independent.
Quoted 9 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
inconsistencies without this explicit one?
Again: Did you see real issues or is this based on static analysis?
Just on static analysis
Then please describe - also for the changelog - at least one case in details where this is needed.
I dived into code. And yes, as you said, ACPI eject does involve some locking operation. So the only thing left is for starting up. There seems no potential lock operation from cpu_synchronize_all_post_init() to resume_all_vcpus().
If correct, I will update this info for the changelog
Regards,
pingfa
Quoted 8 lines
Thanks,
Jan--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux
Quoted 40 lines · liu ping fan
Quoted 39 lines · Jan Kiszka
Quoted 37 lines · liu ping fan
Quoted 27 lines · Jan Kiszka
Quoted 26 lines · liu ping fan
Quoted 24 lines · Jan Kiszka
Quoted 13 lines · Liu Ping Fan
Vcpu state must be set completely before receiving INIT-IPI,SIPI
Signed-off-by Liu Ping Fan <[email protected]>--- kvm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)kvm.h +0
-0kvm.h static inline void cpu_synchronize_post_init(CPUArchState *env) · line 204
Quoted 7 lines
kvm.h +1
-0@@ -198,6 +198,7 @@ static inline void cpu_synchronize_post_init(CPUArchState *env) {if (kvm_enabled ()) {kvm_cpu_synchronize_post_init (env); +smp_wmb (); } }In theory, there should be no vcpu kick-off after this without some locking operations involved that imply barriers. Did you see real
Quoted 8 lines
Quoted 1 line
Yeah, but what if it is non-x86?
The locking I'm referring to is arch independent.
Quoted 1 line
Quoted 1 line
inconsistencies without this explicit one?
Again: Did you see real issues or is this based on static analysis?
Just on static analysis
Quoted 7 lines
Quoted 3 lines
Then please describe - also for the changelog - at least one case in details where this is needed.
I dived into code. And yes, as you said, ACPI eject does involve some locking operation. So the only thing left is for starting up. There seems no potential lock operation from
cpu_synchronize_all_post_init()toresume_all_vcpus().
There is no difference in this scenario as well: the vcpu is waiting on a condvar for the initial kick-off and will synchronize with the main thread via the global mutex. When in doubt, try using a debugger.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux