Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9A6AC3ABC0 for ; Wed, 7 May 2025 20:14:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9CEC310E88D; Wed, 7 May 2025 20:14:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="csTPrqTi"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5A7D10E1C4 for ; Wed, 7 May 2025 20:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1746648857; x=1778184857; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/8ibjK0Q351KkXZAY9yCHVaVOMZfcIK72Y4gkOzHMw8=; b=csTPrqTi4cau2qb4W1yC8lg26QuZa1bBVMEQqgdBFyBPoXI3z8DGk7PI MshEACng8CDatKj8WfmbxMhDXZJTLHcojkQb3xkskylJ+FHpC2S+NOjf9 Rlh0ZAMqxK1akCcUEQq/dxBuxF41jF9wuUWw7VaW0qu69PrB6fVnHE7x3 u4GsX9NmXYpt/+jirFO5lwiI5q7MPqKZlSHK4cDuXjUe+scetStMyva/i h00JAN4Y0G3ICaLGfulGSgwyBBj7Cg+OwrzZ2c5VKSeh1eqZPTmPesd66 teoNxuxuORyhn8LhukEBCVluRGsmWUwr0BPS60LoHXsNrh3dDE4tV1gz8 g==; X-CSE-ConnectionGUID: c41G8TAhS8q52a2F1F4COw== X-CSE-MsgGUID: 2F7aFUkGRzmg/8T6xZtmyQ== X-IronPort-AV: E=McAfee;i="6700,10204,11426"; a="65935085" X-IronPort-AV: E=Sophos;i="6.15,270,1739865600"; d="scan'208";a="65935085" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2025 13:14:17 -0700 X-CSE-ConnectionGUID: GUs+fDPiQqiPx3kKDTcgzQ== X-CSE-MsgGUID: vSnsHkJHQBSKLC5Rm+E5Qw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,270,1739865600"; d="scan'208";a="136571007" Received: from lstrano-desk.jf.intel.com ([10.54.39.91]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2025 13:14:16 -0700 From: Matthew Brost To: intel-xe@lists.freedesktop.org Cc: jose.souza@intel.com, carlos.santa@intel.com, sushma.venkatesh.reddy@intel.com Subject: [PATCH v4 4/9] drm/xe: Add pat_index to properties line in VM snapshot capture Date: Wed, 7 May 2025 13:15:34 -0700 Message-Id: <20250507201539.1316770-5-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250507201539.1316770-1-matthew.brost@intel.com> References: <20250507201539.1316770-1-matthew.brost@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" Add pat index to properties line in VM snapshot capture indicating the VMA caching properites. This is useful information for debug and will help build a robust GPU hang replay tool. The current format is: []: ||mem_region=0x%x|pat_index=%d Permissions has two options, either "read_only" or "read_write". Type has three options, either "userptr", "null_sparse", or "bo". Memory region is a bit mask of where the memory is located. Pat index corresponds to the value setup upon VM bind. Cc: José Roberto de Souza Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_vm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index 842e482b60b2..0675c46b7c63 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -3732,6 +3732,7 @@ struct xe_vm_snapshot { #define XE_VM_SNAP_FLAG_IS_NULL BIT(2) unsigned long flags; int uapi_mem_region; + int pat_index; struct xe_bo *bo; void *data; struct mm_struct *mm; @@ -3774,6 +3775,7 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm) snap->snap[i].len = xe_vma_size(vma); snap->snap[i].flags = xe_vma_read_only(vma) ? XE_VM_SNAP_FLAG_READ_ONLY : 0; + snap->snap[i].pat_index = vma->pat_index; if (bo) { snap->snap[i].bo = xe_bo_get(bo); snap->snap[i].bo_ofs = xe_vma_bo_offset(vma); @@ -3875,7 +3877,7 @@ void xe_vm_snapshot_print(struct xe_vm_snapshot *snap, struct drm_printer *p) for (i = 0; i < snap->num_snaps; i++) { drm_printf(p, "[%llx].length: 0x%lx\n", snap->snap[i].ofs, snap->snap[i].len); - drm_printf(p, "[%llx].properties: %s|%s|mem_region=0x%lx\n", + drm_printf(p, "[%llx].properties: %s|%s|mem_region=0x%lx|pat_index=%d\n", snap->snap[i].ofs, snap->snap[i].flags & XE_VM_SNAP_FLAG_READ_ONLY ? "read_only" : "read_write", @@ -3884,7 +3886,8 @@ void xe_vm_snapshot_print(struct xe_vm_snapshot *snap, struct drm_printer *p) snap->snap[i].flags & XE_VM_SNAP_FLAG_USERPTR ? "userptr" : "bo", snap->snap[i].uapi_mem_region == -1 ? 0 : - BIT(snap->snap[i].uapi_mem_region)); + BIT(snap->snap[i].uapi_mem_region), + snap->snap[i].pat_index); if (IS_ERR(snap->snap[i].data)) { drm_printf(p, "[%llx].error: %li\n", snap->snap[i].ofs, -- 2.34.1