Linux 3.12.44-rt62-rc1
Subsystems (6)
cover Linux 3.12.44-rt62-rc1
Dear RT Folks,
This is the RT stable review cycle of patch 3.12.44-rt62-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 8/10/2015.
Enjoy,
-- Steve
To build 3.12.44-rt62-rc1 directly, the following patches should be applied:
http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.12.tar.xz
http://www.kernel.org/pub/linux/kernel/v3.x/patch-3.12.44.xz
http://www.kernel.org/pub/linux/kernel/projects/rt/3.12/patch-3.12.44-rt62-rc1.patch.xz
You can also build from 3.12.44-rt61 by applying the incremental patch:
http://www.kernel.org/pub/linux/kernel/projects/rt/3.12/incr/patch-3.12.44-rt61-rt62-rc1.patch.xz
Changes from 3.12.44-rt61:
---
Bogdan Purcareata (1):
powerpc/kvm: Disable in-kernel MPIC emulation for PREEMPT_RT_FULL
Frederic Weisbecker (1):
x86-Tell-irq-work-about-self-IPI-support-3.14
Sebastian Andrzej Siewior (1):
Revert "slub: delay ctor until the object is requested"
Steven Rostedt (1):
xfs: Disable percpu SB on PREEMPT_RT_FULL
Steven Rostedt (Red Hat) (1):
Linux 3.12.44-rt62-rc1
Thomas Gleixner (1):
mm/slub: move slab initialization into irq enabled region
----
arch/powerpc/kvm/Kconfig | 1 + arch/x86/include/asm/Kbuild | 1 - arch/x86/include/asm/irq_work.h | 11 ++++++ arch/x86/kernel/irq_work.c | 2 +- fs/xfs/xfs_linux.h | 2 +- localversion-rt | 2 +- mm/slub.c | 86 +++++++++++++++++++---------------------- 7 files changed, 54 insertions(+), 51 deletions(-) create mode 100644 arch/x86/include/asm/irq_work.h
PATCH 1/6 Revert "slub: delay ctor until the object is requested"
3.12.44-rt62-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
This approach is broken with SLAB_DESTROY_BY_RCU allocations. Reported by Steven Rostedt and Koehrer Mathias.
--- mm/slub.c | 6 ------ 1 file changed, 6 deletions(-)
mm/slub.c +0 -6
@@ -1363,10 +1363,8 @@ static void setup_object(struct kmem_cache *s, struct page *page, void *object) {setup_object_debug (s, page, object); -#ifndef CONFIG_PREEMPT_RT_FULL if (unlikely (s->ctor)) s->ctor (object); -#endif }static struct page *new_slab (struct kmem_cache *s,gfp_t flags,int node)
@@ -2470,10 +2468,6 @@ redo:if (unlikely (gfpflags & __GFP_ZERO) && object)memset (object,0 , s->object_size); -#ifdef CONFIG_PREEMPT_RT_FULL -if (unlikely (s->ctor) && object) - s->ctor (object); -#endif slab_post_alloc_hook (s, gfpflags, object);
Signature · 1 line
2.1.4
PATCH 2/6 mm/slub: move slab initialization into irq enabled region
In reply to Steven Rostedt3.12.44-rt62-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
Initializing a new slab can introduce rather large latencies because most of the initialization runs always with interrupts disabled.
There is no point in doing so. The newly allocated slab is not visible yet, so there is no reason to protect it against concurrent alloc/free.
Move the expensive parts of the initialization into allocate_slab(), so for all allocations with GFP_WAIT set, interrupts are enabled.
--- mm/slub.c | 80 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 39 insertions(+), 41 deletions(-)
mm/slub.c +39 -41
@@ -1276,6 +1276,14 @@ struct slub_free_list { }; static DEFINE_PER_CPU(struct slub_free_list, slub_free_list); +static void setup_object (struct kmem_cache *s,struct page *page, +void *object) +{ +setup_object_debug (s, page, object); +if (unlikely (s->ctor)) + s->ctor (object); +} +/* * Slab allocation and freeing */
@@ -1298,6 +1306,8 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)struct kmem_cache_order_objects oo = s->oo;gfp_t alloc_gfp;bool enableirqs; +void *start, *last, *p; +int idx, order; flags &= gfp_allowed_mask;
@@ -1324,13 +1334,13 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)* Try a lower order alloc if possible */ page =alloc_slab_page (flags, node, oo); - -if (page) -stat (s,ORDER_FALLBACK ); +if (unlikely (!page)) + goto out; +stat (s,ORDER_FALLBACK ); } -if (kmemcheck_enabled && page - && !(s->flags & (SLAB_NOTRACK |DEBUG_DEFAULT_FLAGS ))) { +if (kmemcheck_enabled && + !(s->flags & (SLAB_NOTRACK |DEBUG_DEFAULT_FLAGS ))) {int pages =1 <<oo_order (oo);kmemcheck_alloc_shadow (page,oo_order (oo), flags, node);
@@ -1345,45 +1355,9 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)kmemcheck_mark_unallocated_pages (page, pages); } -if (enableirqs) -local_irq_disable (); -if (!page) -return NULL ; - page->objects =oo_objects (oo); -mod_zone_page_state (page_zone (page), - (s->flags &SLAB_RECLAIM_ACCOUNT ) ? -NR_SLAB_RECLAIMABLE :NR_SLAB_UNRECLAIMABLE , -1 <<oo_order (oo)); - -return page; -} - -static void setup_object (struct kmem_cache *s,struct page *page, -void *object) -{ -setup_object_debug (s, page, object); -if (unlikely (s->ctor)) - s->ctor (object); -} - -static struct page *new_slab (struct kmem_cache *s,gfp_t flags,int node) -{ -struct page *page; -void *start; -void *last; -void *p; -int order; - -BUG_ON (flags &GFP_SLAB_BUG_MASK ); - - page =allocate_slab (s, - flags & (GFP_RECLAIM_MASK |GFP_CONSTRAINT_MASK ), node); -if (!page) - goto out; order =compound_order (page); -inc_slabs_node (s,page_to_nid (page), page->objects);memcg_bind_pages (s, order); page->slab_cache = s;__SetPageSlab (page);
@@ -1407,10 +1381,34 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) page->freelist = start; page->inuse = page->objects; page->frozen =1 ; + out: +if (enableirqs) +local_irq_disable (); +if (!page) +return NULL ; + +mod_zone_page_state (page_zone (page), + (s->flags &SLAB_RECLAIM_ACCOUNT ) ? +NR_SLAB_RECLAIMABLE :NR_SLAB_UNRECLAIMABLE , +1 <<oo_order (oo)); + +inc_slabs_node (s,page_to_nid (page), page->objects); +return page; } +static struct page *new_slab (struct kmem_cache *s,gfp_t flags,int node) +{ +if (unlikely (flags &GFP_SLAB_BUG_MASK )) { +pr_emerg ("gfp: %u\n" , flags &GFP_SLAB_BUG_MASK ); +BUG (); + } + +return allocate_slab (s, + flags & (GFP_RECLAIM_MASK |GFP_CONSTRAINT_MASK ), node); +} +static void __free_slab (struct kmem_cache *s,struct page *page) {int order =compound_order (page);
Signature · 1 line
2.1.4
PATCH 3/6 x86-Tell-irq-work-about-self-IPI-support-3.14
In reply to Steven Rostedt3.12.44-rt62-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
commit 3010279f0fc36f0388872203e63ca49912f648fd
Author: Frederic Weisbecker <[email protected]> Date: Sat Aug 16 18:47:15 2014 +0200
x86: Tell irq work about self IPI support
x86 supports irq work self-IPIs when local apic is available. This is partly known on runtime so lets implement arch_irq_work_has_interrupt() accordingly.
This should be safely called after setup_arch().
--- arch/x86/include/asm/Kbuild | 1 - arch/x86/include/asm/irq_work.h | 11 +++++++++++ arch/x86/kernel/irq_work.c | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 arch/x86/include/asm/irq_work.h
arch/x86/include/asm/Kbuild +0 -1
@@ -5,4 +5,3 @@ genhdr-y += unistd_64.h genhdr-y += unistd_x32.h generic-y += clkdev.h -generic-y += irq_work.h
arch/x86/include/asm/irq_work.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef _ASM_IRQ_WORK_H +#define _ASM_IRQ_WORK_H + +#include <asm/processor.h> + +static inline bool arch_irq_work_has_interrupt (void ) +{ +return cpu_has_apic; +} + +#endif /* _ASM_IRQ_WORK_H */
arch/x86/kernel/irq_work.c +1 -1
@@ -41,7 +41,7 @@ __visible void smp_trace_irq_work_interrupt(struct pt_regs *regs)void arch_irq_work_raise (void ) {#ifdef CONFIG_X86_LOCAL_APIC -if (!cpu_has_apic) +if (!arch_irq_work_has_interrupt ())return ; apic->send_IPI_self (IRQ_WORK_VECTOR );
Signature · 1 line
2.1.4
PATCH 4/6 xfs: Disable percpu SB on PREEMPT_RT_FULL
In reply to Steven Rostedt3.12.44-rt62-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
Running a test on a large CPU count box with xfs, I hit a live lock with the following backtraces on several CPUs:
Call Trace: [<ffffffff812c34f8>] __const_udelay+0x28/0x30 [<ffffffffa033ab9a>] xfs_icsb_lock_cntr+0x2a/0x40 [xfs] [<ffffffffa033c871>] xfs_icsb_modify_counters+0x71/0x280 [xfs] [<ffffffffa03413e1>] xfs_trans_reserve+0x171/0x210 [xfs] [<ffffffffa0378cfd>] xfs_create+0x24d/0x6f0 [xfs] [<ffffffff8124c8eb>] ? avc_has_perm_flags+0xfb/0x1e0 [<ffffffffa0336eeb>] xfs_vn_mknod+0xbb/0x1e0 [xfs] [<ffffffffa0337043>] xfs_vn_create+0x13/0x20 [xfs] [<ffffffff811b0edd>] vfs_create+0xcd/0x130 [<ffffffff811b21ef>] do_last+0xb8f/0x1240 [<ffffffff811b39b2>] path_openat+0xc2/0x490
Looking at the code I see it was stuck at:
STATIC void
xfs_icsb_lock_cntr(
xfs_icsb_cnts_t *icsbp)
{
while (test_and_set_bit(XFS_ICSB_FLAG_LOCK, &icsbp->icsb_flags)) {
ndelay(1000);
}
}In xfs_icsb_modify_counters() the code is fine. There's a preempt_disable() called when taking this bit spinlock and a preempt_enable() after it is released. The issue is that not all locations are protected by preempt_disable() when PREEMPT_RT is set. Namely the places that grab all CPU cntr locks.
STATIC void
xfs_icsb_lock_all_counters(
xfs_mount_t *mp)
{
xfs_icsb_cnts_t *cntp;
int i;
for_each_online_cpu(i) {
cntp = (xfs_icsb_cnts_t *)per_cpu_ptr(mp->m_sb_cnts, i);
xfs_icsb_lock_cntr(cntp);
}
}STATIC voidxfs_icsb_disable_counter()
{
[...]
xfs_icsb_lock_all_counters(mp);
[...]
xfs_icsb_unlock_all_counters(mp);
}STATIC voidxfs_icsb_balance_counter_locked()
{
[...]
xfs_icsb_disable_counter();
[...]
}STATIC void
xfs_icsb_balance_counter(
xfs_mount_t *mp,
xfs_sb_field_t fields,
int min_per_cpu)
{
spin_lock(&mp->m_sb_lock);
xfs_icsb_balance_counter_locked(mp, fields, min_per_cpu);
spin_unlock(&mp->m_sb_lock);
}Now, when PREEMPT_RT is not enabled, that spin_lock() disables preemption. But for PREEMPT_RT, it does not. Although with my test box I was not able to produce a task state of all tasks, but I'm assuming that some task called the xfs_icsb_lock_all_counters() and was preempted by an RT task and could not finish, causing all callers of that lock to block indefinitely.
Dave Chinner has stated that the scalability of that code will probably be negated by PREEMPT_RT, and that it is probably best to just disable the code in question. Also, this code has been rewritten in newer kernels.
--- fs/xfs/xfs_linux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_linux.h +1 -1
@@ -131,7 +131,7 @@ typedef __uint64_t __psunsigned_t;/* * Feature macros (disable/enable) */ -#ifdef CONFIG_SMP +#if defined(CONFIG_SMP ) && !defined(CONFIG_PREEMPT_RT_FULL )#define HAVE_PERCPU_SB /* per cpu superblock counters are a 2.6 feature */ #else #undef HAVE_PERCPU_SB/* per cpu superblock counters are a 2.6 feature */
Signature · 1 line
2.1.4
PATCH 5/6 powerpc/kvm: Disable in-kernel MPIC emulation for PREEMPT_RT_FULL
In reply to Steven Rostedt3.12.44-rt62-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Bogdan Purcareata <[email protected]>
While converting the openpic emulation code to use a raw_spinlock_t enables guests to run on RT, there's still a performance issue. For interrupts sent in directed delivery mode with a multiple CPU mask, the emulated openpic will loop through all of the VCPUs, and for each VCPUs, it call IRQ_check, which will loop through all the pending interrupts for that VCPU. This is done while holding the raw_lock, meaning that in all this time the interrupts and preemption are disabled on the host Linux. A malicious user app can max both these number and cause a DoS.
This temporary fix is sent for two reasons. First is so that users who want to use the in-kernel MPIC emulation are aware of the potential latencies, thus making sure that the hardware MPIC and their usage scenario does not involve interrupts sent in directed delivery mode, and the number of possible pending interrupts is kept small. Secondly, this should incentivize the development of a proper openpic emulation that would be better suited for RT.
--- arch/powerpc/kvm/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kvm/Kconfig +1 -0
@@ -155,6 +155,7 @@ config KVM_E500MC config KVM_MPIC bool "KVM in-kernel MPIC emulation" depends on KVM && E500 + depends on !PREEMPT_RT_FULL select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQ_ROUTING select HAVE_KVM_MSI
Signature · 1 line
2.1.4
PATCH 6/6 Linux 3.12.44-rt62-rc1
In reply to Steven Rostedt3.12.44-rt62-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
--- localversion-rt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
localversion-rt +1 -1
@@ -1 +1 @@ --rt61 +-rt62-rc1
Signature · 1 line
2.1.4