28 Sep, 2022

1 commit

  • commit 13b0566962914e167cb3238fbe29ced618f07a27 upstream.

    Due to undocumented, hysterical raisins on x86, the CFI jump-table
    sections in .text are needlessly aligned to PMD_SIZE in the vmlinux
    linker script. When compiling a CFI-enabled arm64 kernel with a 64KiB
    page-size, a PMD maps 512MiB of virtual memory and so the .text section
    increases to a whopping 940MiB and blows the final Image up to 960MiB.
    Others report a link failure.

    Since the CFI jump-table requires only instruction alignment, reduce the
    alignment directives to function alignment for parity with other parts
    of the .text section. This reduces the size of the .text section for the
    aforementioned 64KiB page size arm64 kernel to 19MiB for a much more
    reasonable total Image size of 39MiB.

    Cc: Sami Tolvanen
    Cc: Mark Rutland
    Cc: "Mohan Rao .vanimina"
    Cc: Kees Cook
    Cc: Nathan Chancellor
    Cc:
    Link: https://lore.kernel.org/all/CAL_GTzigiNOMYkOPX1KDnagPhJtFNqSK=1USNbS0wUL4PW6-Uw@mail.gmail.com/
    Fixes: cf68fffb66d6 ("add support for Clang CFI")
    Reviewed-by: Mark Rutland
    Tested-by: Mark Rutland
    Reviewed-by: Sami Tolvanen
    Reviewed-by: Kees Cook
    Link: https://lore.kernel.org/r/20220922215715.13345-1-will@kernel.org
    Signed-off-by: Will Deacon
    Signed-off-by: Greg Kroah-Hartman

    Will Deacon
     

31 Aug, 2022

