From patchwork Mon Oct 21 17:57:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Brost X-Patchwork-Id: 13844488 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 9749CD17121 for ; Mon, 21 Oct 2024 17:56:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5FC5C10E578; Mon, 21 Oct 2024 17:56:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="EK/0Vhr7"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7801710E530; Mon, 21 Oct 2024 17:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729533401; x=1761069401; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BEpvO3t2m99UVkHhQrCHDrpw/InTD5Sb67NybmHf3NY=; b=EK/0Vhr7Aenvnf0Bg0o47E4+RFeuPlpMSMQucUs95AN8Y8Bq+PYetadB VAe57z7itCSOY8FJ+URqhSP2LkePrBv7CFcLCwXU6bx9wFZnpT7aWfU2c A1nDhCm+ksTPIKYiIIeleL5p3rVyfDpg5xDtAJrX7BZ76yIpqrZUp3huj gGAG6A3FSjf7vKE608dFt9voLNcYMwh5LXICVGcD7Ma6UfYTifzBqDt60 wIIJ2+EWIQYjeCzQoa5pc8PXHMyw40HFU1Iyz6HxfRpZoQGnuz54ctChs tTStBPgowVpHoM45KLOnNdMX/eQw5gC9+1XbAoqxRG5DL/Og28iYqc9pq w==; X-CSE-ConnectionGUID: +nKhqrYiQPe99qjgVP+Nuw== X-CSE-MsgGUID: kEghi6sfS9yY/FCCeiFTFg== X-IronPort-AV: E=McAfee;i="6700,10204,11232"; a="28910171" X-IronPort-AV: E=Sophos;i="6.11,221,1725346800"; d="scan'208";a="28910171" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 10:56:40 -0700 X-CSE-ConnectionGUID: C5KXyN3IS1SsapU/RrGumg== X-CSE-MsgGUID: b5sZibLrQXaON4zCNRvdnQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,221,1725346800"; d="scan'208";a="79680263" Received: from lstrano-desk.jf.intel.com ([10.54.39.91]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 10:56:40 -0700 From: Matthew Brost To: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: dakr@kernel.org, pstanner@redhat.com Subject: [PATCH 1/4] drm/sched: Mark scheduler work queues with WQ_MEM_RECLAIM Date: Mon, 21 Oct 2024 10:57:02 -0700 Message-Id: <20241021175705.1584521-2-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021175705.1584521-1-matthew.brost@intel.com> References: <20241021175705.1584521-1-matthew.brost@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" DRM scheduler work queues are used to submit jobs, jobs are in the path or dma-fences, and dma-fences are in the path of reclaim. Mark scheduler work queues with WQ_MEM_RECLAIM so these work queues can continue to make forward progress during reclaim. Cc: Luben Tuikov Cc: Danilo Krummrich Cc: Philipp Stanner Signed-off-by: Matthew Brost --- drivers/gpu/drm/scheduler/sched_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 6e4d004d09ce..567811957c0f 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -1275,10 +1275,10 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, sched->own_submit_wq = false; } else { #ifdef CONFIG_LOCKDEP - sched->submit_wq = alloc_ordered_workqueue_lockdep_map(name, 0, + sched->submit_wq = alloc_ordered_workqueue_lockdep_map(name, WQ_MEM_RECLAIM, &drm_sched_lockdep_map); #else - sched->submit_wq = alloc_ordered_workqueue(name, 0); + sched->submit_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); #endif if (!sched->submit_wq) return -ENOMEM; From patchwork Mon Oct 21 17:57:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Brost X-Patchwork-Id: 13844485 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 16721D3E1BE for ; Mon, 21 Oct 2024 17:56:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12F5510E530; Mon, 21 Oct 2024 17:56:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="TSYOrVtB"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9AFD310E114; Mon, 21 Oct 2024 17:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729533402; x=1761069402; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dJjRbo9MlBz0QJCq/ZVrTxqUK3CqkGW8RHmWUdEKZJM=; b=TSYOrVtBkKHWWSgKDA9A/ZkU/1qCtjjXXAj/9LjhXiGqpkiDgB6NtsHR i1Lt6JQF1rDerYp3hubJrP147B8cAV5TD6Zo2jCdq5XYOxHmie44wFhcZ KZCAvTsrnyUme4ChBsHiGYWw5FIFWVcdvMN200JIWW5VNjTUufzaQxjpe nP0pExhtVdcIhuFyZq5iNp1fz8JQ7NWxvfHYKx/b2rTjLmFuMRe9DceB1 Q9y8/9rJ1U2fvwH8Ly/Kpjdr1Z4xBYJ+2sR8si7O+FQXyBRs9q6XcjybT MZkM+Zc5XLFZOgLX2M3/tjpSwzlOCmFVLmtq/YspEZ4dAFD2dPaZPdTjz Q==; X-CSE-ConnectionGUID: eqg9HjLXTXa30yxuSRzqPg== X-CSE-MsgGUID: LKVisONlQWeFLhgItHvghg== X-IronPort-AV: E=McAfee;i="6700,10204,11232"; a="28910176" X-IronPort-AV: E=Sophos;i="6.11,221,1725346800"; d="scan'208";a="28910176" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 10:56:40 -0700 X-CSE-ConnectionGUID: YNAjmmOhTCOWJFMDUTbu1g== X-CSE-MsgGUID: KCDOqroqSvOeYLQUunyutA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,221,1725346800"; d="scan'208";a="79680265" Received: from lstrano-desk.jf.intel.com ([10.54.39.91]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 10:56:40 -0700 From: Matthew Brost To: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: dakr@kernel.org, pstanner@redhat.com Subject: [PATCH 2/4] drm/xe: Mark GGTT work queue with WQ_MEM_RECLAIM Date: Mon, 21 Oct 2024 10:57:03 -0700 Message-Id: <20241021175705.1584521-3-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021175705.1584521-1-matthew.brost@intel.com> References: <20241021175705.1584521-1-matthew.brost@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" GGTT work queue is used to free memory thus we should allow this work queue to run during reclaim. Mark with GGTT work queue with WQ_MEM_RECLAIM appropriately. Signed-off-by: Matthew Brost Reviewed-by: Himal Prasad Ghimiray Reviewed-by: Badal Nilawar --- drivers/gpu/drm/xe/xe_ggtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c index 1b3178226987..0124ad120c04 100644 --- a/drivers/gpu/drm/xe/xe_ggtt.c +++ b/drivers/gpu/drm/xe/xe_ggtt.c @@ -246,7 +246,7 @@ int xe_ggtt_init_early(struct xe_ggtt *ggtt) else ggtt->pt_ops = &xelp_pt_ops; - ggtt->wq = alloc_workqueue("xe-ggtt-wq", 0, 0); + ggtt->wq = alloc_workqueue("xe-ggtt-wq", 0, WQ_MEM_RECLAIM); drm_mm_init(&ggtt->mm, xe_wopcm_size(xe), ggtt->size - xe_wopcm_size(xe)); From patchwork Mon Oct 21 17:57:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Brost X-Patchwork-Id: 13844486 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 BE30CD17120 for ; Mon, 21 Oct 2024 17:56:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9334410E574; Mon, 21 Oct 2024 17:56:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="hPYc8vBx"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id A1A4C10E573; Mon, 21 Oct 2024 17:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729533402; x=1761069402; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eABO20KdisM/PVaQcce6fai1+qRPiAxKbPBDQTQgfNQ=; b=hPYc8vBxryEVwcc1AmpDycAMCaaiKMUjsClmleenM2OOcrW81kiJqlgF Tp2zI+2D20sKGyT1SZSEzuAsgOIxlJjwzh6Qzgz84OMgRW2Bwtck9VlnY NMGz5D2G/U9p0VB2BvtltfHs2yoQxt0U/GOKWynIB0ra276VVNYlRXK3S 8lPGcyzcb0roFGKak0U8OmUIx9ab7FX6QWQY7kTi1/f4m0lpoCrGX/yZh 6UbnW1hZyZV3eWv5e8Xum7TEZ2SnYQoZC4BEw5+Ic4Dv1ErlouN74UPDz LWiu2B0qkMXNeziWUz8Wkgudnz4qlxS2R+SKDhkx3okJV0O4rfX8XAaxZ g==; X-CSE-ConnectionGUID: 3KzuEpcdQiixQt4EsuiVuw== X-CSE-MsgGUID: ajzEMk0xRpKX6mg6n50KSA== X-IronPort-AV: E=McAfee;i="6700,10204,11232"; a="28910181" X-IronPort-AV: E=Sophos;i="6.11,221,1725346800"; d="scan'208";a="28910181" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 10:56:40 -0700 X-CSE-ConnectionGUID: 5Zop7EWmRAOjlj6HrIBzog== X-CSE-MsgGUID: a3iLNbI/TduTmeUfkVz2yw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,221,1725346800"; d="scan'208";a="79680269" Received: from lstrano-desk.jf.intel.com ([10.54.39.91]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 10:56:40 -0700 From: Matthew Brost To: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: dakr@kernel.org, pstanner@redhat.com Subject: [PATCH 3/4] drm/xe: Mark G2H work queue with WQ_MEM_RECLAIM Date: Mon, 21 Oct 2024 10:57:04 -0700 Message-Id: <20241021175705.1584521-4-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021175705.1584521-1-matthew.brost@intel.com> References: <20241021175705.1584521-1-matthew.brost@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" G2H work queue can be used to free memory thus we should allow this work queue to run during reclaim. Mark with G2H work queue with WQ_MEM_RECLAIM appropriately. Signed-off-by: Matthew Brost Reviewed-by: Himal Prasad Ghimiray Reviewed-by: Badal Nilawar --- drivers/gpu/drm/xe/xe_guc_ct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c index c260d8840990..1b5d8fb1033a 100644 --- a/drivers/gpu/drm/xe/xe_guc_ct.c +++ b/drivers/gpu/drm/xe/xe_guc_ct.c @@ -213,7 +213,7 @@ int xe_guc_ct_init(struct xe_guc_ct *ct) xe_gt_assert(gt, !(guc_ct_size() % PAGE_SIZE)); - ct->g2h_wq = alloc_ordered_workqueue("xe-g2h-wq", 0); + ct->g2h_wq = alloc_ordered_workqueue("xe-g2h-wq", WQ_MEM_RECLAIM); if (!ct->g2h_wq) return -ENOMEM; From patchwork Mon Oct 21 17:57:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Brost X-Patchwork-Id: 13844489 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 1FC01D17122 for ; Mon, 21 Oct 2024 17:56:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B00110E57B; Mon, 21 Oct 2024 17:56:51 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="YHkbGrqq"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id BF6ED10E530; Mon, 21 Oct 2024 17:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729533402; x=1761069402; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UVNM1bzYPKyIS0dI7rcyYwfed75CqkKaVMtfoqIOppc=; b=YHkbGrqqAM6JUsMHNZzal7OLVb0i98PhPxznC/EYIDMWBzuTWJ/mWsRF zYTWj5YkNCPib+PcR1vizJkqHA+ihxRafLIRfvYEPcxpOv/0h5+FtKsZT ai7HDk+yceFZce7+ZqqMcSyQTkQhMLuS+vGYsLcbIU4wB5yyyonAlPtdO l9EBXbo+i6BiIsK0kzcxNYJ48n+fQtLKeiAjLmxFug1tmzHxe9vYADJPq MBKtT2qpj2BLXdGuR+BFRXXhxTgiAZusuhmUw69a87ptOTe5kQbbm1IyK 5o3jbbCASv0riuxBSvvh5ispCGQ5oMYIcwyHCFLU3r5EDSJna2g0US68c w==; X-CSE-ConnectionGUID: FDxVlF0kRlObsaN12gfvHA== X-CSE-MsgGUID: +bQu2Iz8QvOanP74fp63pQ== X-IronPort-AV: E=McAfee;i="6700,10204,11232"; a="28910184" X-IronPort-AV: E=Sophos;i="6.11,221,1725346800"; d="scan'208";a="28910184" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 10:56:41 -0700 X-CSE-ConnectionGUID: 9HTm0Tf1QfeMPN8Xxs/O8A== X-CSE-MsgGUID: 4k3/2iMIRruMI+I50aIRrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,221,1725346800"; d="scan'208";a="79680272" Received: from lstrano-desk.jf.intel.com ([10.54.39.91]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 10:56:40 -0700 From: Matthew Brost To: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: dakr@kernel.org, pstanner@redhat.com Subject: [PATCH 4/4] drm/xe: Mark GT work queue with WQ_MEM_RECLAIM Date: Mon, 21 Oct 2024 10:57:05 -0700 Message-Id: <20241021175705.1584521-5-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021175705.1584521-1-matthew.brost@intel.com> References: <20241021175705.1584521-1-matthew.brost@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" GT ordered work queue can be used to free memory via resets and fence signaling thus we should allow this work queue to run during reclaim. Mark with GT ordered work queue with WQ_MEM_RECLAIM appropriately. Signed-off-by: Matthew Brost Reviewed-by: Himal Prasad Ghimiray Reviewed-by: Badal Nilawar --- drivers/gpu/drm/xe/xe_gt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c index 89e9d9d4db06..d6744be01a68 100644 --- a/drivers/gpu/drm/xe/xe_gt.c +++ b/drivers/gpu/drm/xe/xe_gt.c @@ -77,7 +77,8 @@ struct xe_gt *xe_gt_alloc(struct xe_tile *tile) return ERR_PTR(-ENOMEM); gt->tile = tile; - gt->ordered_wq = alloc_ordered_workqueue("gt-ordered-wq", 0); + gt->ordered_wq = alloc_ordered_workqueue("gt-ordered-wq", + WQ_MEM_RECLAIM); err = drmm_add_action_or_reset(>_to_xe(gt)->drm, gt_fini, gt); if (err)