From nobody Mon Feb 9 10:32:16 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E55E369207; Tue, 3 Feb 2026 18:17:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770142657; cv=none; b=jK2pYM3P9n5ByvXECw1i7YJ0aft1x7FQH8oAZcuXRBWmoLhbF3mCqx/SekDKQpb7RpM94G610Wugu0QMJD0kSH28HVbswAxpYmBMG36yDUh8xv7sVZ+1RnTZ5b3XRXapHB7rwkeuzXBjzVELIm08wYOxTZ6zbSy9if9MgQhHC3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770142657; c=relaxed/simple; bh=v6JWNFCO9hbIhS9f+Hpe5Tv6VmFe0s0qenV2T/lAeic=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=isYok3R80px6bdUVlg3hFTqpoZ29c4tZIjubTg6y/r9UGQM78xaJuzDLp/ViR0jc2rVbUo/8j/gnMn6bCr/IDRD/SyRpayvNRHKnqVqz4KnPFXkJsnIXZJg/Qr9AsMgm8pEifc/YXVVYWkpSt8CyYfEBd03f/T8PtAdNqkC97Tc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WsPrWpeg; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WsPrWpeg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770142654; x=1801678654; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v6JWNFCO9hbIhS9f+Hpe5Tv6VmFe0s0qenV2T/lAeic=; b=WsPrWpeg/fIHLh1odgBI84Lf6yLtxdipcOc8yufLZ1mefETINpKf2aVe GDy2+JMOnaAqoUwnQszeIPVRwSSZ2HgpEEnE0tOvFnqIb31BHtV3g7kar ZQMTq5UBNcwC96W+sOygDliL9ujs110fbuP1QktPhpmA5rkr9ysLe1OlO JOF9BRJYTYz/OMsFp7nZgPYc9BSdSZNaWBYNlawnzecQtYK4ZMxKhb9EM gGkS7wjP8o/NNy243WOZcGj4ZaklqD0KPh6JjX8fMDdQqsRki21BB9N5z rqp9Dk9x76RyDw8dYWAIugGtOn0WC6+2Q55Y+SgS0WFF6lyzExpueltds w==; X-CSE-ConnectionGUID: hmWxtI3aQ4+IreKqVjtiAw== X-CSE-MsgGUID: YWgcCo5ZSCOQuvUM8dxF6g== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="82433175" X-IronPort-AV: E=Sophos;i="6.21,271,1763452800"; d="scan'208";a="82433175" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2026 10:17:34 -0800 X-CSE-ConnectionGUID: bPAhYS24Sv+GIrYxK4XqwQ== X-CSE-MsgGUID: bErh3sbBRQSHtmvodQMvcA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,271,1763452800"; d="scan'208";a="209727487" Received: from khuang2-desk.gar.corp.intel.com (HELO localhost) ([10.124.221.188]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2026 10:17:34 -0800 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , Sean Christopherson , linux-kernel@vger.kernel.org, Yang Zhong Subject: [PATCH 05/32] KVM: x86/lapic: Add a trace point for guest virtual timer Date: Tue, 3 Feb 2026 10:16:48 -0800 Message-ID: <4dfe5a137204456cd984fb0be7c1041898a3a91a.1770116050.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yang Zhong Add a trace point for changing the guest virtual timer, similar to the hv timer case. Co-developed-by: Yang Zhong Signed-off-by: Yang Zhong Co-developed-by: Isaku Yamahata Signed-off-by: Isaku Yamahata --- arch/x86/kvm/lapic.c | 5 +++++ arch/x86/kvm/trace.h | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 080245f6dac1..837f446eea41 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -1848,6 +1848,9 @@ static void cancel_apic_virt_timer(struct kvm_lapic *= apic) =20 kvm_x86_call(cancel_apic_virt_timer)(vcpu); apic->lapic_timer.apic_virt_timer_in_use =3D false; + + trace_kvm_apic_virt_timer_state(vcpu->vcpu_id, + apic->lapic_timer.apic_virt_timer_in_use); } =20 static void apic_cancel_apic_virt_timer(struct kvm_lapic *apic) @@ -1876,6 +1879,8 @@ static void apic_set_apic_virt_timer(struct kvm_lapic= *apic) kvm_x86_call(set_apic_virt_timer)(vcpu, vector); kvm_x86_call(set_guest_tsc_deadline_virt)(vcpu, ktimer->tscdeadline); ktimer->apic_virt_timer_in_use =3D true; + + trace_kvm_apic_virt_timer_state(vcpu->vcpu_id, ktimer->apic_virt_timer_in= _use); } =20 static bool kvm_can_use_apic_virt_timer(struct kvm_vcpu *vcpu) diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index e79bc9cb7162..649d06f87619 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h @@ -1649,6 +1649,22 @@ TRACE_EVENT(kvm_hv_timer_state, __entry->hv_timer_in_use) ); =20 +TRACE_EVENT(kvm_apic_virt_timer_state, + TP_PROTO(unsigned int vcpu_id, unsigned int apic_virt_timer_in_use), + TP_ARGS(vcpu_id, apic_virt_timer_in_use), + TP_STRUCT__entry( + __field(unsigned int, vcpu_id) + __field(unsigned int, apic_virt_timer_in_use) + ), + TP_fast_assign( + __entry->vcpu_id =3D vcpu_id; + __entry->apic_virt_timer_in_use =3D apic_virt_timer_in_use; + ), + TP_printk("vcpu_id %x apic_virt_timer %x", + __entry->vcpu_id, + __entry->apic_virt_timer_in_use) +); + /* * Tracepoint for kvm_hv_flush_tlb. */ --=20 2.45.2