1. 20 Sep, 2024 2 commits
    • Palmer Dabbelt's avatar
      RISC-V: Don't have MAX_PHYSMEM_BITS exceed phys_addr_t · ad380f6a
      Palmer Dabbelt authored
      I recently ended up with a warning on some compilers along the lines of
      
            CC      kernel/resource.o
          In file included from include/linux/ioport.h:16,
                           from kernel/resource.c:15:
          kernel/resource.c: In function 'gfr_start':
          include/linux/minmax.h:49:37: error: conversion from 'long long unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes value from '17179869183' to '4294967295' [-Werror=overflow]
             49 |         ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); })
                |                                     ^
          include/linux/minmax.h:52:9: note: in expansion of macro '__cmp_once_unique'
             52 |         __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))
                |         ^~~~~~~~~~~~~~~~~
          include/linux/minmax.h:161:27: note: in expansion of macro '__cmp_once'
            161 | #define min_t(type, x, y) __cmp_once(min, type, x, y)
                |                           ^~~~~~~~~~
          kernel/resource.c:1829:23: note: in expansion of macro 'min_t'
           1829 |                 end = min_t(resource_size_t, base->end,
                |                       ^~~~~
          kernel/resource.c: In function 'gfr_continue':
          include/linux/minmax.h:49:37: error: conversion from 'long long unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes value from '17179869183' to '4294967295' [-Werror=overflow]
             49 |         ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); })
                |                                     ^
          include/linux/minmax.h:52:9: note: in expansion of macro '__cmp_once_unique'
             52 |         __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))
                |         ^~~~~~~~~~~~~~~~~
          include/linux/minmax.h:161:27: note: in expansion of macro '__cmp_once'
            161 | #define min_t(type, x, y) __cmp_once(min, type, x, y)
                |                           ^~~~~~~~~~
          kernel/resource.c:1847:24: note: in expansion of macro 'min_t'
           1847 |                addr <= min_t(resource_size_t, base->end,
                |                        ^~~~~
          cc1: all warnings being treated as errors
      
      which looks like a real problem: our phys_addr_t is only 32 bits now, so
      having 34-bit masks is just going to result in overflows.
      Reviewed-by: default avatarCharlie Jenkins <charlie@rivosinc.com>
      Reviewed-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Link: https://lore.kernel.org/r/20240731162159.9235-2-palmer@rivosinc.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      ad380f6a
    • Haibo Xu's avatar
      ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE · 732b1776
      Haibo Xu authored
      Currently, only acpi_early_node_map[0] was initialized to NUMA_NO_NODE.
      To ensure all the values were properly initialized, switch to initialize
      all of them to NUMA_NO_NODE.
      Suggested-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Signed-off-by: default avatarHaibo Xu <haibo1.xu@intel.com>
      Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> (arm64 platform)
      Reviewed-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Link: https://lore.kernel.org/r/20240729035958.1957185-1-haibo1.xu@intel.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      732b1776
  2. 19 Sep, 2024 3 commits
    • Palmer Dabbelt's avatar
      Merge patch series "riscv: Improve KASAN coverage to fix unit tests" · 58354376
      Palmer Dabbelt authored
      Samuel Holland <samuel.holland@sifive.com> says:
      
      This series fixes two areas where uninstrumented assembly routines
      caused gaps in KASAN coverage on RISC-V, which were caught by KUnit
      tests. The KASAN KUnit test suite passes after applying this series.
      
      This series fixes the following test failures:
        # kasan_strings: EXPECTATION FAILED at mm/kasan/kasan_test.c:1520
        KASAN failure expected in "kasan_int_result = strcmp(ptr, "2")", but none occurred
        # kasan_strings: EXPECTATION FAILED at mm/kasan/kasan_test.c:1524
        KASAN failure expected in "kasan_int_result = strlen(ptr)", but none occurred
        not ok 60 kasan_strings
        # kasan_bitops_generic: EXPECTATION FAILED at mm/kasan/kasan_test.c:1531
        KASAN failure expected in "set_bit(nr, addr)", but none occurred
        # kasan_bitops_generic: EXPECTATION FAILED at mm/kasan/kasan_test.c:1533
        KASAN failure expected in "clear_bit(nr, addr)", but none occurred
        # kasan_bitops_generic: EXPECTATION FAILED at mm/kasan/kasan_test.c:1535
        KASAN failure expected in "clear_bit_unlock(nr, addr)", but none occurred
        # kasan_bitops_generic: EXPECTATION FAILED at mm/kasan/kasan_test.c:1536
        KASAN failure expected in "__clear_bit_unlock(nr, addr)", but none occurred
        # kasan_bitops_generic: EXPECTATION FAILED at mm/kasan/kasan_test.c:1537
        KASAN failure expected in "change_bit(nr, addr)", but none occurred
        # kasan_bitops_generic: EXPECTATION FAILED at mm/kasan/kasan_test.c:1543
        KASAN failure expected in "test_and_set_bit(nr, addr)", but none occurred
        # kasan_bitops_generic: EXPECTATION FAILED at mm/kasan/kasan_test.c:1545
        KASAN failure expected in "test_and_set_bit_lock(nr, addr)", but none occurred
        # kasan_bitops_generic: EXPECTATION FAILED at mm/kasan/kasan_test.c:1546
        KASAN failure expected in "test_and_clear_bit(nr, addr)", but none occurred
        # kasan_bitops_generic: EXPECTATION FAILED at mm/kasan/kasan_test.c:1548
        KASAN failure expected in "test_and_change_bit(nr, addr)", but none occurred
        not ok 61 kasan_bitops_generic
      
      Samuel Holland (2):
        riscv: Omit optimized string routines when using KASAN
        riscv: Enable bitops instrumentation
      
      arch/riscv/include/asm/bitops.h | 43 ++++++++++++++++++---------------
       arch/riscv/include/asm/string.h |  2 ++
       arch/riscv/kernel/riscv_ksyms.c |  3 ---
       arch/riscv/lib/Makefile         |  2 ++
       arch/riscv/lib/strcmp.S         |  1 +
       arch/riscv/lib/strlen.S         |  1 +
       arch/riscv/lib/strncmp.S        |  1 +
       arch/riscv/purgatory/Makefile   |  2 ++
       8 files changed, 32 insertions(+), 23 deletions(-)
      
      * b4-shazam-merge:
        riscv: Enable bitops instrumentation
        riscv: Omit optimized string routines when using KASAN
      
      Link: https://lore.kernel.org/r/20240801033725.28816-1-samuel.holland@sifive.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      58354376
    • Samuel Holland's avatar
      riscv: Enable bitops instrumentation · 77514915
      Samuel Holland authored
      Instead of implementing the bitops functions directly in assembly,
      provide the arch_-prefixed versions and use the wrappers from
      asm-generic to add instrumentation. This improves KASAN coverage and
      fixes the kasan_bitops_generic() unit test.
      Signed-off-by: default avatarSamuel Holland <samuel.holland@sifive.com>
      Reviewed-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Tested-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Link: https://lore.kernel.org/r/20240801033725.28816-3-samuel.holland@sifive.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      77514915
    • Samuel Holland's avatar
      riscv: Omit optimized string routines when using KASAN · 58ff5371
      Samuel Holland authored
      The optimized string routines are implemented in assembly, so they are
      not instrumented for use with KASAN. Fall back to the C version of the
      routines in order to improve KASAN coverage. This fixes the
      kasan_strings() unit test.
      Signed-off-by: default avatarSamuel Holland <samuel.holland@sifive.com>
      Reviewed-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Tested-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Link: https://lore.kernel.org/r/20240801033725.28816-2-samuel.holland@sifive.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      58ff5371
  3. 17 Sep, 2024 7 commits
  4. 16 Sep, 2024 8 commits
  5. 15 Sep, 2024 8 commits
  6. 14 Sep, 2024 2 commits
  7. 12 Sep, 2024 9 commits
  8. 03 Sep, 2024 1 commit