lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <925fda15-fb21-f42f-f3e4-9284959696be@amd.com>
Date: Tue, 25 Mar 2025 11:14:34 -0700
From: Lizhi Hou <lizhi.hou@....com>
To: Jeff Hugo <jeff.hugo@....qualcomm.com>, <ogabbay@...nel.org>,
	<jacek.lawrynowicz@...ux.intel.com>, <mario.limonciello@....com>,
	<dri-devel@...ts.freedesktop.org>
CC: <linux-kernel@...r.kernel.org>, <min.ma@....com>, <max.zhen@....com>,
	<sonal.santan@....com>, <king.tam@....com>
Subject: Re: [PATCH V1] accel/amdxdna: Add BO import and export

Hi Jeff,


Just noticed that the driver should not use import_attach. 
https://lore.kernel.org/all/20250317131923.238374-1-tzimmermann@suse.de/

I will remove the import_attach usage and send V3 patch.


Thanks

Lizhi

On 3/21/25 12:52, Lizhi Hou wrote:
>
> On 3/21/25 08:15, Jeff Hugo wrote:
>> On 3/6/2025 11:03 AM, Lizhi Hou wrote:
>>> +struct drm_gem_object *
>>> +amdxdna_gem_prime_import(struct drm_device *dev, struct dma_buf 
>>> *dma_buf)
>>> +{
>>> +    struct dma_buf_attachment *attach;
>>> +    struct drm_gem_object *gobj;
>>> +    struct sg_table *sgt;
>>> +    int ret;
>>> +
>>> +    attach = dma_buf_attach(dma_buf, dev->dev);
>>> +    if (IS_ERR(attach))
>>> +        return ERR_CAST(attach);
>>> +
>>> +    get_dma_buf(dma_buf);
>>> +
>>> +    sgt = dma_buf_map_attachment_unlocked(attach, DMA_BIDIRECTIONAL);
>>> +    if (IS_ERR(sgt)) {
>>> +        ret = PTR_ERR(sgt);
>>> +        goto fail_detach;
>>> +    }
>>> +
>>> +    gobj = drm_gem_shmem_prime_import_sg_table(dev, attach, sgt);
>>> +    if (IS_ERR(gobj)) {
>>> +        ret = PTR_ERR(gobj);
>>> +        goto fail_unmap;
>>> +    }
>>> +
>>> +    gobj->import_attach = attach;
>>> +    gobj->resv = dma_buf->resv;
>>> +
>>> +    return gobj;
>>> +
>>> +fail_unmap:
>>> +    dma_buf_unmap_attachment_unlocked(attach, sgt, DMA_BIDIRECTIONAL);
>>> +fail_detach:
>>> +    dma_buf_detach(dma_buf, attach);
>>> +    dma_buf_put(dma_buf);
>>
>> You attach() and then get(), so normal "reverse order" cleanup would 
>> be put(), then detach(). That is not what you do here. Should this be 
>> reordered, or should you get() then attach() first?
>
> I referred drm_gem_prime_import_dev(). And I agree with you. It looks 
> better to get() before attach(). I will respin V2 which will also 
> contain another small update for this patch.
>
>
> Thanks,
>
> Lizhi
>
>>
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