From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=198.175.65.14 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796079763; b=IcE0ZJda5tBLz9uz/acD3y9JtxyVcC92OJko/dz6iTHjuCpaBJdJYssA8vikQz4TWiK5 y2ylRTrNLYJ7blDiFYym9zUV49wq1p7ai+G2gGetUIWSj3UwVGpZfbqDKCx/F2qQkfTND FipxEAvXBj/oLlT5Mk1YK7fKGu/HN855ks6SSsX9S1BUJBwPBEuMUY+Nf64CTASednDuF 5MNKJUwu6DeI97rwNshlh0CXRMgsKz9tFeHe2XKqUZilr+ma44IpjQUcfKYZq5FYHeJ+3 R3svgtctnxzDYG6dz+hUAv51EpwDH6C+E5MuRfEZXRzNVReon6K8XHNPeM1q3O1QCtg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796079763; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Received: Received:Received:Received:Date:From:To:CC:Subject:Message-ID: References:Content-Type:Content-Disposition:Content-Transfer-Encoding: In-Reply-To:X-ClientProxiedBy:MIME-Version:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-LD-Processed:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-Exchange-RoutingPolicyChecked: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; bh=/YUVyXnODObdS9U63V9tYNDrT+0QR2oeRDDwAMKa56k=; b=ZFCjAcuHFqgIpp8fG6lbKItfkSUyY8MsHGg/U5qNBocjq+iHILFdLmhBn/MDget9dLQR b/tIhV0nbF+j8yhyu5pDBfP/4ABj7GD2jjrmXOGMmdPm5kyPI2A/qbgit1t1l627Ph803 BXZBbJ3sUp3z8rPNf6MbzomGELCZReZpWUOoQz6jv9t3KeEOAawWKxOwV/E6l5J33TFJD NXnR+//F13lxrdk9S+n7ru/ADugr091mGuznaIUdsLxX/xYkuhu8lpC7rzpLJ4dcRfEaV fdnjoQ0GwSQqNYuL27IHPI1qabXI81igqK6ZzQ867aAbiSvpWoNYwjCb3vEKXmAWeXg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="NGA/zMqr"; arc=fail smtp.remote-ip=198.175.65.14 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39C3E606A31A for ; Mon, 30 Nov 2026 23:02:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 39C3E606A31A 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.a=rsa-sha256 header.s=Intel header.b=NGA/zMqr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796079764; x=1827615764; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=/YUVyXnODObdS9U63V9tYNDrT+0QR2oeRDDwAMKa56k=; b=NGA/zMqrA/dh9sBLFysR2Cb3oCRFuTjONRi7TO7pbwz1KEbulu8hVQIq nQgfvLKBXkDwIYdvB6IKPG7u0/sRzkNIZBecq56IvxwzFSeqZmKhk2uBr 9Vt35aOlPPG/DLbZ6RWWA4LtFHixsy2S4rkfnQun4UzRvnJ5KjfuJsw1F PRe/hvDdKKp0cZByHZLACw5Ej51VBLx+07jrtJKSWvwTiDL2ylpCzaFFx PoFV9fPcr8CE9BqLHgbn8OLwkqYmBLCNyVacQxL9LYhP9dx9V2U33arWx 5J4j0bo9sGKgBGG36ROlJKSVzHjSsEIhBIsRskTKu9wAEuDn1xFlX2ef7 w==; X-CSE-ConnectionGUID: h/mEvLX6QZ6u/58PaRycVw== X-CSE-MsgGUID: pGMCM5NNTmOV3KiwwecU0Q== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4839912" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4839912" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 15:02:43 -0800 X-CSE-ConnectionGUID: yEleVF6/SNy8Sx6Wts8How== X-CSE-MsgGUID: TdRbiKLZTsi9szQYVcJPVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="12948139" Received: from fmsmsx903.amr.corp.intel.com ([10.18.126.92]) by orviesa003.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 15:02:43 -0800 Received: from FMSMSX902.amr.corp.intel.com (10.18.126.91) by fmsmsx903.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 15:02:42 -0800 Received: from fmsedg902.ED.cps.intel.com (10.1.192.144) by FMSMSX902.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Mon, 30 Nov 2026 15:02:42 -0800 Received: from BN8PR05CU002.outbound.protection.outlook.com (52.101.57.64) by edgegateway.intel.com (192.55.55.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 15:02:41 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iLG/Wwwax+EvrXTfLaWQOfbTcsRB0/QiuuGnLR24iFS0Gqlc+vsVDEmFZYd22AHU91tML8e2e/JfV5EvH65qsTk5J2go9qejIf13MfzzdLruwboqNnGoLJBHXE+NraA1vRTlmIprITeaQCQ3YlOSOFk/qljYldGGDxxLY8Xv618DmoqRbO6uR8QNjFHoeW+8bBEPTUtv24plPwl92enrZwCYoil0GLxPgZOuvNLfESzxuL9v9kpG6B+MDgNb1WgQG53o8DnKpxjrRIMh6O7jcHWbwU7ZBLpsFrqT4MhcfFB7b6G3zl0EOyyxHH+Hxlf+A2nHFu/ldwUcb7p49hXJ0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4Yvnm+uXXysj4i03Yrpc1aj7avhohoCKztcuuh4pRq8=; b=Cg+6/R45dzVBewj3OfAHim/YIhogmKUAJyIyfprRo/xPKdj5gXnJvqf6YGCBEVhLMLuyB83i9n8qhZfV/Ype8N5ALVDMunQfGYBuqM92i7C0jiyJnxCC96O2xOsTfgudtaOOsdL01Ktgs1r3fKwAzj5RZ/QMpcqqIE8lbfYnBHfGYG5R9tXRwMMeIlkQUrDuYBAbU1ydxflj6svvcuVF7Ke0PJANx0awdO+NPkXWP8tfE5okup7PB43fshdtVEbHREl+uixM3U6pd8tFmzK/IR99hDO0wd2KEQr6PYTNOw5atZHTxpGXNxKPKK93wxYegYcO9w0Cp/RJqUPT0qonSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MW3PR11MB4684.namprd11.prod.outlook.com (2603:10b6:303:5d::14) by BL3PR11MB6314.namprd11.prod.outlook.com (2603:10b6:208:3b1::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Mon, 30 Nov 2026 23:02:37 +0000 Received: from MW3PR11MB4684.namprd11.prod.outlook.com ([fe80::2f5a:96ce:f7e4:c315]) by MW3PR11MB4684.namprd11.prod.outlook.com ([fe80::2f5a:96ce:f7e4:c315%7]) with mapi id 15.21.0662.012; Mon, 30 Nov 2026 23:02:37 +0000 Date: Mon, 30 Nov 2026 15:02:29 -0800 From: Niranjana Vishwanathapura To: Matthew Brost CC: , , Carlos Santa , Ryan Neph , Christian Koenig , Huang Rui , Matthew Auld , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , , Thomas =?iso-8859-1?Q?Hellstr=F6m?= Subject: Re: [PATCH v3 21/33] drm/xe: Add defrag GT stats Message-ID: References: <20260711025619.2540575-1-matthew.brost@intel.com> <20260711025619.2540575-22-matthew.brost@intel.com> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: BY3PR04CA0012.namprd04.prod.outlook.com (2603:10b6:a03:217::17) To MW3PR11MB4684.namprd11.prod.outlook.com (2603:10b6:303:5d::14) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW3PR11MB4684:EE_|BL3PR11MB6314:EE_ X-MS-Office365-Filtering-Correlation-Id: 136fbe23-479b-4233-34fa-08df4f3606e2 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|23010399003|1800799024|7416014|376014|56012099006|261028144727099003|10067099003|261021135927099003|261102123227099003|261026121527099003|261021123027099003|261022105027099003|261022075727099003|261021121427099003|261026140227099003|261009223027099003|18002099003|22082099003|4143699003|11063799006; X-Microsoft-Antispam-Message-Info: mk6Edw3UGRjxBEvNCSSZq2xUhsIRC7ZawF/uVnc21/G5W8wkvVlbIkt2A0OdbnRaLi1OYqG8QXHRxuFuwdjk9nbKhroSjl6wQqwTgB8zGyVv/45mFZ1n4MC+liUrTJqZITmRBgA6EDnK3/t47k+l7oXWk8kEQR/a0tzvsghcEePzxtNLYn+pfyTKr9TkqR7hIYqA5aoDaGrE3sPMUQcaqgKQQMhsF543YTI9QpSnarkUXLEI5ufvplifPJVVLJLpRVxtCkFb2M3xtNNOJRdnDDeeGZTlkWGinnN5gZwr9+e9LxpWv+p7/wXP6RTAEkiqP2UnF60b88SUxX6cA8W7HDewfw0m3WlXJnh/P75MBWqtbl+Xqa+jkhphwAfgoHO4lH9Z3DK6f7QAnBWuc11USWZch/b6ihTNeyNM3BcRp3D1MS3jd2EF++SXe0QNV2pqgiluMrZqJPS0SwpxJTlEEsv1iC/j6wbkKnlNczjT2pNI/OcfQHQdqt10cDzSf6iC2ny5QUKH0eY5kKofZRjcAhpeXd7E8QCo8DgLXWhPvdweigioyrmpkwYLhj+2VYJbx24l5m5UpHdnCMFViXXEPXZL7WQrMYVOgWlqQlV16DVv1QFsXjTz/hP7gdI2PL17mfM/g0kfsxHe2zm1UKlxrQFCBrRnN5rHTu87C/ZQPm0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW3PR11MB4684.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(23010399003)(1800799024)(7416014)(376014)(56012099006)(261028144727099003)(10067099003)(261021135927099003)(261102123227099003)(261026121527099003)(261021123027099003)(261022105027099003)(261022075727099003)(261021121427099003)(261026140227099003)(261009223027099003)(18002099003)(22082099003)(4143699003)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?FVY+4uFEpwhZ+rU9P3k8zXoWe5Cq25tTeC3xkD8uR1ngG4mm2kcjr+Pep5?= =?iso-8859-1?Q?FZzZy7uQTCdrrKpB2MEZNmZiOcyzApP/cf9fmfx+wykX41rqz/cLYsCynB?= =?iso-8859-1?Q?5Es/MRefFJkndE8eeHxUP2XFWxHYthNfKcSL0eeq6SC8bm8p6A5Ejn4d3x?= =?iso-8859-1?Q?LPhfHZlaHXBRKoXu9JyjkmzuOnO2nzRsMvkXEcIstmzi3WWI8+xmzFGgCf?= =?iso-8859-1?Q?Xj8Y9f0ikIjJDNiu0fwjQ4kBOHNjYP3xUIsdw+ViHn1cj01KZA1A0z7vQY?= =?iso-8859-1?Q?WIwzWQmg5M+uFoOUMOE2dDQq/b+heEKLo92jaiXZFtnFmhra65itibQk5d?= =?iso-8859-1?Q?yaeqke+1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emw8nyElw== X-MS-Exchange-CrossTenant-Network-Message-Id: 136fbe23-479b-4233-34fa-08df4f3606e2 X-MS-Exchange-CrossTenant-AuthSource: MW3PR11MB4684.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 23:02:37.4236 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cDDs3EA97A61uj/QlU1gntMT8ZOfXoZyWIHf20oIwB1UKYC8bvUAnV7+l5Md9Ywpmb4UF7tenxaD0VBfJJ9dmSqnUn39t4j7FTyb4xWRIwYSl1BGhtlIratEQOMr+FBH X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR11MB6314 X-OriginatorOrg: intel.com On Tue, Nov 24, 2026 at 12:13:30PM -0800, Matthew Brost wrote: >On Sun, Nov 08, 2026 at 05:10:30PM -0800, Niranjana Vishwanathapura wrote: >> On Fri, Jul 10, 2026 at 07:56:07PM -0700, Matthew Brost wrote: >> > Add observability for the page defragmentation worker. >> > >> > Introduce four primary-GT statistics counters: defrag_added_count >> > (BOs queued onto the defrag list after being backed at a sub-optimal >> > page order), defrag_success_count (BOs fully re-backed at the beneficial >> > order), defrag_partial_success_count (BOs only partially re-backed at the >> > beneficial order) defrag_failed_count (attempts that failed and left the >> > BO on its original backing) and defrag_mb_moved. The >> > ineligible/already-removed fast path is intentionally not counted as >> > either success or failure. >> > >> > Cc: Carlos Santa >> > Cc: Ryan Neph >> > Cc: Christian Koenig >> > Cc: Huang Rui >> > Cc: Matthew Auld >> > Cc: Maarten Lankhorst >> > Cc: Maxime Ripard >> > Cc: Thomas Zimmermann >> > Cc: David Airlie >> > Cc: Simona Vetter >> > Cc: dri-devel@lists.freedesktop.org >> > Cc: linux-kernel@vger.kernel.org >> > Cc: Thomas Hellström >> > Assisted-by: GitHub_Copilot:claude-opus-4.8 >> > Signed-off-by: Matthew Brost >> > --- >> > drivers/gpu/drm/xe/xe_bo.c | 18 +++++++++++++++++- >> > drivers/gpu/drm/xe/xe_gt_stats.c | 5 +++++ >> > drivers/gpu/drm/xe/xe_gt_stats_types.h | 17 +++++++++++++++++ >> > 3 files changed, 39 insertions(+), 1 deletion(-) >> > >> > diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c >> > index 907cfa57481f..073d926ef9ac 100644 >> > --- a/drivers/gpu/drm/xe/xe_bo.c >> > +++ b/drivers/gpu/drm/xe/xe_bo.c >> > @@ -26,6 +26,7 @@ >> > #include "xe_dma_buf.h" >> > #include "xe_drm_client.h" >> > #include "xe_ggtt.h" >> > +#include "xe_gt_stats.h" >> > #include "xe_map.h" >> > #include "xe_migrate.h" >> > #include "xe_pat.h" >> > @@ -1160,6 +1161,8 @@ static void xe_bo_defrag_add(struct xe_bo *bo) >> > xe->mem.defrag.interval_ms = XE_BO_DEFRAG_INTERVAL_MS; >> > list_add_tail(&bo->defrag_link, &xe->mem.defrag.list); >> > atomic_inc(&xe->mem.defrag.count); >> > + xe_gt_stats_incr(xe_root_mmio_gt(xe), >> > + XE_GT_STATS_ID_DEFRAG_ADDED_COUNT, 1); >> >> Assisted-by: LLM >> > >Yes. > >> I am not sure if ADDED_COUNT is much helpful here. But BOs added here can get silently >> dropped. Also, a silently dropped BO can get re-added. >> > >That is in fact true and if you run the xe_defrag IGT this happens a >lot. I personally find this one useful and so has the ALOS team. > >> Perhaps a better count would be a 'defrag_pending byte guage'? Also, probably make it >> not-resettable so that it gives the current state of fragmentation. >> > >I think for something like that debugfs would be the better choice >rather than GT stats - e.g., Take spin_lock walk the defrag list and >which shows the current state. This is a different patch though but >probably worth adding. > >> > } >> > } >> > >> > @@ -1274,8 +1277,21 @@ static int xe_bo_defrag_one(struct xe_device *xe, struct xe_bo *bo, >> > xe_dbg(xe, "Defrag attempt on BO size=%zu: ret=%pe consumed=%llu\n", >> > xe_bo_size(bo), ERR_PTR(ret), *consumed); >> > >> > - if (!ret && ttm_tt_is_beneficial_order_failed(bo->ttm.ttm)) >> > + if (!ret && ttm_tt_is_beneficial_order_failed(bo->ttm.ttm)) { >> > *needs_more = true; >> > + xe_gt_stats_incr(xe_root_mmio_gt(xe), >> > + XE_GT_STATS_ID_DEFRAG_PARTIAL_SUCCESS_COUNT, >> > + 1); >> > + } else { >> > + xe_gt_stats_incr(xe_root_mmio_gt(xe), >> > + ret ? XE_GT_STATS_ID_DEFRAG_FAILED_COUNT : >> > + XE_GT_STATS_ID_DEFRAG_SUCCESS_COUNT, 1); >> > + } >> > + >> > + if (!ret) >> > + xe_gt_stats_incr(xe_root_mmio_gt(xe), >> > + XE_GT_STATS_ID_DEFRAG_MB_MOVED, >> > + *consumed >> 20); >> >> This will truncate the size which can accumulate over multiple BOs and the size >> here will be significantly off from real size that is moved. >> > >I'm not following. Consumed is the number of newly pruned bytes, thus >the total number of bytes copied on the migrate queue. A single BO can >prune in anywhere from 2M to DRM_XE_BO_DEFRAG_SIZE_LIMIT per >xe_bo_defrag_one call when !ret is true. > >I use these stats all the time and they seem accurate. > The concern is that we do the MB truncation (>> 20) per-call, before adding to the running counter, rather than accumulating raw bytes and truncating once at report time. Each successful call can lose up to just under 1MB to truncation (e.g. consumed=2.4M becomes 2, not 2.4), and since xe_gt_stats_incr() only stores the already-truncated int, that lost remainder is gone for good. Over many defrag calls these per-call losses add up, so the counter can drift further from the real total the longer the system runs - not a one-time rounding fuzz. Would tracking the running total in bytes (u64) internally, and only right-shifting to MB at the point of the stats increment (or report time), avoid this? Niranjana >> > >> > unlock: >> > xe_bo_unlock(bo); >> > diff --git a/drivers/gpu/drm/xe/xe_gt_stats.c b/drivers/gpu/drm/xe/xe_gt_stats.c >> > index 789397514f3e..68e60d9500c8 100644 >> > --- a/drivers/gpu/drm/xe/xe_gt_stats.c >> > +++ b/drivers/gpu/drm/xe/xe_gt_stats.c >> > @@ -154,6 +154,11 @@ static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = { >> > DEF_STAT_STR(PRL_2M_ENTRY_COUNT, "prl_2m_entry_count"), >> > DEF_STAT_STR(PRL_ISSUED_COUNT, "prl_issued_count"), >> > DEF_STAT_STR(PRL_ABORTED_COUNT, "prl_aborted_count"), >> > + DEF_STAT_STR(DEFRAG_ADDED_COUNT, "defrag_added_count"), >> > + DEF_STAT_STR(DEFRAG_SUCCESS_COUNT, "defrag_success_count"), >> > + DEF_STAT_STR(DEFRAG_PARTIAL_SUCCESS_COUNT, "defrag_partial_success_count"), >> > + DEF_STAT_STR(DEFRAG_FAILED_COUNT, "defrag_failed_count"), >> > + DEF_STAT_STR(DEFRAG_MB_MOVED, "defrag_mb_moved"), >> > }; >> > >> > /** >> > diff --git a/drivers/gpu/drm/xe/xe_gt_stats_types.h b/drivers/gpu/drm/xe/xe_gt_stats_types.h >> > index 425491bed6c4..c42b494390f8 100644 >> > --- a/drivers/gpu/drm/xe/xe_gt_stats_types.h >> > +++ b/drivers/gpu/drm/xe/xe_gt_stats_types.h >> > @@ -122,6 +122,18 @@ >> > * @XE_GT_STATS_ID_PRL_ABORTED_COUNT: Times the page reclaim process was >> > * aborted. >> > * >> > + * @XE_GT_STATS_ID_DEFRAG_ADDED_COUNT: Times a buffer object was added to the >> > + * page defragmentation list after being backed at a sub-optimal page order. >> > + * @XE_GT_STATS_ID_DEFRAG_SUCCESS_COUNT: Times the defrag worker successfully >> > + * re-backed a buffer object at the beneficial page order. >> > + * @XE_GT_STATS_ID_DEFRAG_PARTIAL_SUCCESS_COUNT: Times the defrag worker >> > + * partially re-backed a buffer object at the beneficial page order. >> > + * @XE_GT_STATS_ID_DEFRAG_FAILED_COUNT: Times the defrag worker failed to >> > + * re-back a buffer object at the beneficial page order. >> > + * @XE_GT_STATS_ID_DEFRAG_MB_MOVED: Data (MiB) actually (re)allocated while >> > + * re-backing buffer objects at the beneficial page order. Chunks borrowed >> > + * from the old backing for free are not counted. >> > + * >> >> NIT...all GTs applied to root GT, which is fine, but probably update stats documentation? >> > >Yes, let me add that. > >> > * @__XE_GT_STATS_NUM_IDS: Number of valid IDs; not a real counter. >> > * >> > * See Documentation/gpu/xe/xe_gt_stats.rst. >> > @@ -181,6 +193,11 @@ enum xe_gt_stats_id { >> > XE_GT_STATS_ID_PRL_2M_ENTRY_COUNT, >> > XE_GT_STATS_ID_PRL_ISSUED_COUNT, >> > XE_GT_STATS_ID_PRL_ABORTED_COUNT, >> > + XE_GT_STATS_ID_DEFRAG_ADDED_COUNT, >> > + XE_GT_STATS_ID_DEFRAG_SUCCESS_COUNT, >> > + XE_GT_STATS_ID_DEFRAG_PARTIAL_SUCCESS_COUNT, >> > + XE_GT_STATS_ID_DEFRAG_FAILED_COUNT, >> > + XE_GT_STATS_ID_DEFRAG_MB_MOVED, >> >> NIT...Few other counts that might be helpful are, >> - defrag failure reason (DEFRAG_FAILED_BUSY/ENOMEM) > >I practice ENOMEM is really the way it can fail (e.g., we ask the core >for 2M page with aggresive reclaim flags and it fails). So not sure if >this is really useful. > >> - time cost of defrag (DEFRAG_US) > >This is tricky one. What would DEFRAG_US measure here? The time to >allocate memory (e.g., reclaim time), the time to prune in memory under >dma-resv, or the copy job time? > >You can figure out all the above via ftrace and that how I profiled / >tuned the implementation + how I believe the ALOS team if proving this >works / tuning Kconfig options so we don't miss page flips on a defrag. > >> - 'removed_without_defrag' so that 'MB_MOVED + removed_without_defrag + defrag_pending' >> is the total suboptimal size added to defrag list. > >Removed without a defrag is probably useful and perhaps a total of >suboptimal bytes added could be helpful too. Let me add those. > >Matt > >> >> Niranjana >> >> > /* must be the last entry */ >> > __XE_GT_STATS_NUM_IDS, >> > }; >> > -- >> > 2.34.1 >> >