From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (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 D54172F6590 for ; Tue, 18 Nov 2025 21:13:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763500434; cv=none; b=F+Yzpa3qTVZvWiSd7CZDqm77/q4ACsI+lOq8Pdwogtniplr4tSVAlEJPz83aLiPxt/P113lPaIXacEErAhwIy4a1evqMb4Bqrwd9qeOy6iUCylMTex2FMToarMpeW5nbzO7CACh8s0+USy7h97E3isx9oBkADULh9jhS5kXWRQk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763500434; c=relaxed/simple; bh=hlSfsa/tOevvA5hMzSWStS7nnWQy5iRlXi6rOAcZr14=; h=Date:Mime-Version:Message-ID:Subject:From:To:Content-Type; b=jyjZlo0MKyJ4cFuWut7tCC0k5OPq3SYYh9JNXuXTwcahGnP8DPMkQRVvAZXEpTWyHrxRm7k4t9s4DCKvK7YorJ9AHqyoUgwoLxvDU+E5yFumGl3HNFiB4S5Ie72nmzOxMjfuJkIPvbJY6IaDRKeinvfi68lgT+qPtUhKAha4rJY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ukenp3VB; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ukenp3VB" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-b969f3f5bb1so12992288a12.0 for ; Tue, 18 Nov 2025 13:13:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763500432; x=1764105232; darn=vger.kernel.org; h=to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=2UvhAqv6SeUijjxk0hkcR4/ai/hO70N40/Ki8qgJXPU=; b=ukenp3VBcCdE9iJV0uOdFySyf9eBgN9V/kEGThD7OqcvVD/nR6WmrMxQ74zAIxKdSz tZbp4lYQXRQYzUPNx41kfFK0XtvpmD4x+oxv+fqsrtHv4T7q7pR5GUNeBB72AfxAQKiA R0jmRUn74mNclKL2ayKxFeKBtEduRk55dAZtRk1JFQlQ2BkUjjTpU+kvPuwDhjVS5CDt 0TA1AddU2Cy0RIVNQAyr+kN52DeZxk/CBS/O0JvBxkczijMq10i2PMUipjgxcwJOSKjt CZk27+tUNRZvXZoZV6hB+kM3eCWUHEIqZOTqAUhVWWs2WaTas8V9BJuK68fykHCA+zFU mwTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763500432; x=1764105232; h=to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2UvhAqv6SeUijjxk0hkcR4/ai/hO70N40/Ki8qgJXPU=; b=h1QgvtZJK3W1A0y70osKc6W0VR9r0wCMZrio941C9ArA1Fs8LaNXEWZL9UQoBMwnkC N+/1vrE7w9om7ecwfPh5Tf7Iuy+ATZNJOpMoKQtChgV8g4o3d4rmzvv00yPa5ZgfQQQT Ry6cFbuZGch9HZFqu+Xx/hcfVPqdRupIp3GKQlbvqKicTFYrFvlZQURrWOXpjutsz3gd DwI/i2bAHhKmmSTokttuX1Qg7o5e5hOtz/Hb0E8kAhWsCZCriogke2D69ygcTAuaTXHN CbOP7RM4XGVrIobNZWfhuNrzO9tZE6b7Sl2pZtVkIVoMEjSAA1HaVafIISpL9G/8VSyO WdQg== X-Forwarded-Encrypted: i=1; AJvYcCVJwbm/9/1FEoTfp8ioxWVrbETrGHPfsG82XPe1qvkSiABkhsWBsRzm7tAVi5udKz15FRzIkegEBxjSXZs=@vger.kernel.org X-Gm-Message-State: AOJu0YyGN9WTVezdDwIH9WVk5a67Q2b6FNsi1zppN4aNPFjzCHLpGC9I QhI7+wNGHmGRUoslUC3i8NiyZXFSU9oU4l65Mp+VoBfP4o7c7U0LwHBroZvjyPb9tS+sqFQU8Dl /dCySiJVxYg== X-Google-Smtp-Source: AGHT+IHQSZQd/THE8WOoCX6uKoXlWiBH/GQF2t0yujqxl/1SqlYkLZvtsUudFdX1tXyItk5AtszUMyPZYGJ7 X-Received: from dlbcm21.prod.google.com ([2002:a05:7022:6895:b0:119:78ff:fe10]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:604:b0:11b:9386:826a with SMTP id a92af1059eb24-11b93868475mr5733402c88.47.1763500431993; Tue, 18 Nov 2025 13:13:51 -0800 (PST) Date: Tue, 18 Nov 2025 13:13:23 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog Message-ID: <20251118211326.1840989-1-irogers@google.com> Subject: [PATCH v5 0/3] perf stat affinity changes From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Dr. David Alan Gilbert" , Yang Li , James Clark , Thomas Falcon , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Kleen , Dapeng Mi Content-Type: text/plain; charset="UTF-8" The remnants of: https://lore.kernel.org/lkml/20251113180517.44096-1-irogers@google.com/ Read tool events last so that counts shouldn't exceed theoretic maximums. Change how affinities work with evlist__for_each_cpu. Move the affinity code into the iterator to simplify setting it up. Detect when affinities will and won't be profitable, for example a tool event and a regular perf event (or read group) may face less delay from a single IPI for the event read than from a call to sched_setaffinity. Add a --no-affinity flag to perf stat to allow affinities to be disabled. v5: Drop merged changes. Move tool event reading to first patch. Change --no-affinity flag to --affinity/--no-affinity flag. v4: Rebase. Add patch to reduce scope of walltime_nsec_stats now that the legacy metric code is no more. Minor tweak to the ru_stats clean up. https://lore.kernel.org/lkml/20251113180517.44096-1-irogers@google.com/ v3: Add affinity clean ups and read tool events last. https://lore.kernel.org/lkml/20251106071241.141234-1-irogers@google.com/ v2: Fixed an aggregation index issue: https://lore.kernel.org/lkml/20251104234148.3103176-2-irogers@google.com/ v1: https://lore.kernel.org/lkml/20251104053449.1208800-1-irogers@google.com/ Ian Rogers (3): perf stat: Read tool events last perf evlist: Reduce affinity use and move into iterator, fix no affinity perf stat: Add no-affinity flag tools/perf/Documentation/perf-stat.txt | 4 + tools/perf/builtin-stat.c | 159 ++++++++++++++----------- tools/perf/util/evlist.c | 156 ++++++++++++++---------- tools/perf/util/evlist.h | 27 +++-- tools/perf/util/pmu.c | 12 ++ tools/perf/util/pmu.h | 1 + 6 files changed, 222 insertions(+), 137 deletions(-) -- 2.52.0.rc1.455.g30608eb744-goog