Message ID | 20240202025659.5065-4-shahuang@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-49124-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp173494dyc; Thu, 1 Feb 2024 18:58:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKtSEk5UZCTK47TcQYlnr03dW9KNFCcSDyA3iNaNZJ0MyA/C8rpwxdNgRay0SnXKXMPEnb X-Received: by 2002:a05:620a:a5c:b0:785:350f:7c1d with SMTP id j28-20020a05620a0a5c00b00785350f7c1dmr4269893qka.66.1706842700272; Thu, 01 Feb 2024 18:58:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706842700; cv=pass; d=google.com; s=arc-20160816; b=OEC7wf/1vOi9iHum+CC3vhOXKKq43x5YYVGrb9Uu+F0epf+sc8141KgJr43bBxN6my 4BBeADBV2dVdKAwmXyLTJxWmphWlTuVHExjseYusyJxxrzMkfZL1lggpTBwhXdiwycit 7VOtercGOsD8ajqUTcgfidG4T5c1E7f5KtP48e96tGtksxxgVQKhAPtVT247vhJnj4MC tPFXnkK0KVIsgBXf2W5hP4N7A/fQcrljSLzv9n+cxjar5qn6201eDSd5Iqb5OgM2sSlb lX8grajRovV01uchwC/RzZEvxgqBUfVWU4mmEyGm3s2Le7IgBXhRy9e0QO9lpetEz+Mv hANw== ARC-Message-Signature: i=2; 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=hi+EdE9BcVWpF5frSoCALRQVB52U4QNkUOAopYUQrrE=; fh=XCq0ym0zriBzjpn70wqWC51Jx/WYjhQEX8NTCXF5g04=; b=MAzWubPrjenmDwRS2LspXxLxDUvQzB4ygonM3ysRZOereOXN+7UbmurCBy8NhZLMLs fRRidUFLklM4S1gmedWFZRCInTx9WAEAw3BChLVBOlS3Rtl+LmXnBAijLR/ujLQ23lau cnxR31t0f2La0+AoJ+Asw1QympFKdcZv7rS3ofUxKRrCgkwhe/RsZ40GeK1awefDcw7U VzP0a5RUVJNAnu69WVxbYJ/lFsVki8JAm+2SNr440pJ+2JK5fS9pN+2qLoVBrS1KjPoG Ipcc3AxxwJClg5UZ9DBM94Rckb/YzvgvOSN0cyzLq6k1+dab0RtCrdVarzpaDL7TWT5E qBlQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R31fCCsE; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-49124-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49124-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCVy/77IRjUIZ7+9v+jEO7kp19y0sZcY/jQ8byZY3hYd66ZjRLXgGSY7PU45ZARn/PMH1dRTRmGOTrvZaZow+f2flTGcNg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y29-20020a05620a09dd00b007853a3f8878si1027783qky.447.2024.02.01.18.58.20 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 18:58:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49124-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=R31fCCsE; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-49124-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49124-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 164001C21F93 for <ouuuleilei@gmail.com>; Fri, 2 Feb 2024 02:58:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3BA611190; Fri, 2 Feb 2024 02:57:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="R31fCCsE" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 25D59D2F5 for <linux-kernel@vger.kernel.org>; Fri, 2 Feb 2024 02:57:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706842633; cv=none; b=bw2sHMAWVl854Di1swxjVKW7QsZAbge9FAk9S1cISMrh/NrSWtOkLgSbRznRYrlB8fY0rhqQZyqypuLLx7JxPZtKd5L37frkWxAvNhYtJ1ZvGyHox+WYsWswH9dh2CSLhN6FBezNlElmODl8T+rgyEfuUBrnfG9UT2019ewyXOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706842633; c=relaxed/simple; bh=CFCmJjwKp5av5hjkAYWAQpnhq7Fv7wpmWOVD0ITvnNA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JTe6STQc6tVcopchcaEMFPIFpNrsDy98RuJ7ivkDjmab6qfpkW2nQDyzxHc/mels9QTOzhbeywVkuRWp95S/McGd7S1MYjJSiYik95CXcYwMpP3WC2Lu+lrkJA7Lgxq1x5yGpeiBvuTX2PiQ+BF/Zfek7Xiyv8PDU1ey9aZpAU0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=R31fCCsE; arc=none smtp.client-ip=170.10.133.124 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=1706842631; 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=hi+EdE9BcVWpF5frSoCALRQVB52U4QNkUOAopYUQrrE=; b=R31fCCsERIEq2ZBOvb0lCDZWWMei+BvJQjarC963P+neOknbVCHfO3de7T0voZ55da2aa6 DxDhxZua5+tq1C6bYQxTdPf6AlEuj/0iHJu4+S5S5jGY+ZmBnKoamYDu5PrxEpMBlrb2Di roLvlQt7ckVek8XF69EN3yyzASW7pwA= 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-646-DpsQMxLPPnu5XY_HqBOn1Q-1; Thu, 01 Feb 2024 21:57:08 -0500 X-MC-Unique: DpsQMxLPPnu5XY_HqBOn1Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 F24672825BA8; Fri, 2 Feb 2024 02:57:07 +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 D8E30C1D36C; Fri, 2 Feb 2024 02:57:07 +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 v4 3/5] KVM: selftests: aarch64: Fix the buggy [enable|disable]_counter Date: Thu, 1 Feb 2024 21:56:52 -0500 Message-Id: <20240202025659.5065-4-shahuang@redhat.com> In-Reply-To: <20240202025659.5065-1-shahuang@redhat.com> References: <20240202025659.5065-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.8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789754291230177488 X-GMAIL-MSGID: 1789754291230177488 |
Series |
KVM: selftests: aarch64: Introduce pmu_event_filter_test
|
|
Commit Message
Shaoqin Huang
Feb. 2, 2024, 2:56 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. Signed-off-by: Shaoqin Huang <shahuang@redhat.com> Reviewed-by: Eric Auger <eric.auger@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 f78c93a08bff..92715021f892 100644 --- a/tools/testing/selftests/kvm/include/aarch64/vpmu.h +++ b/tools/testing/selftests/kvm/include/aarch64/vpmu.h @@ -77,17 +77,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(); }