Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2826889lqz; Wed, 3 Apr 2024 09:36:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqiMt+VpdEk90r6l4OMubqY0KzduCgyXsqd/YQqU5MfMP0dG5VLhijJAJY1i1UwLwcQInhLLmadLqMZ0vRuJKMFo7+46IvmH/esXx+qA== X-Google-Smtp-Source: AGHT+IFzTYGyfQOnfuE+xYmj8YGzieavBOO4WghHU8UdUCZ/q2Mix/dMQpnIRQ82mksroYIsYRL5 X-Received: by 2002:a05:6a20:6a12:b0:1a3:6464:1154 with SMTP id p18-20020a056a206a1200b001a364641154mr290374pzk.0.1712162180900; Wed, 03 Apr 2024 09:36:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712162180; cv=pass; d=google.com; s=arc-20160816; b=Zm4tXzhXqTYWM6Ui7UNM7o1ANk7VXnrS6DP7uartmb7tgDYtwLLHgy0W+3Ci0kKrYM 74ubSCirqUH9fd/0SEWhFOErxaHCnqhYdK1mwX3SWw7tkG0tqvGZgHuAaan3uM+9Kle0 nvBlQly4Z/8tsf+yHoRo6ygDnulLICro5qVoT9LCm2UdqdvABBXALyJGYULyRAcFOurx A7KnPWvAqLCPn9TxLiQqVkRQVwSPQZFaQsP+O4gHMxzK3LcRQFEmJGMZQqOfi25tEHuh Kqsl7mF4yMb2rq81re1kVTsAHEJ03EmNTxHLxlmMEclw1OYo2Xzkvhqqw1d6XKdB2v+H lWlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=pTovBIMigzMxozJjoOLniaoDgNINuOLPvVuUktpfkdo=; fh=WE2Q+oitVr3DrPs5OYEkhBtnZkhQ35ZF1WrJJi/jtHg=; b=dywmj0HmidJ7YUME4PTFr2GK0hflNk4fL7CUUkzK2T+wsNRAbxxrBuKs19FFyb3F0l RuSY8wSO9dktarNERNIOuGeYhjMA7+k1o2p07b18tP8lkw5jnUW84IKSpuanIV9RpuMO El4cTTN9IbyVrj9EFDMKwbKhi90BBHhFRmrgqW0Ll/jJAIGbKjyXYdM2R4M7iiFlL2Dm vy05j9E6RNhBP2GReDAStG2ZT9PE+ilJlvfoDV6CRMdFzyEpSHipidg3PXx9iwaDxjoi B/oPO/LeEwKwHd9RNo3fgcMyFR7I2QEtjJh8Z/tGUQ2oqfg4drKRJCqUGtnLY+Lqp7FT tZgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=U9brMdbB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-130170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130170-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 1-20020a056a00072100b006eac5d08f88si13284329pfm.140.2024.04.03.09.36.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=U9brMdbB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-130170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130170-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 10EACB2C92E for ; Wed, 3 Apr 2024 16:08:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8B6E14D45F; Wed, 3 Apr 2024 16:08:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U9brMdbB" Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94B0714D285; Wed, 3 Apr 2024 16:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160500; cv=none; b=LJ63jxwd6v7b91oK5e2beD6hPnhpkY5tkQu46GclVuukL0epkiIFmKvTylzCxdbdcwuCly3LAXR8DVY5RAbaFrIS4kU/NeMHO8DlnBwFAJed4A2vrNhMDMn0SpygDkkZUZPMl26JPnKEGszXFvN/Id13bPgTwyj3v+UQgbK23z0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160500; c=relaxed/simple; bh=IqjH8ZsjjXcHWdkBguAM3YqmROLjZcQ6NsU/4jQD6gI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UO7imUCjOZlmWg96t14mzS+4VduDLWLA4YRS5EVmhSrkdcLiPW1Sh1ZaWBvZVdaCIE7mWXkF2LkzoMHDiwhP7vrQaeeBkUJR0qqoOGUYgSMpWSwsotMSRq3p3G8RdE+a46X9VG9n1XOdrS+hSOhFVxklVOR6gw7+lmUwKDVuGmM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U9brMdbB; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1e0878b76f3so9670575ad.0; Wed, 03 Apr 2024 09:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160498; x=1712765298; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pTovBIMigzMxozJjoOLniaoDgNINuOLPvVuUktpfkdo=; b=U9brMdbBtIpFXuAaUAzc+xfDhWzerujWt1V6vRfsReSSk1ANA98VfSShwTOVft7ecw ghC2B7pvRnBGwaBra4zHDiu5LI3SOExtHvrZGAF9ZQmflcX/J2YJ8PgYfI4vTP6C/O4O f/fYnHQqcHh22VUoFcLPHDkavJE5BOAJ5el37NbvXeSJb16GWnp1s+XdwObb+hcR0Qo5 3s+gosQSM9Ey33hY+0qoo/X5osJRU3SqLBlRTV/Uj2Z/rNQPxf7tVkL3Lc5nzH1k1E+a 0zApEGli8c/MpjFn9IMTxAYqtJbQMs1JjGw9Dnqle1eh1j03OTaHFX/jefMxOJtSrPIB NI4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160498; x=1712765298; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pTovBIMigzMxozJjoOLniaoDgNINuOLPvVuUktpfkdo=; b=ovAUfql9dmP95LyTTOI3Ghd+/RfhisAtKsw6irWO4wts7Etyra4bIl+9flwd18m1XH kFDW2GGkwBjJ0ctWfLZvotfm9h4vJQsZivDd4hEwrTQEEAQ2ZwQE0Zi25V+5WRyqXy48 P9gQ3TfCQgppS3cNkMdKmqxxyXMYzzFxzvQLdpOFG8/XvB3Nzt5iTyDTMcCafM3eKH+C OYH57cfggzqNttKhbuasUw2Vrusil2e5/IyP02QyeZ0pzGVF3cq0GSUYGfpwOdgGaJKn a56x/KSX8UK7gEd1dcZDygXx/+j7LDM1N74/2D5coACsNqpPjlqJUBDV0PkEAVCHgmSJ jmUQ== X-Forwarded-Encrypted: i=1; AJvYcCVj98e6jIW8VjsTT8yZXz0mha2KK7ejkqq6s6KyvNf4QDI6ykdeiwBIo28NaSA2Pg/QjonI6QFwRDFhLRCVbBoUh4zlaxksHXFPxb5DNHj3TpNKOWmrgwg34Nc1CDHS3y46 X-Gm-Message-State: AOJu0YwapkgQ9yx2qIcpFYxoxX5Gc2tplHzLnel839eiseMDQJpV91oc /Ur2ICrbgRc/ioxoGjCs9QnwHMrHLordqS4QpE4PuV8EQKGdF6ByBwzlAICrpRpvDvnfYg9UYdl gVtYa7gOFHmP8MqE/z4gkgejLnifFVTDp X-Received: by 2002:a17:903:32c8:b0:1e0:b628:a752 with SMTP id i8-20020a17090332c800b001e0b628a752mr4121467plr.7.1712160497829; Wed, 03 Apr 2024 09:08:17 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240331041830.2806741-1-andrii@kernel.org> In-Reply-To: From: Andrii Nakryiko Date: Wed, 3 Apr 2024 09:08:05 -0700 Message-ID: Subject: Re: [PATCH v4 0/4] perf/x86/amd: add LBR capture support outside of hardware events To: Ingo Molnar Cc: Andrii Nakryiko , x86@kernel.org, peterz@infradead.org, mingo@redhat.com, tglx@linutronix.de, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, jolsa@kernel.org, song@kernel.org, kernel-team@meta.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 3, 2024 at 1:06=E2=80=AFAM Ingo Molnar wrote= : > > > * Andrii Nakryiko wrote: > > > On Mon, Apr 1, 2024 at 2:30=E2=80=AFAM Ingo Molnar w= rote: > > > > > > > > > * Andrii Nakryiko wrote: > > > > > > > Add AMD-specific implementation of perf_snapshot_branch_stack stati= c call that > > > > allows LBR capture from arbitrary points in the kernel. This is uti= lized by > > > > BPF programs. See patch #3 for all the details. > > > > > > > > Patches #1 and #2 are preparatory steps to ensure LBR freezing is c= ompletely > > > > inlined and have no branches, to minimize LBR snapshot contaminatio= n. > > > > > > > > Patch #4 removes an artificial restriction on perf events with LBR = enabled. > > > > > > > > Andrii Nakryiko (4): > > > > perf/x86/amd: ensure amd_pmu_core_disable_all() is always inlined > > > > perf/x86/amd: avoid taking branches before disabling LBR > > > > perf/x86/amd: support capturing LBR from software events > > > > perf/x86/amd: don't reject non-sampling events with configured LB= R > > > > > > > > arch/x86/events/amd/core.c | 37 ++++++++++++++++++++++++++++++++= +++- > > > > arch/x86/events/amd/lbr.c | 11 +---------- > > > > arch/x86/events/perf_event.h | 11 +++++++++++ > > > > 3 files changed, 48 insertions(+), 11 deletions(-) > > > > > > So there's a new conflict with patch #2, probably due to interaction > > > with this recent fix that is now upstream: > > > > > > 598c2fafc06f ("perf/x86/amd/lbr: Use freeze based on availability"= ) > > > > > > I don't think it should change the logic of the snapshot feature > > > materially, X86_FEATURE_AMD_LBR_PMC_FREEZE should be orthogonal to it= , > > > as the LBR snapshot isn't taken from a PMI. > > > > > > > Yep, seems like there was a parallel change to related code in > > perf/urgent branch. And yes, you are right that it's orthogonal and > > doesn't regress anything as far as branching and whatnot (just > > retested everything on real hardware). So I've rebased my patches on > > top of perf/urgent, will send v5 momentarily. > > Thank you - it's now all in tip:perf/core and lined up for v6.10. Great, thank you! > > > Sorry for an extra round on this. > > Not your doing really - just crossing patches. > > Thanks, > > Ingo