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  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]
Date:   Fri, 25 Mar 2022 22:41:01 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Linus Torvalds' <>,
        Johannes Berg <>
CC:     Maxime Bizon <>,
        Toke Høiland-Jørgensen <>,
        Robin Murphy <>,
        Christoph Hellwig <>,
        Oleksandr Natalenko <>,
        Halil Pasic <>,
        "Marek Szyprowski" <>,
        Kalle Valo <>,
        "David S. Miller" <>,
        Jakub Kicinski <>,
        "Paolo Abeni" <>,
        Olha Cherevyk <>,
        iommu <>,
        linux-wireless <>,
        Netdev <>,
        "Linux Kernel Mailing List" <>,
        Greg Kroah-Hartman <>,
        stable <>
Subject: RE: [REGRESSION] Recent swiotlb DMA_FROM_DEVICE fixes break
 ath9k-based AP

From: Linus Torvalds
> Sent: 25 March 2022 21:57
> On Fri, Mar 25, 2022 at 2:13 PM Johannes Berg <> wrote:
> >
> > Well I see now that you said 'cache "writeback"' in (1), and 'flush' in
> > (2), so perhaps you were thinking of the same, and I'm just calling it
> > "flush" and "invalidate" respectively?
> Yeah, so I mentally tend to think of the operations as just
> "writeback" (which doesn't invalidate) and "flush" (which is a
> writeback-invalidate).

It almost certainly doesn't matter whether the "writeback"
invalidates or not.
You have to assume that all sorts of operations might cause
the cpu to read in a cacheline.
This includes, but is not limited to, speculative execution
and cache line prefetch.

But you definitely need an "invalidate" to force a cache line
be read after the hardware has accessed it.
Now such lines must not be dirty; because the cpu can write
back a dirty cache line at any time - which would break things.
So this can also be "write back if dirty" and "invalidate".

Bounce buffers and cache probably work much the same way.
But for bounce buffers I guess you want to ensure the initially
allocated buffer doesn't contain old data (belonging to
someone else).
So you might decide to zero them on allocation or always copy
from the driver buffer on the first request.

Then you get the really annoying cpu that don't have a 
"write back dirty line and invalidate" opcode.
And the only way is to read enough other memory areas
to displace all the existing cache line data.
You probably might as well give up and use PIO :-)


Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists