30 Dec, 2020

40 commits

  • commit 27d56e62e4748c2135650c260024e9904b8c1a0a upstream.

    While writing an explanation for the need of the commit_root_sem for
    btrfs_prepare_extent_commit, I realized we have a slight hole that could
    result in leaked space if we have to do the old style caching. Consider
    the following scenario

    commit root
    +----+----+----+----+----+----+----+
    |\\\\| |\\\\|\\\\| |\\\\|\\\\|
    +----+----+----+----+----+----+----+
    0 1 2 3 4 5 6 7

    new commit root
    +----+----+----+----+----+----+----+
    | | | |\\\\| | |\\\\|
    +----+----+----+----+----+----+----+
    0 1 2 3 4 5 6 7

    Prior to this patch, we run btrfs_prepare_extent_commit, which updates
    the last_byte_to_unpin, and then we subsequently run
    switch_commit_roots. In this example lets assume that
    caching_ctl->progress == 1 at btrfs_prepare_extent_commit() time, which
    means that cache->last_byte_to_unpin == 1. Then we go and do the
    switch_commit_roots(), but in the meantime the caching thread has made
    some more progress, because we drop the commit_root_sem and re-acquired
    it. Now caching_ctl->progress == 3. We swap out the commit root and
    carry on to unpin.

    The race can happen like:

    1) The caching thread was running using the old commit root when it
    found the extent for [2, 3);

    2) Then it released the commit_root_sem because it was in the last
    item of a leaf and the semaphore was contended, and set ->progress
    to 3 (value of 'last'), as the last extent item in the current leaf
    was for the extent for range [2, 3);

    3) Next time it gets the commit_root_sem, will start using the new
    commit root and search for a key with offset 3, so it never finds
    the hole for [2, 3).

    So the caching thread never saw [2, 3) as free space in any of the
    commit roots, and by the time finish_extent_commit() was called for
    the range [0, 3), ->last_byte_to_unpin was 1, so it only returned the
    subrange [0, 1) to the free space cache, skipping [2, 3).

    In the unpin code we have last_byte_to_unpin == 1, so we unpin [0,1),
    but do not unpin [2,3). However because caching_ctl->progress == 3 we
    do not see the newly freed section of [2,3), and thus do not add it to
    our free space cache. This results in us missing a chunk of free space
    in memory (on disk too, unless we have a power failure before writing
    the free space cache to disk).

    Fix this by making sure the ->last_byte_to_unpin is set at the same time
    that we swap the commit roots, this ensures that we will always be
    consistent.

    CC: stable@vger.kernel.org # 5.8+
    Reviewed-by: Filipe Manana
    Signed-off-by: Josef Bacik
    [ update changelog with Filipe's review comments ]
    Signed-off-by: David Sterba
    Signed-off-by: Greg Kroah-Hartman

    Josef Bacik
     
  • commit 9076dbd5ee837c3882fc42891c14cecd0354a849 upstream.

    While fixing up our ->last_byte_to_unpin locking I noticed that we will
    shorten len based on ->last_byte_to_unpin if we're caching when we're
    adding back the free space. This is correct for the free space, as we
    cannot unpin more than ->last_byte_to_unpin, however we use len to
    adjust the ->bytes_pinned counters and such, which need to track the
    actual pinned usage. This could result in
    WARN_ON(space_info->bytes_pinned) triggering at unmount time.

    Fix this by using a local variable for the amount to add to free space
    cache, and leave len untouched in this case.

    CC: stable@vger.kernel.org # 5.4+
    Reviewed-by: Filipe Manana
    Signed-off-by: Josef Bacik
    Signed-off-by: David Sterba
    Signed-off-by: Greg Kroah-Hartman

    Josef Bacik
     
  • commit 320f9028c7873c3c7710e8e93e5c979f4c857490 upstream.

    The driver did not update its view of the available device buffer space
    until write() was called in task context. This meant that write_room()
    would return 0 even after the device had sent a write-unthrottle
    notification, something which could lead to blocked writers not being
    woken up (e.g. when using OPOST).

    Note that we must also request an unthrottle notification is case a
    write() request fills the device buffer exactly.

    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable
    Acked-by: Sebastian Andrzej Siewior
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 49fbb8e37a961396a5b6c82937c70df91de45e9d upstream.

    The driver's transmit-unthrottle work was never flushed on disconnect,
    something which could lead to the driver port data being freed while the
    unthrottle work is still scheduled.

    Fix this by cancelling the unthrottle work when shutting down the port.

    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Acked-by: Sebastian Andrzej Siewior
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 37faf50615412947868c49aee62f68233307f4e4 upstream.

    The driver's deferred write wakeup was never flushed on disconnect,
    something which could lead to the driver port data being freed while the
    wakeup work is still scheduled.

    Fix this by using the usb-serial write wakeup which gets cancelled
    properly on disconnect.

    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Acked-by: Sebastian Andrzej Siewior
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit c01d2c58698f710c9e13ba3e2d296328606f74fd upstream.

    Make sure to clear the write-busy flag also in case no new data was
    submitted due to lack of device buffer space so that writing is
    resumed once space again becomes available.

    Fixes: 507ca9bc0476 ("[PATCH] USB: add ability for usb-serial drivers to determine if their write urb is currently being used.")
    Cc: stable # 2.6.13
    Acked-by: Sebastian Andrzej Siewior
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 7353cad7ee4deaefc16e94727e69285563e219f6 upstream.

    The write() callback can be called in interrupt context (e.g. when used
    as a console) so interrupts must be disabled while holding the port lock
    to prevent a possible deadlock.

    Fixes: e81ee637e4ae ("usb-serial: possible irq lock inversion (PPP vs. usb/serial)")
    Fixes: 507ca9bc0476 ("[PATCH] USB: add ability for usb-serial drivers to determine if their write urb is currently being used.")
    Cc: stable # 2.6.19
    Acked-by: Sebastian Andrzej Siewior
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 696c541c8c6cfa05d65aa24ae2b9e720fc01766e upstream.

    Commit c528fcb116e6 ("USB: serial: keyspan_pda: fix receive sanity
    checks") broke write-unthrottle handling by dropping well-formed
    unthrottle-interrupt packets which are precisely two bytes long. This
    could lead to blocked writers not being woken up when buffer space again
    becomes available.

    Instead, stop unconditionally printing the third byte which is
    (presumably) only valid on modem-line changes.

    Fixes: c528fcb116e6 ("USB: serial: keyspan_pda: fix receive sanity checks")
    Cc: stable # 4.11
    Acked-by: Sebastian Andrzej Siewior
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 5098e77962e7c8947f87bd8c5869c83e000a522a upstream.

    The driver must not call tty_wakeup() while holding its private lock as
    line disciplines are allowed to call back into write() from
    write_wakeup(), leading to a deadlock.

    Also remove the unneeded work struct that was used to defer wakeup in
    order to work around a possible race in ancient times (see comment about
    n_tty write_chan() in commit 14b54e39b412 ("USB: serial: remove
    changelogs and old todo entries")).

    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 975323ab8f116667676c30ca3502a6757bd89e8d upstream.

    The parallel-port restore operations is called when a driver claims the
    port and is supposed to restore the provided state (e.g. saved when
    releasing the port).

    Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
    Cc: stable # 2.6.35
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 3577afb0052fca65e67efdfc8e0859bb7bac87a6 upstream.

    In commit a2d375eda771 ("dyndbg: refine export, rename to
    dynamic_debug_exec_queries()"), a string is copied before checking it
    isn't NULL. Fix this, report a usage/interface error, and return the
    proper error code.

    Fixes: a2d375eda771 ("dyndbg: refine export, rename to dynamic_debug_exec_queries()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jim Cromie
    Link: https://lore.kernel.org/r/20201209183625.2432329-1-jim.cromie@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Jim Cromie
     
  • commit 406100f3da08066c00105165db8520bbc7694a36 upstream.

    One of our machines keeled over trying to rebuild the scheduler domains.
    Mainline produces the same splat:

    BUG: unable to handle page fault for address: 0000607f820054db
    CPU: 2 PID: 149 Comm: kworker/1:1 Not tainted 5.10.0-rc1-master+ #6
    Workqueue: events cpuset_hotplug_workfn
    RIP: build_sched_domains
    Call Trace:
    partition_sched_domains_locked
    rebuild_sched_domains_locked
    cpuset_hotplug_workfn

    It happens with cgroup2 and exclusive cpusets only. This reproducer
    triggers it on an 8-cpu vm and works most effectively with no
    preexisting child cgroups:

    cd $UNIFIED_ROOT
    mkdir cg1
    echo 4-7 > cg1/cpuset.cpus
    echo root > cg1/cpuset.cpus.partition

    # with smt/control reading 'on',
    echo off > /sys/devices/system/cpu/smt/control

    RIP maps to

    sd->shared = *per_cpu_ptr(sdd->sds, sd_id);

    from sd_init(). sd_id is calculated earlier in the same function:

    cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu));
    sd_id = cpumask_first(sched_domain_span(sd));

    tl->mask(cpu), which reads cpu_sibling_map on x86, returns an empty mask
    and so cpumask_first() returns >= nr_cpu_ids, which leads to the bogus
    value from per_cpu_ptr() above.

    The problem is a race between cpuset_hotplug_workfn() and a later
    offline of CPU N. cpuset_hotplug_workfn() updates the effective masks
    when N is still online, the offline clears N from cpu_sibling_map, and
    then the worker uses the stale effective masks that still have N to
    generate the scheduling domains, leading the worker to read
    N's empty cpu_sibling_map in sd_init().

    rebuild_sched_domains_locked() prevented the race during the cgroup2
    cpuset series up until the Fixes commit changed its check. Make the
    check more robust so that it can detect an offline CPU in any exclusive
    cpuset's effective mask, not just the top one.

    Fixes: 0ccea8feb980 ("cpuset: Make generate_sched_domains() work with partition")
    Signed-off-by: Daniel Jordan
    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Tejun Heo
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20201112171711.639541-1-daniel.m.jordan@oracle.com
    Signed-off-by: Greg Kroah-Hartman

    Daniel Jordan
     
  • commit 706657b1febf446a9ba37dc51b89f46604f57ee9 upstream.

    In order to setup its PCI component, the driver needs any node private
    instance in order to get a reference to the PCI device and hand that
    into edac_pci_create_generic_ctl(). For convenience, it uses the 0th
    memory controller descriptor under the assumption that if any, the 0th
    will be always present.

    However, this assumption goes wrong when the 0th node doesn't have
    memory and the driver doesn't initialize an instance for it:

    EDAC amd64: F17h detected (node 0).
    ...
    EDAC amd64: Node 0: No DIMMs detected.

    But looking up node instances is not really needed - all one needs is
    the pointer to the proper device which gets discovered during instance
    init.

    So stash that pointer into a variable and use it when setting up the
    EDAC PCI component.

    Clear that variable when the driver needs to unwind due to some
    instances failing init to avoid any registration imbalance.

    Cc:
    Signed-off-by: Borislav Petkov
    Link: https://lkml.kernel.org/r/20201122150815.13808-1-bp@alien8.de
    Signed-off-by: Greg Kroah-Hartman

    Borislav Petkov
     
  • commit 83ff51c4e3fecf6b8587ce4d46f6eac59f5d7c5a upstream.

    Instead of raw access, use readl() to access MMIO registers of
    memory controller to avoid possible compiler re-ordering.

    Fixes: d4dc89d069aa ("EDAC, i10nm: Add a driver for Intel 10nm server processors")
    Cc:
    Signed-off-by: Qiuxu Zhuo
    Signed-off-by: Tony Luck
    Signed-off-by: Greg Kroah-Hartman

    Qiuxu Zhuo
     
  • commit cf48647243cc28d15280600292db5777592606c5 upstream.

    Sequence counters with an associated write serialization lock are called
    seqcount_LOCKNAME_t. Fix the documentation accordingly.

    While at it, remove a paragraph that inappropriately discussed a
    seqlock.h implementation detail.

    Fixes: 6dd699b13d53 ("seqlock: seqcount_LOCKNAME_t: Standardize naming convention")
    Signed-off-by: Ahmed S. Darwish
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20201206162143.14387-2-a.darwish@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Ahmed S. Darwish
     
  • commit a7b5458ce73b235be027cf2658c39b19b7e58cf2 upstream.

    Don't add platform resources that won't be used. This avoids a
    recently-added warning from the driver core, that can show up on a
    multi-platform kernel when !MACH_IS_MAC.

    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 0 at drivers/base/platform.c:224 platform_get_irq_optional+0x8e/0xce
    0 is an invalid IRQ number
    Modules linked in:
    CPU: 0 PID: 0 Comm: swapper Not tainted 5.9.0-multi #1
    Stack from 004b3f04:
    004b3f04 00462c2f 00462c2f 004b3f20 0002e128 004754db 004b6ad4 004b3f4c
    0002e19c 004754f7 000000e0 00285ba0 00000009 00000000 004b3f44 ffffffff
    004754db 004b3f64 004b3f74 00285ba0 004754f7 000000e0 00000009 004754db
    004fdf0c 005269e2 004fdf0c 00000000 004b3f88 00285cae 004b6964 00000000
    004fdf0c 004b3fac 0051cc68 004b6964 00000000 004b6964 00000200 00000000
    0051cc3e 0023c18a 004b3fc0 0051cd8a 004fdf0c 00000002 0052b43c 004b3fc8
    Call Trace: [] __warn+0xa6/0xd6
    [] warn_slowpath_fmt+0x44/0x76
    [] platform_get_irq_optional+0x8e/0xce
    [] platform_get_irq_optional+0x8e/0xce
    [] platform_get_irq+0x12/0x4c
    [] pmz_init_port+0x2a/0xa6
    [] pmz_init_port+0x0/0xa6
    [] strlen+0x0/0x22
    [] pmz_probe+0x34/0x88
    [] pmz_console_init+0x8/0x28
    [] console_init+0x1e/0x28
    [] printk+0x0/0x16
    [] start_kernel+0x368/0x4ce
    [] _sinittext+0x4f8/0xc48
    random: get_random_bytes called from print_oops_end_marker+0x56/0x80 with crng_init=0
    ---[ end trace 392d8e82eed68d6c ]---

    Commit a85a6c86c25b ("driver core: platform: Clarify that IRQ 0 is invalid"),
    which introduced the WARNING, suggests that testing for irq == 0 is
    undesirable. Instead of that comparison, just test for resource existence.

    Cc: Michael Ellerman
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Joshua Thompson
    Cc: Greg Kroah-Hartman
    Cc: Jiri Slaby
    Cc: stable@vger.kernel.org # v5.8+
    Reported-by: Laurent Vivier
    Signed-off-by: Finn Thain
    Link: https://lore.kernel.org/r/0c0fe1e4f11ccec202d4df09ea7d9d98155d101a.1606001297.git.fthain@telegraphics.com.au
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Greg Kroah-Hartman

    Finn Thain
     
  • commit f3456b9fd269c6d0c973b136c5449d46b2510f4b upstream.

    ARM Cortex-A57 and Cortex-A72 cores running in 32-bit mode are affected
    by silicon errata #1742098 and #1655431, respectively, where the second
    instruction of a AES instruction pair may execute twice if an interrupt
    is taken right after the first instruction consumes an input register of
    which a single 32-bit lane has been updated the last time it was modified.

    This is not such a rare occurrence as it may seem: in counter mode, only
    the least significant 32-bit word is incremented in the absence of a
    carry, which makes our counter mode implementation susceptible to these
    errata.

    So let's shuffle the counter assignments around a bit so that the most
    recent updates when the AES instruction pair executes are 128-bit wide.

    [0] ARM-EPM-049219 v23 Cortex-A57 MPCore Software Developers Errata Notice
    [1] ARM-EPM-012079 v11.0 Cortex-A72 MPCore Software Developers Errata Notice

    Cc: # v5.4+
    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Ard Biesheuvel
     
  • commit 17858b140bf49961b71d4e73f1c3ea9bc8e7dda0 upstream.

    ecdh_set_secret() casts a void* pointer to a const u64* in order to
    feed it into ecc_is_key_valid(). This is not generally permitted by
    the C standard, and leads to actual misalignment faults on ARMv6
    cores. In some cases, these are fixed up in software, but this still
    leads to performance hits that are entirely avoidable.

    So let's copy the key into the ctx buffer first, which we will do
    anyway in the common case, and which guarantees correct alignment.

    Cc:
    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Ard Biesheuvel
     
  • commit e40ad84c26b4deeee46666492ec66b9a534b8e59 upstream.

    When turbo has been disabled by the BIOS, but HWP_CAP.GUARANTEED is
    changed later, user space may want to take advantage of this increased
    guaranteed performance.

    HWP_CAP.GUARANTEED is not a static value. It can be adjusted by an
    out-of-band agent or during an Intel Speed Select performance level
    change. The HWP_CAP.MAX is still the maximum achievable performance
    with turbo disabled by the BIOS, so HWP_CAP.GUARANTEED can still
    change as long as it remains less than or equal to HWP_CAP.MAX.

    When HWP_CAP.GUARANTEED is changed, the sysfs base_frequency
    attribute shows the most recent guaranteed frequency value. This
    attribute can be used by user space software to update the scaling
    min/max limits of the CPU.

    Currently, the ->setpolicy() callback already uses the latest
    HWP_CAP values when setting HWP_REQ, but the ->verify() callback will
    restrict the user settings to the to old guaranteed performance value
    which prevents user space from making use of the extra CPU capacity
    theoretically available to it after increasing HWP_CAP.GUARANTEED.

    To address this, read HWP_CAP in intel_pstate_verify_cpu_policy()
    to obtain the maximum P-state that can be used and use that to
    confine the policy max limit instead of using the cached and
    possibly stale pstate.max_freq value for this purpose.

    For consistency, update intel_pstate_update_perf_limits() to use the
    maximum available P-state returned by intel_pstate_get_hwp_max() to
    compute the maximum frequency instead of using the return value of
    intel_pstate_get_max_freq() which, again, may be stale.

    This issue is a side-effect of fixing the scaling frequency limits in
    commit eacc9c5a927e ("cpufreq: intel_pstate: Fix intel_pstate_get_hwp_max()
    for turbo disabled") which corrected the setting of the reduced scaling
    frequency values, but caused stale HWP_CAP.GUARANTEED to be used in
    the case at hand.

    Fixes: eacc9c5a927e ("cpufreq: intel_pstate: Fix intel_pstate_get_hwp_max() for turbo disabled")
    Reported-by: Srinivas Pandruvada
    Tested-by: Srinivas Pandruvada
    Cc: 5.8+ # 5.8+
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • commit aa8e21c053d72b6639ea5a7f1d3a1d0209534c94 upstream.

    Perf event attritube supports exclude_kernel flag to avoid
    sampling/profiling in supervisor state (kernel). Based on this event
    attr flag, Monitor Mode Control Register bit is set to freeze on
    supervisor state. But sometimes (due to hardware limitation), Sampled
    Instruction Address Register (SIAR) locks on to kernel address even
    when freeze on supervisor is set. Patch here adds a check to drop
    those samples.

    Cc: stable@vger.kernel.org
    Signed-off-by: Athira Rajeev
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/1606289215-1433-1-git-send-email-atrajeev@linux.vnet.ibm.com
    Signed-off-by: Greg Kroah-Hartman

    Athira Rajeev
     
  • commit f8129cd958b395575e5543ce25a8434874b04d3a upstream.

    The cycle count of a timed LBR is always 1 in perf record -D.

    The cycle count is stored in the first 16 bits of the IA32_LBR_x_INFO
    register, but the get_lbr_cycles() return Boolean type.

    Use u16 to replace the Boolean type.

    Fixes: 47125db27e47 ("perf/x86/intel/lbr: Support Architectural LBR")
    Reported-by: Stephane Eranian
    Signed-off-by: Kan Liang
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20201125213720.15692-2-kan.liang@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Kan Liang
     
  • commit 46b72e1bf4fc571da0c29c6fb3e5b2a2107a4c26 upstream.

    According to the event list from icelake_core_v1.09.json, the encoding
    of the RTM_RETIRED.ABORTED event on Ice Lake should be,
    "EventCode": "0xc9",
    "UMask": "0x04",
    "EventName": "RTM_RETIRED.ABORTED",

    Correct the wrong encoding.

    Fixes: 6017608936c1 ("perf/x86/intel: Add Icelake support")
    Signed-off-by: Kan Liang
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20201125213720.15692-1-kan.liang@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Kan Liang
     
  • commit 306e3e91edf1c6739a55312edd110d298ff498dd upstream.

    The event CYCLE_ACTIVITY.STALLS_MEM_ANY (0x14a3) should be available on
    all 8 GP counters on ICL, but it's only scheduled on the first four
    counters due to the current ICL constraint table.

    Add a line for the CYCLE_ACTIVITY.STALLS_MEM_ANY event in the ICL
    constraint table.
    Correct the comments for the CYCLE_ACTIVITY.CYCLES_MEM_ANY event.

    Fixes: 6017608936c1 ("perf/x86/intel: Add Icelake support")
    Reported-by: Andi Kleen
    Signed-off-by: Kan Liang
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20201019164529.32154-1-kan.liang@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Kan Liang
     
  • commit dcf5aedb24f899d537e21c18ea552c780598d352 upstream.

    Use temporary slots in reclaim function to avoid possible race when
    freeing those.

    While at it, make sure we check CLAIMED flag under page lock in the
    reclaim function to make sure we are not racing with z3fold_alloc().

    Link: https://lkml.kernel.org/r/20201209145151.18994-4-vitaly.wool@konsulko.com
    Signed-off-by: Vitaly Wool
    Cc:
    Cc: Mike Galbraith
    Cc: Sebastian Andrzej Siewior
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Vitaly Wool
     
  • commit fc5488651c7d840c9cad9b0f273f2f31bd03413a upstream.

    Patch series "z3fold: stability / rt fixes".

    Address z3fold stability issues under stress load, primarily in the
    reclaim and free aspects. Besides, it fixes the locking problems that
    were only seen in real-time kernel configuration.

    This patch (of 3):

    There used to be two places in the code where slots could be freed, namely
    when freeing the last allocated handle from the slots and when releasing
    the z3fold header these slots aree linked to. The logic to decide on
    whether to free certain slots was complicated and error prone in both
    functions and it led to failures in RT case.

    To fix that, make free_handle() the single point of freeing slots.

    Link: https://lkml.kernel.org/r/20201209145151.18994-1-vitaly.wool@konsulko.com
    Link: https://lkml.kernel.org/r/20201209145151.18994-2-vitaly.wool@konsulko.com
    Signed-off-by: Vitaly Wool
    Tested-by: Mike Galbraith
    Cc: Sebastian Andrzej Siewior
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Vitaly Wool
     
  • commit 56c90457ebfe9422496aac6ef3d3f0f0ea8b2ec2 upstream.

    I have had reports from two different people that attempts to read the
    analog input channels of the MF624 board fail with an `ETIMEDOUT` error.

    After triggering the conversion, the code calls `comedi_timeout()` with
    `mf6x4_ai_eoc()` as the callback function to check if the conversion is
    complete. The callback returns 0 if complete or `-EBUSY` if not yet
    complete. `comedi_timeout()` returns `-ETIMEDOUT` if it has not
    completed within a timeout period which is propagated as an error to the
    user application.

    The existing code considers the conversion to be complete when the EOLC
    bit is high. However, according to the user manuals for the MF624 and
    MF634 boards, this test is incorrect because EOLC is an active low
    signal that goes high when the conversion is triggered, and goes low
    when the conversion is complete. Fix the problem by inverting the test
    of the EOLC bit state.

    Fixes: 04b565021a83 ("comedi: Humusoft MF634 and MF624 DAQ cards driver")
    Cc: # v4.4+
    Cc: Rostislav Lisovy
    Signed-off-by: Ian Abbott
    Link: https://lore.kernel.org/r/20201207145806.4046-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman

    Ian Abbott
     
  • commit 55d8e6a85bce21f748c42eedea63681219f70523 upstream.

    The Raven and Renoir ACP can be distinguished by the PCI revision.
    Let's do the check very early, otherwise the wrong probe code
    can be run.

    Link: https://lore.kernel.org/alsa-devel/2e4587f8-f602-cf23-4845-fd27a32b1cfc@amd.com/
    Cc:
    Cc: Vijendar Mukunda
    Cc: Mark Brown
    Signed-off-by: Jaroslav Kysela
    Link: https://lore.kernel.org/r/20201208181233.2745726-1-perex@perex.cz
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Jaroslav Kysela
     
  • commit 718c406e1ffaca4eac987b957bbb36ce1090797a upstream.

    Users reported that some Lenovo AMD platforms do not have ACP microphone,
    but the BIOS advertises it via ACPI.

    This patch create a simple DMI table, where those machines with the broken
    BIOS can be added. The DMI description for Lenovo IdeaPad 5 and
    IdeaPad Flex 5 devices are added there.

    Also describe the dmic_acpi_check kernel module parameter in a more
    understandable way.

    Cc:
    Cc: Vijendar Mukunda
    Cc: Mark Brown
    Signed-off-by: Jaroslav Kysela
    Link: https://lore.kernel.org/r/20201208171200.2737620-1-perex@perex.cz
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Jaroslav Kysela
     
  • commit 0d024a8bec084205fdd9fa17479ba91f45f85db3 upstream.

    The cx2072x codec driver defines multiple DAIs with the same stream
    name "Playback" and "Capture". Although the current code works more
    or less as is as the secondary streams are never used, it still leads
    the error message like:
    debugfs: File 'Playback' in directory 'dapm' already present!
    debugfs: File 'Capture' in directory 'dapm' already present!

    Fix it by renaming the secondary streams to unique names.

    Fixes: a497a4363706 ("ASoC: Add support for Conexant CX2072X CODEC")
    Cc:
    Signed-off-by: Takashi Iwai
    Link: https://lore.kernel.org/r/20201208135154.9188-1-tiwai@suse.de
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 0f966cba95c78029f491b433ea95ff38f414a761 upstream.

    Add a per-transaction flag to indicate that the buffer
    must be cleared when the transaction is complete to
    prevent copies of sensitive data from being preserved
    in memory.

    Signed-off-by: Todd Kjos
    Link: https://lore.kernel.org/r/20201120233743.3617529-1-tkjos@google.com
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Todd Kjos
     
  • commit 53a7f655834c7c335bf683f248208d4fbe4b47bc upstream.

    In dasd_alias_disconnect_device_from_lcu the device is removed from any
    list on the LCU. Afterwards the LCU is removed from the lcu list if it
    does not contain devices any longer.

    The lcu->lock protects the lcu from parallel updates. But to cancel all
    workers and wait for completion the lcu->lock has to be unlocked.

    If two devices are removed in parallel and both are removed from the LCU
    the first device that takes the lcu->lock again will delete the LCU because
    it is already empty but the second device also tries to free the LCU which
    leads to a list corruption of the lcu list.

    Fix by removing the device right before the lcu is checked without
    unlocking the lcu->lock in between.

    Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stefan Haberland
    Reviewed-by: Jan Hoeppner
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Stefan Haberland
     
  • commit 0ede91f83aa335da1c3ec68eb0f9e228f269f6d8 upstream.

    dasd_alias_add_device() moves devices to the active_devices list in case
    of a scheduled LCU update regardless if they have previously been in a
    pavgroup or not.

    Example: device A and B are in the same pavgroup.

    Device A has already been in a pavgroup and the private->pavgroup pointer
    is set and points to a valid pavgroup. While going through dasd_add_device
    it is moved from the pavgroup to the active_devices list.

    In parallel device B might be removed from the same pavgroup in
    remove_device_from_lcu() which in turn checks if the group is empty
    and deletes it accordingly because device A has already been removed from
    there.

    When now device A enters remove_device_from_lcu() it is tried to remove it
    from the pavgroup again because the pavgroup pointer is still set and again
    the empty group will be cleaned up which leads to a list corruption.

    Fix by setting private->pavgroup to NULL in dasd_add_device.

    If the device has been the last device on the pavgroup an empty pavgroup
    remains but this will be cleaned up by the scheduled lcu_update which
    iterates over all existing pavgroups.

    Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stefan Haberland
    Reviewed-by: Jan Hoeppner
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Stefan Haberland
     
  • commit a29ea01653493b94ea12bb2b89d1564a265081b6 upstream.

    Prevent _lcu_update from adding a device to a pavgroup if the LCU still
    requires an update. The data is not reliable any longer and in parallel
    devices might have been moved on the lists already.
    This might lead to list corruptions or invalid PAV grouping.
    Only add devices to a pavgroup if the LCU is up to date. Additional steps
    are taken by the scheduled lcu update.

    Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stefan Haberland
    Reviewed-by: Jan Hoeppner
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Stefan Haberland
     
  • commit 658a337a606f48b7ebe451591f7681d383fa115e upstream.

    For an LCU update a read unit address configuration IO is required.
    This is started using sleep_on(), which has early exit paths in case the
    device is not usable for IO. For example when it is in offline processing.

    In those cases the LCU update should fail and not be retried.
    Therefore lcu_update_work checks if EOPNOTSUPP is returned or not.

    Commit 41995342b40c ("s390/dasd: fix endless loop after read unit address configuration")
    accidentally removed the EOPNOTSUPP return code from
    read_unit_address_configuration(), which in turn might lead to an endless
    loop of the LCU update in offline processing.

    Fix by returning EOPNOTSUPP again if the device is not able to perform the
    request.

    Fixes: 41995342b40c ("s390/dasd: fix endless loop after read unit address configuration")
    Cc: stable@vger.kernel.org #5.3
    Signed-off-by: Stefan Haberland
    Reviewed-by: Jan Hoeppner
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Stefan Haberland
     
  • commit 454efcf82ea17d7efeb86ebaa20775a21ec87d27 upstream.

    When a machine check interrupt is triggered during idle, the code
    is using the async timer/clock for idle time calculation. It should use
    the machine check enter timer/clock which is passed to the macro.

    Fixes: 0b0ed657fe00 ("s390: remove critical section cleanup from entry.S")
    Cc: # 5.8
    Reviewed-by: Heiko Carstens
    Signed-off-by: Sven Schnelle
    Signed-off-by: Heiko Carstens
    Signed-off-by: Greg Kroah-Hartman

    Sven Schnelle
     
  • commit e259b3fafa7de362b04ecd86e7fa9a9e9273e5fb upstream.

    During removal of the critical section cleanup the calculation
    of mt_cycles during idle was removed. This causes invalid
    accounting on systems with SMT enabled.

    Fixes: 0b0ed657fe00 ("s390: remove critical section cleanup from entry.S")
    Cc: # 5.8
    Reviewed-by: Heiko Carstens
    Signed-off-by: Sven Schnelle
    Signed-off-by: Heiko Carstens
    Signed-off-by: Greg Kroah-Hartman

    Sven Schnelle
     
  • commit 613775d62ec60202f98d2c5f520e6e9ba6dd4ac4 upstream.

    diag308 subcode 0 performes a clear reset which inlcudes the reset of
    all registers in the system. While this is the preferred behavior when
    loading a normal kernel via kexec it prevents the crash kernel to store
    the register values in the dump. To prevent this use subcode 1 when
    loading a crash kernel instead.

    Fixes: ee337f5469fd ("s390/kexec_file: Add crash support to image loader")
    Cc: # 4.17
    Signed-off-by: Philipp Rudo
    Reported-by: Xiaoying Yan
    Tested-by: Lianbo Jiang
    Signed-off-by: Heiko Carstens
    Signed-off-by: Greg Kroah-Hartman

    Philipp Rudo
     
  • commit b5e438ebd7e808d1d2435159ac4742e01a94b8da upstream.

    Not resetting the SMT siblings might leave them in unpredictable
    state. One of the observed problems was that the CPU timer wasn't
    reset and therefore large system time values where accounted during
    CPU bringup.

    Cc: # 4.0
    Fixes: 10ad34bc76dfb ("s390: add SMT support")
    Reviewed-by: Heiko Carstens
    Signed-off-by: Sven Schnelle
    Signed-off-by: Heiko Carstens
    Signed-off-by: Greg Kroah-Hartman

    Sven Schnelle
     
  • commit 74c64efa1557fef731b59eb813f115436d18078e upstream.

    Since mmap for userspace is based on page alignment, add page alignment
    for iram alloc from pool, otherwise, some good data located in the same
    page of dmab->area maybe touched wrongly by userspace like pulseaudio.

    Signed-off-by: Robin Gong
    Cc:
    Link: https://lore.kernel.org/r/1608221747-3474-1-git-send-email-yibin.gong@nxp.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Robin Gong
     
  • commit 525d9c57d0eeeb660d9b25e5b2d1c95975e3ba95 upstream.

    ASUS PRIME TRX40 PRO-S mobo with 0b05:1918 needs the same quirk alias
    for another ASUS mobo (0b05:1917) for the proper mixer mapping, etc.
    Add the corresponding entry.

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=210783
    Cc:
    Link: https://lore.kernel.org/r/20201221080159.24468-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai