diff --git a/arch/alpha/include/asm/spinlock_types.h b/arch/alpha/include/asm/spinlock_types.h index 1d5716bc060bed0a3b00109478c6faa81dae3c12..6883bc952d2249ea163eaf8d78cb65f0c3c15319 100644 --- a/arch/alpha/include/asm/spinlock_types.h +++ b/arch/alpha/include/asm/spinlock_types.h @@ -2,10 +2,6 @@ #ifndef _ALPHA_SPINLOCK_TYPES_H #define _ALPHA_SPINLOCK_TYPES_H -#ifndef __LINUX_SPINLOCK_TYPES_H -# error "please don't include this file directly" -#endif - typedef struct { volatile unsigned int lock; } arch_spinlock_t; diff --git a/arch/arm/include/asm/spinlock_types.h b/arch/arm/include/asm/spinlock_types.h index 5976958647fe16e71a4b0977b057911470f6c450..a37c0803954baa7cf4830de21afddb0e1d1df266 100644 --- a/arch/arm/include/asm/spinlock_types.h +++ b/arch/arm/include/asm/spinlock_types.h @@ -2,10 +2,6 @@ #ifndef __ASM_SPINLOCK_TYPES_H #define __ASM_SPINLOCK_TYPES_H -#ifndef __LINUX_SPINLOCK_TYPES_H -# error "please don't include this file directly" -#endif - #define TICKET_SHIFT 16 typedef struct { diff --git a/arch/arm64/include/asm/spinlock_types.h b/arch/arm64/include/asm/spinlock_types.h index 18782f0c47212d455266df89de0782ab5b5d7ea3..6672b05350b4ef9df9449a78be632d4289659839 100644 --- a/arch/arm64/include/asm/spinlock_types.h +++ b/arch/arm64/include/asm/spinlock_types.h @@ -5,10 +5,6 @@ #ifndef __ASM_SPINLOCK_TYPES_H #define __ASM_SPINLOCK_TYPES_H -#if !defined(__LINUX_SPINLOCK_TYPES_H) && !defined(__ASM_SPINLOCK_H) -# error "please don't include this file directly" -#endif - #include #include diff --git a/arch/hexagon/include/asm/spinlock_types.h b/arch/hexagon/include/asm/spinlock_types.h index 19d233497ba5211727f47740b9e104caa6baeb71..de72fb23016dc09540fae6e75d5e3924c6f4ff08 100644 --- a/arch/hexagon/include/asm/spinlock_types.h +++ b/arch/hexagon/include/asm/spinlock_types.h @@ -8,10 +8,6 @@ #ifndef _ASM_SPINLOCK_TYPES_H #define _ASM_SPINLOCK_TYPES_H -#ifndef __LINUX_SPINLOCK_TYPES_H -# error "please don't include this file directly" -#endif - typedef struct { volatile unsigned int lock; } arch_spinlock_t; diff --git a/arch/ia64/include/asm/spinlock_types.h b/arch/ia64/include/asm/spinlock_types.h index 6e345fefcdcab0e1962b15a1f03180667b3533f3..681408d6816fbc9157304659162b4783e4ac1eb0 100644 --- a/arch/ia64/include/asm/spinlock_types.h +++ b/arch/ia64/include/asm/spinlock_types.h @@ -2,10 +2,6 @@ #ifndef _ASM_IA64_SPINLOCK_TYPES_H #define _ASM_IA64_SPINLOCK_TYPES_H -#ifndef __LINUX_SPINLOCK_TYPES_H -# error "please don't include this file directly" -#endif - typedef struct { volatile unsigned int lock; } arch_spinlock_t; diff --git a/arch/powerpc/include/asm/spinlock_types.h b/arch/powerpc/include/asm/spinlock_types.h index c5d742f18021dd36c3ca8d20c02b5ec801c822ce..cc6922a011ba112f92a5b00e2fc0b2df9c1b37c0 100644 --- a/arch/powerpc/include/asm/spinlock_types.h +++ b/arch/powerpc/include/asm/spinlock_types.h @@ -2,10 +2,6 @@ #ifndef _ASM_POWERPC_SPINLOCK_TYPES_H #define _ASM_POWERPC_SPINLOCK_TYPES_H -#ifndef __LINUX_SPINLOCK_TYPES_H -# error "please don't include this file directly" -#endif - #ifdef CONFIG_PPC_QUEUED_SPINLOCKS #include #include diff --git a/arch/s390/include/asm/spinlock_types.h b/arch/s390/include/asm/spinlock_types.h index cfed272e4fd592d9d5844485e64921c30a61ccc2..8e28e8176ec88a5defd6e1289739327488ac2933 100644 --- a/arch/s390/include/asm/spinlock_types.h +++ b/arch/s390/include/asm/spinlock_types.h @@ -2,10 +2,6 @@ #ifndef __ASM_SPINLOCK_TYPES_H #define __ASM_SPINLOCK_TYPES_H -#ifndef __LINUX_SPINLOCK_TYPES_H -# error "please don't include this file directly" -#endif - typedef struct { int lock; } __attribute__ ((aligned (4))) arch_spinlock_t; diff --git a/arch/sh/include/asm/spinlock_types.h b/arch/sh/include/asm/spinlock_types.h index e82369f286a20fee9f94f59db4a0f2a24326c537..22ca9a98bbb8bc34921b1b331283d2d5f0ca637c 100644 --- a/arch/sh/include/asm/spinlock_types.h +++ b/arch/sh/include/asm/spinlock_types.h @@ -2,10 +2,6 @@ #ifndef __ASM_SH_SPINLOCK_TYPES_H #define __ASM_SH_SPINLOCK_TYPES_H -#ifndef __LINUX_SPINLOCK_TYPES_H -# error "please don't include this file directly" -#endif - typedef struct { volatile unsigned int lock; } arch_spinlock_t; diff --git a/arch/xtensa/include/asm/spinlock_types.h b/arch/xtensa/include/asm/spinlock_types.h index 64c9389254f13deb18a950b08fef786fb323da70..dc846323b1cd7840a90d8bc43fc640a71460e42a 100644 --- a/arch/xtensa/include/asm/spinlock_types.h +++ b/arch/xtensa/include/asm/spinlock_types.h @@ -2,10 +2,6 @@ #ifndef __ASM_SPINLOCK_TYPES_H #define __ASM_SPINLOCK_TYPES_H -#if !defined(__LINUX_SPINLOCK_TYPES_H) && !defined(__ASM_SPINLOCK_H) -# error "please don't include this file directly" -#endif - #include #include diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 36eebb055d79741f751d05139c96957d67c42a14..fb5a55dcd07104d2dcefd0c5a624fe60f70373c5 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -68,6 +68,7 @@ struct trace_entry { unsigned char flags; unsigned char preempt_count; int pid; + unsigned char migrate_disable; }; #define TRACE_EVENT_TYPE_MAX \ @@ -156,6 +157,7 @@ static inline void tracing_generic_entry_update(struct trace_entry *entry, unsigned int trace_ctx) { entry->preempt_count = trace_ctx & 0xff; + entry->migrate_disable = (trace_ctx >> 8) & 0xff; entry->pid = current->pid; entry->type = type; entry->flags = trace_ctx >> 16; diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 273f0865df0de2fe423470dea71dea7c1edf6227..3356e03540134c1c1b9139e73950763d4d55eaf6 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -1118,6 +1118,7 @@ void __lockfunc rt_spin_lock(spinlock_t *lock) { spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock); + rcu_read_lock(); migrate_disable(); } EXPORT_SYMBOL(rt_spin_lock); @@ -1132,6 +1133,7 @@ void __lockfunc rt_spin_lock_nested(spinlock_t *lock, int subclass) { spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_); rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock); + rcu_read_lock(); migrate_disable(); } EXPORT_SYMBOL(rt_spin_lock_nested); @@ -1141,6 +1143,7 @@ void __lockfunc rt_spin_lock_nest_lock(spinlock_t *lock, { spin_acquire_nest(&lock->dep_map, 0, 0, nest_lock, _RET_IP_); rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock); + rcu_read_lock(); migrate_disable(); } EXPORT_SYMBOL(rt_spin_lock_nest_lock); @@ -1151,6 +1154,7 @@ void __lockfunc rt_spin_unlock(spinlock_t *lock) /* NOTE: we always pass in '1' for nested, for simplicity */ spin_release(&lock->dep_map, _RET_IP_); migrate_enable(); + rcu_read_unlock(); rt_spin_lock_fastunlock(&lock->lock, rt_spin_lock_slowunlock); } EXPORT_SYMBOL(rt_spin_unlock); @@ -1180,6 +1184,7 @@ int __lockfunc rt_spin_trylock(spinlock_t *lock) ret = __rt_mutex_trylock(&lock->lock); if (ret) { spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); + rcu_read_lock(); migrate_disable(); } return ret; @@ -1194,6 +1199,7 @@ int __lockfunc rt_spin_trylock_bh(spinlock_t *lock) ret = __rt_mutex_trylock(&lock->lock); if (ret) { spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); + rcu_read_lock(); migrate_disable(); } else { local_bh_enable(); diff --git a/kernel/locking/rwlock-rt.c b/kernel/locking/rwlock-rt.c index 16be7111aae71c7896c750bbbf88029c2693c3c4..3d2d1f14b513505cd009fa2f1733d93e74ac7746 100644 --- a/kernel/locking/rwlock-rt.c +++ b/kernel/locking/rwlock-rt.c @@ -270,6 +270,7 @@ int __lockfunc rt_read_trylock(rwlock_t *rwlock) ret = __read_rt_trylock(rwlock); if (ret) { rwlock_acquire_read(&rwlock->dep_map, 0, 1, _RET_IP_); + rcu_read_lock(); migrate_disable(); } return ret; @@ -283,6 +284,7 @@ int __lockfunc rt_write_trylock(rwlock_t *rwlock) ret = __write_rt_trylock(rwlock); if (ret) { rwlock_acquire(&rwlock->dep_map, 0, 1, _RET_IP_); + rcu_read_lock(); migrate_disable(); } return ret; @@ -293,6 +295,7 @@ void __lockfunc rt_read_lock(rwlock_t *rwlock) { rwlock_acquire_read(&rwlock->dep_map, 0, 0, _RET_IP_); __read_rt_lock(rwlock); + rcu_read_lock(); migrate_disable(); } EXPORT_SYMBOL(rt_read_lock); @@ -301,6 +304,7 @@ void __lockfunc rt_write_lock(rwlock_t *rwlock) { rwlock_acquire(&rwlock->dep_map, 0, 0, _RET_IP_); __write_rt_lock(rwlock); + rcu_read_lock(); migrate_disable(); } EXPORT_SYMBOL(rt_write_lock); @@ -309,6 +313,7 @@ void __lockfunc rt_read_unlock(rwlock_t *rwlock) { rwlock_release(&rwlock->dep_map, _RET_IP_); migrate_enable(); + rcu_read_unlock(); __read_rt_unlock(rwlock); } EXPORT_SYMBOL(rt_read_unlock); @@ -317,6 +322,7 @@ void __lockfunc rt_write_unlock(rwlock_t *rwlock) { rwlock_release(&rwlock->dep_map, _RET_IP_); migrate_enable(); + rcu_read_unlock(); __write_rt_unlock(rwlock); } EXPORT_SYMBOL(rt_write_unlock); diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 6827f72c8179baea8362cd0618d5391db7c0eb4f..873b0bba53472141ae4fc8c138d8085b845f25fd 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2593,6 +2593,15 @@ enum print_line_t trace_handle_return(struct trace_seq *s) } EXPORT_SYMBOL_GPL(trace_handle_return); +static unsigned short migration_disable_value(void) +{ +#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT) + return current->migration_disabled; +#else + return 0; +#endif +} + unsigned int tracing_gen_ctx_irq_test(unsigned int irqs_status) { unsigned int trace_flags = irqs_status; @@ -2611,7 +2620,8 @@ unsigned int tracing_gen_ctx_irq_test(unsigned int irqs_status) trace_flags |= TRACE_FLAG_NEED_RESCHED; if (test_preempt_need_resched()) trace_flags |= TRACE_FLAG_PREEMPT_RESCHED; - return (trace_flags << 16) | (pc & 0xff); + return (trace_flags << 16) | (pc & 0xff) | + (migration_disable_value() & 0xff) << 8; } struct ring_buffer_event * @@ -3812,9 +3822,10 @@ static void print_lat_help_header(struct seq_file *m) "# | / _----=> need-resched \n" "# || / _---=> hardirq/softirq \n" "# ||| / _--=> preempt-depth \n" - "# |||| / delay \n" - "# cmd pid ||||| time | caller \n" - "# \\ / ||||| \\ | / \n"); + "# |||| / _-=> migrate-disable \n" + "# ||||| / delay \n" + "# cmd pid |||||| time | caller \n" + "# \\ / |||||| \\ | / \n"); } static void print_event_info(struct array_buffer *buf, struct seq_file *m) @@ -3852,9 +3863,10 @@ static void print_func_help_header_irq(struct array_buffer *buf, struct seq_file seq_printf(m, "# %.*s / _----=> need-resched\n", prec, space); seq_printf(m, "# %.*s| / _---=> hardirq/softirq\n", prec, space); seq_printf(m, "# %.*s|| / _--=> preempt-depth\n", prec, space); - seq_printf(m, "# %.*s||| / delay\n", prec, space); - seq_printf(m, "# TASK-PID %.*s CPU# |||| TIMESTAMP FUNCTION\n", prec, " TGID "); - seq_printf(m, "# | | %.*s | |||| | |\n", prec, " | "); + seq_printf(m, "# %.*s||| / _-=> migrate-disable\n", prec, space); + seq_printf(m, "# %.*s|||| / delay\n", prec, space); + seq_printf(m, "# TASK-PID %.*s CPU# ||||| TIMESTAMP FUNCTION\n", prec, " TGID "); + seq_printf(m, "# | | %.*s | ||||| | |\n", prec, " | "); } void diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 065ba69bde5efe305fb2f171c4c8066f7903acb1..cc8ce5d95e76579e0b2de4bf6902c343e04d354e 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -183,6 +183,7 @@ static int trace_define_common_fields(void) __common_field(unsigned char, flags); __common_field(unsigned char, preempt_count); __common_field(int, pid); + __common_field(unsigned char, migrate_disable); return ret; } diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 7042544c5bde1d55b0afa0f7643b43bd125b395a..edc9e7c071701d74d39815c9738f33d28b50fd3e 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -487,6 +487,11 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) else trace_seq_putc(s, '.'); + if (entry->migrate_disable) + trace_seq_printf(s, "%x", entry->migrate_disable); + else + trace_seq_putc(s, '.'); + return !trace_seq_has_overflowed(s); }