Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2363519rdf; Mon, 6 Nov 2023 11:50:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOlSUWgOH1xUOApJRdAOxdQ3PY/0mbmfDd6LBkTIVn8u5OUA7XVnN8U9lu0WindUwG2iPE X-Received: by 2002:a05:6a21:3393:b0:137:23f1:4281 with SMTP id yy19-20020a056a21339300b0013723f14281mr30234877pzb.12.1699300244462; Mon, 06 Nov 2023 11:50:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699300244; cv=none; d=google.com; s=arc-20160816; b=LLdgcwNUU5U6B5NueoJNOJhK/S7xuwtIPV/n9n1DrHeeZoixC2NJ1rC7F1LphmPUeo NoUmU97EXz/L+9ZZ+cRHWV1GW+7+Q3kdL4g4+g5Zi8lN9CTbsQSwls/t+UgImofl+VOM qDZpt4keDnGHmyg/vIkORHPmo/SjF2K1v8vcgU0SutQC77iDW+kdpFcnja3MqXbIt24l Zsbx03pt00wbvirVKBVPPgzd2EqZygYo/11QHssy0u/bxQts7UkyLf6M06t8PsHb53on zrrqT0s33vMpsDLdYE1eyDoz4E0S0cvJHmvmAvRndkiol9B2qEurF4Gwww8ja2BviHXj LglA== 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=0wGNMs0oca0tadm30CfndT39i7CYhn3JaOLDgl0WWCo=; fh=AEB/Qw9IonDhjFU/1n2f/mT5c/qVgyTY2b2Iv+zVo5Y=; b=RfdXV3HQd+I2k4upAdUprY6WXjwXn8qj2Odv//t3sLaPH67oeVxUvlEW/+HNu/EXOG LmK3Mczgh1CPL9SQ+KzG1NyKWy6PmJvcoTq0JLtRLR8yXSUfX4s86RiBdhnjMVOLvR11 lsT380X3HhN1TD9+hISXMuFY36at/wfRdkV+jhMeXOSTk1pvuvuWq7GvxbF3E3I4qR2K zz5XWCVjp8qIqAcnO72NhNqiithQjG2HBgIcjEBUm7koSL5/hCjRL8bWwYp3fQRM4GFa GNAEOlFQ0P7HhBLcm15+KrcUaQAmrcz+jg8TmTWCY9YQbWZVIZlPyAhSN2jl9zRN0Gsa Cc8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nznY5cUa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f12-20020a056a001acc00b006be31c8eea5si9185556pfv.61.2023.11.06.11.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 11:50:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nznY5cUa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 675BA801F769; Mon, 6 Nov 2023 11:50:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232891AbjKFTum (ORCPT + 99 others); Mon, 6 Nov 2023 14:50:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232686AbjKFTul (ORCPT ); Mon, 6 Nov 2023 14:50:41 -0500 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15B6CD69 for ; Mon, 6 Nov 2023 11:50:39 -0800 (PST) Received: by mail-pl1-x649.google.com with SMTP id d9443c01a7336-1cc2be064b8so32219595ad.1 for ; Mon, 06 Nov 2023 11:50:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1699300238; x=1699905038; 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=0wGNMs0oca0tadm30CfndT39i7CYhn3JaOLDgl0WWCo=; b=nznY5cUaK3YO/LDtRTDeCM4++MJJJLahvX+4ZX3Xil4ytS4BXlHvXR+yt9zqaugOWe o5QsZZZ4cldqjfOx4HX1QoIhJa+DkdQRaTULC6i2fLmhe9gTJBhyqjt8w2ZmpVO4c93J WKZrufd/AAGUiWaku4J8m1Jb7oyp540Ir6d5kYFV7a08g+xaM4mshGzV01hKOq1XM4NJ z99VUa/n1d944HT8PzuIl5TI5ABIPk/VQrAZFwC3D3db1pjHx8G1IvWx+KuUMKkGOUh0 PJ3Wf8AYXbxFwedGQZs7LytTabfj2azT5xB5JTHHfVWKXoI5RhNQkPSCT2oWI0iJkGkW CpuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699300238; x=1699905038; 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=0wGNMs0oca0tadm30CfndT39i7CYhn3JaOLDgl0WWCo=; b=iGk9clopRqiMd2QjGbXQXxzAjwKZD8AFKfZKiuGPO2XSwX7lmV33YDWmENvbLBCScC fHPU0oaVAnHUgfLNwDTE0rNd279bv53GXI04gRLUFvb3QVoQcrTdoMUO7Jn9bnjlbKqu m6zaX2SSyt9vhqyHNjxQBv0Te+W3J5xiQ0dgbykcvIHXBfnMq8WtRSj1KuSKZbQ4RUk/ c0/Bk6GWcAiPFkYbuVy5PZRBnUegmBsws6+n5F9oOCCfPoVMrBzhNiGCTKam+CmP70ed NIub93mNTynNsZlziV+0x6sphqfqWSDuBwOdPAS+YEVZn65xw+ewC4/zLkLBzd6sxSkl yX1w== X-Gm-Message-State: AOJu0YyhameohEEIso/LjSieToUyPCQtJk6u7JaiTh8ofMDVtCjAFTwt PyY2d8uBM1ssdFW7HJ6BChNEeFSSILU= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:bd85:b0:1c9:bdc5:c34a with SMTP id q5-20020a170902bd8500b001c9bdc5c34amr14265pls.0.1699300238578; Mon, 06 Nov 2023 11:50:38 -0800 (PST) Date: Mon, 6 Nov 2023 11:50:37 -0800 In-Reply-To: Mime-Version: 1.0 References: <20231104000239.367005-1-seanjc@google.com> <20231104000239.367005-9-seanjc@google.com> Message-ID: Subject: Re: [PATCH v6 08/20] KVM: selftests: Extend {kvm,this}_pmu_has() to support 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=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UPPERCASE_50_75,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 11:50:43 -0800 (PST) On Sat, Nov 04, 2023, Jim Mattson wrote: > On Fri, Nov 3, 2023 at 5:02=E2=80=AFPM Sean Christopherson wrote: > > +#define KVM_X86_PMU_FEATURE(__reg, __bit) = \ > > +({ = \ > > + struct kvm_x86_pmu_feature feature =3D { = \ > > + .f =3D KVM_X86_CPU_FEATURE(0xa, 0, __reg, __bit), = \ > > + }; = \ > > + = \ > > + kvm_static_assert(KVM_CPUID_##__reg =3D=3D KVM_CPUID_EBX || = \ > > + KVM_CPUID_##__reg =3D=3D KVM_CPUID_ECX); = \ > > + feature; = \ > > }) > > > > -#define X86_PMU_FEATURE_BRANCH_INSNS_RETIRED KVM_X86_PMU_FEATURE(5) > > +#define X86_PMU_FEATURE_CPU_CYCLES KVM_X86_PMU_FEATURE(EBX= , 0) > > +#define X86_PMU_FEATURE_INSNS_RETIRED KVM_X86_PMU_FEATURE(EBX= , 1) > > +#define X86_PMU_FEATURE_REFERENCE_CYCLES KVM_X86_PMU_FEATURE(EBX= , 2) > > +#define X86_PMU_FEATURE_LLC_REFERENCES KVM_X86_PMU_FEATURE(EBX= , 3) > > +#define X86_PMU_FEATURE_LLC_MISSES KVM_X86_PMU_FEATURE(EBX= , 4) > > +#define X86_PMU_FEATURE_BRANCH_INSNS_RETIRED KVM_X86_PMU_FEATURE(EBX= , 5) > > +#define X86_PMU_FEATURE_BRANCHES_MISPREDICTED KVM_X86_PMU_FEATURE(EBX= , 6) >=20 > Why not add top down slots now? Laziness? =20 > > +#define X86_PMU_FEATURE_INSNS_RETIRED_FIXED KVM_X86_PMU_FEATURE(ECX= , 0) > > +#define X86_PMU_FEATURE_CPU_CYCLES_FIXED KVM_X86_PMU_FEATURE(ECX= , 1) > > +#define X86_PMU_FEATURE_REFERENCE_CYCLES_FIXED KVM_X86_PMU_FEATURE(ECX= , 2) >=20 > Perhaps toss 'TSC' between CYCLES and FIXED? I think X86_PMU_FEATURE_REFERENCE_TSC_CYCLES_FIXED is more aligned with how= the SDM (and English in general) talks about reference cycles. > And add top down slots now> Ya.