1 commit

  • commit 0c7d7cc2b4fe2e74ef8728f030f0f1674f9f6aee upstream.

    There are two problems with the current code of memory_intersects:

    First, it doesn't check whether the region (begin, end) falls inside the
    region (virt, vend), that is (virt < begin && vend > end).

    The second problem is if vend is equal to begin, it will return true but
    this is wrong since vend (virt + size) is not the last address of the
    memory region but (virt + size -1) is. The wrong determination will
    trigger the misreporting when the function check_for_illegal_area calls
    memory_intersects to check if the dma region intersects with stext region.

    The misreporting is as below (stext is at 0x80100000):
    WARNING: CPU: 0 PID: 77 at kernel/dma/debug.c:1073 check_for_illegal_area+0x130/0x168
    DMA-API: chipidea-usb2 e0002000.usb: device driver maps memory from kernel text or rodata [addr=800f0000] [len=65536]
    Modules linked in:
    CPU: 1 PID: 77 Comm: usb-storage Not tainted 5.19.0-yocto-standard #5
    Hardware name: Xilinx Zynq Platform
    unwind_backtrace from show_stack+0x18/0x1c
    show_stack from dump_stack_lvl+0x58/0x70
    dump_stack_lvl from __warn+0xb0/0x198
    __warn from warn_slowpath_fmt+0x80/0xb4
    warn_slowpath_fmt from check_for_illegal_area+0x130/0x168
    check_for_illegal_area from debug_dma_map_sg+0x94/0x368
    debug_dma_map_sg from __dma_map_sg_attrs+0x114/0x128
    __dma_map_sg_attrs from dma_map_sg_attrs+0x18/0x24
    dma_map_sg_attrs from usb_hcd_map_urb_for_dma+0x250/0x3b4
    usb_hcd_map_urb_for_dma from usb_hcd_submit_urb+0x194/0x214
    usb_hcd_submit_urb from usb_sg_wait+0xa4/0x118
    usb_sg_wait from usb_stor_bulk_transfer_sglist+0xa0/0xec
    usb_stor_bulk_transfer_sglist from usb_stor_bulk_srb+0x38/0x70
    usb_stor_bulk_srb from usb_stor_Bulk_transport+0x150/0x360
    usb_stor_Bulk_transport from usb_stor_invoke_transport+0x38/0x440
    usb_stor_invoke_transport from usb_stor_control_thread+0x1e0/0x238
    usb_stor_control_thread from kthread+0xf8/0x104
    kthread from ret_from_fork+0x14/0x2c

    Refactor memory_intersects to fix the two problems above.

    Before the 1d7db834a027e ("dma-debug: use memory_intersects()
    directly"), memory_intersects is called only by printk_late_init:

    printk_late_init -> init_section_intersects ->memory_intersects.

    There were few places where memory_intersects was called.

    When commit 1d7db834a027e ("dma-debug: use memory_intersects()
    directly") was merged and CONFIG_DMA_API_DEBUG is enabled, the DMA
    subsystem uses it to check for an illegal area and the calltrace above
    is triggered.

    [akpm@linux-foundation.org: fix nearby comment typo]
    Link: https://lkml.kernel.org/r/20220819081145.948016-1-quanyang.wang@windriver.com
    Fixes: 979559362516 ("asm/sections: add helpers to check for section data")
    Signed-off-by: Quanyang Wang
    Cc: Ard Biesheuvel
    Cc: Arnd Bergmann
    Cc: Thierry Reding
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Quanyang Wang
     

25 Aug, 2022

1 commit

  • commit 415d832497098030241605c52ea83d4e2cfa7879 upstream.

    These operations are documented as always ordered in
    include/asm-generic/bitops/instrumented-atomic.h, and producer-consumer
    type use cases where one side needs to ensure a flag is left pending
    after some shared data was updated rely on this ordering, even in the
    failure case.

    This is the case with the workqueue code, which currently suffers from a
    reproducible ordering violation on Apple M1 platforms (which are
    notoriously out-of-order) that ends up causing the TTY layer to fail to
    deliver data to userspace properly under the right conditions. This
    change fixes that bug.

    Change the documentation to restrict the "no order on failure" story to
    the _lock() variant (for which it makes sense), and remove the
    early-exit from the generic implementation, which is what causes the
    missing barrier semantics in that case. Without this, the remaining
    atomic op is fully ordered (including on ARM64 LSE, as of recent
    versions of the architecture spec).

    Suggested-by: Linus Torvalds
    Cc: stable@vger.kernel.org
    Fixes: e986a0d6cb36 ("locking/atomics, asm-generic/bitops/atomic.h: Rewrite using atomic_*() APIs")
    Fixes: 61e02392d3c7 ("locking/atomic/bitops: Document and clarify ordering semantics for failed test_and_{}_bit()")
    Signed-off-by: Hector Martin
    Acked-by: Will Deacon
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Hector Martin
     

03 Aug, 2022

1 commit

  • commit e2a619ca0b38f2114347b7078b8a67d72d457a3d upstream.

    Commit 527701eda5f1 ("lib: Add a generic version of devmem_is_allowed()")
    introduces the config symbol GENERIC_LIB_DEVMEM_IS_ALLOWED, but then
    falsely refers to CONFIG_GENERIC_DEVMEM_IS_ALLOWED (note the missing LIB
    in the reference) in ./include/asm-generic/io.h.

    Luckily, ./scripts/checkkconfigsymbols.py warns on non-existing configs:

    GENERIC_DEVMEM_IS_ALLOWED
    Referencing files: include/asm-generic/io.h

    The actual fix, though, is simply to not to make this function declaration
    dependent on any kernel config. For architectures that intend to use
    the generic version, the arch's 'select GENERIC_LIB_DEVMEM_IS_ALLOWED' will
    lead to picking the function definition, and for other architectures, this
    function is simply defined elsewhere.

    The wrong '#ifndef' on a non-existing config symbol also always had the
    same effect (although more by mistake than by intent). So, there is no
    functional change.

    Remove this broken and needless ifdef conditional.

    Fixes: 527701eda5f1 ("lib: Add a generic version of devmem_is_allowed()")
    Signed-off-by: Lukas Bulwahn
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Lukas Bulwahn
     

20 Apr, 2022

1 commit

  • [ Upstream commit 697a1d44af8ba0477ee729e632f4ade37999249a ]

    tlb_remove_huge_tlb_entry only considers PMD_SIZE and PUD_SIZE when
    updating the mmu_gather structure.

    Unfortunately on arm64 there are two additional huge page sizes that
    need to be covered: CONT_PTE_SIZE and CONT_PMD_SIZE. Where an end-user
    attempts to employ contiguous huge pages, a VM_BUG_ON can be experienced
    due to the fact that the tlb structure hasn't been correctly updated by
    the relevant tlb_flush_p.._range() call from tlb_remove_huge_tlb_entry.

    This patch adds inequality logic to the generic implementation of
    tlb_remove_huge_tlb_entry s.t. CONT_PTE_SIZE and CONT_PMD_SIZE are
    effectively covered on arm64. Also, as well as ptes, pmds and puds;
    p4ds are now considered too.

    Reported-by: David Hildenbrand
    Suggested-by: Peter Zijlstra (Intel)
    Cc: Anshuman Khandual
    Cc: Catalin Marinas
    Cc: Will Deacon
    Link: https://lore.kernel.org/linux-mm/811c5c8e-b3a2-85d2-049c-717f17c3a03a@redhat.com/
    Signed-off-by: Steve Capper
    Acked-by: David Hildenbrand
    Reviewed-by: Anshuman Khandual
    Reviewed-by: Catalin Marinas
    Acked-by: Peter Zijlstra (Intel)
    Link: https://lore.kernel.org/r/20220330112543.863-1-steve.capper@arm.com
    Signed-off-by: Will Deacon
    Signed-off-by: Sasha Levin

    Steve Capper
     

27 Jan, 2022

1 commit

  • commit b7ec62d7ee0f0b8af6ba190501dff7f9ee6545ca upstream.

    find_first_bit() and find_first_zero_bit() are not protected with
    ifdefs as other functions in find.h. It causes build errors on some
    platforms if CONFIG_GENERIC_FIND_FIRST_BIT is enabled.

    Signed-off-by: Yury Norov
    Fixes: 2cc7b6a44ac2 ("lib: add fast path for find_first_*_bit() and find_last_bit()")
    Reported-by: kernel test robot
    Tested-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Yury Norov
     

09 Oct, 2021

1 commit

  • Pull asm-generic fixes from Arnd Bergmann:
    "There is one build fix for Arm platforms that ended up impacting most
    architectures because of the way the drivers/firmware Kconfig file is
    wired up:

    The CONFIG_QCOM_SCM dependency have caused a number of randconfig
    regressions over time, and some still remain in v5.15-rc4. The fix we
    agreed on in the end is to make this symbol selected by any driver
    using it, and then building it even for non-Arm platforms with
    CONFIG_COMPILE_TEST.

    To make this work on all architectures, the drivers/firmware/Kconfig
    file needs to be included for all architectures to make the symbol
    itself visible.

    In a separate discussion, we found that a sound driver patch that is
    pending for v5.16 needs the same change to include this Kconfig file,
    so the easiest solution seems to have my Kconfig rework included in
    v5.15.

    Finally, the branch also includes a small unrelated build fix for
    NOMMU architectures"

    Link: https://lore.kernel.org/all/20210928153508.101208f8@canb.auug.org.au/
    Link: https://lore.kernel.org/all/20210928075216.4193128-1-arnd@kernel.org/
    Link: https://lore.kernel.org/all/20211007151010.333516-1-arnd@kernel.org/

    * tag 'asm-generic-fixes-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
    asm-generic/io.h: give stub iounmap() on !MMU same prototype as elsewhere
    qcom_scm: hide Kconfig symbol
    firmware: include drivers/firmware/Kconfig unconditionally

    Linus Torvalds
     

08 Oct, 2021

1 commit


20 Sep, 2021

2 commits

  • Nathan Chancellor reports that the recent change to pci_iounmap in
    commit 9caea0007601 ("parisc: Declare pci_iounmap() parisc version only
    when CONFIG_PCI enabled") causes build errors on arm64.

    It took me about two hours to convince myself that I think I know what
    the logic of that mess of #ifdef's in the header file
    really aim to do, and rewrite it to be easier to follow.

    Famous last words.

    Anyway, the code has now been lifted from that grotty header file into
    lib/pci_iomap.c, and has fairly extensive comments about what the logic
    is. It also avoids indirecting through another confusing (and badly
    named) helper function that has other preprocessor config conditionals.

    Let's see what odd architecture did something else strange in this area
    to break things. But my arm64 cross build is clean.

    Fixes: 9caea0007601 ("parisc: Declare pci_iounmap() parisc version only when CONFIG_PCI enabled")
    Reported-by: Nathan Chancellor
    Cc: Helge Deller
    Cc: Arnd Bergmann
    Cc: Guenter Roeck
    Cc: Ulrich Teichert
    Cc: James Bottomley
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Linus noticed odd declaration rules for pci_iounmap() in iomap.h and
    pci_iomap.h, where it dependend on either NO_GENERIC_PCI_IOPORT_MAP or
    GENERIC_IOMAP when CONFIG_PCI was disabled.

    Testing on parisc seems to indicate that we need pci_iounmap() only when
    CONFIG_PCI is enabled, so the declaration of pci_iounmap() can be moved
    cleanly into pci_iomap.h in sync with the declarations of pci_iomap().

    Link: https://lore.kernel.org/all/CAHk-=wjRrh98pZoQ+AzfWmsTZacWxTJKXZ9eKU2X_0+jM=O8nw@mail.gmail.com/
    Signed-off-by: Helge Deller
    Suggested-by: Linus Torvalds
    Fixes: 97a29d59fc22 ("[PARISC] fix compile break caused by iomap: make IOPORT/PCI mapping functions conditional")
    Cc: Arnd Bergmann
    Cc: Guenter Roeck
    Cc: Ulrich Teichert
    Cc: James Bottomley
    Signed-off-by: Linus Torvalds

    Helge Deller
     

16 Sep, 2021

1 commit

  • …ernel/git/hyperv/linux

    Pull hyperv fixes from Wei Liu:

    - Fix kernel crash caused by uio driver (Vitaly Kuznetsov)

    - Remove on-stack cpumask from HV APIC code (Wei Liu)

    * tag 'hyperv-fixes-signed-20210915' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
    x86/hyperv: remove on-stack cpumask from hv_send_ipi_mask_allbutself
    asm-generic/hyperv: provide cpumask_to_vpset_noself
    Drivers: hv: vmbus: Fix kernel crash upon unbinding a device from uio_hv_generic driver

    Linus Torvalds
     

14 Sep, 2021

2 commits

  • Merge patch series from Nick Desaulniers to update the minimum gcc
    version to 5.1.

    This is some of the left-overs from the merge window that I didn't want
    to deal with yesterday, so it comes in after -rc1 but was sent before.

    Gcc-4.9 support has been an annoyance for some time, and with -Werror I
    had the choice of applying a fairly big patch from Kees Cook to remove a
    fair number of initializer warnings (still leaving some), or this patch
    series from Nick that just removes the source of the problem.

    The initializer cleanups might still be worth it regardless, but
    honestly, I preferred just tackling the problem with gcc-4.9 head-on.
    We've been more aggressiuve about no longer having to care about
    compilers that were released a long time ago, and I think it's been a
    good thing.

    I added a couple of patches on top to sort out a few left-overs now that
    we no longer support gcc-4.x.

    As noted by Arnd, as a result of this minimum compiler version upgrade
    we can probably change our use of '--std=gnu89' to '--std=gnu11', and
    finally start using local loop declarations etc. But this series does
    _not_ yet do that.

    Link: https://lore.kernel.org/all/20210909182525.372ee687@canb.auug.org.au/
    Link: https://lore.kernel.org/lkml/CAK7LNASs6dvU6D3jL2GG3jW58fXfaj6VNOe55NJnTB8UPuk2pA@mail.gmail.com/
    Link: https://github.com/ClangBuiltLinux/linux/issues/1438

    * emailed patches from Nick Desaulniers :
    Drop some straggling mentions of gcc-4.9 as being stale
    compiler_attributes.h: drop __has_attribute() support for gcc4
    vmlinux.lds.h: remove old check for GCC 4.9
    compiler-gcc.h: drop checks for older GCC versions
    Makefile: drop GCC < 5 -fno-var-tracking-assignments workaround
    arm64: remove GCC version check for ARCH_SUPPORTS_INT128
    powerpc: remove GCC version check for UPD_CONSTR
    riscv: remove Kconfig check for GCC version for ARCH_RV64I
    Kconfig.debug: drop GCC 5+ version check for DWARF5
    mm/ksm: remove old GCC 4.9+ check
    compiler.h: drop fallback overflow checkers
    Documentation: raise minimum supported version of GCC to 5.1

    Linus Torvalds
     
  • Now that GCC 5.1 is the minimally supported version of GCC, we can
    effectively revert commit 85c2ce9104eb ("sched, vmlinux.lds: Increase
    STRUCT_ALIGNMENT to 64 bytes for GCC-4.9")

    Cc: Peter Zijlstra
    Signed-off-by: Nick Desaulniers
    Acked-by: Kees Cook
    Signed-off-by: Linus Torvalds

    Nick Desaulniers
     

11 Sep, 2021

1 commit


10 Sep, 2021

1 commit

  • Pull ARM development updates from Russell King:

    - Rename "mod_init" and "mod_exit" so that initcall debug output is
    actually useful (Randy Dunlap)

    - Update maintainers entries for linux-arm-kernel to indicate it is
    moderated for non-subscribers (Randy Dunlap)

    - Move install rules to arch/arm/Makefile (Masahiro Yamada)

    - Drop unnecessary ARCH_NR_GPIOS definition (Linus Walleij)

    - Don't warn about atags_to_fdt() stack size (David Heidelberg)

    - Speed up unaligned copy_{from,to}_kernel_nofault (Arnd Bergmann)

    - Get rid of set_fs() usage (Arnd Bergmann)

    - Remove checks for GCC prior to v4.6 (Geert Uytterhoeven)

    * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
    ARM: 9118/1: div64: Remove always-true __div64_const32_is_OK() duplicate
    ARM: 9117/1: asm-generic: div64: Remove always-true __div64_const32_is_OK()
    ARM: 9116/1: unified: Remove check for gcc < 4
    ARM: 9110/1: oabi-compat: fix oabi epoll sparse warning
    ARM: 9113/1: uaccess: remove set_fs() implementation
    ARM: 9112/1: uaccess: add __{get,put}_kernel_nofault
    ARM: 9111/1: oabi-compat: rework fcntl64() emulation
    ARM: 9114/1: oabi-compat: rework sys_semtimedop emulation
    ARM: 9108/1: oabi-compat: rework epoll_wait/epoll_pwait emulation
    ARM: 9107/1: syscall: always store thread_info->abi_syscall
    ARM: 9109/1: oabi-compat: add epoll_pwait handler
    ARM: 9106/1: traps: use get_kernel_nofault instead of set_fs()
    ARM: 9115/1: mm/maccess: fix unaligned copy_{from,to}_kernel_nofault
    ARM: 9105/1: atags_to_fdt: don't warn about stack size
    ARM: 9103/1: Drop ARCH_NR_GPIOS definition
    ARM: 9102/1: move theinstall rules to arch/arm/Makefile
    ARM: 9100/1: MAINTAINERS: mark all linux-arm-kernel@infradead list as moderated
    ARM: 9099/1: crypto: rename 'mod_init' & 'mod_exit' functions to be module-specific

    Linus Torvalds
     

09 Sep, 2021

2 commits

  • Merge more updates from Andrew Morton:
    "147 patches, based on 7d2a07b769330c34b4deabeed939325c77a7ec2f.

    Subsystems affected by this patch series: mm (memory-hotplug, rmap,
    ioremap, highmem, cleanups, secretmem, kfence, damon, and vmscan),
    alpha, percpu, procfs, misc, core-kernel, MAINTAINERS, lib,
    checkpatch, epoll, init, nilfs2, coredump, fork, pids, criu, kconfig,
    selftests, ipc, and scripts"

    * emailed patches from Andrew Morton : (94 commits)
    scripts: check_extable: fix typo in user error message
    mm/workingset: correct kernel-doc notations
    ipc: replace costly bailout check in sysvipc_find_ipc()
    selftests/memfd: remove unused variable
    Kconfig.debug: drop selecting non-existing HARDLOCKUP_DETECTOR_ARCH
    configs: remove the obsolete CONFIG_INPUT_POLLDEV
    prctl: allow to setup brk for et_dyn executables
    pid: cleanup the stale comment mentioning pidmap_init().
    kernel/fork.c: unexport get_{mm,task}_exe_file
    coredump: fix memleak in dump_vma_snapshot()
    fs/coredump.c: log if a core dump is aborted due to changed file permissions
    nilfs2: use refcount_dec_and_lock() to fix potential UAF
    nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group
    nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group
    nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group
    nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group
    nilfs2: fix NULL pointer in nilfs_##name##_attr_release
    nilfs2: fix memory leak in nilfs_sysfs_create_device_group
    trap: cleanup trap_init()
    init: move usermodehelper_enable() to populate_rootfs()
    ...

    Linus Torvalds
     
  • early_ioremap_reset() reserved a weak function so that architectures can
    provide a specific cleanup. Now no architectures use it, remove this
    redundant function.

    Link: https://lkml.kernel.org/r/20210901082917.399953-1-o451686892@gmail.com
    Signed-off-by: Weizhao Ouyang
    Reviewed-by: David Hildenbrand
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Weizhao Ouyang
     

08 Sep, 2021

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "Enumeration:
    - Convert controller drivers to generic_handle_domain_irq() (Marc
    Zyngier)
    - Simplify VPD (Vital Product Data) access and search (Heiner
    Kallweit)
    - Update bnx2, bnx2x, bnxt, cxgb4, cxlflash, sfc, tg3 drivers to use
    simplified VPD interfaces (Heiner Kallweit)
    - Run Max Payload Size quirks before configuring MPS; work around
    ASMedia ASM1062 SATA MPS issue (Marek Behún)

    Resource management:
    - Refactor pci_ioremap_bar() and pci_ioremap_wc_bar() (Krzysztof
    Wilczyński)
    - Optimize pci_resource_len() to reduce kernel size (Zhen Lei)

    PCI device hotplug:
    - Fix a double unmap in ibmphp (Vishal Aslot)

    PCIe port driver:
    - Enable Bandwidth Notification only if port supports it (Stuart
    Hayes)

    Sysfs/proc/syscalls:
    - Add schedule point in proc_bus_pci_read() (Krzysztof Wilczyński)
    - Return ~0 data on pciconfig_read() CAP_SYS_ADMIN failure (Krzysztof
    Wilczyński)
    - Return "int" from pciconfig_read() syscall (Krzysztof Wilczyński)

    Virtualization:
    - Extend "pci=noats" to also turn on Translation Blocking to protect
    against some DMA attacks (Alex Williamson)
    - Add sysfs mechanism to control the type of reset used between
    device assignments to VMs (Amey Narkhede)
    - Add support for ACPI _RST reset method (Shanker Donthineni)
    - Add ACS quirks for Cavium multi-function devices (George Cherian)
    - Add ACS quirks for NXP LX2xx0 and LX2xx2 platforms (Wasim Khan)
    - Allow HiSilicon AMBA devices that appear as fake PCI devices to use
    PASID and SVA (Zhangfei Gao)

    Endpoint framework:
    - Add support for SR-IOV Endpoint devices (Kishon Vijay Abraham I)
    - Zero-initialize endpoint test tool parameters so we don't use
    random parameters (Shunyong Yang)

    APM X-Gene PCIe controller driver:
    - Remove redundant dev_err() call in xgene_msi_probe() (ErKun Yang)

    Broadcom iProc PCIe controller driver:
    - Don't fail devm_pci_alloc_host_bridge() on missing 'ranges' because
    it's optional on BCMA devices (Rob Herring)
    - Fix BCMA probe resource handling (Rob Herring)

    Cadence PCIe driver:
    - Work around J7200 Link training electrical issue by increasing
    delays in LTSSM (Nadeem Athani)

    Intel IXP4xx PCI controller driver:
    - Depend on ARCH_IXP4XX to avoid useless config questions (Geert
    Uytterhoeven)

    Intel Keembay PCIe controller driver:
    - Add Intel Keem Bay PCIe controller (Srikanth Thokala)

    Marvell Aardvark PCIe controller driver:
    - Work around config space completion handling issues (Evan Wang)
    - Increase timeout for config access completions (Pali Rohár)
    - Emulate CRS Software Visibility bit (Pali Rohár)
    - Configure resources from DT 'ranges' property to fix I/O space
    access (Pali Rohár)
    - Serialize INTx mask/unmask (Pali Rohár)

    MediaTek PCIe controller driver:
    - Add MT7629 support in DT (Chuanjia Liu)
    - Fix an MSI issue (Chuanjia Liu)
    - Get syscon regmap ("mediatek,generic-pciecfg"), IRQ number
    ("pci_irq"), PCI domain ("linux,pci-domain") from DT properties if
    present (Chuanjia Liu)

    Microsoft Hyper-V host bridge driver:
    - Add ARM64 support (Boqun Feng)
    - Support "Create Interrupt v3" message (Sunil Muthuswamy)

    NVIDIA Tegra PCIe controller driver:
    - Use seq_puts(), move err_msg from stack to static, fix OF node leak
    (Christophe JAILLET)

    NVIDIA Tegra194 PCIe driver:
    - Disable suspend when in Endpoint mode (Om Prakash Singh)
    - Fix MSI-X address programming error (Om Prakash Singh)
    - Disable interrupts during suspend to avoid spurious AER link down
    (Om Prakash Singh)

    Renesas R-Car PCIe controller driver:
    - Work around hardware issue that prevents Link L1->L0 transition
    (Marek Vasut)
    - Fix runtime PM refcount leak (Dinghao Liu)

    Rockchip DesignWare PCIe controller driver:
    - Add Rockchip RK356X host controller driver (Simon Xue)

    TI J721E PCIe driver:
    - Add support for J7200 and AM64 (Kishon Vijay Abraham I)

    Toshiba Visconti PCIe controller driver:
    - Add Toshiba Visconti PCIe host controller driver (Nobuhiro
    Iwamatsu)

    Xilinx NWL PCIe controller driver:
    - Enable PCIe reference clock via CCF (Hyun Kwon)

    Miscellaneous:
    - Convert sta2x11 from 'pci_' to 'dma_' API (Christophe JAILLET)
    - Fix pci_dev_str_match_path() alloc while atomic bug (used for
    kernel parameters that specify devices) (Dan Carpenter)
    - Remove pointless Precision Time Management warning when PTM is
    present but not enabled (Jakub Kicinski)
    - Remove surplus "break" statements (Krzysztof Wilczyński)"

    * tag 'pci-v5.15-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (132 commits)
    PCI: ibmphp: Fix double unmap of io_mem
    x86/PCI: sta2x11: switch from 'pci_' to 'dma_' API
    PCI/VPD: Use unaligned access helpers
    PCI/VPD: Clean up public VPD defines and inline functions
    cxgb4: Use pci_vpd_find_id_string() to find VPD ID string
    PCI/VPD: Add pci_vpd_find_id_string()
    PCI/VPD: Include post-processing in pci_vpd_find_tag()
    PCI/VPD: Stop exporting pci_vpd_find_info_keyword()
    PCI/VPD: Stop exporting pci_vpd_find_tag()
    PCI: Set dma-can-stall for HiSilicon chips
    PCI: rockchip-dwc: Add Rockchip RK356X host controller driver
    PCI: dwc: Remove surplus break statement after return
    PCI: artpec6: Remove local code block from switch statement
    PCI: artpec6: Remove surplus break statement after return
    MAINTAINERS: Add entries for Toshiba Visconti PCIe controller
    PCI: visconti: Add Toshiba Visconti PCIe host controller driver
    PCI/portdrv: Enable Bandwidth Notification only if port supports it
    PCI: Allow PASID on fake PCIe devices without TLP prefixes
    PCI: mediatek: Use PCI domain to handle ports detection
    PCI: mediatek: Add new method to get irq number
    ...

    Linus Torvalds
     

02 Sep, 2021

3 commits

  • Pull printk updates from Petr Mladek:

    - Optionally, provide an index of possible printk messages via
    /printk/index/. It can be used when monitoring important
    kernel messages on a farm of various hosts. The monitor has to be
    updated when some messages has changed or are not longer available by
    a newly deployed kernel.

    - Add printk.console_no_auto_verbose boot parameter. It allows to
    generate crash dump even with slow consoles in a reasonable time
    frame.

    - Remove printk_safe buffers. The messages are always stored directly
    to the main logbuffer, even in NMI or recursive context. Also it
    allows to serialize syslog operations by a mutex instead of a spin
    lock.

    - Misc clean up and build fixes.

    * tag 'printk-for-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
    printk/index: Fix -Wunused-function warning
    lib/nmi_backtrace: Serialize even messages about idle CPUs
    printk: Add printk.console_no_auto_verbose boot parameter
    printk: Remove console_silent()
    lib/test_scanf: Handle n_bits == 0 in random tests
    printk: syslog: close window between wait and read
    printk: convert @syslog_lock to mutex
    printk: remove NMI tracking
    printk: remove safe buffers
    printk: track/limit recursion
    lib/nmi_backtrace: explicitly serialize banner and regs
    printk: Move the printk() kerneldoc comment to its new home
    printk/index: Fix warning about missing prototypes
    MIPS/asm/printk: Fix build failure caused by printk
    printk: index: Add indexing support to dev_printk
    printk: Userspace format indexing support
    printk: Rework parse_prefix into printk_parse_prefix
    printk: Straighten out log_flags into printk_info_flags
    string_helpers: Escape double quotes in escape_special
    printk/console: Check consistent sequence number when handling race in console_unlock()

    Linus Torvalds
     
  • …rnel/git/hyperv/linux

    Pull hyperv updates from Wei Liu:

    - make Hyper-V code arch-agnostic (Michael Kelley)

    - fix sched_clock behaviour on Hyper-V (Ani Sinha)

    - fix a fault when Linux runs as the root partition on MSHV (Praveen
    Kumar)

    - fix VSS driver (Vitaly Kuznetsov)

    - cleanup (Sonia Sharma)

    * tag 'hyperv-next-signed-20210831' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
    hv_utils: Set the maximum packet size for VSS driver to the length of the receive buffer
    Drivers: hv: Enable Hyper-V code to be built on ARM64
    arm64: efi: Export screen_info
    arm64: hyperv: Initialize hypervisor on boot
    arm64: hyperv: Add panic handler
    arm64: hyperv: Add Hyper-V hypercall and register access utilities
    x86/hyperv: fix root partition faults when writing to VP assist page MSR
    hv: hyperv.h: Remove unused inline functions
    drivers: hv: Decouple Hyper-V clock/timer code from VMbus drivers
    x86/hyperv: add comment describing TSC_INVARIANT_CONTROL MSR setting bit 0
    Drivers: hv: Move Hyper-V misc functionality to arch-neutral code
    Drivers: hv: Add arch independent default functions for some Hyper-V handlers
    Drivers: hv: Make portions of Hyper-V init code be arch neutral
    x86/hyperv: fix for unwanted manipulation of sched_clock when TSC marked unstable
    asm-generic/hyperv: Add missing #include of nmi.h

    Linus Torvalds
     
  • Pull asm-generic updates from Arnd Bergmann:
    "The main content for 5.15 is a series that cleans up the handling of
    strncpy_from_user() and strnlen_user(), removing a lot of slightly
    incorrect versions of these in favor of the lib/strn*.c helpers that
    implement these correctly and more efficiently.

    The only architectures that retain a private version now are mips,
    ia64, um and parisc. I had offered to convert those at all, but Thomas
    Bogendoerfer wanted to keep the mips version for the moment until he
    had a chance to do regression testing.

    The branch also contains two patches for bitops and for ffs()"

    * tag 'asm-generic-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
    bitops/non-atomic: make @nr unsigned to avoid any DIV
    asm-generic: ffs: Drop bogus reference to ffz location
    asm-generic: reverse GENERIC_{STRNCPY_FROM,STRNLEN}_USER symbols
    asm-generic: remove extra strn{cpy_from,len}_user declarations
    asm-generic: uaccess: remove inline strncpy_from_user/strnlen_user
    s390: use generic strncpy/strnlen from_user
    microblaze: use generic strncpy/strnlen from_user
    csky: use generic strncpy/strnlen from_user
    arc: use generic strncpy/strnlen from_user
    hexagon: use generic strncpy/strnlen from_user
    h8300: remove stale strncpy_from_user
    asm-generic/uaccess.h: remove __strncpy_from_user/__strnlen_user

    Linus Torvalds
     

01 Sep, 2021

1 commit

  • Pull networking updates from Jakub Kicinski:
    "Core:

    - Enable memcg accounting for various networking objects.

    BPF:

    - Introduce bpf timers.

    - Add perf link and opaque bpf_cookie which the program can read out
    again, to be used in libbpf-based USDT library.

    - Add bpf_task_pt_regs() helper to access user space pt_regs in
    kprobes, to help user space stack unwinding.

    - Add support for UNIX sockets for BPF sockmap.

    - Extend BPF iterator support for UNIX domain sockets.

    - Allow BPF TCP congestion control progs and bpf iterators to call
    bpf_setsockopt(), e.g. to switch to another congestion control
    algorithm.

    Protocols:

    - Support IOAM Pre-allocated Trace with IPv6.

    - Support Management Component Transport Protocol.

    - bridge: multicast: add vlan support.

    - netfilter: add hooks for the SRv6 lightweight tunnel driver.

    - tcp:
    - enable mid-stream window clamping (by user space or BPF)
    - allow data-less, empty-cookie SYN with TFO_SERVER_COOKIE_NOT_REQD
    - more accurate DSACK processing for RACK-TLP

    - mptcp:
    - add full mesh path manager option
    - add partial support for MP_FAIL
    - improve use of backup subflows
    - optimize option processing

    - af_unix: add OOB notification support.

    - ipv6: add IFLA_INET6_RA_MTU to expose MTU value advertised by the
    router.

    - mac80211: Target Wake Time support in AP mode.

    - can: j1939: extend UAPI to notify about RX status.

    Driver APIs:

    - Add page frag support in page pool API.

    - Many improvements to the DSA (distributed switch) APIs.

    - ethtool: extend IRQ coalesce uAPI with timer reset modes.

    - devlink: control which auxiliary devices are created.

    - Support CAN PHYs via the generic PHY subsystem.

    - Proper cross-chip support for tag_8021q.

    - Allow TX forwarding for the software bridge data path to be
    offloaded to capable devices.

    Drivers:

    - veth: more flexible channels number configuration.

    - openvswitch: introduce per-cpu upcall dispatch.

    - Add internet mix (IMIX) mode to pktgen.

    - Transparently handle XDP operations in the bonding driver.

    - Add LiteETH network driver.

    - Renesas (ravb):
    - support Gigabit Ethernet IP

    - NXP Ethernet switch (sja1105):
    - fast aging support
    - support for "H" switch topologies
    - traffic termination for ports under VLAN-aware bridge

    - Intel 1G Ethernet
    - support getcrosststamp() with PCIe PTM (Precision Time
    Measurement) for better time sync
    - support Credit-Based Shaper (CBS) offload, enabling HW traffic
    prioritization and bandwidth reservation

    - Broadcom Ethernet (bnxt)
    - support pulse-per-second output
    - support larger Rx rings

    - Mellanox Ethernet (mlx5)
    - support ethtool RSS contexts and MQPRIO channel mode
    - support LAG offload with bridging
    - support devlink rate limit API
    - support packet sampling on tunnels

    - Huawei Ethernet (hns3):
    - basic devlink support
    - add extended IRQ coalescing support
    - report extended link state

    - Netronome Ethernet (nfp):
    - add conntrack offload support

    - Broadcom WiFi (brcmfmac):
    - add WPA3 Personal with FT to supported cipher suites
    - support 43752 SDIO device

    - Intel WiFi (iwlwifi):
    - support scanning hidden 6GHz networks
    - support for a new hardware family (Bz)

    - Xen pv driver:
    - harden netfront against malicious backends

    - Qualcomm mobile
    - ipa: refactor power management and enable automatic suspend
    - mhi: move MBIM to WWAN subsystem interfaces

    Refactor:

    - Ambient BPF run context and cgroup storage cleanup.

    - Compat rework for ndo_ioctl.

    Old code removal:

    - prism54 remove the obsoleted driver, deprecated by the p54 driver.

    - wan: remove sbni/granch driver"

    * tag 'net-next-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (1715 commits)
    net: Add depends on OF_NET for LiteX's LiteETH
    ipv6: seg6: remove duplicated include
    net: hns3: remove unnecessary spaces
    net: hns3: add some required spaces
    net: hns3: clean up a type mismatch warning
    net: hns3: refine function hns3_set_default_feature()
    ipv6: remove duplicated 'net/lwtunnel.h' include
    net: w5100: check return value after calling platform_get_resource()
    net/mlxbf_gige: Make use of devm_platform_ioremap_resourcexxx()
    net: mdio: mscc-miim: Make use of the helper function devm_platform_ioremap_resource()
    net: mdio-ipq4019: Make use of devm_platform_ioremap_resource()
    fou: remove sparse errors
    ipv4: fix endianness issue in inet_rtm_getroute_build_skb()
    octeontx2-af: Set proper errorcode for IPv4 checksum errors
    octeontx2-af: Fix static code analyzer reported issues
    octeontx2-af: Fix mailbox errors in nix_rss_flowkey_cfg
    octeontx2-af: Fix loop in free and unmap counter
    af_unix: fix potential NULL deref in unix_dgram_connect()
    dpaa2-eth: Replace strlcpy with strscpy
    octeontx2-af: Use NDC TX for transmit packet data
    ...

    Linus Torvalds
     

21 Aug, 2021

1 commit


20 Aug, 2021

1 commit

  • Since commit cafa0010cd51fb71 ("Raise the minimum required gcc version
    to 4.6"), the kernel can no longer be compiled using gcc-3.
    Hence __div64_const32_is_OK() is always true, and the corresponding
    check can thus be removed.

    While at it, remove the whitespace error that hurts my eyes, and add the
    missing curly braces for the final else statement, as per coding style.

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Arnd Bergmann
    Signed-off-by: Russell King (Oracle)

    Geert Uytterhoeven
     

17 Aug, 2021

1 commit


14 Aug, 2021

1 commit

  • signed math causes generation of costlier instructions such as DIV when
    they could be done by barrerl shifter.

    Worse part is this is not caught by things like bloat-o-meter since
    instruction length / symbols are typically same size.

    e.g.

    stock (signed math)
    __________________

    919b4614 :
    919b4614: div r2,r0,0x20
    ^^^
    919b4618: add2 r2,0x920f6050,r2
    919b4620: ld_s r2,[r2,0]
    919b4622: lsr r0,r2,r0
    919b4626: j_s.d [blink]
    919b4628: bmsk_s r0,r0,0
    919b462a: nop_s

    (patched) unsigned math
    __________________

    919b4614 :
    919b4614: lsr r2,r0,0x5 @nr/32
    ^^^
    919b4618: add2 r2,0x920f6050,r2
    919b4620: ld_s r2,[r2,0]
    919b4622: lsr r0,r2,r0 #test_bit()
    919b4626: j_s.d [blink]
    919b4628: bmsk_s r0,r0,0
    919b462a: nop_s

    Signed-off-by: Vineet Gupta
    Acked-by: Will Deacon
    Signed-off-by: Arnd Bergmann

    Vineet Gupta
     

13 Aug, 2021

2 commits

  • Conflicts:

    drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h
    9e26680733d5 ("bnxt_en: Update firmware call to retrieve TX PTP timestamp")
    9e518f25802c ("bnxt_en: 1PPS functions to configure TSIO pins")
    099fdeda659d ("bnxt_en: Event handler for PPS events")

    kernel/bpf/helpers.c
    include/linux/bpf-cgroup.h
    a2baf4e8bb0f ("bpf: Fix potentially incorrect results with bpf_get_local_storage()")
    c7603cfa04e7 ("bpf: Add ambient BPF runtime context stored in current")

    drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
    5957cc557dc5 ("net/mlx5: Set all field of mlx5_irq before inserting it to the xarray")
    2d0b41a37679 ("net/mlx5: Refcount mlx5_irq with integer")

    MAINTAINERS
    7b637cd52f02 ("MAINTAINERS: fix Microchip CAN BUS Analyzer Tool entry typo")
    7d901a1e878a ("net: phy: add Maxlinear GPY115/21x/24x driver")

    Signed-off-by: Jakub Kicinski

    Jakub Kicinski
     
  • …l/git/arnd/asm-generic into asm-generic

    These two functions appear to be unnecessarily different between
    architectures, and the asm-generic version is a bit questionable,
    even for NOMMU architectures.

    Clean this up to just use the generic library version for anything
    that uses the generic version today. I've expanded on the patch
    descriptions a little, as suggested by Christoph Hellwig, but I
    suspect a more detailed review would uncover additional problems
    with the custom versions that are getting removed.

    I ended up adding patches for csky and microblaze as they had the
    same implementation that I removed elsewhere, these are now gone
    as well.

    * 'asm-generic-uaccess-7' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
    asm-generic: reverse GENERIC_{STRNCPY_FROM,STRNLEN}_USER symbols
    asm-generic: remove extra strn{cpy_from,len}_user declarations
    asm-generic: uaccess: remove inline strncpy_from_user/strnlen_user
    s390: use generic strncpy/strnlen from_user
    microblaze: use generic strncpy/strnlen from_user
    csky: use generic strncpy/strnlen from_user
    arc: use generic strncpy/strnlen from_user
    hexagon: use generic strncpy/strnlen from_user
    h8300: remove stale strncpy_from_user
    asm-generic/uaccess.h: remove __strncpy_from_user/__strnlen_user

    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Arnd Bergmann
     

12 Aug, 2021

1 commit

  • A recent change in LLVM causes module_{c,d}tor sections to appear when
    CONFIG_K{A,C}SAN are enabled, which results in orphan section warnings
    because these are not handled anywhere:

    ld.lld: warning: arch/x86/pci/built-in.a(legacy.o):(.text.asan.module_ctor) is being placed in '.text.asan.module_ctor'
    ld.lld: warning: arch/x86/pci/built-in.a(legacy.o):(.text.asan.module_dtor) is being placed in '.text.asan.module_dtor'
    ld.lld: warning: arch/x86/pci/built-in.a(legacy.o):(.text.tsan.module_ctor) is being placed in '.text.tsan.module_ctor'

    Fangrui explains: "the function asan.module_ctor has the SHF_GNU_RETAIN
    flag, so it is in a separate section even with -fno-function-sections
    (default)".

    Place them in the TEXT_TEXT section so that these technologies continue
    to work with the newer compiler versions. All of the KASAN and KCSAN
    KUnit tests continue to pass after this change.

    Cc: stable@vger.kernel.org
    Link: https://github.com/ClangBuiltLinux/linux/issues/1432
    Link: https://github.com/llvm/llvm-project/commit/7b789562244ee941b7bf2cefeb3fc08a59a01865
    Signed-off-by: Nathan Chancellor
    Reviewed-by: Nick Desaulniers
    Reviewed-by: Fangrui Song
    Acked-by: Marco Elver
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20210731023107.1932981-1-nathan@kernel.org

    Nathan Chancellor
     

11 Aug, 2021

1 commit


04 Aug, 2021

1 commit

  • Since the non-atomic arch_*() bitops use plain accesses, they are
    implicitly instrumnted by the compiler, and we work around this in the
    instrumented wrappers to avoid double instrumentation.

    It's simpler to avoid the wrappers entirely, and use the preprocessor to
    alias the arch_*() bitops to their regular versions, removing the need
    for checks in the instrumented wrappers.

    Suggested-by: Marco Elver
    Signed-off-by: Mark Rutland
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Marco Elver
    Link: https://lore.kernel.org/r/20210721155813.17082-1-mark.rutland@arm.com

    Mark Rutland
     

28 Jul, 2021

1 commit

  • The inline version is used on three NOMMU architectures and is
    particularly inefficient when it scans the string one byte at a time
    twice. It also lacks a check for user_addr_max(), but this is
    probably ok on NOMMU targets.

    Consolidate the asm-generic implementation with the library version
    that is used everywhere else. This version is generalized enough to
    work efficiently on both MMU and NOMMU targets, and using the
    same code everywhere reduces the potential for subtle bugs.

    Mark the prototypes as __must_check in the process.

    Reviewed-by: Geert Uytterhoeven
    Acked-by: Geert Uytterhoeven
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

23 Jul, 2021

2 commits

  • Parts of linux/compat.h are under an #ifdef, but we end up
    using more of those over time, moving things around bit by
    bit.

    To get it over with once and for all, make all of this file
    uncondititonal now so it can be accessed everywhere. There
    are only a few types left that are in asm/compat.h but not
    yet in the asm-generic version, so add those in the process.

    This requires providing a few more types in asm-generic/compat.h
    that were not already there. The only tricky one is
    compat_sigset_t, which needs a little help on 32-bit architectures
    and for x86.

    Signed-off-by: Arnd Bergmann
    Reviewed-by: Christoph Hellwig
    Signed-off-by: David S. Miller

    Arnd Bergmann
     
  • This is a preparation for changing over architectures to the
    generic implementation one at a time. As there are no callers
    of either __strncpy_from_user() or __strnlen_user(), fold these
    into the strncpy_from_user() and strnlen_user() functions to make
    each implementation independent of the others.

    Many of these implementations have known bugs, but the intention
    here is to not change behavior at all and stay compatible with
    those bugs for the moment.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

19 Jul, 2021

2 commits

  • We have a number of systems industry-wide that have a subset of their
    functionality that works as follows:

    1. Receive a message from local kmsg, serial console, or netconsole;
    2. Apply a set of rules to classify the message;
    3. Do something based on this classification (like scheduling a
    remediation for the machine), rinse, and repeat.

    As a couple of examples of places we have this implemented just inside
    Facebook, although this isn't a Facebook-specific problem, we have this
    inside our netconsole processing (for alarm classification), and as part
    of our machine health checking. We use these messages to determine
    fairly important metrics around production health, and it's important
    that we get them right.

    While for some kinds of issues we have counters, tracepoints, or metrics
    with a stable interface which can reliably indicate the issue, in order
    to react to production issues quickly we need to work with the interface
    which most kernel developers naturally use when developing: printk.

    Most production issues come from unexpected phenomena, and as such
    usually the code in question doesn't have easily usable tracepoints or
    other counters available for the specific problem being mitigated. We
    have a number of lines of monitoring defence against problems in
    production (host metrics, process metrics, service metrics, etc), and
    where it's not feasible to reliably monitor at another level, this kind
    of pragmatic netconsole monitoring is essential.

    As one would expect, monitoring using printk is rather brittle for a
    number of reasons -- most notably that the message might disappear
    entirely in a new version of the kernel, or that the message may change
    in some way that the regex or other classification methods start to
    silently fail.

    One factor that makes this even harder is that, under normal operation,
    many of these messages are never expected to be hit. For example, there
    may be a rare hardware bug which one wants to detect if it was to ever
    happen again, but its recurrence is not likely or anticipated. This
    precludes using something like checking whether the printk in question
    was printed somewhere fleetwide recently to determine whether the
    message in question is still present or not, since we don't anticipate
    that it should be printed anywhere, but still need to monitor for its
    future presence in the long-term.

    This class of issue has happened on a number of occasions, causing
    unhealthy machines with hardware issues to remain in production for
    longer than ideal. As a recent example, some monitoring around
    blk_update_request fell out of date and caused semi-broken machines to
    remain in production for longer than would be desirable.

    Searching through the codebase to find the message is also extremely
    fragile, because many of the messages are further constructed beyond
    their callsite (eg. btrfs_printk and other module-specific wrappers,
    each with their own functionality). Even if they aren't, guessing the
    format and formulation of the underlying message based on the aesthetics
    of the message emitted is not a recipe for success at scale, and our
    previous issues with fleetwide machine health checking demonstrate as
    much.

    This provides a solution to the issue of silently changed or deleted
    printks: we record pointers to all printk format strings known at
    compile time into a new .printk_index section, both in vmlinux and
    modules. At runtime, this can then be iterated by looking at
    /printk/index/, which emits the following format, both
    readable by humans and able to be parsed by machines:

    $ head -1 vmlinux; shuf -n 5 vmlinux
    # filename:line function "format"
    block/blk-settings.c:661 disk_stack_limits "%s: Warning: Device %s is misaligned\n"
    kernel/trace/trace.c:8296 trace_create_file "Could not create tracefs '%s' entry\n"
    arch/x86/kernel/hpet.c:144 _hpet_print_config "hpet: %s(%d):\n"
    init/do_mounts.c:605 prepare_namespace "Waiting for root device %s...\n"
    drivers/acpi/osl.c:1410 acpi_no_auto_serialize_setup "ACPI: auto-serialization disabled\n"

    This mitigates the majority of cases where we have a highly-specific
    printk which we want to match on, as we can now enumerate and check
    whether the format changed or the printk callsite disappeared entirely
    in userspace. This allows us to catch changes to printks we monitor
    earlier and decide what to do about it before it becomes problematic.

    There is no additional runtime cost for printk callers or printk itself,
    and the assembly generated is exactly the same.

    Signed-off-by: Chris Down
    Cc: Petr Mladek
    Cc: Jessica Yu
    Cc: Sergey Senozhatsky
    Cc: John Ogness
    Cc: Steven Rostedt
    Cc: Greg Kroah-Hartman
    Cc: Johannes Weiner
    Cc: Kees Cook
    Reviewed-by: Petr Mladek
    Tested-by: Petr Mladek
    Reported-by: kernel test robot
    Acked-by: Andy Shevchenko
    Acked-by: Jessica Yu # for module.{c,h}
    Signed-off-by: Petr Mladek
    Link: https://lore.kernel.org/r/e42070983637ac5e384f17fbdbe86d19c7b212a5.1623775748.git.chris@chrisdown.name

    Chris Down
     
  • Hyper-V clock/timer code in hyperv_timer.c is mostly independent from
    other VMbus drivers, but building for ARM64 without hyperv_timer.c
    shows some remaining entanglements. A default implementation of
    hv_read_reference_counter can just read a Hyper-V synthetic register
    and be independent of hyperv_timer.c, so move this code out and into
    hv_common.c. Then it can be used by the timesync driver even if
    hyperv_timer.c isn't built on a particular architecture. If
    hyperv_timer.c *is* built, it can override with a faster implementation.

    Also provide stubs for stimer functions called by the VMbus driver when
    hyperv_timer.c isn't built.

    No functional changes.

    Signed-off-by: Michael Kelley
    Link: https://lore.kernel.org/r/1626220906-22629-1-git-send-email-mikelley@microsoft.com
    Signed-off-by: Wei Liu

    Michael Kelley
     

17 Jul, 2021

2 commits

  • Now that all architectures provide arch_atomic_long_*(), we can
    implement the generic bitops atop these rather than atop
    atomic_long_*(), and provide arch_*() forms of the bitops that are safe
    to use in noinstr code.

    Now that all architectures provide arch_atomic_long_*(), we can
    build the generic arch_*() bitops atop these, which can be safely used
    in noinstr code. The regular bitop wrappers are built atop these.

    As the generic non-atomic bitops use plain accesses, these will be
    implicitly instrumented unless they are inlined into noinstr functions
    (which is similar to arch_atomic*_read() when based on READ_ONCE()).
    The wrappers are modified so that where the underlying arch_*() function
    uses a plain access, no explicit instrumentation is added, as this is
    redundant and could result in confusing reports.

    Since function prototypes get excessively long with both an `arch_`
    prefix and `__always_inline` attribute, the return type and function
    attributes have been split onto a separate line, matching the style of
    the generated atomic headers.

    Signed-off-by: Mark Rutland
    Signed-off-by: Peter Zijlstra (Intel)
    Link: https://lore.kernel.org/r/20210713105253.7615-6-mark.rutland@arm.com

    Mark Rutland
     
  • The generated atomic headers are only intended to be included directly
    by , but are spread across include/linux/ and
    include/asm-generic/, where people mnay be encouraged to include them.

    This patch centralizes them under include/linux/atomic/.

    Other than the header guards and hashes, there is no change to any of
    the generated headers as a result of this patch.

    Signed-off-by: Mark Rutland
    Signed-off-by: Peter Zijlstra (Intel)
    Link: https://lore.kernel.org/r/20210713105253.7615-4-mark.rutland@arm.com

    Mark Rutland
     

15 Jul, 2021

1 commit

  • The code to allocate and initialize the hv_vp_index array is
    architecture neutral. Similarly, the code to allocate and
    populate the hypercall input and output arg pages is architecture
    neutral. Move both sets of code out from arch/x86 and into
    utility functions in drivers/hv/hv_common.c that can be shared
    by Hyper-V initialization on ARM64.

    No functional changes. However, the allocation of the hypercall
    input and output arg pages is done differently so that the
    size is always the Hyper-V page size, even if not the same as
    the guest page size (such as with ARM64's 64K page size).

    Signed-off-by: Michael Kelley
    Link: https://lore.kernel.org/r/1626287687-2045-2-git-send-email-mikelley@microsoft.com
    Signed-off-by: Wei Liu

    Michael Kelley
     

13 Jul, 2021

1 commit

  • The recent move of hv_do_rep_hypercall() to this file adds
    a reference to touch_nmi_watchdog(). Its function definition
    is included indirectly when compiled on x86, but not when
    compiled on ARM64. So add the explicit #include.

    No functional change.

    Signed-off-by: Michael Kelley
    Link: https://lore.kernel.org/r/1626058204-2106-1-git-send-email-mikelley@microsoft.com
    Signed-off-by: Wei Liu

    Michael Kelley