linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ariel Miculas <ariel.miculas@gmail.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Josh Stone" <jistone@redhat.com>,
	"William Brown" <william.brown@suse.com>,
	"Georgy Yakovlev" <gyakovlev@gentoo.org>,
	"Jan Alexander Steffens" <jan.steffens@gmail.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@lists.linux.dev
Subject: Re: [PATCH 0/3] Rust 1.68.2 upgrade
Date: Thu, 20 Apr 2023 20:17:56 +0300	[thread overview]
Message-ID: <CAPDJoNvGQBNN6X6fs26tjUy7LbpJjWwPvQuf=1+nSwj94aa6LA@mail.gmail.com> (raw)
In-Reply-To: <CANiq72mtb9V+1a7nPEHBCeg_fob4rpPTWJZjdahnGL2Mg3uoUA@mail.gmail.com>

Yes, I've edited the commands since I've run them out of order, let me
include the output of commands and my general setup.
Since I've already run these steps previously, most of the commands
just say that it's already configured.

❯ rustup override set $(scripts/min-tool-version.sh rustc)
info: using existing install for '1.68.2-x86_64-unknown-linux-gnu'
info: override toolchain for '/home/amiculas/work/linux' set to
'1.68.2-x86_64-unknown-linux-gnu'

  1.68.2-x86_64-unknown-linux-gnu unchanged - rustc 1.68.2 (9eb3afe9e
2023-03-27)

❯ rustup override list
/home/amiculas/work/linux                       1.68.2-x86_64-unknown-linux-gnu

❯ rustup component add rust-src
info: component 'rust-src' is up to date

❯ cargo install --locked --version $(scripts/min-tool-version.sh
bindgen) bindgen
     Ignored package `bindgen v0.56.0` is already installed, use
--force to override

❯  make LLVM=1 rustavailable
Rust is available!

❮ rg -i '[^a-zA-Z]rust' .config
14:CONFIG_RUST_IS_AVAILABLE=y
279:CONFIG_RUST=y
280:CONFIG_RUSTC_VERSION_TEXT="rustc 1.68.2 (9eb3afe9e 2023-03-27)"
687:CONFIG_HAVE_RUST=y
5093:CONFIG_SAMPLES_RUST=y
5094:CONFIG_SAMPLE_RUST_MINIMAL=m
5095:CONFIG_SAMPLE_RUST_PRINT=m
5096:CONFIG_SAMPLE_RUST_HOSTPROGS=y
5185:# Rust hacking
5187:# CONFIG_RUST_DEBUG_ASSERTIONS is not set
5188:CONFIG_RUST_OVERFLOW_CHECKS=y
5189:# CONFIG_RUST_BUILD_ASSERT_ALLOW is not set
5190:# end of Rust hacking

❯ make LLVM=1 -j$(nproc)
  DESCEND objtool
  CALL    scripts/checksyscalls.sh
