Message ID | 20250325222724.93226-1-jonathan.cavitt@intel.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <dri-devel-bounces@lists.freedesktop.org> 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 CE3C9C36011 for <dri-devel@archiver.kernel.org>; Tue, 25 Mar 2025 22:27:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1978910E60C; Tue, 25 Mar 2025 22:27:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Lzo/b9ZW"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 42E8110E605; Tue, 25 Mar 2025 22:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742941646; x=1774477646; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+nxq8QCq9XmGTTfqgBcBAT+oe6S8Pr4x+sDlS/gKb8g=; b=Lzo/b9ZWlB+EPRPlk7aHxiHq8Xj1NiqSefxqYNWW1gZOQECMzrd53T8B bMdm8hrWKv7KoLXc4+9sIqvUOGsj6a0bH1geQGHaN3vD2yx1cIUVZibix CybFS6gpBRlrie/53opnvJje89ZWmoRYUBUEemnGG1Oh8IHGsk5wlfGuI N1PeCOHA/ip6harz0jqdVCDGxm4tG5nqo0uUe9U/3NZPDYM9EkdEEcGmD Sf8DjRx9CuMw4rjAkQ5N4SBvmU8v5LPeaz2r1K8ZrZoj9/3UN5QvuZFty Tgf99n9woWZsua0I6heU4JXycv2k+5c0vRylAmjJhVu2kVVyB6lQMiGWt A==; X-CSE-ConnectionGUID: BheNscdVT0C9En7lpdoc0g== X-CSE-MsgGUID: 8dVB1OYxSkqcRKhP4RB69g== X-IronPort-AV: E=McAfee;i="6700,10204,11384"; a="44369290" X-IronPort-AV: E=Sophos;i="6.14,276,1736841600"; d="scan'208";a="44369290" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2025 15:27:25 -0700 X-CSE-ConnectionGUID: FUUi4oyTQaqnTmx/nLRsVQ== X-CSE-MsgGUID: FSGAlksuTD2StNANBEe8rA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,276,1736841600"; d="scan'208";a="129561839" Received: from dut4086lnl.fm.intel.com ([10.105.10.68]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2025 15:27:25 -0700 From: Jonathan Cavitt <jonathan.cavitt@intel.com> To: intel-xe@lists.freedesktop.org Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com, jonathan.cavitt@intel.com, joonas.lahtinen@linux.intel.com, matthew.brost@intel.com, jianxun.zhang@intel.com, shuicheng.lin@intel.com, dri-devel@lists.freedesktop.org, Michal.Wajdeczko@intel.com, michal.mrozek@intel.com, raag.jadav@intel.com, john.c.harrison@intel.com Subject: [PATCH v13 0/6] drm/xe/xe_vm: Implement xe_vm_get_property_ioctl Date: Tue, 25 Mar 2025 22:27:17 +0000 Message-ID: <20250325222724.93226-1-jonathan.cavitt@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> |
Series |
drm/xe/xe_vm: Implement xe_vm_get_property_ioctl
|
expand
|
Add additional information to each VM so they can report up to the first 50 seen faults. Only pagefaults are saved this way currently, though in the future, all faults should be tracked by the VM for future reporting. Additionally, of the pagefaults reported, only failed pagefaults are saved this way, as successful pagefaults should recover silently and not need to be reported to userspace. To allow userspace to access these faults, a new ioctl - xe_vm_get_property_ioct - was created. v2: (Matt Brost) - Break full ban list request into a separate property. - Reformat drm_xe_vm_get_property struct. - Remove need for drm_xe_faults helper struct. - Separate data pointer and scalar return value in ioctl. - Get address type on pagefault report and save it to the pagefault. - Correctly reject writes to read-only VMAs. - Miscellaneous formatting fixes. v3: (Matt Brost) - Only allow querying of failed pagefaults v4: - Remove unnecessary size parameter from helper function, as it is a property of the arguments. (jcavitt) - Remove unnecessary copy_from_user (Jainxun) - Set address_precision to 1 (Jainxun) - Report max size instead of dynamic size for memory allocation purposes. Total memory usage is reported separately. v5: - Return int from xe_vm_get_property_size (Shuicheng) - Fix memory leak (Shuicheng) - Remove unnecessary size variable (jcavitt) v6: - Free vm after use (Shuicheng) - Compress pf copy logic (Shuicheng) - Update fault_unsuccessful before storing (Shuicheng) - Fix old struct name in comments (Shuicheng) - Keep first 50 pagefaults instead of last 50 (Jianxun) - Rename ioctl to xe_vm_get_faults_ioctl (jcavitt) v7: - Avoid unnecessary execution by checking MAX_PFS earlier (jcavitt) - Fix double-locking error (jcavitt) - Assert kmemdump is successful (Shuicheng) - Repair and move fill_faults break condition (Dan Carpenter) - Free vm after use (jcavitt) - Combine assertions (jcavitt) - Expand size check in xe_vm_get_faults_ioctl (jcavitt) - Remove return mask from fill_faults, as return is already -EFAULT or 0 (jcavitt) v8: - Revert back to using drm_xe_vm_get_property_ioctl - s/Migrate/Move (Michal) - s/xe_pagefault/xe_gt_pagefault (Michal) - Create new header file, xe_gt_pagefault_types.h (Michal) - Add and fix kernel docs (Michal) - Rename xe_vm.pfs to xe_vm.faults (jcavitt) - Store fault data and not pagefault in xe_vm faults list (jcavitt) - Store address, address type, and address precision per fault (jcavitt) - Store engine class and instance data per fault (Jianxun) - Properly handle kzalloc error (Michal W) - s/MAX_PFS/MAX_FAULTS_SAVED_PER_VM (Michal W) - Store fault level per fault (Micahl M) - Apply better copy_to_user logic (jcavitt) v9: - More kernel doc fixes (Michal W, Jianxun) - Better error handling (jcavitt) v10: - Convert enums to defines in regs folder (Michal W) - Move xe_guc_pagefault_desc to regs folder (Michal W) - Future-proof size logic for zero-size properties (jcavitt) - Replace address type extern with access type (Jianxun) - Add fault type to xe_drm_fault (Jianxun) v11: - Remove unnecessary switch case logic (Raag) - Compress size get, size validation, and property fill functions into a single helper function (jcavitt) - Assert valid size (jcavitt) - Store pagefaults in non-fault-mode VMs as well (Jianxun) v12: - Remove unnecessary else condition - Correct backwards helper function size logic (jcavitt) - Fix kernel docs and comments (Michal W) v13: - Move xe and user engine class mapping arrays to header (John H) Signed-off-by: Jonathan Cavitt <joanthan.cavitt@intel.com> Suggested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Suggested-by: Matthew Brost <matthew.brost@intel.com> Cc: Zhang Jianxun <jianxun.zhang@intel.com> Cc: Shuicheng Lin <shuicheng.lin@intel.com> Cc: Michal Wajdeczko <Michal.Wajdeczko@intel.com> Cc: Michal Mrozek <michal.mrozek@intel.com> Cc: Raag Jadav <raag.jadav@intel.com> Cc: John Harrison <john.c.harrison@intel.com> Jonathan Cavitt (6): drm/xe/xe_hw_engine: Map xe and user engine class in header drm/xe/xe_gt_pagefault: Disallow writes to read-only VMAs drm/xe/xe_gt_pagefault: Move pagefault struct to header drm/xe/uapi: Define drm_xe_vm_get_property drm/xe/xe_vm: Add per VM fault info drm/xe/xe_vm: Implement xe_vm_get_property_ioctl drivers/gpu/drm/xe/regs/xe_pagefault_desc.h | 50 +++++++ drivers/gpu/drm/xe/xe_device.c | 3 + drivers/gpu/drm/xe/xe_gt_pagefault.c | 80 ++++++----- drivers/gpu/drm/xe/xe_gt_pagefault_types.h | 42 ++++++ drivers/gpu/drm/xe/xe_guc_fwif.h | 28 ---- drivers/gpu/drm/xe/xe_hw_engine.c | 24 ++-- drivers/gpu/drm/xe/xe_hw_engine_types.h | 5 + drivers/gpu/drm/xe/xe_query.c | 18 +-- drivers/gpu/drm/xe/xe_vm.c | 148 ++++++++++++++++++++ drivers/gpu/drm/xe/xe_vm.h | 11 ++ drivers/gpu/drm/xe/xe_vm_types.h | 32 +++++ include/uapi/drm/xe_drm.h | 79 +++++++++++ 12 files changed, 434 insertions(+), 86 deletions(-) create mode 100644 drivers/gpu/drm/xe/regs/xe_pagefault_desc.h create mode 100644 drivers/gpu/drm/xe/xe_gt_pagefault_types.h