Re: Possible nohz-full/RCU issue in arm64 KVM

2022-01-11 Thread Mark Rutland
On Tue, Jan 11, 2022 at 12:32:38PM +0100, Nicolas Saenz Julienne wrote: > Hi Mark, > > On Tue, 2022-01-04 at 16:39 +, Mark Rutland wrote: > > On Fri, Dec 17, 2021 at 04:54:22PM +0100, Paolo Bonzini wrote: > > > On 12/17/21 15:38, Mark Rutland wrote: > > > > For example

Re: Possible nohz-full/RCU issue in arm64 KVM

2022-01-11 Thread Nicolas Saenz Julienne
Hi Mark, On Tue, 2022-01-04 at 16:39 +, Mark Rutland wrote: > On Fri, Dec 17, 2021 at 04:54:22PM +0100, Paolo Bonzini wrote: > > On 12/17/21 15:38, Mark Rutland wrote: > > > For example kvm_guest_enter_irqoff() calls guest_enter_irq_off() which > > > calls > > > vtime_account_guest_enter(),

Re: Possible nohz-full/RCU issue in arm64 KVM

2022-01-04 Thread Paolo Bonzini
On 1/4/22 17:39, Mark Rutland wrote: My main issue here was just that it's really difficult to see how the entry/exit logic is balanced, and I reckon we can solve that by splitting guest_{enter,exit}_irqoff() into helper functions to handle the vtime accounting separately from the context

Re: Possible nohz-full/RCU issue in arm64 KVM

2022-01-04 Thread Mark Rutland
On Fri, Dec 17, 2021 at 04:54:22PM +0100, Paolo Bonzini wrote: > On 12/17/21 15:38, Mark Rutland wrote: > > For example kvm_guest_enter_irqoff() calls guest_enter_irq_off() which calls > > vtime_account_guest_enter(), but kvm_guest_exit_irqoff() doesn't call > > guest_exit_irq_off() and the call

Re: Possible nohz-full/RCU issue in arm64 KVM

2022-01-04 Thread Mark Rutland
On Mon, Dec 20, 2021 at 05:10:14PM +0100, Frederic Weisbecker wrote: > On Fri, Dec 17, 2021 at 01:21:39PM +, Mark Rutland wrote: > > On Fri, Dec 17, 2021 at 12:51:57PM +0100, Nicolas Saenz Julienne wrote: > > > Hi All, > > > > Hi, > > > > > arm64's guest entry code does the following: > > >

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-20 Thread Frederic Weisbecker
On Fri, Dec 17, 2021 at 01:21:39PM +, Mark Rutland wrote: > On Fri, Dec 17, 2021 at 12:51:57PM +0100, Nicolas Saenz Julienne wrote: > > Hi All, > > Hi, > > > arm64's guest entry code does the following: > > > > int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) > > { > > [...] > > > >

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-20 Thread Marc Zyngier
On Fri, 17 Dec 2021 13:21:39 +, Mark Rutland wrote: > > On Fri, Dec 17, 2021 at 12:51:57PM +0100, Nicolas Saenz Julienne wrote: > > Hi All, > > Hi, > > > arm64's guest entry code does the following: > > > > int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) > > { > > [...] > > > >

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-19 Thread Paul E. McKenney
On Fri, Dec 17, 2021 at 06:02:23PM +0100, Paolo Bonzini wrote: > On 12/17/21 17:45, Paul E. McKenney wrote: > > On Fri, Dec 17, 2021 at 05:34:04PM +0100, Paolo Bonzini wrote: > > > On 12/17/21 17:07, Paul E. McKenney wrote: > > > > > rcu_note_context_switch() is a point-in-time notification; it's

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-19 Thread Paul E. McKenney
On Fri, Dec 17, 2021 at 06:23:32PM +0100, Paolo Bonzini wrote: > On 12/17/21 18:12, Paul E. McKenney wrote: > > On Fri, Dec 17, 2021 at 06:02:23PM +0100, Paolo Bonzini wrote: > > > On 12/17/21 17:45, Paul E. McKenney wrote: > > > > On Fri, Dec 17, 2021 at 05:34:04PM +0100, Paolo Bonzini wrote: > >

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-19 Thread Paul E. McKenney
On Fri, Dec 17, 2021 at 05:20:21PM +0100, Nicolas Saenz Julienne wrote: > Hi Paul, > > On Fri, 2021-12-17 at 08:07 -0800, Paul E. McKenney wrote: > > On Fri, Dec 17, 2021 at 04:54:22PM +0100, Paolo Bonzini wrote: > > > On 12/17/21 15:38, Mark Rutland wrote: > > > > For example

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-19 Thread Paul E. McKenney
On Fri, Dec 17, 2021 at 05:34:04PM +0100, Paolo Bonzini wrote: > On 12/17/21 17:07, Paul E. McKenney wrote: > > > rcu_note_context_switch() is a point-in-time notification; it's not > > > strictly > > > necessary, but it may improve performance a bit by avoiding unnecessary > > > IPIs > > > from

