From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: "José Roberto de Souza" <jose.souza@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 2/4] drm/xe/devcoredump: Print errno if VM snapshot was not captured
Date: Thu, 7 Mar 2024 11:50:53 +0100 [thread overview]
Message-ID: <83889329-ec9f-4c0e-8bb7-f34a8670d607@linux.intel.com> (raw)
In-Reply-To: <20240304140514.24768-2-jose.souza@intel.com>
On 2024-03-04 15:05, José Roberto de Souza wrote:
> My testing machine has only 8GB of RAM and while running piglit tests
> I can reach the OOM cache in xe_vm_snapshot_capture() snap allocaiton
> sometimes.
>
> So to differentiate the OOM from race between capture and UMDs
> unbinbind VMs here I'm adding a '[0].error: -12' to devcoredump.
>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> ---
> drivers/gpu/drm/xe/xe_devcoredump.c | 6 ++----
> drivers/gpu/drm/xe/xe_vm.c | 13 ++++++++++---
> 2 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
> index 0fcd306803236..4ab0feca55cdd 100644
> --- a/drivers/gpu/drm/xe/xe_devcoredump.c
> +++ b/drivers/gpu/drm/xe/xe_devcoredump.c
> @@ -117,10 +117,8 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
> if (coredump->snapshot.hwe[i])
> xe_hw_engine_snapshot_print(coredump->snapshot.hwe[i],
> &p);
> - if (coredump->snapshot.vm) {
> - drm_printf(&p, "\n**** VM state ****\n");
> - xe_vm_snapshot_print(coredump->snapshot.vm, &p);
> - }
> + drm_printf(&p, "\n**** VM state ****\n");
> + xe_vm_snapshot_print(coredump->snapshot.vm, &p);
>
> return count - iter.remain;
> }
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index df9360a4c9e8e..f7d20bf9b33a9 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -3336,8 +3336,10 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm)
>
> if (num_snaps)
> snap = kvzalloc(offsetof(struct xe_vm_snapshot, snap[num_snaps]), GFP_NOWAIT);
> - if (!snap)
> + if (!snap) {
> + snap = num_snaps ? ERR_PTR(-ENODEV) : ERR_PTR(-ENOMEM);
> goto out_unlock;
> + }
You inverted -ENODEV and -ENOMEM here. Perhaps return earlier for
!num_snaps instead of a ternary?
>
> snap->num_snaps = num_snaps;
> i = 0;
> @@ -3377,7 +3379,7 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm)
>
> void xe_vm_snapshot_capture_delayed(struct xe_vm_snapshot *snap)
> {
> - if (!snap)
> + if (IS_ERR(snap))
> return;
>
> for (int i = 0; i < snap->num_snaps; i++) {
> @@ -3434,6 +3436,11 @@ void xe_vm_snapshot_print(struct xe_vm_snapshot *snap, struct drm_printer *p)
> {
> unsigned long i, j;
>
> + if (IS_ERR(snap)) {
> + drm_printf(p, "[0].error: %li\n", PTR_ERR(snap));
> + return;
> + }
> +
> for (i = 0; i < snap->num_snaps; i++) {
> drm_printf(p, "[%llx].length: 0x%lx\n", snap->snap[i].ofs, snap->snap[i].len);
>
> @@ -3460,7 +3467,7 @@ void xe_vm_snapshot_free(struct xe_vm_snapshot *snap)
> {
> unsigned long i;
>
> - if (!snap)
> + if (IS_ERR(snap))
> return;
>
> for (i = 0; i < snap->num_snaps; i++) {
next prev parent reply other threads:[~2024-03-07 10:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 14:05 [PATCH 1/4] drm/xe: Make devcoredump VM error state print consistent José Roberto de Souza
2024-03-04 14:05 ` [PATCH 2/4] drm/xe/devcoredump: Print errno if VM snapshot was not captured José Roberto de Souza
2024-03-07 10:50 ` Maarten Lankhorst [this message]
2024-03-04 14:05 ` [PATCH 3/4] drm/xe/devcoredump: Lock snap_mutex earlier José Roberto de Souza
2024-03-07 10:53 ` Maarten Lankhorst
2024-03-04 14:05 ` [PATCH 4/4] drm/xe: Nuke EXEC_QUEUE_FLAG_PERSISTENT José Roberto de Souza
2024-03-07 10:54 ` Maarten Lankhorst
2024-03-05 5:35 ` ✓ CI.Patch_applied: success for series starting with [1/4] drm/xe: Make devcoredump VM error state print consistent (rev2) Patchwork
2024-03-05 5:35 ` ✗ CI.checkpatch: warning " Patchwork
2024-03-05 5:36 ` ✓ CI.KUnit: success " Patchwork
2024-03-05 5:47 ` ✓ CI.Build: " Patchwork
2024-03-05 5:47 ` ✓ CI.Hooks: " Patchwork
2024-03-05 5:49 ` ✓ CI.checksparse: " Patchwork
2024-03-05 6:09 ` ✓ CI.BAT: " 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=83889329-ec9f-4c0e-8bb7-f34a8670d607@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jose.souza@intel.com \
/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