Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5941792ybi; Wed, 12 Jun 2019 11:05:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOFrmhbLDbDWdXunFUT0tibY6WxV3EEvhPW7ORdtKUtxRHh+hqR1szzKOjGGhpuHh/lXFx X-Received: by 2002:a62:1ec3:: with SMTP id e186mr88748835pfe.197.1560362754714; Wed, 12 Jun 2019 11:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560362754; cv=none; d=google.com; s=arc-20160816; b=ztblWtr3g++um19r20mysL/vj8P1Vh73i3vHIBvrPaA2MbcyXtEWMOyd4cGQWCmd4W hZ6MZqzeHQVRjKTypp8BDkH9Lm+m9QAQB9vecNzCpp4oF3pSRC2zasNCO7oNvtcCnnk1 w6aelBeqbIR4YVz9ehNVDRbNLmncbF9gbM4bpEvMLJgBSemLxjgLxilfhsV70ucxYhGw v1qemToiDcX6t5Nn9lM1OFZlZEuLAy24b/FaJduammJQAdnv8Mi2O8ndSV269+98I5j8 u9yejC8R1KEN/WTQv+yUh2SK50lOw+MHNp86J3HdtrbMi8IgQvb263et4PfTn0dpNRDo e8Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=kShu2Idifkng/gERsAn27BG6+RkryGWfrUTZHaTh8I0=; b=AgU0L9o683WUxrd6uOfK1lQ/03ZI6B+IXgiEGz8orKZTEYoMC/04UKsSUIc5Pm+8po nP9f3PcAC/warqDwHQkxVi1KRiwfy1eUN8UEFFozutpejOm7Ap0jsmQvG/Au6/1az/cX clvYT76a84W0/ToZjshnogduqcMgei9yh2BQGStFbgZL8EktRl5MxwMqiJuUWLeXGn02 UtWOEc9UwOA4g8Ucnl/+HfrocWcO1gWQZPT3G3v/dhCiUMyFsBOVnwpx9NUcrjHD8UyO EER8VzttNwVZyX9kggSyMx0Wht9Gexm1m7PCm2HId/m97z1umUBD6hqSK9VXjA0/qwvF pZnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w8si415802pgs.257.2019.06.12.11.05.39; Wed, 12 Jun 2019 11:05:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408736AbfFLPWf (ORCPT + 99 others); Wed, 12 Jun 2019 11:22:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58206 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727419AbfFLPWf (ORCPT ); Wed, 12 Jun 2019 11:22:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 50B5C11549; Wed, 12 Jun 2019 15:22:35 +0000 (UTC) Received: from flask (unknown [10.40.205.10]) by smtp.corp.redhat.com (Postfix) with SMTP id 32E4A377B; Wed, 12 Jun 2019 15:22:31 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Wed, 12 Jun 2019 17:22:31 +0200 Date: Wed, 12 Jun 2019 17:22:31 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Wanpeng Li Cc: Marcelo Tosatti , LKML , kvm , Paolo Bonzini Subject: Re: [PATCH v3 2/4] KVM: LAPIC: lapic timer interrupt is injected by posted interrupt Message-ID: <20190612152231.GA22785@flask> References: <1560255429-7105-1-git-send-email-wanpengli@tencent.com> <1560255429-7105-3-git-send-email-wanpengli@tencent.com> <20190611201849.GA7520@amt.cnet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 12 Jun 2019 15:22:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2019-06-12 09:48+0800, Wanpeng Li: > On Wed, 12 Jun 2019 at 04:39, Marcelo Tosatti wrote: > > On Tue, Jun 11, 2019 at 08:17:07PM +0800, Wanpeng Li wrote: > > > From: Wanpeng Li > > > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > > > @@ -133,6 +133,12 @@ inline bool posted_interrupt_inject_timer_enabled(struct kvm_vcpu *vcpu) > > > } > > > EXPORT_SYMBOL_GPL(posted_interrupt_inject_timer_enabled); > > > > > > +static inline bool can_posted_interrupt_inject_timer(struct kvm_vcpu *vcpu) > > > +{ > > > + return posted_interrupt_inject_timer_enabled(vcpu) && > > > + kvm_hlt_in_guest(vcpu->kvm); > > > +} > > > > Hi Li, > > Hi Marcelo, > > > > > Don't think its necessary to depend on kvm_hlt_in_guest: Can also use > > exitless injection if the guest is running (think DPDK style workloads > > that busy-spin on network card). I agree. > There are some discussions here. > > https://lkml.org/lkml/2019/6/11/424 > https://lkml.org/lkml/2019/6/5/436 Paolo wants to disable the APF synthetic halt first, which I think is unrelated to the timer implementation. The synthetic halt happens when the VCPU cannot progress because the host swapped out its memory and any asynchronous event should unhalt it, because we assume that the interrupt path wasn't swapped out. The posted interrupt does a swake_up_one (part of vcpu kick), which is everything what the non-posted path does after setting a KVM request -- it's a bug if we later handle the PIR differently from the KVM request, so the guest is going to be woken up on any halt blocking in KVM (even synthetic APF halt). Paolo, have I missed the point? Thanks.