Posts
4497
Following
316
Followers
475
Linux kernel hacker and maintainer etc.

OpenPGP: 3AB05486C7752FE1
Yeah well the language itself is nice and especially when fallible alloc's are a stable feature :-) And I'd expect that there will be clippy switch to make them enforced if you want... so things will get fixed eventually.
0
0
0

Jarkko Sakkinen

Edited 1 year ago
@heaths I actually also think that Rust's stdlib is quite bad.

Rust is a modern language, and e.g. I like the idea of procedural macros. But why create standard library, which takes greatest hits of 80s POSIX tape-drive alike File API and container types from 90s Java that I don't get.

It was pretty apparent in 2016 that you mostly just map memory, and storage is non-volatile RAM. There's lot of these types of contradictions in Rust, and variance in stock API quality.

Personally I use this as my basic memory API https://github.com/rust-vmm/vm-memory, and more like to to this direction should have been I/O API design of stdlib in 2016 (despite being part of rust-vmm, it can do all types of mmaps).

Not even joking when I say that this my favorite part of Rust's stdlib: https://doc.rust-lang.org/std/marker/struct.PhantomData.html. This one I do like.

The comment about crypto library is IMHO even more to the point given that not only Rust was designed with the borrow checker but it was also made by Mozilla for use in Web Browser development. The first presentation I saw about Rust was at LinuxCon EU 2014, and it was more about Servo than Rust itself.
0
0
1
@heaths I often sort of circle through bunch of languages when doing a concept. Like something started with Rust might end up being written in C or might even start with a spreadsheet :-) Rewriting is quite easy really once you have a gist of design...

Python is pretty nice for emulating a C program as you can make it call same things as with C. So I actually have like crypto libraries for trying out stuff because they have smooth API and then use something else for the end product.
1
0
0
@heaths I actually will use this to PoC stuff that I use kernel's crypto for so I have something quicker than e.g. libssl to get a concept :-) Not putting to production... Understand your point.
1
0
0

Jarkko Sakkinen

This is first pure #Rust #crypto crate that I actually like. There's been a few #libsodium alike attempts but nothing quite as good as the original. This really feels like done right: https://github.com/brndnmtthws/dryoc #rustlang
1
0
0
This is at least my experience: if you love your tools, you never learn to use them properly :-----)
0
0
1

Jarkko Sakkinen

Edited 1 year ago
despite all the hate speech towards #rustlang i'm working on a small and cool patch set and tooling for #rust #linux tree ;-) doing it on side but i have pretty solid idea what i want. and also is in reach of what i generally have done in kernel.

the feature has nothing to do with hard real-time operating systems but some nice patterns used by #rtic have inspired me to find a right angle:

https://rtic.rs/2/book/en/

It's cool project IMHO and nice box of ideas how to do low-level and #embedded in rust.

#rtos
1
0
4
@kernellogger @vbabka lol, ok ok, won't forget this i promise! 🔀 🤠
0
0
2
@vbabka point taken :-)
1
0
1
Can't probably go wrong with GPLv2 I guess.
0
0
1

Jarkko Sakkinen

Edited 1 year ago

I wonder what is the policy of putting something to scripts/ (not to vmlinux) that is written with #Rust? I.e. build time utility. Just curious.

And actually, since bindgen is installed from crates.io, not from kernel tree, should it be actually submitted there, and not to the kernel tree?

Kernel documentation gives pretty bad rationale for bindgen being in Cargo: “The bindings to the C side of the kernel are generated at build time using the bindgen tool. A particular version is required.” I’m sure there are good reasons to install it using cargo but why the documentation does not list those reasons, no matter how obvious they might be to some.

So I guess I put my build time tool to crates.io because at least first it is an experiment, and secondly bindgen is managed like this. But even this does not conclude the story fully. I have no idea in what license that out-of-tree pulled build-time utility is expected to be. It is not documented, or at least I cannot find it documented anywhere.

#rustlang #linux #kernel

1
0
0
@jani Wow, nice list of people in the loop you have over there...
1
0
2
@jani @TheKeymaker And to further underline: for parts that are not obvious, there must be also a solid reason why they are not obvious. I.e. those parts exist no matter how well the semantics are implemented. Otherwise, it should not IMHO pass the patch review process in the first place... I'm not saying that accepting such functions never happens to me but this is at least the ideal...
0
0
1
@jani @TheKeymaker Documentation should merely document the parts that are neither obvious nor intuitive. This applies both to an inline comment and also header comment of a function...
1
0
1

Jarkko Sakkinen

Edited 1 year ago

@jani OK, did not check the implementation. I thought the point was to find the nearest power of two.

I’d probably use __fls() and << 1 unless the exact same number (i.e. already pow2). Like for the stuff I thought it was used for to be more specific… I guess I stay away from those functions, feels for me more complicated to use them than do what I want open-coded :-) Probably would end up using them in a wrong way…

0
0
1

Jarkko Sakkinen

Today I might start experimenting with procedural macros in #Rust, and generating opcodes with them :-)

And also keep it compiling with gccrs, if by any means possible (not going to hang myself to this tho).

#rustlang #kernel
0
0
2
Given how wide they are spread, neither make sense to fix the naming. Something simple like roundup and roundup_pow2 would already bring some clarity.

Ofc you could make an inline function with a "better name", which calls round_up, and let subsystems progressively transform to that but probably not worth of time and energy :-)
0
0
0
@jani NO. I had to check never used them. I've done round_up manually :-) Actually where I've done manual "rounding", I'd rather keep it the way it is, than switch because it makes later on easier to recall... So I have question their usefulness actually but I don't mind them being there.
1
0
1
OK, I guess this solves the problem: https://eips.ethereum.org/EIPS/eip-2718
0
0
0
Show older