Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp31413lqn; Thu, 11 Apr 2024 12:47:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVYMgwJ3HF1my2gGIE28iJ9wNx1ZfPy/Gkl0EClNLJs4XDPaVRcO3br0ElUbVCZWGQrCsBQ7EXjqlPpMr2Ttt0/UxCRh+tXF8pFB13OaA== X-Google-Smtp-Source: AGHT+IHTRluB4WDjjywF8vRQ/Bj8rlcqCIhDBJNSuRdB0VvvS/jQHEujZ2la3Ry74nQTFCAJKuYV X-Received: by 2002:a17:903:2348:b0:1e2:b026:cad5 with SMTP id c8-20020a170903234800b001e2b026cad5mr559712plh.0.1712864878452; Thu, 11 Apr 2024 12:47:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712864878; cv=pass; d=google.com; s=arc-20160816; b=WYI6ewxvOZ6KUgndUUUl5gcZeGbCEAEtBoKIS/zNYECyPOIa27uFH40LM8JajiXbjy PHxjTBbQCqfKN7MAbdojucKpZPQyaUVpWwJxxvYBnPBjmToY0tL/Q71TfTZU6E1RhuzC J+EOGpHmd1Kn+63Pl4KPdfcwuQXv27WDoTgcgiMybw+6Mj/HKKbvSIV+hqjQk907hrxb dksyK37E4yn9iLSsWlDjddljlCihu127NaQV6ueXHABH2BcJVH0E/SUec4SLB7r2zy9s BO2UOtcSxgvlNX2CUWJ1sPIkH+vXaBBhGLCLTL1y2G8NEIbCO05VJJw7F/J7f3tqzS4n fPuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=ZWyDifNB+g3/yqoVnm4if7NwdO+FurrszL4Rzn9n/PI=; fh=AH/a/Chjky01zA5PNCFAfIknWtT+0NXz+C/kdo7v+x0=; b=zVvm3rGI31F6RjDWKAmkHHnFY3IjCM9f7lawq+FsLs3IRK73dmP7JlgjglAVyipsYg pN/qfSflsOL7wnnv5qcWd8Nbh517HuyCH5atfBh2TBZ+dCLfW0e7CU22RErrtSScG/3L 9e1L9KNjPPCezDMn1KzM1SnQ2UMafJlhlFBNXdqpikbrue8YoZywXqI9C5/uRRWhE5ll oDDwsNKWEWian8CdVSVRKyxwPMm92x3YunTvFo7RBiQAgUu6iVqH0uoYN6YoLXyZP35H U7ccpqUIFwrrW4tCGl9AXLv0+zzSl0oNRkZgjgEHo5mgzvDk5XMFa88IWZTxPralCiDC AZtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=X4ADJCl3; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-141523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u14-20020a170902e5ce00b001e2c3ace272si1842133plf.99.2024.04.11.12.47.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 12:47:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=X4ADJCl3; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-141523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 92F8BB2479A for ; Thu, 11 Apr 2024 19:23:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5239715E81; Thu, 11 Apr 2024 19:23:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="X4ADJCl3" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 813CD12E7F for ; Thu, 11 Apr 2024 19:23:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712863382; cv=none; b=IK+w9EQDCr7kjIH6uF1cGsMJbQQSRlSXZMU7yckLe4wm9uktx0ptwpxKGtf76iq0/ZbH9DBvBaWuXjSrBujlX/kv6ZCtLXEMQDc8DnrnV17y+0paQYZj7TycN5a3zlwWqSKvevLEfG5dKzImsSRP+KUR/NTd1hajEYFykEoCLLs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712863382; c=relaxed/simple; bh=fT4P0gGE+O7sWBDiZ8pLxxyQEVTnnen55DJKAfs9ezU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ubl65JoPe5m2z1yonY+8LaQpIdv5arRpQgvnWSTt9p/gFt7Tv2uDd0F5mQO+hCBLtl2xPZ4hyp5vO62DwwCjA8Qy0s46TA6x/BDIsdTiCryAfC9W5gY1KBd0QCbVkgQHswcqjvUmDI55+2u8gwfviptsPt7UovlDTPpLlotaOPA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=X4ADJCl3; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-618596c23b4so1887287b3.0 for ; Thu, 11 Apr 2024 12:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712863379; x=1713468179; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ZWyDifNB+g3/yqoVnm4if7NwdO+FurrszL4Rzn9n/PI=; b=X4ADJCl3aXslKO6WR1GzXOkIx0F8RxwRThktrxh9RgpI76pJwgZ7dMeC4vPKWdryr7 NyvINpteUicAKPS/0EdyiSoTk/iB8XAl66qjAMj22rb35cwl1ahQf/ZGOBHaLswN21p+ Coj8WrxEOUz/KyypUDOlXG7Ayc9Wcag0eMGY1AcQ8Ke1tzRypVB/LGTxm0ZZEElfXh3r QBj7b7rBXv9Kk2IV4CIp+33I+UQdShsd5G/5YLdTm6SXXzvxyktb2mminHz+xEGNOAGL jqDzOxpblthADLbthzW0AV7ziin4Wgo1DXDSoseD+Sai/PTPu9dpnIxu8xgqUIz/3AeF zVmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712863379; x=1713468179; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZWyDifNB+g3/yqoVnm4if7NwdO+FurrszL4Rzn9n/PI=; b=lzgKxQQn+KqRVoWIyyYKuc3VRdTDj1U2kWWFjAOO/aNpb8ABAJFuEgCtKacy1kbHMW LHzr9uWBTHEPSwskR634BrgxEZlQnH/7ubvtuDEe77YD+KuPi6x5VYpIOnyjBIjiSahU D3BhkcDzi8gtJcX9qEomCs32/WXLBhWvBvaG/9etvx83ysKsin8ylHJJJOUVnnTVBeqq L9aFRJofwBxqjD1uTRzJodoAdDS57+jux5FiYr/SSanqoprOE0vuFkVAGbTvLMqG5Mln qjTLda4iSPPVDBJrVXrCugG6VJ2qyVbc37YzsuotIDdqudiT9zj67CSEqEjeztbZUoi8 JVxQ== X-Forwarded-Encrypted: i=1; AJvYcCXDEQLF3YGORoyTLsOMnn7fKB0GQD5pg5i0eBAmCVHoaVcrVUXeSTE7hDZFBDkqPijb8ZvJXgdVrb4MzO2VD7vR9bDGDxBeg2tR8hkQ X-Gm-Message-State: AOJu0YzUC99xrHhy6+WoQVQViwMDdzAcjvHIsJd++nUo+HwbSUETTUOU EapnG3y7KYYTzGhO7oRvjgAfFtmHjxcOpVSqaZj2Rs2bMQIuGjkAEBhabL75tFd1zRwdpN6n0Gy Ovg== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:6cc9:0:b0:615:2597:7246 with SMTP id h192-20020a816cc9000000b0061525977246mr83113ywc.6.1712863379573; Thu, 11 Apr 2024 12:22:59 -0700 (PDT) Date: Thu, 11 Apr 2024 12:22:58 -0700 In-Reply-To: <20240126085444.324918-9-xiong.y.zhang@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240126085444.324918-1-xiong.y.zhang@linux.intel.com> <20240126085444.324918-9-xiong.y.zhang@linux.intel.com> Message-ID: Subject: Re: [RFC PATCH 08/41] KVM: x86/pmu: Add get virtual LVTPC_MASK bit function From: Sean Christopherson To: Xiong Zhang Cc: pbonzini@redhat.com, peterz@infradead.org, mizhang@google.com, kan.liang@intel.com, zhenyuw@linux.intel.com, dapeng1.mi@linux.intel.com, jmattson@google.com, kvm@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, zhiyuan.lv@intel.com, eranian@google.com, irogers@google.com, samantha.alt@intel.com, like.xu.linux@gmail.com, chao.gao@intel.com, Xiong Zhang Content-Type: text/plain; charset="us-ascii" On Fri, Jan 26, 2024, Xiong Zhang wrote: > From: Xiong Zhang > > On PMU passthrough mode, guest virtual LVTPC_MASK bit must be reflected > onto HW, especially when guest clear it, the HW bit should be cleared also. > Otherwise processor can't generate PMI until the HW mask bit is cleared. > > This commit add a function to get virtual LVTPC_MASK bit, so that No "This commit", "This patch", or any other variation. Please read through: Documentation/process/maintainer-tip.rst Documentation/process/maintainer-kvm-x86.rst > it can be set onto HW later. > > Signed-off-by: Xiong Zhang > --- > arch/x86/kvm/lapic.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h > index e30641d5ac90..dafae44325d1 100644 > --- a/arch/x86/kvm/lapic.h > +++ b/arch/x86/kvm/lapic.h > @@ -277,4 +277,10 @@ static inline u8 kvm_xapic_id(struct kvm_lapic *apic) > { > return kvm_lapic_get_reg(apic, APIC_ID) >> 24; > } > + > +static inline bool kvm_lapic_get_lvtpc_mask(struct kvm_vcpu *vcpu) > +{ > + return lapic_in_kernel(vcpu) && > + (kvm_lapic_get_reg(vcpu->arch.apic, APIC_LVTPC) & APIC_LVT_MASKED); > +} As suggested in the previous patch, I'm pretty sure we can safely omit this helper. > #endif > -- > 2.34.1 >