From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F3FA606A31A for ; Tue, 1 Dec 2026 22:05:47 +0000 (UTC) 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=koEXut/E Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 519BE10E3FA; Tue, 1 Dec 2026 22:05:42 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id B750B10FD7A; Tue, 1 Dec 2026 22:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796162736; x=1827698736; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=2QsW017CltnK8tYa67J+Eg92h2PpRNBB/R7x37Cpifg=; b=koEXut/E+c28ml/VP17Y9e0aqZpq2UO2dVwR4GG4vyI9k+meK/J3w1Sh TnH1gndf2I3hj+VjlTdLxcHEM9O2ucCH0SnVIVENBQE2/MWMrE19FTnTl CLsCnEyMH9pufPPL75r5d3+4Sj9601NYWvhisin//Ufox4uvPFQUKxt8A vuc6d9EVFWlyQtSYBZOA+F3etPORtwliLH9G0iayvkh4lh07RyyeQSgEH smoqc2lEDry8cA+5r3nG33EeC95be0KDwgAYZ2Jm31JAJ2u7S9eW4sGei j/+IF4DVY4KjhmQYP9SINVK5u4HYr4NgHUmSg83fpof5au/NF5vCLTuXB Q==; X-CSE-ConnectionGUID: wHlhzA+fRySvi0s9Zix3lw== X-CSE-MsgGUID: pJ4/+sB0TtCKX2dVht8HhA== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="4905433" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="4905433" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 14:05:35 -0800 X-CSE-ConnectionGUID: Ms46PPtoQHKzci+6CTRxCw== X-CSE-MsgGUID: lc6nRF/HQmaHz/m7BAj4YQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13598198" Received: from orsmsx903.amr.corp.intel.com ([10.22.229.25]) by fmviesa002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 14:05:34 -0800 Received: from ORSMSX903.amr.corp.intel.com (10.22.229.25) 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; Tue, 1 Dec 2026 14:05:34 -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; Tue, 1 Dec 2026 14:05:34 -0800 Received: from MW6PR02CU001.outbound.protection.outlook.com (52.101.48.45) 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; Tue, 1 Dec 2026 14:05:32 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Hawi0QKvy+dc6bP9RxxZ3Kgv8i84GsZ3fkcmS9nzOgD8cBvlk5eDxu7tuNQJUEiR2T4DVZfC9k4ncIddohYv1MzCaxikaApBE208mhdoH0236g8x4MvKLreNeKExAjykDvEZRBYvWfgHGqLOoxImmee1TTqxYpAMPgS97ejd14GcMEjx4GlpHal+cj69amldgGbV3dxhRYCq+yJXE60hcgAvDIFM4KQuvCYD7HtFwFDJ+lAdFIOkdM4JuFTOEbhJNyu3/nPCJ/Be+7UA9p3CtyGCmRGKio/K691sLC/77DAZLiLT3FAcn7P/OlpuKwYeXhgev166whk9e/aLdhskAA== 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=7W10ym19ZvcCVDpD2y3FSJph/Z/wlLkK2eO1hI0VPO8=; b=Yc54cIBSc8+yY4JGBp4Eq3dn2HU9V5A4w7NHX3WLO0xC4PdFw4hbBtYmx8SDD7WSUXVdVb9Ge54f0kNWl5JVhbyx8CMXpk2t9mTGi+35RqGwDAcRmbOO93sI5OZuimICc4qLVX2sbVN1FOzvMgp9wnlYCIPYICrtMZ4KTAt7qZLjRXY0SrIw5ZRYYR5zvelri1M2EEbsX7m3xoIw4KMF+4SMOAg2zFgtKo+lyb/HwfmWIIC+T4tOCVPSThP9Uy8QzvYH1E46LxR8cexT8yQ7Zwv8i26waPxgK33/BRvgQDPiK/uMObi+ONWHH7xR5WBtDXzo3wPIzztV4JBYdh7T9w== 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 BN9PR11MB5322.namprd11.prod.outlook.com (2603:10b6:408:137::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Tue, 1 Dec 2026 22:05:28 +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.0688.009; Tue, 1 Dec 2026 22:05:28 +0000 Date: Tue, 1 Dec 2026 14:05:25 -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 29/33] drm/xe: Add per-device dependency scheduler for IOVA defrag finalize Message-ID: References: <20260711025619.2540575-1-matthew.brost@intel.com> <20260711025619.2540575-30-matthew.brost@intel.com> Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: BY3PR03CA0006.namprd03.prod.outlook.com (2603:10b6:a03:39a::11) To CO1PR11MB4787.namprd11.prod.outlook.com (2603:10b6:303:95::23) X-Archived-By: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR11MB4787:EE_|BN9PR11MB5322:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c6f42c5-a5c6-4fea-f64b-08df4ff73533 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|23010399003|366016|1800799024|10067099003|56012099006|261026121527099003|261021123027099003|261026140227099003|261022105027099003|261022075727099003|261021121427099003|11063799006|261028144727099003|261102123227099003|261009223027099003|18002099003|22082099003|4143699003; X-Microsoft-Antispam-Message-Info: G1uhOZ5DeypmOdnlN6JsnnodOib8VON3U1hBpg8+snNDDoiLGBTCwkTvDrNRE5CQEk/hjFoQpTQp+ttRerMc4yMuRnuHjxEAj4xZSaBkL0RUCbC1bPkVs1XGRIwRkJE7GnNZZUHfhDZvbeQCqzdtky0/kGRtL1bGytOe1P2uZ+VqccTCAl6SglTORVjpE7D+vLm2LxoXZfSSqrPL9f25ukKOybFxFz9RJTDVV7EI2sf2V25owFx7gQ4OYKZtxbnXBdvqEClkW+3jzf4p2sBEmbu0uoksS8W7Gv6tdBmkpIbQ1ptlUMWnxRayw7+1aB3FFUFEyZ6KGSCmlTOJpJPiz6sanMKRdcN1hPENLf/XjEBDfO+Ly7r1A27Yt2ErQ8VSOB3f7dHum7q5ne5fg/nSfM2ArYllQdQ9IJNC/cahTmLzPdeuyLfSo+lWvMiS15rt7L+A4rCTJOmtygREC6wZiSteAURCbub+eJNDA6vJhUCkp+TwPt9PquJqW3Ob3hqoZPBjEiiBDak2JWbL3QQLwrfkPSOWaNIT2u37YHiUzhTukjtlvrqgom3WyH88+EfSnqd9VJW86uGZnvLTvifiQVC4uHUkz216/YfJ0DGxIiA7eWmZ5+UfitzJmMFA4oCrvH4pmRHbSXAnPEEIry3g8KjJkTNv7HZTIVo+IarFz8w= 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)(23010399003)(366016)(1800799024)(10067099003)(56012099006)(261026121527099003)(261021123027099003)(261026140227099003)(261022105027099003)(261022075727099003)(261021121427099003)(11063799006)(261028144727099003)(261102123227099003)(261009223027099003)(18002099003)(22082099003)(4143699003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?nnOFm4t2OQ5uKArlNHEHPduR4qh4h3QRTexkq5x/k9CBWm5m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2?= =?iso-8859-1?Q?5R20DBOlfDiO9SP1K79HoO+YNVIg4uk=3D?= X-Exchange-RoutingPolicyChecked: FULue+t9zVovFLFBdV59RTMphLRgNLsjJx+e+CAKPmbAN0a7oQpmSSQrH224xRMIpm9aVIKUYWonVgQN/XDcctKOa9xaSpZY8Wf+mKYnZpKOTuPhAF0HqIozzqVxd3laAz0EaS4AkeyLiWs09YSMIoZrUWdcXsiJEkinHpatt5TM+8D7mL1dTrKxOjtHGj+xno1mGjA0NMb6P1d3uPbgiZqSCkNC71jxXvaGOFsFqMIq3lBxo7F8fCdsz1viw0gm/vCrM0sZD23Hw5+paPqK3xiMlCDVNj5TVQZd3kkPaVMdD673Kakw/cuf5qZmpx7+uNK2z2vvx+bykKB1TeBjIw== X-MS-Exchange-CrossTenant-Network-Message-Id: 8c6f42c5-a5c6-4fea-f64b-08df4ff73533 X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4787.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 22:05:27.9156 (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: ITAWNk4FAA7tBzMq8qoCfXgpH/r0TAu3GiIU9enFR/PDpdpI8YfFjjz0Kxw7dMlBp66VPRRvWfqXO45kOJHR6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5322 X-OriginatorOrg: intel.com X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Mon, Nov 30, 2026 at 11:15:44AM -0800, Niranjana Vishwanathapura wrote: > On Tue, Nov 24, 2026 at 12:57:14PM -0800, Matthew Brost wrote: > > On Fri, Nov 13, 2026 at 05:47:59PM -0800, Niranjana Vishwanathapura wrote: > > > On Fri, Jul 10, 2026 at 07:56:15PM -0700, Matthew Brost wrote: > > > > A future patch performs the destination DMA mapping of a defrag move in > > > > two stages when the BO is IOVA mapped: a temporary contiguous mapping of > > > > just tht changed pages used for the GPU copy, followed by a post-copy > > > > finalize stet that tears that mapping down and links the new backing > > > > into the (transferred) IOVA reservation. The finalize step must run only > > > > after the GPU copy it depends on has completed, so it is dispatched as > > > > an xe_dep_job, > > > > > > Assisted-by: LLM > > > > > > NIT...minor types 'tht', 'stet' and trailing comma. > > > > > > > > > > > Add a per-device xe_dep_scheduler dedicated to these finalize jobs, > > > > created in xe_bo_defrag_init() (after the migrate contexts are up) and > > > > torn down in xe_bo_defrag_fini(). No users yet; the job itself is added > > > > in a later patch. > > > > > > > > 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 | 15 +++++++++++++++ > > > > drivers/gpu/drm/xe/xe_device_types.h | 10 ++++++++++ > > > > 2 files changed, 25 insertions(+) > > > > > > > > diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c > > > > index d54e69aefeba..c5022c16411f 100644 > > > > --- a/drivers/gpu/drm/xe/xe_bo.c > > > > +++ b/drivers/gpu/drm/xe/xe_bo.c > > > > @@ -25,6 +25,7 @@ > > > > #include > > > > > > > > #include "xe_device.h" > > > > +#include "xe_dep_scheduler.h" > > > > #include "xe_dma_buf.h" > > > > #include "xe_drm_client.h" > > > > #include "xe_ggtt.h" > > > > @@ -1306,6 +1307,10 @@ static void xe_bo_defrag_fini(void *arg) > > > > struct xe_device *xe = arg; > > > > > > > > disable_delayed_work_sync(&xe->mem.defrag.worker); > > > > + if (xe->mem.defrag.iova_sched) { > > > > + xe_dep_scheduler_fini(xe->mem.defrag.iova_sched); > > > > > > LLM suggests adding drm_sched_entity_flush() after calling > > > > Honestly I'd rather than not call drm_sched_entity_flush as that a > > pretty scary function. > > > > We might be able to explode here if iova jobs are in flight but I'd > > really have to think one through. Even if were possible it really just > > an accidemic issue and no one in practice hotplugs a driver - if we find > > accidemic issues we can fixup later. My fix probably would be use ref > > counting from jobs -> xe->mem.defrag.iova_sched to make everything safe > > (i.e., do what we do for exec queues). > > > > Ok > > > > disable_delayed_work_sync() but before calling xe_dep_scheduler_fini(). > > > > > > > + xe->mem.defrag.iova_sched = NULL; > > > > + } > > > > } > > > > > > > > /** > > > > @@ -1342,6 +1347,16 @@ void xe_bo_defrag_init_early(struct xe_device *xe) > > > > */ > > > > int xe_bo_defrag_init(struct xe_device *xe) > > > > { > > > > +#define XE_BO_MAX_IOVA_DEFRAG_JOBS 16 /* Picking a reasonable value */ > > > > + struct xe_dep_scheduler *iova_sched; > > > > + > > > > + iova_sched = xe_dep_scheduler_create(xe, NULL, "xe_iova_defrag", > > > > + XE_BO_MAX_IOVA_DEFRAG_JOBS); > > > > > > Should we be creating this only if IOMMU is enabled (IOVA supported) > > > and defragmentation is enabled? > > > > This very small piece of memory and I don't think it worth do any > > special casing here. > > > > ok, but the check seems simple 'if (use_dma_iommu(xe->drm.dev))'. > Yea ok, will add this as I use use_dma_iommu in different place in the code so this is consistent. Matt > > > > > > > + if (IS_ERR(iova_sched)) > > > > + return PTR_ERR(iova_sched); > > > > > > returning early here skips registering xe_bo_defrag_fini. Though it is > > > unlikely that defrag worker getting scheduled by this time, it is > > > probably still good to register xe_bo_defrag_fini to ensure worker > > > is stopped. > > > > So call: > > disable_delayed_work_sync(&xe->mem.defrag.worker); > > > > Probably a good idea. > > > > ok. > > Niranjana > > > Matt > > > > > > > > Niranjana > > > > > > > + xe->mem.defrag.iova_sched = iova_sched; > > > > +#undef XE_BO_MAX_IOVA_DEFRAG_JOBS > > > > + > > > > return devm_add_action_or_reset(xe->drm.dev, xe_bo_defrag_fini, xe); > > > > } > > > > > > > > diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h > > > > index 6e68add4d652..b55d549d5e30 100644 > > > > --- a/drivers/gpu/drm/xe/xe_device_types.h > > > > +++ b/drivers/gpu/drm/xe/xe_device_types.h > > > > @@ -38,6 +38,7 @@ > > > > > > > > struct drm_pagemap_shrinker; > > > > struct intel_display; > > > > +struct xe_dep_scheduler; > > > > struct intel_dg_nvm_dev; > > > > struct xe_ggtt; > > > > struct xe_i2c; > > > > @@ -325,6 +326,15 @@ struct xe_device { > > > > * @mem.defrag.worker, in milliseconds. > > > > */ > > > > unsigned int interval_ms; > > > > + /** > > > > + * @mem.defrag.iova_sched: Dependency scheduler used to > > > > + * run the post-copy IOVA finalize job for defrag moves > > > > + * of IOVA-mapped BOs. The job tears down the temporary > > > > + * copy-step IOVA mapping and links the new backing into > > > > + * the (transferred) reservation once the GPU copy that > > > > + * its dependencies gate has completed. > > > > + */ > > > > + struct xe_dep_scheduler *iova_sched; > > > > } defrag; > > > > } mem; > > > > > > > > -- > > > > 2.34.1 > > > >