Message ID | 20240116060129.55473-4-shahuang@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-27028-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp72192dye; Mon, 15 Jan 2024 22:02:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+Ws4qvpWF7tKyNG3rwybz6F5+C7EAx/lR4zqxNU7PcwkKUBzTpnN4rwcIrIBf6tOn/SZC X-Received: by 2002:a05:622a:48b:b0:429:e304:7f9a with SMTP id p11-20020a05622a048b00b00429e3047f9amr5593889qtx.35.1705384971166; Mon, 15 Jan 2024 22:02:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705384971; cv=none; d=google.com; s=arc-20160816; b=AQijutNLeA1/7QsNbMW9TykECJbaSCJxKdsxBbfF6nOl0izQPSVZbUtzroQ0+qY1s7 P5XvIK4DMDqG0IvriYxbHgQKi0teWRQFh6xW0EtJ8GoR8zD4v79rPQbve9nN/E8au0mW 1QdBZ3/ix67XJyw/Le0AQnLh2GM67M4m7NgwJ8P6a4+WbHd5UX+w0LgSIhKYmL0tHmMy JiiDh7Xui2t5KN6EEWkLJCSA1enGXkrTknvqHVSF7BqhH9nckZnAIwan1H6aOuRnagFT V0IT3h2wdHdgaeLAokw87gdPTc9yLkslbCLuqGY0I2lq+vRTJpgb8avF4gYZsWoi9tW7 A9Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=U9F5YnPtqeaOtnF1jbWP/C35kmOg9rX0z8z8z6VZYAU=; fh=VuUlYqvMXabbrxSvl5QPcnzeZiyktiyWLJ0H4umU7EU=; b=l4jPXGEITg+tPOaHdZpqi2/BO36qSkV2dee6IdG5DeMVj1MFbIFxXWzMluwNpxCOLO 1HPcdhGBY3zy259n8XvqBhV1jhP1Bi/66BUdSJyfdfgJZFf7+UktgDaIzM3nzvqmpE5Y GMekl/2nl4w4NF/E1d4REEucDmKdRVEuMSlQxO6ZBtaOoHrnvmeDhzuAMzlZiHUtND/T C+6gKOYDsSeZ3iSwk7gRkBIfzpl7iWcWNS055vqXgsV7Bb6rSsbej4R7IfqybaVGjS3t +yciEdWvfSbPSpFEjWr6BwmF6XGV32CBCPEDTSPVE5YFpNVQr+rLc4bZDmlGoc4mpWn5 5muw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MDqQd6JR; spf=pass (google.com: domain of linux-kernel+bounces-27028-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27028-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id hf9-20020a05622a608900b00429c9588f7fsi8400935qtb.659.2024.01.15.22.02.51 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 22:02:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27028-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MDqQd6JR; spf=pass (google.com: domain of linux-kernel+bounces-27028-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27028-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id EDF331C2292D for <ouuuleilei@gmail.com>; Tue, 16 Jan 2024 06:02:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C8B7C125B7; Tue, 16 Jan 2024 06:01:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MDqQd6JR" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 B6DCB10A1D for <linux-kernel@vger.kernel.org>; Tue, 16 Jan 2024 06:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705384898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U9F5YnPtqeaOtnF1jbWP/C35kmOg9rX0z8z8z6VZYAU=; b=MDqQd6JRVC0831ofRESKpA2ITEYBe7Lz4P1veMYCJDoJIzYlP8ux/m+I25dphljLzkyIu7 PvgWWalInbvpDo5Mip5ydqOPpgtfHm5b9NgMQ2C/XSCAhCoISQp/FVsBYqJuCCixYq5cEJ s9ucIbch1ui41u4SGYBZGpesIa5LoNw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-341-Myyr4p0TPemJrsDxd090_Q-1; Tue, 16 Jan 2024 01:01:35 -0500 X-MC-Unique: Myyr4p0TPemJrsDxd090_Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B8CE01C05ABF; Tue, 16 Jan 2024 06:01:34 +0000 (UTC) Received: from virt-mtcollins-01.lab.eng.rdu2.redhat.com (virt-mtcollins-01.lab.eng.rdu2.redhat.com [10.8.1.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5B1B2026D6F; Tue, 16 Jan 2024 06:01:34 +0000 (UTC) From: Shaoqin Huang <shahuang@redhat.com> To: Oliver Upton <oliver.upton@linux.dev>, Marc Zyngier <maz@kernel.org>, kvmarm@lists.linux.dev Cc: Eric Auger <eauger@redhat.com>, Shaoqin Huang <shahuang@redhat.com>, Eric Auger <eric.auger@redhat.com>, James Morse <james.morse@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Zenghui Yu <yuzenghui@huawei.com>, Paolo Bonzini <pbonzini@redhat.com>, Shuah Khan <shuah@kernel.org>, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/5] KVM: selftests: aarch64: Fix the buggy [enable|disable]_counter Date: Tue, 16 Jan 2024 01:01:21 -0500 Message-Id: <20240116060129.55473-4-shahuang@redhat.com> In-Reply-To: <20240116060129.55473-1-shahuang@redhat.com> References: <20240116060129.55473-1-shahuang@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788225751535763148 X-GMAIL-MSGID: 1788225751535763148 |
Series |
KVM: selftests: aarch64: Introduce pmu_event_filter_test
|
|
Commit Message
Shaoqin Huang
Jan. 16, 2024, 6:01 a.m. UTC
In general, the set/clr registers should always be used in their write form, never in a RMW form (imagine an interrupt disabling a counter between the read and the write...). The current implementation of [enable|disable]_counter both use the RMW form, fix them by directly write to the set/clr registers. At the same time, it also fix the buggy disable_counter() which would end up disabling all the counters. Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Shaoqin Huang <shahuang@redhat.com> --- tools/testing/selftests/kvm/include/aarch64/vpmu.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/kvm/include/aarch64/vpmu.h b/tools/testing/selftests/kvm/include/aarch64/vpmu.h index e0cc1ca1c4b7..644dae3814b5 100644 --- a/tools/testing/selftests/kvm/include/aarch64/vpmu.h +++ b/tools/testing/selftests/kvm/include/aarch64/vpmu.h @@ -78,17 +78,13 @@ static inline void write_sel_evtyper(int sel, unsigned long val) static inline void enable_counter(int idx) { - uint64_t v = read_sysreg(pmcntenset_el0); - - write_sysreg(BIT(idx) | v, pmcntenset_el0); + write_sysreg(BIT(idx), pmcntenset_el0); isb(); } static inline void disable_counter(int idx) { - uint64_t v = read_sysreg(pmcntenset_el0); - - write_sysreg(BIT(idx) | v, pmcntenclr_el0); + write_sysreg(BIT(idx), pmcntenclr_el0); isb(); }