KVM: PPC: Book3S HV: Reuse kvmppc_inject_interrupt for async guest delivery
Subsystems (2)
Nicholas Piggin
reviewerPATCH 3/5 KVM: PPC: Book3S HV: Reuse kvmppc_inject_interrupt for async guest delivery
--- arch/powerpc/kvm/book3s.h | 3 ++ arch/powerpc/kvm/book3s_hv.c | 45 ------------------- arch/powerpc/kvm/book3s_hv_builtin.c | 65 ++++++++++++++++++++++------ 3 files changed, 54 insertions(+), 59 deletions(-)
arch/powerpc/kvm/book3s.h +3 -0
@@ -37,4 +37,7 @@ extern void kvmppc_emulate_tabort(struct kvm_vcpu *vcpu, int ra_val);static inline void kvmppc_emulate_tabort (struct kvm_vcpu *vcpu,int ra_val) {}#endif +extern void kvmppc_set_msr_hv (struct kvm_vcpu *vcpu,u64 msr); +extern void kvmppc_inject_interrupt_hv (struct kvm_vcpu *vcpu,int vec,u64 srr1_flags); +#endif
arch/powerpc/kvm/book3s_hv.c +0 -45
63 lines not on this page · raw message
arch/powerpc/kvm/book3s_hv_builtin.c +51 -14
90 lines not on this page · raw message
Signature · 1 line
2.20.1
Quoted 1 line · Nicholas Piggin
Signed-off-by Nicholas Piggin <[email protected]>
This really needs a couple of paragraphs describing what's going on here, and why...
Paul.
Quoted 1 line · Nicholas Piggin
Signed-off-by Nicholas Piggin <[email protected]>
Comment below...
arch/powerpc/kvm/book3s_hv_builtin.c void kvmhv_p9_restore_lpcr(struct kvm_split_mode *sip) · line 765
Quoted 13 lines
arch/powerpc/kvm/book3s_hv_builtin.c +5
-0@@ -758,6 +758,53 @@ void kvmhv_p9_restore_lpcr(struct kvm_split_mode *sip) local_paca->kvm_hstate.kvm_split_mode =NULL ; } +static void kvmppc_end_cede (struct kvm_vcpu *vcpu) +{ + vcpu->arch.ceded =0 ; +if (vcpu->arch.timer_running) { +hrtimer_try_to_cancel (&vcpu->arch.dec_timer);
So now we're potentially calling hrtimer_try_to_cancel in real mode. Are you absolutely sure that nothing in the hrtimer code accesses anything that is vmalloc'd? I'm not. Maybe you can prove that when called in real mode, vcpu->arch.timer_running will always be false, but it seems fragile to me.
Paul.
Nicholas Piggin
reviewerPaul Mackerras's on June 17, 2019 11:45 am:
Quoted 13 lines · Nicholas Piggin
Quoted 1 line
Signed-off-by Nicholas Piggin <[email protected]>Comment below...
Quoted 8 lines
arch/powerpc/kvm/book3s_hv_builtin.c +0
-0@@ -758,6 +758,53 @@ void kvmhv_p9_restore_lpcr(struct kvm_split_mode *sip) local_paca->kvm_hstate.kvm_split_mode =NULL ; }
Quoted 11 lines
arch/powerpc/kvm/book3s_hv_builtin.c void kvmhv_p9_restore_lpcr(struct kvm_split_mode *sip) · line 765
Quoted 5 lines
arch/powerpc/kvm/book3s_hv_builtin.c +5
-0+static void kvmppc_end_cede (struct kvm_vcpu *vcpu) +{ + vcpu->arch.ceded =0 ; +if (vcpu->arch.timer_running) { +hrtimer_try_to_cancel (&vcpu->arch.dec_timer);So now we're potentially calling
hrtimer_try_to_cancelin real mode. Are you absolutely sure that nothing in the hrtimer code accesses anything that is vmalloc'd? I'm not. Maybe you can prove that when called in real mode,vcpu->arch.timer_runningwill always be false, but it seems fragile to me.
Good point, no we shouldn't do this.
Is the guest always going to be out of cede at this point? Possibly just a variant of the function that doesn't end cede would be the go.
Thanks,
Nick