From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 5A3BC3839B8; Mon, 31 Aug 2026 20:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788209203; cv=none; b=aIwR9tyBJ6cXUNBowIOwbqW91cBxmxDS0MLEqN2liUvpJbPo33L+M2K1sbzX9usO6v14fCz5x1nr3U0qKnAWM98e6Pzzh9YLThW8uXW4g+TFkGYoyfMC++IqoXTU4KScvkQYBjvuSCs+ycp1ayNrXAUvA8fipQTDoIdovfcwy/c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788209203; c=relaxed/simple; bh=SKyIGI+/c7WaxikI+kavIQjsJX93KrmQegyf3BWOd/c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JoWD1YK0e4eE8+C6TgcqR8vJxDucHsBVTmCEhEpeWiu2AsuKCCmN5AwBv+0nmrfdxEtV6AxF3VYvq6BPDlsqRvnrCMua0b1ySjjL3qvDs9ps1mI4bQNSJWfB7ckn4us5prre5tH+OCVY+qVbJE+VASyd+e5aCYkVYnQDKhOsqRc= 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=FQRb238z; arc=none smtp.client-ip=192.198.163.8 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="FQRb238z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1788209201; x=1819745201; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SKyIGI+/c7WaxikI+kavIQjsJX93KrmQegyf3BWOd/c=; b=FQRb238zB+oiNX0HcbytUu8Qh5xxhDYnKhQ5iYNe4SZXRb9mwQ9dVyUq NsPZ3w9j8tg9r0db/bBXFw/WThyFFlwAbBdopmmtFvoRDOzSGSwYpUXUe JigIM4IvnGIEs6POLh6U1HDsJ10sDz1+wL5k2ZPKAIXL9cIxcd0vpOOPE dOlaIcQx/lq1ZJNZg8FKMdoXShOV6EbJR2ydXhY6+AkbOM5OXXEcB0E0l 95Eyv36s4MwMgEEEMgXVk/cTx7uU9kYxyLuuihyYa4kBAdXKB7NijN5EU TMkPMuN9pd+1LuEGhQroQU/BFDkACq1vgv439ASsTP5yHKObO8T+RgV55 g==; X-CSE-ConnectionGUID: o6DasfNtTzmz897ruZp3qw== X-CSE-MsgGUID: qmJnu6ZhQJu37QHOq8YwUw== X-IronPort-AV: E=McAfee;i="6800,10657,11892"; a="106147334" X-IronPort-AV: E=Sophos;i="6.25,254,1779174000"; d="scan'208";a="106147334" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2026 13:46:40 -0700 X-CSE-ConnectionGUID: /AebtKHlSXqqKwN4c7TbBg== X-CSE-MsgGUID: iybHK4w2RDCCoWFU+fEqOA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,254,1779174000"; d="scan'208";a="268346046" Received: from aschofie-mobl2.amr.corp.intel.com (HELO tfalcon-desk.intel.com) ([10.124.220.28]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2026 13:46:39 -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 v6 6/6] perf c2c: print memory region data with stdio output Date: Mon, 31 Aug 2026 15:46:13 -0500 Message-ID: <20260831204613.2793526-7-thomas.falcon@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260831204613.2793526-1-thomas.falcon@intel.com> References: <20260831204613.2793526-1-thomas.falcon@intel.com> Precedence: bulk X-Mailing-List: linux-perf-users@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 Reviewed-by: Ian Rogers 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 c877b5056da0..da669136e545 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -2580,6 +2580,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(); @@ -2593,6 +2621,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.43.0