Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
To: <John.C.Harrison@Intel.com>, <Intel-Xe@Lists.FreeDesktop.Org>
Subject: Re: [PATCH v2 3/4] drm/xe: Allow freeing of a managed bo
Date: Tue, 9 Sep 2025 15:10:06 -0700	[thread overview]
Message-ID: <a9b8d42c-bff6-4faa-8b9a-5fb447d248b1@intel.com> (raw)
In-Reply-To: <20250805234256.1021020-4-John.C.Harrison@Intel.com>



On 8/5/2025 4:42 PM, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> If a bo is created via xe_managed_bo_create_pin_map() then it cannot be
> freed by the driver using xe_bo_unpin_map_no_vm(), or indeed any other
> existing function. The DRM layer will still have a pointer stashed
> away for later freeing, causing a invalid memory access on driver
> unload. So add a helper for releasing the DRM action as well.
>
> v2: Drop 'xe' parameter (review feedbak from Michal W)
>
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> ---
>   drivers/gpu/drm/xe/xe_bo.c | 5 +++++
>   drivers/gpu/drm/xe/xe_bo.h | 1 +
>   2 files changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index ffca1cea5585..87aa0f5b2b2a 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -2222,6 +2222,11 @@ struct xe_bo *xe_managed_bo_create_pin_map(struct xe_device *xe, struct xe_tile
>   	return bo;
>   }
>   
> +void xe_managed_bo_unpin_map_no_vm(struct xe_bo *bo)

Not sure if the "_no_vm" postfix is the best choice here, because all 
managed_bo operations are without vm. But maybe better to keep it for 
future-proofing, in case we have a vm-enabled version later?
Since I'm undecided myself I won't block on it.

Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Daniele

> +{
> +	devm_release_action(xe_bo_device(bo)->drm.dev, __xe_bo_unpin_map_no_vm, bo);
> +}
> +
>   struct xe_bo *xe_managed_bo_create_from_data(struct xe_device *xe, struct xe_tile *tile,
>   					     const void *data, size_t size, u32 flags)
>   {
> diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
> index 8cce413b5235..298eef403505 100644
> --- a/drivers/gpu/drm/xe/xe_bo.h
> +++ b/drivers/gpu/drm/xe/xe_bo.h
> @@ -122,6 +122,7 @@ struct xe_bo *xe_bo_create_pin_map_at_aligned(struct xe_device *xe,
>   					      u64 alignment);
>   struct xe_bo *xe_managed_bo_create_pin_map(struct xe_device *xe, struct xe_tile *tile,
>   					   size_t size, u32 flags);
> +void xe_managed_bo_unpin_map_no_vm(struct xe_bo *bo);
>   struct xe_bo *xe_managed_bo_create_from_data(struct xe_device *xe, struct xe_tile *tile,
>   					     const void *data, size_t size, u32 flags);
>   int xe_managed_bo_reinit_in_vram(struct xe_device *xe, struct xe_tile *tile, struct xe_bo **src);


  reply	other threads:[~2025-09-09 22:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05 23:42 [PATCH v2 0/4] Add test for G2G communications John.C.Harrison
2025-08-05 23:42 ` [PATCH v2 1/4] drm/xe/guc: Update CSS header structures John.C.Harrison
2025-09-05 21:30   ` Daniele Ceraolo Spurio
2025-08-05 23:42 ` [PATCH v2 2/4] drm/xe/guc: Add firmware build type to available info John.C.Harrison
2025-08-05 23:42 ` [PATCH v2 3/4] drm/xe: Allow freeing of a managed bo John.C.Harrison
2025-09-09 22:10   ` Daniele Ceraolo Spurio [this message]
2025-08-05 23:42 ` [PATCH v2 4/4] drm/xe/guc: Add test for G2G communications John.C.Harrison
2025-09-05 22:20   ` Daniele Ceraolo Spurio
2025-08-06  0:58 ` ✗ CI.checkpatch: warning for Add test for G2G communications (rev2) Patchwork
2025-08-06  0:59 ` ✓ CI.KUnit: success " Patchwork
2025-08-06  1:33 ` ✓ Xe.CI.BAT: " Patchwork
2025-08-06  2:36 ` ✗ Xe.CI.Full: failure " 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=a9b8d42c-bff6-4faa-8b9a-5fb447d248b1@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=Intel-Xe@Lists.FreeDesktop.Org \
    --cc=John.C.Harrison@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