Re: [RFC 0/6] mm, x86: New special mapping ops

From: Andy Lutomirski
Date: Wed Oct 29 2014 - 20:57:46 EST


On Wed, Oct 29, 2014 at 5:42 PM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> This is an attempt to make the core special mapping infrastructure
> track what arch vdso code needs better than it currently does. It
> adds:
>
> .start_addr_set: A callback to notify arch code that a special mapping
> was mremapped. (CRIU does this. Without something like this, it's
> somewhat broken for 64-bit userspace and completely broken for 32-bit
> userspace on Intel hardware. Apparently no one has noticed the 64-bit
> breakage, and no one ever ported CRIU to 32-bit in the first place.)
>
> .fault: Directly fault handling on the vdso. Imagine that! It turns
> out that storing a list of struct page pointers in the special mapping
> data is awkward for pretty much everyone and completely precludes
> mapping things that aren't pages without dirty hacks. (x86 uses dirty
> hacks for the HPET mapping. See below.)

I should add that there's further motivation for this. I want to change the x86
vdso code so that the HPET is only mapped if it's actually in use. Getting
this right is delicate, but it's almost impossible without this change.

In particular, if the HPET gets selected due to TSC instability after
boot, then there's no good way to start allowing access right now.
I'd have to remap_pfn_range on all mms at (egads!) an unknown address,
whereas now I can just start accepting the reference in .fault.
Getting the other direction right is tricky, but it's doable in a
number of ways.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/