[PATCH] kmap_local: don't assume kmap PTEs are linear arrays in memory

Russell King (Oracle) linux at armlinux.org.uk
Tue Nov 9 03:47:16 PST 2021


On Fri, Nov 05, 2021 at 04:01:20PM +0100, Ard Biesheuvel wrote:
> On Fri, 5 Nov 2021 at 15:50, Russell King (Oracle)
> <linux at armlinux.org.uk> wrote:
> >
> > On Fri, Nov 05, 2021 at 03:21:00PM +0100, Ard Biesheuvel wrote:
> > > On Tue, 26 Oct 2021 at 15:13, Ard Biesheuvel <ardb at kernel.org> wrote:
> > > >
> > > > The kmap_local conversion broke the ARM architecture, because the new
> > > > code assumes that all PTEs used for creating kmaps form a linear array
> > > > in memory, and uses array indexing to look up the kmap PTE belonging to
> > > > a certain kmap index.
> > > >
> > > > On ARM, this cannot work, not only because the PTE pages may be
> > > > non-adjacent in memory, but also because ARM/!LPAE interleaves hardware
> > > > entries and extended entries (carrying software-only bits) in a way that
> > > > is not compatible with array indexing.
> > > >
> > > > Fortunately, this only seems to affect configurations with more than 8
> > > > CPUs, due to the way the per-CPU kmap slots are organized in memory.
> > > >
> > > > Work around this by permitting an architecture to set a Kconfig symbol
> > > > that signifies that the kmap PTEs do not form a lineary array in memory,
> > > > and so the only way to locate the appropriate one is to walk the page
> > > > tables.
> > > >
> > > > Reported-by: Quanyang Wang <quanyang.wang at windriver.com>
> > > > Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
> > > > ---
> > >
> > > Ping? Can we get this fixed please?
> >
> > Who are you expecting to apply it? It seems to be touching only core
> > code, so I don't think it's up to me - not without some kind of review
> > from mm guys.
> >
> 
> I was hoping Thomas would respond, given that he introduced the
> problem in the first place, and can either carry the fix himself, or
> tell us whether he wants it fixed in a different way.

We're two weeks on, and Thomas hasn't responded - not on IRC nor via
email. Can we get akpm to pick the patch up? (Original patch message
attached.)

I think I have one fix ("fix early early_iounmap()") that needs to go
to Linus, so alternatively I could send it with that... if someone
wants to drop it in the patch system.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
-------------- next part --------------
An embedded message was scrubbed...
From: Ard Biesheuvel <ardb at kernel.org>
Subject: [PATCH] kmap_local: don't assume kmap PTEs are linear arrays in memory
Date: Tue, 26 Oct 2021 15:12:49 +0200
Size: 7588
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20211109/f7174c06/attachment-0001.eml>


More information about the linux-arm-kernel mailing list