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=1796360114; b=4lqCNzoTrpqVb6luQ8Ic79mQAfqQzADOT/tsscRQ9L7kc5EQwP27cU0PFp83+UOMampv zMe+Bqo379rv/98oAS7hQV1MCVuFk4GbsPcPnWGiVQUUhRmOWRtfsbURFazfIbF1amxh2 PVR8WPauLgtGL3LxVKqMDsc4KFphSAFWDMMtEdEyNsZFzHL77QdRPxgW47M5cK7B21lOp Nb3GatYcZssBOaWvLo5kH0mFFY8mP7Y+/p3X+Ly23hFrfpEeUPpQcNVq6NOT4c341Ob72 dcG3Ua6gaJJniFmwtKm708xgTvaEFXRG3Y5pxmBQWwKeGTczMmxz0yDSLcwGXkXe7+w== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796360114; 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=YlkSMUiPNmFkv9+fzP6llTitYSyGSTvUouNzyG1hGb0=; b=ab0bwBXg2EFK+BXPObPOblKyFDFc7eVbNXIQFd8z359v8sa6KCrPFPn0MBvpVKVbaD4v oqbUaSjBRKAwc+URMU/L413PXerBuURoe9UUek+4NLuP8AEU6cgY8jIYJVciAkZHw4DPs GOdHjyxbDFHPZmN+3ZrjQphvZA4Q2oi6cNWti0cEQbcs+iQE7yNaW2CTnKWHkpPtblaDg Mj0PeIW1u4aMJFB0GBi0lgcdpGV9AomBR0qFgWwpzF1yHtB76sCm5grL6BuURcn6vMiJ/ GN8OSfNRcvupCfJTc2GFpEdpDR3tyDOoLFd1sS0P8IM9K7hsIOM+QCxEhKdHOo/4+zQ== 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=fQCnwpe4; 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 8711C606A322 for ; Fri, 4 Dec 2026 04:55:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8711C606A322 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=fQCnwpe4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796360114; x=1827896114; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=YlkSMUiPNmFkv9+fzP6llTitYSyGSTvUouNzyG1hGb0=; b=fQCnwpe4csTZlS8FhRZZa//VaoYWZMGX/kjUK5VsVBlrgcHB8ZTyyQNt WDp8nKlAtUv3h6/v8IbunjDeNKaAkqs/16GTqyp75+xHr8SJ1xZoJBNuO GovRywbXojUSUO/frn6X61l6qh7JVwTzSQK1Y0gkRyNkHxUPT9gHPmjDO HZoO56uiW4QdtqDfPFSxIs89hMFnZRsZgbcKNlVBrjRe3USFM57Vj/EbD 5FE/Ln7m+xpyuVupVPAgDrc/CmPNVZX/Vvi1PtRhn2X52bVuxOjTOv9YL oskK+vwtnohoP7eLjhqY3oRdlXGlbF9fIoqQy9tFCPHDywiYgfAmB/hME g==; X-CSE-ConnectionGUID: Q/c/1h7ERfKTlmawFqUuVw== X-CSE-MsgGUID: 6OQEes4DQjWR1P4iAUYMcg== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="5354672" X-IronPort-AV: E=Sophos;i="6.29,77,1794902400"; d="scan'208";a="5354672" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 20:55:10 -0800 X-CSE-ConnectionGUID: itcw4hvlTP+IEn83M2Fseg== X-CSE-MsgGUID: uzeEFoqqREap4aCaE3WDlQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,77,1794902400"; d="scan'208";a="13804772" Received: from orsmsx902.amr.corp.intel.com ([10.22.229.24]) by orviesa005.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 20:55:10 -0800 Received: from ORSMSX903.amr.corp.intel.com (10.22.229.25) by ORSMSX902.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Thu, 3 Dec 2026 20:55:09 -0800 Received: from ORSEDG902.ED.cps.intel.com (10.7.248.12) by ORSMSX903.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Thu, 3 Dec 2026 20:55:09 -0800 Received: from SJ2PR03CU001.outbound.protection.outlook.com (52.101.43.29) by edgegateway.intel.com (134.134.137.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Thu, 3 Dec 2026 20:55:09 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nDYA0coV2Kk8or58M+ff307NOOwr7kp2PwUnzO/twqjkADgtz28V518/VdZJQX6wLPemgAXL26KvwUNGp1L0CdlLuh1PnC+GLIDdfXUtNpCwmr21SwQLXqiVk/fR1DVFHmfIJsxtzrgbYUN9JjvEr9dKXIYzakTEOCAgc9BLRR4r56duR+C7F39bphqDpvxAT9ineuuXn50OuFNypmBfb8xFSDhogRe9MzDewUXVjFGjkbK67eEFcMk4LQQihxzmQyasur2gRKwHgLlKHxYYLMwni5y1eaUmW8zJ6VxmR+xJQF/2vN4jX4RsFWIIoGSgyBFlBtJsoE/5v6eeH63Ydw== 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=rlIxL4Tj+7N+7qaxOgFsmRt4AMksL2iABM64yLuBaGM=; b=jZn4PdxL/B64/4jNs7HiDd3aXmYZsw9Cec+6c7uzTWNL2Al0eRYa7TRvT3di6zJq7+vJqQb63HUbpc9JlIgZOHowze0L2HNvZNwUIPTW4svTzU1O9y1XhTHbCpf4O6zxpN6EOffQRcV7KiOEz5lVgOWpOoYj8zMBSM9z5GwF/fD9pqgK+7IaJydNV2Vd5sUqadIMaY90T3peaxqFz8VDMUNw12qHTkw4WGR/BJUaj6ulZ8d5m9L1LPB149iciy6HdwdxiZfOLKrBtuZY+f/0EiSjdPMGUa41Ujxs8YeD1Fq9vFdpBjE7DsJjzHpvIkHh7uTNcDEpHE8qreDcckEZgQ== 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 DS7PR11MB7887.namprd11.prod.outlook.com (2603:10b6:8:e2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Fri, 4 Dec 2026 04:55:01 +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.0688.011; Fri, 4 Dec 2026 04:55:01 +0000 Date: Thu, 3 Dec 2026 20:54:58 -0800 From: Niranjana Vishwanathapura To: Matthew Brost CC: , , Carlos Santa , Ryan Neph , Natalie Vock , Arun Pravin , Matthew Auld , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , , Thomas =?iso-8859-1?Q?Hellstr=F6m?= Subject: Re: [PATCH v6 16/35] drm/xe: Handle defrag moves in xe_bo_move() Message-ID: References: <20261203202352.4153159-1-matthew.brost@intel.com> <20261203202352.4153159-17-matthew.brost@intel.com> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261203202352.4153159-17-matthew.brost@intel.com> X-ClientProxiedBy: SJ0PR03CA0156.namprd03.prod.outlook.com (2603:10b6:a03:338::11) 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_|DS7PR11MB7887:EE_ X-MS-Office365-Filtering-Correlation-Id: a6773cc5-8113-41bd-1166-08df51c2c0ad 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|1800799024|366016|23010399003|376014|7416014|4143699003|22082099003|18002099003|261009223027099003|56012099006|11063799006|261022105027099003|10067099003|261028144727099003|261026121527099003|261026140227099003|261021121427099003|261102123227099003|261021123027099003|261022075727099003; X-Microsoft-Antispam-Message-Info: Yi/VeHZXjFiew60IGax3+MN7fhSSKz2QsMK9AEgLvnZkyrXiSv2y7p1XL+pvIzTEF8ADB5/hsvOZXp6GAvS6Yv4SRycEbEMJsrPhkjZYaaqnR8qYQCUYzhMl/BRpxTq3UO4sBJLpF9Ej22l8vR/va8MgYPAzKVOO1+bPM6EDr19/lasU4gV9ig+MdSBLmfugF0cIdLN2jJNrk6S3LAWLN5RcOZcfd9xMzBvCUeNDTQ9RCvN/b4l9uLDQAMn4qOHK/q8zaZGIv8OguYSr3L9g9QMSIAJ3fKRhghe3N+gb7rHeR441pNG5KKOzGVQHTBXOvHeystNSIxuwgs7nj9ZWwbJ3YCviYlZs4jOQOP3SPVSAtWrYdsSgD9HD8ARKNTVJhO9P/pl5TO1WzCLYGoOC2PucUo/lB33uoIkKMqHWjWrZ+AtymhAymEsYRYHSa8yE0g2JY5Wnr14NuKdoTF94XMmArLEUa7b6GTjUVxvY5J6tDhQA7qPNj3TFKS05s1hR8Lhv/ZJl5DqKn67IfLrL1aQKTVuVsa90FIi/QgSuH6zN3chn+VsvzIvrtn2h88DJPlXOP/eFV5TgDejcrBX/Badu/MAskCGYMSBH5kosNvLdHseY8rLdakihvsnOmGpxGJGfcnE19QmDu34/BgDBthZ6X98SEbPB0jegZMZjZ4A= 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)(1800799024)(366016)(23010399003)(376014)(7416014)(4143699003)(22082099003)(18002099003)(261009223027099003)(56012099006)(11063799006)(261022105027099003)(10067099003)(261028144727099003)(261026121527099003)(261026140227099003)(261021121427099003)(261102123227099003)(261021123027099003)(261022075727099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?valGtqGRcAHaulpn3R/ssDcy6ToAjYtlTKL+w4TvmIDm9BkzugSpGYgyJd?= =?iso-8859-1?Q?A7eREgEkHZ73b1KY4NP68tbP7PCyNh/EU59ZGdzSy+j0dSPWt6uN8zcHt4?= =?iso-8859-1?Q?KXFzCrO/B30LNBLuVKhkRzlZ35bq3DlSWR4owc+B7CMu1lpGl4pEAaygWY?= =?iso-8859-1?Q?6yMuf4gEkgi5OIz/OeYGXZ0m0fh2S9E1S1PQchZILCXPde0dv97IiToViN?= =?iso-8859-1?Q?iPzGLrsVwhBsD8OeNF/wazoGb6VnQuqwc5OJbqb4pnn1F0xg1pSUMoya3c?= =?iso-8859-1?Q?9iqfz4K3FRNR+i9sFb0OKxyP1qU8We/ExI5sCNaduvuf3A9WXYtQluyE3E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kjq8IKelRC8I0ZVdm7LfAOS2oz56ZceW8xR2FJY1S+9GWoONdkl9bDQ== X-MS-Exchange-CrossTenant-Network-Message-Id: a6773cc5-8113-41bd-1166-08df51c2c0ad X-MS-Exchange-CrossTenant-AuthSource: MW3PR11MB4684.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 04:55:01.1013 (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: qPNyJyVdl8qE5ptt0blhjkcGVTUh9hds9AM055BIc8QgiaqKQ6j6kNjRRXCAi7mghwy+awJtqBQRic5zusMmPfnxTq72Vmx+bvk8PNOaw27yIggbMpWpzMdwIMy6h7hO X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB7887 X-OriginatorOrg: intel.com On Thu, Dec 03, 2026 at 12:23:33PM -0800, Matthew Brost wrote: >Teach xe_bo_move() to service a defrag move, where TTM reallocates a >BO's backing at the device's beneficial order and hands the old, still >populated tt to the move via the BO's defrag_old_tt. > >A defrag move always has existing contents to copy, so force >move_lacks_source false and fall through the XE_PL_TT -> XE_PL_TT no-op >shortcut so the copy path runs. The relocation is performed entirely on >the GPU via xe_migrate_copy_defrag(), reading the old pages from the >stashed tt's sg table and writing the freshly reallocated backing. > >Both copy passes run in order on the same migrate queue and are captured >by the returned fence, so the teardown is pipelined via >ttm_bo_move_accel_cleanup(): the old tt is handed to a ghost object and >only unpopulated and freed once the fence signals, so the move need not >block. > >v6: > - Assert defrag BOs have system placement (Sashiko) > >Cc: Carlos Santa >Cc: Ryan Neph >Cc: Natalie Vock >Cc: Arun Pravin >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 >Signed-off-by: Matthew Brost LGTM. Reviewed-by: Niranjana Vishwanathapura >--- > drivers/gpu/drm/xe/xe_bo.c | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > >diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c >index 382f4664287c..886029c0f90d 100644 >--- a/drivers/gpu/drm/xe/xe_bo.c >+++ b/drivers/gpu/drm/xe/xe_bo.c >@@ -1299,6 +1299,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, > bool move_lacks_source; > bool tt_has_data; > bool needs_clear; >+ bool has_defrag_old_tt = !!ttm_bo->defrag_old_tt; > bool handle_system_ccs = (!IS_DGFX(xe) && xe_bo_needs_ccs_pages(bo) && > ttm && ttm_tt_is_populated(ttm)) ? true : false; > int ret = 0; >@@ -1339,6 +1340,17 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, > move_lacks_source = !old_mem || (handle_system_ccs ? (!bo->ccs_cleared) : > (!mem_type_is_vram(old_mem_type) && !tt_has_data)); > >+ /* >+ * A defrag move always copies the existing contents from the stashed >+ * old tt into the freshly (re)allocated backing. Only BOs with system >+ * placement are defragged (see xe_bo_needs_defrag()), so the tt never >+ * carries DGFX FlatCCS backup pages the copy would drop. >+ */ >+ if (has_defrag_old_tt) { >+ xe_assert(xe, bo->flags & XE_BO_FLAG_SYSTEM); >+ move_lacks_source = false; >+ } >+ > needs_clear = (ttm && ttm->page_flags & TTM_TT_FLAG_ZERO_ALLOC) || > (!ttm && ttm_bo->type == ttm_bo_type_device); > >@@ -1382,9 +1394,12 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, > /* > * Failed multi-hop where the old_mem is still marked as > * TTM_PL_FLAG_TEMPORARY, should just be a dummy move. >+ * >+ * For a defrag move the old and new tt differ, so continue to the >+ * copy path instead of treating it as a no-op. > */ > if (old_mem_type == XE_PL_TT && >- new_mem->mem_type == XE_PL_TT) { >+ new_mem->mem_type == XE_PL_TT && !has_defrag_old_tt) { > ttm_bo_move_null(ttm_bo, new_mem); > goto out; > } >@@ -1471,6 +1486,12 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, > > fence = xe_migrate_clear(migrate, bo, new_mem, flags, > ctx->interruptible); >+ } else if (has_defrag_old_tt) { >+ struct xe_ttm_tt *old_xe_tt = >+ container_of(ttm_bo->defrag_old_tt, struct xe_ttm_tt, ttm); >+ >+ fence = xe_migrate_copy_defrag(migrate, bo, old_mem, new_mem, >+ old_xe_tt->sg, handle_system_ccs); > } else { > fence = xe_migrate_copy(migrate, bo, bo, old_mem, new_mem, > handle_system_ccs, ctx->interruptible); >-- >2.34.1 >