make[3]: 'install_headers' is up to date.
grep: warning: stray \ before #
grep: warning: stray \ before #
Kernel: arch/x86/boot/bzImage is ready  (#29)

# I have some commits on top of the patchset, but they are only for
setting up the kernel environment (an initramfs with busybox, running
inside qemu)
❯ git log --oneline
03cad1754b24 (HEAD -> ariel-rust) Add lwnfs.ko kernel module to initramfs
233183beae92 Insert rust_fs.ko module and mount a rustfs to /mnt
a1de6ad1ec15 Add other rust samples to initramfs
192ab4a5dd58 Mount /dev, /proc and insert the parrot.ko module
05d7232d50cf enable kvm
c2724fa122af Add scripts for running the kernel in qemu
3f81af042dd2 (rust-next) rust: upgrade to Rust 1.68.2
418e1087dce1 rust: arc: fix intra-doc link in `Arc<T>::init`
ee16705fb79f rust: alloc: clarify what is the upstream version
1944caa8e8dc (rust-for-linux/rust-next) rust: sync: add functions for
initializing `UniqueArc<MaybeUninit<T>>`
701608bd030a rust: sync: reduce stack usage of `UniqueArc::try_new_uninit`
692e8935e23e rust: types: add `Opaque::ffi_init`

❯ git --no-pager diff
diff --git a/samples/rust/rust_minimal.rs b/samples/rust/rust_minimal.rs
index dc05f4bbe27e..1ca75c85f161 100644
--- a/samples/rust/rust_minimal.rs
+++ b/samples/rust/rust_minimal.rs
@@ -19,6 +19,7 @@ struct RustMinimal {
 impl kernel::Module for RustMinimal {
     fn init(_module: &'static ThisModule) -> Result<Self> {
         pr_info!("Rust minimal sample (init)\n");
+        pr_info!("Ariel was here");
         pr_info!("Am I built-in? {}\n", !cfg!(MODULE));

         let mut numbers = Vec::new();

❯ cd linux-environment
❯ ls
busybox  Makefile  qemu-initramfs.desc  qemu-initramfs.img
qemu-init.sh  run_qemu.sh

❯ file busybox
busybox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
statically linked, stripped

❯ /usr/bin/cat Makefile
.PHONY: all clean

all: qemu-initramfs.img

qemu-initramfs.img:
        ../usr/gen_init_cpio qemu-initramfs.desc > qemu-initramfs.img

clean:
        rm qemu-initramfs.img

run: qemu-initramfs.img
        sudo ./run_qemu.sh

❯ /usr/bin/cat qemu-init.sh
#!/bin/sh

busybox mount -t devtmpfs none /dev
busybox mount -t proc none /proc
busybox mount -t sysfs none /sys

busybox insmod rust_minimal.ko
busybox rmmod rust_minimal.ko
busybox setsid sh -c 'exec sh -l </dev/ttyS0 >/dev/ttyS0 2>&1'

❯ /usr/bin/cat qemu-initramfs.desc
dir     /bin                                          0755 0 0
dir     /sys                                          0755 0 0
dir     /dev                                          0755 0 0
dir     /proc                                         0755 0 0
file    /bin/busybox  busybox                         0755 0 0
slink   /bin/sh       /bin/busybox                    0755 0 0
file    /init         qemu-init.sh                    0755 0 0

file    /rust_minimal.ko            ../samples/rust/rust_minimal.ko
        0755 0 0
file    /rust_print.ko              ../samples/rust/rust_print.ko
        0755 0 0

❯ make
../usr/gen_init_cpio qemu-initramfs.desc > qemu-initramfs.img

❯ /usr/bin/cat run_qemu.sh
sudo qemu-system-x86_64 \
    -kernel ../arch/x86/boot/bzImage \
    -initrd qemu-initramfs.img \
    -M pc \
    -m 4G \
    -accel kvm \
    -cpu host \
    -smp $(nproc) \
    -nographic \
    -vga none \
    -no-reboot \
    -append 'console=ttyS0'

❯ ./run_qemu.sh
[sudo] password for amiculas:
SeaBIOS (version Arch Linux 1.16.2-1-1)


iPXE (http://ipxe.org) 00:02.0 C000 PCI2.10 PnP PMM+BEFD31B0+BEF331B0 C000



Booting from ROM..
[    0.000000] Linux version 6.3.0-rc6-00039-g03cad1754b24-dirty
(amiculas@archlinux-cisco) (clang version 15.0.7, LLD 15.0.7) #29 SMP
PREEMPT_DYNAMIC Thu Apr 20 15:54:18 EEST 2023
[    0.000000] Command line: console=ttyS0
...
[    0.802414] Run /init as init process
[    0.803185] busybox (89) used greatest stack depth: 13848 bytes left
[    0.805450] rust_minimal: Rust minimal sample (init)
[    0.805736] rust_minimal: Ariel was here
[    0.805737] rust_minimal: Am I built-in? false
[    0.806304] busybox (92) used greatest stack depth: 13696 bytes left
[    0.806591] rust_minimal: My numbers are [72, 108, 200]
[    0.807021] rust_minimal: Rust minimal sample (exit)

Cheers,
Ariel

On Thu, Apr 20, 2023 at 4:20 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Thu, Apr 20, 2023 at 3:13 PM Ariel Miculas <ariel.miculas@gmail.com> wrote:
> >
> > $ make LLVM=1 rustavailable
>
> Since you showed the output of the other commands, did this one show
> "Rust is available!"? I guess so -- I imagine you edited the commands
> for the email, e.g. the config changed too.
>
> That is fine, as long as it works as expected :) Thanks a lot for testing!
>
> Cheers,
> Miguel

  reply	other threads:[~2023-04-20 17:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 21:43 [PATCH 0/3] Rust 1.68.2 upgrade Miguel Ojeda
2023-04-18 21:43 ` [PATCH 1/3] rust: alloc: clarify what is the upstream version Miguel Ojeda
2023-04-19  2:51   ` Martin Rodriguez Reboredo
2023-04-19  8:06   ` Benno Lossin
2023-04-19 11:58   ` Gary Guo
2023-04-20 12:14   ` Björn Roy Baron
2023-04-18 21:43 ` [PATCH 2/3] rust: arc: fix intra-doc link in `Arc<T>::init` Miguel Ojeda
2023-04-19  2:51   ` Martin Rodriguez Reboredo
2023-04-19  8:11   ` Benno Lossin
2023-04-19 11:59   ` Gary Guo
2023-04-20 12:15   ` Björn Roy Baron
2023-04-18 21:43 ` [PATCH 3/3] rust: upgrade to Rust 1.68.2 Miguel Ojeda
2023-04-19  3:02   ` Martin Rodriguez Reboredo
2023-05-31 17:02     ` Miguel Ojeda
     [not found]       ` <22ac8a99-d243-c537-41c7-ff2c5e69d28f@gmail.com>
2023-05-31 21:30         ` Miguel Ojeda
2023-04-19 12:38   ` Gary Guo
2023-04-20 12:31   ` Björn Roy Baron
2023-04-18 22:17 ` [PATCH 0/3] Rust 1.68.2 upgrade Miguel Ojeda
2023-04-20  3:23 ` Boqun Feng
2023-04-20  3:45 ` David Gow
2023-04-20 13:12 ` Ariel Miculas
2023-04-20 13:19   ` Miguel Ojeda
2023-04-20 17:17     ` Ariel Miculas [this message]
2023-04-20 17:20       ` Miguel Ojeda
2023-05-04 22:27         ` Fabien Parent
2023-05-05  9:59           ` Miguel Ojeda
2023-05-31 17:03 ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPDJoNvGQBNN6X6fs26tjUy7LbpJjWwPvQuf=1+nSwj94aa6LA@mail.gmail.com' \
    --to=ariel.miculas@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=gyakovlev@gentoo.org \
    --cc=jan.steffens@gmail.com \
    --cc=jistone@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    --cc=william.brown@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).