Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=192.198.163.16 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796270613; b=A4L90i2pEheYyA1IDGBsNfSeE/mprXHGuaKPpPt6HXvV3U3EOoyrRXdQCRKBY0Mf+g/7 Zf/2D7nw3oSIEWqVzOc6G/2vuPQspv5TZJZyCLGMDz6QsnrSg6zo5JakCUOHFcAQ5ZQ/8 MBcH0dU+9YT2Q91USSlu/9r+RO8+s3XyFAiTbjEhbixh1yitVkNexOJOUI3uKIhg+8IJh QEp4Q8SJd1u16UwKGNFVPHEHLBKt4W2qQg2t29kSsc9n9DsHI7fzeUBCnXT5dFf1tF55F LmaHjYQ+WHNVOgryY5XQGaMvPKHpwAV/WDhIjKmvFn+lDcDMvMs/wfnIgkaLTanNC9w== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796270613; 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=3wC/QYoY7hytsIXS/5eSNfpIyDKiuRBht/TRqJYrSyw=; b=SVm1B2o5F46KXQA9LsVFP/VLCZV4JZShrylCFasluHOl9PYJNtn2GvUC+OgkyOk997Ac 1UxOdSGpssFzKcq9fqX0RmVj+rycshAWoW4P0ZGk+FlxravKckyWdmdpF8EmYZeaSxqfw 5jVeC+005DQ4WorBo+28PgLYdu/rD4QTtl3LSZ6H+founXyRviW9dWsIdR22g0Xbzqu0M 9PHk97AC4z4C6NukH9nT6tE7XsOzxPbomu/YRTNkTpnyRKPNrk9bFy6Ncm68FNyJoiR7v SsutKPenedmHr6ZNBrxErAnyfCpenalHn+wsox8JpC1BWmavXlF1Y1AdFv0NT5vihwA== 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=XSQXBnq+; arc=fail smtp.remote-ip=192.198.163.16 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 ED093606A32F for ; Thu, 3 Dec 2026 04:03:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ED093606A32F 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=XSQXBnq+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796270613; x=1827806613; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=3wC/QYoY7hytsIXS/5eSNfpIyDKiuRBht/TRqJYrSyw=; b=XSQXBnq+4V+Bv9T/PHOjgbFD7l8b4059xYxYndZcbhPeXIPP1AEdQmGA I6s5ZnD/9RYUEA5vOZTkC93aGG4rCPh97Lkwz7Legj46LEzAke+srroTf s3/ct536jQn1fNDabN/ZieBI79fYShU4q0ecO5MZ7n7S8uOmtP2RhkG9A WtB5c9D8fR5BJT2gtPn7zrROpWfAMh2BS22eWIu2nBRUn8NrlGpiS6yuh P50Ug4+oaCBTtIWx3Z8oFzuyXqtaK8teqr6EusNgZBAm+/7LZzBLJOy7Z SWJSCfrjTyDFGoDgq8gcLLHlD+Q6emiwWMefRORp+xfz3LpdHAOYAruey Q==; X-CSE-ConnectionGUID: r9Qph9ksRFyCRHAuUBg6Ag== X-CSE-MsgGUID: ZaT1x4KoQbCF98vUYf+obA== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5219846" X-IronPort-AV: E=Sophos;i="6.27,247,1787036400"; d="scan'208";a="5219846" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 20:03:32 -0800 X-CSE-ConnectionGUID: i2Xru3H2QoqAsUKrnrVeng== X-CSE-MsgGUID: Ucn4VeINTSu68DH7nsP2Bg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,247,1787036400"; d="scan'208";a="13499305" Received: from fmsmsx901.amr.corp.intel.com ([10.18.126.90]) by orviesa008.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 20:03:32 -0800 Received: from FMSMSX901.amr.corp.intel.com (10.18.126.90) 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; Wed, 2 Dec 2026 20:03:30 -0800 Received: from fmsedg901.ED.cps.intel.com (10.1.192.143) 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; Wed, 2 Dec 2026 20:03:30 -0800 Received: from SN4PR2101CU001.outbound.protection.outlook.com (40.93.195.28) 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.57; Wed, 2 Dec 2026 20:03:29 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o9im705JmWrEV7ezLWWSzL30N5u0XSahi+E3DDatJTNdaKQc8efa3mo2T2RkeH68a/s67IYQLm6rxatdYG5yggDrhxmd4KTYFXMrQFCO/IFG74krvZr9OHzZHDzkrCg8I30TUcpZWY6lGcP5fI/Y8Jg7RKipLbk5ZC7ru082gXpZMbIAyYqo+Iqd3VvAqKBv4RalCwR7OmdgPQ5CDZIiznk5/4sL3zxAJArjfMa+e0MCGt/Cfjg3bOG+hMGEdsSOy+vIzRU0GPMPmpf/aaRfdYuJz6apNJCqns6aZt5DkxBcIZ+We7QxK3BPr5FLRUv7PZ9BvPct/7CFrL5soFlUkw== 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=ZISRouvI8CuHzt7wrLAdIKzYIlu+Np/ALKAN2uRsSb4=; b=NyjCbn3E9l1mUh5YU1ot/6YXwV5U6a/CHpgbjaExDdPbVFxHJWjXSXwudPpzy/7B2bBy70WFFnJARF2mcezQV1vhoFerdY9O37L+4X0H5quGkiFVFtyebJ2VMOfhUD5O9mRBrUU8AQRd97HFWRXnMl4EPL55wGn5SLz05fTkWlXfpuEq6K21rrRKOeuBv3tsgznmqDI5uHodldOYDVBAc7YceC/crGczIs/FCMAuNznfyuKW3/VmfdSmQs1Mhd3QMQxGIjYlUSE+i5Cd7q3wDpJh8dYRwHLbsGoOIe95CPh4LM1YC4qmzWuhZqcngDXBYK0mocSDsHrkWic8Et+zng== 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 MW4PR11MB6958.namprd11.prod.outlook.com (2603:10b6:303:229::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.11; Thu, 3 Dec 2026 04:03:24 +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.010; Thu, 3 Dec 2026 04:03:24 +0000 Date: Wed, 2 Dec 2026 20:03:21 -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 v5 22/36] drm/xe: Add defrag profiling tracepoints Message-ID: References: <20261202233323.3743190-1-matthew.brost@intel.com> <20261202233323.3743190-23-matthew.brost@intel.com> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261202233323.3743190-23-matthew.brost@intel.com> X-ClientProxiedBy: SJ0PR13CA0010.namprd13.prod.outlook.com (2603:10b6:a03:2c0::15) 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_|MW4PR11MB6958:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a4a8566-db6f-459f-0632-08df50f26064 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|366016|23010399003|1800799024|10067099003|260925022911599003|260925021911599003|260925021311599003|56012099006|261021123027099003|261021121427099003|261022105027099003|261022075727099003|261026121527099003|261026140227099003|261009223027099003|261028144727099003|261102123227099003|22082099003|18002099003|11063799006|4143699003|6133799003; X-Microsoft-Antispam-Message-Info: 8Z8ikOGOPWR30ftNZtOmH97W+cdubAVDIMfT7a4F7o0X9M+5mEDueUKam/OATUXRtb/SBslzGefYHVDVV1ZJ1ZLIOMIc19aFFmkBUTSeoZJWkhmH9FY0PfIAuW4DHQTWhnpw9pxD7WKuXi33Q16uIfHVm0x3Cw34Wwx8hX0hRGwguqlAjWu80pc0/DobDXawrUScja6PNk2+q+1DWftx8nZj9cljBMUmvTUrxcg1DSa0hAp0IbzCHhh79olMw/NCAhjmqnIliLmo5O81plA/dNb3rhJ3ocGR8yyzF4fH0W2x+u1BE5txTxM52K4o4Bo6hM6+HWuTyy0KkSDZfgGTMp9QR5k3Ah+U6gfAOUhIfV0cgsm9nKaWlKYUj5ScSQLDlxHG0dYFMWgl4XDeNN4cmFsfoPwTG+MwLpkGxtHcnwPZMhTNNL/arKGwoBgdefccum24jU19hPVXRyww5nWaX5m7VAvrVw5IvOW2NfVXkFREX3/64jc9O4W4qcDcKmx91oApEQxWZwvSEv5q7kmI4BZIytgTrbAPN/HyQIU0PwdeHIlk2tQqW5XrlZDTLVNmI0yXf++c12cnGq1rUJirRJWsPzTX3BETpPpY4PHZcRXuHERqApjmso6wWRmCU9cYXxhBCIErOE/LNQ5ptDEmB/cy8u6CzQVKOTXX42E7abU= 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)(376014)(7416014)(366016)(23010399003)(1800799024)(10067099003)(260925022911599003)(260925021911599003)(260925021311599003)(56012099006)(261021123027099003)(261021121427099003)(261022105027099003)(261022075727099003)(261026121527099003)(261026140227099003)(261009223027099003)(261028144727099003)(261102123227099003)(22082099003)(18002099003)(11063799006)(4143699003)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?y4aXugwImhrG++kOYvzP76HkUQSJpzUDNdNps/keE00mauulivOzI2autK?= =?iso-8859-1?Q?2y2C1XF7yV4VjelBKx0tlNpNZpo6aJ85LHumpA6SMIwHsnFRw3phhmJ4fl?= =?iso-8859-1?Q?OSLHqKx+pIGRZUh89bK/tSGxRvunv9gRVjIlwDcnp2U3SNMog1Emc2kp+S?= =?iso-8859-1?Q?1h59M9WwLGiAedacivgG8d1TE1B0vJfPEnBk/RtIys01Htmculg1Sf1UfV?= =?iso-8859-1?Q?mYF4MjtS0VM/FlKAMMsyoBsscUae4nfbFnTnzMsOyIKIiNAfyuHYBNyUKl?= =?iso-8859-1?Q?imPY2UpGY8D28AeosmBG/d5mBXk2nxSz2VYXiYV8mZSR4v07WWQ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Pmoq/2r8WE97IHzANyuAzApax1z4nffPN8pzkK+mow== X-MS-Exchange-CrossTenant-Network-Message-Id: 4a4a8566-db6f-459f-0632-08df50f26064 X-MS-Exchange-CrossTenant-AuthSource: MW3PR11MB4684.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 04:03:24.5050 (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: c55yYlb9uDSAnGbl7APHE/Z7qDozDnwjBjzyGBsVZapkeD5ghMsQA98QfdxIJ/hZxGCQ3ypWnaTqhccYjDRgob/VsAUcAzAiCbTvtrdVtkm54eYbdZQHxRtYTF39xI14 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6958 X-OriginatorOrg: intel.com On Wed, Dec 02, 2026 at 03:33:09PM -0800, Matthew Brost wrote: >Add two tracepoints to profile the page defragmentation worker: > > - xe_bo_defrag_worker: emitted on worker entry and exit with 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). > >v4: > - Drop count from trace point > - Add phase 1 to lockwait_us (Niranjana) >v5: > - Reword commit (Sashiko) > - Use pp.count rather than used (Sashiko) > - Record prealloc_ns regardless of failure (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 | 18 +++++++++- > drivers/gpu/drm/xe/xe_trace_bo.h | 56 ++++++++++++++++++++++++++++++++ > 2 files changed, 73 insertions(+), 1 deletion(-) > >diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c >index f3ce4e7ed98d..bf8078635932 100644 >--- a/drivers/gpu/drm/xe/xe_bo.c >+++ b/drivers/gpu/drm/xe/xe_bo.c >@@ -1515,7 +1515,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; >@@ -1527,7 +1529,9 @@ static int xe_bo_defrag_one(struct xe_device *xe, struct xe_bo *bo, > * the run's byte budget. Then drop the lock so the high-order, possibly > * reclaim/compaction stalling allocations happen unlocked. > */ >+ t0 = ktime_get(); > xe_bo_lock(bo, false); >+ lockwait_ns = ktime_to_ns(ktime_sub(ktime_get(), t0)); > if (!xe_bo_needs_defrag(bo)) { > xe_bo_defrag_remove(bo); > xe_bo_unlock(bo); >@@ -1556,7 +1560,10 @@ static int xe_bo_defrag_one(struct xe_device *xe, struct xe_bo *bo, > xe_bo_unlock(bo); > > /* Phase 2: preallocate outside the lock; */ >+ t0 = ktime_get(); > ret = ttm_pool_prealloc_fill(pool, tt_caching, &pp, want); >+ prealloc_ns = ktime_to_ns(ktime_sub(ktime_get(), t0)); >+ got = pp.count; > if (ret || !pp.count) { > ret = ret ?: -ENOMEM; > xe_gt_stats_incr(xe_root_mmio_gt(xe), >@@ -1567,7 +1574,10 @@ static int xe_bo_defrag_one(struct xe_device *xe, struct xe_bo *bo, > /* > * 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(); > > if (!xe_bo_needs_defrag(bo)) { > xe_bo_defrag_remove(bo); >@@ -1630,9 +1640,12 @@ 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)); > 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; > } > >@@ -1660,6 +1673,8 @@ static void xe_bo_defrag_worker(struct work_struct *w) > return; > } > >+ trace_xe_bo_defrag_worker(xe, 0, 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 >@@ -1762,6 +1777,7 @@ 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, 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 36fc7eb65882..e21aa96d9d6f 100644 >--- a/drivers/gpu/drm/xe/xe_trace_bo.h >+++ b/drivers/gpu/drm/xe/xe_trace_bo.h >@@ -90,6 +90,62 @@ 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, bool enter), >+ TP_ARGS(xe, defrag_bytes, enter), >+ TP_STRUCT__entry( >+ __string(dev, dev_name(xe->drm.dev)) >+ __field(u64, defrag_bytes) >+ __field(bool, enter) >+ ), >+ TP_fast_assign( >+ __assign_str(dev); >+ __entry->defrag_bytes = defrag_bytes; >+ __entry->enter = enter; >+ ), >+ TP_printk("dev=%s %s defrag_bytes=%llu", >+ __get_str(dev), __entry->enter ? "enter" : "exit", >+ __entry->defrag_bytes) >+); >+ >+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 >