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] [thread-next>] [day] [month] [year] [list]
Message-ID: <578953dd-6298-2bfe-a8fb-52004b84fd17@amd.com>
Date:   Thu, 23 Jun 2022 13:32:18 +0200
From:   Christian König <christian.koenig@....com>
To:     Daniel Stone <daniel@...ishbar.org>
Cc:     Lucas Stach <l.stach@...gutronix.de>,
        Pekka Paalanen <ppaalanen@...il.com>,
        "Sharma, Shashank" <Shashank.Sharma@....com>,
        lkml <linux-kernel@...r.kernel.org>,
        dri-devel <dri-devel@...ts.freedesktop.org>,
        Nicolas Dufresne <nicolas@...fresne.ca>,
        linaro-mm-sig@...ts.linaro.org,
        Sumit Semwal <sumit.semwal@...aro.org>,
        linux-media <linux-media@...r.kernel.org>
Subject: Re: DMA-buf and uncached system memory

Am 23.06.22 um 13:27 schrieb Daniel Stone:
> Hi Christian,
>
> On Thu, 23 Jun 2022 at 12:11, Christian König <christian.koenig@....com> wrote:
>>> In fact DMA-buf sharing works fine on most of those SoCs because
>>> everyone just assumes that all the accelerators don't snoop, so the
>>> memory shared via DMA-buf is mostly CPU uncached. It only falls apart
>>> for uses like the UVC cameras, where the shared buffer ends up being
>>> CPU cached.
>> Well then the existing DMA-buf framework is not what you want to use for
>> this.
>>
>>> Non-coherent without explicit domain transfer points is just not going
>>> to work. So why can't we solve the issue for DMA-buf in the same way as
>>> the DMA API already solved it years ago: by adding the equivalent of
>>> the dma_sync calls that do cache maintenance when necessary? On x86 (or
>>> any system where things are mostly coherent) you could still no-op them
>>> for the common case and only trigger cache cleaning if the importer
>>> explicitly says that is going to do a non-snooping access.
>> Because DMA-buf is a framework for buffer sharing between cache coherent
>> devices which don't signal transitions.
>>
>> We intentionally didn't implemented any of the dma_sync_* functions
>> because that would break the intended use case.
>>
>> You can of course use DMA-buf in an incoherent environment, but then you
>> can't expect that this works all the time.
>>
>> This is documented behavior and so far we have bluntly rejected any of
>> the complains that it doesn't work on most ARM SoCs and I don't really
>> see a way to do this differently.
> For some strange reason, 'let's do buffer sharing but make sure it
> doesn't work on Arm' wasn't exactly the intention of the groups who
> came together under the Linaro umbrella to create dmabuf.
>
> If it's really your belief that dmabuf requires universal snooping, I
> recommend you send the patch to update the documentation, as well as
> to remove DRIVER_PRIME from, realistically, most non-PCIE drivers.

Well, to be honest I think that would indeed be necessary.

What we have created are essentially two different worlds, one for PCI 
devices and one for the rest.

This was indeed not the intention, but it's a fact that basically all 
DMA-buf based PCI drivers assume coherent access.

Regards,
Christian.

>
> Cheers,
> Daniel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