LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Which architectures need to sync vmalloc mappings between processes?
@ 2007-02-18  5:29 Jeremy Fitzhardinge
  2007-02-18 14:55 ` James Bottomley
  2007-02-18 17:08 ` Andi Kleen
  0 siblings, 2 replies; 3+ messages in thread
From: Jeremy Fitzhardinge @ 2007-02-18  5:29 UTC (permalink / raw)
  To: linux-arch; +Cc: Linux Kernel Mailing List

Hi,

I'm looking at making all architectures export a vmalloc_sync_all()
function, so that generic code can be sure that a particular vmalloc
mapping is present in all address spaces.   I need this to implement a
function to reserve a chunk of vmalloc address space complete with
constructed pagetables, but without allocating any actual data pages.

On i386 with PAE, this is not necessary because the kernel's mappings
are shared between all processes anyway, so it would be a no-op.  
However, non-PAE i386 has a separate kernel mapping for each process,
and so needs to sync them - typically lazily on faults, but
vmalloc_sync_all exists to allow mass syncing when required.

What other architectures would require syncing of vmalloc mappings, and
what architectures would implement it as a no-op?

Thanks,
    J

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Which architectures need to sync vmalloc mappings between processes?
  2007-02-18  5:29 Which architectures need to sync vmalloc mappings between processes? Jeremy Fitzhardinge
@ 2007-02-18 14:55 ` James Bottomley
  2007-02-18 17:08 ` Andi Kleen
  1 sibling, 0 replies; 3+ messages in thread
From: James Bottomley @ 2007-02-18 14:55 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: linux-arch, Linux Kernel Mailing List

On Sat, 2007-02-17 at 21:29 -0800, Jeremy Fitzhardinge wrote:
> I'm looking at making all architectures export a vmalloc_sync_all()
> function, so that generic code can be sure that a particular vmalloc
> mapping is present in all address spaces.   I need this to implement a
> function to reserve a chunk of vmalloc address space complete with
> constructed pagetables, but without allocating any actual data pages.
> 
> On i386 with PAE, this is not necessary because the kernel's mappings
> are shared between all processes anyway, so it would be a no-op.  
> However, non-PAE i386 has a separate kernel mapping for each process,
> and so needs to sync them - typically lazily on faults, but
> vmalloc_sync_all exists to allow mass syncing when required.
> 
> What other architectures would require syncing of vmalloc mappings, and
> what architectures would implement it as a no-op?

Er, but there are fundamental assumptions that vmalloc_sync_all() makes
that simply aren't true on other architectures.  Really, it's an
artifact of the Intel x86 processor's inability to flush by %cr3, so we
try to keep the kernel mappings alive in a process so that a sys call
and return doesn't do a full TLB flush ... and thus, because we have a
hidden piece of kernel in userspace, we get the HIGHMEM issues.

A substantial number of other architectures do have a selective TLB
flush, so a lot operate with a fully separated kernel and user space,
and thus vmalloc mappings appear only in the single kernel address space
and nowhere else.

Could you elaborate on exactly what you think you need
vmalloc_sync_all() exported for ... your explanation of a reserved
vmalloc range sounds reasonable, but should in no way depend on
vmalloc_sync_all().  It really sounds like this should be an arch
specific function so the architectures can decide the implementation
details.

James



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Which architectures need to sync vmalloc mappings between processes?
  2007-02-18  5:29 Which architectures need to sync vmalloc mappings between processes? Jeremy Fitzhardinge
  2007-02-18 14:55 ` James Bottomley
@ 2007-02-18 17:08 ` Andi Kleen
  1 sibling, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2007-02-18 17:08 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: linux-arch, Linux Kernel Mailing List


> On i386 with PAE, this is not necessary because the kernel's mappings
> are shared between all processes anyway, so it would be a no-op.  
> However, non-PAE i386 has a separate kernel mapping for each process,
> and so needs to sync them - typically lazily on faults, but
> vmalloc_sync_all exists to allow mass syncing when required.

The only case that needs it right now on x86 is NMI handlers in modules
to avoid early IRETs that could cause NMI recursion.

That's a very obscure architecture specific quirk and I wouldn't expect any 
other architecture to suffer from this.

-Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-18 17:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-18  5:29 Which architectures need to sync vmalloc mappings between processes? Jeremy Fitzhardinge
2007-02-18 14:55 ` James Bottomley
2007-02-18 17:08 ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).