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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ba8aefcd8c5a4e8e921e5f56e199a82f@AcuMS.aculab.com>
Date:   Tue, 12 Oct 2021 21:01:16 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Jarkko Sakkinen' <jarkko@...nel.org>,
        Jason Gunthorpe <jgg@...pe.ca>
CC:     Cai Huoqing <caihuoqing@...du.com>,
        Michael Ellerman <mpe@...erman.id.au>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        Peter Huewe <peterhuewe@....de>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
        "linux-integrity@...r.kernel.org" <linux-integrity@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] tpm: ibmvtpm: Make use of dma_alloc_coherent()

From: Jarkko Sakkinen
> Sent: 12 October 2021 18:41
> 
> On Tue, 2021-10-12 at 12:43 -0300, Jason Gunthorpe wrote:
> > On Tue, Oct 12, 2021 at 06:29:58PM +0300, Jarkko Sakkinen wrote:
> > > On Mon, 2021-10-11 at 00:01 +0800, Cai Huoqing wrote:
> > > > Replacing kmalloc/kfree/get_zeroed_page/free_page/dma_map_single/
> > >   ~~~~~~~~~
> > >   Replace
> > >
> > > > dma_unmap_single() with dma_alloc_coherent/dma_free_coherent()
> > > > helps to reduce code size, and simplify the code, and coherent
> > > > DMA will not clear the cache every time.
> > > >
> > > > Signed-off-by: Cai Huoqing <caihuoqing@...du.com>
> > >
> > > If this does not do functionally anything useful, there's no
> > > reason to apply this.
> >
> > At least in this case it looks like the ibmvtpm is not using the DMA
> > API properly. There is no sync after each data transfer. Replacing
> > this wrong usage with the coherent API is reasonable.
> 
> Thank you. As long as this is documented to the commit message,
> I'm cool with the change itself.
> 
> E.g. something like this would be perfectly fine replacement for the
> current commit message:
> 
> "The current usage pattern for the DMA API is inappropriate, as
> data transfers are not synced. Replace the existing DMA code
> with the coherent DMA API."

Why not also say that the DMA access snoop the cache?
(I think that was mentioned earlier in the thread.)

	David

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