dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: phasta@kernel.org,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	tursulin@ursulin.net, matthew.brost@intel.com,
	sumit.semwal@linaro.org
Cc: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH 1/9] dma-buf: add dma_fence_was_initialized function v2
Date: Wed, 2 Sep 2026 12:47:02 +0200	[thread overview]
Message-ID: <275a55e8-543e-466d-a6a1-84776e763024@kernel.org> (raw)
In-Reply-To: <307d764629d7c5d2704b7897c8c0c32c1ef4ce33.camel@mailbox.org>

On 02. 09. 26, 9:03, Philipp Stanner wrote:
> On Wed, 2026-09-02 at 08:56 +0200, Jiri Slaby wrote:
>> On 02. 09. 26, 8:52, Philipp Stanner wrote:
>>> On Fri, 2026-08-28 at 10:32 +0200, Jiri Slaby wrote:
>>>> On 28. 08. 26, 9:46, Jiri Slaby wrote:
>>>>> What helps is indeed the revert back to:
>>>>>
>>>>> --- a/drivers/gpu/drm/qxl/qxl_release.c
>>>>> +++ b/drivers/gpu/drm/qxl/qxl_release.c
>>>>> @@ -147,7 +147,7 @@ qxl_release_free(struct qxl_device *qdev,
>>>>>            idr_remove(&qdev->release_idr, release->id);
>>>>>            spin_unlock(&qdev->release_idr_lock);
>>>>>
>>>>> -       if (dma_fence_was_initialized(&release->base)) {
>>>>> +       if (release->base.ops) {
>>>>
>>>> Crap, the flags simple got garbage from previous freed buffer, so:
>>>> -       release = kmalloc(size, GFP_KERNEL);
>>>> +       release = kzalloc(size, GFP_KERNEL);
>>>>
>>>> fixes this of course. Patch coming.
>>>>
>>>> Now, the ops and initialized are either both set or unset:
>>>> qxl_release_free 1: release->base.ops=0x0 initialized=0 id=6 type=2
>>>> qxl_release_free 1: release->base.ops=qxl_fence_ops initialized=1 id=2
>>>> type=0
>>>>
>>>> Unlike before.
>>>>
>>>> FTR release->base.ops were NULLed after that kmalloc. Unlike
>>>> release->base.flags.
>>>
>>> You're saying that QXL is re-using that fence if it were uninitialized?
>>
>> Sort of. The fence was dropped and freed. Then a new memory was
>> allocated. And garbage from that allocation was used -- it might be the
>> old (freed) fence. Or anything else freed previously. Simply garbage.
> 
> 
> Maybe even dma_fence_init() should zero out the memory for maximum
> robustness.

That would not help as dma_fence_init() is called too late or not at all 
here...

dma_fence_init() is called late as the driver wants to call 
dma_fence_was_initialized() to distinguish the cases when the init was 
called and when not.

> We do that in drm_sched at a few places.
> 
> Opinions? @Christian?

-- 
js
suse labs

  reply	other threads:[~2026-09-02 10:47 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 10:54 Independence for dma_fences! v6 Christian König
2026-01-20 10:54 ` [PATCH 1/9] dma-buf: add dma_fence_was_initialized function v2 Christian König
2026-01-20 11:33   ` Tvrtko Ursulin
2026-07-13  8:58   ` Jiri Slaby
2026-07-14  7:53     ` Philipp Stanner
2026-07-14  8:43       ` Philipp Stanner
2026-08-19  8:59         ` Jiri Slaby
2026-08-19 12:33           ` Philipp Stanner
2026-08-19 12:51             ` Philipp Stanner
2026-08-28  7:29               ` Jiri Slaby
2026-08-28  7:46                 ` Jiri Slaby
2026-08-28  8:32                   ` Jiri Slaby
2026-09-02  6:52                     ` Philipp Stanner
2026-09-02  6:56                       ` Jiri Slaby
2026-09-02  7:03                         ` Philipp Stanner
2026-09-02 10:47                           ` Jiri Slaby [this message]
2026-01-20 10:54 ` [PATCH 2/9] dma-buf: protected fence ops by RCU v5 Christian König
2026-01-20 10:54 ` [PATCH 3/9] dma-buf: detach fence ops on signal v2 Christian König
2026-01-20 10:54 ` [PATCH 4/9] dma-buf: abstract fence locking Christian König
2026-01-20 10:54 ` [PATCH 5/9] dma-buf: inline spinlock for fence protection v4 Christian König
2026-01-20 11:41   ` Tvrtko Ursulin
2026-01-21  8:48     ` Christian König
2026-01-21  9:03       ` Tvrtko Ursulin
2026-01-27  4:56   ` kernel test robot
2026-01-20 10:54 ` [PATCH 6/9] dma-buf/selftests: test RCU ops and inline lock v2 Christian König
2026-01-20 10:54 ` [PATCH 7/9] dma-buf: use inline lock for the stub fence v2 Christian König
2026-01-21  9:29   ` Philipp Stanner
2026-01-20 10:54 ` [PATCH 8/9] dma-buf: use inline lock for the dma-fence-array Christian König
2026-01-20 10:54 ` [PATCH 9/9] dma-buf: use inline lock for the dma-fence-chain Christian König

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=275a55e8-543e-466d-a6a1-84776e763024@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=matthew.brost@intel.com \
    --cc=phasta@kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=tursulin@ursulin.net \
    /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