1. 18 Aug, 2023 10 commits
    • Vineet Gupta's avatar
      6b606c8d
    • Vineet Gupta's avatar
      ARC: entry: rework (non-functional) · c505b0da
      Vineet Gupta authored
       - comments update
       - rename syscall_trace_entry
       - use PT_xxx in entry code
      Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
      c505b0da
    • Vineet Gupta's avatar
      ARC: __switch_to: move ksp to thread_info from thread_struct · fd476197
      Vineet Gupta authored
      task's arch specific bits are carried in 2 places
       - embedded thread_struct in task_struct
       - associated thread_info (hoisted in task's stack page) and
         syntactically: (thread_info *)(task_struct->stack)
      
      ksp (dynamic kernel stack top) currently lives in thread_struct but
      given its deep location in task struct likely to cache miss when
      accessed from  __switch_to(). Moving it to thread_info would be more
      efficient given proximity to frequently accessed items such as
      preempt_count thus very likely to be in cache, specially in schedular
      code.
      
      Note however that currently tsk.thread.ksp takes 1 memory access (off
      of tsk pointer) while new code tsk->stack.ksp would take 2, but likely
      to be in cache. Moreover if task is current the 2nd reference can be
      elided and instead derived from SP as (SP & ~(THREAD_SIZE - 1))
      
      All of this also makes __switch_to() code simpler and we can see the 2
      ways of retirving ksp (descrobed above) in new code.
      Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
      fd476197
    • Vineet Gupta's avatar
      ARC: __switch_to: asm with dwarf ops (vs. inline asm) · b060b7d0
      Vineet Gupta authored
      __switch_to() is final step of context switch, swapping kernel modes
      stack (and callee regs) of outgoing task with next task.
      
      It is also the starting point of stack unwinging of a sleeping task and
      captures SP, FP, BLINK and the corresponding dwarf info. Back when
      dinosaurs still roamed around, ARC gas didn't support CFI pseudo ops and
      gcc was responsible for generating dwarf info. Thus it had to be written
      in "C" with inline asm to do the hand crafting of stack. The function
      prologue (and crucial saving of blink etc) was still gcc generated but
      not visible in code. Likewise dwarf info was missing.
      
      Now with modern tools, we can make things more obvious by writing the
      code in asm and adding approproate dwarf cfi pseudo ops.
      
      This is mostly non functional change, except for slight chnages to asm
      
       - ARCompact doesn't support MOV_S fp, sp, so we use MOV
      Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
      b060b7d0
    • Vineet Gupta's avatar
      ARC: kernel stack: INIT_THREAD need not setup @init_stack in @ksp · d1d1569e
      Vineet Gupta authored
      There are 2 pointers to kernel mode stack of a task
       - task_struct.stack: base address of stack page (max possible stack top)
       - thread_info.ksp  : runtime stack top in __switch_to
      
      INIT_THREAD was setting up ksp to stack base which was not really needed
       - it would get overwritten with dynamic value on first call to
         __switch_to when init is switched out for the very first time.
       - generic code already does
            init_task.stack = init_stack
         and ARC code uses that to retrieve task's stack base.
      Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
      d1d1569e
    • Vineet Gupta's avatar
      ARC: entry: use gp to cache task pointer (vs. r25) · cfca4b5a
      Vineet Gupta authored
      The motivation is eventual ABI considerations for ARCv3 but even without
      it this change us worthwhile as diffstat reduces 100 net lines
      
      r25 is a callee saved register, normally not saved by entry code in
      pt_regs. However because of its usage in CONFIG_ARC_CURR_IN_REG it needs
      to be. This in turn requires a whole bunch of special casing when we
      need to access r25. Then there is distinction between user mode r25 vs.
      kernel mode r25 - hence distinct SAVE_CALLEE_SAVED_{USER,KERNEL}
      
      Instead use gp which is a scratch register and thus saved already in entry
      code. This cleans things up significantly and much nocer on eyes:
      
       - SAVE_CALLEE_SAVED_{USER,KERNEL} are now exactly same
       - no special user_r25 slot in pt_reggs
      
      Note that typical global asm registers are callee-saved (r25), but gp is
      not callee-saved thus needs additional -ffixed-<reg> toggle
      Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
      cfca4b5a
    • Vineet Gupta's avatar
      ARC: boot log: eliminate struct cpuinfo_arc #4: boot log per ISA · fad84e39
      Vineet Gupta authored
       - boot log now clearly per ISA
       - global struct cpuinfo_arc[] elimiated
       - local struct struct arcinfo kept for passing info
         between functions
      Tested-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202308162101.Ve5jBg80-lkp@intel.comSigned-off-by: default avatarVineet Gupta <vgupta@kernel.org>
      fad84e39
    • Vineet Gupta's avatar
    • Vineet Gupta's avatar
      17a5ed56
    • Vineet Gupta's avatar
      ARC: boot log: eliminate struct cpuinfo_arc #1: mm · 72d861f2
      Vineet Gupta authored
      This is first step in eliminating struct cpuinfo_arc[NR_CPUS]
      
      Back when we had just ARCompact ISA, the idea was to read/bit-fiddle
      the BCRs once and and cache decoded information in a global struct ready
      to use.
      
      With ARCv2 it was modified to contained abstract / ISA agnostic
      information.
      
      However with ARCv3 there 's too much disparity to abstract in common
      structures. So drop the entire decode once and store paradigm. Afterall
      there's only 2 users of this machinery anyways:  boot printing and
      cat /proc/cpuinfo. None is performance critical to warrant locking away
      resident memory per cpu.
      
      This patch is first step in that direction
       - decouples struct cpuinfo_arc_mmu from global struct cpuinfo_arc
       - mmu code still has a trimmed down static version of
         struct cpuinfo_arc_mmu to cache information needed in performance
         critical code such as tlb flush routines
       - folds read_decode_mmu_bcr() into arc_mmu_mumbojumbo()
       - setup_processor() directly calls arc_mmu_init() and not via
         arc_cpu_init()
      Tested-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202308151213.qKZPMiyz-lkp@intel.com/Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
      72d861f2
  2. 17 Aug, 2023 4 commits
  3. 16 Aug, 2023 1 commit
    • Pavel Kozlov's avatar
      ARC: atomics: Add compiler barrier to atomic operations... · 42f51fb2
      Pavel Kozlov authored
      ... to avoid unwanted gcc optimizations
      
      SMP kernels fail to boot with commit 596ff4a0
      ("cpumask: re-introduce constant-sized cpumask optimizations").
      
      |
      | percpu: BUG: failure at mm/percpu.c:2981/pcpu_build_alloc_info()!
      |
      
      The write operation performed by the SCOND instruction in the atomic
      inline asm code is not properly passed to the compiler. The compiler
      cannot correctly optimize a nested loop that runs through the cpumask
      in the pcpu_build_alloc_info() function.
      
      Fix this by add a compiler barrier (memory clobber in inline asm).
      
      Apparently atomic ops used to have memory clobber implicitly via
      surrounding smp_mb(). However commit b64be683
      ("ARC: atomics: implement relaxed variants") removed the smp_mb() for
      the relaxed variants, but failed to add the explicit compiler barrier.
      
      Link: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/135
      Cc: <stable@vger.kernel.org> # v6.3+
      Fixes: b64be683 ("ARC: atomics: implement relaxed variants")
      Signed-off-by: default avatarPavel Kozlov <pavel.kozlov@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
      [vgupta: tweaked the changelog and added Fixes tag]
      42f51fb2
  4. 13 Aug, 2023 10 commits
  5. 12 Aug, 2023 11 commits
    • Linus Torvalds's avatar
      Merge tag 'for-6.5-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · a785fd28
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "More fixes, some of them going back to older releases and there are
        fixes for hangs in stress tests regarding space caching:
      
         - fixes and progress tracking for hangs in free space caching, found
           by test generic/475
      
         - writeback fixes, write pages in integrity mode and skip writing
           pages that have been written meanwhile
      
         - properly clear end of extent range after an error
      
         - relocation fixes:
            - fix race betwen qgroup tree creation and relocation
            - detect and report invalid reloc roots"
      
      * tag 'for-6.5-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: set cache_block_group_error if we find an error
        btrfs: reject invalid reloc tree root keys with stack dump
        btrfs: exit gracefully if reloc roots don't match
        btrfs: avoid race between qgroup tree creation and relocation
        btrfs: properly clear end of the unreserved range in cow_file_range
        btrfs: don't wait for writeback on clean pages in extent_write_cache_pages
        btrfs: don't stop integrity writeback too early
        btrfs: wait for actual caching progress during allocation
      a785fd28
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · ae545c32
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - mark virtual chips exposed by gpio-sim as ones that can sleep
         (callbacks must not be called from interrupt context)
      
       - fix an off-by-one error in gpio-ws16c48
      
      * tag 'gpio-fixes-for-v6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: ws16c48: Fix off-by-one error in WS16C48 resource region extent
        gpio: sim: mark the GPIO chip as a one that can sleep
      ae545c32
    • Mateusz Guzik's avatar
      locking: remove spin_lock_prefetch · c8afaa1b
      Mateusz Guzik authored
      The only remaining consumer is new_inode, where it showed up in 2001 as
      commit c37fa164 ("v2.4.9.9 -> v2.4.9.10") in a historical repo [1]
      with a changelog which does not mention it.
      
      Since then the line got only touched up to keep compiling.
      
      While it may have been of benefit back in the day, it is guaranteed to
      at best not get in the way in the multicore setting -- as the code
      performs *a lot* of work between the prefetch and actual lock acquire,
      any contention means the cacheline is already invalid by the time the
      routine calls spin_lock().  It adds spurious traffic, for short.
      
      On top of it prefetch is notoriously tricky to use for single-threaded
      purposes, making it questionable from the get go.
      
      As such, remove it.
      
      I admit upfront I did not see value in benchmarking this change, but I
      can do it if that is deemed appropriate.
      
      Removal from new_inode and of the entire thing are in the same patch as
      requested by Linus, so whatever weird looks can be directed at that guy.
      
      Link: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/fs/inode.c?id=c37fa164f793735b32aa3f53154ff1a7659e6442 [1]
      Signed-off-by: default avatarMateusz Guzik <mjguzik@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c8afaa1b
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 3feecb1b
      Linus Torvalds authored
      Pull char / misc driver fixes from Greg KH:
       "Here are some small char/misc driver fixes for 6.5-rc6 that resolve
        some reported issues. Included in here are:
      
         - bunch of iio driver fixes for reported problems
      
         - interconnect driver fixes
      
         - counter driver build fix
      
         - cardreader driver fixes
      
         - binder driver fixes
      
         - other tiny driver fixes
      
        All of these have been in linux-next for a while with no reported
        problems"
      
      * tag 'char-misc-6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (21 commits)
        misc: tps6594-esm: Disable ESM for rev 1 PMIC
        misc: rtsx: judge ASPM Mode to set PETXCFG Reg
        binder: fix memory leak in binder_init()
        iio: cros_ec: Fix the allocation size for cros_ec_command
        tools/counter: Makefile: Replace rmdir by rm to avoid make,clean failure
        iio: imu: lsm6dsx: Fix mount matrix retrieval
        iio: adc: meson: fix core clock enable/disable moment
        iio: core: Prevent invalid memory access when there is no parent
        iio: frequency: admv1013: propagate errors from regulator_get_voltage()
        counter: Fix menuconfig "Counter support" submenu entries disappearance
        dt-bindings: iio: adi,ad74115: remove ref from -nanoamp
        iio: adc: ina2xx: avoid NULL pointer dereference on OF device match
        iio: light: bu27008: Fix intensity data type
        iio: light: bu27008: Fix scale format
        iio: light: bu27034: Fix scale format
        iio: adc: ad7192: Fix ac excitation feature
        interconnect: qcom: sa8775p: add enable_mask for bcm nodes
        interconnect: qcom: sm8550: add enable_mask for bcm nodes
        interconnect: qcom: sm8450: add enable_mask for bcm nodes
        interconnect: qcom: Add support for mask-based BCMs
        ...
      3feecb1b
    • Linus Torvalds's avatar
      Merge tag 'usb-6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 469a2f50
      Linus Torvalds authored
      Pull USB / Thunderbolt driver fixes from Greg KH:
       "Here are some small USB and Thunderbolt driver fixes for reported
        problems. Included in here are:
      
         - thunderbolt driver memory leak fix
      
         - thunderbolt display flicker fix
      
         - usb dwc3 driver fix
      
         - usb gadget uvc disconnect crash fix
      
         - usb typec Kconfig build dependency fix
      
         - usb typec small fixes
      
         - usb-con-gpio bugfix
      
         - usb-storage old driver bugfix
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'usb-6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        thunderbolt: Fix memory leak in tb_handle_dp_bandwidth_request()
        usb: dwc3: Properly handle processing of pending events
        usb-storage: alauda: Fix uninit-value in alauda_check_media()
        usb: common: usb-conn-gpio: Prevent bailing out if initial role is none
        USB: Gadget: core: Help prevent panic during UVC unconfigure
        usb: typec: mux: intel: Add dependency on USB_COMMON
        usb: typec: nb7vpq904m: Add an error handling path in nb7vpq904m_probe()
        usb: typec: altmodes/displayport: Signal hpd when configuring pin assignment
        usb: typec: tcpm: Fix response to vsafe0V event
        thunderbolt: Fix Thunderbolt 3 display flickering issue on 2nd hot plug onwards
      469a2f50
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v6.5_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 43972cf2
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
      
       - Do not parse the confidential computing blob on non-AMD hardware as
         it leads to an EFI config table ending up unmapped
      
       - Use the correct segment selector in the 32-bit version of getcpu() in
         the vDSO
      
       - Make sure vDSO and VVAR regions are placed in the 47-bit VA range
         even on 5-level paging systems
      
       - Add models 0x90-0x91 to the range of AMD Zenbleed-affected CPUs
      
      * tag 'x86_urgent_for_v6.5_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cpu/amd: Enable Zenbleed fix for AMD Custom APU 0405
        x86/mm: Fix VDSO and VVAR placement on 5-level paging machines
        x86/linkage: Fix typo of BUILD_VDSO in asm/linkage.h
        x86/vdso: Choose the right GDT_ENTRY_CPUNODE for 32-bit getcpu() on 64-bit kernel
        x86/sev: Do not try to parse for the CC blob on non-AMD hardware
      43972cf2
    • Linus Torvalds's avatar
      Merge tag 'x86_bugs_for_v6.5_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 272b86ba
      Linus Torvalds authored
      Pull x86 mitigation fixes from Borislav Petkov:
       "The first set of fallout fixes after the embargo madness. There will
        be another set next week too.
      
         - A first series of cleanups/unifications and documentation
           improvements to the SRSO and GDS mitigations code which got
           postponed to after the embargo date
      
         - Fix the SRSO aliasing addresses assertion so that the LLVM linker
           can parse it too"
      
      * tag 'x86_bugs_for_v6.5_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        driver core: cpu: Fix the fallback cpu_show_gds() name
        x86: Move gds_ucode_mitigated() declaration to header
        x86/speculation: Add cpu_show_gds() prototype
        driver core: cpu: Make cpu_show_not_affected() static
        x86/srso: Fix build breakage with the LLVM linker
        Documentation/srso: Document IBPB aspect and fix formatting
        driver core: cpu: Unify redundant silly stubs
        Documentation/hw-vuln: Unify filename specification in index
      272b86ba
    • Linus Torvalds's avatar
      Merge tag 'tpmdd-v6.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd · f8de32cc
      Linus Torvalds authored
      Pull tpm irq fixes from Jarkko Sakkinen:
       "These change the probing and enabling of interrupts advertised by the
        platform firmware (i.e. ACPI, Device Tree) to be an opt-in for tpm_tis,
        which can be set from the kernel command-line.
      
        Note that the opt-in change is only for the PC MMIO tpm_tis module. It
        does not affect other similar drivers using IRQs, like tpm_tis_spi and
        synquacer"
      
      * tag 'tpmdd-v6.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
        tpm_tis: Opt-in interrupts
        tpm: tpm_tis: Fix UPX-i11 DMI_MATCH condition
      f8de32cc
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 9a20704f
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
       "A few small bugs:
      
         - Fix longstanding mlx5 bug where ODP would fail with certain MR
           alignments
      
         - cancel work to prevent a hfi1 UAF
      
         - MAINTAINERS update
      
         - UAF, missing mutex_init and an error unwind bug in bnxt_re"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/bnxt_re: Initialize dpi_tbl_lock mutex
        RDMA/bnxt_re: Fix error handling in probe failure path
        RDMA/bnxt_re: Properly order ib_device_unalloc() to avoid UAF
        MAINTAINERS: Remove maintainer of HiSilicon RoCE
        IB/hfi1: Fix possible panic during hotplug remove
        RDMA/umem: Set iova in ODP flow
      9a20704f
    • Linus Torvalds's avatar
      Merge tag 'zonefs-6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs · 0725a704
      Linus Torvalds authored
      Pull zonefs fix from Damien Le Moal:
      
       - The switch to using iomap for executing a direct synchronous write to
         sequential files using a zone append BIO overlooked cases where the
         BIO built by iomap is too large and needs splitting, which is not
         allowed with zone append.
      
         Fix this by using regular write commands instead. The use of zone
         append commands will be reintroduced later with proper support from
         iomap.
      
      * tag 'zonefs-6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
        zonefs: fix synchronous direct writes to sequential files
      0725a704
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-v6.5-rc6' of... · 5512c33c
      Linus Torvalds authored
      Merge tag 'hwmon-for-v6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fixes from Guenter Roeck:
      
       - Fix sporadic comunication errors in pmbus/bel-pfe and
         aquacomputer_d5next drivers
      
      * tag 'hwmon-for-v6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (aquacomputer_d5next) Add selective 200ms delay after sending ctrl report
        hwmon: (pmbus/bel-pfe) Enable PMBUS_SKIP_STATUS_CHECK for pfe1100
      5512c33c
  6. 11 Aug, 2023 4 commits