From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.9 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796086005; b=kQZAMA2FghhCiYWjWGVwT25WzZ6ehUqDGawcvrmcDX6j7+AoHhAZzKKxCDwKvYIQ0I8A 0Qpg02/D3ue8wz0n63P4g4suNDHMuPb7VN1nAUO17QsUeukhkeq2p9uBzsiCeY2TIcrK2 QGV4bhSX+kxuqcePeXVnHMgu8ALpiXEK3/mJUR0pm8CxwIaPKxCUfsKaTDHeokp4PGrGY hkcCyzIz2UHf4PHf6dOukmjKfO5mmyy/y0X6xiFZARHvtsfj0hYDAQ/8ui8BoEd7BsjrV bKoVEXgIJ2oBoqxTspPhG8gJuLUnxabERKAO+BKI4c7ONMcD1Kns7U63v7Np9xYL98w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796086005; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Cc:Subject: Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=XpmmW7C1JzQXUAYxec9lEKBEyNM86GHihI2o8KJ159g=; b=dFyuwXJms7KT606lt9ecjksNY/wWezdzlbgQxUvz2Un8p2mDsVlRQ4w/LSUx/7s5jWU2 jdEP98HBUC9Jy1zUqFjY3wUYuMsEQTZL0idkjr5K1DSRoCnbLIQQqZAM7iWvRtW6PldCl 05FzvSwcPWSgFnLvgRc8+ILKYMI0Kvi9rytr6Md465uDzuhhJyUaxRmX5TdRzOImfcNTW KC0qQLKO6OvQN+nfjfVhd6fDS61qei5wjPA0piPAwwIEK4QauZLaSjQq7UD9/+A4KDxb2 IhV41hDRSud32XZ+nu6ycW9/+NtQJiGz7xUBMntjHPcrhW9/JKvAFaQZ84tQ+fJXaeQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=UJPiZNVA; arc=none smtp.remote-ip=198.175.65.9 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AC8C606A325; Tue, 1 Dec 2026 00:46:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7AC8C606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=UJPiZNVA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796086006; x=1827622006; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XpmmW7C1JzQXUAYxec9lEKBEyNM86GHihI2o8KJ159g=; b=UJPiZNVA//BgI0jMp7Qyq2KzKyyMO6egQQGnvAUB587ZlBXqHulxZG0x qyYkLwqEt1e5Bk6Ew+clbwjIvu4lk2qGgpt8l3OYOSJuTG2VgY0JHv42c qfZFEjZvLRKigYtfmfUBBYOZnwiFBIbzBMmtCKz0yIwx5Xacjp3KF+M12 5puop5Pl1t4gkFGYXdKd0uAzaZK+gUq+ZrmR64IoGUfpl5+cNkCb6S/7a QhstWaHCBefgc3Zvj6CjiRbg3kOpBSe93deiwehBjTkoW9mlF+mJhFd0y rC2XPy5WQ2Zd7hXieZrW/YlBNnhACxQy1owOm1+8ylowjDMU2EK8EbokL A==; X-CSE-ConnectionGUID: EnPRhPFXRvOYRzNpgPISuA== X-CSE-MsgGUID: 7iDxeAiNSoS1G0WBJPLGNg== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4846066" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4846066" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 16:46:46 -0800 X-CSE-ConnectionGUID: sldrsOxYQSu88r9p5/Xkww== X-CSE-MsgGUID: GfUIk7efRbKauSASdjenhw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="13678878" Received: from spr.sh.intel.com ([10.112.229.196]) by fmviesa010.fm.intel.com with ESMTP; 30 Nov 2026 16:46:39 -0800 From: Dapeng Mi To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Ian Rogers , Adrian Hunter , Alexander Shishkin , Andi Kleen , Eranian Stephane Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Dapeng Mi , Zide Chen , Falcon Thomas , Xudong Hao , Dapeng Mi Subject: [Patch v2 14/16] perf/x86/intel: Only program ACR reload value for events with config2 Date: Tue, 1 Dec 2026 08:37:06 +0800 Message-Id: <20261201003708.1806748-15-dapeng1.mi@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261201003708.1806748-1-dapeng1.mi@linux.intel.com> References: <20261201003708.1806748-1-dapeng1.mi@linux.intel.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit An ACR (Auto-Counter Reload) event requires its auto-reload value to be programmed into the matching *_CFG_C MSR. This configuration is supplied by the user via the event attribute's 'config2' field. Currently, intel_pmu_enable_event_ext() unconditionally programs the *_CFG_C MSR reload value for any event residing in an ACR event group, without validating if 'config2' is actually configured. However, a counting event with a zero 'config2' field can still reside within an ACR event group; such an event should not have a reload value written to the *_CFG_C reload field. Enhance this check by ensuring that the RELOAD bits are only set and programmed when the event belongs to an ACR group and 'config2' is non-zero. This maintains consistency with intel_pmu_enable_acr() and prevents erroneously setting up the auto-reload configuration for events that were not explicitly requested to auto-reload. Fixes: 5c3cdc74af25 ("perf/x86/intel: Consolidate MSR_IA32_PERF_CFG_C tracking") Signed-off-by: Dapeng Mi --- arch/x86/events/intel/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 6d1038186197..9906eaaef49c 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3476,7 +3476,7 @@ static void intel_pmu_enable_event_ext(struct perf_event *event) struct hw_perf_event *hwc = &event->hw; u64 ext = 0; - if (is_acr_event_group(event)) + if (is_acr_event_group(event) && event->attr.config2) ext |= (-hwc->sample_period) & ARCH_PEBS_RELOAD; if (event->attr.precise_ip) { -- 2.34.1