public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: stable <stable@vger.kernel.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Matteo Croce <mcroce@linux.microsoft.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm: fix struct page layout on 32-bit systems
Date: Sun, 16 May 2021 19:22:14 +0100	[thread overview]
Message-ID: <YKFi1hIBGLIQOHgc@casper.infradead.org> (raw)
In-Reply-To: <CAHk-=wgTG0Bb30NzXX=3F=n-rHjVrQAHVzFFCxRKWTTu1QxABQ@mail.gmail.com>

On Sun, May 16, 2021 at 09:29:41AM -0700, Linus Torvalds wrote:
> On Sun, May 16, 2021 at 5:19 AM Matthew Wilcox (Oracle)
> <willy@infradead.org> wrote:
> >
> > 32-bit architectures which expect 8-byte alignment for 8-byte integers and
> > need 64-bit DMA addresses (arm, mips, ppc) had their struct page
> > inadvertently expanded in 2019.  When the dma_addr_t was added, it forced
> > the alignment of the union to 8 bytes, which inserted a 4 byte gap between
> > 'flags' and the union.
> 
> So I already have this in my tree, but this stable submission made me go "Hmm".
> 
> Why do we actually want a full 64-bit DMA address on 32-bit architectures here?
> 
> It strikes me that the address is page-aligned, and I suspect we could
> just use a 32-bit "DMA page frame number" instead in 'struct page'?

Nobody's been willing to guarantee that all 32-bit architectures keep the
top 20 bits clear for their DMA addresses.  I've certainly seen hardware
(maybe PA-RISC?  MIPS?) which uses the top few bits of the DMA address to
indicate things like "coherent" or "bypasses IOMMU".  Rather than trying
to find out, I thought this was the safer option.  It only affects
32-bit architectures with PAE, and I'd rather not introduce a shift on
64-bit architectures to work around a 32-bit PAE problem.

  reply	other threads:[~2021-05-16 18:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-16 12:18 [PATCH] mm: fix struct page layout on 32-bit systems Matthew Wilcox (Oracle)
2021-05-16 12:31 ` Matthew Wilcox
2021-05-17 10:06   ` Greg KH
2021-05-16 16:29 ` Linus Torvalds
2021-05-16 18:22   ` Matthew Wilcox [this message]
2021-05-16 18:27     ` Linus Torvalds
2021-05-16 19:09       ` Matthew Wilcox
2021-05-16 19:22         ` Linus Torvalds
2021-05-17  2:42           ` Matthew Wilcox
2021-05-17 22:18             ` Linus Torvalds
2021-05-17 23:02               ` Matthew Wilcox
2021-05-17 23:37                 ` Linus Torvalds
2021-05-18  0:02                   ` Linus Torvalds
2021-05-18  0:53                     ` Matthew Wilcox
  -- strict thread matches above, loose matches on Subject: below --
2021-05-10 15:32 [PATCH] mm: Fix " Matthew Wilcox (Oracle)
2021-05-10 16:38 ` Matteo Croce

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=YKFi1hIBGLIQOHgc@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=brouer@redhat.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=mcroce@linux.microsoft.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vbabka@suse.cz \
    /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