Linux 3.10.105-rt120-rc1
Subsystems (7)
cover Linux 3.10.105-rt120-rc1
Dear RT Folks,
This is the RT stable review cycle of patch 3.10.105-rt120-rc1.
Please scream at me if I messed something up. Please test the patches too.
The -rc release will be uploaded to kernel.org and will be deleted when the final release is out. This is just a review release (or release candidate).
The pre-releases will not be pushed to the git repository, only the final release is.
If all goes well, this patch will be converted to the next main release on 3/10/2017.
Enjoy,
-- Steve
To build 3.10.105-rt120-rc1 directly, the following patches should be applied:
http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.tar.xz
http://www.kernel.org/pub/linux/kernel/v3.x/patch-3.10.105.xz
http://www.kernel.org/pub/linux/kernel/projects/rt/3.10/patch-3.10.105-rt120-rc1.patch.xz
You can also build from 3.10.105-rt119 by applying the incremental patch:
http://www.kernel.org/pub/linux/kernel/projects/rt/3.10/incr/patch-3.10.105-rt119-rt120-rc1.patch.xz
Changes from 3.10.105-rt119:
---
Dan Murphy (1):
lockdep: Fix compilation error for !CONFIG_MODULES and !CONFIG_SMP
John Ogness (1):
x86/mm/cpa: avoid wbinvd() for PREEMPT
Sebastian Andrzej Siewior (3):
radix-tree: use local locks
rt: Drop mutex_disable() on !DEBUG configs and the GPL suffix from export symbol
rt: Drop the removal of _GPL from rt_mutex_destroy()'s EXPORT_SYMBOL
Steven Rostedt (VMware) (1):
Linux 3.10.105-rt120-rc1
Thomas Gleixner (1):
lockdep: Handle statically initialized PER_CPU locks proper
----
arch/x86/mm/pageattr.c | 8 ++++++++ include/linux/module.h | 6 ++++++ include/linux/mutex_rt.h | 5 +++++ include/linux/percpu.h | 1 + include/linux/radix-tree.h | 10 +--------- kernel/lockdep.c | 32 +++++++++++++++++++++++--------- kernel/module.c | 36 ++++++++++++++++++++++++------------ lib/radix-tree.c | 21 +++++++++++++-------- localversion-rt | 2 +- mm/percpu.c | 37 +++++++++++++++++++++++-------------- 10 files changed, 105 insertions(+), 53 deletions(-)
PATCH 1/7 radix-tree: use local locks
3.10.105-rt120-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
The preload functionality uses per-CPU variables and preempt-disable to ensure that it does not switch CPUs during its usage. This patch adds local_locks() instead preempt_disable() for the same purpose and to remain preemptible on -RT.
--- include/linux/radix-tree.h | 10 +--------- lib/radix-tree.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 17 deletions(-)
include/linux/radix-tree.h +1 -9
@@ -231,11 +231,8 @@ unsigned long radix_tree_next_hole(struct radix_tree_root *root,unsigned long radix_tree_prev_hole (struct radix_tree_root *root,unsigned long index,unsigned long max_scan); -#ifndef CONFIG_PREEMPT_RT_FULL int radix_tree_preload (gfp_t gfp_mask); -#else -static inline int radix_tree_preload (gfp_t gm) {return 0 ; } -#endif +void radix_tree_preload_end (void );void radix_tree_init (void ); void *radix_tree_tag_set(struct radix_tree_root *root,
@@ -259,11 +256,6 @@ unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root,int radix_tree_tagged (struct radix_tree_root *root,unsigned int tag);unsigned long radix_tree_locate_item (struct radix_tree_root *root,void *item); -static inline void radix_tree_preload_end (void ) -{ -preempt_enable_nort (); -} -/** * struct radix_tree_iter - radix tree iterator state *
lib/radix-tree.c +13 -8
@@ -32,7 +32,7 @@#include <linux/string.h> #include <linux/bitops.h> #include <linux/rcupdate.h> - +#include <linux/locallock.h> #ifdef __KERNEL__#define RADIX_TREE_MAP_SHIFT (CONFIG_BASE_SMALL ? 4 : 6)
@@ -93,6 +93,7 @@ struct radix_tree_preload {struct radix_tree_node *nodes[RADIX_TREE_PRELOAD_SIZE ]; }; static DEFINE_PER_CPU(struct radix_tree_preload, radix_tree_preloads) = { 0, }; +static DEFINE_LOCAL_IRQ_LOCK (radix_tree_preloads_lock);static inline void *ptr_to_indirect (void *ptr) {
@@ -215,13 +216,13 @@ radix_tree_node_alloc(struct radix_tree_root *root)* succeed in getting a node here (and never reach * kmem_cache_alloc) */ - rtp = &get_cpu_var (radix_tree_preloads); + rtp = &get_locked_var (radix_tree_preloads_lock, radix_tree_preloads);if (rtp->nr) { ret = rtp->nodes[rtp->nr -1 ]; rtp->nodes[rtp->nr -1 ] =NULL ; rtp->nr--; } -put_cpu_var (radix_tree_preloads); +put_locked_var (radix_tree_preloads_lock, radix_tree_preloads); }if (ret ==NULL ) ret =kmem_cache_alloc (radix_tree_node_cachep, gfp_mask);
@@ -256,7 +257,6 @@ radix_tree_node_free(struct radix_tree_node *node)call_rcu (&node->rcu_head, radix_tree_node_rcu_free); } -#ifndef CONFIG_PREEMPT_RT_FULL /* * Load up this CPU's radix_tree_node buffer with sufficient objects to * ensure that the addition of a single element in the tree cannot fail. On
@@ -272,14 +272,14 @@ int radix_tree_preload(gfp_t gfp_mask)struct radix_tree_node *node;int ret = -ENOMEM ; -preempt_disable (); +local_lock (radix_tree_preloads_lock); rtp = &__get_cpu_var (radix_tree_preloads);while (rtp->nr <ARRAY_SIZE (rtp->nodes)) { -preempt_enable (); +local_unlock (radix_tree_preloads_lock); node =kmem_cache_alloc (radix_tree_node_cachep, gfp_mask);if (node ==NULL ) goto out; -preempt_disable (); +local_lock (radix_tree_preloads_lock); rtp = &__get_cpu_var (radix_tree_preloads);if (rtp->nr <ARRAY_SIZE (rtp->nodes)) rtp->nodes[rtp->nr++] = node;
@@ -291,7 +291,12 @@ out:return ret; }EXPORT_SYMBOL (radix_tree_preload); -#endif + +void radix_tree_preload_end (void ) +{ +local_unlock (radix_tree_preloads_lock); +} +EXPORT_SYMBOL (radix_tree_preload_end);/* * Return the maximum key which can be store into a
Signature · 1 line
2.10.2
PATCH 2/7 x86/mm/cpa: avoid wbinvd() for PREEMPT
In reply to Steven Rostedt3.10.105-rt120-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
Although wbinvd() is faster than flushing many individual pages, it blocks the memory bus for "long" periods of time (>100us), thus directly causing unusually large latencies on all CPUs, regardless of any CPU isolation features that may be active.
For 1024 pages, flushing those pages individually can take up to 2200us, but the task remains fully preemptible during that time.
--- arch/x86/mm/pageattr.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/mm/pageattr.c +8 -0
@@ -210,7 +210,15 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache, int in_flags, struct page **pages) {unsigned int i, level; +#ifdef CONFIG_PREEMPT +/* +* Avoid wbinvd() because it causes latencies on all CPUs, +* regardless of any CPU isolation that may be in effect. +*/ +unsigned long do_wbinvd =0 ; +#else unsigned long do_wbinvd = cache && numpages >=1024 ;/* 4M threshold */ +#endif BUG_ON (irqs_disabled ());
Signature · 1 line
2.10.2
PATCH 3/7 rt: Drop mutex_disable() on !DEBUG configs and the GPL suffix from export symbol
In reply to Steven Rostedt3.10.105-rt120-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
Alex Goins reported that mutex_destroy() on RT will force a GPL only symbol which won't link and therefore fail on a non-GPL kernel module. This does not happen on !RT and is a regression on RT which we would like to avoid.
I try here the easy thing and to not use rt_mutex_destroy() if CONFIG_DEBUG_MUTEXES is not enabled. This will still break for the DEBUG configs so instead of adding a wrapper around rt_mutex_destroy() (which we have for rt_mutex_lock() for instance) I am simply dropping the GPL part from the export.
--- include/linux/mutex_rt.h | 5 +++++ kernel/rtmutex.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-)
include/linux/mutex_rt.h +5 -0
@@ -43,7 +43,12 @@ extern void __lockfunc _mutex_unlock(struct mutex *lock);#define mutex_lock_killable (l) _mutex_lock_killable(l)#define mutex_trylock (l) _mutex_trylock(l)#define mutex_unlock (l) _mutex_unlock(l) + +#ifdef CONFIG_DEBUG_MUTEXES #define mutex_destroy (l) rt_mutex_destroy(&(l)->lock) +#else +static inline void mutex_destroy (struct mutex *lock) {} +#endif #ifdef CONFIG_DEBUG_LOCK_ALLOC # define mutex_lock_nested (l, s) _mutex_lock_nested(l, s)
kernel/rtmutex.c +1 -2
@@ -1789,8 +1789,7 @@ void rt_mutex_destroy(struct rt_mutex *lock) lock->magic =NULL ;#endif } - -EXPORT_SYMBOL_GPL (rt_mutex_destroy); +EXPORT_SYMBOL (rt_mutex_destroy);/** * __rt_mutex_init - initialize the rt lock
Signature · 1 line
2.10.2
PATCH 4/7 lockdep: Handle statically initialized PER_CPU locks proper
In reply to Steven Rostedt3.10.105-rt120-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
If a PER_CPU struct which contains a spin_lock is statically initialized via:
DEFINE_PER_CPU(struct foo, bla) = {
.lock = __SPIN_LOCK_UNLOCKED(bla.lock)
};
then lockdep assigns a seperate key to each lock because the logic for assigning a key to statically initialized locks is to use the address as the key. With per CPU locks the address is obvioulsy different on each CPU.
That's wrong, because all locks should have the same key.
To solve this the following modifications are required:
1) Extend the is_kernel/module_percpu_addr() functions to hand back the canonical address of the per CPU address, i.e. the per CPU address minus the per CPU offset.
2) Check the lock address with these functions and if the per CPU check matches use the returned canonical address as the lock key, so all per CPU locks have the same key.
3) Move the static_obj(key) check into look_up_lock_class() so this check can be avoided for statically initialized per CPU locks. That's required because the canonical address fails the static_obj(key) check for obvious reasons.
--- include/linux/module.h | 1 + include/linux/percpu.h | 1 + kernel/lockdep.c | 32 +++++++++++++++++++++++--------- kernel/module.c | 31 +++++++++++++++++++------------ mm/percpu.c | 37 +++++++++++++++++++++++-------------- 5 files changed, 67 insertions(+), 35 deletions(-)
include/linux/module.h +1 -0
@@ -394,6 +394,7 @@ static inline int module_is_live(struct module *mod)struct module *__module_text_address (unsigned long addr);struct module *__module_address (unsigned long addr);bool is_module_address (unsigned long addr); +bool __is_module_percpu_address (unsigned long addr,unsigned long *can_addr);bool is_module_percpu_address (unsigned long addr);bool is_module_text_address (unsigned long addr);
include/linux/percpu.h +1 -0
@@ -176,6 +176,7 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size,#endif extern void __percpu *__alloc_reserved_percpu (size_t size,size_t align); +extern bool __is_kernel_percpu_address (unsigned long addr,unsigned long *can_addr);extern bool is_kernel_percpu_address (unsigned long addr);#if !defined(CONFIG_SMP ) || !defined(CONFIG_HAVE_SETUP_PER_CPU_AREA )
kernel/lockdep.c +23 -9
@@ -650,6 +650,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)struct lockdep_subclass_key *key;struct list_head *hash_head;struct lock_class *class; +bool is_static = false;#ifdef CONFIG_DEBUG_LOCKDEP /*
@@ -677,10 +678,23 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)/* * Static locks do not have their class-keys yet - for them the key -* is the lock object itself: +* is the lock object itself. If the lock is in the per cpu area, +* the canonical address of the lock (per cpu offset removed) is +* used. */ -if (unlikely (!lock->key)) - lock->key = (void *)lock; +if (unlikely (!lock->key)) { +unsigned long can_addr, addr = (unsigned long )lock; + +if (__is_kernel_percpu_address (addr, &can_addr)) + lock->key = (void *)can_addr; +else if (__is_module_percpu_address (addr, &can_addr)) + lock->key = (void *)can_addr; +else if (static_obj (lock)) + lock->key = (void *)lock; +else +return ERR_PTR (-EINVAL ); + is_static = true; + }/* * NOTE: the class-key must be unique. For dynamic locks, a static
@@ -710,7 +724,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) } } -return NULL ; +return is_static ||static_obj (lock->key) ?NULL :ERR_PTR (-EINVAL ); }/*
@@ -727,13 +741,13 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)unsigned long flags; class =look_up_lock_class (lock, subclass); -if (likely (class)) +if (likely (!IS_ERR_OR_NULL (class))) goto out_set_class_cache;/* * Debug-check: all keys must be persistent! -*/ -if (!static_obj (lock->key)) { +*/ +if (IS_ERR (class)) {debug_locks_off ();printk ("INFO: trying to register non-static key.\n" );printk ("the code is fine but needs lockdep annotation.\n" );
@@ -3275,7 +3289,7 @@ static int match_held_lock(struct held_lock *hlock, struct lockdep_map *lock)* Clearly if the lock hasn't been acquired _ever_, we're not * holding it either, so report failure. */ -if (!class) +if (IS_ERR_OR_NULL (class))return 0 ;/*
@@ -3937,7 +3951,7 @@ void lockdep_reset_lock(struct lockdep_map *lock)* If the class exists we look it up and zap it: */ class =look_up_lock_class (lock, j); -if (class) +if (!IS_ERR_OR_NULL (class))zap_class (class); }/*
kernel/module.c +19 -12
@@ -524,16 +524,7 @@ static void percpu_modcopy(struct module *mod,memcpy (per_cpu_ptr (mod->percpu, cpu), from, size); } -/** -* is_module_percpu_address - test whether address is from module static percpu -* @addr: address to test -* -* Test whether @addr belongs to module static percpu area. -* -* RETURNS: -* %true if @addr is from module static percpu area -*/ -bool is_module_percpu_address (unsigned long addr) +bool __is_module_percpu_address (unsigned long addr,unsigned long *can_addr) {struct module *mod;unsigned int cpu;
@@ -547,9 +538,11 @@ bool is_module_percpu_address(unsigned long addr)continue ;for_each_possible_cpu (cpu) {void *start =per_cpu_ptr (mod->percpu, cpu); +void *va = (void *)addr; -if ((void *)addr >= start && - (void *)addr < start + mod->percpu_size) { +if (va >= start && va < start + mod->percpu_size) { +if (can_addr) + *can_addr = (unsigned long ) (va - start);preempt_enable ();return true; }
@@ -560,6 +553,20 @@ bool is_module_percpu_address(unsigned long addr) return false; } +/** +* is_module_percpu_address - test whether address is from module static percpu +* @addr: address to test +* +* Test whether @addr belongs to module static percpu area. +* +* RETURNS: +* %true if @addr is from module static percpu area +*/ +bool is_module_percpu_address (unsigned long addr) +{ +return __is_module_percpu_address (addr,NULL ); +} +#else /* ... !CONFIG_SMP */ static inline void __percpu *mod_percpu (struct module *mod)
mm/percpu.c +23 -14
@@ -946,18 +946,7 @@ void free_percpu(void __percpu *ptr) }EXPORT_SYMBOL_GPL (free_percpu); -/** -* is_kernel_percpu_address - test whether address is from static percpu area -* @addr: address to test -* -* Test whether @addr belongs to in-kernel static percpu area. Module -* static percpu areas are not considered. For those, use -* is_module_percpu_address(). -* -* RETURNS: -* %true if @addr is from in-kernel static percpu area, %false otherwise. -*/ -bool is_kernel_percpu_address (unsigned long addr) +bool __is_kernel_percpu_address (unsigned long addr,unsigned long *can_addr) {#ifdef CONFIG_SMP const size_t static_size = __per_cpu_end - __per_cpu_start;
@@ -966,16 +955,36 @@ bool is_kernel_percpu_address(unsigned long addr)for_each_possible_cpu (cpu) {void *start =per_cpu_ptr (base, cpu); +void *va = (void *)addr; -if ((void *)addr >= start && (void *)addr < start + static_size) +if (va >= start && va < start + static_size) { +if (can_addr) + *can_addr = (unsigned long ) (va - start);return true; - } + } + }#endif /* on UP, can't distinguish from other static vars, always false */ return false; }/** +* is_kernel_percpu_address - test whether address is from static percpu area +* @addr: address to test +* +* Test whether @addr belongs to in-kernel static percpu area. Module +* static percpu areas are not considered. For those, use +* is_module_percpu_address(). +* +* RETURNS: +* %true if @addr is from in-kernel static percpu area, %false otherwise. +*/ +bool is_kernel_percpu_address (unsigned long addr) +{ +return __is_kernel_percpu_address (addr,NULL ); +} + +/** * per_cpu_ptr_to_phys - convert translated percpu address to physical address * @addr: the address to be converted to physical address *
Signature · 1 line
2.10.2
PATCH 5/7 rt: Drop the removal of _GPL from rt_mutex_destroy()s EXPORT_SYMBOL
In reply to Steven Rostedt3.10.105-rt120-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
What we have now should be enough, the EXPORT_SYMBOL statement for rt_mutex_destroy() is not required.
--- kernel/rtmutex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/rtmutex.c +2 -1
@@ -1789,7 +1789,8 @@ void rt_mutex_destroy(struct rt_mutex *lock) lock->magic =NULL ;#endif } -EXPORT_SYMBOL (rt_mutex_destroy); + +EXPORT_SYMBOL_GPL (rt_mutex_destroy);/** * __rt_mutex_init - initialize the rt lock
Signature · 1 line
2.10.2
PATCH 6/7 lockdep: Fix compilation error for !CONFIG_MODULES and !CONFIG_SMP
In reply to Steven Rostedt3.10.105-rt120-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Dan Murphy <[email protected]>
When CONFIG_MODULES is not set then it fails to compile in lockdep:
|kernel/locking/lockdep.c: In function 'look_up_lock_class': |kernel/locking/lockdep.c:684:12: error: implicit declaration of function | '__is_module_percpu_address' [-Werror=implicit-function-declaration]
If CONFIG_MODULES is set but CONFIG_SMP is not, then it compiles but fails link at the end:
|kernel/locking/lockdep.c:684: undefined reference to __is_module_percpu_address' |kernel/built-in.o:(.debug_addr+0x1e674): undefined reference to __is_module_percpu_address'
This patch adds the function for both cases.
--- include/linux/module.h | 5 +++++ kernel/module.c | 5 +++++ 2 files changed, 10 insertions(+)
include/linux/module.h +5 -0
@@ -540,6 +540,11 @@ static inline bool is_module_percpu_address(unsigned long addr)return false; } +static inline bool __is_module_percpu_address (unsigned long addr,unsigned long *can_addr) +{ +return false; +} +static inline bool is_module_text_address (unsigned long addr) {return false;
kernel/module.c +5 -0
@@ -596,6 +596,11 @@ bool is_module_percpu_address(unsigned long addr) return false; } +bool __is_module_percpu_address (unsigned long addr,unsigned long *can_addr) +{ +return false; +} +#endif /* CONFIG_SMP */ #define MODINFO_ATTR (field) \
Signature · 1 line
2.10.2
PATCH 7/7 Linux 3.10.105-rt120-rc1
In reply to Steven Rostedt3.10.105-rt120-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (VMware)" <[email protected]>
--- localversion-rt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
localversion-rt +1 -1
@@ -1 +1 @@ --rt119 +-rt120-rc1
Signature · 1 line
2.10.2