RE: [ANNOUNCE] 4.19.106-rt45

From: Tiejun Chen
Date: Fri Mar 27 2020 - 19:17:09 EST


Steven,

We cannot build this release (maybe all 4.19-rt) with CONFIG_UBSAN=y
----
lib/ubsan.c: In function '__ubsan_handle_vla_bound_not_positive':
lib/ubsan.c:348:2: error: too many arguments to function 'ubsan_prologue'
ubsan_prologue(&data->location, &flags);
^~~~~~~~~~~~~~
lib/ubsan.c:146:13: note: declared here
static void ubsan_prologue(struct source_location *location)
^~~~~~~~~~~~~~
lib/ubsan.c:353:2: error: too many arguments to function 'ubsan_epilogue'
ubsan_epilogue(&flags);
^~~~~~~~~~~~~~
lib/ubsan.c:155:13: note: declared here
static void ubsan_epilogue(void)
^~~~~~~~~~~~~~

I think you have to squash the following into patches/0309-lib-ubsan-Don-t-seralize-UBSAN-report.patch In your release.

rebase onto [PATCH 309/326] lib/ubsan: Don't seralize UBSAN report

Signed-off-by: Tiejun Chen <tiejunc@xxxxxxxxxx>

diff --git a/lib/ubsan.c b/lib/ubsan.c
index 5830cc9a2..199c75e03 100644
--- a/lib/ubsan.c
+++ b/lib/ubsan.c
@@ -339,18 +339,17 @@ EXPORT_SYMBOL(__ubsan_handle_type_mismatch_v1);
void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data,
void *bound)
{
- unsigned long flags;
char bound_str[VALUE_LENGTH];

if (suppress_report(&data->location))
return;

- ubsan_prologue(&data->location, &flags);
+ ubsan_prologue(&data->location);

val_to_string(bound_str, sizeof(bound_str), data->type, bound);
pr_err("variable length array bound value %s <= 0\n", bound_str);

- ubsan_epilogue(&flags);
+ ubsan_epilogue();
}
EXPORT_SYMBOL(__ubsan_handle_vla_bound_not_positive);

Thanks
Tiejun

