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 3/4] drm/xe/devcoredump: Lock snap_mutex earlier
Date: Thu, 7 Mar 2024 11:53:07 +0100 [thread overview]
Message-ID: <ce222fff-d962-4c65-9d84-9306ea91353d@linux.intel.com> (raw)
In-Reply-To: <20240304140514.24768-3-jose.souza@intel.com>
Hey,
On 2024-03-04 15:05, José Roberto de Souza wrote:
> In case job gets signaled while snapshot capture is running this
> prevents UMD from unbind VMAs that needs to be captured.
How does this protect things exactly?
It could still have happened before devcoredump_snapshot is called. I
think we should focus on protecting VM data only, if it happens to
unbind, it could have happened before devcoredump_snapshot was ever
called. All we can do its ensure that we dump without causing security
issues, which the current code already does.
Cheers,
~Maarten
>
> 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 | 7 +++++++
> drivers/gpu/drm/xe/xe_vm.c | 2 --
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
> index 4ab0feca55cdd..24d27f1c9efc6 100644
> --- a/drivers/gpu/drm/xe/xe_devcoredump.c
> +++ b/drivers/gpu/drm/xe/xe_devcoredump.c
> @@ -162,6 +162,9 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
> int i;
> bool cookie;
>
> + if (q->vm)
> + mutex_lock(&q->vm->snap_mutex);
> +
> ss->snapshot_time = ktime_get_real();
> ss->boot_time = ktime_get_boottime();
>
> @@ -197,6 +200,10 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
> queue_work(system_unbound_wq, &ss->work);
>
> xe_force_wake_put(gt_to_fw(q->gt), XE_FORCEWAKE_ALL);
> +
> + if (q->vm)
> + mutex_unlock(&q->vm->snap_mutex);
> +
> dma_fence_end_signalling(cookie);
> }
>
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index f7d20bf9b33a9..544907b09289a 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -3328,7 +3328,6 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm)
> if (!vm)
> return NULL;
>
> - mutex_lock(&vm->snap_mutex);
> drm_gpuvm_for_each_va(gpuva, &vm->gpuvm) {
> if (gpuva->flags & XE_VMA_DUMPABLE)
> num_snaps++;
> @@ -3373,7 +3372,6 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm)
> }
>
> out_unlock:
> - mutex_unlock(&vm->snap_mutex);
> return snap;
> }
>
next prev parent reply other threads:[~2024-03-07 10:53 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
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 [this message]
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=ce222fff-d962-4c65-9d84-9306ea91353d@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