Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp356267pxj; Thu, 3 Jun 2021 08:21:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCbL202RX27ZRVuOzocaVW/qXwHqxzvxFOo3QPEjYR9UqIfr7tfywUrwdViJsNWLtr5PAM X-Received: by 2002:a17:906:1986:: with SMTP id g6mr118525ejd.265.1622733690477; Thu, 03 Jun 2021 08:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622733690; cv=none; d=google.com; s=arc-20160816; b=sB5h8++Rbpmn9Rbpyx1GOiZOwsQzlqMVuxHKetf3LFNZVvAGN6NJ3rV06Xj0GcAnmT DzhgOtytVWmpVU2I3iMqBwJq8th8kFp3uKhjJjinBFVgCEvMNnQAltvLzlP5nnJMhf2T /5LCZi2aVgaf9ZPANIrkSR9KSLhycRv7V89i90t873cNCW+AgOMv5W3tcZjcSG6dJjEt 18eyZpODE4SXTIXzqf+vq9IqjZfPV9HG+xn6B6nEfeFZM+iqlHj6nfRXhuuWAeeqmxH1 MxgK2QsKfAYxMwVGVZ0EzwAZcL/g2yU5/8JDE1EbHCNbhY8ZhWwTkxQJnpHwm4L7Cq/M 2rcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EM5lQ+MrZan5XXagwUBW9ttdhkPzpL4+w0s0X2CVGAY=; b=ygDCw8p3+uz5eHlOUUxE4UQ51j8Axivr8mEe47xsLICEMn64J7xW9QNh0jtX1kBA+A RlQ6ftxWKEeoFBcWPdrgSU1uZj0LBYCPGuodWuGIDHFkzBpPNw+EoKOJTjSzD7mD+Zyj kH+wr3R3Ard3YHSkQrJq7wrtccp85phOvBtdCAFDnyVYjbdMxgVuYfny7feX4lWDHTnc bpzjIZ/0N6mAX8+cJddgEIKnO1tWcBVpJFsSEyNDzhNRxH4zy9rFoij8p57xTNUy0ppf FBxwswu/cggFe9MOWLpw38zAnnZJ9twrm3/uXtTXv8QthXECElhY+hPp7AWy9vkLyIQD WIRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hQuy1dTx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 26si2496251ejk.419.2021.06.03.08.21.05; Thu, 03 Jun 2021 08:21:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hQuy1dTx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231695AbhFCPV5 (ORCPT + 99 others); Thu, 3 Jun 2021 11:21:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231589AbhFCPV5 (ORCPT ); Thu, 3 Jun 2021 11:21:57 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91C58C06174A for ; Thu, 3 Jun 2021 08:20:12 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id d5-20020a17090ab305b02901675357c371so5341030pjr.1 for ; Thu, 03 Jun 2021 08:20:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EM5lQ+MrZan5XXagwUBW9ttdhkPzpL4+w0s0X2CVGAY=; b=hQuy1dTxwDnv46KdNYBfAe/cdq8Wu5hRmeKWwVzoL1v4TqhFkcT9LWH9tjLcaaewtu 0a6XUewjLCk4qxcP394ZVbZLW9IvuvGlb7m4oxkKRYwc8Uu8Jwabjg+ZlSE7+0v+a2hy /JbKOCQWuN4vqH2ryfeePbDzp1DpQJqxGubXm5Clnv8Osd0jWAP1Hld60lGFRhKPJ5kW WoK6cLMSJ3VWWayuActX2VL6ndQy88A46Id9wO83rOLIaMwZ7L4r3iKkWWy3OFpW5CL/ WMO2wDvHIQ0kN23PuBbh8xehdlq+RFX6pInLAAxQTqSZi6IOyDChLDNqOzCr9LU0cfN9 ULMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EM5lQ+MrZan5XXagwUBW9ttdhkPzpL4+w0s0X2CVGAY=; b=XEA/cgbwqAaR5hBOeaQqfWnmxlwEd8V7w5e/nusysWEEfxIgOgWcNtYjv5rEyx2IVg fHH9X/Q32hltnAYP9QEoSG47vGYdqo4eqUdjlIxLWoDdRCB3uhlOxVe43PoaKtJV/P/B nBMZ9/DHbMCc+B1G8Ia/gasyq5fESo1H/lUYf/xrO0vBUNt9fPijPSor6MAkICasdhvl yW5Lg3mfmFZc2zHBqUZe3t17iSqN/XEYpQmP2JZnad01Ky5A7JG37q/FLI37RY++Ccsn vrUeKvVSNCRKYnWFXKBVY8wU9jlGU+QuvXKKE3tGX7dNtP8hb+hlzVaKwpAnc7o1Zyo+ cljQ== X-Gm-Message-State: AOAM531fpiy6xnaJXCtM10VX+/6mlw8kLg3YAoVxu3NeC3tRKWxkuW+K Z8sv+TyBMxrP6zx5zCNqVHruCQ== X-Received: by 2002:a17:90a:a60d:: with SMTP id c13mr11766792pjq.172.1622733611957; Thu, 03 Jun 2021 08:20:11 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id j1sm2536349pgq.23.2021.06.03.08.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 08:20:11 -0700 (PDT) Date: Thu, 3 Jun 2021 15:20:07 +0000 From: Sean Christopherson To: Wanpeng Li Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel Subject: Re: [PATCH 1/2] KVM: LAPIC: write 0 to TMICT should also cancel vmx-preemption timer Message-ID: References: <1622710841-76604-1-git-send-email-wanpengli@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1622710841-76604-1-git-send-email-wanpengli@tencent.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 03, 2021, Wanpeng Li wrote: > From: Wanpeng Li > > According to the SDM 10.5.4.1: > > A write of 0 to the initial-count register effectively stops the local > APIC timer, in both one-shot and periodic mode. > > The lapic timer oneshot/periodic mode which is emulated by vmx-preemption > timer doesn't stop since vmx->hv_deadline_tsc is still set. But the VMX preemption timer is only used for deadline, never for oneshot or periodic. Am I missing something? static bool start_hv_timer(struct kvm_lapic *apic) { struct kvm_timer *ktimer = &apic->lapic_timer; struct kvm_vcpu *vcpu = apic->vcpu; bool expired; WARN_ON(preemptible()); if (!kvm_can_use_hv_timer(vcpu)) return false; if (!ktimer->tscdeadline) <------- return false; ... }