Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2250248rdf; Mon, 6 Nov 2023 08:39:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtdyidjGOTbDIZ0tDK1/xeXpT752OW3n6jKLawrrlYA/nPt5tpUYROAk2ARWJ3DDsSRiyq X-Received: by 2002:a05:6a21:4983:b0:181:1549:f1fa with SMTP id ax3-20020a056a21498300b001811549f1famr7724013pzc.28.1699288796661; Mon, 06 Nov 2023 08:39:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699288796; cv=none; d=google.com; s=arc-20160816; b=cwjGLbVbXDXLSdC8SS9ZHfYGQV19QrPrufCDUaHLeugSzTC9MAxo5naKvG7mQSpU3g u1YnYOSPYZUez4x99b5TwXrS4Hqu9jktOXkoOCNT5aMSkdBghouNQWMzUKZAx6BZiEjE rerUPMEkkOiDMIHnrBNFhso8Jrw9jpHBuvhdgJXsefeddCkyrCVXfq9NLBi6BdRZo+27 ubaukLNZo0757j/IBDZ2hHHqOFu3jcf6V2Dz+kJiwTh9rPbP+yoo2H0ZsMWagXtOf45z U1HrZaE89QhRekD3MYEVeKsywDmFXtEtQCfCX5NdXisSGi6Z6vBg1JsjN7lboFeiEsq4 7NWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:dkim-signature; bh=s6GJqjPyHEWJBt2NqwShpg4qNSCTYad7QEEr5EefJZo=; fh=AEB/Qw9IonDhjFU/1n2f/mT5c/qVgyTY2b2Iv+zVo5Y=; b=BY0ZOXugq3tGTA9i0vKe5ojOiPfQmwPf3uBMUephXEWZ7Q7atJfvL3RvYyl6LCGWT6 deJRNcXr2N8utMcKuK2QYcn1wp5kacrFu4+xOlbKnoK7dA6BdLPre4NaBvPbdppsj/XO itFOAQBq1m4ZJMCBXPqVHJ7W4d5uBYat6v+RXYPH2AUlrZTwUIeJsBesCu0RFnkZ5/qk H17Jav1YPDNAAQVvi2OV5BquHORAB1x982cp4IoASdu9nuIdPTCkbJBYndpBJ+nHfbS6 MFGS6n7LxTfJnZiseBDDGVAvL6RTxpYHtTo6FzIUB9vvCEQFv+Hpuu0/03xFJ/lr05ff 9xlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JX7NAUCp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id e17-20020a170902e0d100b001c6189eaaebsi8024142pla.186.2023.11.06.08.39.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 08:39:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JX7NAUCp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 6A9C38038D40; Mon, 6 Nov 2023 08:39:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231785AbjKFQjl (ORCPT + 99 others); Mon, 6 Nov 2023 11:39:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjKFQjk (ORCPT ); Mon, 6 Nov 2023 11:39:40 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 640FE1BF for ; Mon, 6 Nov 2023 08:39:38 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5b0c27d504fso32457537b3.1 for ; Mon, 06 Nov 2023 08:39:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1699288777; x=1699893577; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=s6GJqjPyHEWJBt2NqwShpg4qNSCTYad7QEEr5EefJZo=; b=JX7NAUCpiEM67qqL3gJDF7pnWLvohEjUq8tKurjUCCzjqmcjLSGWr95PQ3sY7zinEs F0UoHKaje/uy8AvKQGe0h8I0uB/I22CfoQkqTprQXXpBaN9YR1ulmi+ZWly75TtFCgpx RJak0HR94aZeY03pkGTbzwBUkTC7SICthPSi2JgzTrdXbjo4A6DpuDMwDwhepTgP1Fvp OKJ9MmNKuCN7nqyQYfP4wG7uiQfBQ+Ui8XfQXf+U/mk6qyfTuuwjwRTzd12laGVgiXuX Ainr92BlkiCmWil3bdlnn9C2eWVaBKjozR63WzZgMIJ3iRNgvaWcydhn6/0uKDp1OQsb blqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699288777; x=1699893577; h=content-transfer-encoding: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=s6GJqjPyHEWJBt2NqwShpg4qNSCTYad7QEEr5EefJZo=; b=qd/v4tsswEa4cf7khYLzNbZsZf1ioBR8T04SOGZMDvzNv/tvnGnFssFD5XUuhlyhM9 xVgH1gHSlmEGylS7MhK9Y7Ef9jP39FsIUMZa9d/OHUB2sLEvOuxsuiJm+nmutwVS6CtO KJh8Lab4YeP5lFK5OTczXwNdAeyD9/Fvq9mrdmFiGxRVaRhb0oy2hRpYC2JWOnTobz4j XFwZpXLUo/iTNA0G07/iKEjcVHnKzvU1/ahsqsSb2gwL9bxeo2T7vZaEm8AA19goOKVL VuCnSL1snLVQrlRZaHlzoic2j6qYPD/RSt8msz3fLzu7d4bHDWdignRCwPNHGIy/t3IZ ES1Q== X-Gm-Message-State: AOJu0Yx+RfjBDI9JEvuaymWpuKkjgoT/JuicUFldeH2jXtpUDnSYoLlx phQm7M4/hkv0APUncy3FuBl10b/OiZo= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:b64a:0:b0:5a7:d45d:1223 with SMTP id h10-20020a81b64a000000b005a7d45d1223mr243215ywk.3.1699288777668; Mon, 06 Nov 2023 08:39:37 -0800 (PST) Date: Mon, 6 Nov 2023 08:39:36 -0800 In-Reply-To: Mime-Version: 1.0 References: <20231104000239.367005-1-seanjc@google.com> <20231104000239.367005-12-seanjc@google.com> Message-ID: Subject: Re: [PATCH v6 11/20] KVM: selftests: Test Intel PMU architectural events on fixed counters From: Sean Christopherson To: Jim Mattson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Kan Liang , Dapeng Mi , Jinrong Liang , Like Xu , Aaron Lewis Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 06 Nov 2023 08:39:54 -0800 (PST) On Sat, Nov 04, 2023, Jim Mattson wrote: > On Fri, Nov 3, 2023 at 5:03=E2=80=AFPM Sean Christopherson wrote: > > static void guest_test_arch_event(uint8_t idx) > > { > > const struct { > > struct kvm_x86_pmu_feature gp_event; > > + struct kvm_x86_pmu_feature fixed_event; > > } intel_event_to_feature[] =3D { > > - [INTEL_ARCH_CPU_CYCLES] =3D { X86_PMU_FEATUR= E_CPU_CYCLES }, > > - [INTEL_ARCH_INSTRUCTIONS_RETIRED] =3D { X86_PMU_FEATUR= E_INSNS_RETIRED }, > > - [INTEL_ARCH_REFERENCE_CYCLES] =3D { X86_PMU_FEATUR= E_REFERENCE_CYCLES }, > > - [INTEL_ARCH_LLC_REFERENCES] =3D { X86_PMU_FEATUR= E_LLC_REFERENCES }, > > - [INTEL_ARCH_LLC_MISSES] =3D { X86_PMU_FEATUR= E_LLC_MISSES }, > > - [INTEL_ARCH_BRANCHES_RETIRED] =3D { X86_PMU_FEATUR= E_BRANCH_INSNS_RETIRED }, > > - [INTEL_ARCH_BRANCHES_MISPREDICTED] =3D { X86_PMU_FEATUR= E_BRANCHES_MISPREDICTED }, > > + [INTEL_ARCH_CPU_CYCLES] =3D { X86_PMU_FEATUR= E_CPU_CYCLES, X86_PMU_FEATURE_CPU_CYCLES_FIXED }, > > + [INTEL_ARCH_INSTRUCTIONS_RETIRED] =3D { X86_PMU_FEATUR= E_INSNS_RETIRED, X86_PMU_FEATURE_INSNS_RETIRED_FIXED }, > > + /* > > + * Note, the fixed counter for reference cycles is NOT = the same > > + * as the general purpose architectural event (because = the GP > > + * event is garbage). The fixed counter explicitly cou= nts at > > + * the same frequency as the TSC, whereas the GP event = counts > > + * at a fixed, but uarch specific, frequency. Bundle t= hem here > > + * for simplicity. > > + */ >=20 > Implementation-specific is not necessarily garbage, though it would be > nice if there was a way to query the frequency rather than calibrating > against another clock. Heh, I'll drop the editorial commentry, though I still think an architectur= al event with implementation-specific behavior is garbage :-)