1. 29 Sep, 2023 3 commits
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · acfdcaee
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "A bunch of clk driver fixes for issues found recently:
      
         - Fix the binding for versaclock3 that was introduced this merge
           window so we know what the values are for clk consumers
      
         - Fix a 64-bit division issue in the versaclock3 driver
      
         - Avoid breakage in the versaclock3 driver by rejiggering the enums
           used to layout clks
      
         - Fix the parent name of a clk in the Spreadtrum ums512 clk driver
      
         - Fix a suspend/resume issue in Skyworks Si521xx clk driver where
           regmap restoration fails because writes are wedged
      
         - Return zero from Tegra bpmp recalc_rate() implementation when an
           error occurs so we don't consider an error as a large rate"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: tegra: fix error return case for recalc_rate
        clk: si521xx: Fix regmap write accessor
        clk: si521xx: Use REGCACHE_FLAT instead of NONE
        clk: sprd: Fix thm_parents incorrect configuration
        clk: vc3: Make vc3_clk_mux enum values based on vc3_clk enum values
        clk: vc3: Fix output clock mapping
        clk: vc3: Fix 64 by 64 division
        dt-bindings: clock: versaclock3: Add description for #clock-cells property
      acfdcaee
    • Linus Torvalds's avatar
      Merge tag 'for-v6.6-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply · 94b7ed38
      Linus Torvalds authored
      Pull power supply fixes from Sebastian Reichel:
      
       - core: fix use after free during device release
      
       - ab8500: avoid reporting multiple batteries to userspace
      
       - rk817: fix DT node resource leak
      
       - misc. small fixes, mostly for compiler warnings/errors
      
      * tag 'for-v6.6-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
        power: supply: rk817: Fix node refcount leak
        power: supply: core: fix use after free in uevent
        power: supply: rt9467: Fix rt9467_run_aicl()
        power: supply: rk817: Add missing module alias
        power: supply: ucs1002: fix error code in ucs1002_get_property()
        power: vexpress: fix -Wvoid-pointer-to-enum-cast warning
        power: reset: use capital "OR" for multiple licenses in SPDX
        pwr-mlxbf: extend Kconfig to include gpio-mlxbf3 dependency
        power: supply: rt5033_charger: recognize EXTCON setting
        power: supply: mt6370: Fix missing error code in mt6370_chg_toggle_cfo()
        power: supply: ab8500: Set typing and props
      94b7ed38
    • Linus Torvalds's avatar
      Merge tag 'xtensa-20230928' of https://github.com/jcmvbkbc/linux-xtensa · b02afe1d
      Linus Torvalds authored
      Pull Xtensa fixes from Max Filippov:
      
       - fix build warnings from builds performed with W=1
      
      * tag 'xtensa-20230928' of https://github.com/jcmvbkbc/linux-xtensa:
        xtensa: boot/lib: fix function prototypes
        xtensa: umulsidi3: fix conditional expression
        xtensa: boot: don't add include-dirs
        xtensa: iss/network: make functions static
        xtensa: tlb: include <asm/tlb.h> for missing prototype
        xtensa: hw_breakpoint: include header for missing prototype
        xtensa: smp: add headers for missing function prototypes
        irqchip: irq-xtensa-mx: include header for missing prototype
        xtensa: traps: add <linux/cpu.h> for function prototype
        xtensa: stacktrace: include <asm/ftrace.h> for prototype
        xtensa: signal: include headers for function prototypes
        xtensa: processor.h: add init_arch() prototype
        xtensa: ptrace: add prototypes to <asm/ptrace.h>
        xtensa: irq: include <asm/traps.h>
        xtensa: fault: include <asm/traps.h>
        xtensa: add default definition for XCHAL_HAVE_DIV32
      b02afe1d
  2. 28 Sep, 2023 3 commits
  3. 27 Sep, 2023 7 commits
  4. 26 Sep, 2023 5 commits
    • Linus Torvalds's avatar
      Merge tag 'wq-for-6.6-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq · 0e945134
      Linus Torvalds authored
      Pull workqueue fixes from Tejun Heo:
      
       - Remove double allocation of wq_update_pod_attrs_buf
      
       - Fix missing allocation of pwq_release_worker when
         wq_cpu_intensive_thresh_us is set to a custom value
      
      * tag 'wq-for-6.6-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
        workqueue: Fix missed pwq_release_worker creation in wq_cpu_intensive_thresh_init()
        workqueue: Removed double allocation of wq_update_pod_attrs_buf
      0e945134
    • Linus Torvalds's avatar
      Merge tag 'for-6.6-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · cac405a3
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
      
       - delayed refs fixes:
           - fix race when refilling delayed refs block reserve
           - prevent transaction block reserve underflow when starting
             transaction
           - error message and value adjustments
      
       - fix build warnings with CONFIG_CC_OPTIMIZE_FOR_SIZE and
         -Wmaybe-uninitialized
      
       - fix for smatch report where uninitialized data from invalid extent
         buffer range could be returned to the caller
      
       - fix numeric overflow in statfs when calculating lower threshold
         for a full filesystem
      
      * tag 'for-6.6-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: initialize start_slot in btrfs_log_prealloc_extents
        btrfs: make sure to initialize start and len in find_free_dev_extent
        btrfs: reset destination buffer when read_extent_buffer() gets invalid range
        btrfs: properly report 0 avail for very full file systems
        btrfs: log message if extent item not found when running delayed extent op
        btrfs: remove redundant BUG_ON() from __btrfs_inc_extent_ref()
        btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1
        btrfs: prevent transaction block reserve underflow when starting transaction
        btrfs: fix race when refilling delayed refs block reserve
      cac405a3
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-fixes-6.6-rc4' of... · 50768a42
      Linus Torvalds authored
      Merge tag 'linux-kselftest-fixes-6.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull kselftest fix from Shuah Khan:
       "One single fix to unmount tracefs when test created mount"
      
      * tag 'linux-kselftest-fixes-6.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/user_events: Fix to unmount tracefs when test created mount
      50768a42
    • Linus Torvalds's avatar
      Merge tag 'v6.6-rc4.vfs.fixes' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs · 84422aee
      Linus Torvalds authored
      Pull vfs fixes from Christian Brauner:
       "This contains the usual miscellaneous fixes and cleanups for vfs and
        individual fses:
      
        Fixes:
         - Revert ki_pos on error from buffered writes for direct io fallback
         - Add missing documentation for block device and superblock handling
           for changes merged this cycle
         - Fix reiserfs flexible array usage
         - Ensure that overlayfs sets ctime when setting mtime and atime
         - Disable deferred caller completions with overlayfs writes until
           proper support exists
      
        Cleanups:
         - Remove duplicate initialization in pipe code
         - Annotate aio kioctx_table with __counted_by"
      
      * tag 'v6.6-rc4.vfs.fixes' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs:
        overlayfs: set ctime when setting mtime and atime
        ntfs3: put resources during ntfs_fill_super()
        ovl: disable IOCB_DIO_CALLER_COMP
        porting: document superblock as block device holder
        porting: document new block device opening order
        fs/pipe: remove duplicate "offset" initializer
        fs-writeback: do not requeue a clean inode having skipped pages
        aio: Annotate struct kioctx_table with __counted_by
        direct_write_fallback(): on error revert the ->ki_pos update from buffered write
        reiserfs: Replace 1-element array with C99 style flex-array
      84422aee
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v6.6-1-2023-09-25' of... · 5c519bc0
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v6.6-1-2023-09-25' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
      
      Pull perf tools fixes from Namhyung Kim:
       "Build:
      
         - Update header files in the tools/**/include directory to sync with
           the kernel sources as usual.
      
         - Remove unused bpf-prologue files. While it's not strictly a fix,
           but the functionality was removed in this cycle so better to get
           rid of the code together.
      
         - Other minor build fixes.
      
        Misc:
      
         - Fix uninitialized memory access in PMU parsing code
      
         - Fix segfaults on software event"
      
      * tag 'perf-tools-fixes-for-v6.6-1-2023-09-25' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools:
        perf jevent: fix core dump on software events on s390
        perf pmu: Ensure all alias variables are initialized
        perf jevents metric: Fix type of strcmp_cpuid_str
        perf trace: Avoid compile error wrt redefining bool
        perf bpf-prologue: Remove unused file
        tools headers UAPI: Update tools's copy of drm.h headers
        tools arch x86: Sync the msr-index.h copy with the kernel sources
        perf bench sched-seccomp-notify: Use the tools copy of seccomp.h UAPI
        tools headers UAPI: Copy seccomp.h to be able to build 'perf bench' in older systems
        tools headers UAPI: Sync files changed by new fchmodat2 and map_shadow_stack syscalls with the kernel sources
        perf tools: Update copy of libbpf's hashmap.c
      5c519bc0
  5. 25 Sep, 2023 5 commits
  6. 24 Sep, 2023 4 commits
    • Linus Torvalds's avatar
      Linux 6.6-rc3 · 6465e260
      Linus Torvalds authored
      6465e260
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 8a511e7e
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
      "ARM:
      
         - Fix EL2 Stage-1 MMIO mappings where a random address was used
      
         - Fix SMCCC function number comparison when the SVE hint is set
      
        RISC-V:
      
         - Fix KVM_GET_REG_LIST API for ISA_EXT registers
      
         - Fix reading ISA_EXT register of a missing extension
      
         - Fix ISA_EXT register handling in get-reg-list test
      
         - Fix filtering of AIA registers in get-reg-list test
      
        x86:
      
         - Fixes for TSC_AUX virtualization
      
         - Stop zapping page tables asynchronously, since we don't zap them as
           often as before"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: SVM: Do not use user return MSR support for virtualized TSC_AUX
        KVM: SVM: Fix TSC_AUX virtualization setup
        KVM: SVM: INTERCEPT_RDTSCP is never intercepted anyway
        KVM: x86/mmu: Stop zapping invalidated TDP MMU roots asynchronously
        KVM: x86/mmu: Do not filter address spaces in for_each_tdp_mmu_root_yield_safe()
        KVM: x86/mmu: Open code leaf invalidation from mmu_notifier
        KVM: riscv: selftests: Selectively filter-out AIA registers
        KVM: riscv: selftests: Fix ISA_EXT register handling in get-reg-list
        RISC-V: KVM: Fix riscv_vcpu_get_isa_ext_single() for missing extensions
        RISC-V: KVM: Fix KVM_GET_REG_LIST API for ISA_EXT registers
        KVM: selftests: Assert that vasprintf() is successful
        KVM: arm64: nvhe: Ignore SVE hint in SMCCC function ID
        KVM: arm64: Properly return allocated EL2 VA from hyp_alloc_private_va_range()
      8a511e7e
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 5edc6bb3
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Fix the "bytes" output of the per_cpu stat file
      
         The tracefs/per_cpu/cpu*/stats "bytes" was giving bogus values as the
         accounting was not accurate. It is suppose to show how many used
         bytes are still in the ring buffer, but even when the ring buffer was
         empty it would still show there were bytes used.
      
       - Fix a bug in eventfs where reading a dynamic event directory (open)
         and then creating a dynamic event that goes into that diretory screws
         up the accounting.
      
         On close, the newly created event dentry will get a "dput" without
         ever having a "dget" done for it. The fix is to allocate an array on
         dir open to save what dentries were actually "dget" on, and what ones
         to "dput" on close.
      
      * tag 'trace-v6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        eventfs: Remember what dentries were created on dir open
        ring-buffer: Fix bytes info in per_cpu buffer stats
      5edc6bb3
    • Linus Torvalds's avatar
      Merge tag 'cxl-fixes-6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl · 2ad78f8c
      Linus Torvalds authored
      Pull cxl fixes from Dan Williams:
       "A collection of regression fixes, bug fixes, and some small cleanups
        to the Compute Express Link code.
      
        The regressions arrived in the v6.5 dev cycle and missed the v6.6
        merge window due to my personal absences this cycle. The most
        important fixes are for scenarios where the CXL subsystem fails to
        parse valid region configurations established by platform firmware.
        This is important because agreement between OS and BIOS on the CXL
        configuration is fundamental to implementing "OS native" error
        handling, i.e. address translation and component failure
        identification.
      
        Other important fixes are a driver load error when the BIOS lets the
        Linux PCI core handle AER events, but not CXL memory errors.
      
        The other fixex might have end user impact, but for now are only known
        to trigger in our test/emulation environment.
      
        Summary:
      
         - Fix multiple scenarios where platform firmware defined regions fail
           to be assembled by the CXL core.
      
         - Fix a spurious driver-load failure on platforms that enable OS
           native AER, but not OS native CXL error handling.
      
         - Fix a regression detecting "poison" commands when "security"
           commands are also defined.
      
         - Fix a cxl_test regression with the move to centralize CXL port
           register enumeration in the CXL core.
      
         - Miscellaneous small fixes and cleanups"
      
      * tag 'cxl-fixes-6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl:
        cxl/acpi: Annotate struct cxl_cxims_data with __counted_by
        cxl/port: Fix cxl_test register enumeration regression
        cxl/region: Refactor granularity select in cxl_port_setup_targets()
        cxl/region: Match auto-discovered region decoders by HPA range
        cxl/mbox: Fix CEL logic for poison and security commands
        cxl/pci: Replace host_bridge->native_aer with pcie_aer_is_native()
        PCI/AER: Export pcie_aer_is_native()
        cxl/pci: Fix appropriate checking for _OSC while handling CXL RAS registers
      2ad78f8c
  7. 23 Sep, 2023 13 commits
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · 3aba70ae
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - fix an invalid usage of __free(kfree) leading to kfreeing an
         ERR_PTR()
      
       - fix an irq domain leak in gpio-tb10x
      
       - MAINTAINERS update
      
      * tag 'gpio-fixes-for-v6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: sim: fix an invalid __free() usage
        gpio: tb10x: Fix an error handling path in tb10x_gpio_probe()
        MAINTAINERS: gpio-regmap: make myself a maintainer of it
      3aba70ae
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2023-09-23-10-31' of... · 85eba5f1
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2023-09-23-10-31' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull misc fixes from Andrew Morton:
       "13 hotfixes, 10 of which pertain to post-6.5 issues. The other three
        are cc:stable"
      
      * tag 'mm-hotfixes-stable-2023-09-23-10-31' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        proc: nommu: fix empty /proc/<pid>/maps
        filemap: add filemap_map_order0_folio() to handle order0 folio
        proc: nommu: /proc/<pid>/maps: release mmap read lock
        mm: memcontrol: fix GFP_NOFS recursion in memory.high enforcement
        pidfd: prevent a kernel-doc warning
        argv_split: fix kernel-doc warnings
        scatterlist: add missing function params to kernel-doc
        selftests/proc: fixup proc-empty-vm test after KSM changes
        revert "scripts/gdb/symbols: add specific ko module load command"
        selftests: link libasan statically for tests with -fsanitize=address
        task_work: add kerneldoc annotation for 'data' argument
        mm: page_alloc: fix CMA and HIGHATOMIC landing on the wrong buddy list
        sh: mm: re-add lost __ref to ioremap_prot() to fix modpost warning
      85eba5f1
    • Linus Torvalds's avatar
      Merge tag '6.6-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 · 8565bdf8
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
       "Six smb3 client fixes, including three for stable, from the SMB
        plugfest (testing event) this week:
      
         - Reparse point handling fix (found when investigating dir
           enumeration when fifo in dir)
      
         - Fix excessive thread creation for dir lease cleanup
      
         - UAF fix in negotiate path
      
         - remove duplicate error message mapping and fix confusing warning
           message
      
         - add dynamic trace point to improve debugging RDMA connection
           attempts"
      
      * tag '6.6-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        smb3: fix confusing debug message
        smb: client: handle STATUS_IO_REPARSE_TAG_NOT_HANDLED
        smb3: remove duplicate error mapping
        cifs: Fix UAF in cifs_demultiplex_thread()
        smb3: do not start laundromat thread when dir leases  disabled
        smb3: Add dynamic trace points for RDMA (smbdirect) reconnect
      8565bdf8
    • Linus Torvalds's avatar
      Merge tag 'i2c-for-6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 5a4de7dc
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "A set of I2C driver fixes. Mostly fixing resource leaks or sanity
        checks"
      
      * tag 'i2c-for-6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: xiic: Correct return value check for xiic_reinit()
        i2c: mux: gpio: Add missing fwnode_handle_put()
        i2c: mux: demux-pinctrl: check the return value of devm_kstrdup()
        i2c: designware: fix __i2c_dw_disable() in case master is holding SCL low
        i2c: i801: unregister tco_pdev in i801_probe() error path
      5a4de7dc
    • Charles Keepax's avatar
      mfd: cs42l43: Use correct macro for new-style PM runtime ops · eb72d520
      Charles Keepax authored
      The code was accidentally mixing new and old style macros, update the
      macros used to remove an unused function warning whilst building with
      no PM enabled in the config.
      
      Fixes: ace6d144 ("mfd: cs42l43: Add support for cs42l43 core driver")
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Link: https://lore.kernel.org/all/20230822114914.340359-1-ckeepax@opensource.cirrus.com/Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Tested-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: default avatarLee Jones <lee@kernel.org>
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      eb72d520
    • Linus Torvalds's avatar
      Merge tag 'loongarch-fixes-6.6-1' of... · 93397d3a
      Linus Torvalds authored
      Merge tag 'loongarch-fixes-6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
      
      Pull LoongArch fixes from Huacai Chen:
       "Fix lockdep, fix a boot failure, fix some build warnings, fix document
        links, and some cleanups"
      
      * tag 'loongarch-fixes-6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
        docs/zh_CN/LoongArch: Update the links of ABI
        docs/LoongArch: Update the links of ABI
        LoongArch: Don't inline kasan_mem_to_shadow()/kasan_shadow_to_mem()
        kasan: Cleanup the __HAVE_ARCH_SHADOW_MAP usage
        LoongArch: Set all reserved memblocks on Node#0 at initialization
        LoongArch: Remove dead code in relocate_new_kernel
        LoongArch: Use _UL() and _ULL()
        LoongArch: Fix some build warnings with W=1
        LoongArch: Fix lockdep static memory detection
      93397d3a
    • Linus Torvalds's avatar
      Merge tag 's390-6.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 2e3d3911
      Linus Torvalds authored
      Pull s390 fixes from Vasily Gorbik:
      
       - Fix potential string buffer overflow in hypervisor user-defined
         certificates handling
      
       - Update defconfigs
      
      * tag 's390-6.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/cert_store: fix string length handling
        s390: update defconfigs
      2e3d3911
    • Linus Torvalds's avatar
      Merge tag 'iomap-6.6-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · 59c376d6
      Linus Torvalds authored
      Pull iomap fixes from Darrick Wong:
      
       - Return EIO on bad inputs to iomap_to_bh instead of BUGging, to deal
         less poorly with block device io racing with block device resizing
      
       - Fix a stale page data exposure bug introduced in 6.6-rc1 when
         unsharing a file range that is not in the page cache
      
      * tag 'iomap-6.6-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        iomap: convert iomap_unshare_iter to use large folios
        iomap: don't skip reading in !uptodate folios when unsharing a range
        iomap: handle error conditions more gracefully in iomap_to_bh
      59c376d6
    • Paolo Bonzini's avatar
      Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD · 5804c19b
      Paolo Bonzini authored
      KVM/riscv fixes for 6.6, take #1
      
      - Fix KVM_GET_REG_LIST API for ISA_EXT registers
      - Fix reading ISA_EXT register of a missing extension
      - Fix ISA_EXT register handling in get-reg-list test
      - Fix filtering of AIA registers in get-reg-list test
      5804c19b
    • Tom Lendacky's avatar
      KVM: SVM: Do not use user return MSR support for virtualized TSC_AUX · 916e3e5f
      Tom Lendacky authored
      When the TSC_AUX MSR is virtualized, the TSC_AUX value is swap type "B"
      within the VMSA. This means that the guest value is loaded on VMRUN and
      the host value is restored from the host save area on #VMEXIT.
      
      Since the value is restored on #VMEXIT, the KVM user return MSR support
      for TSC_AUX can be replaced by populating the host save area with the
      current host value of TSC_AUX. And, since TSC_AUX is not changed by Linux
      post-boot, the host save area can be set once in svm_hardware_enable().
      This eliminates the two WRMSR instructions associated with the user return
      MSR support.
      Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Message-Id: <d381de38eb0ab6c9c93dda8503b72b72546053d7.1694811272.git.thomas.lendacky@amd.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      916e3e5f
    • Tom Lendacky's avatar
      KVM: SVM: Fix TSC_AUX virtualization setup · e0096d01
      Tom Lendacky authored
      The checks for virtualizing TSC_AUX occur during the vCPU reset processing
      path. However, at the time of initial vCPU reset processing, when the vCPU
      is first created, not all of the guest CPUID information has been set. In
      this case the RDTSCP and RDPID feature support for the guest is not in
      place and so TSC_AUX virtualization is not established.
      
      This continues for each vCPU created for the guest. On the first boot of
      an AP, vCPU reset processing is executed as a result of an APIC INIT
      event, this time with all of the guest CPUID information set, resulting
      in TSC_AUX virtualization being enabled, but only for the APs. The BSP
      always sees a TSC_AUX value of 0 which probably went unnoticed because,
      at least for Linux, the BSP TSC_AUX value is 0.
      
      Move the TSC_AUX virtualization enablement out of the init_vmcb() path and
      into the vcpu_after_set_cpuid() path to allow for proper initialization of
      the support after the guest CPUID information has been set.
      
      With the TSC_AUX virtualization support now in the vcpu_set_after_cpuid()
      path, the intercepts must be either cleared or set based on the guest
      CPUID input.
      
      Fixes: 296d5a17 ("KVM: SEV-ES: Use V_TSC_AUX if available instead of RDTSC/MSR_TSC_AUX intercepts")
      Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Message-Id: <4137fbcb9008951ab5f0befa74a0399d2cce809a.1694811272.git.thomas.lendacky@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e0096d01
    • Paolo Bonzini's avatar
      KVM: SVM: INTERCEPT_RDTSCP is never intercepted anyway · e8d93d5d
      Paolo Bonzini authored
      svm_recalc_instruction_intercepts() is always called at least once
      before the vCPU is started, so the setting or clearing of the RDTSCP
      intercept can be dropped from the TSC_AUX virtualization support.
      
      Extracted from a patch by Tom Lendacky.
      
      Cc: stable@vger.kernel.org
      Fixes: 296d5a17 ("KVM: SEV-ES: Use V_TSC_AUX if available instead of RDTSC/MSR_TSC_AUX intercepts")
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e8d93d5d
    • Sean Christopherson's avatar
      KVM: x86/mmu: Stop zapping invalidated TDP MMU roots asynchronously · 0df9dab8
      Sean Christopherson authored
      Stop zapping invalidate TDP MMU roots via work queue now that KVM
      preserves TDP MMU roots until they are explicitly invalidated.  Zapping
      roots asynchronously was effectively a workaround to avoid stalling a vCPU
      for an extended during if a vCPU unloaded a root, which at the time
      happened whenever the guest toggled CR0.WP (a frequent operation for some
      guest kernels).
      
      While a clever hack, zapping roots via an unbound worker had subtle,
      unintended consequences on host scheduling, especially when zapping
      multiple roots, e.g. as part of a memslot.  Because the work of zapping a
      root is no longer bound to the task that initiated the zap, things like
      the CPU affinity and priority of the original task get lost.  Losing the
      affinity and priority can be especially problematic if unbound workqueues
      aren't affined to a small number of CPUs, as zapping multiple roots can
      cause KVM to heavily utilize the majority of CPUs in the system, *beyond*
      the CPUs KVM is already using to run vCPUs.
      
      When deleting a memslot via KVM_SET_USER_MEMORY_REGION, the async root
      zap can result in KVM occupying all logical CPUs for ~8ms, and result in
      high priority tasks not being scheduled in in a timely manner.  In v5.15,
      which doesn't preserve unloaded roots, the issues were even more noticeable
      as KVM would zap roots more frequently and could occupy all CPUs for 50ms+.
      
      Consuming all CPUs for an extended duration can lead to significant jitter
      throughout the system, e.g. on ChromeOS with virtio-gpu, deleting memslots
      is a semi-frequent operation as memslots are deleted and recreated with
      different host virtual addresses to react to host GPU drivers allocating
      and freeing GPU blobs.  On ChromeOS, the jitter manifests as audio blips
      during games due to the audio server's tasks not getting scheduled in
      promptly, despite the tasks having a high realtime priority.
      
      Deleting memslots isn't exactly a fast path and should be avoided when
      possible, and ChromeOS is working towards utilizing MAP_FIXED to avoid the
      memslot shenanigans, but KVM is squarely in the wrong.  Not to mention
      that removing the async zapping eliminates a non-trivial amount of
      complexity.
      
      Note, one of the subtle behaviors hidden behind the async zapping is that
      KVM would zap invalidated roots only once (ignoring partial zaps from
      things like mmu_notifier events).  Preserve this behavior by adding a flag
      to identify roots that are scheduled to be zapped versus roots that have
      already been zapped but not yet freed.
      
      Add a comment calling out why kvm_tdp_mmu_invalidate_all_roots() can
      encounter invalid roots, as it's not at all obvious why zapping
      invalidated roots shouldn't simply zap all invalid roots.
      Reported-by: default avatarPattara Teerapong <pteerapong@google.com>
      Cc: David Stevens <stevensd@google.com>
      Cc: Yiwei Zhang<zzyiwei@google.com>
      Cc: Paul Hsia <paulhsia@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230916003916.2545000-4-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0df9dab8