Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rust support for RISC-V arch #225

Merged
merged 2 commits into from
Apr 28, 2021
Merged

Add Rust support for RISC-V arch #225

merged 2 commits into from
Apr 28, 2021

Conversation

nbdd0121
Copy link
Member

@nbdd0121 nbdd0121 commented Apr 25, 2021

No description provided.

@TheSven73
Copy link
Collaborator

Does this run on QEMU? If so, would it make sense to run this in the CI, like the other architectures?

@nbdd0121
Copy link
Member Author

Does this run on QEMU? If so, would it make sense to run this in the CI, like the other architectures?

It runs on QEMU, but you need to supply a firmware (e.g. OpenSBI). I don't think any distro has that supplied yet, so it means in the CI we have to pull and compile another project, which isn't trivial amount of work.

@ojeda
Copy link
Member

ojeda commented Apr 26, 2021

we have to pull and compile another project, which isn't trivial amount of work.

We are already cross-compiling Busybox on the fly -- does OpenSBI take long to compile? If not, I can take a look at adding it.

@memoryruins
Copy link

memoryruins commented Apr 26, 2021

Ubuntu 20.04 (which I think CI uses) packages OpenSBI 0.6, 20.10 packages 0.8, and 21.04 packages 0.9.
The most recent version of OpenSBI is 0.9 if that matters.

@nbdd0121
Copy link
Member Author

Ubuntu 20.04 (which I think CI uses) packages OpenSBI 0.6, 20.10 packages 0.8, and 21.04 packages 0.9.
The most recent version of OpenSBI is 0.9 if that matters.

Wow, Ubuntu has OpenSBI packaged, I didn't know that. Debian only has OpenSBI in sid, so I assumed Ubuntu wouldn't have it yet. I'll look to see if I can integrate it in the CI.

@ojeda
Copy link
Member

ojeda commented Apr 26, 2021

Thanks @nbdd0121! If you see any problems or you do not have time, let me know and I can do the CI missing bits.

@nbdd0121 nbdd0121 marked this pull request as draft April 27, 2021 00:11
@nbdd0121
Copy link
Member Author

nbdd0121 commented Apr 27, 2021

@ojeda I had a try, but I got a timeout and GitHub killed it without giving me much information. I don't have any machines with Ubuntu 20.04, and I tried to use nektos/act to test locally but it does not seem to support some constructs used in the CI script. I don't have much experience debugging GitHub actions; could you have a look if you have time? Thanks.

@ojeda
Copy link
Member

ojeda commented Apr 27, 2021

Sure! Let me take a look.

@ojeda
Copy link
Member

ojeda commented Apr 27, 2021

The bundled OpenSBI works fine for me in a VM, so no need to recompile.

The timing out issue is because 1) CONFIG_SOC_VIRT is not enabled and 2) -no-reboot does not seem to work for RISC-V in that version of QEMU. I compiled the latest QEMU and it works there.

The no output issue is due to something missing in the configuration, defconfig works.

I think the best approach is merging this without enabling riscv in the CI matrix just yet, and then I can look into adding a newer QEMU and enabling it.

@nbdd0121 nbdd0121 marked this pull request as ready for review April 27, 2021 22:14
@ojeda
Copy link
Member

ojeda commented Apr 28, 2021

I will likely tweak a few minor nits later on, but I think we can merge this as-is.

Thanks a lot!

Referencing #66.

@ojeda ojeda merged commit a6efc40 into Rust-for-Linux:rust Apr 28, 2021
@alex
Copy link
Member

alex commented Apr 28, 2021

We should add this to arch-support.rst as well!

@ojeda
Copy link
Member

ojeda commented Apr 28, 2021

Yeah! I will do it when actually enabling it in the CI matrix.

ojeda added a commit to ojeda/linux that referenced this pull request May 3, 2021
Finishes Rust-for-Linux#225.

There were several problems:

  - No console output. This was due to missing `CONFIG_SOC_VIRT`
    and `CONFIG_SERIAL_OF_PLATFORM`.

  - Hanging QEMU. This was due to missing `CONFIG_SOC_VIRT`, plus
    `-no-reboot` not working in older QEMU versions for RISC-V.
    We provide a custom build of the latest QEMU (6.0.0, recently
    released) in https://github.com/Rust-for-Linux/ci-bin.

  - Broken boot for debug builds. Some debugging options under
    `Kernel hacking` do not seem to work for RISC-V (in our
    branched kernel version, that is).

Also take the chance to clean up the `.config`s a bit more.

Signed-off-by: Miguel Ojeda <[email protected]>
ojeda added a commit to ojeda/linux that referenced this pull request May 3, 2021
Finishes Rust-for-Linux#225.

There were several problems:

  - No console output. This was due to missing `CONFIG_SOC_VIRT`
    and `CONFIG_SERIAL_OF_PLATFORM`.

  - Hanging QEMU. This was due to missing `CONFIG_SOC_VIRT` plus
    reboot not working in older QEMU versions for RISC-V.
    We provide a custom build of the latest QEMU (6.0.0, recently
    released) in https://github.com/Rust-for-Linux/ci-bin.

  - Broken boot for debug builds. Some debugging options under
    `Kernel hacking` do not seem to work for RISC-V (in our
    branched kernel version, that is).

Also take the chance to clean up the `.config`s a bit more.

Signed-off-by: Miguel Ojeda <[email protected]>
@ojeda ojeda mentioned this pull request May 3, 2021
ojeda added a commit to ojeda/linux that referenced this pull request May 3, 2021
Completes Rust-for-Linux#225.

There were several problems:

  - No console output. This was due to missing `CONFIG_SOC_VIRT`
    and `CONFIG_SERIAL_OF_PLATFORM`.

  - Hanging QEMU. This was due to missing `CONFIG_SOC_VIRT` plus
    reboot not working in older QEMU versions for RISC-V.
    We provide a custom build of the latest QEMU (6.0.0, recently
    released) in https://github.com/Rust-for-Linux/ci-bin.

  - Broken boot for debug builds. Some debugging options under
    `Kernel hacking` do not seem to work for RISC-V (in our
    branched kernel version, that is).

Also take the chance to clean up the `.config`s a bit more.

Signed-off-by: Miguel Ojeda <[email protected]>
fbq pushed a commit that referenced this pull request Dec 28, 2023
Reduce verboseness of test_progs' output in reg_bounds set of tests with
two changes.

First, instead of each different operator (<, <=, >, ...) being it's own
subtest, combine all different ops for the same (x, y, init_t, cond_t)
values into single subtest. Instead of getting 6 subtests, we get one
generic one, e.g.:

  #192/53  reg_bounds_crafted/(s64)[0xffffffffffffffff; 0] (s64)<op> 0xffffffff00000000:OK

Second, for random generated test cases, treat all of them as a single
test to eliminate very verbose output with random values in them. So now
we'll just get one line per each combination of (init_t, cond_t),
instead of 6 x 25 = 150 subtests before this change:

  #225     reg_bounds_rand_consts_s32_s32:OK

Given we reduce verboseness so much, it makes sense to do a bit more
random testing, so we also bump default number of random tests to 100,
up from 25. This doesn't increase runtime significantly, especially in
parallelized mode.

With all the above changes we still make sure that we have all the
information necessary for reproducing test case if it happens to fail.
That includes reporting random seed and specific operator that is
failing. Those will only be printed to console if related test/subtest
fails, so it doesn't have any added verboseness implications.

Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants