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

xous: misc fixes + add network support #119408

Merged
merged 14 commits into from
Jan 22, 2024

Conversation

xobs
Copy link
Contributor

@xobs xobs commented Dec 29, 2023

This patchset makes several fixes to Xous support. Additionally, this patch adds networking support.

Many of these fixes are the result of the recent patch to get unwinding support merged. As a result of this patch, we can now run rust tests. As a result of these tests, we now have 729 tests passing:

failures:
    env::tests::test
    env::tests::test_self_exe_path
    env::tests::vars_debug
    env::tests::vars_os_debug
    os::raw::tests::same
    path::tests::test_push
    path::tests::test_set_file_name
    time::tests::since_epoch
test result: FAILED. 729 passed; 8 failed; 1 ignored; 0 measured; 0 filtered out; finished in 214.54s

In the course of fixing several tests and getting the test sequence to reliably run, several issues were found. This patchset fixes those issues.

@rustbot
Copy link
Collaborator

rustbot commented Dec 29, 2023

r? @Mark-Simulacrum

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 29, 2023
@bjorn3
Copy link
Member

bjorn3 commented Dec 30, 2023

I didn't review the fixes to the synchronization primitives and I only skimmed the networking implementation, but other than that I've reviewed everything.

@xobs
Copy link
Contributor Author

xobs commented Dec 30, 2023

I've made the adjustments requested. I think doing it using extern "Rust" {} is better than using the llvm approach because it makes it slightly more obvious what's going on.

Tests are still passing with the changes with the exception of the failures mentioned in the initial PR.

As an aside, I'm working on a method of connecting this so that it will run under cargo test.

@bors
Copy link
Contributor

bors commented Jan 13, 2024

