From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=198.175.65.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796079888; b=rHj9iWZNBSAmx0UZhWV3T/JSWpbF3vrYHNPRJMm49tuKJQLzyyh3t2OlUWmfBTlFHHo3 ai1muqjVZJ8cO1Bp1ZTXqSVfHG+cdjfqBG2r8WGE7hbVs7QlqDVxICznBrsAA+hvv5eS1 KZWBHjnXAku8J3aYyPVIKyWnXCTIsV9BNS2ON09EW7Zqu0+0A3b7Mlx6SWMMzqk2y8+hL swfFHzS/PqwZ6+3gIi7AExyoTjN5Mo+mAWMY++VjAE2Xr/n2+hy7RsIaSKpTQmTfU0acQ yeu7M1DIMnEqwSHTQ79QdLKD45WxLQOeN7lbh5OQfgyASN7k4epX2h+zIWSr1bxrldA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796079888; 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=iwnDeC2//cyI+XpnOD/UengS3wd3pNUVE0x04HFXFfY=; b=3lAIW2rLaulNc5inrS/fWZ0UHfsptZm+FAi7+LzrskdpYwRn+RGiMFLZft+mVPMgXv1q NBSCSIlM2GLm54zgQj6iKjanGgwBkpejdqnpccfvDvJacQLBHqgpwvkvpzg90i0g31e4h Aes7Hl57oBwymBo6HP8sFjItDG9+ReODuhO61+vQwOUp4bcNA/eI1tgVmQzgRSfrEYGab YJXA8URVKkpHew3/XYNrmK+j8rKU0wOWbuzkcU7AJmjeq/oA98CtOvcMX0C4KATAb7i++ p+17vqy83MgY3GyJumD40t11qGq8ZmUsEY/XqEmhZebx0LiMOXvyGDzsBXFGuQ2t06A== 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="Wu/d3nUO"; arc=fail smtp.remote-ip=198.175.65.18 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 7EBC7606A320 for ; Mon, 30 Nov 2026 23:04:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7EBC7606A320 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=Wu/d3nUO DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796079888; x=1827615888; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=iwnDeC2//cyI+XpnOD/UengS3wd3pNUVE0x04HFXFfY=; b=Wu/d3nUO+FuZkbdDeFXCgzC0y/TApILIqwiVvt87BavK0qPoZVP/zuzL DHAdmimGHk1KbNYxDE6sK6p30Uu4lCYJEokE9EzaW3hwb86ZqapPhWijU 5j+H9nTusVFw3KP9cFTEXxGBJJOIGU7BuCRz0LWvGEmuEA9T1kmILe7j1 uz/reVEt1gTh65mW8YJWccrkwa8TA7IwumRy21IPICRqIp7WPrkkXNBTc 5S03C/VQ5EI7WfuDawF8w5Ayul7gd6IvI4q/qQkPEHr47sIB4Oe6qcxot z9TK9iMYlqwninsKHnFV+WNVw78MrIZUnX0MLwShBiGk2iW7yQxmSipX8 g==; X-CSE-ConnectionGUID: sDiXy2mNQjS4/rTD90sBOg== X-CSE-MsgGUID: 7HAJ5UAMQripYFjVEgX4Sw== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4938855" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4938855" Received: from fmviesa011.fm.intel.com ([10.60.135.151]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 15:04:47 -0800 X-CSE-ConnectionGUID: AkYXYzfjRG6b0VyLzcbKxA== X-CSE-MsgGUID: D6itanrARtGiU73KfMw+eQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="14823440" Received: from fmsmsx903.amr.corp.intel.com ([10.18.126.92]) by fmviesa011.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 15:04:47 -0800 Received: from FMSMSX901.amr.corp.intel.com (10.18.126.90) 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:04:46 -0800 Received: from fmsedg903.ED.cps.intel.com (10.1.192.145) by FMSMSX901.amr.corp.intel.com (10.18.126.90) 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:04:46 -0800 Received: from SN4PR2101CU001.outbound.protection.outlook.com (40.93.195.38) by edgegateway.intel.com (192.55.55.83) 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:04:45 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g9oFJJJpe9XtaZ6ydwdAc2JO9AmErnHtqipzxEPXi+1COeZ49Kb2R0y9d6Rbk1B4vaogKP6R3TfTblizIkLY0nGohYrazqkhbt2I3JtTkrVHspyG4Ab8SYatHPCQ5RH7rdz71XePw85CbjUR5BHAJSb2OsC2ykOUDpAY9sHA0xIUHnjk0/lHtZ6SY0t6w6wr70ky8Eo/6b4ln+FVu0qx9H0Y3CK5Dahx5sIpxvr7yX8EQLeJ/d/HVN2dsgMlhCVjK0BGH7m/fQ3Vr+iFbKA10DfAy+UFtstOdksaWTn5GHxQnJg4Ib1gsXzTX9ZrULvj1d2JPK/6K5VFA6QrzqQqpQ== 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=kk2PdA2nvl8bWJVX7FEOj3e8Mqcv0nQqZaj7dAy+eUM=; b=zM3vY1jfQ/HgH2HSFGt15Y18A1VtSdkhOsk1KvtaZumd2fB7oS2+NSGMDJb5U5gldCnDumtxOu3r595Z8trvdpBXU5Xm1URl5Xq/xzvHsRZOtmAOaqUjqfeQ7LEHTqlAkXfMF3iBamm+390MCAC/GAFZNgY7Bm+iX/44B/5QG5Avm2U+NMrMqZUgNkZPKj/PzeB0vBB2nn4iq0RkyGFazIFl+eCmrIP9t7w9r8e72u+zHyPADVy2VB7WmIFTcWjZak4JYrqlu1JqrKBtpgiC1H6nHd3jtmJBNhPUSYGQtzKb6kYyzeZOJ3HVKly12vZvaah8ldaesA3+Pkl9g5Bpug== 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 CO1PR11MB4787.namprd11.prod.outlook.com (2603:10b6:303:95::23) by SJ5PPFD25B21260.namprd11.prod.outlook.com (2603:10b6:a0f:fc02::856) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Mon, 30 Nov 2026 23:04:41 +0000 Received: from CO1PR11MB4787.namprd11.prod.outlook.com ([fe80::e7eb:a872:53d1:21fd]) by CO1PR11MB4787.namprd11.prod.outlook.com ([fe80::e7eb:a872:53d1:21fd%4]) with mapi id 15.21.0662.012; Mon, 30 Nov 2026 23:04:41 +0000 Date: Mon, 30 Nov 2026 15:04:38 -0800 From: Matthew Brost To: Niranjana Vishwanathapura 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 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: BYAPR05CA0059.namprd05.prod.outlook.com (2603:10b6:a03:c0::19) To CO1PR11MB4787.namprd11.prod.outlook.com (2603:10b6:303:95::23) 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: CO1PR11MB4787:EE_|SJ5PPFD25B21260:EE_ X-MS-Office365-Filtering-Correlation-Id: 0374ee70-3e18-4b28-180b-08df4f365099 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|376014|7416014|1800799024|366016|23010399003|11063799006|4143699003|22082099003|18002099003|261009223027099003|56012099006|10067099003|261028144727099003|261026140227099003|261026121527099003|261022105027099003|261022075727099003|261021121427099003|261102123227099003|261021135927099003|261021123027099003; X-Microsoft-Antispam-Message-Info: BI1iozKXV9WWuPdeDh+LACFPB5OZ0/ctiOf7QMOllk8+PTp7uOCi4Af2uU1ylwSUT/aRm3M0c7nKpX3dm28xOWk71zX4TfuYLsYzRMQ2xvbMAOb8IUcVxJNZcXIipXrypnKnptxOgTUy/Hl5AiU80y56q1ukRDKFIVN53515bT7Ir4Pls6dzdGskP9S5njXwE3ESZ71lSJAnpDy/MOXp5rkyh267ZEO7Yk4Fkg/T7Ks5r9MRbzKvobo1Lw82S1LZCExa5R9UGDOhkuVrtD1kqfufwsOG1GHgLU5AmZlSpYTgVETck4evllJYDhHAxnZ99C9hg3n8TGmOdlS79tzjA7A03pNYEQSH/nO7W9GNCd4oAkCrMdciCqUe700M3G9prQUbIJnrTlJlhnu5a/YYRo8w9a4H7z/sOKVmIs8DYSxWtiCCidcQaSwO8BDlm0gpDkWt8+EVcgvJW/IRg0hcHZ0xG5U9j7Sm+RDy5WnkY95U4DCPqtAoTzZgkBcFJjVWMw1/5ROkDvT8B9V8ZHhbiIItdRH2qDgmATJ8YZsBmisMcuoZFDWS/uOObfnIe7A9HDLXktDT5WuYb2Kh81iArmc9thu59dwxtukOeHGZJsVUXCBmC9OALCoRkWnkxKsssL0jej6xmVp5msKUMHk2ksChG+NZdGppBsXgwt3WoNA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4787.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(366016)(23010399003)(11063799006)(4143699003)(22082099003)(18002099003)(261009223027099003)(56012099006)(10067099003)(261028144727099003)(261026140227099003)(261026121527099003)(261022105027099003)(261022075727099003)(261021121427099003)(261102123227099003)(261021135927099003)(261021123027099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?HVrw18dYt0Pmrr2covojha7tBFR+vB/6CKVPpPoCvDcjyYrukJYSeMcC76?= =?iso-8859-1?Q?v3X2e/tUBdVXfIJqxf1zHj/4axMyRRglmfmxR8tp9gQDzEwHMgVbN4Clde?= =?iso-8859-1?Q?ddlDrlk9IfrMEJWXd+Rg414oBZemBjLF1tzZGhb49PX5WBJg9xi9V2B7kK?= =?iso-8859-1?Q?ztcS7fIF5tV5LIgBRY8sH2/w9faRQahc5vrPoK4hdqAvuRV7fj2JFzxgVu?= =?iso-8859-1?Q?Jy/oNrifipTHwnYh0wNgNgX34jRBo1WSoqegB5KWRC5GAtGhHMFhBVzb+h?= =?iso-8859-1?Q?fYyQPULnLbYiYoNDfI/BSv9VrXUYJamK6WK8uHmNUDD0RFFRcXwx8z4tlq?= =?iso-8859-1?Q?OwIryTn1FVj4Qd8jKr01bSa9/9BRGYWW19T0da72ZR3QMzjb0/X87H48uh?= =?iso-8859-1?Q?mjqk4bNx6eJ9juOuiEtyQxdYBk/pznmFWSEbIqAJPQeFiAif0eRI2djPd+?= =?iso-8859-1?Q?5PrNw5ujyEyO4yTVg/JtQXYyOcOTMAxy6cgi+aayn+RmInwFchEcOE+fw/?= =?iso-8859-1?Q?z9XBIOVJRcUecQBcaa9SWMCe7edgMXwuCWjTeBmKtDxzHzJ2NU6eekkmef?= =?iso-8859-1?Q?Tb6HDmrfO6fRhzyFyhuxQ+QF/6YYqbsRLxv1pJXcPqoiu0Wh2+5fhErWld?= =?iso-8859-1?Q?GzSUPR0BBYd5pU6CyNk9Sh1JH12bEWcMDf7luTB4sIkTWHguBJ7vrWs1pr?= =?iso-8859-1?Q?CrE2y0iBqVXTpO7JQlXcvw5vTmAMJ1V/WfewlwMUjza78kKsSC9v/oRQig?= =?iso-8859-1?Q?EH2TvImiM/bYug1/ixMOjthOpUEn+4KY1xgYacS9nkq4kGuKsGkE6tFFzs?= =?iso-8859-1?Q?P2ieVy5/BrVL/ybwg4sOkvRtmaHAai4dnvj249K/h1HRIqg9XW4FVKaEMe?= =?iso-8859-1?Q?FW4RmkXBQSo9CwakMHHxIherCFd+LmQtgnO/4d815d7m0lvZI2J54CBU9t?= =?iso-8859-1?Q?OdYhULURdn5stAyesxf7wTFZgAMrY2yZee2y0iF3WFA1JB63H9zPcpPEym?= =?iso-8859-1?Q?quXSO7scgeZU2dZGgCgpI0CTojemoT57k+XhnxhYSLUwiPkRpCbZuyLOH2?= =?iso-8859-1?Q?UMOnH85nHENUhT2EnRHrgHJVQoPuzUyenlnEA9A4i9PkVkZ/rtPQlTmc9u?= =?iso-8859-1?Q?yLP/hC3k+xTIFXjtOAWmvkS2ha2siI5HAfzbaFDbRilRzABv0VThcv8gzB?= =?iso-8859-1?Q?QxrI9MSOmLQnrcdinM2XPEdlUMqRt1fabFyA+kHg4Bn/l8F3DLDBJTKgL6?= =?iso-8859-1?Q?s4JET/Ansn83B59YrHhtr6mZWqVI334EyiqeK00+btP7dCXIT1TeOymfNP?= =?iso-8859-1?Q?jg+uMHzofllurSVZ0vyBgGnRqLSs2Dp5YG3lIc5CoUiHXvP5XSH35D+bU1?= =?iso-8859-1?Q?QUR2jwyN2Fob/8vpekKsoQ7sLSITavH2S4HiiIEBSnEzabdRTWViasBHrQ?= =?iso-8859-1?Q?oMMJ89tYVWuYxOCTl6mL7R3gfjzkFNOdyK7zJfBULY0t2jJppPh5q0Iinh?= =?iso-8859-1?Q?zmJElidjvxLjQejIuCNepBxahLLCUA+FVgg6e6o6Sg9PyqkeWnagsAPQyk?= =?iso-8859-1?Q?iosYAc1VHvdhyaWhKDWh43CNOBWdid7wKxAM7G0ZjzlovbNojUU8mPy1DB?= =?iso-8859-1?Q?ZvEEGny9iL2Jv6jgBHRh8MjA9oGUHejENxmB5uZ3FgQOLjbLpg+TZR1oWz?= =?iso-8859-1?Q?jvdEXUeDuqK5QJVSvUTxBazG/rmFtbV0CBfeuIrIXWZiSuzrEw5tQxz0Hi?= =?iso-8859-1?Q?ZtH26qBB6j9evval27h79s6MjWM7AGhgUvwQIxn28BKy5SLabHUSAc/jkD?= =?iso-8859-1?Q?bdCpEanp9A=3D=3D?= X-Exchange-RoutingPolicyChecked: CpXTMGyKmoH3ipJgPxslFmyVlYhDYMd7jqFqVGesS+vrG7YQkVviZGLpDeSq1LzJmlKoA+bG5wJkaPc+9atkB0QaPYo53ffptivAlaZYiVTelfJ5NpvFRXaqB8V7s4ocuQF2YkTTUhEgX++kP23yvyMEnyURxwtZS/DDT7NkHJAUTOPIHUVIG83FhgQxH/CgbYem8lpuHQHU9SrjV13zwPGaWqH3B7yoflE16920QhBAUvv+1sdNcTR03VookoiOB94FOX8a3QZEydxxZG+OvrFN2xn5Ydowdxasf2rW5HtgZYqikke9JofWtDlHPCrvxgs/TKk+XQH4kVWkYBjgtw== X-MS-Exchange-CrossTenant-Network-Message-Id: 0374ee70-3e18-4b28-180b-08df4f365099 X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4787.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 23:04:41.0694 (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: /HEl8094RJD96IncyYxomgSISVx9vJIitj6hbMNk/DKQdHgckjJO6q0zB3WaAuKboFNExutI6bPdemQvZxCqGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ5PPFD25B21260 X-OriginatorOrg: intel.com On Mon, Nov 30, 2026 at 03:02:29PM -0800, Niranjana Vishwanathapura wrote: > 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 consumed is also 2M aligned. Matt > 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 > > > >