From patchwork Mon Mar 4 14:39:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 209563 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1463562dyc; Mon, 4 Mar 2024 06:40:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW3jg4uZlL80/TWz6rKrXoHIqUl2WDgWhBePuqV3wdPTnWeY3FHp6ko8MoOJMokrwAXEK1o+FClLa2m3EO5s6MYQ98OeQ== X-Google-Smtp-Source: AGHT+IGjJerSiwec7o+9IvMIEfCeOq/9xpTtCHemi6WHKj9KL2JBMVp23i3ozU9gqQTAiAriGcxK X-Received: by 2002:a19:f714:0:b0:512:acc8:7c36 with SMTP id z20-20020a19f714000000b00512acc87c36mr5674218lfe.58.1709563239319; Mon, 04 Mar 2024 06:40:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709563239; cv=pass; d=google.com; s=arc-20160816; b=h29gXXgk/TNF4lCUScb9SXaPzrULD7gVAD93+5ZN1E+fahyGgvLu4R2iIkVTQiW52k l5gd95XvguzSue857Pv4ZZmYdWISmbcHGoTO5GcRJJ31KH66wHSyLuJjavYOMRAAgkeh 1oU/tcs4RLqS0H/xor5uPPm+PeDWcKocyDGiTfZ/GrqFAIlPPvbreZdNBPNERn7G9JHh 2HR0h1S4XzT6JMYInG4BqmgSGmAtvQgRwkieOlrKnsOqA5qTEMbmnOh2TTxX0L+seX2o 2byKIEI1c5lv3IT0XnMBv1h4wi5VpnNJkq1TcIW9EPrCAajQvCmDpYHjPohlU02xRIqV i1Sw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3Y1NkJd9wGERzMr+tdHd3dO7H78qHyX1QJaQPI5rUvk=; fh=iWkGsoy7TPTmscZDaNwAhCaNzZd4htfetWN3qPRQ3vU=; b=bqsrui4LKJixYHQajK9ZtHVLf6eRyd/E2hRx9VZW/YxnUE9XXeIpr4E8p39NDij9cN si9LeXtjBIBgwCXSkkaHZLFBAWLU7MHzEznFUre3oY5KLawRRJnm0Q71mZaaGv1cFF6p TQmRkklnXcRUaJ8PJsAM+aHs8/DlZJ1lW/LT7a+UOlR3oaj0ssvQR/EZKiMOgu3p4z23 W6Z3LQAsoeJkN2Eap4xXk3rPq9b+rYsZ2oWpQFjWM6LrOZT9keczNM3KG7TlFrbMAUpo cQfkljQqcRG3mzenEltqDzOGkkh+6XM85BBWXoykO1E45qCWeiNb7ftjB9cz7tMVnZYJ C1HQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VtKTOoVk; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-90746-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90746-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l17-20020a170906795100b00a43093bddaasi4202340ejo.313.2024.03.04.06.40.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 06:40:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90746-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VtKTOoVk; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-90746-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90746-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BBA951F23EE3 for ; Mon, 4 Mar 2024 14:40:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BC0F482EF; Mon, 4 Mar 2024 14:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VtKTOoVk" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 D11252575B for ; Mon, 4 Mar 2024 14:39:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709563159; cv=none; b=VeR7miPmG8pbYUYybUQyd8raF8gvVcAXuAsa9WB8XRBVXOPXfPF4PpiYTG3FXpH3zgKDxXyTG8XrJejhPIQW3mjcXZG9WUSXRg2FHHJ1PnLr4vinVshEOy5J5s/w1hsk/3cDQR5FEQLlScfyd+BGJphEP2cPvuNfsJ/pmeAvc40= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709563159; c=relaxed/simple; bh=Ev9vAd6KMr30CCRVCaJ2grIXca9Zj7XJ7NQCoKyrOb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AyK02Hh3jx/C0qJacrimq9mFMBv7BUsqqDPHY5u49vRI51e/MfKLtjtKg+2IZwJTb/3Sj1c7MtT5T486LchSZgZiEnQRLwNe6N9baJmGQDffU0wM4I9hcMJjxC2iImJIPVLHlEP3+KZUHcz1WXFe7WZlDkxDhLWbG/2qMQiNqdE= 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=VtKTOoVk; arc=none smtp.client-ip=192.198.163.10 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709563158; x=1741099158; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ev9vAd6KMr30CCRVCaJ2grIXca9Zj7XJ7NQCoKyrOb0=; b=VtKTOoVkkGwuP/NR+aSxEGhIDLJVaFfhK91Up617JSyVJ1D3sWaPdRdc J7bxO8aNaIsvtHg5vqTts2eGGTp+abkMm0gQebXBkF8JV8RPBUF+8qmEi zBC3lPWFElHiVZklsNpGZJitEZHbESRWfiPUG0MqXt9sUkIKBH9THoqG5 L6ETLw16WnSLDiGCC87qNNI7aXhA2tPk75ad0fXMKMlkFfJXpsEpzR/8K 3QRnDMOvAGABR4quIrC8wIYx72YSkhguMkNxjHEkEEIpe8jxLs9P/5Lit 9uEVXA+EB0Km7y4xqlJp6BHMO6Q9StA9n8IpDe6BhIiEU270aRIfIbtla w==; X-IronPort-AV: E=McAfee;i="6600,9927,11002"; a="15464639" X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="15464639" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:39:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="9162547" Received: from josouza-mobl2.bz.intel.com ([10.87.243.88]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:39:16 -0800 From: =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= To: linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org Cc: Rodrigo Vivi , Jonathan Cavitt , =?utf-8?q?Jos=C3=A9_Roberto_de?= =?utf-8?q?_Souza?= Subject: [PATCH v3 3/4] drm/xe: Remove devcoredump during driver release Date: Mon, 4 Mar 2024 06:39:04 -0800 Message-ID: <20240304143905.52740-3-jose.souza@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304143905.52740-1-jose.souza@intel.com> References: <20240304143905.52740-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792606983072916704 X-GMAIL-MSGID: 1792606983072916704 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 | 5 +++++ drivers/gpu/drm/xe/xe_device.c | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c index 0fcd306803236..109c027188bd9 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" @@ -230,5 +232,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..9eba67f37234f 100644 --- a/drivers/gpu/drm/xe/xe_devcoredump.h +++ b/drivers/gpu/drm/xe/xe_devcoredump.h @@ -11,10 +11,15 @@ 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 919ad88f0495a..22be76537c7da 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" @@ -502,6 +503,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;