Skip to content
  1. Apr 02, 2022
  2. Mar 30, 2022
    • Linus Torvalds's avatar
      fs: fix fd table size alignment properly · d888c83f
      Linus Torvalds authored
      Jason Donenfeld reports that my commit 1c24a186 ("fs: fd tables have
      to be multiples of BITS_PER_LONG") doesn't work, and the reason is an
      embarrassing brown-paper-bag bug.
      
      Yes, we want to align the number of fds to BITS_PER_LONG, and yes, the
      reason they might not be aligned is because the incoming 'max_fd'
      argument might not be aligned.
      
      But aligining the argument - while simple - will cause a "infinitely
      big" maxfd (eg NR_OPEN_MAX) to just overflow to zero.  Which most
      definitely isn't what we want either.
      
      The obvious fix was always just to do the alignment last, but I had
      moved it earlier just to make the patch smaller and the code look
      simpler.  Duh.  It certainly made _me_ look simple.
      
      Fixes: 1c24a186
      
       ("fs: fd tables have to be multiples of BITS_PER_LONG")
      Reported-and-tested-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Cc: Fedor Pchelkin <aissur0002@gmail.com>
      Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
      Cc: Christian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d888c83f
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-5.18-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · 965181d7
      Linus Torvalds authored
      Pull NFS client updates from Trond Myklebust:
       "Highlights include:
      
        Features:
      
         - Switch NFS to use readahead instead of the obsolete readpages.
      
         - Readdir fixes to improve cacheability of large directories when
           there are multiple readers and writers.
      
         - Readdir performance improvements when doing a seekdir() immediately
           after opening the directory (common when re-exporting NFS).
      
         - NFS swap improvements from Neil Brown.
      
         - Loosen up memory allocation to permit direct reclaim and write back
           in cases where there is no danger of deadlocking the writeback code
           or NFS swap.
      
         - Avoid sillyrename when the NFSv4 server claims to support the
           necessary features to recover the unlinked but open file after
           reboot.
      
        Bugfixes:
      
         - Patch from Olga to add a mount option to control NFSv4.1 session
           trunking discovery, and default it to being off.
      
         - Fix a lockup in nfs_do_recoalesce().
      
         - Two fixes for list iterator variables being used when pointing to
           the list head.
      
         - Fix a kernel memory scribble when reading from a non-socket
           transport in /sys/kernel/sunrpc.
      
         - Fix a race where reconnecting to a server could leave the TCP
           socket stuck forever in the connecting state.
      
         - Patch from Neil to fix a shutdown race which can leave the SUNRPC
           transport timer primed after we free the struct xprt itself.
      
         - Patch from Xin Xiong to fix reference count leaks in the NFSv4.2
           copy offload.
      
         - Sunrpc patch from Olga to avoid resending a task on an offlined
           transport.
      
        Cleanups:
      
         - Patches from Dave Wysochanski to clean up the fscache code"
      
      * tag 'nfs-for-5.18-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (91 commits)
        NFSv4/pNFS: Fix another issue with a list iterator pointing to the head
        NFS: Don't loop forever in nfs_do_recoalesce()
        SUNRPC: Don't return error values in sysfs read of closed files
        SUNRPC: Do not dereference non-socket transports in sysfs
        NFSv4.1: don't retry BIND_CONN_TO_SESSION on session error
        SUNRPC don't resend a task on an offlined transport
        NFS: replace usage of found with dedicated list iterator variable
        SUNRPC: avoid race between mod_timer() and del_timer_sync()
        pNFS/files: Ensure pNFS allocation modes are consistent with nfsiod
        pNFS/flexfiles: Ensure pNFS allocation modes are consistent with nfsiod
        NFSv4/pnfs: Ensure pNFS allocation modes are consistent with nfsiod
        NFS: Avoid writeback threads getting stuck in mempool_alloc()
        NFS: nfsiod should not block forever in mempool_alloc()
        SUNRPC: Make the rpciod and xprtiod slab allocation modes consistent
        SUNRPC: Fix unx_lookup_cred() allocation
        NFS: Fix memory allocation in rpc_alloc_task()
        NFS: Fix memory allocation in rpc_malloc()
        SUNRPC: Improve accuracy of socket ENOBUFS determination
        SUNRPC: Replace internal use of SOCKWQ_ASYNC_NOSPACE
        SUNRPC: Fix socket waits for write buffer space
        ...
      965181d7
    • Linus Torvalds's avatar
      Merge tag 'jfs-5.18' of https://github.com/kleikamp/linux-shaggy · 1ec48f95
      Linus Torvalds authored
      Pull jfs updates from Dave Kleikamp:
       "A couple bug fixes"
      
      * tag 'jfs-5.18' of https://github.com/kleikamp/linux-shaggy:
        jfs: prevent NULL deref in diFree
        jfs: fix divide error in dbNextAG
      1ec48f95
    • Linus Torvalds's avatar
      fs: fd tables have to be multiples of BITS_PER_LONG · 1c24a186
      Linus Torvalds authored
      This has always been the rule: fdtables have several bitmaps in them,
      and as a result they have to be sized properly for bitmaps.  We walk
      those bitmaps in chunks of 'unsigned long' in serveral cases, but even
      when we don't, we use the regular kernel bitops that are defined to work
      on arrays of 'unsigned long', not on some byte array.
      
      Now, the distinction between arrays of bytes and 'unsigned long'
      normally only really ends up being noticeable on big-endian systems, but
      Fedor Pchelkin and Alexey Khoroshilov reported that copy_fd_bitmaps()
      could be called with an argument that wasn't even a multiple of
      BITS_PER_BYTE.  And then it fails to do the proper copy even on
      little-endian machines.
      
      The bug wasn't in copy_fd_bitmap(), but in sane_fdtable_size(), which
      didn't actually sanitize the fdtable size sufficiently, and never made
      sure it had the proper BITS_PER_LONG alignment.
      
      That's partly because the alignment historically came not from having to
      explicitly align things, but simply from previous fdtable sizes, and
      from count_open_files(), which counts the file descriptors by walking
      them one 'unsigned long' word at a time and thus naturally ends up doing
      sizing in the proper 'chunks of unsigned long'.
      
      But with the introduction of close_range(), we now have an external
      source of "this is how many files we want to have", and so
      sane_fdtable_size() needs to do a better job.
      
      This also adds that explicit alignment to alloc_fdtable(), although
      there it is mainly just for documentation at a source code level.  The
      arithmetic we do there to pick a reasonable fdtable size already aligns
      the result sufficiently.
      
      In fact,clang notices that the added ALIGN() in that function doesn't
      actually do anything, and does not generate any extra code for it.
      
      It turns out that gcc ends up confusing itself by combining a previous
      constant-sized shift operation with the variable-sized shift operations
      in roundup_pow_of_two().  And probably due to that doesn't notice that
      the ALIGN() is a no-op.  But that's a (tiny) gcc misfeature that doesn't
      matter.  Having the explicit alignment makes sense, and would actually
      matter on a 128-bit architecture if we ever go there.
      
      This also adds big comments above both functions about how fdtable sizes
      have to have that BITS_PER_LONG alignment.
      
      Fixes: 60997c3d
      
       ("close_range: add CLOSE_RANGE_UNSHARE")
      Reported-by: default avatarFedor Pchelkin <aissur0002@gmail.com>
      Reported-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
      Link: https://lore.kernel.org/all/20220326114009.1690-1-aissur0002@gmail.com/
      
      
      Tested-and-acked-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1c24a186
    • Linus Torvalds's avatar
      Merge tag 'devprop-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 13776ebb
      Linus Torvalds authored
      Pull device properties code update from Rafael Wysocki:
       "This is based on new i2c material for 5.18-rc1 and simply reorganizes
        the code on top of it so as to group similar functions together (Andy
        Shevchenko)"
      
      * tag 'devprop-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        device property: Don't split fwnode_get_irq*() APIs in the code
      13776ebb
    • Linus Torvalds's avatar
      Merge tag 'pm-5.18-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 1d59c3b6
      Linus Torvalds authored
      Pull more power management updates from Rafael Wysocki:
       "These update ARM cpufreq drivers, the OPP (Operating Performance
        Points) library and the power management documentation.
      
        Specifics:
      
         - Add per core DVFS support for QCom SoC (Bjorn Andersson), convert
           to yaml binding (Manivannan Sadhasivam) and various other fixes to
           the QCom drivers (Luca Weiss).
      
         - Add OPP table for imx7s SoC (Denys Drozdov) and minor fixes (Stefan
           Agner).
      
         - Fix CPPC driver's freq/performance conversions (Pierre Gondois).
      
         - Minor generic cleanups (Yury Norov).
      
         - Introduce opp-microwatt property to the OPP core, bindings, etc
           (Lukasz Luba).
      
         - Convert DT bindings to schema format and various related fixes
           (Yassine Oudjana).
      
         - Expose OPP's OF node in debugfs (Viresh Kumar).
      
         - Add Intel uncore frequency scaling documentation file to its
           MAINTAINERS entry (Srinivas Pandruvada).
      
         - Clean up the AMD P-state driver documentation (Jan Engelhardt)"
      
      * tag 'pm-5.18-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (24 commits)
        Documentation: amd-pstate: grammar and sentence structure updates
        dt-bindings: cpufreq: cpufreq-qcom-hw: Convert to YAML bindings
        dt-bindings: dvfs: Use MediaTek CPUFREQ HW as an example
        Documentation: EM: Describe new registration method using DT
        OPP: Add support of "opp-microwatt" for EM registration
        PM: EM: add macro to set .active_power() callback conditionally
        OPP: Add "opp-microwatt" supporting code
        dt-bindings: opp: Add "opp-microwatt" entry in the OPP
        MAINTAINERS: Add additional file to uncore frequency control
        cpufreq: blocklist Qualcomm sc8280xp and sa8540p in cpufreq-dt-platdev
        cpufreq: qcom-hw: Add support for per-core-dcvs
        dt-bindings: power: avs: qcom,cpr: Convert to DT schema
        arm64: dts: qcom: qcs404: Rename CPU and CPR OPP tables
        arm64: dts: qcom: msm8996: Rename cluster OPP tables
        dt-bindings: opp: Convert qcom-nvmem-cpufreq to DT schema
        dt-bindings: opp: qcom-opp: Convert to DT schema
        arm64: dts: qcom: msm8996-mtp: Add msm8996 compatible
        dt-bindings: arm: qcom: Add msm8996 and apq8096 compatibles
        opp: Expose of-node's name in debugfs
        cpufreq: CPPC: Fix performance/frequency conversion
        ...
      1d59c3b6
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-docs' · 3b65dd5b
      Rafael J. Wysocki authored
      Merge additional power management documentation udates for 5.18-rc1:
      
       - Add Intel uncore frequency scaling documentation file to its
         MAINTAINERS entry (Srinivas Pandruvada).
      
       - Clean up the AMD P-state driver documentation (Jan Engelhardt).
      
      * pm-docs:
        Documentation: amd-pstate: grammar and sentence structure updates
        MAINTAINERS: Add additional file to uncore frequency control
      3b65dd5b
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-opp' · 79bc8bfa
      Rafael J. Wysocki authored
      Merge OPP (Operating Performance Points) changes for 5.18-rc1.
      
      * pm-opp:
        Documentation: EM: Describe new registration method using DT
        OPP: Add support of "opp-microwatt" for EM registration
        PM: EM: add macro to set .active_power() callback conditionally
        OPP: Add "opp-microwatt" supporting code
        dt-bindings: opp: Add "opp-microwatt" entry in the OPP
        dt-bindings: power: avs: qcom,cpr: Convert to DT schema
        arm64: dts: qcom: qcs404: Rename CPU and CPR OPP tables
        arm64: dts: qcom: msm8996: Rename cluster OPP tables
        dt-bindings: opp: Convert qcom-nvmem-cpufreq to DT schema
        dt-bindings: opp: qcom-opp: Convert to DT schema
        arm64: dts: qcom: msm8996-mtp: Add msm8996 compatible
        dt-bindings: arm: qcom: Add msm8996 and apq8096 compatibles
        opp: Expose of-node's name in debugfs
      79bc8bfa
  3. Mar 29, 2022