From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 0BD5945C6FA; Tue, 11 Aug 2026 17:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786469644; cv=none; b=fF7Y7Y+VxoFnyycUv2LlB7gnEFn4gVmjaQwVEfjA8Ig8xX9fxWpMIY2Uu7yVOHksNuNkA3WnFlchjWd0H/vSj7seJX98hxx/xoWsWZF/TaU1ZU2p9jev8mAsnTU1EOFKuH3hS193RwZrmKcjN7w+6rtRJP/0NAaVOx2zj1jO61k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786469644; c=relaxed/simple; bh=YPtScEkaIh0cMaZGSYZbdtdCeqct0TIk/DenrQyxmLY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UoGMnXJIXU7pkpEZgZY/MHvWU5aV1CU7WVAtSRDlre3jJvILRKo4Kyjxagozncbx6iak1EYRkhzg7OlYMhG/kR+yVSBPuabfFCzugrl6exbE9kOiw4Q/vp005dj3dOyOMzct4lZyWkT6BMXVxniaEq8HciTpobUkoJdSPbm9fZ4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JAzO602r; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JAzO602r" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1786469643; x=1818005643; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YPtScEkaIh0cMaZGSYZbdtdCeqct0TIk/DenrQyxmLY=; b=JAzO602rOWD8SBJyeXdqCnxl820OYPNn4V8a2ojjM/WkLhItdzN6iYle /XLe1lNyUFWGYp3z4Fo3SnQsaA6PgA4XIio00KGov4T1nBiL+AS0itrB/ l5wN1isXZJF91YgRfgj33J8gYNILR2xuVl7tuwj2GG+rflxUlL29dpBpB wSA309+IobrYledOv1x7tW3ALCRyNbN8qAhalt/VUl40o7Uj+dLBfFfsH 2C+Vt0IAbCFsZoQp9g50SXmjf4THZfO5ZPFOtzodGDIxvpztK0cgotLib z9L0lv5nb5QCssv3o3Aw+IMWJGm+fjdD6dgNPiNdBvF9wlai3CUmRaY2o w==; X-CSE-ConnectionGUID: iegJqvCnR5KXyX09dqkfjw== X-CSE-MsgGUID: 2VlXkw8fTVys84YvIiFieg== X-IronPort-AV: E=McAfee;i="6800,10657,11872"; a="86863250" X-IronPort-AV: E=Sophos;i="6.25,218,1779174000"; d="scan'208";a="86863250" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2026 10:34:03 -0700 X-CSE-ConnectionGUID: R01hN7X/QSCI7ks6cS3bVw== X-CSE-MsgGUID: SDmncw4aQHi9Cuy1e0pYmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,218,1779174000"; d="scan'208";a="261648111" Received: from hanvin-mobl3.amr.corp.intel.com (HELO tfalcon-desk.intel.com) ([10.124.223.16]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2026 10:34:01 -0700 From: Thomas Falcon To: Namhyung Kim Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Dapeng Mi Subject: [PATCH v4 6/6] perf c2c: print memory region data with stdio output Date: Tue, 11 Aug 2026 12:33:40 -0500 Message-ID: <20260811173340.96013-7-thomas.falcon@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260811173340.96013-1-thomas.falcon@intel.com> References: <20260811173340.96013-1-thomas.falcon@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Print memory range data in perf-c2c subcommand. Only available in stdio mode currently. If memory ranges are not supported or present, print nothing. Example output of perf c2c report --stdio: ================================================= Memory Ranges ================================================= Range 0: [0x0000000000000000-0x00000000bfffffff] Node 0, local region id 0, remote region id 255 Range 1: [0x0000000100000000-0x000000203fffffff] Node 0, local region id 0, remote region id 255 Range 2: [0x0000008000000000-0x0000027fffffffff] Node -2, local region id 1, remote region id 255 Range 3: [0x0000028000000000-0x0000047fffffffff] Node -2, local region id 1, remote region id 255 Range 4: [0x0000048000000000-0x000004ffffffffff] Node -2, local region id 1, remote region id 255 Assisted-by: Sashiko:gemini-3.1-pro-preview Signed-off-by: Thomas Falcon --- v3: Included examples of memory range output in commit message --- tools/perf/builtin-c2c.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 8cd90524fe49..7739023ced41 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -2635,6 +2635,34 @@ static void print_c2c_info(FILE *out, struct perf_session *session) fprintf(out, " Cacheline data grouping : %s\n", c2c.cl_sort); } + +static void print_memory_ranges_info(FILE *out, struct perf_session *session) +{ + struct perf_env *env = perf_session__env(session); + int nr_ranges = 0; + + if (!perf_header__has_feat(&session->header, HEADER_MEMORY_RANGES)) + return; + nr_ranges = env->nr_memory_ranges; + if (nr_ranges == 0) { + pr_debug("No memory ranges found, skipping\n"); + return; + } + + fprintf(out, "\n"); + fprintf(out, "=================================================\n"); + fprintf(out, " Memory Ranges \n"); + fprintf(out, "=================================================\n"); + + for (int i = 0; i < nr_ranges; i++) { + struct memory_range *r = &env->memory_ranges[i]; + + fprintf(out, "Range %d: [0x%016" PRIx64 "-0x%016" PRIx64 "] Node %d, local region id %u, remote region id %u\n", + i, r->base, r->base + r->length - 1, r->node, + r->local_region_id, r->remote_region_id); + } +} + static void perf_c2c__hists_fprintf(FILE *out, struct perf_session *session) { setup_pager(); @@ -2648,6 +2676,8 @@ static void perf_c2c__hists_fprintf(FILE *out, struct perf_session *session) if (c2c.stats_only) return; + print_memory_ranges_info(out, session); + fprintf(out, "\n"); fprintf(out, "=================================================\n"); fprintf(out, " Shared Data Cache Line Table \n"); -- 2.55.0