Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2189940rbb; Tue, 27 Feb 2024 13:41:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX07wrcDDIEN1qXlue6eW4F3FvaFScaB5H48LEt/oSIsfx9ZljlZvLC+6dNXmEgGB9AvuYqBG0ID+Lgr8W+xFeeNObg5gxt0oae1A1Rag== X-Google-Smtp-Source: AGHT+IEzj5Jpd2JtrIG3Xkwzd6w5fG0S6Qv83SI+c1oFN0kctL1yiJ7woHjuPTtM3uQ5Sud45cHI X-Received: by 2002:a17:902:f64b:b0:1dc:88bd:66d1 with SMTP id m11-20020a170902f64b00b001dc88bd66d1mr13054700plg.35.1709070110032; Tue, 27 Feb 2024 13:41:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709070110; cv=pass; d=google.com; s=arc-20160816; b=jY0Vv1PNyjghFinNsDGpzixwtJSuGdQQZ+f+VuyfUS1UnwOwjMPNY+4vYB0ARAgdJT Eg0uejSttupyAhSMRS5tidU7VQUjbyui5XSw1ycG2b3nHAVmBiSzQyDjhJIH6g91VVX7 BhN5qBqLTJTYmiYEjjck1sQJJl/FHwmBK8nd0bS/jFNwXorqSpoZtzeqc+HEx+d0x2t8 FyGwXqE8dPKd6IC2V9hjuxEjlFpG1xCA3oDqD6LFUmwtGhqAX0gdlitlsaQByGVdtNxS ASyUDU2veZ8M4veH0wfC5l4K8TK0wMwySaGwPXppnUboO03CmIxXt0B+Yf+Us8RcQnW4 yhAQ== 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=HTZrsEZ92DTeO98d3walMogWqIvXqs2eT6HtyYaQ5PY=; fh=iWkGsoy7TPTmscZDaNwAhCaNzZd4htfetWN3qPRQ3vU=; b=TYIs1NBqHKNbRleHw4OUUuexp+VquIz+ErE7Ak9Y+6dNGHUJFORSd+fFN/Lf7bNECv 2sk6k/G4EuC9TxDqMSLbTjfV8pZbo9l0dbMqHh1A6JNmrFL8AwRwktvf+mdRTEouTIwG G+QiP0ZwUsfuyAsy16OAgK4jARAS0IB8YbwWc9Kx7vucnCr+JfdIaz8ZM0qrk5pC02BA fkL6t84a51Br+S8Uw7qkmX/XwMQ1o9nb5ccLoC5cgPdigTJkYS4Kx9XaMzdDBW84I11C x26fM3SkzmZ7HcIRzuYOTRrHC91YE2K08XBLcv+KW8xMfU/iVvBxYjt0Pv+Vx3373+00 1iiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FNWniD1z; 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-84009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84009-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s8-20020a170902a50800b001d9d44403bbsi1923806plq.583.2024.02.27.13.41.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:41:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FNWniD1z; 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-84009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84009-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7D2C0B2D363 for ; Tue, 27 Feb 2024 21:00:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D84214F979; Tue, 27 Feb 2024 21:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FNWniD1z" 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 A93E314E2CB for ; Tue, 27 Feb 2024 21:00:20 +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=1709067622; cv=none; b=fOVk70fzi3JVp5SAGpnhyafqOvMROd81LkU/TUUTPLplhduPE39UBIqQQn2f/G26x6E0HBAJFDNXsV9ctcT5R/byDL3+E0G7zGNQxiadr2+YATKgMutyMM6QAjp5KadVXnHYpi3DyKT0yjevqcIG+X5cP/3ZXa5i4NdJAU0OSak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709067622; c=relaxed/simple; bh=AIkMM1NMy91FDgmfFFaJ0HxHDsRelsqEiKUcFIg+iw8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=vEY6m4H5vngLIJAmFIl5YDopt2LxVNAGQ/4ZWCKdnqCFqJODIdtuqAVizHO3SdPggU+mXmf7gQdNmlf0etT8HbzFgr0uYoinKAF0MGTwrXHzkwtIAxrXeXa/0ynWk8GKXpCBpZqT2mCdRtKJfkKIbp78edBkiYvD7yLutk1BTCc= 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=FNWniD1z; 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=1709067621; x=1740603621; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AIkMM1NMy91FDgmfFFaJ0HxHDsRelsqEiKUcFIg+iw8=; b=FNWniD1zrr9PoKOCcGiMrAj2+KWZxw26DhT1sCDcBpk1XLKobm7brJhV 3+AryNna8+FNQaKdowZN+ucUXMUPk9ldGBt127k7WLu+0uMi7TPOzVTEM ZZUeZY8+V8LHBl+x94LbvW7aqCrzWx/MKYa6K9LV1dIRbMZWINU5Mr4zY PuMlJs1svdmB7waivjv8BwTlIqSS55WC3Jb0x1UXink0zXcge3Pd6Xrbt fu2AAE8UWrrI3qnUSn/dD/ew+EWfKMQzZ7OefaPeKA9ipSroQ8yFKEIZq 4/13L78axYeqJmZGYlnteq0I4JRE7N3eHIzuDowEWhzsqdKiFPvlBVD9U g==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="14858450" X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="14858450" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 13:00:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="7150425" Received: from josouza-mobl2.bz.intel.com ([10.87.243.88]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 13:00:19 -0800 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 3/4] drm/xe: Remove devcoredump during driver release Date: Tue, 27 Feb 2024 13:00:07 -0800 Message-ID: <20240227210008.182904-3-jose.souza@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240227210008.182904-1-jose.souza@intel.com> References: <20240227210008.182904-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 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 68d3d623a05bf..3fef81396fe8a 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" @@ -231,5 +233,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; -- 2.44.0