Skip to content
Snippets Groups Projects
  1. Apr 23, 2023
    • Linus Torvalds's avatar
      gcc: disable '-Warray-bounds' for gcc-13 too · 0da6e5fd
      Linus Torvalds authored
      
      We started disabling '-Warray-bounds' for gcc-12 originally on s390,
      because it resulted in some warnings that weren't realistically fixable
      (commit 8b202ee2: "s390: disable -Warray-bounds").
      
      That s390-specific issue was then found to be less common elsewhere, but
      generic (see f0be87c4: "gcc-12: disable '-Warray-bounds' universally
      for now"), and then later expanded the version check was expanded to
      gcc-11 (5a41237a: "gcc: disable -Warray-bounds for gcc-11 too").
      
      And it turns out that I was much too optimistic in thinking that it's
      all going to go away, and here we are with gcc-13 showing all the same
      issues.  So instead of expanding this one version at a time, let's just
      disable it for gcc-11+, and put an end limit to it only when we actually
      find a solution.
      
      Yes, I'm sure some of this is because the kernel just does odd things
      (like our "container_of()" use, but also knowingly playing games with
      things like linker tables and array layouts).
      
      And yes, some of the warnings are likely signs of real bugs, but when
      there are hundreds of false positives, that doesn't really help.
      
      Oh well.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0da6e5fd
  2. Apr 16, 2023
  3. Apr 14, 2023
  4. Apr 06, 2023
  5. Mar 29, 2023
  6. Mar 27, 2023
  7. Mar 22, 2023
  8. Mar 12, 2023
  9. Mar 06, 2023
    • Greg Kroah-Hartman's avatar
      driver core: remove CONFIG_SYSFS_DEPRECATED and CONFIG_SYSFS_DEPRECATED_V2 · 721da5ce
      Greg Kroah-Hartman authored
      
      CONFIG_SYSFS_DEPRECATED was added in commit 88a22c98
      ("CONFIG_SYSFS_DEPRECATED") in 2006 to allow systems with older versions
      of some tools (i.e. Fedora 3's version of udev) to boot properly.  Four
      years later, in 2010, the option was attempted to be removed as most of
      userspace should have been fixed up properly by then, but some kernel
      developers clung to those old systems and refused to update, so we added
      CONFIG_SYSFS_DEPRECATED_V2 in commit e52eec13 ("SYSFS: Allow boot
      time switching between deprecated and modern sysfs layout") to allow
      them to continue to boot properly, and we allowed a boot time parameter
      to be used to switch back to the old format if needed.
      
      Over time, the logic that was covered under these config options was
      slowly removed from individual driver subsystems successfully, removed,
      and the only thing that is now left in the kernel are some changes in
      the block layer's representation in sysfs where real directories are
      used instead of symlinks like normal.
      
      Because the original changes were done to userspace tools in 2006, and
      all distros that use those tools are long end-of-life, and older
      non-udev-based systems do not care about the block layer's sysfs
      representation, it is time to finally remove this old logic and the
      config entries from the kernel.
      
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: linux-block@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Acked-by: default avatarJens Axboe <axboe@kernel.dk>
      Link: https://lore.kernel.org/r/20230223073326.2073220-1-gregkh@linuxfoundation.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      721da5ce
  10. Feb 21, 2023
  11. Feb 03, 2023
  12. Jan 26, 2023
  13. Jan 17, 2023
  14. Jan 13, 2023
  15. Jan 12, 2023
  16. Jan 11, 2023
  17. Jan 09, 2023
  18. Jan 08, 2023
  19. Dec 27, 2022
    • Mathieu Desnoyers's avatar
      sched: Introduce per-memory-map concurrency ID · af7f588d
      Mathieu Desnoyers authored
      This feature allows the scheduler to expose a per-memory map concurrency
      ID to user-space. This concurrency ID is within the possible cpus range,
      and is temporarily (and uniquely) assigned while threads are actively
      running within a memory map. If a memory map has fewer threads than
      cores, or is limited to run on few cores concurrently through sched
      affinity or cgroup cpusets, the concurrency IDs will be values close
      to 0, thus allowing efficient use of user-space memory for per-cpu
      data structures.
      
      This feature is meant to be exposed by a new rseq thread area field.
      
      The primary purpose of this feature is to do the heavy-lifting needed
      by memory allocators to allow them to use per-cpu data structures
      efficiently in the following situations:
      
      - Single-threaded applications,
      - Multi-threaded applications on large systems (many cores) with limited
        cpu affinity mask,
      - Multi-threaded applications on large systems (many cores) with
        restricted cgroup cpuset per container.
      
      One of the key concern from scheduler maintainers is the overhead
      associated with additional spin locks or atomic operations in the
      scheduler fast-path. This is why the following optimization is
      implemented.
      
      On context switch between threads belonging to the same memory map,
      transfer the mm_cid from prev to next without any atomic ops. This
      takes care of use-cases involving frequent context switch between
      threads belonging to the same memory map.
      
      Additional optimizations can be done if the spin locks added when
      context switching between threads belonging to different memory maps end
      up being a performance bottleneck. Those are left out of this patch
      though. A performance impact would have to be clearly demonstrated to
      justify the added complexity.
      
      The credit goes to Paul Turner (Google) for the original virtual cpu id
      idea. This feature is implemented based on the discussions with Paul
      Turner and Peter Oskolkov (Google), but I took the liberty to implement
      scheduler fast-path optimizations and my own NUMA-awareness scheme. The
      rumor has it that Google have been running a rseq vcpu_id extension
      internally in production for a year. The tcmalloc source code indeed has
      comments hinting at a vcpu_id prototype extension to the rseq system
      call [1].
      
      The following benchmarks do not show any significant overhead added to
      the scheduler context switch by this feature:
      
      * perf bench sched messaging (process)
      
      Baseline:                    86.5±0.3 ms
      With mm_cid:                 86.7±2.6 ms
      
      * perf bench sched messaging (threaded)
      
      Baseline:                    84.3±3.0 ms
      With mm_cid:                 84.7±2.6 ms
      
      * hackbench (process)
      
      Baseline:                    82.9±2.7 ms
      With mm_cid:                 82.9±2.9 ms
      
      * hackbench (threaded)
      
      Baseline:                    85.2±2.6 ms
      With mm_cid:                 84.4±2.9 ms
      
      [1] https://github.com/google/tcmalloc/blob/master/tcmalloc/internal/linux_syscall_support.h#L26
      
      
      
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221122203932.231377-8-mathieu.desnoyers@efficios.com
      af7f588d
  20. Dec 15, 2022
  21. Dec 10, 2022
  22. Nov 22, 2022
  23. Nov 18, 2022
    • XU pengfei's avatar
      initramfs: remove unnecessary (void*) conversion · 4197530b
      XU pengfei authored
      Remove unnecessary void* type casting.
      
      Link: https://lkml.kernel.org/r/20221026080517.3221-1-xupengfei@nfschina.com
      
      
      Signed-off-by: default avatarXU pengfei <xupengfei@nfschina.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: David Disseldorp <ddiss@suse.de>
      Cc: "Eric W . Biederman" <ebiederm@xmission.com>
      Cc: Martin Wilck <mwilck@suse.com>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: wuchi <wuchi.zero@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      4197530b
    • Alexey Dobriyan's avatar
      proc: give /proc/cmdline size · 941baf6f
      Alexey Dobriyan authored
      Most /proc files don't have length (in fstat sense).  This leads to
      inefficiencies when reading such files with APIs commonly found in modern
      programming languages.  They open file, then fstat descriptor, get st_size
      == 0 and either assume file is empty or start reading without knowing
      target size.
      
      cat(1) does OK because it uses large enough buffer by default.  But naive
      programs copy-pasted from SO aren't:
      
      	let mut f = std::fs::File::open("/proc/cmdline").unwrap();
      	let mut buf: Vec<u8> = Vec::new();
      	f.read_to_end(&mut buf).unwrap();
      
      will result in
      
      	openat(AT_FDCWD, "/proc/cmdline", O_RDONLY|O_CLOEXEC) = 3
      	statx(0, NULL, AT_STATX_SYNC_AS_STAT, STATX_ALL, NULL) = -1 EFAULT (Bad address)
      	statx(3, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=0, ...}) = 0
      	lseek(3, 0, SEEK_CUR)                   = 0
      	read(3, "BOOT_IMAGE=(hd3,gpt2)/vmlinuz-5.", 32) = 32
      	read(3, "19.6-100.fc35.x86_64 root=/dev/m", 32) = 32
      	read(3, "apper/fedora_localhost--live-roo"..., 64) = 64
      	read(3, "ocalhost--live-swap rd.lvm.lv=fe"..., 128) = 116
      	read(3, "", 12)
      
      open/stat is OK, lseek looks silly but there are 3 unnecessary reads
      because Rust starts with 32 bytes per Vec<u8> and grows from there.
      
      In case of /proc/cmdline, the length is known precisely.
      
      Make variables readonly while I'm at it.
      
      P.S.: I tried to scp /proc/cpuinfo today and got empty file
      	but this is separate story.
      
      Link: https://lkml.kernel.org/r/YxoywlbM73JJN3r+@localhost.localdomain
      
      
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      941baf6f
  24. Nov 15, 2022
    • Zhen Lei's avatar
      kallsyms: Add self-test facility · 30f3bb09
      Zhen Lei authored
      
      Added test cases for basic functions and performance of functions
      kallsyms_lookup_name(), kallsyms_on_each_symbol() and
      kallsyms_on_each_match_symbol(). It also calculates the compression rate
      of the kallsyms compression algorithm for the current symbol set.
      
      The basic functions test begins by testing a set of symbols whose address
      values are known. Then, traverse all symbol addresses and find the
      corresponding symbol name based on the address. It's impossible to
      determine whether these addresses are correct, but we can use the above
      three functions along with the addresses to test each other. Due to the
      traversal operation of kallsyms_on_each_symbol() is too slow, only 60
      symbols can be tested in one second, so let it test on average once
      every 128 symbols. The other two functions validate all symbols.
      
      If the basic functions test is passed, print only performance test
      results. If the test fails, print error information, but do not perform
      subsequent performance tests.
      
      Start self-test automatically after system startup if
      CONFIG_KALLSYMS_SELFTEST=y.
      
      Example of output content: (prefix 'kallsyms_selftest:' is omitted
       start
        ---------------------------------------------------------
       | nr_symbols | compressed size | original size | ratio(%) |
       |---------------------------------------------------------|
       |     107543 |       1357912   |      2407433  |  56.40   |
        ---------------------------------------------------------
       kallsyms_lookup_name() looked up 107543 symbols
       The time spent on each symbol is (ns): min=630, max=35295, avg=7353
       kallsyms_on_each_symbol() traverse all: 11782628 ns
       kallsyms_on_each_match_symbol() traverse all: 9261 ns
       finish
      
      Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      30f3bb09
  25. Nov 01, 2022
  26. Oct 21, 2022
  27. Oct 12, 2022
  28. Oct 03, 2022
Loading