lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <847fc9bd-c0b9-0f7b-f029-9a5499f2c74e@redhat.com>
Date:   Fri, 5 Jul 2019 15:26:02 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Wanpeng Li <wanpeng.li@...mail.com>,
        Wanpeng Li <kernellwp@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>
Cc:     Radim Krčmář <rkrcmar@...hat.com>,
        Marcelo Tosatti <mtosatti@...hat.com>
Subject: Re: [PATCH v5 4/4] KVM: LAPIC: Don't inject already-expired timer via
 posted interrupt

On 05/07/19 15:11, Wanpeng Li wrote:
> On 7/5/19 8:40 PM, Paolo Bonzini wrote:
> 
>> On 21/06/19 11:40, Wanpeng Li wrote:
>>> From: Wanpeng Li <wanpengli@...cent.com>
>>>
>>> already-expired timer interrupt can be injected to guest when vCPU who
>>> arms the lapic timer re-vmentry, don't posted inject in this case.
>>>
>>> Cc: Paolo Bonzini <pbonzini@...hat.com>
>>> Cc: Radim Krčmář <rkrcmar@...hat.com>
>>> Cc: Marcelo Tosatti <mtosatti@...hat.com>
>>> Signed-off-by: Wanpeng Li <wanpengli@...cent.com>
>>> ---
>>>   arch/x86/kvm/lapic.c | 14 +++++++-------
>>>   1 file changed, 7 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
>>> index ae575c0..7cd95ea 100644
>>> --- a/arch/x86/kvm/lapic.c
>>> +++ b/arch/x86/kvm/lapic.c
>>> @@ -1452,7 +1452,7 @@ static void kvm_apic_inject_pending_timer_irqs(struct kvm_lapic *apic)
>>>   	}
>>>   }
>>>   
>>> -static void apic_timer_expired(struct kvm_lapic *apic)
>>> +static void apic_timer_expired(struct kvm_lapic *apic, bool can_pi_inject)
>>>   {
>>>   	struct kvm_vcpu *vcpu = apic->vcpu;
>>>   	struct swait_queue_head *q = &vcpu->wq;
>>> @@ -1464,7 +1464,7 @@ static void apic_timer_expired(struct kvm_lapic *apic)
>>>   	if (apic_lvtt_tscdeadline(apic) || ktimer->hv_timer_in_use)
>>>   		ktimer->expired_tscdeadline = ktimer->tscdeadline;
>>>   
>>> -	if (posted_interrupt_inject_timer(apic->vcpu)) {
>>> +	if (can_pi_inject && posted_interrupt_inject_timer(apic->vcpu)) {
>> Perhaps it should use a posted interrupt if kvm_arch_should_kick(vcpu),
>> i.e. just add kvm_arch_vcpu_should_kick(apic->vcpu) to
>> posted_interrupt_inject_timer?
> 
> So do you mean not nohz_full setup? An external interrupt is incurred 
> here and preemption timer is better.

No, I mean instead of adding can_pi_inject, just test
kvm_arch_should_kick in posted_interrupt_inject_timer, skipping the PI
if the vCPU is not running.  Instead just go down the normal path and
the guest will get the interrupt by checking the timer-pending flag.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