Possible nohz-full/RCU issue in arm64 KVM

2021-12-19 Thread Nicolas Saenz Julienne
Hi All, arm64's guest entry code does the following: int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) { [...] guest_enter_irqoff(); ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu); [...] local_irq_enable(); /* * We do local_irq_enable()

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-19 Thread Paul E. McKenney
On Fri, Dec 17, 2021 at 04:54:22PM +0100, Paolo Bonzini wrote: > On 12/17/21 15:38, Mark Rutland wrote: > > For example kvm_guest_enter_irqoff() calls guest_enter_irq_off() which calls > > vtime_account_guest_enter(), but kvm_guest_exit_irqoff() doesn't call > > guest_exit_irq_off() and the call

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-19 Thread Nicolas Saenz Julienne
On Fri, 2021-12-17 at 13:21 +, Mark Rutland wrote: > On Fri, Dec 17, 2021 at 12:51:57PM +0100, Nicolas Saenz Julienne wrote: > > Hi All, > > Hi, > > > arm64's guest entry code does the following: > > > > int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) > > { > > [...] > > > >

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-19 Thread Nicolas Saenz Julienne
Hi Paul, On Fri, 2021-12-17 at 08:07 -0800, Paul E. McKenney wrote: > On Fri, Dec 17, 2021 at 04:54:22PM +0100, Paolo Bonzini wrote: > > On 12/17/21 15:38, Mark Rutland wrote: > > > For example kvm_guest_enter_irqoff() calls guest_enter_irq_off() which > > > calls > > >

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-17 Thread Paolo Bonzini
On 12/17/21 18:12, Paul E. McKenney wrote: On Fri, Dec 17, 2021 at 06:02:23PM +0100, Paolo Bonzini wrote: On 12/17/21 17:45, Paul E. McKenney wrote: On Fri, Dec 17, 2021 at 05:34:04PM +0100, Paolo Bonzini wrote: On 12/17/21 17:07, Paul E. McKenney wrote: rcu_note_context_switch() is a

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-17 Thread Paolo Bonzini
On 12/17/21 17:45, Paul E. McKenney wrote: On Fri, Dec 17, 2021 at 05:34:04PM +0100, Paolo Bonzini wrote: On 12/17/21 17:07, Paul E. McKenney wrote: rcu_note_context_switch() is a point-in-time notification; it's not strictly necessary, but it may improve performance a bit by avoiding

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-17 Thread Paolo Bonzini
On 12/17/21 17:07, Paul E. McKenney wrote: rcu_note_context_switch() is a point-in-time notification; it's not strictly necessary, but it may improve performance a bit by avoiding unnecessary IPIs from the RCU subsystem. There's no benefit from doing it when you're back from the guest, because

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-17 Thread Paolo Bonzini
On 12/17/21 15:38, Mark Rutland wrote: For example kvm_guest_enter_irqoff() calls guest_enter_irq_off() which calls vtime_account_guest_enter(), but kvm_guest_exit_irqoff() doesn't call guest_exit_irq_off() and the call to vtime_account_guest_exit() is open-coded elsewhere. Also,

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-17 Thread Paolo Bonzini
On 12/17/21 14:21, Mark Rutland wrote: I'm not immediately sure what we*should* do here. What does x86 do for an IRQ taken from a guest mode? I couldn't spot any handling of that case, but I'm not familiar enough with the x86 exception model to know if I'm looking in the right place. ARM is

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-17 Thread Mark Rutland
On Fri, Dec 17, 2021 at 03:15:29PM +0100, Nicolas Saenz Julienne wrote: > On Fri, 2021-12-17 at 13:21 +, Mark Rutland wrote: > > On Fri, Dec 17, 2021 at 12:51:57PM +0100, Nicolas Saenz Julienne wrote: > > > Hi All, > > > > Hi, > > > > > arm64's guest entry code does the following: > > > > >

Re: Possible nohz-full/RCU issue in arm64 KVM

2021-12-17 Thread Mark Rutland
On Fri, Dec 17, 2021 at 12:51:57PM +0100, Nicolas Saenz Julienne wrote: > Hi All, Hi, > arm64's guest entry code does the following: > > int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) > { > [...] > > guest_enter_irqoff(); > > ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu);