scheduler changes for v4.2
Subsystems (43)
Linus,
Please pull the latest sched-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-core-for-linus
# HEAD: 6fab54101923044712baee429ff573f03b99fc47 sched/deadline: Remove needless parameter in dl_runtime_exceeded()
The main changes are:
- lockless wakeup support for futexes and IPC message queues. (Davidlohr Bueso, Peter Zijlstra)
- Replace spinlocks with atomics in thread_group_cputimer(), to improve scalability (Jason Low)
- NUMA balancing improvements (Rik van Riel)
- SCHED_DEADLINE improvements (Wanpeng Li)
- clean up and reorganize preemption helpers (Frederic Weisbecker)
- decouple page fault disabling machinery from the preemption counter, to improve debuggability and robustness. (David Hildenbrand)
- SCHED_DEADLINE documentation updates (Luca Abeni)
- topology CPU masks cleanups. (Bartosz Golaszewski)
- /proc/sched_debug improvements. (Srikar Dronamraju)
Thanks,
Ingo
------------------>
Bartosz Golaszewski (9):
sched/topology: Rename topology_thread_cpumask() to topology_sibling_cpumask()
Documentation: Update cputopology.txt
coretemp: Replace cpu_sibling_mask() with topology_sibling_cpumask()
powernow-k8: Replace cpu_core_mask() with topology_core_cpumask()
p4-clockmod: Replace cpu_sibling_mask() with topology_sibling_cpumask()
acpi-cpufreq: Replace cpu_**_mask() with topology_**_cpumask()
speedstep-ich: Replace cpu_sibling_mask() with topology_sibling_cpumask()
x86: Replace cpu_**_mask() with topology_**_cpumask()
x86: Remove cpu_sibling_mask() and cpu_core_mask()
Ben Segall (1):
sched/fair: Prevent throttling in early pick_next_task_fair()
David Hildenbrand (15):
sched/preempt, mm/fault: Count pagefault_disable() levels in pagefault_disabled sched/preempt, mm/fault: Trigger might_sleep() in might_fault() with disabled pagefaults mm/uaccess, mm/fault: Clarify that uaccess may only sleep if pagefaults are enabled sched/preempt, mm/kmap: Explicitly disable/enable preemption in kmap_atomic_* sched/preempt, mm/kmap, MIPS: Disable preemption in kmap_coherent() explicitly mm/fault, arch: Use pagefault_disable() to check for disabled pagefaults in the handler mm/fault, drm/i915: Use pagefault_disabled() to check for disabled pagefaults sched/preempt, futex: Disable preemption in UP futex_atomic_op_inuser() explicitly sched/preempt, futex: Disable preemption in UP futex_atomic_cmpxchg_inatomic() explicitly sched/preempt, arm/futex: Disable preemption in UP futex_atomic_cmpxchg_inatomic() explicitly sched/preempt, arm/futex: Disable preemption in UP futex_atomic_op_inuser() explicitly sched/preempt, futex: Update comments to clarify that preemption doesn't have to be disabled sched/preempt, powerpc: Disable preemption in enable_kernel_altivec() explicitly sched/preempt, MIPS: Properly lock access to the FPU
sched/preempt, mm/fault: Decouple preemption from the page fault logic
Davidlohr Bueso (2):
futex: Implement lockless wakeups ipc/mqueue: Implement lockless pipelined wakeups
Frederic Weisbecker (9):
sched/preempt: Merge preempt_mask.h into preempt.h
sched/preempt: Rearrange a few symbols after headers merge sched/preempt: Rename PREEMPT_CHECK_OFFSET to PREEMPT_DISABLE_OFFSET sched/preempt: Optimize preemption operations on __schedule() callers sched/preempt: Fix out of date comment
sched/preempt: Remove PREEMPT_ACTIVE unmasking off in_atomic()
sched: Make preempt_schedule_context() function-tracing safe
preempt: Use preempt_schedule_context() as the official tracing preemption point
preempt: Reorganize the notrace definitions a bit
Huang Rui (1):
sched/x86: Drop repeated word from mwait_idle() comment
Jason Low (6):
sched, timer: Convert usages of ACCESS_ONCE() in the scheduler to READ_ONCE()/WRITE_ONCE() sched/numa: Document usages of mm->numa_scan_seq
sched, timer: Replace spinlocks with atomics in thread_group_cputimer(), to improve scalability sched, timer: Provide an atomic 'struct task_cputime' data structure
sched, timer: Use the atomic task_cputime in thread_group_cputimer
sched, timer: Fix documentation for 'struct thread_group_cputimer'
Luca Abeni (8):
sched/dl/Documentation: Switch to American English
sched/dl/Documentation: Fix typos
sched/dl/Documentation: Use consistent naming
sched/dl/Documentation: Clarify indexing notation
sched/dl/Documentation: Add some notes on EDF schedulability
sched/dl/Documentation: Add some references
sched/dl/Documentation: Clarify the relationship between tasks' deadlines and absolute scheduling deadlines sched/dl/Documentation: Split Section 3
Mathieu Desnoyers (1):
sched/preempt: Fix preempt notifiers documentation about hlist_del() within unsafe iteration
Nicholas Mc Guire (2):
sched/core: Remove unnecessary down/up conversion
sched: Fix function declaration return type mismatch
Nikolay Borisov (1):
sched: Remove redundant #ifdef
Palmer Dabbelt (3):
signals, sched: Change all uses of JOBCTL_* from 'int' to 'long' sched/wait: Change wait_on_bit*() to take an unsigned long *, not a void * signals, ptrace, sched: Fix a misaligned load inside ptrace_attach()
Paul Gortmaker (1):
sched/core: Remove __cpuinit section tag that crept back in
Peter Zijlstra (6):
sched: Move the loadavg code to a more obvious location
sched: Implement lockless wake-queues
sched/wait: Introduce TASK_NOLOAD and TASK_IDLE mm/fault, um: Fix compile error
sched/stop_machine: Fix deadlock between multiple stop_two_cpus() sched/preempt: Add static_key() to preempt_notifiers
Rik van Riel (3):
sched/numa: Reduce conflict between fbq_classify_rq() and migration Revert 095bebf61a46 ("sched/numa: Do not move past the balance point if unbalanced") sched/numa: Only consider less busy nodes as numa balancing destinations
Srikar Dronamraju (3):
sched/debug: Properly format runnable tasks in /proc/sched_debug sched/debug: Replace vruntime with wait_sum in /proc/sched_debug sched/debug: Add sum_sleep_runtime to /proc/<pid>/sched
Tobias Klauser (1):
sched/autogroup: Remove unnecessary #ifdef guards
Wanpeng Li (5):
sched/deadline: Optimize pull_dl_task()
sched/deadline: Make init_sched_dl_class() __init
sched/deadline: Reduce rq lock contention by eliminating locking of non-feasible target sched/deadline: Drop duplicate init_sched_dl_class() declaration
sched: Remove superfluous resetting of the p->dl_throttled flag
Zhiqiang Zhang (2):
sched/dl/Documentation: Correct the definition of density as C_i/min{D_i,P_i} sched/deadline: Remove needless parameter in dl_runtime_exceeded()
Documentation/cputopology.txt | 37 +-
Documentation/scheduler/sched-deadline.txt | 184 ++++++++--
arch/alpha/mm/fault.c | 5 +-
arch/arc/include/asm/futex.h | 10 +-
arch/arc/mm/fault.c | 2 +-
arch/arm/include/asm/futex.h | 13 +-
arch/arm/include/asm/topology.h | 2 +-
arch/arm/mm/fault.c | 2 +-
arch/arm/mm/highmem.c | 3 +
arch/arm64/include/asm/futex.h | 4 +-
arch/arm64/include/asm/topology.h | 2 +-
arch/arm64/mm/fault.c | 2 +-
arch/avr32/include/asm/uaccess.h | 12 +-
arch/avr32/mm/fault.c | 4 +-
arch/cris/mm/fault.c | 6 +-
arch/frv/mm/fault.c | 4 +-
arch/frv/mm/highmem.c | 2 +
arch/hexagon/include/asm/uaccess.h | 3 +-
arch/ia64/include/asm/topology.h | 2 +-
arch/ia64/mm/fault.c | 4 +-
arch/m32r/include/asm/uaccess.h | 30 +-
arch/m32r/mm/fault.c | 8 +-
arch/m68k/include/asm/irqflags.h | 3 -
arch/m68k/mm/fault.c | 4 +-
arch/metag/mm/fault.c | 2 +-
arch/metag/mm/highmem.c | 4 +-
arch/microblaze/include/asm/uaccess.h | 6 +-
arch/microblaze/mm/fault.c | 8 +-
arch/microblaze/mm/highmem.c | 4 +-
arch/mips/include/asm/topology.h | 2 +-
arch/mips/include/asm/uaccess.h | 45 ++-
arch/mips/kernel/signal-common.h | 9 +-
arch/mips/mm/fault.c | 4 +-
arch/mips/mm/highmem.c | 5 +-
arch/mips/mm/init.c | 2 +
arch/mn10300/include/asm/highmem.h | 3 +
arch/mn10300/mm/fault.c | 4 +-
arch/nios2/mm/fault.c | 2 +-
arch/parisc/include/asm/cacheflush.h | 2 +
arch/parisc/kernel/traps.c | 4 +-
arch/parisc/mm/fault.c | 4 +-
arch/powerpc/include/asm/topology.h | 2 +-
arch/powerpc/lib/vmx-helper.c | 11 +-
arch/powerpc/mm/fault.c | 9 +-
arch/powerpc/mm/highmem.c | 4 +-
arch/powerpc/mm/tlb_nohash.c | 2 +-
arch/s390/include/asm/topology.h | 3 +-
arch/s390/include/asm/uaccess.h | 15 +-
arch/s390/mm/fault.c | 2 +-
arch/score/include/asm/uaccess.h | 15 +-
arch/score/mm/fault.c | 3 +-
arch/sh/mm/fault.c | 5 +-
arch/sparc/include/asm/topology_64.h | 2 +-
arch/sparc/mm/fault_32.c | 4 +-
arch/sparc/mm/fault_64.c | 4 +-
arch/sparc/mm/highmem.c | 4 +-
arch/sparc/mm/init_64.c | 2 +-
arch/tile/include/asm/topology.h | 2 +-
arch/tile/include/asm/uaccess.h | 18 +-
arch/tile/mm/fault.c | 4 +-
arch/tile/mm/highmem.c | 3 +-
arch/um/kernel/trap.c | 5 +-
arch/unicore32/mm/fault.c | 2 +-
arch/x86/include/asm/preempt.h | 8 +-
arch/x86/include/asm/smp.h | 10 -
arch/x86/include/asm/topology.h | 2 +-
arch/x86/include/asm/uaccess.h | 15 +-
arch/x86/include/asm/uaccess_32.h | 6 +-
arch/x86/kernel/cpu/perf_event_intel.c | 6 +-
arch/x86/kernel/cpu/proc.c | 3 +-
arch/x86/kernel/i386_ksyms_32.c | 4 +-
arch/x86/kernel/process.c | 7 +-
arch/x86/kernel/smpboot.c | 42 +--
arch/x86/kernel/tsc_sync.c | 2 +-
arch/x86/kernel/x8664_ksyms_64.c | 4 +-
arch/x86/lib/thunk_32.S | 4 +-
arch/x86/lib/thunk_64.S | 4 +-
arch/x86/lib/usercopy_32.c | 6 +-
arch/x86/mm/fault.c | 5 +-
arch/x86/mm/highmem_32.c | 3 +-
arch/x86/mm/iomap_32.c | 2 +
arch/xtensa/mm/fault.c | 4 +-
arch/xtensa/mm/highmem.c | 2 +
block/blk-mq-cpumap.c | 2 +-
drivers/acpi/acpi_pad.c | 2 +-
drivers/base/topology.c | 2 +-
drivers/cpufreq/acpi-cpufreq.c | 5 +-
drivers/cpufreq/p4-clockmod.c | 2 +-
drivers/cpufreq/powernow-k8.c | 13 +-
drivers/cpufreq/speedstep-ich.c | 2 +-
drivers/crypto/vmx/aes.c | 8 +-
drivers/crypto/vmx/aes_cbc.c | 6 +
drivers/crypto/vmx/ghash.c | 8 +
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 3 +-
drivers/hwmon/coretemp.c | 3 +-
drivers/net/ethernet/sfc/efx.c | 2 +-
.../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 2 +-
drivers/staging/lustre/lustre/ptlrpc/service.c | 4 +-
include/asm-generic/futex.h | 7 +-
include/asm-generic/preempt.h | 7 +-
include/linux/bottom_half.h | 1 -
include/linux/hardirq.h | 2 +-
include/linux/highmem.h | 2 +
include/linux/init_task.h | 5 +-
include/linux/io-mapping.h | 2 +
include/linux/kernel.h | 3 +-
include/linux/lglock.h | 5 +
include/linux/preempt.h | 159 +++++++--
include/linux/preempt_mask.h | 117 -------
include/linux/sched.h | 118 +++++--
include/linux/topology.h | 6 +-
include/linux/uaccess.h | 48 ++-
include/linux/wait.h | 17 +-
include/trace/events/sched.h | 3 +-
ipc/mqueue.c | 54 +--
kernel/fork.c | 8 +-
kernel/futex.c | 33 +-
kernel/locking/lglock.c | 22 ++
kernel/sched/Makefile | 2 +-
kernel/sched/auto_group.c | 6 +-
kernel/sched/auto_group.h | 2 +-
kernel/sched/core.c | 136 +++++---
kernel/sched/cputime.c | 2 +-
kernel/sched/deadline.c | 51 ++-
kernel/sched/debug.c | 11 +-
kernel/sched/fair.c | 372 ++++++++++++++++-----
kernel/sched/{proc.c => loadavg.c} | 236 ++-----------
kernel/sched/rt.c | 2 +-
kernel/sched/sched.h | 11 +-
kernel/sched/stats.h | 15 +-
kernel/sched/wait.c | 4 +-
kernel/signal.c | 6 +-
kernel/stop_machine.c | 42 +--
kernel/time/posix-cpu-timers.c | 87 +++--
lib/cpu_rmap.c | 2 +-
lib/radix-tree.c | 2 +-
lib/strnlen_user.c | 6 +-
mm/memory.c | 18 +-
138 files changed, 1442 insertions(+), 972 deletions(-)
delete mode 100644 include/linux/preempt_mask.h
rename kernel/sched/{proc.c => loadavg.c} (62%)Documentation/cputopology.txt +27 -10
@@ -1,6 +1,6 @@ Export CPU topology info via sysfs. Items (attributes) are similar -to /proc/cpuinfo. +to /proc/cpuinfo output of some architectures: 1) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
@@ -23,20 +23,35 @@ to /proc/cpuinfo. 4) /sys/devices/system/cpu/cpuX/topology/thread_siblings: internal kernel map of cpuX's hardware threads within the same - core as cpuX + core as cpuX. -5) /sys/devices/system/cpu/cpuX/topology/core_siblings: +5) /sys/devices/system/cpu/cpuX/topology/thread_siblings_list: + + human-readable list of cpuX's hardware threads within the same + core as cpuX. + +6) /sys/devices/system/cpu/cpuX/topology/core_siblings: internal kernel map of cpuX's hardware threads within the same physical_package_id. -6) /sys/devices/system/cpu/cpuX/topology/book_siblings: +7) /sys/devices/system/cpu/cpuX/topology/core_siblings_list: + + human-readable list of cpuX's hardware threads within the same + physical_package_id. + +8) /sys/devices/system/cpu/cpuX/topology/book_siblings: internal kernel map of cpuX's hardware threads within the same book_id. +9) /sys/devices/system/cpu/cpuX/topology/book_siblings_list: + + human-readable list of cpuX's hardware threads within the same + book_id. + To implement it in an architecture-neutral way, a new source file, -drivers/base/topology.c, is to export the 4 or 6 attributes. The two book +drivers/base/topology.c, is to export the 6 or 9 attributes. The three book related sysfs files will only be created if CONFIG_SCHED_BOOK is selected. For an architecture to support this feature, it must define some of
@@ -44,20 +59,22 @@ For an architecture to support this feature, it must define some of #define topology_physical_package_id(cpu) #define topology_core_id(cpu) #define topology_book_id(cpu) -#define topology_thread_cpumask(cpu) +#define topology_sibling_cpumask(cpu) #define topology_core_cpumask(cpu) #define topology_book_cpumask(cpu) -The type of **_id is int. -The type of siblings is (const) struct cpumask *. +The type of **_id macros is int. +The type of **_cpumask macros is (const) struct cpumask *. The latter +correspond with appropriate **_siblings sysfs attributes (except for +topology_sibling_cpumask() which corresponds with thread_siblings). To be consistent on all architectures, include/linux/topology.h provides default definitions for any of the above macros that are not defined by include/asm-XXX/topology.h: 1) physical_package_id: -1 2) core_id: 0 -3) thread_siblings: just the given CPU -4) core_siblings: just the given CPU +3) sibling_cpumask: just the given CPU +4) core_cpumask: just the given CPU For architectures that don't support books (CONFIG_SCHED_BOOK) there are no default definitions for topology_book_id() and topology_book_cpumask().
Documentation/scheduler/sched-deadline.txt +154 -30
280 lines not on this page · raw message
arch/alpha/mm/fault.c +2 -3
@@ -23,8 +23,7 @@#include <linux/smp.h> #include <linux/interrupt.h> #include <linux/module.h> - -#include <asm/uaccess.h> +#include <linux/uaccess.h> extern void die_if_kernel (char *,struct pt_regs *,long ,unsigned long *);
@@ -107,7 +106,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,/* If we're in an interrupt context, or have no user context, we must not take the fault. */ -if (!mm ||in_atomic ()) +if (!mm ||faulthandler_disabled ()) goto no_context;#ifdef CONFIG_ALPHA_LARGE_VMALLOC
arch/arc/include/asm/futex.h +5 -5
@@ -53,7 +53,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)if (!access_ok (VERIFY_WRITE , uaddr,sizeof (int )))return -EFAULT ; -pagefault_disable ();/* implies preempt_disable() */ +pagefault_disable ();switch (op) {case FUTEX_OP_SET :
@@ -75,7 +75,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) ret = -ENOSYS ; } -pagefault_enable ();/* subsumes preempt_enable() */ +pagefault_enable ();if (!ret) {switch (cmp) {
@@ -104,7 +104,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)return ret; } -/* Compare-xchg with preemption disabled. +/* Compare-xchg with pagefaults disabled. * Notes: * -Best-Effort: Exchg happens only if compare succeeds. * If compare fails, returns; leaving retry/looping to upper layers
@@ -121,7 +121,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval,if (!access_ok (VERIFY_WRITE , uaddr,sizeof (int )))return -EFAULT ; -pagefault_disable ();/* implies preempt_disable() */ +pagefault_disable ();/* TBD : can use llock/scond */ __asm__ __volatile__(
@@ -142,7 +142,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, : "r"(oldval), "r"(newval), "r"(uaddr), "ir"(-EFAULT) : "cc", "memory"); -pagefault_enable ();/* subsumes preempt_enable() */ +pagefault_enable (); *uval = val;return val;
arch/arc/mm/fault.c +1 -1
@@ -86,7 +86,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto no_context;if (user_mode (regs))
arch/arm/include/asm/futex.h +11 -2
@@ -93,6 +93,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,if (!access_ok (VERIFY_WRITE , uaddr,sizeof (u32)))return -EFAULT ; +preempt_disable (); __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n" "1: " TUSER(ldr) " %1, [%4]\n"" teq %1, %2\n"
@@ -104,6 +105,8 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, : "cc", "memory"); *uval = val; +preempt_enable (); +return ret; }
@@ -124,7 +127,10 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)if (!access_ok (VERIFY_WRITE , uaddr,sizeof (u32)))return -EFAULT ; -pagefault_disable ();/* implies preempt_disable() */ +#ifndef CONFIG_SMP +preempt_disable (); +#endif +pagefault_disable ();switch (op) {case FUTEX_OP_SET :
@@ -146,7 +152,10 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) ret = -ENOSYS ; } -pagefault_enable ();/* subsumes preempt_enable() */ +pagefault_enable (); +#ifndef CONFIG_SMP +preempt_enable (); +#endif if (!ret) {switch (cmp) {
arch/arm/include/asm/topology.h +1 -1
@@ -18,7 +18,7 @@ extern struct cputopo_arm cpu_topology[NR_CPUS];#define topology_physical_package_id (cpu) (cpu_topology[cpu].socket_id)#define topology_core_id (cpu) (cpu_topology[cpu].core_id)#define topology_core_cpumask (cpu) (&cpu_topology[cpu].core_sibling) -#define topology_thread_cpumask (cpu) (&cpu_topology[cpu].thread_sibling) +#define topology_sibling_cpumask (cpu) (&cpu_topology[cpu].thread_sibling)void init_cpu_topology (void );void store_cpu_topology (unsigned int cpuid);
arch/arm/mm/fault.c +1 -1
@@ -276,7 +276,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto no_context;if (user_mode (regs))
arch/arm/mm/highmem.c +3 -0
@@ -59,6 +59,7 @@ void *kmap_atomic(struct page *page)void *kmap;int type; +preempt_disable ();pagefault_disable ();if (!PageHighMem (page))return page_address (page);
@@ -121,6 +122,7 @@ void __kunmap_atomic(void *kvaddr)kunmap_high (pte_page (pkmap_page_table[PKMAP_NR (vaddr)])); }pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL (__kunmap_atomic);
@@ -130,6 +132,7 @@ void *kmap_atomic_pfn(unsigned long pfn)int idx, type;struct page *page =pfn_to_page (pfn); +preempt_disable ();pagefault_disable ();if (!PageHighMem (page))return page_address (page);
arch/arm64/include/asm/futex.h +2 -2
@@ -58,7 +58,7 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)if (!access_ok (VERIFY_WRITE , uaddr,sizeof (u32)))return -EFAULT ; -pagefault_disable ();/* implies preempt_disable() */ +pagefault_disable ();switch (op) {case FUTEX_OP_SET :
@@ -85,7 +85,7 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) ret = -ENOSYS ; } -pagefault_enable ();/* subsumes preempt_enable() */ +pagefault_enable ();if (!ret) {switch (cmp) {
arch/arm64/include/asm/topology.h +1 -1
@@ -18,7 +18,7 @@ extern struct cpu_topology cpu_topology[NR_CPUS];#define topology_physical_package_id (cpu) (cpu_topology[cpu].cluster_id)#define topology_core_id (cpu) (cpu_topology[cpu].core_id)#define topology_core_cpumask (cpu) (&cpu_topology[cpu].core_sibling) -#define topology_thread_cpumask (cpu) (&cpu_topology[cpu].thread_sibling) +#define topology_sibling_cpumask (cpu) (&cpu_topology[cpu].thread_sibling)void init_cpu_topology (void );void store_cpu_topology (unsigned int cpuid);
arch/arm64/mm/fault.c +1 -1
@@ -211,7 +211,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,* If we're in an interrupt or have no user context, we must not take * the fault. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto no_context;if (user_mode (regs))
arch/avr32/include/asm/uaccess.h +8 -4
@@ -97,7 +97,8 @@ static inline __kernel_size_t __copy_from_user(void *to,* @x: Value to copy to user space. * @ptr: Destination address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple value from kernel space to user * space. It supports simple types like char and int, but not larger
@@ -116,7 +117,8 @@ static inline __kernel_size_t __copy_from_user(void *to,* @x: Variable to store result. * @ptr: Source address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple variable from user space to kernel * space. It supports simple types like char and int, but not larger
@@ -136,7 +138,8 @@ static inline __kernel_size_t __copy_from_user(void *to,* @x: Value to copy to user space. * @ptr: Destination address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple value from kernel space to user * space. It supports simple types like char and int, but not larger
@@ -158,7 +161,8 @@ static inline __kernel_size_t __copy_from_user(void *to,* @x: Variable to store result. * @ptr: Source address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple variable from user space to kernel * space. It supports simple types like char and int, but not larger
arch/avr32/mm/fault.c +2 -2
@@ -14,11 +14,11 @@#include <linux/pagemap.h> #include <linux/kdebug.h> #include <linux/kprobes.h> +#include <linux/uaccess.h> #include <asm/mmu_context.h> #include <asm/sysreg.h> #include <asm/tlb.h> -#include <asm/uaccess.h> #ifdef CONFIG_KPROBES static inline int notify_page_fault (struct pt_regs *regs,int trap)
@@ -81,7 +81,7 @@ asmlinkage void do_page_fault(unsigned long ecr, struct pt_regs *regs)* If we're in an interrupt or have no user context, we must * not take the fault... */ -if (in_atomic () || !mm || regs->sr &SYSREG_BIT (GM )) +if (faulthandler_disabled () || !mm || regs->sr &SYSREG_BIT (GM )) goto no_context;local_irq_enable ();
arch/cris/mm/fault.c +3 -3
@@ -8,7 +8,7 @@#include <linux/interrupt.h> #include <linux/module.h> #include <linux/wait.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <arch/system.h> extern int find_fixup_code (struct pt_regs *);
@@ -109,11 +109,11 @@ do_page_fault(unsigned long address, struct pt_regs *regs, info.si_code =SEGV_MAPERR ;/* -* If we're in an interrupt or "atomic" operation or have no +* If we're in an interrupt, have pagefaults disabled or have no * user context, we must not take the fault. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto no_context;if (user_mode (regs))
arch/frv/mm/fault.c +2 -2
@@ -19,9 +19,9 @@#include <linux/kernel.h> #include <linux/ptrace.h> #include <linux/hardirq.h> +#include <linux/uaccess.h> #include <asm/pgtable.h> -#include <asm/uaccess.h> #include <asm/gdb-stub.h> /*****************************************************************************/
@@ -78,7 +78,7 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto no_context;if (user_mode (__frame))
arch/frv/mm/highmem.c +2 -0
@@ -42,6 +42,7 @@ void *kmap_atomic(struct page *page)unsigned long paddr;int type; +preempt_disable ();pagefault_disable (); type =kmap_atomic_idx_push (); paddr =page_to_phys (page);
@@ -85,5 +86,6 @@ void __kunmap_atomic(void *kvaddr) }kmap_atomic_idx_pop ();pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL (__kunmap_atomic);
arch/hexagon/include/asm/uaccess.h +2 -1
@@ -36,7 +36,8 @@* @addr: User space pointer to start of block to check * @size: Size of block to check * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Checks if a pointer to a block of memory in user space is valid. *
arch/ia64/include/asm/topology.h +1 -1
@@ -53,7 +53,7 @@ void build_cpu_to_node_map(void);#define topology_physical_package_id (cpu) (cpu_data(cpu)->socket_id)#define topology_core_id (cpu) (cpu_data(cpu)->core_id)#define topology_core_cpumask (cpu) (&cpu_core_map[cpu]) -#define topology_thread_cpumask (cpu) (&per_cpu(cpu_sibling_map, cpu)) +#define topology_sibling_cpumask (cpu) (&per_cpu(cpu_sibling_map, cpu))#endif extern void arch_fix_phys_package_id (int num,u32 slot);
arch/ia64/mm/fault.c +2 -2
@@ -11,10 +11,10 @@#include <linux/kprobes.h> #include <linux/kdebug.h> #include <linux/prefetch.h> +#include <linux/uaccess.h> #include <asm/pgtable.h> #include <asm/processor.h> -#include <asm/uaccess.h> extern int die (char *,struct pt_regs *,long );
@@ -96,7 +96,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re/* * If we're in an interrupt or have no user context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto no_context;#ifdef CONFIG_VIRTUAL_MEM_MAP
arch/m32r/include/asm/uaccess.h +20 -10
@@ -91,7 +91,8 @@ static inline void set_fs(mm_segment_t s)* @addr: User space pointer to start of block to check * @size: Size of block to check * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Checks if a pointer to a block of memory in user space is valid. *
@@ -155,7 +156,8 @@ extern int fixup_exception(struct pt_regs *regs);* @x: Variable to store result. * @ptr: Source address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple variable from user space to kernel * space. It supports simple types like char and int, but not larger
@@ -175,7 +177,8 @@ extern int fixup_exception(struct pt_regs *regs);* @x: Value to copy to user space. * @ptr: Destination address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple value from kernel space to user * space. It supports simple types like char and int, but not larger
@@ -194,7 +197,8 @@ extern int fixup_exception(struct pt_regs *regs);* @x: Variable to store result. * @ptr: Source address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple variable from user space to kernel * space. It supports simple types like char and int, but not larger
@@ -274,7 +278,8 @@ do { \* @x: Value to copy to user space. * @ptr: Destination address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple value from kernel space to user * space. It supports simple types like char and int, but not larger
@@ -568,7 +573,8 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon* @from: Source address, in kernel space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from kernel space to user space. Caller must check * the specified block with access_ok() before calling this function.
@@ -588,7 +594,8 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon* @from: Source address, in kernel space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from kernel space to user space. *
@@ -606,7 +613,8 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon* @from: Source address, in user space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from user space to kernel space. Caller must check * the specified block with access_ok() before calling this function.
@@ -626,7 +634,8 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon* @from: Source address, in user space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from user space to kernel space. *
@@ -677,7 +686,8 @@ unsigned long clear_user(void __user *mem, unsigned long len);* strlen_user: - Get the size of a string in user space. * @str: The string to measure. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Get the size of a NUL-terminated string in user space. *
arch/m32r/mm/fault.c +4 -4
@@ -24,9 +24,9 @@#include <linux/vt_kern.h> /* For unblank_screen() */ #include <linux/highmem.h> #include <linux/module.h> +#include <linux/uaccess.h> #include <asm/m32r.h> -#include <asm/uaccess.h> #include <asm/hardirq.h> #include <asm/mmu_context.h> #include <asm/tlbflush.h>
@@ -111,10 +111,10 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, mm = tsk->mm;/* -* If we're in an interrupt or have no user context or are running in an -* atomic region then we must not take the fault.. +* If we're in an interrupt or have no user context or have pagefaults +* disabled then we must not take the fault. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto bad_area_nosemaphore;if (error_code &ACE_USERMODE )
arch/m68k/include/asm/irqflags.h +0 -3
@@ -2,9 +2,6 @@#define _M68K_IRQFLAGS_H#include <linux/types.h> -#ifdef CONFIG_MMU -#include <linux/preempt_mask.h> -#endif #include <linux/preempt.h> #include <asm/thread_info.h> #include <asm/entry.h>
arch/m68k/mm/fault.c +2 -2
@@ -10,10 +10,10 @@#include <linux/ptrace.h> #include <linux/interrupt.h> #include <linux/module.h> +#include <linux/uaccess.h> #include <asm/setup.h> #include <asm/traps.h> -#include <asm/uaccess.h> #include <asm/pgalloc.h> extern void die_if_kernel (char *,struct pt_regs *,long );
@@ -81,7 +81,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto no_context;if (user_mode (regs))
arch/metag/mm/fault.c +1 -1
@@ -105,7 +105,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, mm = tsk->mm; -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto no_context;if (user_mode (regs))
arch/metag/mm/highmem.c +3 -1
@@ -43,7 +43,7 @@ void *kmap_atomic(struct page *page)unsigned long vaddr;int type; -/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ +preempt_disable ();pagefault_disable ();if (!PageHighMem (page))return page_address (page);
@@ -82,6 +82,7 @@ void __kunmap_atomic(void *kvaddr) }pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL (__kunmap_atomic);
@@ -95,6 +96,7 @@ void *kmap_atomic_pfn(unsigned long pfn)unsigned long vaddr;int type; +preempt_disable ();pagefault_disable (); type =kmap_atomic_idx_push ();
arch/microblaze/include/asm/uaccess.h +4 -2
@@ -178,7 +178,8 @@ extern long __user_bad(void);* @x: Variable to store result. * @ptr: Source address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple variable from user space to kernel * space. It supports simple types like char and int, but not larger
@@ -290,7 +291,8 @@ extern long __user_bad(void);* @x: Value to copy to user space. * @ptr: Destination address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple value from kernel space to user * space. It supports simple types like char and int, but not larger
arch/microblaze/mm/fault.c +4 -4
@@ -107,14 +107,14 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,if ((error_code &0x13 ) ==0x13 || (error_code &0x11 ) ==0x11 ) is_write =0 ; -if (unlikely (in_atomic () || !mm)) { +if (unlikely (faulthandler_disabled () || !mm)) {if (kernel_mode (regs)) goto bad_area_nosemaphore; -/* in_atomic() in user mode is really bad, +/* faulthandler_disabled() in user mode is really bad, as is current->mm == NULL. */ -pr_emerg ("Page fault in user mode with in_atomic(), mm = %p\n" , - mm); +pr_emerg ("Page fault in user mode with faulthandler_disabled(), mm = %p\n" , + mm);pr_emerg ("r15 = %lx MSR = %lx\n" , regs->r15, regs->msr);die ("Weird page fault" , regs,SIGSEGV );
arch/microblaze/mm/highmem.c +3 -1
@@ -37,7 +37,7 @@ void *kmap_atomic_prot(struct page *page, pgprot_t prot)unsigned long vaddr;int idx, type; -/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ +preempt_disable ();pagefault_disable ();if (!PageHighMem (page))return page_address (page);
@@ -63,6 +63,7 @@ void __kunmap_atomic(void *kvaddr)if (vaddr <__fix_to_virt (FIX_KMAP_END )) {pagefault_enable (); +preempt_enable ();return ; }
@@ -84,5 +85,6 @@ void __kunmap_atomic(void *kvaddr)#endif kmap_atomic_idx_pop ();pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL (__kunmap_atomic);
arch/mips/include/asm/topology.h +1 -1
@@ -15,7 +15,7 @@#define topology_physical_package_id (cpu) (cpu_data[cpu].package)#define topology_core_id (cpu) (cpu_data[cpu].core)#define topology_core_cpumask (cpu) (&cpu_core_map[cpu]) -#define topology_thread_cpumask (cpu) (&cpu_sibling_map[cpu]) +#define topology_sibling_cpumask (cpu) (&cpu_sibling_map[cpu])#endif #endif /* __ASM_TOPOLOGY_H */
arch/mips/include/asm/uaccess.h +30 -15
135 lines not on this page · raw message
arch/mips/kernel/signal-common.h +2 -7
@@ -28,12 +28,7 @@ extern void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,extern int fpcsr_pending (unsigned int __user *fpcsr);/* Make sure we will not lose FPU ownership */ -#ifdef CONFIG_PREEMPT -#define lock_fpu_owner () preempt_disable() -#define unlock_fpu_owner () preempt_enable() -#else -#define lock_fpu_owner () pagefault_disable() -#define unlock_fpu_owner () pagefault_enable() -#endif +#define lock_fpu_owner () ({ preempt_disable(); pagefault_disable(); }) +#define unlock_fpu_owner () ({ pagefault_enable(); preempt_enable(); })#endif /* __SIGNAL_COMMON_H */
arch/mips/mm/fault.c +2 -2
@@ -21,10 +21,10 @@#include <linux/module.h> #include <linux/kprobes.h> #include <linux/perf_event.h> +#include <linux/uaccess.h> #include <asm/branch.h> #include <asm/mmu_context.h> -#include <asm/uaccess.h> #include <asm/ptrace.h> #include <asm/highmem.h> /* For VMALLOC_END */ #include <linux/kdebug.h>
@@ -94,7 +94,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write,* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto bad_area_nosemaphore;if (user_mode (regs))
arch/mips/mm/highmem.c +4 -1
@@ -47,7 +47,7 @@ void *kmap_atomic(struct page *page)unsigned long vaddr;int idx, type; -/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ +preempt_disable ();pagefault_disable ();if (!PageHighMem (page))return page_address (page);
@@ -72,6 +72,7 @@ void __kunmap_atomic(void *kvaddr)if (vaddr <FIXADDR_START ) {// FIXME pagefault_enable (); +preempt_enable ();return ; }
@@ -92,6 +93,7 @@ void __kunmap_atomic(void *kvaddr)#endif kmap_atomic_idx_pop ();pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL (__kunmap_atomic);
@@ -104,6 +106,7 @@ void *kmap_atomic_pfn(unsigned long pfn)unsigned long vaddr;int idx, type; +preempt_disable ();pagefault_disable (); type =kmap_atomic_idx_push ();
arch/mips/mm/init.c +2 -0
@@ -90,6 +90,7 @@ static void *__kmap_pgprot(struct page *page, unsigned long addr, pgprot_t prot)BUG_ON (Page_dcache_dirty (page)); +preempt_disable ();pagefault_disable (); idx = (addr >>PAGE_SHIFT ) & (FIX_N_COLOURS -1 ); idx +=in_interrupt () ?FIX_N_COLOURS :0 ;
@@ -152,6 +153,7 @@ void kunmap_coherent(void)write_c0_entryhi (old_ctx);local_irq_restore (flags);pagefault_enable (); +preempt_enable (); } void copy_user_highpage(struct page *to, struct page *from,
arch/mn10300/include/asm/highmem.h +3 -0
@@ -75,6 +75,7 @@ static inline void *kmap_atomic(struct page *page)unsigned long vaddr;int idx, type; +preempt_disable ();pagefault_disable ();if (page < highmem_start_page)return page_address (page);
@@ -98,6 +99,7 @@ static inline void __kunmap_atomic(unsigned long vaddr)if (vaddr <FIXADDR_START ) {/* FIXME */ pagefault_enable (); +preempt_enable ();return ; }
@@ -122,6 +124,7 @@ static inline void __kunmap_atomic(unsigned long vaddr)kmap_atomic_idx_pop ();pagefault_enable (); + preempt_enable(); }#endif /* __KERNEL__ */
arch/mn10300/mm/fault.c +2 -2
@@ -23,8 +23,8 @@#include <linux/interrupt.h> #include <linux/init.h> #include <linux/vt_kern.h> /* For unblank_screen() */ +#include <linux/uaccess.h> -#include <asm/uaccess.h> #include <asm/pgalloc.h> #include <asm/hardirq.h> #include <asm/cpu-regs.h>
@@ -168,7 +168,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long fault_code,* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto no_context;if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR)
arch/nios2/mm/fault.c +1 -1
@@ -77,7 +77,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause,* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto bad_area_nosemaphore;if (user_mode (regs))
arch/parisc/include/asm/cacheflush.h +2 -0
@@ -142,6 +142,7 @@ static inline void kunmap(struct page *page)static inline void *kmap_atomic (struct page *page) { +preempt_disable ();pagefault_disable ();return page_address (page); }
@@ -150,6 +151,7 @@ static inline void __kunmap_atomic(void *addr) {flush_kernel_dcache_page_addr (addr);pagefault_enable (); +preempt_enable (); }#define kmap_atomic_prot (page, prot) kmap_atomic(page)
arch/parisc/kernel/traps.c +2 -2
@@ -26,9 +26,9 @@#include <linux/console.h> #include <linux/bug.h> #include <linux/ratelimit.h> +#include <linux/uaccess.h> #include <asm/assembly.h> -#include <asm/uaccess.h> #include <asm/io.h> #include <asm/irq.h> #include <asm/traps.h>
@@ -800,7 +800,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)* unless pagefault_disable() was called before. */ -if (fault_space ==0 && !in_atomic ()) +if (fault_space ==0 && !faulthandler_disabled ()) {pdc_chassis_send_status (PDC_CHASSIS_DIRECT_PANIC );parisc_terminate ("Kernel Fault" , regs, code, fault_address);
arch/parisc/mm/fault.c +2 -2
@@ -15,8 +15,8 @@#include <linux/sched.h> #include <linux/interrupt.h> #include <linux/module.h> +#include <linux/uaccess.h> -#include <asm/uaccess.h> #include <asm/traps.h> /* Various important other fields */
@@ -207,7 +207,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,int fault;unsigned int flags; -if (in_atomic ()) +if (pagefault_disabled ()) goto no_context; tsk = current;
arch/powerpc/include/asm/topology.h +1 -1
@@ -87,7 +87,7 @@ static inline int prrn_is_enabled(void)#include <asm/smp.h> #define topology_physical_package_id (cpu) (cpu_to_chip_id(cpu)) -#define topology_thread_cpumask (cpu) (per_cpu(cpu_sibling_map, cpu)) +#define topology_sibling_cpumask (cpu) (per_cpu(cpu_sibling_map, cpu))#define topology_core_cpumask (cpu) (per_cpu(cpu_core_map, cpu))#define topology_core_id (cpu) (cpu_to_core_id(cpu))#endif
arch/powerpc/lib/vmx-helper.c +6 -5
@@ -27,11 +27,11 @@ int enter_vmx_usercopy(void)if (in_interrupt ())return 0 ; -/* This acts as preempt_disable() as well and will make -* enable_kernel_altivec(). We need to disable page faults -* as they can call schedule and thus make us lose the VMX -* context. So on page faults, we just fail which will cause -* a fallback to the normal non-vmx copy. +preempt_disable (); +/* +* We need to disable page faults as they can call schedule and +* thus make us lose the VMX context. So on page faults, we just +* fail which will cause a fallback to the normal non-vmx copy. */ pagefault_disable ();
@@ -47,6 +47,7 @@ int enter_vmx_usercopy(void)int exit_vmx_usercopy (void ) {pagefault_enable (); +preempt_enable ();return 0 ; }
arch/powerpc/mm/fault.c +5 -4
@@ -33,13 +33,13 @@#include <linux/ratelimit.h> #include <linux/context_tracking.h> #include <linux/hugetlb.h> +#include <linux/uaccess.h> #include <asm/firmware.h> #include <asm/page.h> #include <asm/pgtable.h> #include <asm/mmu.h> #include <asm/mmu_context.h> -#include <asm/uaccess.h> #include <asm/tlbflush.h> #include <asm/siginfo.h> #include <asm/debug.h>
@@ -272,15 +272,16 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,if (!arch_irq_disabled_regs (regs))local_irq_enable (); -if (in_atomic () || mm ==NULL ) { +if (faulthandler_disabled () || mm ==NULL ) {if (!user_mode (regs)) { rc =SIGSEGV ; goto bail; } -/* in_atomic() in user mode is really bad, +/* faulthandler_disabled() in user mode is really bad, as is current->mm == NULL. */ printk (KERN_EMERG "Page fault in user mode with " -"in_atomic() = %d mm = %p\n" ,in_atomic (), mm); +"faulthandler_disabled() = %d mm = %p\n" , +faulthandler_disabled (), mm);printk (KERN_EMERG "NIP = %lx MSR = %lx\n" , regs->nip, regs->msr);die ("Weird page fault" , regs,SIGSEGV );
arch/powerpc/mm/highmem.c +3 -1
@@ -34,7 +34,7 @@ void *kmap_atomic_prot(struct page *page, pgprot_t prot)unsigned long vaddr;int idx, type; -/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ +preempt_disable ();pagefault_disable ();if (!PageHighMem (page))return page_address (page);
@@ -59,6 +59,7 @@ void __kunmap_atomic(void *kvaddr)if (vaddr <__fix_to_virt (FIX_KMAP_END )) {pagefault_enable (); +preempt_enable ();return ; }
@@ -82,5 +83,6 @@ void __kunmap_atomic(void *kvaddr)kmap_atomic_idx_pop ();pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL (__kunmap_atomic);
arch/powerpc/mm/tlb_nohash.c +1 -1
@@ -217,7 +217,7 @@ static DEFINE_RAW_SPINLOCK(tlbivax_lock);static int mm_is_core_local (struct mm_struct *mm) {return cpumask_subset (mm_cpumask (mm), -topology_thread_cpumask (smp_processor_id ())); +topology_sibling_cpumask (smp_processor_id ())); }struct tlb_flush_param {
arch/s390/include/asm/topology.h +2 -1
@@ -22,7 +22,8 @@ DECLARE_PER_CPU(struct cpu_topology_s390, cpu_topology);#define topology_physical_package_id (cpu) (per_cpu(cpu_topology, cpu).socket_id)#define topology_thread_id (cpu) (per_cpu(cpu_topology, cpu).thread_id) -#define topology_thread_cpumask (cpu) (&per_cpu(cpu_topology, cpu).thread_mask) +#define topology_sibling_cpumask (cpu) \ + (&per_cpu(cpu_topology, cpu).thread_mask)#define topology_core_id (cpu) (per_cpu(cpu_topology, cpu).core_id)#define topology_core_cpumask (cpu) (&per_cpu(cpu_topology, cpu).core_mask)#define topology_book_id (cpu) (per_cpu(cpu_topology, cpu).book_id)
arch/s390/include/asm/uaccess.h +10 -5
@@ -98,7 +98,8 @@ static inline unsigned long extable_fixup(const struct exception_table_entry *x)* @from: Source address, in user space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from user space to kernel space. Caller must check * the specified block with access_ok() before calling this function.
@@ -118,7 +119,8 @@ unsigned long __must_check __copy_from_user(void *to, const void __user *from,* @from: Source address, in kernel space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from kernel space to user space. Caller must check * the specified block with access_ok() before calling this function.
@@ -264,7 +266,8 @@ int __get_user_bad(void) __attribute__((noreturn));* @from: Source address, in kernel space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from kernel space to user space. *
@@ -290,7 +293,8 @@ __compiletime_warning("copy_from_user() buffer size is not provably correct")* @from: Source address, in user space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from user space to kernel space. *
@@ -348,7 +352,8 @@ static inline unsigned long strnlen_user(const char __user *src, unsigned long n* strlen_user: - Get the size of a string in user space. * @str: The string to measure. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Get the size of a NUL-terminated string in user space. *
arch/s390/mm/fault.c +1 -1
@@ -399,7 +399,7 @@ static inline int do_exception(struct pt_regs *regs, int access)* user context. */ fault =VM_FAULT_BADCONTEXT ; -if (unlikely (!user_space_fault (regs) ||in_atomic () || !mm)) +if (unlikely (!user_space_fault (regs) ||faulthandler_disabled () || !mm)) goto out; address = trans_exc_code & __FAIL_ADDR_MASK;
arch/score/include/asm/uaccess.h +10 -5
@@ -36,7 +36,8 @@* @addr: User space pointer to start of block to check * @size: Size of block to check * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Checks if a pointer to a block of memory in user space is valid. *
@@ -61,7 +62,8 @@* @x: Value to copy to user space. * @ptr: Destination address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple value from kernel space to user * space. It supports simple types like char and int, but not larger
@@ -79,7 +81,8 @@* @x: Variable to store result. * @ptr: Source address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple variable from user space to kernel * space. It supports simple types like char and int, but not larger
@@ -98,7 +101,8 @@* @x: Value to copy to user space. * @ptr: Destination address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple value from kernel space to user * space. It supports simple types like char and int, but not larger
@@ -119,7 +123,8 @@* @x: Variable to store result. * @ptr: Source address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple variable from user space to kernel * space. It supports simple types like char and int, but not larger
arch/score/mm/fault.c +2 -1
@@ -34,6 +34,7 @@#include <linux/string.h> #include <linux/types.h> #include <linux/ptrace.h> +#include <linux/uaccess.h> /* * This routine handles page faults. It determines the address,
@@ -73,7 +74,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (pagefault_disabled () || !mm) goto bad_area_nosemaphore;if (user_mode (regs))
arch/sh/mm/fault.c +3 -2
@@ -17,6 +17,7 @@#include <linux/kprobes.h> #include <linux/perf_event.h> #include <linux/kdebug.h> +#include <linux/uaccess.h> #include <asm/io_trapped.h> #include <asm/mmu_context.h> #include <asm/tlbflush.h>
@@ -438,9 +439,9 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,/* * If we're in an interrupt, have no user context or are running -* in an atomic region then we must not take the fault: +* with pagefaults disabled then we must not take the fault: */ -if (unlikely (in_atomic () || !mm)) { +if (unlikely (faulthandler_disabled () || !mm)) {bad_area_nosemaphore (regs, error_code, address);return ; }
arch/sparc/include/asm/topology_64.h +1 -1
@@ -41,7 +41,7 @@ static inline int pcibus_to_node(struct pci_bus *pbus)#define topology_physical_package_id (cpu) (cpu_data(cpu).proc_id)#define topology_core_id (cpu) (cpu_data(cpu).core_id)#define topology_core_cpumask (cpu) (&cpu_core_sib_map[cpu]) -#define topology_thread_cpumask (cpu) (&per_cpu(cpu_sibling_map, cpu)) +#define topology_sibling_cpumask (cpu) (&per_cpu(cpu_sibling_map, cpu))#endif /* CONFIG_SMP */ extern cpumask_t cpu_core_map[NR_CPUS ];
arch/sparc/mm/fault_32.c +2 -2
@@ -21,6 +21,7 @@#include <linux/perf_event.h> #include <linux/interrupt.h> #include <linux/kdebug.h> +#include <linux/uaccess.h> #include <asm/page.h> #include <asm/pgtable.h>
@@ -29,7 +30,6 @@#include <asm/setup.h> #include <asm/smp.h> #include <asm/traps.h> -#include <asm/uaccess.h> #include "mm_32.h"
@@ -196,7 +196,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (pagefault_disabled () || !mm) goto no_context;perf_sw_event (PERF_COUNT_SW_PAGE_FAULTS ,1 , regs, address);
arch/sparc/mm/fault_64.c +2 -2
@@ -22,12 +22,12 @@#include <linux/kdebug.h> #include <linux/percpu.h> #include <linux/context_tracking.h> +#include <linux/uaccess.h> #include <asm/page.h> #include <asm/pgtable.h> #include <asm/openprom.h> #include <asm/oplib.h> -#include <asm/uaccess.h> #include <asm/asi.h> #include <asm/lsu.h> #include <asm/sections.h>
@@ -330,7 +330,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto intr_or_no_mm;perf_sw_event (PERF_COUNT_SW_PAGE_FAULTS ,1 , regs, address);
arch/sparc/mm/highmem.c +3 -1
@@ -53,7 +53,7 @@ void *kmap_atomic(struct page *page)unsigned long vaddr;long idx, type; -/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ +preempt_disable ();pagefault_disable ();if (!PageHighMem (page))return page_address (page);
@@ -91,6 +91,7 @@ void __kunmap_atomic(void *kvaddr)if (vaddr <FIXADDR_START ) {// FIXME pagefault_enable (); +preempt_enable ();return ; }
@@ -126,5 +127,6 @@ void __kunmap_atomic(void *kvaddr)kmap_atomic_idx_pop ();pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL (__kunmap_atomic);
arch/sparc/mm/init_64.c +1 -1
@@ -2738,7 +2738,7 @@ void hugetlb_setup(struct pt_regs *regs)struct mm_struct *mm = current->mm;struct tsb_config *tp; -if (in_atomic () || !mm) { +if (faulthandler_disabled () || !mm) {const struct exception_table_entry *entry; entry =search_exception_tables (regs->tpc);
arch/tile/include/asm/topology.h +1 -1
@@ -55,7 +55,7 @@ static inline const struct cpumask *cpumask_of_node(int node)#define topology_physical_package_id (cpu) ((void)(cpu), 0)#define topology_core_id (cpu) (cpu)#define topology_core_cpumask (cpu) ((void)(cpu), cpu_online_mask) -#define topology_thread_cpumask (cpu) cpumask_of(cpu) +#define topology_sibling_cpumask (cpu) cpumask_of(cpu)#endif #endif /* _ASM_TILE_TOPOLOGY_H */
arch/tile/include/asm/uaccess.h +12 -6
@@ -78,7 +78,8 @@ int __range_ok(unsigned long addr, unsigned long size);* @addr: User space pointer to start of block to check * @size: Size of block to check * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Checks if a pointer to a block of memory in user space is valid. *
@@ -192,7 +193,8 @@ extern int __get_user_bad(void)* @x: Variable to store result. * @ptr: Source address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple variable from user space to kernel * space. It supports simple types like char and int, but not larger
@@ -274,7 +276,8 @@ extern int __put_user_bad(void)* @x: Value to copy to user space. * @ptr: Destination address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple value from kernel space to user * space. It supports simple types like char and int, but not larger
@@ -330,7 +333,8 @@ extern int __put_user_bad(void)* @from: Source address, in kernel space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from kernel space to user space. Caller must check * the specified block with access_ok() before calling this function.
@@ -366,7 +370,8 @@ copy_to_user(void __user *to, const void *from, unsigned long n)* @from: Source address, in user space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from user space to kernel space. Caller must check * the specified block with access_ok() before calling this function.
@@ -437,7 +442,8 @@ static inline unsigned long __must_check copy_from_user(void *to,* @from: Source address, in user space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from user space to user space. Caller must check * the specified blocks with access_ok() before calling this function.
arch/tile/mm/fault.c +2 -2
@@ -354,9 +354,9 @@ static int handle_page_fault(struct pt_regs *regs,/* * If we're in an interrupt, have no user context or are running in an -* atomic region then we must not take the fault. +* region with pagefaults disabled then we must not take the fault. */ -if (in_atomic () || !mm) { +if (pagefault_disabled () || !mm) { vma =NULL ;/* happy compiler */ goto bad_area_nosemaphore; }
arch/tile/mm/highmem.c +2 -1
@@ -201,7 +201,7 @@ void *kmap_atomic_prot(struct page *page, pgprot_t prot)int idx, type;pte_t *pte; -/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ +preempt_disable ();pagefault_disable ();/* Avoid icache flushes by disallowing atomic executable mappings. */
@@ -259,6 +259,7 @@ void __kunmap_atomic(void *kvaddr) }pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL (__kunmap_atomic);
arch/um/kernel/trap.c +3 -2
@@ -7,6 +7,7 @@#include <linux/sched.h> #include <linux/hardirq.h> #include <linux/module.h> +#include <linux/uaccess.h> #include <asm/current.h> #include <asm/pgtable.h> #include <asm/tlbflush.h>
@@ -35,10 +36,10 @@ int handle_page_fault(unsigned long address, unsigned long ip, *code_out =SEGV_MAPERR ;/* -* If the fault was during atomic operation, don't take the fault, just +* If the fault was with pagefaults disabled, don't take the fault, just * fail. */ -if (in_atomic ()) +if (faulthandler_disabled ()) goto out_nosemaphore;if (is_user)
arch/unicore32/mm/fault.c +1 -1
@@ -218,7 +218,7 @@ static int do_pf(unsigned long addr, unsigned int fsr, struct pt_regs *regs)* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) +if (faulthandler_disabled () || !mm) goto no_context;if (user_mode (regs))
arch/x86/include/asm/preempt.h +3 -5
@@ -99,11 +99,9 @@ static __always_inline bool should_resched(void) extern asmlinkage void ___preempt_schedule(void);# define __preempt_schedule () asm ("call ___preempt_schedule") extern asmlinkage void preempt_schedule(void); -# ifdef CONFIG_CONTEXT_TRACKING - extern asmlinkage void ___preempt_schedule_context(void); -# define __preempt_schedule_context () asm ("call ___preempt_schedule_context") - extern asmlinkage void preempt_schedule_context(void); -# endif + extern asmlinkage void ___preempt_schedule_notrace(void); +# define __preempt_schedule_notrace () asm ("call ___preempt_schedule_notrace") + extern asmlinkage void preempt_schedule_notrace(void);#endif #endif /* __ASM_PREEMPT_H */
arch/x86/include/asm/smp.h +0 -10
@@ -37,16 +37,6 @@ DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map);DECLARE_PER_CPU_READ_MOSTLY (u16, cpu_llc_id);DECLARE_PER_CPU_READ_MOSTLY (int, cpu_number); -static inline struct cpumask *cpu_sibling_mask (int cpu) -{ -return per_cpu (cpu_sibling_map, cpu); -} - -static inline struct cpumask *cpu_core_mask (int cpu) -{ -return per_cpu (cpu_core_map, cpu); -} -static inline struct cpumask *cpu_llc_shared_mask (int cpu) {return per_cpu (cpu_llc_shared_map, cpu);
arch/x86/include/asm/topology.h +1 -1
@@ -124,7 +124,7 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);#ifdef ENABLE_TOPO_DEFINES #define topology_core_cpumask (cpu) (per_cpu(cpu_core_map, cpu)) -#define topology_thread_cpumask (cpu) (per_cpu(cpu_sibling_map, cpu)) +#define topology_sibling_cpumask (cpu) (per_cpu(cpu_sibling_map, cpu))#endif static inline void arch_fix_phys_package_id (int num,u32 slot)
arch/x86/include/asm/uaccess.h +10 -5
@@ -74,7 +74,8 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un* @addr: User space pointer to start of block to check * @size: Size of block to check * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Checks if a pointer to a block of memory in user space is valid. *
@@ -145,7 +146,8 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))* @x: Variable to store result. * @ptr: Source address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple variable from user space to kernel * space. It supports simple types like char and int, but not larger
@@ -240,7 +242,8 @@ extern void __put_user_8(void);* @x: Value to copy to user space. * @ptr: Destination address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple value from kernel space to user * space. It supports simple types like char and int, but not larger
@@ -455,7 +458,8 @@ struct __large_struct { unsigned long buf[100]; };* @x: Variable to store result. * @ptr: Source address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple variable from user space to kernel * space. It supports simple types like char and int, but not larger
@@ -479,7 +483,8 @@ struct __large_struct { unsigned long buf[100]; };* @x: Value to copy to user space. * @ptr: Destination address, in user space. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * This macro copies a single simple value from kernel space to user * space. It supports simple types like char and int, but not larger
arch/x86/include/asm/uaccess_32.h +4 -2
@@ -70,7 +70,8 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)* @from: Source address, in kernel space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from kernel space to user space. Caller must check * the specified block with access_ok() before calling this function.
@@ -117,7 +118,8 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)* @from: Source address, in user space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from user space to kernel space. Caller must check * the specified block with access_ok() before calling this function.
arch/x86/kernel/cpu/perf_event_intel.c +3 -3
@@ -2621,7 +2621,7 @@ static void intel_pmu_cpu_starting(int cpu)if (!(x86_pmu.flags &PMU_FL_NO_HT_SHARING )) {void **onln = &cpuc->kfree_on_online[X86_PERF_KFREE_SHARED ]; -for_each_cpu (i,topology_thread_cpumask (cpu)) { +for_each_cpu (i,topology_sibling_cpumask (cpu)) {struct intel_shared_regs *pc; pc =per_cpu (cpu_hw_events, i).shared_regs;
@@ -2641,7 +2641,7 @@ static void intel_pmu_cpu_starting(int cpu)if (x86_pmu.flags &PMU_FL_EXCL_CNTRS ) {int h = x86_pmu.num_counters >>1 ; -for_each_cpu (i,topology_thread_cpumask (cpu)) { +for_each_cpu (i,topology_sibling_cpumask (cpu)) {struct intel_excl_cntrs *c; c =per_cpu (cpu_hw_events, i).excl_cntrs;
@@ -3403,7 +3403,7 @@ static __init int fixup_ht_bug(void)if (!(x86_pmu.flags &PMU_FL_EXCL_ENABLED ))return 0 ; - w =cpumask_weight (topology_thread_cpumask (cpu)); + w =cpumask_weight (topology_sibling_cpumask (cpu));if (w >1 ) {pr_info ("PMU erratum BJ122, BV98, HSD29 worked around, HT is on\n" );return 0 ;
arch/x86/kernel/cpu/proc.c +2 -1
@@ -12,7 +12,8 @@ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c, {#ifdef CONFIG_SMP seq_printf (m,"physical id\t: %d\n" , c->phys_proc_id); -seq_printf (m,"siblings\t: %d\n" ,cpumask_weight (cpu_core_mask (cpu))); +seq_printf (m,"siblings\t: %d\n" , +cpumask_weight (topology_core_cpumask (cpu)));seq_printf (m,"core id\t\t: %d\n" , c->cpu_core_id);seq_printf (m,"cpu cores\t: %d\n" , c->booted_cores);seq_printf (m,"apicid\t\t: %d\n" , c->apicid);
arch/x86/kernel/i386_ksyms_32.c +1 -3
@@ -40,7 +40,5 @@ EXPORT_SYMBOL(empty_zero_page);#ifdef CONFIG_PREEMPT EXPORT_SYMBOL (___preempt_schedule); -#ifdef CONFIG_CONTEXT_TRACKING -EXPORT_SYMBOL (___preempt_schedule_context); -#endif +EXPORT_SYMBOL (___preempt_schedule_notrace);#endif
arch/x86/kernel/process.c +3 -4
@@ -445,11 +445,10 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c) }/* -* MONITOR/MWAIT with no hints, used for default default C1 state. -* This invokes MWAIT with interrutps enabled and no flags, -* which is backwards compatible with the original MWAIT implementation. +* MONITOR/MWAIT with no hints, used for default C1 state. This invokes MWAIT +* with interrupts enabled and no flags, which is backwards compatible with the +* original MWAIT implementation. */ -static void mwait_idle (void ) {if (!current_set_polling_and_test ()) {
arch/x86/kernel/smpboot.c +22 -20
103 lines not on this page · raw message
arch/x86/kernel/tsc_sync.c +1 -1
@@ -113,7 +113,7 @@ static void check_tsc_warp(unsigned int timeout)*/ static inline unsigned int loop_timeout (int cpu) { -return (cpumask_weight (cpu_core_mask (cpu)) >1 ) ?2 :20 ; +return (cpumask_weight (topology_core_cpumask (cpu)) >1 ) ?2 :20 ; }/*
arch/x86/kernel/x8664_ksyms_64.c +1 -3
@@ -75,7 +75,5 @@ EXPORT_SYMBOL(native_load_gs_index);#ifdef CONFIG_PREEMPT EXPORT_SYMBOL (___preempt_schedule); -#ifdef CONFIG_CONTEXT_TRACKING -EXPORT_SYMBOL (___preempt_schedule_context); -#endif +EXPORT_SYMBOL (___preempt_schedule_notrace);#endif
arch/x86/lib/thunk_32.S +1 -3
@@ -38,8 +38,6 @@ #ifdef CONFIG_PREEMPT THUNK ___preempt_schedule, preempt_schedule -#ifdef CONFIG_CONTEXT_TRACKING - THUNK ___preempt_schedule_context, preempt_schedule_context -#endif + THUNK ___preempt_schedule_notrace, preempt_schedule_notrace #endif
arch/x86/lib/thunk_64.S +1 -3
@@ -49,9 +49,7 @@ #ifdef CONFIG_PREEMPT THUNK ___preempt_schedule, preempt_schedule -#ifdef CONFIG_CONTEXT_TRACKING - THUNK ___preempt_schedule_context, preempt_schedule_context -#endif + THUNK ___preempt_schedule_notrace, preempt_schedule_notrace #endif #if defined(CONFIG_TRACE_IRQFLAGS) \
arch/x86/lib/usercopy_32.c +4 -2
@@ -647,7 +647,8 @@ EXPORT_SYMBOL(__copy_from_user_ll_nocache_nozero);* @from: Source address, in kernel space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from kernel space to user space. *
@@ -668,7 +669,8 @@ EXPORT_SYMBOL(_copy_to_user);* @from: Source address, in user space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. This function may sleep if pagefaults are +* enabled. * * Copy data from user space to kernel space. *
arch/x86/mm/fault.c +3 -2
@@ -13,6 +13,7 @@#include <linux/hugetlb.h> /* hstate_index_to_shift */ #include <linux/prefetch.h> /* prefetchw */ #include <linux/context_tracking.h> /* exception_enter(), ... */ +#include <linux/uaccess.h> /* faulthandler_disabled() */ #include <asm/traps.h> /* dotraplinkage, ... */ #include <asm/pgalloc.h> /* pgd_*(), ... */
@@ -1126,9 +1127,9 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code,/* * If we're in an interrupt, have no user context or are running -* in an atomic region then we must not take the fault: +* in a region with pagefaults disabled then we must not take the fault */ -if (unlikely (in_atomic () || !mm)) { +if (unlikely (faulthandler_disabled () || !mm)) {bad_area_nosemaphore (regs, error_code, address);return ; }
arch/x86/mm/highmem_32.c +2 -1
@@ -35,7 +35,7 @@ void *kmap_atomic_prot(struct page *page, pgprot_t prot)unsigned long vaddr;int idx, type; -/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ +preempt_disable ();pagefault_disable ();if (!PageHighMem (page))
@@ -100,6 +100,7 @@ void __kunmap_atomic(void *kvaddr)#endif pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL (__kunmap_atomic);
arch/x86/mm/iomap_32.c +2 -0
@@ -59,6 +59,7 @@ void *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot)unsigned long vaddr;int idx, type; +preempt_disable ();pagefault_disable (); type =kmap_atomic_idx_push ();
@@ -117,5 +118,6 @@ iounmap_atomic(void __iomem *kvaddr) }pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL_GPL (iounmap_atomic);
arch/xtensa/mm/fault.c +2 -2
@@ -15,10 +15,10 @@#include <linux/mm.h> #include <linux/module.h> #include <linux/hardirq.h> +#include <linux/uaccess.h> #include <asm/mmu_context.h> #include <asm/cacheflush.h> #include <asm/hardirq.h> -#include <asm/uaccess.h> #include <asm/pgalloc.h> DEFINE_PER_CPU(unsigned long, asid_cache) = ASID_USER_FIRST;
@@ -57,7 +57,7 @@ void do_page_fault(struct pt_regs *regs)/* If we're in an interrupt or have no user * context, we must not take the fault.. */ -if (in_atomic () || !mm) { +if (faulthandler_disabled () || !mm) {bad_page_fault (regs, address,SIGSEGV );return ; }
arch/xtensa/mm/highmem.c +2 -0
@@ -42,6 +42,7 @@ void *kmap_atomic(struct page *page)enum fixed_addresses idx;unsigned long vaddr; +preempt_disable ();pagefault_disable ();if (!PageHighMem (page))return page_address (page);
@@ -79,6 +80,7 @@ void __kunmap_atomic(void *kvaddr) }pagefault_enable (); +preempt_enable (); }EXPORT_SYMBOL (__kunmap_atomic);
block/blk-mq-cpumap.c +1 -1
@@ -24,7 +24,7 @@ static int get_first_sibling(unsigned int cpu) {unsigned int ret; - ret =cpumask_first (topology_thread_cpumask (cpu)); + ret =cpumask_first (topology_sibling_cpumask (cpu));if (ret < nr_cpu_ids)return ret;
drivers/acpi/acpi_pad.c +1 -1
@@ -105,7 +105,7 @@ static void round_robin_cpu(unsigned int tsk_index)mutex_lock (&round_robin_lock);cpumask_clear (tmp);for_each_cpu (cpu, pad_busy_cpus) -cpumask_or (tmp, tmp,topology_thread_cpumask (cpu)); +cpumask_or (tmp, tmp,topology_sibling_cpumask (cpu));cpumask_andnot (tmp, cpu_online_mask, tmp);/* avoid HT sibilings if possible */ if (cpumask_empty (tmp))
drivers/base/topology.c +1 -1
@@ -61,7 +61,7 @@ static DEVICE_ATTR_RO(physical_package_id);define_id_show_func (core_id);static DEVICE_ATTR_RO (core_id); -define_siblings_show_func (thread_siblings, thread_cpumask); +define_siblings_show_func (thread_siblings, sibling_cpumask);static DEVICE_ATTR_RO (thread_siblings);static DEVICE_ATTR_RO (thread_siblings_list);
drivers/cpufreq/acpi-cpufreq.c +3 -2
@@ -699,13 +699,14 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)dmi_check_system (sw_any_bug_dmi_table);if (bios_with_sw_any_bug && !policy_is_shared (policy)) { policy->shared_type =CPUFREQ_SHARED_TYPE_ALL ; -cpumask_copy (policy->cpus,cpu_core_mask (cpu)); +cpumask_copy (policy->cpus,topology_core_cpumask (cpu)); }if (check_amd_hwpstate_cpu (cpu) && !acpi_pstate_strict) {cpumask_clear (policy->cpus);cpumask_set_cpu (cpu, policy->cpus); -cpumask_copy (data->freqdomain_cpus,cpu_sibling_mask (cpu)); +cpumask_copy (data->freqdomain_cpus, +topology_sibling_cpumask (cpu)); policy->shared_type =CPUFREQ_SHARED_TYPE_HW ;pr_info_once (PFX "overriding BIOS provided _PSD data\n" ); }
drivers/cpufreq/p4-clockmod.c +1 -1
@@ -172,7 +172,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)unsigned int i;#ifdef CONFIG_SMP -cpumask_copy (policy->cpus,cpu_sibling_mask (policy->cpu)); +cpumask_copy (policy->cpus,topology_sibling_cpumask (policy->cpu));#endif /* Errata workaround */
drivers/cpufreq/powernow-k8.c +3 -10
@@ -57,13 +57,6 @@ static DEFINE_PER_CPU(struct powernow_k8_data *, powernow_data);static struct cpufreq_driver cpufreq_amd64_driver; -#ifndef CONFIG_SMP -static inline const struct cpumask *cpu_core_mask (int cpu) -{ -return cpumask_of (0 ); -} -#endif -/* Return a frequency in MHz, given an input fid */ static u32 find_freq_from_fid (u32 fid) {
@@ -620,7 +613,7 @@ static int fill_powernow_table(struct powernow_k8_data *data,pr_debug ("cfid 0x%x, cvid 0x%x\n" , data->currfid, data->currvid); data->powernow_table = powernow_table; -if (cpumask_first (cpu_core_mask (data->cpu)) == data->cpu) +if (cpumask_first (topology_core_cpumask (data->cpu)) == data->cpu)print_basics (data);for (j =0 ; j < data->numps; j++)
@@ -784,7 +777,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)CPUFREQ_TABLE_END ; data->powernow_table = powernow_table; -if (cpumask_first (cpu_core_mask (data->cpu)) == data->cpu) +if (cpumask_first (topology_core_cpumask (data->cpu)) == data->cpu)print_basics (data);/* notify BIOS that we exist */
@@ -1090,7 +1083,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)if (rc !=0 ) goto err_out_exit_acpi; -cpumask_copy (pol->cpus,cpu_core_mask (pol->cpu)); +cpumask_copy (pol->cpus,topology_core_cpumask (pol->cpu)); data->available_cores = pol->cpus;/* min/max the cpu is capable of */
drivers/cpufreq/speedstep-ich.c +1 -1
@@ -292,7 +292,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)/* only run on CPU to be set, or on its sibling */ #ifdef CONFIG_SMP -cpumask_copy (policy->cpus,cpu_sibling_mask (policy->cpu)); +cpumask_copy (policy->cpus,topology_sibling_cpumask (policy->cpu));#endif policy_cpu =cpumask_any_and (policy->cpus, cpu_online_mask);
drivers/crypto/vmx/aes.c +7 -1
@@ -78,12 +78,14 @@ static int p8_aes_setkey(struct crypto_tfm *tfm, const u8 *key,int ret;struct p8_aes_ctx *ctx =crypto_tfm_ctx (tfm); +preempt_disable ();pagefault_disable ();enable_kernel_altivec (); ret =aes_p8_set_encrypt_key (key, keylen *8 , &ctx->enc_key); ret +=aes_p8_set_decrypt_key (key, keylen *8 , &ctx->dec_key);pagefault_enable (); - +preempt_enable (); + ret +=crypto_cipher_setkey (ctx->fallback, key, keylen);return ret; }
@@ -95,10 +97,12 @@ static void p8_aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)if (in_interrupt ()) {crypto_cipher_encrypt_one (ctx->fallback, dst, src); }else { +preempt_disable ();pagefault_disable ();enable_kernel_altivec ();aes_p8_encrypt (src, dst, &ctx->enc_key);pagefault_enable (); +preempt_enable (); } }
@@ -109,10 +113,12 @@ static void p8_aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)if (in_interrupt ()) {crypto_cipher_decrypt_one (ctx->fallback, dst, src); }else { +preempt_disable ();pagefault_disable ();enable_kernel_altivec ();aes_p8_decrypt (src, dst, &ctx->dec_key);pagefault_enable (); +preempt_enable (); } }
drivers/crypto/vmx/aes_cbc.c +6 -0
@@ -79,11 +79,13 @@ static int p8_aes_cbc_setkey(struct crypto_tfm *tfm, const u8 *key,int ret;struct p8_aes_cbc_ctx *ctx =crypto_tfm_ctx (tfm); +preempt_disable ();pagefault_disable ();enable_kernel_altivec (); ret =aes_p8_set_encrypt_key (key, keylen *8 , &ctx->enc_key); ret +=aes_p8_set_decrypt_key (key, keylen *8 , &ctx->dec_key);pagefault_enable (); +preempt_enable (); ret +=crypto_blkcipher_setkey (ctx->fallback, key, keylen);return ret;
@@ -106,6 +108,7 @@ static int p8_aes_cbc_encrypt(struct blkcipher_desc *desc,if (in_interrupt ()) { ret =crypto_blkcipher_encrypt (&fallback_desc, dst, src, nbytes); }else { +preempt_disable ();pagefault_disable ();enable_kernel_altivec ();
@@ -119,6 +122,7 @@ static int p8_aes_cbc_encrypt(struct blkcipher_desc *desc, }pagefault_enable (); +preempt_enable (); }return ret;
@@ -141,6 +145,7 @@ static int p8_aes_cbc_decrypt(struct blkcipher_desc *desc,if (in_interrupt ()) { ret =crypto_blkcipher_decrypt (&fallback_desc, dst, src, nbytes); }else { +preempt_disable ();pagefault_disable ();enable_kernel_altivec ();
@@ -154,6 +159,7 @@ static int p8_aes_cbc_decrypt(struct blkcipher_desc *desc, }pagefault_enable (); +preempt_enable (); }return ret;
drivers/crypto/vmx/ghash.c +8 -0
@@ -114,11 +114,13 @@ static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key,if (keylen !=GHASH_KEY_LEN )return -EINVAL ; +preempt_disable ();pagefault_disable ();enable_kernel_altivec ();enable_kernel_fp ();gcm_init_p8 (ctx->htable, (const u64 *) key);pagefault_enable (); +preempt_enable ();return crypto_shash_setkey (ctx->fallback, key, keylen); }
@@ -140,23 +142,27 @@ static int p8_ghash_update(struct shash_desc *desc, }memcpy (dctx->buffer + dctx->bytes, src,GHASH_DIGEST_SIZE - dctx->bytes); +preempt_disable ();pagefault_disable ();enable_kernel_altivec ();enable_kernel_fp ();gcm_ghash_p8 (dctx->shash, ctx->htable, dctx->buffer,GHASH_DIGEST_SIZE );pagefault_enable (); +preempt_enable (); src +=GHASH_DIGEST_SIZE - dctx->bytes; srclen -=GHASH_DIGEST_SIZE - dctx->bytes; dctx->bytes =0 ; } len = srclen & ~(GHASH_DIGEST_SIZE -1 );if (len) { +preempt_disable ();pagefault_disable ();enable_kernel_altivec ();enable_kernel_fp ();gcm_ghash_p8 (dctx->shash, ctx->htable, src, len);pagefault_enable (); +preempt_enable (); src += len; srclen -= len; }
@@ -180,12 +186,14 @@ static int p8_ghash_final(struct shash_desc *desc, u8 *out)if (dctx->bytes) {for (i = dctx->bytes; i <GHASH_DIGEST_SIZE ; i++) dctx->buffer[i] =0 ; +preempt_disable ();pagefault_disable ();enable_kernel_altivec ();enable_kernel_fp ();gcm_ghash_p8 (dctx->shash, ctx->htable, dctx->buffer,GHASH_DIGEST_SIZE );pagefault_enable (); +preempt_enable (); dctx->bytes =0 ; }memcpy (out, dctx->shash,GHASH_DIGEST_SIZE );
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -1
@@ -32,6 +32,7 @@#include "i915_trace.h" #include "intel_drv.h" #include <linux/dma_remapping.h> +#include <linux/uaccess.h> #define __EXEC_OBJECT_HAS_PIN (1<<31)#define __EXEC_OBJECT_HAS_FENCE (1<<30)
@@ -465,7 +466,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, }/* We can't wait for rendering with pagefaults disabled */ -if (obj->active &&in_atomic ()) +if (obj->active &&pagefault_disabled ())return -EFAULT ;if (use_cpu_reloc (obj))
drivers/hwmon/coretemp.c +2 -1
@@ -63,7 +63,8 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius");#define TO_ATTR_NO (cpu) (TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)#ifdef CONFIG_SMP -#define for_each_sibling (i, cpu) for_each_cpu(i, cpu_sibling_mask(cpu)) +#define for_each_sibling (i, cpu) \ + for_each_cpu(i, topology_sibling_cpumask(cpu))#else #define for_each_sibling (i, cpu) for (i = 0; false; )#endif
drivers/net/ethernet/sfc/efx.c +1 -1
@@ -1304,7 +1304,7 @@ static unsigned int efx_wanted_parallelism(struct efx_nic *efx)if (!cpumask_test_cpu (cpu, thread_mask)) { ++count;cpumask_or (thread_mask, thread_mask, -topology_thread_cpumask (cpu)); +topology_sibling_cpumask (cpu)); } }
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +1 -1
@@ -87,7 +87,7 @@ static void cfs_cpu_core_siblings(int cpu, cpumask_t *mask)/* return cpumask of HTs in the same core */ static void cfs_cpu_ht_siblings (int cpu,cpumask_t *mask) { -cpumask_copy (mask,topology_thread_cpumask (cpu)); +cpumask_copy (mask,topology_sibling_cpumask (cpu)); }static void cfs_node_to_cpumask (int node,cpumask_t *mask)
drivers/staging/lustre/lustre/ptlrpc/service.c +2 -2
@@ -557,7 +557,7 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc,* there are. */ /* weight is # of HTs */ -if (cpumask_weight (topology_thread_cpumask (0 )) >1 ) { +if (cpumask_weight (topology_sibling_cpumask (0 )) >1 ) {/* depress thread factor for hyper-thread */ factor = factor - (factor >>1 ) + (factor >>3 ); }
@@ -2768,7 +2768,7 @@ int ptlrpc_hr_init(void)init_waitqueue_head (&ptlrpc_hr.hr_waitq); - weight =cpumask_weight (topology_thread_cpumask (0 )); + weight =cpumask_weight (topology_sibling_cpumask (0 ));cfs_percpt_for_each (hrp, i, ptlrpc_hr.hr_partitions) { hrp->hrp_cpt = i;
include/asm-generic/futex.h +5 -2
@@ -8,8 +8,7 @@#ifndef CONFIG_SMP /* * The following implementation only for uniprocessor machines. -* For UP, it's relies on the fact that pagefault_disable() also disables -* preemption to ensure mutual exclusion. +* It relies on preempt_disable() ensuring mutual exclusion. * */
@@ -38,6 +37,7 @@ futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)if (encoded_op & (FUTEX_OP_OPARG_SHIFT <<28 )) oparg =1 << oparg; +preempt_disable ();pagefault_disable (); ret = -EFAULT ;
@@ -72,6 +72,7 @@ futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) out_pagefault_enable:pagefault_enable (); +preempt_enable ();if (ret ==0 ) {switch (cmp) {
@@ -106,6 +107,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, {u32 val; +preempt_disable ();if (unlikely (get_user (val, uaddr) !=0 ))return -EFAULT ;
@@ -113,6 +115,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,return -EFAULT ; *uval = val; +preempt_enable ();return 0 ; }
include/asm-generic/preempt.h +2 -5
@@ -79,11 +79,8 @@ static __always_inline bool should_resched(void)#ifdef CONFIG_PREEMPT extern asmlinkage void preempt_schedule(void);#define __preempt_schedule () preempt_schedule() - -#ifdef CONFIG_CONTEXT_TRACKING -extern asmlinkage void preempt_schedule_context(void); -#define __preempt_schedule_context () preempt_schedule_context() -#endif +extern asmlinkage void preempt_schedule_notrace(void); +#define __preempt_schedule_notrace () preempt_schedule_notrace()#endif /* CONFIG_PREEMPT */ #endif /* __ASM_PREEMPT_H */
include/linux/bottom_half.h +0 -1
@@ -2,7 +2,6 @@#define _LINUX_BH_H#include <linux/preempt.h> -#include <linux/preempt_mask.h> #ifdef CONFIG_TRACE_IRQFLAGS extern void __local_bh_disable_ip (unsigned long ip,unsigned int cnt);
include/linux/hardirq.h +1 -1
@@ -1,7 +1,7 @@#ifndef LINUX_HARDIRQ_H #define LINUX_HARDIRQ_H -#include <linux/preempt_mask.h> +#include <linux/preempt.h> #include <linux/lockdep.h> #include <linux/ftrace_irq.h> #include <linux/vtime.h>
include/linux/highmem.h +2 -0
@@ -65,6 +65,7 @@ static inline void kunmap(struct page *page)static inline void *kmap_atomic (struct page *page) { +preempt_disable ();pagefault_disable ();return page_address (page); }
@@ -73,6 +74,7 @@ static inline void *kmap_atomic(struct page *page)static inline void __kunmap_atomic (void *addr) {pagefault_enable (); +preempt_enable (); }#define kmap_atomic_pfn (pfn) kmap_atomic(pfn_to_page(pfn))
include/linux/init_task.h +2 -3
@@ -50,9 +50,8 @@ extern struct fs_struct init_fs; .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \ .rlim = INIT_RLIMITS, \ .cputimer = { \ - .cputime = INIT_CPUTIME, \ - .running = 0, \ - .lock = __RAW_SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \ + .cputime_atomic = INIT_CPUTIME_ATOMIC, \ + .running = 0, \ }, \ .cred_guard_mutex = \ __MUTEX_INITIALIZER(sig.cred_guard_mutex), \
include/linux/io-mapping.h +2 -0
@@ -141,6 +141,7 @@ static inline void __iomem * io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) { +preempt_disable ();pagefault_disable ();return ((char __force __iomem *) mapping) + offset; }
@@ -149,6 +150,7 @@ static inline void io_mapping_unmap_atomic(void __iomem *vaddr) {pagefault_enable (); +preempt_enable (); }/* Non-atomic map/unmap */
include/linux/kernel.h +2 -1
@@ -244,7 +244,8 @@ static inline u32 reciprocal_scale(u32 val, u32 ep_ro)#if defined(CONFIG_MMU ) && \ (defined(CONFIG_PROVE_LOCKING ) || defined(CONFIG_DEBUG_ATOMIC_SLEEP )) -void might_fault (void ); +#define might_fault () __might_fault(__FILE__, __LINE__) +void __might_fault (const char *file,int line);#else static inline void might_fault (void ) { }#endif
include/linux/lglock.h +5 -0
@@ -52,10 +52,15 @@ struct lglock { static struct lglock name = { .lock = &name ## _lock }void lg_lock_init (struct lglock *lg,char *name); +void lg_local_lock (struct lglock *lg);void lg_local_unlock (struct lglock *lg);void lg_local_lock_cpu (struct lglock *lg,int cpu);void lg_local_unlock_cpu (struct lglock *lg,int cpu); + +void lg_double_lock (struct lglock *lg,int cpu1,int cpu2); +void lg_double_unlock (struct lglock *lg,int cpu1,int cpu2); +void lg_global_lock (struct lglock *lg);void lg_global_unlock (struct lglock *lg);
include/linux/preempt.h +136 -23
219 lines not on this page · raw message
include/linux/preempt_mask.h deleted +0 -117
117 lines not on this page · raw message
include/linux/sched.h +91 -27
224 lines not on this page · raw message
include/linux/uaccess.h +35 -13
48 lines not on this page · raw message
ipc/mqueue.c +33 -21
54 lines not on this page · raw message
kernel/sched/core.c +97 -39
136 lines not on this page · raw message
kernel/sched/deadline.c +45 -6
51 lines not on this page · raw message
kernel/sched/fair.c +296 -76
372 lines not on this page · raw message
kernel/sched/loadavg.c renamed from kernel/sched/proc.c +23 -213
236 lines not on this page · raw message
kernel/stop_machine.c +5 -37
42 lines not on this page · raw message
kernel/time/posix-cpu-timers.c +54 -33
87 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/
Part of the diff is not shown here. View the raw message.