From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=198.175.65.15 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796073241; b=w5uK15gSD1AOM5InzOicJeDdxDCASwWu71LBtpi4X4NC8GqLQK19mB9L9b1qhLUsTRiD /QtmkrVZLOEoqrPzEAE4x53rB1+XgLsL6l6901gR17kqc+yezM+0upgRst/WpOg3aEGGK pnhjTfya5KubQttlfsH0SMG/50FMrLjVSY6tez80XvGIpgn0hJ3F/B/sNskfY3Bdnm5br HlKIpzg4n8QkTMVcvvAm5U/NFrw0mdiHm5UtKYAJWrqzfVv8HuKeEQE6t7n40BXqSeGKR Rx8+tjOkUaZohEHnWlnYWb8iM2xZwxGiIGW5GXonq6AJ32DKyk2PVilFN0lFVjEs45w== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796073241; 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=kffbYPaVeEKMBW2aMlrO73FLmbSk2Jj0DBCwqfYJGRA=; b=yiugeBVHl6DE6zYdb1FfTbWQloaVviMvD6g7vIIc+JhadrF5jCx4NbNrzFgTSPkr6vHP pTJUhJ+B3zn6MztkR8BUiaBYRh1e/0vAFL4iqxQqHjGDkR9apeuWLlflNlLMbiAaPmRHE PBjGHZ9GjGdvXEhZO/EtgBEM22CFkYnMFtGuXqHPTCJc0yfqF3IFDnWMOtP+bla6DAooO AVPR+E/Q1j0zNTot/b18E3nl+g0airdiFpQhusLfFPA2PrHuQOrTuBuPGql6whWBXJ834 Q8QH8jZCezA5Yl8zz1xCcL/a07YAcwqmOqMyaIJxD9t0d84ubxGavh/yAjTWxYYPNOA== 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=enpfGHKh; arc=fail smtp.remote-ip=198.175.65.15 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 5A4B8606A31A for ; Mon, 30 Nov 2026 21:14:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5A4B8606A31A 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=enpfGHKh DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796073242; x=1827609242; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=kffbYPaVeEKMBW2aMlrO73FLmbSk2Jj0DBCwqfYJGRA=; b=enpfGHKhhdxl7Ol7igwQxRVTcOxsLJ/ZnKcpFtuRVEdbce3ygq3s+kp3 9T0LQrtav2OErwdj3c5XE7Mw3Bhd3nmb7CmIggIUeDjTljm9gPLRNIi7H 5hwle4Ij+HEDzv/PxzUs5FCqwE8uP+4RjzvphpWBt7R2avK8FyKXF7Uqh G83BbGusjP4TudH7j/NPc2a0EH1LGb8lgiFsSXrJS7Kj6+QPAOD2fn2Sf di9sR/qIFLfKMrHXKI/8uld4FKJuZsNmD3ccCvDSygRIXmiE8A6+QMVai U/L3yOEGkPlnApXtNFcajPZGYMtF9n1hABWyaXUoy2I5PcVCXSiG7DBVW Q==; X-CSE-ConnectionGUID: fopDYbHCRxCwWRXKubPwNQ== X-CSE-MsgGUID: 9ukztZkZSP+zDlEFfJ0htQ== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4913918" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4913918" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 13:14:01 -0800 X-CSE-ConnectionGUID: 5OGIjOdPR+aOMdrrTAojWg== X-CSE-MsgGUID: bgQBktsfRbS6OUcnBUGAOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="13268322" Received: from orsmsx901.amr.corp.intel.com ([10.22.229.23]) by fmviesa003.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 13:14:00 -0800 Received: from ORSMSX903.amr.corp.intel.com (10.22.229.25) by ORSMSX901.amr.corp.intel.com (10.22.229.23) 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 13:13:59 -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; Mon, 30 Nov 2026 13:13:59 -0800 Received: from DM1PR04CU001.outbound.protection.outlook.com (52.101.61.41) 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; Mon, 30 Nov 2026 13:13:59 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YXm/7cpL9mRSmSFalX21r7v3RvoIGMeF3LJu4Ebu1PX2Y5wAaMyFQWdgJbnoSeHPCmHt2zt4BX/SVTOXzxmXBVcv0xwfzIEtN9T9gTc84EgjS1yUO7Iv7JiPDslboODvrPjFmUWtSBjUDHyDCmZ/q6RgPycNGqwfWlgkb5taXOD6QBgZ8koTNxnebytTOYCPPItGAxEhfhNBHzKuRWnm4pQAH6DZi5J1Fro4vdbrFbXloi2Fx3aS/I9kHs/x5SGPNikA77z+V4sOk97CjGswotq+T4jJ8yqoXZ6WGte+XTdJibRxZqlZNbr/kdo/rHXvCDd+jqLghfiKweKoQse3gw== 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=9ZWfopoHYYKLT99rVoEXDGgmr+38/UyTm48PeOyuARw=; b=ufIeFZsrEbkbltzSn2rVw2Zx4sRiAnh+Itdiv9aOEW3rGb/1TX2FvS1RptzJwzV2uQKuAgNrr7nAMytkeMh6MM6ujy8KLnS+2GNfWfY7ZzdPXbtq71cgnlJyjXwlN2BX55cw+wvowqdRqTznKfJAFhjZ7GEUfAM/ZNk4VFdiVMq61FB7VKnEsDeLUS2aWIYTsoGVKWbGNkzFQ688cGFkqkwMxwUm7aurkR+04A6fUUvNhrny1iUNE7V2RrW3S1brsGGfX9cvdzwBHf1FWFfLj8SZHP33/UPq1/3VBytGOgkniFE8GEeZYI3OD1jEXFx2TUZvj1wjHw9gXtZz4MYDmQ== 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 SA7PR11MB9595.namprd11.prod.outlook.com (2603:10b6:806:4d0::11) 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 21:13:56 +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.0662.012; Mon, 30 Nov 2026 21:13:56 +0000 Date: Mon, 30 Nov 2026 13:13:54 -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: X-ClientProxiedBy: BY1P220CA0004.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:59d::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_|SA7PR11MB9595:EE_ X-MS-Office365-Filtering-Correlation-Id: e0a0f717-3057-4e39-9fb5-08df4f26d823 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|366016|1800799024|7416014|376014|23010399003|10067099003|56012099006|11063799006|261021121427099003|261026140227099003|261021123027099003|261009223027099003|261026121527099003|261028144727099003|261102123227099003|261022105027099003|261022075727099003|22082099003|18002099003|4143699003|6133799003; X-Microsoft-Antispam-Message-Info: 9TphRfQWwkTzDgg4Z/hnPQ6WC6srh2/FtwzK5oS9IhS/xGBAKvJLiYB/vHqmSrXG2O1dLPQgY10vWzx/xKpfxMza86mryUeR0dSc4aWQP4iaskLc5nYsSL5OfXDv2tnfIiIxIJqA4udvrYIs/fI7zp/8SXD+HI9hSEsuLf4r4XLAWveEnTIjmBq3eHajtruMt5GnZc1m/qpM3i8XODVYiK2FomVo8GU7qKfD1BxRLqNYzdT/l3yV8xIgnl1Sw974QA42ZoeNMUWCaE4aI8JEdLO/xa79iUgsue7fSkKBcWQqzjg9iPQ7gKpRCkK2IC4FdZL4VJX9TtyUTM8S3Cvj20ayac69tCNUTyIkYniTp61RbGqbOmHC4BaJdr6W1RvlHfSn8EmvMHRIfxiB0DqUruxUPCSQuJg7d2ZyLeDkUIxfEXZzt+zsR1AEyYCdtldVcM9Cd8qQgjUOPmaPOzDnZarf8wq0cP/a/EfjJyp5AvvH7mxleCkWopT0j9Dqms7NYKoGV8IPrbH/ZV9zVn7jAONQUNM/o+R1EOz7pjP9IdLs2TJ7bi9GPsc8s6Y8085DZdPv22RBIUiS3kGUMAEkMSb2ZVRhvZgYCnV694Gx7sKv5iL0kj0Uf9Hq1QwuOcgkf5wn045sVhpMyvcRZUIey2g4vU+c4uv8W+ou/Fn1H+Y= 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)(366016)(1800799024)(7416014)(376014)(23010399003)(10067099003)(56012099006)(11063799006)(261021121427099003)(261026140227099003)(261021123027099003)(261009223027099003)(261026121527099003)(261028144727099003)(261102123227099003)(261022105027099003)(261022075727099003)(22082099003)(18002099003)(4143699003)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?3oijWdoxLZdDTbB5fgmGgdhRHo34HHxoAaxjDLSB8L1/SHt51YIItdvBef?= =?iso-8859-1?Q?Beh9ytIRCFzoHklOr4/iRKm9Jsrs3HynXLiqabJDtHuynNjVHzOsx5M/d0?= =?iso-8859-1?Q?GrhRrNKhzwxdhMTqOjj86Wtu85JWHNMkAjABc/nI6uv9k14OWPAW+/ic56?= =?iso-8859-1?Q?GcD/6EAjj6fsdQm9nabCNOrXDoeEW9imzqCA7Jq55M7BgGkLR345d+rUp+?= =?iso-8859-1?Q?XxYyz8X2Foqqk1xGuZK5jWx/StKI5N+mpFuG5S516f526JyhU8/GbZGa8l?= =?iso-8859-1?Q?vhOVQiWYERPpUBlCrKQBW5xwMlEnZVaSWV0jRNBTia1BBoR7hr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Vi23z6vr4XliAXe8+VF2HPvIG0mbQOwHX8VdSdPxWgHjXiPQ3IBBty01BzHeEOcSg== X-MS-Exchange-CrossTenant-Network-Message-Id: e0a0f717-3057-4e39-9fb5-08df4f26d823 X-MS-Exchange-CrossTenant-AuthSource: MW3PR11MB4684.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 21:13:56.5154 (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: 0qWe9ayitaX7rt8JasbtHx1VXBZQvkGlLDvXNzPlXpPmR/IJmSIrDWNIr0nNQ+LyemSJv0YJEWB15UAYNmICvyN5W7tC0RpYn759JpWlPRt1RobJt6PaJupClAD2X9ab X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA7PR11MB9595 X-OriginatorOrg: intel.com On Tue, Nov 24, 2026 at 12:42:30PM -0800, Matthew Brost wrote: >On Sun, Nov 08, 2026 at 08:34:18PM -0800, Niranjana Vishwanathapura wrote: >> 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? >> > >Phase 1 consists of a series of very small, time bounded checks >performed under lock for stability, which should be extremely fast. > >Phase 3 is interesting part as we perform dma mapping, formulate a copy >job, and internally update the TTM bookkeeping. If this part takes too >long (several ms) we could risk missing page flips as compositor could >be waiting on the same lock. Fortunately iirc for most BOs the lock is >held for less than 100us. So this is part we really need ftrace points >for profiling. > Ok, but, given phase 1 involves locking, we might spend significant time waiting for the lock. Not sure how useful this phase 1 locking time profiling will be though. Niranjana >Matt > >> 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 >> >