☔ The latest upstream changes (presumably #117285) made this pull request unmergeable. Please resolve the merge conflicts.

xobs and others added 14 commits January 13, 2024 09:13
The `ret1` and `ret2` return values from lend operations are returned in
$a1 and $a2. This function incorrectly pulled them from $a6 and $a7,
causing them to always be `0`.

Signed-off-by: Sean Cross <[email protected]>
The amount of memory allocated was multiplied by sizeof::<T>(), so the
amount of memory to be freed should also be multiplied by sizeof::<T>().

Signed-off-by: Sean Cross <[email protected]>
Fix a deadlock condition that can occur when a thread is awoken in
between the point at which it checks its wake state and the point where
it actually waits.

This change will cause the waker to continuously send Notify messages
until it actually wakes up the target thread.

Signed-off-by: Sean Cross <[email protected]>
Rework the Condvar implementation on Xous to ensure notifications are
not missed. This involves keeping track of how many times a Condvar
timed out and synchronizing based on that.

Signed-off-by: Sean Cross <[email protected]>
When updating memory flags via `update_memory_flags()`, ensure we
multiply the slice length by the element size to get the full memory
size.

Signed-off-by: Sean Cross <[email protected]>
Use blocking scalars when unlocking a mutex. This ensures that mutexes
are unlocked immediately rather than dangling.

Signed-off-by: Sean Cross <[email protected]>
Add more checks to RwLock on Xous. As part of this, ensure the variable
is in a good state when unlocking.

Additionally, use the global `yield_now()` rather than platform-specific
`do_yield()`.

Signed-off-by: Sean Cross <[email protected]>
Use the global queue implementation of Once when running on Xous. This
gets us a thread-safe implementation, rather than using the
non-threadsafe `unsupported` implementation.

Signed-off-by: Sean Cross <[email protected]>
When running tests, libstd gets implemented as a second library. Due to
this fact, the `create()` and `destroy()` functions come from different
libraries.

To work around this, stash the `destroy_tls()` pointer in the first
unused slot in the thread local storage pool. That way even if
the destruction comes from a different version of libstd, the correct
`DTORS` list will be consulted.

Signed-off-by: Sean Cross <[email protected]>
When using the testing framework, a second copy of libstd is built and
linked. Use a global symbol for the `DLMALLOC` variable and mark it as
`extern` when building as a test.

This ensures we only have a single allocator even when running tests.

Signed-off-by: Sean Cross <[email protected]>
This is an initial commit of network support for Xous.

On hardware, is backed by smoltcp running via a Xous server in a
separate process space.

This patch adds TCP and UDP client and server support as well as DNS
resolution support using the dns Xous server.

Signed-off-by: Sean Cross <[email protected]>
Ensure these structs have a well-defined ABI layout.

Signed-off-by: Sean Cross <[email protected]>
Use constants for the opcodes when writing to stdout or stderr.

There still is no stdin operation.

Signed-off-by: Sean Cross <[email protected]>
The thread wrapper function never returns, so we can mark it as
divergent.

Signed-off-by: Sean Cross <[email protected]>
@Mark-Simulacrum
Copy link
Member

@bors r+

Tier 3 target which you are the maintainer for.

Thanks!

@bors
Copy link
Contributor

bors commented Jan 20, 2024

📌 Commit 50e4fed has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 20, 2024
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 20, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 22, 2024
…k, r=Mark-Simulacrum

xous: misc fixes + add network support

This patchset makes several fixes to Xous support. Additionally, this patch adds networking support.

Many of these fixes are the result of the recent patch to get `unwinding` support merged. As a result of this patch, we can now run rust tests. As a result of these tests, we now have 729 tests passing:

```
failures:
    env::tests::test
    env::tests::test_self_exe_path
    env::tests::vars_debug
    env::tests::vars_os_debug
    os::raw::tests::same
    path::tests::test_push
    path::tests::test_set_file_name
    time::tests::since_epoch
test result: FAILED. 729 passed; 8 failed; 1 ignored; 0 measured; 0 filtered out; finished in 214.54s
```

In the course of fixing several tests and getting the test sequence to reliably run, several issues were found. This patchset fixes those issues.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 22, 2024
…k, r=Mark-Simulacrum

xous: misc fixes + add network support

This patchset makes several fixes to Xous support. Additionally, this patch adds networking support.

Many of these fixes are the result of the recent patch to get `unwinding` support merged. As a result of this patch, we can now run rust tests. As a result of these tests, we now have 729 tests passing:

```
failures:
    env::tests::test
    env::tests::test_self_exe_path
    env::tests::vars_debug
    env::tests::vars_os_debug
    os::raw::tests::same
    path::tests::test_push
    path::tests::test_set_file_name
    time::tests::since_epoch
test result: FAILED. 729 passed; 8 failed; 1 ignored; 0 measured; 0 filtered out; finished in 214.54s
```

In the course of fixing several tests and getting the test sequence to reliably run, several issues were found. This patchset fixes those issues.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 22, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#118578 (core: introduce split_at{,_mut}_checked)
 - rust-lang#119369 (exclude unexported macro bindings from extern crate)
 - rust-lang#119408 (xous: misc fixes + add network support)
 - rust-lang#119943 (std::net: bind update for using backlog as `-1` too.)
 - rust-lang#119948 (Make `unsafe_op_in_unsafe_fn` migrated in edition 2024)
 - rust-lang#119999 (remote-test: use u64 to represent file size)
 - rust-lang#120152 (add help message for `exclusive_range_pattern` error)
 - rust-lang#120213 (Don't actually make bound ty/const for RTN)
 - rust-lang#120225 (Fix -Zremap-path-scope typo)

Failed merges:

 - rust-lang#119972 (Add `ErrCode`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e9c2e1b into rust-lang:master Jan 22, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 22, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 22, 2024
Rollup merge of rust-lang#119408 - betrusted-io:xous-fixes-add-network, r=Mark-Simulacrum

xous: misc fixes + add network support

This patchset makes several fixes to Xous support. Additionally, this patch adds networking support.

Many of these fixes are the result of the recent patch to get `unwinding` support merged. As a result of this patch, we can now run rust tests. As a result of these tests, we now have 729 tests passing:

```
failures:
    env::tests::test
    env::tests::test_self_exe_path
    env::tests::vars_debug
    env::tests::vars_os_debug
    os::raw::tests::same
    path::tests::test_push
    path::tests::test_set_file_name
    time::tests::since_epoch
test result: FAILED. 729 passed; 8 failed; 1 ignored; 0 measured; 0 filtered out; finished in 214.54s
```

In the course of fixing several tests and getting the test sequence to reliably run, several issues were found. This patchset fixes those issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants