17 Aug, 2022

40 commits

  • [ Upstream commit f3dd3f674555bd9455c5ae7fafce0696bd9931b3 ]

    Wakelist can help avoid cache bouncing and offload the overhead of waker
    cpu. So far, using wakelist within the same llc only happens on
    WF_ON_CPU, and this limitation could be removed to further improve
    wakeup performance.

    The commit 518cd6234178 ("sched: Only queue remote wakeups when
    crossing cache boundaries") disabled queuing tasks on wakelist when
    the cpus share llc. This is because, at that time, the scheduler must
    send IPIs to do ttwu_queue_wakelist. Nowadays, ttwu_queue_wakelist also
    supports TIF_POLLING, so this is not a problem now when the wakee cpu is
    in idle polling.

    Benefits:
    Queuing the task on idle cpu can help improving performance on waker cpu
    and utilization on wakee cpu, and further improve locality because
    the wakee cpu can handle its own rq. This patch helps improving rt on
    our real java workloads where wakeup happens frequently.

    Consider the normal condition (CPU0 and CPU1 share same llc)
    Before this patch:

    CPU0 CPU1

    select_task_rq() idle
    rq_lock(CPU1->rq)
    enqueue_task(CPU1->rq)
    notify CPU1 (by sending IPI or CPU1 polling)

    resched()

    After this patch:

    CPU0 CPU1

    select_task_rq() idle
    add to wakelist of CPU1
    notify CPU1 (by sending IPI or CPU1 polling)

    rq_lock(CPU1->rq)
    enqueue_task(CPU1->rq)
    resched()

    We see CPU0 can finish its work earlier. It only needs to put task to
    wakelist and return.
    While CPU1 is idle, so let itself handle its own runqueue data.

    This patch brings no difference about IPI.
    This patch only takes effect when the wakee cpu is:
    1) idle polling
    2) idle not polling

    For 1), there will be no IPI with or without this patch.

    For 2), there will always be an IPI before or after this patch.
    Before this patch: waker cpu will enqueue task and check preempt. Since
    "idle" will be sure to be preempted, waker cpu must send a resched IPI.
    After this patch: waker cpu will put the task to the wakelist of wakee
    cpu, and send an IPI.

    Benchmark:
    We've tested schbench, unixbench, and hachbench on both x86 and arm64.

    On x86 (Intel Xeon Platinum 8269CY):
    schbench -m 2 -t 8

    Latency percentiles (usec) before after
    50.0000th: 8 6
    75.0000th: 10 7
    90.0000th: 11 8
    95.0000th: 12 8
    *99.0000th: 13 10
    99.5000th: 15 11
    99.9000th: 18 14

    Unixbench with full threads (104)
    before after
    Dhrystone 2 using register variables 3011862938 3009935994 -0.06%
    Double-Precision Whetstone 617119.3 617298.5 0.03%
    Execl Throughput 27667.3 27627.3 -0.14%
    File Copy 1024 bufsize 2000 maxblocks 785871.4 784906.2 -0.12%
    File Copy 256 bufsize 500 maxblocks 210113.6 212635.4 1.20%
    File Copy 4096 bufsize 8000 maxblocks 2328862.2 2320529.1 -0.36%
    Pipe Throughput 145535622.8 145323033.2 -0.15%
    Pipe-based Context Switching 3221686.4 3583975.4 11.25%
    Process Creation 101347.1 103345.4 1.97%
    Shell Scripts (1 concurrent) 120193.5 123977.8 3.15%
    Shell Scripts (8 concurrent) 17233.4 17138.4 -0.55%
    System Call Overhead 5300604.8 5312213.6 0.22%

    hackbench -g 1 -l 100000
    before after
    Time 3.246 2.251

    On arm64 (Ampere Altra):
    schbench -m 2 -t 8

    Latency percentiles (usec) before after
    50.0000th: 14 10
    75.0000th: 19 14
    90.0000th: 22 16
    95.0000th: 23 16
    *99.0000th: 24 17
    99.5000th: 24 17
    99.9000th: 28 25

    Unixbench with full threads (80)
    before after
    Dhrystone 2 using register variables 3536194249 3537019613 0.02%
    Double-Precision Whetstone 629383.6 629431.6 0.01%
    Execl Throughput 65920.5 65846.2 -0.11%
    File Copy 1024 bufsize 2000 maxblocks 1063722.8 1064026.8 0.03%
    File Copy 256 bufsize 500 maxblocks 322684.5 318724.5 -1.23%
    File Copy 4096 bufsize 8000 maxblocks 2348285.3 2328804.8 -0.83%
    Pipe Throughput 133542875.3 131619389.8 -1.44%
    Pipe-based Context Switching 3215356.1 3576945.1 11.25%
    Process Creation 108520.5 120184.6 10.75%
    Shell Scripts (1 concurrent) 122636.3 121888 -0.61%
    Shell Scripts (8 concurrent) 17462.1 17381.4 -0.46%
    System Call Overhead 4429998.9 4435006.7 0.11%

    hackbench -g 1 -l 100000
    before after
    Time 4.217 2.916

    Our patch has improvement on schbench, hackbench
    and Pipe-based Context Switching of unixbench
    when there exists idle cpus,
    and no obvious regression on other tests of unixbench.
    This can help improve rt in scenes where wakeup happens frequently.

    Signed-off-by: Tianchen Ding
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Valentin Schneider
    Link: https://lore.kernel.org/r/20220608233412.327341-3-dtcccc@linux.alibaba.com
    Signed-off-by: Sasha Levin

    Tianchen Ding
     
  • [ Upstream commit 28156108fecb1f808b21d216e8ea8f0d205a530c ]

    The commit 2ebb17717550 ("sched/core: Offload wakee task activation if it
    the wakee is descheduling") checked rq->nr_running on_rq and p->on_cpu, observing p->on_cpu
    (WF_ON_CPU) in ttwu_queue_cond() implies !p->on_rq, IOW p has gone through
    the deactivate_task() in __schedule(), thus p has been accounted out of
    rq->nr_running. As such, the task being the only runnable task on the rq
    implies reading rq->nr_running == 0 at that point.

    The benchmark result is in [1].

    [1] https://lore.kernel.org/all/e34de686-4e85-bde1-9f3c-9bbc86b38627@linux.alibaba.com/

    Suggested-by: Valentin Schneider
    Signed-off-by: Tianchen Ding
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Valentin Schneider
    Link: https://lore.kernel.org/r/20220608233412.327341-2-dtcccc@linux.alibaba.com
    Signed-off-by: Sasha Levin

    Tianchen Ding
     
  • [ Upstream commit 6c58cf40e3a1d2f47c09d3489857e9476316788a ]

    A build with -D_FORTIFY_SOURCE=2 enabled will produce the following warnings:

    sysfs.c:63:30: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 0 and 255 [-Wformat-truncation=]
    snprintf(filepath, 256, "%s/%s", path, filename);
    ^~
    Bump up the buffer to PATH_MAX which is the limit and account for all of
    the possible NUL and separators that could lead to exceeding the
    allocated buffer sizes.

    Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal subsystem")
    Signed-off-by: Florian Fainelli
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin

    Florian Fainelli
     
  • [ Upstream commit 2f1c4523f7a3aaabe7e53d3ebd378292947e95c8 ]

    Since the user can control the arguments of the ioctl() from the user
    space, under special arguments that may result in a divide-by-zero bug
    in:
    drivers/video/fbdev/arkfb.c:784: ark_set_pixclock(info, (hdiv * info->var.pixclock) / hmul);
    with hdiv=1, pixclock=1 and hmul=2 you end up with (1*1)/2 = (int) 0.
    and then in:
    drivers/video/fbdev/arkfb.c:504: rv = dac_set_freq(par->dac, 0, 1000000000 / pixclock);
    we'll get a division-by-zero.

    The following log can reveal it:

    divide error: 0000 [#1] PREEMPT SMP KASAN PTI
    RIP: 0010:ark_set_pixclock drivers/video/fbdev/arkfb.c:504 [inline]
    RIP: 0010:arkfb_set_par+0x10fc/0x24c0 drivers/video/fbdev/arkfb.c:784
    Call Trace:
    fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1034
    do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110
    fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189

    Fix this by checking the argument of ark_set_pixclock() first.

    Fixes: 681e14730c73 ("arkfb: new framebuffer driver for ARK Logic cards")
    Signed-off-by: Zheyu Ma
    Signed-off-by: Helge Deller
    Signed-off-by: Sasha Levin

    Zheyu Ma
     
  • [ Upstream commit 625395c4a0f4775e0fe00f616888d2e6c1ba49db ]

    GCC-12 started triggering a new warning:

    arch/x86/mm/numa.c: In function ‘cpumask_of_node’:
    arch/x86/mm/numa.c:916:39: warning: the comparison will always evaluate as ‘false’ for the address of ‘node_to_cpumask_map’ will never be NULL [-Waddress]
    916 | if (node_to_cpumask_map[node] == NULL) {
    | ^~

    node_to_cpumask_map is of type cpumask_var_t[].

    When CONFIG_CPUMASK_OFFSTACK is set, cpumask_var_t is typedef'd to a
    pointer for dynamic allocation, else to an array of one element. The
    "wicked game" can be checked on line 700 of include/linux/cpumask.h.

    The original code in debug_cpumask_set_cpu() and cpumask_of_node() were
    probably written by the original authors with CONFIG_CPUMASK_OFFSTACK=y
    (i.e. dynamic allocation) in mind, checking if the cpumask was available
    via a direct NULL check.

    When CONFIG_CPUMASK_OFFSTACK is not set, GCC gives the above warning
    while compiling the kernel.

    Fix that by using cpumask_available(), which does the NULL check when
    CONFIG_CPUMASK_OFFSTACK is set, otherwise returns true. Use it wherever
    such checks are made.

    Conditional definitions of cpumask_available() can be found along with
    the definition of cpumask_var_t. Check the cpumask.h reference mentioned
    above.

    Fixes: c032ef60d1aa ("cpumask: convert node_to_cpumask_map[] to cpumask_var_t")
    Fixes: de2d9445f162 ("x86: Unify node_to_cpumask_map handling between 32 and 64bit")
    Signed-off-by: Siddh Raman Pant
    Signed-off-by: Ingo Molnar
    Link: https://lore.kernel.org/r/20220731160913.632092-1-code@siddh.me
    Signed-off-by: Sasha Levin

    Siddh Raman Pant
     
  • [ Upstream commit b6e8d40d43ae4dec00c8fea2593eeea3114b8f44 ]

    With cgroup v2, the cpuset's cpus_allowed mask can be empty indicating
    that the cpuset will just use the effective CPUs of its parent. So
    cpuset_can_attach() can call task_can_attach() with an empty mask.
    This can lead to cpumask_any_and() returns nr_cpu_ids causing the call
    to dl_bw_of() to crash due to percpu value access of an out of bound
    CPU value. For example:

    [80468.182258] BUG: unable to handle page fault for address: ffffffff8b6648b0
    :
    [80468.191019] RIP: 0010:dl_cpu_busy+0x30/0x2b0
    :
    [80468.207946] Call Trace:
    [80468.208947] cpuset_can_attach+0xa0/0x140
    [80468.209953] cgroup_migrate_execute+0x8c/0x490
    [80468.210931] cgroup_update_dfl_csses+0x254/0x270
    [80468.211898] cgroup_subtree_control_write+0x322/0x400
    [80468.212854] kernfs_fop_write_iter+0x11c/0x1b0
    [80468.213777] new_sync_write+0x11f/0x1b0
    [80468.214689] vfs_write+0x1eb/0x280
    [80468.215592] ksys_write+0x5f/0xe0
    [80468.216463] do_syscall_64+0x5c/0x80
    [80468.224287] entry_SYSCALL_64_after_hwframe+0x44/0xae

    Fix that by using effective_cpus instead. For cgroup v1, effective_cpus
    is the same as cpus_allowed. For v2, effective_cpus is the real cpumask
    to be used by tasks within the cpuset anyway.

    Also update task_can_attach()'s 2nd argument name to cs_effective_cpus to
    reflect the change. In addition, a check is added to task_can_attach()
    to guard against the possibility that cpumask_any_and() may return a
    value >= nr_cpu_ids.

    Fixes: 7f51412a415d ("sched/deadline: Fix bandwidth check/update when migrating tasks between exclusive cpusets")
    Signed-off-by: Waiman Long
    Signed-off-by: Ingo Molnar
    Acked-by: Juri Lelli
    Link: https://lore.kernel.org/r/20220803015451.2219567-1-longman@redhat.com
    Signed-off-by: Sasha Levin

    Waiman Long
     
  • [ Upstream commit 772b6539fdda31462cc08368e78df60b31a58bab ]

    Both functions are doing almost the same, that is checking if admission
    control is still respected.

    With exclusive cpusets, dl_task_can_attach() checks if the destination
    cpuset (i.e. its root domain) has enough CPU capacity to accommodate the
    task.
    dl_cpu_busy() checks if there is enough CPU capacity in the cpuset in
    case the CPU is hot-plugged out.

    dl_task_can_attach() is used to check if a task can be admitted while
    dl_cpu_busy() is used to check if a CPU can be hotplugged out.

    Make dl_cpu_busy() able to deal with a task and use it instead of
    dl_task_can_attach() in task_can_attach().

    Signed-off-by: Dietmar Eggemann
    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Juri Lelli
    Link: https://lore.kernel.org/r/20220302183433.333029-4-dietmar.eggemann@arm.com
    Signed-off-by: Sasha Levin

    Dietmar Eggemann
     
  • [ Upstream commit b6a5068854cfe372da7dee3224dcf023ed5b00cb ]

    Since commit dcea997beed6 ("faddr2line: Fix overlapping text section
    failures, the sequel"), faddr2line is completely broken on arm64.

    For some reason, on arm64, the vmlinux ELF object file type is ET_DYN
    rather than ET_EXEC. Check for both when determining whether the object
    is vmlinux.

    Modules and vmlinux.o have type ET_REL on all arches.

    Fixes: dcea997beed6 ("faddr2line: Fix overlapping text section failures, the sequel")
    Reported-by: John Garry
    Signed-off-by: Josh Poimboeuf
    Signed-off-by: Ingo Molnar
    Tested-by: John Garry
    Link: https://lore.kernel.org/r/dad1999737471b06d6188ce4cdb11329aa41682c.1658426357.git.jpoimboe@kernel.org
    Signed-off-by: Sasha Levin

    Josh Poimboeuf
     
  • [ Upstream commit 91cea6be90e436c55cde8770a15e4dac9d3032d0 ]

    When genelf was introduced it tested for HAVE_LIBCRYPTO not
    HAVE_LIBCRYPTO_SUPPORT, which is the define the feature test for openssl
    defines, fix it.

    This also adds disables the deprecation warning, someone has to fix this
    to build with openssl 3.0 before the warning becomes a hard error.

    Fixes: 9b07e27f88b9cd78 ("perf inject: Add jitdump mmap injection support")
    Reported-by: 谭梓煊
    Cc: Alexei Starovoitov
    Cc: Andrii Nakryiko
    Cc: Daniel Borkmann
    Cc: Jiri Olsa
    Cc: John Fastabend
    Cc: KP Singh
    Cc: Martin KaFai Lau
    Cc: Nick Terrell
    Cc: Song Liu
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/YulpPqXSOG0Q4J1o@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Arnaldo Carvalho de Melo
     
  • [ Upstream commit f4b39e88b42d13366b831270306326b5c20971ca ]

    The recent change to the PHB numbering logic has a logic error in the
    handling of "ibm,opal-phbid".

    When an "ibm,opal-phbid" property is present, &prop is written to and
    ret is set to zero.

    The following call to of_alias_get_id() is skipped because ret == 0.

    But then the if (ret >= 0) is true, and the body of that if statement
    sets prop = ret which throws away the value that was just read from
    "ibm,opal-phbid".

    Fix the logic by only doing the ret >= 0 check in the of_alias_get_id()
    case.

    Fixes: 0fe1e96fef0a ("powerpc/pci: Prefer PCI domain assignment via DT 'linux,pci-domain' and alias")
    Reviewed-by: Pali Rohár
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20220802105723.1055178-1-mpe@ellerman.id.au
    Signed-off-by: Sasha Levin

    Michael Ellerman
     
  • [ Upstream commit ffa6482e461ff550325356ae705b79e256702ea9 ]

    It's possible that this kernel has been kexec'd from a kernel that
    enabled bus lock detection, or (hypothetically) BIOS/firmware has set
    DEBUGCTLMSR_BUS_LOCK_DETECT.

    Disable bus lock detection explicitly if not wanted.

    Fixes: ebb1064e7c2e ("x86/traps: Handle #DB for bus lock")
    Signed-off-by: Chenyi Qiang
    Signed-off-by: Ingo Molnar
    Reviewed-by: Tony Luck
    Link: https://lore.kernel.org/r/20220802033206.21333-1-chenyi.qiang@intel.com
    Signed-off-by: Sasha Levin

    Chenyi Qiang
     
  • [ Upstream commit 28f6c37a2910f565b4f5960df52b2eccae28c891 ]

    kernel_text_address() treats ftrace_trampoline, kprobe_insn_slot
    and bpf_text_address as valid kprobe addresses - which is not ideal.

    These text areas are removable and changeable without any notification
    to kprobes, and probing on them can trigger unexpected behavior:

    https://lkml.org/lkml/2022/7/26/1148

    Considering that jump_label and static_call text are already
    forbiden to probe, kernel_text_address() should be replaced with
    core_kernel_text() and is_module_text_address() to check other text
    areas which are unsafe to kprobe.

    [ mingo: Rewrote the changelog. ]

    Fixes: 5b485629ba0d ("kprobes, extable: Identify kprobes trampolines as kernel text area")
    Fixes: 74451e66d516 ("bpf: make jited programs visible in traces")
    Signed-off-by: Chen Zhongjin
    Signed-off-by: Ingo Molnar
    Acked-by: Masami Hiramatsu (Google)
    Link: https://lore.kernel.org/r/20220801033719.228248-1-chenzhongjin@huawei.com
    Signed-off-by: Sasha Levin

    Chen Zhongjin
     
  • [ Upstream commit 6d518ac7be6223811ab947897273b1bbef846180 ]

    The perf jvmti agent doesn't create program headers, in this case
    fallback on section headers as happened previously.

    Committer notes:

    To test this, from a public post by Ian:

    1) download a Java workload dacapo-9.12-MR1-bach.jar from
    https://sourceforge.net/projects/dacapobench/

    2) build perf such as "make -C tools/perf O=/tmp/perf NO_LIBBFD=1" it
    should detect Java and create /tmp/perf/libperf-jvmti.so

    3) run perf with the jvmti agent:

    perf record -k 1 java -agentpath:/tmp/perf/libperf-jvmti.so -jar dacapo-9.12-MR1-bach.jar -n 10 fop

    4) run perf inject:

    perf inject -i perf.data -o perf-injected.data -j

    5) run perf report

    perf report -i perf-injected.data | grep org.apache.fop

    With this patch reverted I see lots of symbols like:

    0.00% java jitted-388040-4656.so [.] org.apache.fop.fo.FObj.bind(org.apache.fop.fo.PropertyList)

    With the patch (2d86612aacb7805f ("perf symbol: Correct address for bss
    symbols")) I see lots of:

    dso__load_sym_internal: failed to find program header for symbol:
    Lorg/apache/fop/fo/FObj;bind(Lorg/apache/fop/fo/PropertyList;)V
    st_value: 0x40

    Fixes: 2d86612aacb7805f ("perf symbol: Correct address for bss symbols")
    Reviewed-by: Leo Yan
    Signed-off-by: Ian Rogers
    Tested-by: Leo Yan
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Leo Yan
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20220731164923.691193-1-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Ian Rogers
     
  • [ Upstream commit df5d4b616ee76abc97e5bd348e22659c2b095b1c ]

    of_get_next_parent() returns a node pointer with refcount incremented,
    we should use of_node_put() on it when not need anymore.
    Add missing of_node_put() in the error path to avoid refcount leak.

    Fixes: ce21b3c9648a ("[CELL] add support for MSI on Axon-based Cell systems")
    Signed-off-by: Miaoqian Lin
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20220605065129.63906-1-linmq006@gmail.com
    Signed-off-by: Sasha Levin

    Miaoqian Lin
     
  • [ Upstream commit 255b650cbec6849443ce2e0cdd187fd5e61c218c ]

    of_find_node_by_path() returns a node pointer with
    refcount incremented, we should use of_node_put() on it when done.
    Add missing of_node_put() to avoid refcount leak.

    Fixes: eac1e731b59e ("powerpc/xive: guest exploitation of the XIVE interrupt controller")
    Signed-off-by: Miaoqian Lin
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20220605053225.56125-1-linmq006@gmail.com
    Signed-off-by: Sasha Levin

    Miaoqian Lin
     
  • [ Upstream commit 6ac059dacffa8ab2f7798f20e4bd3333890c541c ]

    of_find_node_by_path() returns remote device nodepointer with
    refcount incremented, we should use of_node_put() on it when done.
    Add missing of_node_put() to avoid refcount leak.

    Fixes: 0afacde3df4c ("[POWERPC] spufs: allow isolated mode apps by starting the SPE loader")
    Signed-off-by: Miaoqian Lin
    Acked-by: Arnd Bergmann
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20220603121543.22884-1-linmq006@gmail.com
    Signed-off-by: Sasha Levin

    Miaoqian Lin
     
  • [ Upstream commit 8ee236dcaa690d09ca612622e8bc8d09c302021d ]

    If the inode has the compress flag, it will fail to use
    'chattr -c +m' to remove its compress flag and tag no compress flag.
    However, the same command will be successful when executed again,
    as shown below:

    $ touch foo.txt
    $ chattr +c foo.txt
    $ chattr -c +m foo.txt
    chattr: Invalid argument while setting flags on foo.txt
    $ chattr -c +m foo.txt
    $ f2fs_io getflags foo.txt
    get a flag on foo.txt ret=0, flags=nocompression,inline_data

    Fix this by removing some checks in f2fs_setflags_common()
    that do not affect the original logic. I go through all the
    possible scenarios, and the results are as follows. Bold is
    the only thing that has changed.

    +---------------+-----------+-----------+----------+
    | | file flags |
    + command +-----------+-----------+----------+
    | | no flag | compr | nocompr |
    +---------------+-----------+-----------+----------+
    | chattr +c | compr | compr | -EINVAL |
    | chattr -c | no flag | no flag | nocompr |
    | chattr +m | nocompr | -EINVAL | nocompr |
    | chattr -m | no flag | compr | no flag |
    | chattr +c +m | -EINVAL | -EINVAL | -EINVAL |
    | chattr +c -m | compr | compr | compr |
    | chattr -c +m | nocompr | *nocompr* | nocompr |
    | chattr -c -m | no flag | no flag | no flag |
    +---------------+-----------+-----------+----------+

    Link: https://lore.kernel.org/linux-f2fs-devel/20220621064833.1079383-1-chaoliu719@gmail.com/
    Fixes: 4c8ff7095bef ("f2fs: support data compression")
    Reviewed-by: Chao Yu
    Signed-off-by: Chao Liu
    Signed-off-by: Jaegeuk Kim
    Signed-off-by: Sasha Levin

    Chao Liu
     
  • [ Upstream commit 6f5c672d17f583b081e283927f5040f726c54598 ]

    As result of commit 915fea04f932 ("s390/smp: enable DAT before
    CPU restart callback is called") the low-address protection bit
    gets mistakenly unset in control register 0 save area of the
    absolute zero memory. That area is used when manual PSW restart
    happened to hit an offline CPU. In this case the low-address
    protection for that CPU will be dropped.

    Reviewed-by: Heiko Carstens
    Fixes: 915fea04f932 ("s390/smp: enable DAT before CPU restart callback is called")
    Signed-off-by: Alexander Gordeev
    Signed-off-by: Sasha Levin

    Alexander Gordeev
     
  • [ Upstream commit ed0192bc644f3553d64a5cb461bdd0b1fbae3fdf ]

    Macro mem_assign_absolute() is able to access the whole memory, but
    is only used and makes sense when updating the absolute lowcore.
    Instead, introduce get_abs_lowcore() and put_abs_lowcore() macros
    that limit access to absolute lowcore addresses only.

    Suggested-by: Heiko Carstens
    Reviewed-by: Heiko Carstens
    Signed-off-by: Alexander Gordeev
    Signed-off-by: Vasily Gorbik
    Signed-off-by: Sasha Levin

    Alexander Gordeev
     
  • [ Upstream commit 9097fc793f74ef9c677f8c4aed0c24f6f07f0133 ]

    Get rid of duplicate code and redundant data.

    Reviewed-by: Heiko Carstens
    Signed-off-by: Alexander Gordeev
    Signed-off-by: Vasily Gorbik
    Signed-off-by: Sasha Levin

    Alexander Gordeev
     
  • [ Upstream commit dc2ab23b992c9d5dab93b9bf01b10b10465e537e ]

    Macro mem_assign_absolute() is used to initialize a target
    CPU lowcore callback parameters. But despite the macro name
    it writes to the absolute lowcore only if the target CPU is
    offline. In case the CPU is online the macro does implicitly
    write to the normal memory.

    That behaviour is correct, but extremely subtle. Sacrifice
    few program bits in favour of clarity and distinguish between
    online vs offline CPUs and normal vs absolute lowcore pointer.

    Reviewed-by: Heiko Carstens
    Signed-off-by: Alexander Gordeev
    Signed-off-by: Vasily Gorbik
    Signed-off-by: Sasha Levin

    Alexander Gordeev
     
  • [ Upstream commit 9de209c7d584d6e06ad92f120d83d4f27c200497 ]

    Due to historical reasons os_info handling functions misuse
    the notion of physical vs virtual addresses difference.

    Note: this does not fix a bug currently, since virtual
    and physical addresses are identical.

    Reviewed-by: Heiko Carstens
    Signed-off-by: Alexander Gordeev
    Signed-off-by: Vasily Gorbik
    Signed-off-by: Sasha Levin

    Alexander Gordeev
     
  • [ Upstream commit 707f816f25590c20e056b3bd4a17ce69b03fe856 ]

    The LPUART can't distinguish between a break signal and a framing error,
    so need to count the break characters if there is a framing error and
    received data is zero instead of the parity error.

    Fixes: 5541a9bacfe5 ("serial: fsl_lpuart: handle break and make sysrq work")
    Reviewed-by: Michael Walle
    Signed-off-by: Sherry Sun
    Link: https://lore.kernel.org/r/20220725050115.12396-1-sherry.sun@nxp.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Sherry Sun
     
  • [ Upstream commit 0fe1e96fef0a5c53b4c0d1500d356f3906000f81 ]

    Other Linux architectures use DT property 'linux,pci-domain' for
    specifying fixed PCI domain of PCI controller specified in Device-Tree.

    And lot of Freescale powerpc boards have defined numbered pci alias in
    Device-Tree for every PCIe controller which number specify preferred PCI
    domain.

    So prefer usage of DT property 'linux,pci-domain' (via function
    of_get_pci_domain_nr()) and DT pci alias (via function
    of_alias_get_id()) on powerpc architecture for assigning PCI domain to
    PCI controller.

    Fixes: 63a72284b159 ("powerpc/pci: Assign fixed PHB number based on device-tree properties")
    Signed-off-by: Pali Rohár
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20220706102148.5060-2-pali@kernel.org
    Signed-off-by: Sasha Levin

    Pali Rohár
     
  • [ Upstream commit d80f6de9d601c30b53c17f00cb7cfe3169f2ddad ]

    The existing iommu_table_in_use() helper checks if the kernel is using
    any of TCEs. There are some reserved TCEs:
    1) the very first one if DMA window starts from 0 to avoid having a zero
    but still valid DMA handle;
    2) it_reserved_start..it_reserved_end to exclude MMIO32 window in case
    the default window spans across that - this is the default for the first
    DMA window on PowerNV.

    When 1) is the case and 2) is not the helper does not skip 1) and returns
    wrong status.

    This only seems occurring when passing through a PCI device to a nested
    guest (not something we support really well) so it has not been seen
    before.

    This fixes the bug by adding a special case for no MMIO32 reservation.

    Fixes: 3c33066a2190 ("powerpc/kernel/iommu: Add new iommu_table_in_use() helper")
    Signed-off-by: Alexey Kardashevskiy
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20220714081119.3714605-1-aik@ozlabs.ru
    Signed-off-by: Sasha Levin

    Alexey Kardashevskiy
     
  • [ Upstream commit 9be013b2a9ecb29b5168e4b9db0e48ed53acf37c ]

    Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
    enlarged the CPU selection logic to PPC32 by removing depend to
    PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU.
    Fortunately that got unnoticed because -mcpu=8540 will override the
    -mcpu=e500mc64 or -mpcu=e6500 as they are ealier, but that's
    fragile and may no be right in the future.

    Add back the depend PPC64 on E5500_CPU and E6500_CPU.

    Fixes: 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32")
    Signed-off-by: Christophe Leroy
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/8abab4888da69ff78b73a56f64d9678a7bf684e9.1657549153.git.christophe.leroy@csgroup.eu
    Signed-off-by: Sasha Levin

    Christophe Leroy
     
  • [ Upstream commit 980bbf7ca72012d317617fcdbfabe8708e4cef29 ]

    mark_initmem_nx() calls either mmu_mark_initmem_nx() or
    set_memory_attr() based on return from v_block_mapped()
    of _sinittext.

    But we can now handle text and data independently, so that
    text may be mapped by block even when data is mapped by pages.

    On the 8xx for instance, at startup 32Mbytes of memory are
    pinned in TLB. So the pinned entries need to go away for sinittext.

    In next patch a BAT will be set to also covers sinittext on book3s/32.
    So it will also be needed to call mmu_mark_initmem_nx() even when
    data above sinittext is not mapped with BATs.

    As this is highly dependent on the platform, call mmu_mark_initmem_nx()
    regardless of data block mapping. Then the platform will know what to
    do.

    Modify 8xx mmu_mark_initmem_nx() so that inittext mapping is modified
    only when pagealloc debug and kfence are not active, otherwise inittext
    is mapped with standard pages. And don't do anything on kernel text
    which is already mapped with PAGE_KERNEL_TEXT.

    Fixes: da1adea07576 ("powerpc/8xx: Allow STRICT_KERNEL_RwX with pinned TLB")
    Signed-off-by: Christophe Leroy
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/db3fc14f3bfa6215b0786ef58a6e2bc1e1f964d7.1655202804.git.christophe.leroy@csgroup.eu
    Signed-off-by: Sasha Levin

    Christophe Leroy
     
  • [ Upstream commit 768ac4f12ca0fda935f58eb8c5120e9d795bc6e3 ]

    Disable end of block interrupt in case of wait for completion timeout
    or errors to undo previously enable operation (done in
    mchp_spdifrx_isr_blockend_en()). Otherwise we can end up with an
    unbalanced reference counter for this interrupt.

    Fixes: ef265c55c1ac ("ASoC: mchp-spdifrx: add driver for SPDIF RX")
    Signed-off-by: Claudiu Beznea
    Link: https://lore.kernel.org/r/20220727090814.2446111-2-claudiu.beznea@microchip.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Claudiu Beznea
     
  • [ Upstream commit 3eb8fccc244bfb41a7961969e4db280d44911226 ]

    The second operand of a '&&' operator has no impact on expression
    result for cases 400 and 512 in SiS_GetModeID().

    Judging by the logic and the names of the variables, in both cases a
    typo was made.

    Found by Linux Verification Center (linuxtesting.org) with SVACE.

    Signed-off-by: Rustam Subkhankulov
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Helge Deller
    Signed-off-by: Sasha Levin

    Rustam Subkhankulov
     
  • [ Upstream commit 26c2b7d9fac42eb8317f3ceefa4c1a9a9170ca69 ]

    In clcdfb_of_init_display(), we should call of_node_put() for the
    references returned by of_graph_get_next_endpoint() and
    of_graph_get_remote_port_parent() which have increased the refcount.

    Besides, we should call of_node_put() both in fail path or when
    the references are not used anymore.

    Fixes: d10715be03bd ("video: ARM CLCD: Add DT support")
    Signed-off-by: Liang He
    Signed-off-by: Helge Deller
    Signed-off-by: Sasha Levin

    Liang He
     
  • [ Upstream commit 2d27e52841092e5831dd41f313028c668d816eb0 ]

    The function devm_ioremap() in armada_37xx_wdt_probe() can fail, so
    its return value should be checked.

    Fixes: 54e3d9b518c8a ("watchdog: Add support for Armada 37xx CPU watchdog")
    Reported-by: Hacash Robot
    Signed-off-by: William Dean
    Reviewed-by: Marek Beh=C3=BAn
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20220722030938.2925156-1-williamsukatube@163.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin

    William Dean
     
  • [ Upstream commit c6d9c0798ed366a09a9e53d71edcd2266e34a6eb ]

    Unlike release_mem_region(), a call to release_resource() does not
    free the resource, so it has to be freed explicitly to avoid a memory
    leak.

    Signed-off-by: Jean Delvare
    Fixes: 0578fff4aae5 ("Watchdog: sp5100_tco: Add initialization using EFCH MMIO")
    Cc: Terry Bowman
    Cc: Wim Van Sebroeck
    Cc: Guenter Roeck
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20220621152840.420a0f4c@endymion.delvare
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin

    Jean Delvare
     
  • [ Upstream commit 65fb8e2ef3531a6e950060fca6e551c923fb0f0e ]

    In asoc_simple_parse_dai(), we should call of_node_put() for the
    reference returned by of_graph_get_port_parent() in fail path.

    Fixes: ae30a694da4c ("ASoC: simple-card-utils: add asoc_simple_card_parse_dai()")
    Signed-off-by: Liang He
    Link: https://lore.kernel.org/r/20220721144308.1301587-1-windhl@126.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Liang He
     
  • [ Upstream commit c64797809a64c73497082aa05e401a062ec1af34 ]

    The commit 15c8e72e88e0 ("fuse: allow skipping control interface and forced
    unmount") tries to remove the control interface for virtio-fs since it does
    not support aborting requests which are being processed. But it doesn't
    work now.

    This patch fixes it by skipping creating the control interface if
    fuse_conn->no_control is set.

    Fixes: 15c8e72e88e0 ("fuse: allow skipping control interface and forced unmount")
    Signed-off-by: Xie Yongji
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Sasha Levin

    Xie Yongji
     
  • [ Upstream commit 673f58f62ca6fc98979d1cf3fe89c3ff33f29b2e ]

    find_first_zero_bit() returns MAX_COPPS_PER_PORT at max here.
    So 'idx' should be tested with ">=" or the test can't match.

    Fixes: 7b20b2be51e1 ("ASoC: qdsp6: q6adm: Add q6adm driver")
    Signed-off-by: Christophe JAILLET
    Link: https://lore.kernel.org/r/0fca3271649736053eb9649d87e1ca01b056be40.1658394124.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Christophe JAILLET
     
  • [ Upstream commit 409a8652e909e323c715f3088e6c3133e37c8881 ]

    Fix sparse warning:
    sound/soc/fsl/imx-card.c:653:59: sparse: warning: incorrect type in assignment (different base types)
    sound/soc/fsl/imx-card.c:653:59: sparse: expected unsigned int [usertype] asrc_format
    sound/soc/fsl/imx-card.c:653:59: sparse: got restricted snd_pcm_format_t [usertype]
    sound/soc/fsl/imx-card.c:655:59: sparse: warning: incorrect type in assignment (different base types)
    sound/soc/fsl/imx-card.c:655:59: sparse: expected unsigned int [usertype] asrc_format
    sound/soc/fsl/imx-card.c:655:59: sparse: got restricted snd_pcm_format_t [usertype]

    Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver")
    Signed-off-by: Shengjiu Wang
    Link: https://lore.kernel.org/r/1658399393-28777-6-git-send-email-shengjiu.wang@nxp.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Shengjiu Wang
     
  • [ Upstream commit de27216cf2d645c2fd14e513707bdcd54e5b1de4 ]

    Fix sparse warning:
    sound/soc/fsl/fsl_easrc.c:562:33: sparse: warning: restricted snd_pcm_format_t degrades to integer
    sound/soc/fsl/fsl_easrc.c:563:34: sparse: warning: restricted snd_pcm_format_t degrades to integer
    sound/soc/fsl/fsl_easrc.c:565:38: sparse: warning: restricted snd_pcm_format_t degrades to integer
    sound/soc/fsl/fsl_easrc.c:566:39: sparse: warning: restricted snd_pcm_format_t degrades to integer
    sound/soc/fsl/fsl_easrc.c:608:33: sparse: warning: restricted snd_pcm_format_t degrades to integer
    sound/soc/fsl/fsl_easrc.c:609:34: sparse: warning: restricted snd_pcm_format_t degrades to integer
    sound/soc/fsl/fsl_easrc.c:615:40: sparse: warning: restricted snd_pcm_format_t degrades to integer
    sound/soc/fsl/fsl_easrc.c:616:41: sparse: warning: restricted snd_pcm_format_t degrades to integer

    sound/soc/fsl/fsl_easrc.c:1465:51: sparse: warning: incorrect type in assignment (different base types)
    sound/soc/fsl/fsl_easrc.c:1465:51: sparse: expected unsigned int sample_format
    sound/soc/fsl/fsl_easrc.c:1465:51: sparse: got restricted snd_pcm_format_t [usertype] format
    sound/soc/fsl/fsl_easrc.c:1467:52: sparse: warning: incorrect type in assignment (different base types)
    sound/soc/fsl/fsl_easrc.c:1467:52: sparse: expected unsigned int sample_format
    sound/soc/fsl/fsl_easrc.c:1467:52: sparse: got restricted snd_pcm_format_t [usertype] asrc_format
    sound/soc/fsl/fsl_easrc.c:1470:52: sparse: warning: incorrect type in assignment (different base types)
    sound/soc/fsl/fsl_easrc.c:1470:52: sparse: expected unsigned int sample_format
    sound/soc/fsl/fsl_easrc.c:1470:52: sparse: got restricted snd_pcm_format_t [usertype] format
    sound/soc/fsl/fsl_easrc.c:1472:51: sparse: warning: incorrect type in assignment (different base types)
    sound/soc/fsl/fsl_easrc.c:1472:51: sparse: expected unsigned int sample_format
    sound/soc/fsl/fsl_easrc.c:1472:51: sparse: got restricted snd_pcm_format_t [usertype] asrc_format
    sound/soc/fsl/fsl_easrc.c:1484:41: sparse: warning: incorrect type in argument 2 (different base types)
    sound/soc/fsl/fsl_easrc.c:1484:41: sparse: expected restricted snd_pcm_format_t [usertype] *in_raw_format
    sound/soc/fsl/fsl_easrc.c:1484:41: sparse: got unsigned int *
    sound/soc/fsl/fsl_easrc.c:1485:41: sparse: warning: incorrect type in argument 3 (different base types)
    sound/soc/fsl/fsl_easrc.c:1485:41: sparse: expected restricted snd_pcm_format_t [usertype] *out_raw_format
    sound/soc/fsl/fsl_easrc.c:1485:41: sparse: got unsigned int *
    sound/soc/fsl/fsl_easrc.c:1937:60: sparse: warning: incorrect type in argument 3 (different base types)
    sound/soc/fsl/fsl_easrc.c:1937:60: sparse: expected unsigned int [usertype] *out_value
    sound/soc/fsl/fsl_easrc.c:1937:60: sparse: got restricted snd_pcm_format_t *
    sound/soc/fsl/fsl_easrc.c:1943:49: sparse: warning: restricted snd_pcm_format_t degrades to integer

    Fixes: 955ac624058f ("ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers")
    Signed-off-by: Shengjiu Wang
    Link: https://lore.kernel.org/r/1658399393-28777-5-git-send-email-shengjiu.wang@nxp.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Shengjiu Wang
     
  • [ Upstream commit 6c7b077dad62178c33f9a3ae17f90d6b0bf6e2e5 ]

    Fix sparse warning:
    sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: warning: incorrect type in argument 3 (different base types)
    sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: expected unsigned int [usertype] *out_value
    sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: got restricted snd_pcm_format_t *

    Fixes: 859e364302c5 ("ASoC: fsl-asoc-card: Support new property fsl, asrc-format")
    Signed-off-by: Shengjiu Wang
    Link: https://lore.kernel.org/r/1658399393-28777-4-git-send-email-shengjiu.wang@nxp.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Shengjiu Wang
     
  • [ Upstream commit c49932726de24405d45516b3f8ad2735714fdf05 ]

    Fix sparse warning:
    sound/soc/fsl/fsl_asrc.c:1177:60: sparse: warning: incorrect type in argument 3 (different base types)
    sound/soc/fsl/fsl_asrc.c:1177:60: sparse: expected unsigned int [usertype] *out_value
    sound/soc/fsl/fsl_asrc.c:1177:60: sparse: got restricted snd_pcm_format_t *
    sound/soc/fsl/fsl_asrc.c:1200:47: sparse: warning: restricted snd_pcm_format_t degrades to integer

    Fixes: 4520af41fd21 ("ASoC: fsl_asrc: Support new property fsl,asrc-format")
    Signed-off-by: Shengjiu Wang
    Link: https://lore.kernel.org/r/1658399393-28777-3-git-send-email-shengjiu.wang@nxp.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Shengjiu Wang
     
  • [ Upstream commit 9ffed254d938c9e99eb7761c7f739294c84e0367 ]

    Memory buffer used for reading out data from hardware system
    area is not protected against concurrent access.

    Reported-by: Matthew Wilcox
    Fixes: 411ed3225733 ("[S390] zfcpdump support.")
    Acked-by: Heiko Carstens
    Tested-by: Alexander Egorenkov
    Link: https://lore.kernel.org/r/e68137f0f9a0d2558f37becc20af18e2939934f6.1658206891.git.agordeev@linux.ibm.com
    Signed-off-by: Alexander Gordeev
    Signed-off-by: Sasha Levin

    Alexander Gordeev