From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, akihiko.odaki@gmail.com
Subject: Re: [PATCH] virtio-gpu/virgl: free BHs and timers on renderer reset
Date: Thu, 27 Aug 2026 18:07:28 +0100 [thread overview]
Message-ID: <871pbj5w6n.fsf@draig.linaro.org> (raw)
In-Reply-To: <CAJ+F1CJ-tFV4Yc8Gvp7huyQjLZJW5FE5fKb4QEqf+wSB8DNA-Q@mail.gmail.com> ("Marc-André Lureau"'s message of "Thu, 27 Aug 2026 20:31:49 +0400")
Marc-André Lureau <marcandre.lureau@redhat.com> writes:
> Hi
>
> On Thu, Aug 27, 2026 at 8:11 PM Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> marcandre.lureau@redhat.com writes:
>>
>> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
>> >
>> > virtio_gpu_virgl_reset() does not free the bottom halves or timers
>> > allocated by the previous virtio_gpu_virgl_init() call. A subsequent
>> > virtio_gpu_virgl_init() overwrites the old pointers, leaking the
>> > previous allocations.
>> >
>> > Fixes: bd9258917fbf ("virtio-gpu: Destroy virgl resources on virtio-gpu reset")
>> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> > ---
>> > hw/display/virtio-gpu-virgl.c | 6 ++++++
>> > 1 file changed, 6 insertions(+)
>> >
>> > diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
>> > index 0b79aef8d1f5..8bf6417c6514 100644
>> > --- a/hw/display/virtio-gpu-virgl.c
>> > +++ b/hw/display/virtio-gpu-virgl.c
>> > @@ -1425,6 +1425,7 @@ void virtio_gpu_virgl_reset_scanout(VirtIOGPU *g)
>> >
>> > static bool virtio_gpu_virgl_reset(VirtIOGPU *g)
>> > {
>> > + VirtIOGPUGL *gl = VIRTIO_GPU_GL(g);
>> > struct virtio_gpu_simple_resource *res, *tmp;
>> >
>> > /*
>> > @@ -1443,6 +1444,11 @@ static bool virtio_gpu_virgl_reset(VirtIOGPU *g)
>> >
>> > virtio_gpu_virgl_reset_async_fences(g);
>> >
>> > + g_clear_pointer(&gl->cmdq_resume_bh, qemu_bh_delete);
>> > + g_clear_pointer(&gl->async_fence_bh, qemu_bh_delete);
>> > + g_clear_pointer(&gl->print_stats, timer_free);
>> > + g_clear_pointer(&gl->fence_poll, timer_free);
>> > +
>>
>> Don't we need some ptr checks in virtio_gpu_gl_device_unrealize so a
>> reset followed by an unplug doesn't causes segs chasing now NULL
>> pointers?
>
> Good point, actually we should be safe, since render_state < RS_INITED.
>
> But those qemu_bh_delete().. can we make it safe to call with NULL?
That seems sane as it will be on the exit path. I wouldn't tolerate
NULL for any of the other qemu_bh functions though.
> timer_free() was fixed already.
>
>>
>>
>> > return true;
>> > }
>>
>> --
>> Alex Bennée
>> Virtualisation Tech Lead @ Linaro
>>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2026-08-27 17:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 15:43 [PATCH] virtio-gpu/virgl: free BHs and timers on renderer reset marcandre.lureau
2026-08-27 16:11 ` Alex Bennée
2026-08-27 16:31 ` Marc-André Lureau
2026-08-27 17:07 ` Alex Bennée [this message]
2026-08-28 12:47 ` Akihiko Odaki
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=871pbj5w6n.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=akihiko.odaki@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.