Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5953369ybi; Wed, 31 Jul 2019 06:03:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzG8axg1XjvqZc/g9u6Eh4cMLov8rQIjS9QHL7c6gHykJOacTyhr2gUCllenq+bmbKb7K+U X-Received: by 2002:a17:90a:8c0c:: with SMTP id a12mr2898929pjo.67.1564578182408; Wed, 31 Jul 2019 06:03:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564578182; cv=none; d=google.com; s=arc-20160816; b=Y26JyKOXRCYbQE63adFeeYK6hEZwM5uDZFfcJ6fCyCKUSKg9kzVs5tWay4PSnZiTmS GS0BVvSEyk0v61cCROfwy63bRL2EgNTMf+bF2DUSv21XiOMNeSBQigB3vL+V3c7f0Tw0 h+zJXa37zynGFzUz0YIKPogMsqvyW3gQTo5pSq1wPem906AqUtUnmnQxV0A1xqitrvIu LH62tLktg5PoDVr6PJxJ3gNobSm4BufoqSH4/pJoCPr/k9+xAqR1JqcGCkz1XsxGBfoN QrlpCvvx7JdYvPD/qN1pdJjas1mhL2kd9sgF7gTwmqu/gb9+VBi68FixAkX2rYxlaFux vbEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject; bh=IZIh6MlDVtHPiwAsFVJnNtW03boho+9QyTSEdiXSHBw=; b=HGPab2LEiaKNvcLXxLVHE0cuFICWWcGoil/JEoKSIPRsTQ8AUNRtc4tDFdjkFpWdVv oOCtpc4eS/W1oyjnVePQxmRxeBorfQUiRTs5mK2dAS8SuE4trtpn9P6Yo4tHCef9+Ero XAQlmYDdFKUnJM68N51WHyEMsw5QXOsbt0yqlEFtY7kRsMptlRet2+gUoSRitazZPHH1 ASvlXJzh857rPjNXDo8ixQnJZuSkkpySDJWUxLYiqAd8pL5U1dDa+tRAuvsB4qx3ngc8 kE1/68bzoaSL4OjXlBQbgOcnazvqUkRQ4S45J9dfetRjt/Or1BSyisjsVvtvX4D3YXHy dxFA== 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 k70si33430930pgd.494.2019.07.31.06.02.47; Wed, 31 Jul 2019 06:03:02 -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 S2388153AbfGaM5B (ORCPT + 99 others); Wed, 31 Jul 2019 08:57:01 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38840 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388017AbfGaM5A (ORCPT ); Wed, 31 Jul 2019 08:57:00 -0400 Received: by mail-wm1-f67.google.com with SMTP id s15so38376262wmj.3 for ; Wed, 31 Jul 2019 05:56:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=IZIh6MlDVtHPiwAsFVJnNtW03boho+9QyTSEdiXSHBw=; b=AjZdmR7Vrh0heSuyoz9V2gpHq1aMBoFnhWjc/XjMPBakGnZoaPOJf16RG5060yfEWK H9dAwkc6Cq/RLhwLlMRqpDZIaAJ9RV11AdubRi2/UuzrM9uHXavIY0wh0oQ20IBdKl5y K0AJhkK+pSc3dS70y4eCT9CoAMefG7f4nLRzo1GOupsq+WSVxMxL4e5a1xDHVEKOe715 Tbyyv3JzTnW03U0/4k1eENK7Dvzc2auIgKeaIn9Nzv7UpuFfrf9R5/lrMIojSlkILPHU jxnDFaT3aw2RLUqbWZXgqCkziV7WUkzg7uaT4/bcPnQgNsKfklzJ6YvGBwdDcCqrEF5p zpBg== X-Gm-Message-State: APjAAAXqLxTZdSOuVk23yJ8t6ZlnP1pJ5leOfty/M1G/8orzObDg4C2v ytbinCqbEK1fctR0N40G35tnag== X-Received: by 2002:a1c:be05:: with SMTP id o5mr112635648wmf.52.1564577818394; Wed, 31 Jul 2019 05:56:58 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:91e7:65e:d8cd:fdb3? ([2001:b07:6468:f312:91e7:65e:d8cd:fdb3]) by smtp.gmail.com with ESMTPSA id r4sm40675504wrq.82.2019.07.31.05.56.57 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jul 2019 05:56:57 -0700 (PDT) Subject: Re: [PATCH 1/3] KVM: Don't need to wakeup vCPU twice afer timer fire To: Wanpeng Li , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= References: <1564572438-15518-1-git-send-email-wanpengli@tencent.com> From: Paolo Bonzini Openpgp: preference=signencrypt Message-ID: Date: Wed, 31 Jul 2019 14:56:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1564572438-15518-1-git-send-email-wanpengli@tencent.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31/07/19 13:27, Wanpeng Li wrote: > From: Wanpeng Li > > kvm_set_pending_timer() will take care to wake up the sleeping vCPU which > has pending timer, don't need to check this in apic_timer_expired() again. No, it doesn't. kvm_make_request never kicks the vCPU. Paolo > Cc: Paolo Bonzini > Cc: Radim Krčmář > Signed-off-by: Wanpeng Li > --- > arch/x86/kvm/lapic.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index 0aa1586..685d17c 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -1548,7 +1548,6 @@ static void kvm_apic_inject_pending_timer_irqs(struct kvm_lapic *apic) > static void apic_timer_expired(struct kvm_lapic *apic) > { > struct kvm_vcpu *vcpu = apic->vcpu; > - struct swait_queue_head *q = &vcpu->wq; > struct kvm_timer *ktimer = &apic->lapic_timer; > > if (atomic_read(&apic->lapic_timer.pending)) > @@ -1566,13 +1565,6 @@ static void apic_timer_expired(struct kvm_lapic *apic) > > atomic_inc(&apic->lapic_timer.pending); > kvm_set_pending_timer(vcpu); > - > - /* > - * For x86, the atomic_inc() is serialized, thus > - * using swait_active() is safe. > - */ > - if (swait_active(q)) > - swake_up_one(q); > } > > static void start_sw_tscdeadline(struct kvm_lapic *apic) >