From: Greg KH <gregkh@linuxfoundation.org>
To: 潘煜杭 <panyuhang@hdu.edu.cn>
Cc: zack.rusin@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
security@kernel.org
Subject: Re: [PATCH] drm/vmwgfx: unpin BOs without revalidating placement
Date: Thu, 29 Oct 2026 10:00:27 +0100 [thread overview]
Message-ID: <2026102908-calculus-reenact-6ec5@gregkh> (raw)
In-Reply-To: <AD6AfwDkLPJWAKFimg*tgar*.1.1793261964318.Hmail.242270054@hdu.edu.cn>
On Thu, Oct 29, 2026 at 04:19:24PM +0800, 潘煜杭 wrote:
>
> Unpinning a buffer object does not change its memory placement.
> Placement revalidation is unnecessary. Currently
> vmw_bo_pin_reserved() calls ttm_bo_validate() for both pin and unpin
> operations and treats any validation error as impossible with BUG_ON().
>
> During PRIME/GEM cleanup, vmw_gem_object_unpin() calls
> vmw_bo_pin_reserved(vbo, false). The Linux 7.3-based QEMU reproducer
> confirmed that ttm_bo_validate() returned -EINVAL. The following BUG_ON()
> crashed the kernel during process exit.
>
> The relevant report excerpt is:
>
> [ 72.916147] [BO_PIN_TRACE] before-validate pin=0 old_mem_type=0 target_mem_type=0 flags=0x10
> [ 72.916201] [BO_PIN_TRACE] after-validate ret=-22 old_mem_type=0 new_mem_type=0 ...
> [ 72.918841] kernel BUG at drivers/gpu/drm/vmwgfx/vmwgfx_bo.c:342!
> [ 72.918892] Oops: invalid opcode: 0000 [#1] SMP NOPTI
> [ 72.933292] CPU: 1 UID: 0 PID: 346 Comm: repro_vmwgfx_bo
> Not tainted 7.3.0-dirty #2 PREEMPT(lazy)
> [ 72.937912] RIP: 0010:vmw_bo_pin_reserved+0x36d/0x380
> [ 72.947235] RBP: 00000000ffffffea
> [ 72.990254] Fixing recursive fault but reboot is needed!
>
> The reproducer created a dumb GEM buffer, exported/imported its PRIME fd,
> performed GEM flink/open/close operations, and exited. During exit_group(),
> the call path was vmw_gem_object_unpin() -> drm_gem_map_detach() ->
> dma_buf_detach() -> drm_prime_gem_destroy() -> drm_gem_shmem_release() ->
> vmw_bo_pin_reserved().
>
> The fix skips ttm_bo_validate() when unpinning. Validation remains on the
> pin path before ttm_bo_pin().
>
> Assisted-by: OpenAI Codex (GPT-5)
> Signed-off-by: Yuhang Pan <242270054@hdu.edu.cn>
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
> index 9c7a73c..14d28e2 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
> @@ -308,6 +308,11 @@ void vmw_bo_pin_reserved(struct vmw_bo *vbo, bool pin)
> if (pin == !!bo->pin_count)
> return;
>
> + if (!pin) {
> + ttm_bo_unpin(bo);
> + return;
> + }
> +
> pl.fpfn = 0;
> pl.lpfn = 0;
> pl.mem_type = bo->resource->mem_type;
> @@ -321,8 +326,5 @@ void vmw_bo_pin_reserved(struct vmw_bo *vbo, bool pin)
>
> BUG_ON(ret != 0 || bo->resource->mem_type != old_mem_type);
>
> - if (pin)
> - ttm_bo_pin(bo);
> - else
> - ttm_bo_unpin(bo);
> + ttm_bo_pin(bo);
> }
>
> --
> 2.34.1
This patch is corrupted and can not be applied :(
Also, no Fixes: or cc: stable tags?
thanks,
greg k-h
next prev parent reply other threads:[~2026-10-29 9:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 8:19 潘煜杭
2026-10-29 9:00 ` Greg KH [this message]
2026-10-29 13:50 ` Willy Tarreau
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=2026102908-calculus-reenact-6ec5@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=airlied@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=panyuhang@hdu.edu.cn \
--cc=security@kernel.org \
--cc=tzimmermann@suse.de \
--cc=zack.rusin@broadcom.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
all inboxes | Powered by JetHome®