From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E4AA1581E5 for ; Tue, 9 Apr 2024 20:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712692940; cv=none; b=mGjZ01M5zUuJ9pBJHkz42g5YC/1VyoOCmTN661nY8mtqspdZBAEFDpfzdNKTaUXHVX/wBpcjx9HSDX0rnuXtFusSuWY3zO1gXwbsgwEjotx/4nmZ1FUunfCRSpBTJj40RcS2ubRKECTd1TXDm/SkE5rBmLwjDeWXftsJHDzM7co= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712692940; c=relaxed/simple; bh=9th3zcxHkOFYKgqfwBhxafNw916wP0TsbaIUcqTYDjc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aeqzYmcodku5/wEjGDE965n7y0YAegvvEQShBBsYGvVpsle82LLhvVaQAJHuMrd96gb85uqfL+hSbclPL6mhuOPH9hiEZ3Mwz42s69JhGfBJC4TxNsL2m0u8FDuGplvjQ/wwPAsgTo/U+hiKGTaDs8ufhD/WYAtCVA/f49DxORA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JVzMVEi/; arc=none smtp.client-ip=192.198.163.13 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.b="JVzMVEi/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712692938; x=1744228938; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9th3zcxHkOFYKgqfwBhxafNw916wP0TsbaIUcqTYDjc=; b=JVzMVEi/EHxklU9f+1PyiEoDYNJmbPIs1fZyjRvlzoMOtnOdu41ag+ns P6bChjJozyVwbwS0vH9HTdZxomTs+WjFAHXRZEDffylFMGiMvR8JgP/pR symD5DVxo0iAgk9lKi5VYp954k4nVX2Muf7Hj5X9/aBHDKxVS/8o57uMQ 6aaBqqP6G/AVF8t3bT2WIYh+EUO6jzcFt8LNvDPJrSe2aCI3+x225sHlP 5k19mGxDs4ey0MqDY1X4fB22tOOG5IECH1rhBZtkKvE8WMGAz4Aw8vHgm eZQFMdwtZtXi9SeJ8oXdBmClZTJ8s/PrsmaUmAjrdrGdRPnTqHEa2QqP6 g==; X-CSE-ConnectionGUID: KPhDZVr4RYi8PPJBrQ5QFw== X-CSE-MsgGUID: B3IPQ5reR6aQynKOW4YA3A== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="10996849" X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="10996849" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 13:02:17 -0700 X-CSE-ConnectionGUID: pal8vJweQ9CdDP6WaAQoOg== X-CSE-MsgGUID: 1iBq4LdKSviFKwsOebRdgQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="24824248" Received: from josouza-mobl2.bz.intel.com ([10.87.243.88]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 13:02:16 -0700 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= To: linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org Cc: Rodrigo Vivi , Jonathan Cavitt , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Subject: [PATCH v4 2/2] drm/xe: Remove devcoredump during driver release Date: Tue, 9 Apr 2024 13:02:06 -0700 Message-ID: <20240409200206.108452-2-jose.souza@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240409200206.108452-1-jose.souza@intel.com> References: <20240409200206.108452-1-jose.souza@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will remove devcoredump from file system and free its resources during driver unload. This fix the driver unload after gpu hang happened, otherwise this it would report that Xe KMD is still in use and it would leave the kernel in a state that Xe KMD can't be unload without a reboot. Cc: Rodrigo Vivi Cc: Jonathan Cavitt Acked-by: Jonathan Cavitt Signed-off-by: José Roberto de Souza --- drivers/gpu/drm/xe/xe_devcoredump.c | 13 ++++++++++++- drivers/gpu/drm/xe/xe_devcoredump.h | 6 ++++++ drivers/gpu/drm/xe/xe_device.c | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c index 283ca7518aff2..3d7980232be1c 100644 --- a/drivers/gpu/drm/xe/xe_devcoredump.c +++ b/drivers/gpu/drm/xe/xe_devcoredump.c @@ -9,6 +9,8 @@ #include #include +#include + #include "xe_device.h" #include "xe_exec_queue.h" #include "xe_force_wake.h" @@ -235,5 +237,14 @@ void xe_devcoredump(struct xe_sched_job *job) dev_coredumpm(xe->drm.dev, THIS_MODULE, coredump, 0, GFP_KERNEL, xe_devcoredump_read, xe_devcoredump_free); } -#endif +static void xe_driver_devcoredump_fini(struct drm_device *drm, void *arg) +{ + dev_coredump_put(drm->dev); +} + +int xe_devcoredump_init(struct xe_device *xe) +{ + return drmm_add_action_or_reset(&xe->drm, xe_driver_devcoredump_fini, xe); +} +#endif diff --git a/drivers/gpu/drm/xe/xe_devcoredump.h b/drivers/gpu/drm/xe/xe_devcoredump.h index df8671f0b5eb2..e2fa65ce09322 100644 --- a/drivers/gpu/drm/xe/xe_devcoredump.h +++ b/drivers/gpu/drm/xe/xe_devcoredump.h @@ -11,10 +11,16 @@ struct xe_sched_job; #ifdef CONFIG_DEV_COREDUMP void xe_devcoredump(struct xe_sched_job *job); +int xe_devcoredump_init(struct xe_device *xe); #else static inline void xe_devcoredump(struct xe_sched_job *job) { } + +static inline int xe_devcoredump_init(struct xe_device *xe) +{ + return 0; +} #endif #endif diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 9083f5e02dd9e..ce27d0d1bdb34 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -20,6 +20,7 @@ #include "regs/xe_regs.h" #include "xe_bo.h" #include "xe_debugfs.h" +#include "xe_devcoredump.h" #include "xe_dma_buf.h" #include "xe_drm_client.h" #include "xe_drv.h" @@ -513,6 +514,9 @@ int xe_device_probe(struct xe_device *xe) return err; } + err = xe_devcoredump_init(xe); + if (err) + return err; err = drmm_add_action_or_reset(&xe->drm, xe_driver_flr_fini, xe); if (err) return err; -- 2.44.0