Skip to contentSkip to conversation

You might need vmalloc_sync_all()

DISCUSSION Andi Kleen 2 participants 4 messages May 1, 2007 Generic include/asm header files

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

Since someone mentioned again.

Right now only x86 implements vmalloc_sync_all(). But iff:

- Your module mappings might require a page fault calling C code in kernel
- You got a pagefault notifier at the beginning of the page fault handler

you risk a endless pagefault recursion with modular pagefault notifiers. vmalloc_sync_all should sync all the available mappings on notifier register so that the C pf handler is not called for module faults.

Apparently at least ARM has this problem.

If the kernel module fault is only assembler code without notifier (e.g. to reload a TLB) it is probably not needed.

-Andi

#1 lore raw
Quoted 7 lines · Andi Kleen

Since someone mentioned again.

Right now only x86 implements vmalloc_sync_all(). But iff:

- Your module mappings might require a page fault calling C code in kernel

Yes, just like x86.

Quoted 2 lines

- You got a pagefault notifier at the beginning of the page fault handler

What's this?

Quoted 1 line

Apparently at least ARM has this problem.

Is there a bug report?

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
author
#2 lore raw
Quoted 1 line

What's this?

Hmm, when I look now at your source I don't see one either. Maybe the reporter had a strangely patched kernel.

Anyways, point stands -- for on demand module mappings you likely want vmalloc_sync_all to avoid nested faults. If you think you can handle the nested faults safely then ignore it @)

Quoted 4 lines
Quoted 2 lines

Apparently at least ARM has this problem.

Is there a bug report?

Forwarded it.

-Andi

#3 lore raw
Quoted 10 lines · Andi Kleen
Quoted 1 line

What's this?

Hmm, when I look now at your source I don't see one either. Maybe the reporter had a strangely patched kernel.

Anyways, point stands -- for on demand module mappings you likely want vmalloc_sync_all to avoid nested faults. If you think you can handle the nested faults safely then ignore it @)

Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Apparently at least ARM has this problem.

Is there a bug report?

Forwarded it.

For the record here, Andi forwarded the report about kprobes on ARM causing recursive page faults. In essence, my opinion is that the kprobes hook is probably incorrectly placed - probably far too early in the data exception processing.

Since the data exception path is used for all sorts of things (missing page table entries, permission, ECC errors, hardware errors, alignment faults, etc) putting a call designed to intercept page faults early will pick up all this other noise.

If it's placed in the same way as i386 then there shouldn't be an issue.

Since I haven't seen the code which adds this hook to ARM, I can only speculate at the time being. So I feel that until the hook comes up as a candidate for merging, there's no point in fixing a problem in mainline which doesn't yet exist there.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of: