lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m28qrpbeiw.fsf@posteo.net>
Date: Sun, 05 Jan 2025 13:01:43 +0000
From: Charalampos Mitrodimas <charmitro@...teo.net>
To: "Christoph Lameter (Ampere)" <cl@...two.org>
Cc: Mitchell Levy <levymitchell0@...il.com>,  Miguel Ojeda
 <ojeda@...nel.org>,  Alex Gaynor <alex.gaynor@...il.com>,  Boqun Feng
 <boqun.feng@...il.com>,  Gary Guo <gary@...yguo.net>,  Björn Roy Baron
 <bjorn3_gh@...tonmail.com>,  Benno Lossin <benno.lossin@...ton.me>,
  Andreas Hindborg <a.hindborg@...nel.org>,  Alice Ryhl
 <aliceryhl@...gle.com>,  Trevor Gross <tmgross@...ch.edu>,  Andrew Morton
 <akpm@...ux-foundation.org>,  Dennis Zhou <dennis@...nel.org>,  Tejun Heo
 <tj@...nel.org>,  linux-kernel@...r.kernel.org,
  rust-for-linux@...r.kernel.org,  linux-mm@...ck.org
Subject: Re: [PATCH RFC 3/3] rust: percpu: add a rust per-CPU variable test

"Christoph Lameter (Ampere)" <cl@...two.org> writes:

> On Thu, 19 Dec 2024, Mitchell Levy wrote:
>
>> +        let mut native: i64 = 0;
>> +        let mut pcpu: PerCpuRef<i64> = unsafe { unsafe_get_per_cpu_ref!(PERCPU, CpuGuard::new()) };
>
> A bit complex.

I agree with this, maybe a helper function would suffise? Something in
terms of,
  unsafe fn get_per_cpu<T>(var: &PerCpuVariable<T>) -> PerCpuRef<T> {
	  unsafe_get_per_cpu_ref!(var, CpuGuard::new())
  }

>
>> +        native += -1;
>> +        *pcpu += -1;
>> +        assert!(native == *pcpu && native == -1);
>> +
>> +        native += 1;
>> +        *pcpu += 1;
>> +        assert!(native == *pcpu && native == 0);
>> +
>
> That's pretty straightforward..... But is there no symbolic access to the
> per cpu namespace? How would you access the kernel per cpu variables
> defined in C?
>
> How do you go about using per cpu atomics like
>
> this_cpu_inc(nr_dentry_unused);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