Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "José Roberto de Souza" <jose.souza@intel.com>
Cc: <linux-kernel@vger.kernel.org>, <intel-xe@lists.freedesktop.org>,
	Jonathan Cavitt <jonathan.cavitt@intel.com>
Subject: Re: [PATCH v4 2/2] drm/xe: Remove devcoredump during driver release
Date: Tue, 9 Apr 2024 18:21:45 -0400	[thread overview]
Message-ID: <ZhW_eTyS6Irp619S@intel.com> (raw)
In-Reply-To: <20240409200206.108452-2-jose.souza@intel.com>

On Tue, Apr 09, 2024 at 01:02:06PM -0700, José Roberto de Souza wrote:
> 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 <rodrigo.vivi@intel.com>
> Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>
> Acked-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  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 <linux/devcoredump.h>
>  #include <generated/utsrelease.h>
>  
> +#include <drm/drm_managed.h>
> +
>  #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
> 

  reply	other threads:[~2024-04-09 22:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 20:02 [PATCH v4 1/2] devcoredump: Add dev_coredump_put() José Roberto de Souza
2024-04-09 20:02 ` [PATCH v4 2/2] drm/xe: Remove devcoredump during driver release José Roberto de Souza
2024-04-09 22:21   ` Rodrigo Vivi [this message]
2024-04-09 20:07 ` ✓ CI.Patch_applied: success for series starting with [v4,1/2] devcoredump: Add dev_coredump_put() Patchwork
2024-04-09 20:07 ` ✗ CI.checkpatch: warning " Patchwork
2024-04-09 20:08 ` ✓ CI.KUnit: success " Patchwork
2024-04-09 20:19 ` ✓ CI.Build: " Patchwork
2024-04-09 20:22 ` ✓ CI.Hooks: " Patchwork
2024-04-09 20:23 ` ✓ CI.checksparse: " Patchwork
2024-04-09 20:48 ` ✓ CI.BAT: " Patchwork
2024-04-09 22:23 ` [PATCH v4 1/2] " Rodrigo Vivi
2024-04-11 13:08   ` Greg KH
2024-04-09 22:39 ` ✗ CI.FULL: failure for series starting with [v4,1/2] " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZhW_eTyS6Irp619S@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jonathan.cavitt@intel.com \
    --cc=jose.souza@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox