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 73D16C77B73 for ; Mon, 22 May 2023 17:22:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5151D10E209; Mon, 22 May 2023 17:22:41 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 00B9F10E1A4 for ; Mon, 22 May 2023 17:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684776153; x=1716312153; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8kxWwlmi/80BIuZup2tZYksMfZa756JTN+2mwjPbMPM=; b=S30oDWmw6YoVR+X8BDWmnUGcVfojHSQ8n5fZRo93RqIDnT4IU2ZU/3yS uFcAuHJ7JitTlc7JPTQ9LNYpkmXW8S9CrnfXOg0UNWDS61bVvTP/6p6xk Jeq9eIqeXq18LGUS6lYEs6Z//cBa0kA6j9VlDk+yEUwZf21w6z4lgiOfe dtt09Ib1FRzIsrxvUspjuCc4zHGqjYlswoQhSU3rrw9Mvnz0aj3N4dz8W 0y8IxTEyD8wipVFLyIMfOh2PaKfc6MOdcMsUPJvaKLPDxJTgwY8gQnvct H2Xhi6x4lao558etiS/W3qpwivVpgxGSz6ZiIRHLfpwYV4tylUGQgEIJe Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10718"; a="342439586" X-IronPort-AV: E=Sophos;i="6.00,184,1681196400"; d="scan'208";a="342439586" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2023 10:22:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10718"; a="793409284" X-IronPort-AV: E=Sophos;i="6.00,184,1681196400"; d="scan'208";a="793409284" Received: from amigon-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.249.128.230]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2023 10:22:31 -0700 From: Matthew Auld To: intel-xe@lists.freedesktop.org Date: Mon, 22 May 2023 18:22:09 +0100 Message-Id: <20230522172211.90678-5-matthew.auld@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230522172211.90678-1-matthew.auld@intel.com> References: <20230522172211.90678-1-matthew.auld@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Intel-xe] [PATCH v8 5/7] drm/xe/ggtt: prime ggtt->lock against FS_RECLAIM 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: , Cc: Rodrigo Vivi Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" Increase the sensitivity of the ggtt->lock by priming it against FS_RECLAIM, such that allocating memory while holding will result in lockdep splats. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Rodrigo Vivi Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/xe/xe_ggtt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c index f986e8218820..e25eb70d44f6 100644 --- a/drivers/gpu/drm/xe/xe_ggtt.c +++ b/drivers/gpu/drm/xe/xe_ggtt.c @@ -90,6 +90,16 @@ static void ggtt_fini_noalloc(struct drm_device *drm, void *arg) xe_bo_unpin_map_no_vm(ggtt->scratch); } +static void primelockdep(struct xe_ggtt *ggtt) +{ + if (!IS_ENABLED(CONFIG_LOCKDEP)) + return; + + fs_reclaim_acquire(GFP_KERNEL); + might_lock(&ggtt->lock); + fs_reclaim_release(GFP_KERNEL); +} + int xe_ggtt_init_noalloc(struct xe_gt *gt, struct xe_ggtt *ggtt) { struct xe_device *xe = gt_to_xe(gt); @@ -132,6 +142,7 @@ int xe_ggtt_init_noalloc(struct xe_gt *gt, struct xe_ggtt *ggtt) drm_mm_init(&ggtt->mm, xe_wopcm_size(xe), ggtt->size - xe_wopcm_size(xe)); mutex_init(&ggtt->lock); + primelockdep(ggtt); return drmm_add_action_or_reset(&xe->drm, ggtt_fini_noalloc, ggtt); } -- 2.40.1