From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 CFE163E5EF3; Tue, 30 Jun 2026 09:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782810584; cv=none; b=LUmOoBEL3iKFSkhXyItfcmeDmpQljE54QvfNNwtQXHgqZGhENurZHIbjH9g2mndLjUb9x7fb6OjR08ql2mXiqo+Tc0oeOYJke+dfKLjaPUFJEGiSIQZj6bOvXYS6lSXOJkKmkO4hANZyK1wOamgRc7IEjnIMzT0WARw3OP4MKNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782810584; c=relaxed/simple; bh=+baHYKwTjxTk5imsrjd5D8+6DidKHphkkiyXZ9R5Sgo=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=XNGHDyfvtT0fGnvSTs957Ie2DOhpDzzNs5p7YLj5G9IArUuVzZovZHaHGbIPo7E3iz8HmGfO6/9eNHdGjn99nL0+RpXTVEgAx6WZZHfdXZsiVpVqhLHyVbzVNJd9GEOji7/lhr3l+J9tqNdJnVdd0rlbdgZ9T8mwB3uvOHnJNp8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QOGDKMZK; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sxdK8TL4; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QOGDKMZK"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sxdK8TL4" Date: Tue, 30 Jun 2026 09:09:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1782810577; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Njw/FrcDue+I1tCWUKjI/Y6U2aBKtQCIG9DXCzfvb1g=; b=QOGDKMZKr4GpKhpG0Cm3vtKms1pXYmSqQf5VtFPpRETK7T0zwNNusoJD6bRUAhSzmwbQR1 xje55AirbU248R4JECrIu6SPG63BC2JocJUZGI5P9VtJOXg/vHmDdwiGCk5BVFdrTMBisV buSMMmm4ckR5V90R+qXZs3/gBrE7j119J1ecZvlTefdmqn/HPEN8lvljzP8GIDNKvjidsi TbHs8D0WcVmyaM9e62tB1IJZAzTMN9JqyrJ6BHMu3c57zQ4MWHMyncyn89rhUoqcWXRmag +bodAQ6eq1Pn6cA2gW1RlTPXVg2QUchi4VCKalR+IxesiC2NzaVyZoEyYbQo1w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1782810577; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Njw/FrcDue+I1tCWUKjI/Y6U2aBKtQCIG9DXCzfvb1g=; b=sxdK8TL47USp4GM2Wp4skHC6oRC+Iq497PpWETLCY5xy56EJLK29Otsq4qIkiyNtF5DNWJ rUNLRbnA2+9rKSBA== From: "tip-bot2 for Dapeng Mi" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86/intel: Fallback to sw branch type decoding if no hw decoding Cc: Dapeng Mi , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260612090114.3188886-4-dapeng1.mi@linux.intel.com> References: <20260612090114.3188886-4-dapeng1.mi@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178281057604.3843924.16032744879655413527.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the perf/core branch of tip: Commit-ID: d8b3ee29a7e4aa00805aae8d6be329912d05bd5e Gitweb: https://git.kernel.org/tip/d8b3ee29a7e4aa00805aae8d6be329912d0= 5bd5e Author: Dapeng Mi AuthorDate: Fri, 12 Jun 2026 17:01:09 +08:00 Committer: Peter Zijlstra CommitterDate: Tue, 30 Jun 2026 10:57:06 +02:00 perf/x86/intel: Fallback to sw branch type decoding if no hw decoding intel_pmu_lbr_filter() currently assumes arch-LBR provides hardware branch-type decoding and skips software decoding on that path. However, arch-LBR may not always expose branch-type information. In that case, treating entries as hardware-decoded can misclassify sampled branches (for example, defaulting to JCC), which breaks branch-type filtering results. Fix this by using software branch-type decoding when hardware branch-type decoding is unavailable (that is, when x86_lbr_type is not enabled). This keeps branch classification and filtering behavior correct across arch-LBR configurations. Since x86_lbr_type is only set to true when arch-LBR is supported, it's unnecessary to check if the CPU has the arch-LBR feature. Signed-off-by: Dapeng Mi Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260612090114.3188886-4-dapeng1.mi@linux.inte= l.com --- arch/x86/events/intel/lbr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c index cae2e02..688d1df 100644 --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c @@ -1232,7 +1232,7 @@ intel_pmu_lbr_filter(struct cpu_hw_events *cpuc) * Doesn't support OTHER_BRANCH decoding for now. * OTHER_BRANCH branch type still rely on software decoding. */ - if (static_cpu_has(X86_FEATURE_ARCH_LBR) && + if (static_branch_likely(&x86_lbr_type) && type <=3D ARCH_LBR_BR_TYPE_KNOWN_MAX) { to_plm =3D kernel_ip(to) ? X86_BR_KERNEL : X86_BR_USER; type =3D arch_lbr_br_type_map[type] | to_plm;