From nobody Sun Feb 8 20:59:43 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 39733255248 for ; Mon, 12 May 2025 20:35:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747082128; cv=none; b=JoQf+63fexB81DTYizaxCfrxXJamz+BOVE5JTaJ/b2xFwMroms31hwWKpobiPC+aPqIf8u0yedOx781DTGOKIcij2yCdPYYFZESE93RPa7drC5k4diig8gvTAQsCTS6Oc1nr6X7Bfx3uQvxCVO118FSFaHY686bMMG3H1eOAbG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747082128; c=relaxed/simple; bh=sbKEH0mtOMt+F0I4DmyfiTosiqaIXIsr51L+eoqDFRE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RVz0BHJGfD5ggtOyXPO9ZIwxzTaVCdxJg8hlFe+3sXxt33qHFJv7Y4YkXp4bKIcvRcSLD4q/IHKmDgiBEyECvBziLILA5R7ZLkC3PsMSpV98TigYzGTFC+wkXGy1pmdzIXXzz5fTz8kyMuo6fZ59Clhm8wngDdBEo8m0bPMbCbU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=qUS838T9; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="qUS838T9" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=mKXn+e5Cb3c3H6ayP7B6hMsIHAndkudj1I6Xs4jTea0=; b=qUS838T98uJ70l2oy9+cUWUGsx m9lOvJcxOAqoBeQYV0kfz/hVQ0E6ZEkRCO64wxemtL18b74niaLwWkOaqb9qNC+jy9kgVZbXECa00 2WNi0OcI+z+VKO7TgE9COWR7YoYzF4AdpN7dMX5xy72YzO8/saZbr+ooZRBUs8GnYf3Orfoz8SHuV 6FSVFE+7H6RaMTpC7oQruMZnaBKeV0m3KqrnVGg7jMiG13a6KVuIdZnmYSg/3F+Og7Lh/VeYHhfUN c5Khl7N7xrcc91Nhxd9815Hs52owyKPl9fcXyyKwXJQIhCDPzzI/Rbh0XCs4MC62QFEEpVoDuRR94 QnpHVmYA==; Received: from [191.204.192.64] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uEZmR-007G93-Vf; Mon, 12 May 2025 22:35:08 +0200 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: "Alex Deucher" , =?UTF-8?q?Christian=20K=C3=B6nig?= , siqueira@igalia.com, airlied@gmail.com, simona@ffwll.ch, "Raag Jadav" , rodrigo.vivi@intel.com, jani.nikula@linux.intel.com, Xaver Hugl , "Pierre-Loup A . Griffais" , Krzysztof Karas Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, amd-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH v3 1/3] drm: Create an app info option for wedge events Date: Mon, 12 May 2025 17:34:35 -0300 Message-ID: <20250512203437.989894-2-andrealmeid@igalia.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250512203437.989894-1-andrealmeid@igalia.com> References: <20250512203437.989894-1-andrealmeid@igalia.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: quoted-printable When a device get wedged, it might be caused by a guilty application. For userspace, knowing which app was the cause can be useful for some situations, like for implementing a policy, logs or for giving a chance for the compositor to let the user know what app caused the problem. This is an optional argument, when the app info is not available, the PID and APP string won't appear in the event string. Sometimes just the PID isn't enough giving that the app might be already dead by the time userspace will try to check what was this PID's name, so to make the life easier also notify what's the app's name in the user event. Acked-by: Rodrigo Vivi (for i915 and xe) Signed-off-by: Andr=C3=A9 Almeida Reviewed-by: Krzysztof Karas --- v3: Make comm_string and pid_string empty when there's no app info --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/drm_drv.c | 15 ++++++++++++--- drivers/gpu/drm/i915/gt/intel_reset.c | 3 ++- drivers/gpu/drm/xe/xe_device.c | 3 ++- include/drm/drm_device.h | 8 ++++++++ include/drm/drm_drv.h | 3 ++- 7 files changed, 28 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/a= md/amdgpu/amdgpu_device.c index 7f354cd532dc..c8a51418d0e7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -6216,7 +6216,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *a= dev, atomic_set(&adev->reset_domain->reset_res, r); =20 if (!r) - drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE); + drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL); =20 return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_job.c index acb21fc8b3ce..a47b2eb301e5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -166,7 +166,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(stru= ct drm_sched_job *s_job) if (amdgpu_ring_sched_ready(ring)) drm_sched_start(&ring->sched, 0); dev_err(adev->dev, "Ring %s reset succeeded\n", ring->sched.name); - drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE); + drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL); goto exit; } dev_err(adev->dev, "Ring %s reset failure\n", ring->sched.name); diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 3dc7acd56b1d..e30efa4ac330 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -542,6 +542,7 @@ static const char *drm_get_wedge_recovery(unsigned int = opt) * drm_dev_wedged_event - generate a device wedged uevent * @dev: DRM device * @method: method(s) to be used for recovery + * @info: optional information about the guilty app * * This generates a device wedged uevent for the DRM device specified by @= dev. * Recovery @method\(s) of choice will be sent in the uevent environment as @@ -554,13 +555,14 @@ static const char *drm_get_wedge_recovery(unsigned in= t opt) * * Returns: 0 on success, negative error code otherwise. */ -int drm_dev_wedged_event(struct drm_device *dev, unsigned long method) +int drm_dev_wedged_event(struct drm_device *dev, unsigned long method, + struct drm_wedge_app_info *info) { const char *recovery =3D NULL; unsigned int len, opt; /* Event string length up to 28+ characters with available methods */ - char event_string[32]; - char *envp[] =3D { event_string, NULL }; + char event_string[32], pid_string[15] =3D "", comm_string[TASK_COMM_LEN] = =3D ""; + char *envp[] =3D { event_string, NULL, NULL, NULL }; =20 len =3D scnprintf(event_string, sizeof(event_string), "%s", "WEDGED=3D"); =20 @@ -582,6 +584,13 @@ int drm_dev_wedged_event(struct drm_device *dev, unsig= ned long method) drm_info(dev, "device wedged, %s\n", method =3D=3D DRM_WEDGE_RECOVERY_NON= E ? "but recovered through reset" : "needs recovery"); =20 + if (info) { + snprintf(pid_string, sizeof(pid_string), "PID=3D%u", info->pid); + snprintf(comm_string, sizeof(comm_string), "APP=3D%s", info->comm); + envp[1] =3D pid_string; + envp[2] =3D comm_string; + } + return kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp); } EXPORT_SYMBOL(drm_dev_wedged_event); diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/g= t/intel_reset.c index dbdcfe130ad4..ba1d8fdc3c7b 100644 --- a/drivers/gpu/drm/i915/gt/intel_reset.c +++ b/drivers/gpu/drm/i915/gt/intel_reset.c @@ -1448,7 +1448,8 @@ static void intel_gt_reset_global(struct intel_gt *gt, kobject_uevent_env(kobj, KOBJ_CHANGE, reset_done_event); else drm_dev_wedged_event(>->i915->drm, - DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET); + DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET, + NULL); } =20 /** diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index c02c4c4e9412..f329613e061f 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -1168,7 +1168,8 @@ void xe_device_declare_wedged(struct xe_device *xe) =20 /* Notify userspace of wedged device */ drm_dev_wedged_event(&xe->drm, - DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET); + DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET, + NULL); } =20 for_each_gt(gt, xe, id) diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h index e2f894f1b90a..b87401d5079e 100644 --- a/include/drm/drm_device.h +++ b/include/drm/drm_device.h @@ -30,6 +30,14 @@ struct pci_controller; #define DRM_WEDGE_RECOVERY_REBIND BIT(1) /* unbind + bind driver */ #define DRM_WEDGE_RECOVERY_BUS_RESET BIT(2) /* unbind + reset bus device += bind */ =20 +/** + * struct drm_wedge_app_info - information about the guilty app of a wedge= dev + */ +struct drm_wedge_app_info { + pid_t pid; + char *comm; +}; + /** * enum switch_power_state - power state of drm device */ diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index a43d707b5f36..8fc6412a6345 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -482,7 +482,8 @@ void drm_put_dev(struct drm_device *dev); bool drm_dev_enter(struct drm_device *dev, int *idx); void drm_dev_exit(int idx); void drm_dev_unplug(struct drm_device *dev); -int drm_dev_wedged_event(struct drm_device *dev, unsigned long method); +int drm_dev_wedged_event(struct drm_device *dev, unsigned long method, + struct drm_wedge_app_info *info); =20 /** * drm_dev_is_unplugged - is a DRM device unplugged --=20 2.49.0 From nobody Sun Feb 8 20:59:43 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 396641B6CF1 for ; Mon, 12 May 2025 20:35:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747082128; cv=none; b=AoRgEvXWi4RZ1eTqnjBg7QvY0GR6KG8pclx1oOXplTJDDJJ/O8p78GOUszv0yoZk9PtJUUPfjYzeYQ2DllyOPWaoq5u32fyEoTgE2XdahKF16GkPYr0meyawPMCTHaYRXEHJRYbZ/orsYY0s9cCDY60wmTRzFByJL820JqHDTkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747082128; c=relaxed/simple; bh=hMq2OzLKnYsyj+X0Hsnfkyo8yCgar5kO5vw/I18zzV0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nGRIOcWEJ2qhFOTZNsgKzALY2ZrNZxutHiyDi79xfD3GL+ElloswhDuWxhwfmIkvnP23moJWfF2aTGaapZegHVJuQcSaKrKJW8kgpKmq2WdChPXSHtQZM6Ktw+p2hnPNUHaST0OiRLtE7jcBF5EFjEb2/oc8FDVTPP7EucSu6tM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=a/Jw4OYW; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="a/Jw4OYW" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=L1LxK4TZQDE52pEV0Jwgeq4wCFdLfv5GHDtN18/XliQ=; b=a/Jw4OYWkUu9i9ligkRfj88aZL Tkyvpy7o7Y2v3Y+3bhlUnJAPwwLtckpSHNV6Ko4NVTD1NoZ15zuAvHzfNw5fAXzgLB+d1NRUXv3fJ Nqg/ydNNwTyQ5kHjfI59Vw8vmN/yuNxvQq6tWdZhgmaTv5MUqFFsSmyCmTfNL4BSnZTui0kKk/CLS ooOAwqcAleCIwxoX5+rPyRa7shbaYKG1ZckAbVvjb1/fHQRVZKg0KD3Mkxb6cWifJtHYf0PVy3JxU bMy+9nN+h1qOM6UXnrdE38EU9GK66CIetCIH4UnBV/8iPA6Cj25hmpSm1wT6Z+SHTJlk0YChLQACC m70PJxkw==; Received: from [191.204.192.64] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uEZmW-007G93-4g; Mon, 12 May 2025 22:35:13 +0200 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: "Alex Deucher" , =?UTF-8?q?Christian=20K=C3=B6nig?= , siqueira@igalia.com, airlied@gmail.com, simona@ffwll.ch, "Raag Jadav" , rodrigo.vivi@intel.com, jani.nikula@linux.intel.com, Xaver Hugl , "Pierre-Loup A . Griffais" , Krzysztof Karas Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, amd-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH v3 2/3] drm/doc: Add a section about "App information" for the wedge API Date: Mon, 12 May 2025 17:34:36 -0300 Message-ID: <20250512203437.989894-3-andrealmeid@igalia.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250512203437.989894-1-andrealmeid@igalia.com> References: <20250512203437.989894-1-andrealmeid@igalia.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: quoted-printable Add a section about "App information" for the wedge API. Signed-off-by: Andr=C3=A9 Almeida Reviewed-by: Krzysztof Karas Reviewed-by: Raag Jadav --- v3: - Change "app that caused ..." to "app involved ..." - Clarify that devcoredump have more information about what happened - Update that PID and APP will be empty if there's no app info --- Documentation/gpu/drm-uapi.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst index 69f72e71a96e..3300a928d8ef 100644 --- a/Documentation/gpu/drm-uapi.rst +++ b/Documentation/gpu/drm-uapi.rst @@ -446,6 +446,23 @@ telemetry information (devcoredump, syslog). This is u= seful because the first hang is usually the most critical one which can result in consequential ha= ngs or complete wedging. =20 +App information +--------------- + +The information about which application (if any) was involved in the device +wedging is useful for userspace if they want to notify the user about what +happened (e.g. the compositor display a message to the user "The +caused a graphical error and the system recovered") or to implement polici= es +(e.g. the daemon may "ban" an app that keeps resetting the device). If the= app +information is available, the uevent will display as ``PID=3D`` and +``APP=3D``. Otherwise, ``PID`` and ``APP`` will not appear in t= he event +string. + +The reliability of this information is driver and hardware specific, and s= hould +be taken with a caution regarding it's precision. To have a big picture of= what +happened, the devcoredump file provides should have much more detailed +information about the device state and about the event. + Consumer prerequisites ---------------------- =20 --=20 2.49.0 From nobody Sun Feb 8 20:59:43 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 96D50298CDF for ; Mon, 12 May 2025 20:35:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747082131; cv=none; b=eIMoJw9UJeKbTfKthChojObvJ53yrtnDPGMUmnhBV9RnWc5RJzaZiiCQlOL1ktEWrhvg20Zetv37yzp9EPwT4uctn46j4FMFMT+Qjhi7H5mI7Kn2RaDskOiukwjTumb12OCGIgeSdewpJaUl/5lgXU59T6dFfs8G0WyEyFZB3n4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747082131; c=relaxed/simple; bh=vmLwhuTwTvt7eMs50a6cBYCilwolKWR9eHExvgLaBtA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gVC1KZwENU4lBDfHo9sNa9+9qw3hWs8DUxHwrpnbnPbzRIuyKRbDHeY2wzv1YNYK5ZOuJiP+bS4ACgzc4Vyyxi7K9nx3svQ2OODQN56Cb8TkCCU2mTVhnWpkcDUVHc+5n1Mvw8MANO/YfX+9pi9MaqvS1a1e+TIXpF2xhLnOTyk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=p2WGpxig; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="p2WGpxig" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=OL4xibm39jmfI8uxvEjCXO513VYShvHZZAZJDGQ0FxA=; b=p2WGpxigHBx3gau2Yiw/fhKIZ7 syFZ3DMhwlt50o7TW2Gsq+dULtvOm+gdRv0yEH2et50uYrkPHvumZB+O7IGhwukZijURDlpLLXE/O 8OkJjji2YSYY9B3fKZyYGisXBJ/G6kseBpE7Z5MceL3DMlxGdkrrXkPMExbN22vTFw+t7AtKiVWh+ ++KWftimb2oSknkJ4pSgJoSea2yofIts4XIQJT55WpIqfltcAOKJmg2JC/55Ovx/6Rxykm/G9A9gd yHm84PlZsFwufmB+tJTXrLNgAmdJRky3SO37ZdzbuTm9tHuClB3RI5XNYhpjsDNzbZJQFBPQ4H1Ke ac5hVHGA==; Received: from [191.204.192.64] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uEZma-007G93-A4; Mon, 12 May 2025 22:35:17 +0200 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: "Alex Deucher" , =?UTF-8?q?Christian=20K=C3=B6nig?= , siqueira@igalia.com, airlied@gmail.com, simona@ffwll.ch, "Raag Jadav" , rodrigo.vivi@intel.com, jani.nikula@linux.intel.com, Xaver Hugl , "Pierre-Loup A . Griffais" , Krzysztof Karas Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, amd-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH v3 3/3] drm/amdgpu: Make use of drm_wedge_app_info Date: Mon, 12 May 2025 17:34:37 -0300 Message-ID: <20250512203437.989894-4-andrealmeid@igalia.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250512203437.989894-1-andrealmeid@igalia.com> References: <20250512203437.989894-1-andrealmeid@igalia.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: quoted-printable To notify userspace about which app (if any) made the device get in a wedge state, make use of drm_wedge_app_info parameter, filling it with the app PID and name. Signed-off-by: Andr=C3=A9 Almeida --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 +++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/a= md/amdgpu/amdgpu_device.c index c8a51418d0e7..e6d8f6d0ec47 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -6215,8 +6215,23 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *= adev, =20 atomic_set(&adev->reset_domain->reset_res, r); =20 - if (!r) - drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL); + if (!r) { + struct drm_wedge_app_info aux, *info =3D NULL; + + if (job) { + struct amdgpu_task_info *ti; + + ti =3D amdgpu_vm_get_task_info_pasid(adev, job->pasid); + if (ti) { + aux.pid =3D ti->pid; + aux.comm =3D ti->process_name; + info =3D &aux; + amdgpu_vm_put_task_info(ti); + } + } + + drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, info); + } =20 return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_job.c index a47b2eb301e5..98efa3318ddb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -89,6 +89,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct= drm_sched_job *s_job) { struct amdgpu_ring *ring =3D to_amdgpu_ring(s_job->sched); struct amdgpu_job *job =3D to_amdgpu_job(s_job); + struct drm_wedge_app_info aux, *info =3D NULL; struct amdgpu_task_info *ti; struct amdgpu_device *adev =3D ring->adev; int idx; @@ -127,6 +128,9 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(stru= ct drm_sched_job *s_job) dev_err(adev->dev, "Process information: process %s pid %d thread %s pid %d\n", ti->process_name, ti->tgid, ti->task_name, ti->pid); + aux.pid =3D ti->pid; + aux.comm =3D ti->process_name; + info =3D &aux; amdgpu_vm_put_task_info(ti); } =20 @@ -166,7 +170,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(stru= ct drm_sched_job *s_job) if (amdgpu_ring_sched_ready(ring)) drm_sched_start(&ring->sched, 0); dev_err(adev->dev, "Ring %s reset succeeded\n", ring->sched.name); - drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL); + drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, info); goto exit; } dev_err(adev->dev, "Ring %s reset failure\n", ring->sched.name); --=20 2.49.0