> -----Original Message-----
> From: linux-rt-users-owner@xxxxxxxxxxxxxxx <linux-rt-users-
> owner@xxxxxxxxxxxxxxx> On Behalf Of Steven Rostedt
> Sent: Wednesday, March 11, 2020 1:32 AM
> To: LKML <linux-kernel@xxxxxxxxxxxxxxx>; linux-rt-users <linux-rt-
> users@xxxxxxxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>; Carsten Emde <C.Emde@xxxxxxxxx>;
> John Kacur <jkacur@xxxxxxxxxx>; Sebastian Andrzej Siewior
> <bigeasy@xxxxxxxxxxxxx>; Julia Cartwright <julia@xxxxxx>; Daniel Wagner
> <wagi@xxxxxxxxx>; Tom Zanussi <zanussi@xxxxxxxxxx>;
> srivatsa@xxxxxxxxxxxxx
> Subject: [ANNOUNCE] 4.19.106-rt45
>
>
> Dear RT Folks,
>
> I'm pleased to announce the 4.19.106-rt45 stable release.
>
>
> You can get this release via the git tree at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git
>
> branch: v4.19-rt
> Head SHA1: d515995ead09469fbddcb2ffff800caab9cb0c5f
>
>
> Or to build 4.19.106-rt45 directly, the following patches should be applied:
>
>
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ker
> nel.org%2Fpub%2Flinux%2Fkernel%2Fv4.x%2Flinux-
> 4.19.tar.xz&amp;data=02%7C01%7Ctiejunc%40vmware.com%7C1e0b4f7370b94
> 06a2d9908d7c518f3cc%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C
> 637194583286665081&amp;sdata=O9kUWVf5%2BV6mztSmEPDVEEyBXeWsJ5X3
> EdZUOm4Rojg%3D&amp;reserved=0
>
>
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ker
> nel.org%2Fpub%2Flinux%2Fkernel%2Fv4.x%2Fpatch-
> 4.19.106.xz&amp;data=02%7C01%7Ctiejunc%40vmware.com%7C1e0b4f7370b9
> 406a2d9908d7c518f3cc%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7
> C637194583286665081&amp;sdata=uktKRMBu2bvbY6q0Q4oDTKKASJGCW9Ve6
> V4RuDQ2VWo%3D&amp;reserved=0
>
>
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ker
> nel.org%2Fpub%2Flinux%2Fkernel%2Fprojects%2Frt%2F4.19%2Fpatch-4.19.106-
> rt45.patch.xz&amp;data=02%7C01%7Ctiejunc%40vmware.com%7C1e0b4f7370b
> 9406a2d9908d7c518f3cc%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%
> 7C637194583286665081&amp;sdata=1w1imJvHGtBCtzMcGD47B6fHEZnId1MR2E
> %2Fxa9RLNnc%3D&amp;reserved=0
>
>
>
> You can also build from 4.19.106-rt44 by applying the incremental patch:
>
>
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ker
> nel.org%2Fpub%2Flinux%2Fkernel%2Fprojects%2Frt%2F4.19%2Fincr%2Fpatch-
> 4.19.106-rt44-
> rt45.patch.xz&amp;data=02%7C01%7Ctiejunc%40vmware.com%7C1e0b4f7370b
> 9406a2d9908d7c518f3cc%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%
> 7C637194583286665081&amp;sdata=Vqwzq6ssrVtktlSvtfyj25cbIU7zBI66db7aAG
> fWt%2FI%3D&amp;reserved=0
>
>
>
> Enjoy,
>
> -- Steve
>
>
> Changes from v4.19.106-rt44:
>
> ---
>
> Matt Fleming (1):
> mm/memcontrol: Move misplaced local_unlock_irqrestore()
>
> Scott Wood (2):
> sched: migrate_enable: Use per-cpu cpu_stop_work
> sched: migrate_enable: Remove __schedule() call
>
> Sebastian Andrzej Siewior (4):
> userfaultfd: Use a seqlock instead of seqcount
> locallock: Include header for the `current' macro
> drm/vmwgfx: Drop preempt_disable() in vmw_fifo_ping_host()
> tracing: make preempt_lazy and migrate_disable counter smaller
>
> Steven Rostedt (VMware) (1):
> Linux 4.19.106-rt45
>
> ----
> drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 2 --
> fs/userfaultfd.c | 12 ++++++------
> include/linux/locallock.h | 1 +
> include/linux/trace_events.h | 3 +--
> kernel/sched/core.c | 23 ++++++++++++++---------
> kernel/trace/trace_events.c | 4 ++--
> localversion-rt | 2 +-
> mm/memcontrol.c | 2 +-
> 8 files changed, 26 insertions(+), 23 deletions(-)
> ---------------------------
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
> index d0fd147ef75f..fb5a3461bb8c 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
> @@ -167,10 +167,8 @@ void vmw_fifo_ping_host(struct vmw_private
> *dev_priv, uint32_t reason) {
> u32 *fifo_mem = dev_priv->mmio_virt;
>
> - preempt_disable();
> if (cmpxchg(fifo_mem + SVGA_FIFO_BUSY, 0, 1) == 0)
> vmw_write(dev_priv, SVGA_REG_SYNC, reason);
> - preempt_enable();
> }
>
> void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state
> *fifo) diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index
> d269d1139f7f..ff6be687f68e 100644
> --- a/fs/userfaultfd.c
> +++ b/fs/userfaultfd.c
> @@ -61,7 +61,7 @@ struct userfaultfd_ctx {
> /* waitqueue head for events */
> wait_queue_head_t event_wqh;
> /* a refile sequence protected by fault_pending_wqh lock */
> - struct seqcount refile_seq;
> + seqlock_t refile_seq;
> /* pseudo fd refcounting */
> atomic_t refcount;
> /* userfaultfd syscall flags */
> @@ -1064,7 +1064,7 @@ static ssize_t userfaultfd_ctx_read(struct
> userfaultfd_ctx *ctx, int no_wait,
> * waitqueue could become empty if this is the
> * only userfault.
> */
> - write_seqcount_begin(&ctx->refile_seq);
> + write_seqlock(&ctx->refile_seq);
>
> /*
> * The fault_pending_wqh.lock prevents the uwq @@ -
> 1090,7 +1090,7 @@ static ssize_t userfaultfd_ctx_read(struct userfaultfd_ctx
> *ctx, int no_wait,
> list_del(&uwq->wq.entry);
> add_wait_queue(&ctx->fault_wqh, &uwq->wq);
>
> - write_seqcount_end(&ctx->refile_seq);
> + write_sequnlock(&ctx->refile_seq);
>
> /* careful to always initialize msg if ret == 0 */
> *msg = uwq->msg;
> @@ -1263,11 +1263,11 @@ static __always_inline void wake_userfault(struct
> userfaultfd_ctx *ctx,
> * sure we've userfaults to wake.
> */
> do {
> - seq = read_seqcount_begin(&ctx->refile_seq);
> + seq = read_seqbegin(&ctx->refile_seq);
> need_wakeup = waitqueue_active(&ctx->fault_pending_wqh) ||
> waitqueue_active(&ctx->fault_wqh);
> cond_resched();
> - } while (read_seqcount_retry(&ctx->refile_seq, seq));
> + } while (read_seqretry(&ctx->refile_seq, seq));
> if (need_wakeup)
> __wake_userfault(ctx, range);
> }
> @@ -1938,7 +1938,7 @@ static void init_once_userfaultfd_ctx(void *mem)
> init_waitqueue_head(&ctx->fault_wqh);
> init_waitqueue_head(&ctx->event_wqh);
> init_waitqueue_head(&ctx->fd_wqh);
> - seqcount_init(&ctx->refile_seq);
> + seqlock_init(&ctx->refile_seq);
> }
>
> SYSCALL_DEFINE1(userfaultfd, int, flags) diff --git a/include/linux/locallock.h
> b/include/linux/locallock.h index 921eab83cd34..81c89d87723b 100644
> --- a/include/linux/locallock.h
> +++ b/include/linux/locallock.h
> @@ -3,6 +3,7 @@
>
> #include <linux/percpu.h>
> #include <linux/spinlock.h>
> +#include <asm/current.h>
>
> #ifdef CONFIG_PREEMPT_RT_BASE
>
> diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index
> 72864a11cec0..e26a85c1b7ba 100644
> --- a/include/linux/trace_events.h
> +++ b/include/linux/trace_events.h
> @@ -62,8 +62,7 @@ struct trace_entry {
> unsigned char flags;
> unsigned char preempt_count;
> int pid;
> - unsigned short migrate_disable;
> - unsigned short padding;
> + unsigned char migrate_disable;
> unsigned char preempt_lazy_count;
> };
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c index
> 4616c086dd26..02e51c74e0bf 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7291,6 +7291,9 @@ static void migrate_disabled_sched(struct task_struct
> *p)
> p->migrate_disable_scheduled = 1;
> }
>
> +static DEFINE_PER_CPU(struct cpu_stop_work, migrate_work); static
> +DEFINE_PER_CPU(struct migration_arg, migrate_arg);
> +
> void migrate_enable(void)
> {
> struct task_struct *p = current;
> @@ -7329,23 +7332,25 @@ void migrate_enable(void)
>
> WARN_ON(smp_processor_id() != cpu);
> if (!is_cpu_allowed(p, cpu)) {
> - struct migration_arg arg = { .task = p };
> - struct cpu_stop_work work;
> + struct migration_arg __percpu *arg;
> + struct cpu_stop_work __percpu *work;
> struct rq_flags rf;
>
> + work = this_cpu_ptr(&migrate_work);
> + arg = this_cpu_ptr(&migrate_arg);
> + WARN_ON_ONCE(!arg->done && !work->disabled && work->arg);
> +
> + arg->task = p;
> + arg->done = false;
> +
> rq = task_rq_lock(p, &rf);
> update_rq_clock(rq);
> - arg.dest_cpu = select_fallback_rq(cpu, p);
> + arg->dest_cpu = select_fallback_rq(cpu, p);
> task_rq_unlock(rq, p, &rf);
>
> stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop,
> - &arg, &work);
> + arg, work);
> tlb_migrate_finish(p->mm);
> - __schedule(true);
> - if (!work.disabled) {
> - while (!arg.done)
> - cpu_relax();
> - }
> }
>
> out:
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index
> 1febb0ca4c81..07b8f5bfd263 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -188,8 +188,8 @@ 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 short, migrate_disable);
> - __common_field(unsigned short, padding);
> + __common_field(unsigned char, migrate_disable);
> + __common_field(unsigned char, preempt_lazy_count);
>
> return ret;
> }
> diff --git a/localversion-rt b/localversion-rt index ac4d836a809d..38c40b21a885
> 100644
> --- a/localversion-rt
> +++ b/localversion-rt
> @@ -1 +1 @@
> --rt44
> +-rt45
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c index
> 421ac74450f6..519528959eef 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -6540,10 +6540,10 @@ void mem_cgroup_swapout(struct page *page,
> swp_entry_t entry)
> mem_cgroup_charge_statistics(memcg, page, PageTransHuge(page),
> -nr_entries);
> memcg_check_events(memcg, page);
> + local_unlock_irqrestore(event_lock, flags);
>
> if (!mem_cgroup_is_root(memcg))
> css_put_many(&memcg->css, nr_entries);
> - local_unlock_irqrestore(event_lock, flags);
> }
>
> /**