From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=198.175.65.10 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1794198868; b=qvl/ACEa884LcJGtr21BWbXo4Ah2J9zjn2GwgknQjExE7Los05j2bUtnOhiM1jgsZeHY 7fIOm69GE0QJKbDgVR4zPc0STITn4pMuYNzUPgNBfd3nK+b7fogn02oeov8AQJ7ZTVr/M 5MNtXRQJ5FMQgQMusMkgnMod5NgA1R1UYUdoKzd52fTa/eXz7KSjAbsiOSV26u0A68aP5 ayhFKVGTs/IIYd5NpeeDwEWjYHShHF6CIMlJX6qGwJpsfzPZcgaE9WGTNF9++Uz7349R9 yADGPut28n2I42sXFsYqi7/lwFM1G7FqikjsPY8uNg9uCjYMAQNiOTqrB4mt6apA43A== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794198868; 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=JdXboV7qxhltwNH0LSlUGIaBkpIrFuZqTC7N4GeLyss=; b=B+EFjJs5W96p3V9B2dhO3/KK+R9ZbXFPMv48v0K96VpBQh3r1wDfe4+94yFGlNxwEyY/ k9v90PA2UuiHvLHBgKaMRTuL8/EgrBCVaYOm/7C2Kj3aGawQTtq1DCbX7sJKBorGwiIEw I5Bv0ZtUPJ5DmDDMr4K8uuUs1+TYFodXJOLTg1M+GxkEowuhcE3xT795+mVoi6N+xbVb8 TdZDKUsE+W/XQSNvEe72+nujldBIt8rfcM9N1we7d8yMRDhJHrNnSRj566QOIQ2KFYKK5 PyxGnPX4Wbn9YtlkZZdpiJJwPrwCqlkoC+GQu5fGAEz5ZW+E6gseqWyb/8XF7gE4C8A== 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=RoehDnAO; arc=fail smtp.remote-ip=198.175.65.10 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 5DC60606A31C for ; Mon, 9 Nov 2026 04:34:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5DC60606A31C 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, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=RoehDnAO DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1794198865; x=1825734865; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=a5yAsM2ArfnJ82919SOECnhUtIe1OwnTp2CXvDgUU60=; b=RoehDnAOdyPwjoGKVgcyVCFi9CaMbqfh1XtseY4UtH+1fsV/fRqe72Ws O+xHb+TKHllF+TYynnw8GGE0bkoz9wEWl4KWCpV4bZ+rZ8LyS9XtjB7hI g7zlxAsPlj8Xitg4udAJg39Es9xX50BCCKOdSei9VCA7TMYAr8o57N2fa YVnjtpCpOVOYlnwmANucA9JBHzFwo5OYqKOgNu1nLrDqT3wew6S9Aenc5 ucgRnJHoRu1PExW1uf9/G0h2kJfu0r7Ed1ntE2fwzpJaSpOiMZvLknnIL RKz+5wOX89Ujd1VvtABQwtPnQa9n6agfJhSkeq+phcuthxWmgQo5O/DdA w==; X-CSE-ConnectionGUID: px97ssUSTkeBPE1ELydq1g== X-CSE-MsgGUID: ew94hxzIQBC75gSUky2dMw== X-IronPort-AV: E=McAfee;i="6800,10657,11960"; a="2819575" X-IronPort-AV: E=Sophos;i="6.27,203,1787036400"; d="scan'208";a="2819575" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2026 20:34:24 -0800 X-CSE-ConnectionGUID: DkoXC/0+Qfitg6bQnqp0Gg== X-CSE-MsgGUID: cDMfWOS6TmGMVPkZi32fXg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,203,1787036400"; d="scan'208";a="7940071" Received: from fmsmsx901.amr.corp.intel.com ([10.18.126.90]) by fmviesa002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2026 20:34:25 -0800 Received: from FMSMSX903.amr.corp.intel.com (10.18.126.92) 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.56; Sun, 8 Nov 2026 20:34:24 -0800 Received: from fmsedg901.ED.cps.intel.com (10.1.192.143) 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.56 via Frontend Transport; Sun, 8 Nov 2026 20:34:24 -0800 Received: from CH1PR05CU001.outbound.protection.outlook.com (52.101.193.24) by edgegateway.intel.com (192.55.55.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Sun, 8 Nov 2026 20:34:24 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DtU8O0Crd9kDD2rDkwDnnNeJiptqRdnEK+PZ2wGCNbivoS/s/ITKpdoCqn+d5C6ElaslXT6wRseWD/EBRt2KtqeoG9xN1B5vFXeNZtXkXCnyN762YOzvZN9K7kZEXljKuEsKoFx/F2Aeb3CVYGv9t81jy4RjIAcH4+hxjNqhphBaLoEc4bbuUfD5fy8fLV3XNEm7c2+VZWo8LtBh4AJuepe66Pm1wv4+EcHglatcvdtfWDAroOIJLcBQ9jUK/eAY2NDG5NCZAT2sWS+8luSdzyVdSktENDSSNt7GK+mjHCLPNxrJ9KqrHNivgHE2cqu0EStg8ZzyWJZ79O1V4LZveg== 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=xdXyFIBxuV087j5YzfqQlOqvfr+ZGSU5Wqne6ftSAxM=; b=kd0XYc+k7TFbgVm+O9N99tupVGo/gCbToq117wUcPM1o2h0y8U0C1r0i+vzCYlUWWfVLOPEuGXyZ2r9ssitnjdItiE3YU/KN7Fc5abvPpoWqscTTxgo0l4g6dJF+1VjoFj2z9EyZtu6wC3U2QgsJA5xNmX2Ccdn6twiKE+eYK0SbefejyWZw+K7D6okKlBVxef+J8XsQ/h4m5aX/SXDZCmAlLmX89GVYd/tNfzQPaqWIElFRO7uc5LPnckqJ3qAG/9Ct15zaHIClkNKjZGAtBM6pr3yeuq9LFTkfjobyKkF2SZ7RirfJOOUI0ANxUBq42BuhO01iRWDKfeKNuXnMFQ== 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 CH3PR11MB196721.namprd11.prod.outlook.com (2603:10b6:610:364::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.592.13; Mon, 9 Nov 2026 04:34:22 +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.0592.010; Mon, 9 Nov 2026 04:34:21 +0000 Date: Sun, 8 Nov 2026 20:34:18 -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 24/33] drm/xe: Add defrag profiling tracepoints Message-ID: References: <20260711025619.2540575-1-matthew.brost@intel.com> <20260711025619.2540575-25-matthew.brost@intel.com> Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260711025619.2540575-25-matthew.brost@intel.com> X-ClientProxiedBy: SJ0PR05CA0002.namprd05.prod.outlook.com (2603:10b6:a03:33b::7) 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_|CH3PR11MB196721:EE_ X-MS-Office365-Filtering-Correlation-Id: b2f8099b-78aa-4446-6147-08df3e1ab9be 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|23010399003|7416014|376014|366016|1800799024|11063799006|4143699003|56012099006|261021123027099003|261021121427099003|261022105027099003|261022075727099003|261009223027099003|261026140227099003|261026121527099003|261028144727099003|261102123227099003|10067099003|18002099003|22082099003|6133799003; X-Microsoft-Antispam-Message-Info: HAC7MKkGngzdZn8p0I/DQL8Av3OD6DL/DIM5VZXVexYztpIDS2PwXFYo9X9Eqd+qkiQgj5rC/AUX/+pTSdPvg59KBO3gEDgqDr2X2APQLHKNWE2/EwGD6SB1na14fgR41CnrICqZK1xxNgALVpohQH/bgTc2pLwvbnHe3M9kWgLNFxrfi1H12pHl9ZzUQ3XZcn6vzZ8ll9x9qJ8Qqkmj7UpiLlvG8tYmSXQU5Z8/15no/Z6LfR4eW66mPzupnjf9JgsUGPFAX0LRgZufOoZ2DF57JrhB1Qul2UVFd0+4OWftBw72vGXsNTSl1e+vHjo8vaxOYcZFSbb5S+psyXsvfke9HbilfrU8IvLoVzuJI0ITkoOvd1DBSg1IsnqR/F096BTthVxAbTVlbwIATPX4CI5X1p03OnZTVy9kYQxJ9Phgfysffi/kdCXo0Y0ueV3LwVHuSXxKUkMYOdMtSYAPtjVV3jlY7aykv4Q2l2CjnyG7VsJlUB2U1DXb2w36Fk+qkmf829GgB2Y9i8GZanFj9FuGPHlZjBl8hn1CxycDRRkDpBNhXGeXzXunkJqLRJvjhXvFZadYDM0N3M6idxkOS3yf2bmf7TigrE6QwtNHibEYtMabRogPwBDunniEO0WWXNWKDRufz55A2zbTU8tJPaC3dFTf7gVs2N+u1ln6m6g= 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)(23010399003)(7416014)(376014)(366016)(1800799024)(11063799006)(4143699003)(56012099006)(261021123027099003)(261021121427099003)(261022105027099003)(261022075727099003)(261009223027099003)(261026140227099003)(261026121527099003)(261028144727099003)(261102123227099003)(10067099003)(18002099003)(22082099003)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?BUI9UQGb1vbxtGObGd6okkjCbvLKusFqkqAaBBmZtC1vHrtWdbQN77mMph?= =?iso-8859-1?Q?bgNfTs24Uc98eONFHaPp81t3e+M9j7ecMThLrGljO/UkM7DbzmmdsX27o+?= =?iso-8859-1?Q?7il3LgwDWNhEM41jvYG3pQXgkeMhvsm1pka0QsLi/NolW6m6HN3l+2kc27?= =?iso-8859-1?Q?ylqAnKHtxZ4hUlazOTKaimv0VyATxTvNFNUbKwV8fuIQ8I6EB44LPhhxXg?= =?iso-8859-1?Q?jmi1WAXW5k6UXuw7NyA+oYwRF8ciNCTbvxIey7UFui6hIhllJDqPrtvi0C?= =?iso-8859-1?Q?1Fhqkqh9IzQJ4Zu5Ta+0rR3AGTpnEcauwDTOUumE1N5EO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TuexMxW4Vpbs86CfvtttWnCd1VXcXr/lJY5J1GzTQ== X-MS-Exchange-CrossTenant-Network-Message-Id: b2f8099b-78aa-4446-6147-08df3e1ab9be X-MS-Exchange-CrossTenant-AuthSource: MW3PR11MB4684.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2026 04:34:21.7730 (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: pv71sKL+nHEqSSEu0q6ZnOxhjMelP25lF9UZ11xko3xr354MJxjOH7hipm3/FCkzoqQlkq+041HPikxVk+vm/tKF/2eSGsZlnBiAocW3lW49yQU9ye1fvRBE+v+52LCq X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB196721 X-OriginatorOrg: intel.com On Fri, Jul 10, 2026 at 07:56:10PM -0700, Matthew Brost wrote: >Add two tracepoints to profile the page defragmentation worker: > > - xe_bo_defrag_worker: emitted on worker entry and exit with the > current defrag list count and the bytes processed in the run. > - xe_bo_defrag_one: emitted per BO with the run budget, the prealloc > fill ratio (got/want) and the lock-held, lock-wait and prealloc > durations, plus the bytes consumed and the result. > >These break down the cost of a defrag attempt into its locked vs >unlocked phases, making it possible to confirm that the expensive >beneficial-order allocation and cpu cache mode change happen outside >the BO dma-resv lock and that the residual lock-held time is copy-bound >(with the tail dominated by lock-wait behind active rendering). > >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 > >--- > >v3: > - Move the ns-to-us division into TP_fast_assign() to avoid a 64-bit > divide in TP_printk() (Sashiko) >--- > drivers/gpu/drm/xe/xe_bo.c | 18 +++++++++- > drivers/gpu/drm/xe/xe_trace_bo.h | 59 ++++++++++++++++++++++++++++++++ > 2 files changed, 76 insertions(+), 1 deletion(-) > >diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c >index 8b89d34f37d4..25e5b72f870c 100644 >--- a/drivers/gpu/drm/xe/xe_bo.c >+++ b/drivers/gpu/drm/xe/xe_bo.c >@@ -1263,7 +1263,9 @@ static int xe_bo_defrag_one(struct xe_device *xe, struct xe_bo *bo, > struct ttm_placement placement; > struct ttm_place place; > enum ttm_caching tt_caching; >- unsigned int order, want = 0; >+ unsigned int order, want = 0, got = 0; >+ u64 lock_ns = 0, prealloc_ns = 0, lockwait_ns = 0; >+ ktime_t t0; > int ret = 0; > > *consumed = 0; >@@ -1294,6 +1296,7 @@ static int xe_bo_defrag_one(struct xe_device *xe, struct xe_bo *bo, > > /* Phase 2: preallocate outside the lock; */ > if (want) { >+ t0 = ktime_get(); > ret = ttm_pool_prealloc_fill(pool, tt_caching, &pp, want); > if (ret || !pp.count) { > ret = ret ?: -ENOMEM; >@@ -1301,12 +1304,16 @@ static int xe_bo_defrag_one(struct xe_device *xe, struct xe_bo *bo, > XE_GT_STATS_ID_DEFRAG_FAILED_COUNT, 1); > goto out_err; > } >+ prealloc_ns = ktime_to_ns(ktime_sub(ktime_get(), t0)); > } > > /* > * Phase 3: re-take the lock, re-check, and validate using the prealloc. > */ >+ t0 = ktime_get(); > xe_bo_lock(bo, false); >+ lockwait_ns = ktime_to_ns(ktime_sub(ktime_get(), t0)); >+ t0 = ktime_get(); Here only phase 3 locking is profiled. What about phase 1 locking? Niranjana > > if (!xe_bo_needs_defrag(bo)) { > xe_bo_defrag_remove(bo); >@@ -1362,9 +1369,13 @@ static int xe_bo_defrag_one(struct xe_device *xe, struct xe_bo *bo, > > unlock: > xe_bo_unlock(bo); >+ lock_ns = ktime_to_ns(ktime_sub(ktime_get(), t0)); >+ got = pp.used; > out_err: > ttm_pool_prealloc_fini(pool, &pp); > out: >+ trace_xe_bo_defrag_one(bo, budget, want, got, lock_ns, prealloc_ns, >+ lockwait_ns, *consumed, ret); > return ret; > } > >@@ -1396,6 +1407,9 @@ static void xe_bo_defrag_worker(struct work_struct *w) > return; > } > >+ trace_xe_bo_defrag_worker(xe, 0, atomic_read(&xe->mem.defrag.count), >+ true); >+ > /* > * Process at most XE_BO_DEFRAG_SIZE_LIMIT bytes of newly (re)allocated > * backing per run rather than draining the whole list in one go. Only >@@ -1503,6 +1517,8 @@ static void xe_bo_defrag_worker(struct work_struct *w) > > xe_pm_runtime_put(xe); > drm_dev_exit(idx); >+ trace_xe_bo_defrag_worker(xe, defrag_bytes, >+ atomic_read(&xe->mem.defrag.count), false); > } > > static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, >diff --git a/drivers/gpu/drm/xe/xe_trace_bo.h b/drivers/gpu/drm/xe/xe_trace_bo.h >index 86323cf3be2c..b159d37d39a1 100644 >--- a/drivers/gpu/drm/xe/xe_trace_bo.h >+++ b/drivers/gpu/drm/xe/xe_trace_bo.h >@@ -85,6 +85,65 @@ TRACE_EVENT(xe_bo_move, > __get_str(new_placement_name), __get_str(device_id)) > ); > >+TRACE_EVENT(xe_bo_defrag_worker, >+ TP_PROTO(struct xe_device *xe, u64 defrag_bytes, int count, >+ bool enter), >+ TP_ARGS(xe, defrag_bytes, count, enter), >+ TP_STRUCT__entry( >+ __string(dev, dev_name(xe->drm.dev)) >+ __field(u64, defrag_bytes) >+ __field(int, count) >+ __field(bool, enter) >+ ), >+ TP_fast_assign( >+ __assign_str(dev); >+ __entry->defrag_bytes = defrag_bytes; >+ __entry->count = count; >+ __entry->enter = enter; >+ ), >+ TP_printk("dev=%s %s defrag_bytes=%llu count=%d", >+ __get_str(dev), __entry->enter ? "enter" : "exit", >+ __entry->defrag_bytes, __entry->count) >+); >+ >+TRACE_EVENT(xe_bo_defrag_one, >+ TP_PROTO(struct xe_bo *bo, u64 budget, unsigned int prealloc_want, >+ unsigned int prealloc_got, u64 lock_ns, u64 prealloc_ns, >+ u64 lockwait_ns, u64 consumed, int ret), >+ TP_ARGS(bo, budget, prealloc_want, prealloc_got, lock_ns, >+ prealloc_ns, lockwait_ns, consumed, ret), >+ TP_STRUCT__entry( >+ __string(dev, __dev_name_bo(bo)) >+ __field(size_t, size) >+ __field(u64, budget) >+ __field(unsigned int, prealloc_want) >+ __field(unsigned int, prealloc_got) >+ __field(u64, lock_us) >+ __field(u64, prealloc_us) >+ __field(u64, lockwait_us) >+ __field(u64, consumed) >+ __field(int, ret) >+ ), >+ TP_fast_assign( >+ __assign_str(dev); >+ __entry->size = xe_bo_size(bo); >+ __entry->budget = budget; >+ __entry->prealloc_want = prealloc_want; >+ __entry->prealloc_got = prealloc_got; >+ __entry->lock_us = div_u64(lock_ns, 1000); >+ __entry->prealloc_us = div_u64(prealloc_ns, 1000); >+ __entry->lockwait_us = div_u64(lockwait_ns, 1000); >+ __entry->consumed = consumed; >+ __entry->ret = ret; >+ ), >+ TP_printk("dev=%s size=%zu budget=%llu prealloc=%u/%u lock_us=%llu lockwait_us=%llu prealloc_us=%llu consumed=%llu ret=%d", >+ __get_str(dev), __entry->size, __entry->budget, >+ __entry->prealloc_got, __entry->prealloc_want, >+ __entry->lock_us, __entry->lockwait_us, >+ __entry->prealloc_us, __entry->consumed, >+ __entry->ret) >+); >+ > DECLARE_EVENT_CLASS(xe_vma, > TP_PROTO(struct xe_vma *vma), > TP_ARGS(vma), >-- >2.34.1 >