Linux 5.4.44-rt27-rc1
Subsystems (6)
Steven Rostedt
reviewercover Linux 5.4.44-rt27-rc1
Dear RT Folks,
This is the RT stable review cycle of patch 5.4.44-rt27-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 6/9/2020.
Enjoy,
-- Steve
To build 5.4.44-rt27-rc1 directly, the following patches should be applied:
http://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.tar.xz
http://www.kernel.org/pub/linux/kernel/v5.x/patch-5.4.44.xz
http://www.kernel.org/pub/linux/kernel/projects/rt/5.4/patch-5.4.44-rt27-rc1.patch.xz
You can also build from 5.4.44-rt26 by applying the incremental patch:
http://www.kernel.org/pub/linux/kernel/projects/rt/5.4/incr/patch-5.4.44-rt26-rt27-rc1.patch.xz
Changes from 5.4.44-rt26:
---
John Ogness (1):
printk: console must not schedule for drivers
Kevin Hao (1):
mm: slub: Always flush the delayed empty slubs in flush_all()
Liwei Song (1):
mm: Don't warn about atomic memory allocations during suspend
Sebastian Andrzej Siewior (3):
fs/dcache: Include swait.h header
Revert "rt: Improve the serial console PASS_LIMIT" mm/zswap: Use local lock to protect per-CPU data
Steven Rostedt (VMware) (1):
Linux 5.4.44-rt27-rc1
汪勇10269566 (1):
printk: Force a line break on pr_cont(" ")
----
drivers/tty/serial/8250/8250_core.c | 11 +---------- fs/proc/base.c | 1 + kernel/printk/printk.c | 2 ++ localversion-rt | 2 +- mm/slub.c | 11 +++++------ mm/zswap.c | 21 ++++++++++++--------- 6 files changed, 22 insertions(+), 26 deletions(-)
Steven Rostedt
reviewerPATCH 1/8 printk: console must not schedule for drivers
5.4.44-rt27-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
Even though the printk kthread is always preemptible, it is still not allowed to call cond_resched() from within console drivers. The task may become non-preemptible in the console driver call chain. For example, vt_console_print() takes a spinlock and then can call into fbcon_redraw(), which can conditionally invoke cond_resched():
|BUG: sleeping function called from invalid context at kernel/printk/printk.c:2322 |in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 177, name: printk |CPU: 0 PID: 177 Comm: printk Not tainted 5.6.2-00011-ga536059557f1d9 #1 |Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 |Call Trace: | dump_stack+0x66/0x8b | ___might_sleep+0x102/0x120 | console_conditional_schedule+0x24/0x30 | fbcon_redraw+0x96/0x1c0 | fbcon_scroll+0x556/0xd70 | con_scroll+0x147/0x1e0 | lf+0x9e/0xb0 | vt_console_print+0x253/0x3d0 | printk_kthread_func+0x1d5/0x3b0
Disable cond_resched() for the call into the console drivers.
--- kernel/printk/printk.c | 1 + 1 file changed, 1 insertion(+)
kernel/printk/printk.c +1 -0
@@ -2746,6 +2746,7 @@ static int printk_kthread_func(void *data) &len, printk_time);console_lock (); + console_may_schedule =0 ;call_console_drivers (master_seq, ext_text, ext_len, text, len, msg->level, msg->facility);if (len >0 || ext_len >0 )
Signature · 1 line
2.26.2
Steven Rostedt
reviewerPATCH 2/8 fs/dcache: Include swait.h header
In reply to Steven Rostedt5.4.44-rt27-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
Include the swait.h header so it compiles even if not all patches are applied.
--- fs/proc/base.c | 1 + 1 file changed, 1 insertion(+)
fs/proc/base.c +1 -0
@@ -95,6 +95,7 @@#include <linux/sched/stat.h> #include <linux/posix-timers.h> #include <trace/events/oom.h> +#include <linux/swait.h> #include "internal.h" #include "fd.h"
Signature · 1 line
2.26.2
Steven Rostedt
reviewerPATCH 3/8 Revert "rt: Improve the serial console PASS_LIMIT"
In reply to Steven Rostedt5.4.44-rt27-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
There is no need to loop for longer. The message of too much work was removed in commit
9d7c249a1ef9b ("serial: 8250: drop the printk from serial8250_interrupt()")--- drivers/tty/serial/8250/8250_core.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/tty/serial/8250/8250_core.c +1 -10
@@ -55,16 +55,7 @@ static struct uart_driver serial8250_reg;static unsigned int skip_txen_test;/* force skip of txen test at init time */ -/* -* On -rt we can have a more delays, and legitimately -* so - so don't drop work spuriously and spam the -* syslog: -*/ -#ifdef CONFIG_PREEMPT_RT -# define PASS_LIMIT 1000000 -#else -# define PASS_LIMIT 512 -#endif +#define PASS_LIMIT 512#include <asm/serial.h> /*
Signature · 1 line
2.26.2
Steven Rostedt
reviewerPATCH 4/8 mm: Dont warn about atomic memory allocations during suspend
In reply to Steven Rostedt5.4.44-rt27-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Liwei Song <[email protected]>
The ACPI code allocates larger amount of memory during resume. This triggers a warning because the allocation happens with disabled interrupts.
At this stage only one CPU is active so there should be no lock contention. If SLUB needs to call into the buddy allocator for more memory then it should not enable interrupts.
Limit the check to system state with more CPUs and scheduling and only enable interrupts in SLUB at this stage.
--- mm/slub.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
mm/slub.c +5 -3
@@ -1635,7 +1635,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) enableirqs = true;#ifdef CONFIG_PREEMPT_RT -if (system_state >SYSTEM_BOOTING ) +if (system_state >SYSTEM_BOOTING && system_state <SYSTEM_SUSPEND ) enableirqs = true;#endif if (enableirqs)
@@ -2751,7 +2751,8 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s,unsigned long tid;if (IS_ENABLED (CONFIG_PREEMPT_RT ) &&IS_ENABLED (CONFIG_DEBUG_ATOMIC_SLEEP )) -WARN_ON_ONCE (!preemptible () && system_state >=SYSTEM_SCHEDULING ); +WARN_ON_ONCE (!preemptible () && + (system_state >SYSTEM_BOOTING && system_state <SYSTEM_SUSPEND )); s =slab_pre_alloc_hook (s, gfpflags);if (!s)
@@ -3216,7 +3217,8 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size,int i;if (IS_ENABLED (CONFIG_PREEMPT_RT ) &&IS_ENABLED (CONFIG_DEBUG_ATOMIC_SLEEP )) -WARN_ON_ONCE (!preemptible () && system_state >=SYSTEM_SCHEDULING ); +WARN_ON_ONCE (!preemptible () && + (system_state >SYSTEM_BOOTING && system_state <SYSTEM_SUSPEND ));/* memcg and kmem_cache debug support */ s =slab_pre_alloc_hook (s, flags);
Signature · 1 line
2.26.2
Steven Rostedt
reviewerPATCH 5/8 mm: slub: Always flush the delayed empty slubs in flush_all()
In reply to Steven Rostedt5.4.44-rt27-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Kevin Hao <[email protected]>
After commit f0b231101c94 ("mm/SLUB: delay giving back empty slubs to IRQ enabled regions"), when the free_slab() is invoked with the IRQ disabled, the empty slubs are moved to a per-CPU list and will be freed after IRQ enabled later. But in the current codes, there is a check to see if there really has the cpu slub on a specific cpu before flushing the delayed empty slubs, this may cause a reference of already released kmem_cache in a scenario like below:
cpu 0 cpu 1
kmem_cache_destroy()
flush_all()
--->IPI flush_cpu_slab()
flush_slab()
deactivate_slab()
discard_slab()
free_slab()
c->page = NULL;
for_each_online_cpu(cpu)
if (!has_cpu_slab(1, s))
continue
this skip to flush the delayed
empty slub released by cpu1
kmem_cache_free(kmem_cache, s)
kmalloc()
__slab_alloc()
free_delayed()
__free_slab()
reference to released kmem_cache--- mm/slub.c | 3 --- 1 file changed, 3 deletions(-)
mm/slub.c +0 -3
@@ -2382,9 +2382,6 @@ static void flush_all(struct kmem_cache *s)for_each_online_cpu (cpu) {struct slub_free_list *f; -if (!has_cpu_slab (cpu, s)) -continue ; - f = &per_cpu (slub_free_list, cpu);raw_spin_lock_irq (&f->lock);list_splice_init (&f->list, &tofree);
Signature · 1 line
2.26.2
Steven Rostedt
reviewerPATCH 7/8 mm/zswap: Use local lock to protect per-CPU data
In reply to Steven Rostedt5.4.44-rt27-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
This is an incremental update of the zswap patch. Addtional spots were identified, which were lacking proper locking, during the rework of the patch for upstream.
The complete patch description is available as commit
79410590ae87e ("mm/zswap: Use local lock to protect per-CPU data")
--- mm/zswap.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
mm/zswap.c +12 -9
@@ -372,6 +372,8 @@ static struct zswap_entry *zswap_entry_find_get(struct rb_root *root,* per-cpu code **********************************/ static DEFINE_PER_CPU(u8 *, zswap_dstmem); +/* Used for zswap_dstmem and tfm */ +static DEFINE_LOCAL_IRQ_LOCK (zswap_cpu_lock);static int zswap_dstmem_prepare (unsigned int cpu) {
@@ -889,10 +891,11 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle) dlen =PAGE_SIZE ; src = (u8 *)zhdr +sizeof (struct zswap_header ); dst =kmap_atomic (page); - tfm = *get_cpu_ptr (entry->pool->tfm); +local_lock (zswap_cpu_lock); + tfm = *this_cpu_ptr (entry->pool->tfm); ret =crypto_comp_decompress (tfm, src, entry->length, dst, &dlen); -put_cpu_ptr (entry->pool->tfm); +local_unlock (zswap_cpu_lock);kunmap_atomic (dst);BUG_ON (ret);BUG_ON (dlen !=PAGE_SIZE );
@@ -981,8 +984,6 @@ static void zswap_fill_page(void *ptr, unsigned long value)memset_l (page, value,PAGE_SIZE /sizeof (unsigned long )); } -/* protect zswap_dstmem from concurrency */ -static DEFINE_LOCAL_IRQ_LOCK (zswap_dstmem_lock);/********************************* * frontswap hooks **********************************/
@@ -1060,7 +1061,8 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset, }/* compress */ - dst =get_locked_var (zswap_dstmem_lock, zswap_dstmem); +local_lock (zswap_cpu_lock); + dst = *this_cpu_ptr (&zswap_dstmem); tfm = *this_cpu_ptr (entry->pool->tfm); src =kmap_atomic (page); ret =crypto_comp_compress (tfm, src,PAGE_SIZE , dst, &dlen);
@@ -1088,7 +1090,7 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset,memcpy (buf, &zhdr, hlen);memcpy (buf + hlen, dst, dlen);zpool_unmap_handle (entry->pool->zpool, handle); -put_locked_var (zswap_dstmem_lock, zswap_dstmem); +local_unlock (zswap_cpu_lock);/* populate entry */ entry->offset = offset;
@@ -1116,7 +1118,7 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset,return 0 ; put_dstmem: -put_locked_var (zswap_dstmem_lock, zswap_dstmem); +local_unlock (zswap_cpu_lock);zswap_pool_put (entry->pool); freepage:zswap_entry_cache_free (entry);
@@ -1161,9 +1163,10 @@ static int zswap_frontswap_load(unsigned type, pgoff_t offset,if (zpool_evictable (entry->pool->zpool)) src +=sizeof (struct zswap_header ); dst =kmap_atomic (page); - tfm = *get_cpu_ptr (entry->pool->tfm); +local_lock (zswap_cpu_lock); + tfm = *this_cpu_ptr (entry->pool->tfm); ret =crypto_comp_decompress (tfm, src, entry->length, dst, &dlen); -put_cpu_ptr (entry->pool->tfm); +local_unlock (zswap_cpu_lock);kunmap_atomic (dst);zpool_unmap_handle (entry->pool->zpool, entry->handle);BUG_ON (ret);
Signature · 1 line
2.26.2
Steven Rostedt
reviewerPATCH 8/8 Linux 5.4.44-rt27-rc1
In reply to Steven Rostedt5.4.44-rt27-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 @@ --rt26 +-rt27-rc1
Signature · 1 line
2.26.2