From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49F95C2BD09 for ; Tue, 9 Jul 2024 14:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LFnTUzpKhBIUCroDn1g1yjbNPSRiA5x35lp/BspUfsQ=; b=3yBSNcg8OXMGaA9JjArbNVfmMu SxHHwvw8by0hobJtJGz4IpyeFdBWFQB43qSSyZNp9fsHNlwpN1cTdCe1NOHplXQMfxcidGbO2rZCL srciOM4aN+rb4yeqVX2vKjKh+/W5DzWCkoWW+ahvsewoIQHYEZd4ZeIGCigqex4hPliCCgCdEDtpJ aEAHZiKWdrhXguzr8uNvByUbJCogfqHg84drN/xpSnGAHFos34M8hY3pCF4+cVEfltKvxTPM6Zatk I1bXNI1Yz0h7XLRyFwblS/tPYUo3tTFmn02n86mvTnDMgQmZEHRVWyMZh3sDC6un4cL0/LGNYDPlf 1UPE/qcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRBTE-00000007V4D-0LSN; Tue, 09 Jul 2024 14:05:28 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRBSw-00000007Uze-4803 for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 14:05:12 +0000 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-58bac81f3f9so6744827a12.2 for ; Tue, 09 Jul 2024 07:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720533909; x=1721138709; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LFnTUzpKhBIUCroDn1g1yjbNPSRiA5x35lp/BspUfsQ=; b=HOC8tiuq6p9A9z7ABTSKcc/CPjBdORuTK3KpA88J5YsqwyPsFZjivRVrHK3hjJvQGR X1pp5iWhr9altg84mog0Se3xE5b02xFG2XRN4ki8+BsqIve76SzTIWdNxLM5ZZOOkg/u 2hXA9km+hznboY2Zwd6mp1LXbNAxVrGhTtD2bcIaiHXEGiZ/HOKUQQX4SdqVJRHGHuTD hWaeSa2ENyiQVBbM2+KnrlxqGTM5cvNLOL8kcohztd9BgwXinCeS46tfD6TTIrS8osLr yVrGTS+eVwxggD7krhk90tiSQ2+wuyF+fBUpddvvQAfy5sEM+COH6mxbR5kxJkUrmeVh RtAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720533909; x=1721138709; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LFnTUzpKhBIUCroDn1g1yjbNPSRiA5x35lp/BspUfsQ=; b=MQE7W8weTv+QUinpLXT5uq1J6ssrqbKAwqv/l9lwHVU9z1QR1qqosQ0znRuMuc7ZiG KsjsCRk7U/DiMkoGS7tn9UCHN7ISmReoPkJBxv03DH/Glpwc6NxNJeL92lrkKb2EWeBT gWoqzW1X1v8g8KM8tT5DHU7IGjmPVr/rTA8DExN9ULjuwinWAKXyWl+hG3Srhg+MuiqP dhrkLmLAUMk7OVYzvAzrmMvHHsN5uaIQ7HkMQa3y8mB2OcT+/IDSc78aFT1k5FBP86tK wFCJawS52Pn5fefrrRNs+xVntmgn/Q+zIa5LGU9Esl1xrVH69sU2WR08DuZu6urhE6Ys DZNg== X-Forwarded-Encrypted: i=1; AJvYcCWxbaCeQqcU4TYdetaamG5L3g7jLtcbriYBBWxAi8srO3LVCHkzEjt+NcKQYD1aaPx921Aul2gnjLk61YqkwK3U1iiL9taFHCHaHhV3QAsBUc1dSpA= X-Gm-Message-State: AOJu0Yw5Rongtadila1wA66rzvQwCBZf5mHcF54cSqFz3xXhUqxT2ihb t1YCORSC7yZ/LSqNxXUeizZNXw808bx4SALw3Kv3snoz6UcbQgsVwBbCUyCKxx9Q5BePQyUUqbF v X-Google-Smtp-Source: AGHT+IE+Zmggc07hsVlPoxEDJ5GRtNGB1wyrmyRK/TXjRJdHi8hOElRGk0h0SF/eAxRWxky1RxL6mQ== X-Received: by 2002:aa7:c45a:0:b0:58b:12bd:69c8 with SMTP id 4fb4d7f45d1cf-594bbe2ba49mr1526124a12.36.1720533908642; Tue, 09 Jul 2024 07:05:08 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-594bda308d7sm1088890a12.91.2024.07.09.07.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 07:05:08 -0700 (PDT) Received: from draig (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4247C5F8D7; Tue, 9 Jul 2024 15:05:07 +0100 (BST) From: =?utf-8?Q?Alex_Benn=C3=A9e?= To: Peter Maydell Cc: Alexandru Elisei , pbonzini@redhat.com, drjones@redhat.com, thuth@redhat.com, kvm@vger.kernel.org, qemu-arm@nongnu.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, christoffer.dall@arm.com, maz@kernel.org, Anders Roxell , Andrew Jones , Eric Auger , "open list:ARM" Subject: Re: [kvm-unit-tests PATCH v1 1/2] arm/pmu: skip the PMU introspection test if missing In-Reply-To: (Peter Maydell's message of "Tue, 9 Jul 2024 10:33:28 +0100") References: <20240702163515.1964784-1-alex.bennee@linaro.org> <20240702163515.1964784-2-alex.bennee@linaro.org> Date: Tue, 09 Jul 2024 15:05:07 +0100 Message-ID: <87ed82slt8.fsf@draig.linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_070511_053387_87EBA2FD X-CRM114-Status: GOOD ( 24.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Peter Maydell writes: > On Tue, 9 Jul 2024 at 09:58, Alexandru Elisei = wrote: >> >> Hi, >> >> On Tue, Jul 02, 2024 at 05:35:14PM +0100, Alex Benn=C3=A9e wrote: >> > The test for number of events is not a substitute for properly >> > checking the feature register. Fix the define and skip if PMUv3 is not >> > available on the system. This includes emulator such as QEMU which >> > don't implement PMU counters as a matter of policy. >> > >> > Signed-off-by: Alex Benn=C3=A9e >> > Cc: Anders Roxell >> > --- >> > arm/pmu.c | 7 ++++++- >> > 1 file changed, 6 insertions(+), 1 deletion(-) >> > >> > diff --git a/arm/pmu.c b/arm/pmu.c >> > index 9ff7a301..66163a40 100644 >> > --- a/arm/pmu.c >> > +++ b/arm/pmu.c >> > @@ -200,7 +200,7 @@ static void test_overflow_interrupt(bool overflow_= at_64bits) {} >> > #define ID_AA64DFR0_PERFMON_MASK 0xf >> > >> > #define ID_DFR0_PMU_NOTIMPL 0b0000 >> > -#define ID_DFR0_PMU_V3 0b0001 >> > +#define ID_DFR0_PMU_V3 0b0011 >> > #define ID_DFR0_PMU_V3_8_1 0b0100 >> > #define ID_DFR0_PMU_V3_8_4 0b0101 >> > #define ID_DFR0_PMU_V3_8_5 0b0110 >> > @@ -286,6 +286,11 @@ static void test_event_introspection(void) >> > return; >> > } >> > >> > + if (pmu.version < ID_DFR0_PMU_V3) { >> > + report_skip("PMUv3 extensions not supported, skip ..."); >> > + return; >> > + } >> > + >> >> I don't get this patch - test_event_introspection() is only run on 64bit= . On >> arm64, if there is a PMU present, that PMU is a PMUv3. A prerequisite to >> running any PMU tests is for pmu_probe() to succeed, and pmu_probe() fai= ls if >> there is no PMU implemented (PMUVer is either 0, or 0b1111). As a result= , if >> test_event_introspection() is executed, then a PMUv3 is present. >> >> When does QEMU advertise FEAT_PMUv3*, but no event counters (other than = the cycle >> counter)? The other option I have is this: --8<---------------cut here---------------start------------->8--- arm/pmu: event-introspection needs icount for TCG The TCG accelerator will report a PMU (unless explicitly disabled with -cpu foo,pmu=3Doff) however not all events are available unless you run under icount. Fix this by splitting the test into a kvm and tcg version. Signed-off-by: Alex Benn=C3=A9e 1 file changed, 8 insertions(+) arm/unittests.cfg | 8 ++++++++ modified arm/unittests.cfg @@ -52,8 +52,16 @@ extra_params =3D -append 'cycle-counter 0' file =3D pmu.flat groups =3D pmu arch =3D arm64 +accel =3D kvm extra_params =3D -append 'pmu-event-introspection' =20 +[pmu-event-introspection-icount] +file =3D pmu.flat +groups =3D pmu +arch =3D arm64 +accel =3D tcg +extra_params =3D -icount shift=3D1 -append 'pmu-event-introspection' + [pmu-event-counter-config] file =3D pmu.flat groups =3D pmu --8<---------------cut here---------------end--------------->8--- which just punts icount on TCG to its own test (note there are commented out versions further down the unitests.cfg file) --=20 Alex Benn=C3=A9e Virtualisation Tech Lead @ Linaro