Skip to content
Snippets Groups Projects
  1. Nov 14, 2024
  2. Nov 13, 2024
  3. Nov 12, 2024
  4. Nov 06, 2024
  5. Nov 04, 2024
    • Alice Ryhl's avatar
      rust: samples: add tracepoint to Rust sample · 91d39024
      Alice Ryhl authored
      This updates the Rust printing sample to invoke a tracepoint. This
      ensures that we have a user in-tree from the get-go even though the
      patch is being merged before its real user.
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Jason Baron <jbaron@akamai.com>
      Cc: Ard Biesheuvel <ardb@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Alex Gaynor <alex.gaynor@gmail.com>
      Cc: Wedson Almeida Filho <wedsonaf@gmail.com>
      Cc: Gary Guo <gary@garyguo.net>
      Cc: " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <bjorn3_gh@protonmail.com>
      Cc: Benno Lossin <benno.lossin@proton.me>
      Cc: Andreas Hindborg <a.hindborg@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Uros Bizjak <ubizjak@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Oliver Upton <oliver.upton@linux.dev>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ryan Roberts <ryan.roberts@arm.com>
      Cc: Fuad Tabba <tabba@google.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Anup Patel <apatel@ventanamicro.com>
      Cc: Andrew Jones <ajones@ventanamicro.com>
      Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
      Cc: Conor Dooley <conor.dooley@microchip.com>
      Cc: Samuel Holland <samuel.holland@sifive.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: WANG Xuerui <kernel@xen0n.name>
      Cc: Bibo Mao <maobibo@loongson.cn>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Tianrui Zhao <zhaotianrui@loongson.cn>
      Link: https://lore.kernel.org/20241030-tracepoint-v12-3-eec7f0f8ad22@google.com
      
      
      Reviewed-by: default avatarBoqun Feng <boqun.feng@gmail.com>
      Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      91d39024
  6. Oct 31, 2024
  7. Oct 30, 2024
  8. Oct 28, 2024
  9. Oct 23, 2024
  10. Oct 22, 2024
  11. Oct 15, 2024
  12. Oct 11, 2024
  13. Oct 10, 2024
  14. Oct 08, 2024
  15. Oct 07, 2024
    • Miguel Ojeda's avatar
      rust: start using the `#[expect(...)]` attribute · 1f9ed172
      Miguel Ojeda authored
      In Rust, it is possible to `allow` particular warnings (diagnostics,
      lints) locally, making the compiler ignore instances of a given warning
      within a given function, module, block, etc.
      
      It is similar to `#pragma GCC diagnostic push` + `ignored` + `pop` in C:
      
          #pragma GCC diagnostic push
          #pragma GCC diagnostic ignored "-Wunused-function"
          static void f(void) {}
          #pragma GCC diagnostic pop
      
      But way less verbose:
      
          #[allow(dead_code)]
          fn f() {}
      
      By that virtue, it makes it possible to comfortably enable more
      diagnostics by default (i.e. outside `W=` levels) that may have some
      false positives but that are otherwise quite useful to keep enabled to
      catch potential mistakes.
      
      The `#[expect(...)]` attribute [1] takes this further, and makes the
      compiler warn if the diagnostic was _not_ produced. For instance, the
      following will ensure that, when `f()` is called somewhere, we will have
      to remove the attribute:
      
          #[expect(dead_code)]
          fn f() {}
      
      If we do not, we get a warning from the compiler:
      
          warning: this lint expectation is unfulfilled
           --> x.rs:3:10
            |
          3 | #[expect(dead_code)]
            |          ^^^^^^^^^
            |
            = note: `#[warn(unfulfilled_lint_expectations)]` on by default
      
      This means that `expect`s do not get forgotten when they are not needed.
      
      See the next commit for more details, nuances on its usage and
      documentation on the feature.
      
      The attribute requires the `lint_reasons` [2] unstable feature, but it
      is becoming stable in 1.81.0 (to be released on 2024-09-05) and it has
      already been useful to clean things up in this patch series, finding
      cases where the `allow`s should not have been there.
      
      Thus, enable `lint_reasons` and convert some of our `allow`s to `expect`s
      where possible.
      
      This feature was also an example of the ongoing collaboration between
      Rust and the kernel -- we tested it in the kernel early on and found an
      issue that was quickly resolved [3].
      
      Cc: Fridtjof Stoldt <xfrednet@gmail.com>
      Cc: Urgau <urgau@numericable.fr>
      Link: https://rust-lang.github.io/rfcs/2383-lint-reasons.html#expect-lint-attribute [1]
      Link: https://github.com/rust-lang/rust/issues/54503 [2]
      Link: https://github.com/rust-lang/rust/issues/114557
      
       [3]
      Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
      Reviewed-by: default avatarTrevor Gross <tmgross@umich.edu>
      Tested-by: default avatarGary Guo <gary@garyguo.net>
      Reviewed-by: default avatarGary Guo <gary@garyguo.net>
      Link: https://lore.kernel.org/r/20240904204347.168520-18-ojeda@kernel.org
      
      
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      1f9ed172
    • Miguel Ojeda's avatar
      rust: replace `clippy::dbg_macro` with `disallowed_macros` · 8577c9dc
      Miguel Ojeda authored
      Back when we used Rust 1.60.0 (before Rust was merged in the kernel),
      we added `-Wclippy::dbg_macro` to the compilation flags. This worked
      great with our custom `dbg!` macro (vendored from `std`, but slightly
      modified to use the kernel printing facilities).
      
      However, in the very next version, 1.61.0, it stopped working [1] since
      the lint started to use a Rust diagnostic item rather than a path to find
      the `dbg!` macro [1]. This behavior remains until the current nightly
      (1.83.0).
      
      Therefore, currently, the `dbg_macro` is not doing anything, which
      explains why we can invoke `dbg!` in samples/rust/rust_print.rs`, as well
      as why changing the `#[allow()]`s to `#[expect()]`s in `std_vendor.rs`
      doctests does not work since they are not fulfilled.
      
      One possible workaround is using `rustc_attrs` like the standard library
      does. However, this is intended to be internal, and we just started
      supporting several Rust compiler versions, so it is best to avoid it.
      
      Therefore, instead, use `disallowed_macros`. It is a stable lint and
      is more flexible (in that we can provide different macros), although
      its diagnostic message(s) are not as nice as the specialized one (yet),
      and does not allow to set different lint levels per macro/path [2].
      
      In turn, this requires allowing the (intentional) `dbg!` use in the
      sample, as one would have expected.
      
      Finally, in a single case, the `allow` is fixed to be an inner attribute,
      since otherwise it was not being applied.
      
      Link: https://github.com/rust-lang/rust-clippy/issues/11303 [1]
      Link: https://github.com/rust-lang/rust-clippy/issues/11307
      
       [2]
      Tested-by: default avatarGary Guo <gary@garyguo.net>
      Reviewed-by: default avatarGary Guo <gary@garyguo.net>
      Link: https://lore.kernel.org/r/20240904204347.168520-13-ojeda@kernel.org
      
      
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      8577c9dc
  16. Sep 27, 2024
    • Al Viro's avatar
      [tree-wide] finally take no_llseek out · cb787f4a
      Al Viro authored
      
      no_llseek had been defined to NULL two years ago, in commit 868941b1
      ("fs: remove no_llseek")
      
      To quote that commit,
      
        At -rc1 we'll need do a mechanical removal of no_llseek -
      
        git grep -l -w no_llseek | grep -v porting.rst | while read i; do
      	sed -i '/\<no_llseek\>/d' $i
        done
      
        would do it.
      
      Unfortunately, that hadn't been done.  Linus, could you do that now, so
      that we could finally put that thing to rest? All instances are of the
      form
      	.llseek = no_llseek,
      so it's obviously safe.
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cb787f4a
  17. Sep 16, 2024
  18. Sep 04, 2024
  19. Sep 02, 2024
    • Pavel Tikhomirov's avatar
      kmemleak-test: add percpu leak · e0b2fdb3
      Pavel Tikhomirov authored
      Add a per-CPU memory leak, which will be reported like:
      
      unreferenced object 0x3efa840195f8 (size 64):
        comm "modprobe", pid 4667, jiffies 4294688677
        hex dump (first 32 bytes on cpu 0):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace (crc 0):
          [<ffffffffa7fa87af>] pcpu_alloc+0x3df/0x840
          [<ffffffffc11642d9>] kmemleak_test_init+0x2c9/0x2f0 [kmemleak_test]
          [<ffffffffa7c02264>] do_one_initcall+0x44/0x300
          [<ffffffffa7de9e10>] do_init_module+0x60/0x240
          [<ffffffffa7deb946>] init_module_from_file+0x86/0xc0
          [<ffffffffa7deba99>] idempotent_init_module+0x109/0x2a0
          [<ffffffffa7debd2a>] __x64_sys_finit_module+0x5a/0xb0
          [<ffffffffa88f4f3a>] do_syscall_64+0x7a/0x160
          [<ffffffffa8a0012b>] entry_SYSCALL_64_after_hwframe+0x76/0x7e
      
      Link: https://lkml.kernel.org/r/20240725041223.872472-3-ptikhomirov@virtuozzo.com
      
      
      Signed-off-by: default avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
      Cc: Chen Jun <chenjun102@huawei.com>
      Cc: Wei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      e0b2fdb3
  20. Aug 27, 2024
  21. Aug 15, 2024
  22. Aug 12, 2024
  23. Jul 17, 2024
  24. Jul 10, 2024
  25. Jul 08, 2024
  26. Jul 05, 2024
  27. Jul 04, 2024
  28. Jun 29, 2024
  29. Jun 14, 2024
  30. Jun 11, 2024
Loading