Skip to content

Commit e0a8c34

Browse files
committed
Merge branch 'master' into dev-iocp4
# Conflicts: # core/src/net/event_loop.rs # core/src/net/mod.rs # core/src/syscall/windows/WSARecv.rs # core/src/syscall/windows/WSASend.rs # hook/src/syscall/windows.rs
2 parents 11d96b7 + bcfb4b7 commit e0a8c34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+3308
-1319
lines changed

.github/workflows/ci-preemptive.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ "${CROSS}" = "1" ]; then
77
export CARGO_NET_RETRY=5
88
export CARGO_NET_TIMEOUT=10
99

10-
cargo install cross
10+
cargo install cross --git https://github.com/cross-rs/cross --rev 4090beca3cfffa44371a5bba524de3a578aa46c3
1111
CARGO=cross
1212
fi
1313

@@ -17,22 +17,22 @@ export RUST_BACKTRACE=1
1717

1818
# test open-coroutine-core mod
1919
cd "${PROJECT_DIR}"/core
20-
"${CARGO}" test --target "${TARGET}" --features preemptive
21-
"${CARGO}" test --target "${TARGET}" --features preemptive --release
20+
"${CARGO}" test --target "${TARGET}" --features preemptive,ci
21+
"${CARGO}" test --target "${TARGET}" --features preemptive,ci --release
2222

2323
# test open-coroutine
2424
cd "${PROJECT_DIR}"/open-coroutine
25-
"${CARGO}" test --target "${TARGET}" --features preemptive
26-
"${CARGO}" test --target "${TARGET}" --features preemptive --release
25+
"${CARGO}" test --target "${TARGET}" --features preemptive,ci
26+
"${CARGO}" test --target "${TARGET}" --features preemptive,ci --release
2727

2828
# test io_uring
2929
if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ]; then
3030
cd "${PROJECT_DIR}"/core
31-
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,preemptive
32-
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,preemptive --release
31+
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,preemptive,ci
32+
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,preemptive,ci --release
3333
cd "${PROJECT_DIR}"/open-coroutine
34-
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,preemptive
35-
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,preemptive --release
34+
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,preemptive,ci
35+
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,preemptive,ci --release
3636
fi
3737

3838
# test IOCP

.github/workflows/ci.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ "${CROSS}" = "1" ]; then
77
export CARGO_NET_RETRY=5
88
export CARGO_NET_TIMEOUT=10
99

10-
cargo install cross
10+
cargo install cross --git https://github.com/cross-rs/cross --rev 4090beca3cfffa44371a5bba524de3a578aa46c3
1111
CARGO=cross
1212
fi
1313

@@ -24,22 +24,22 @@ fi
2424

2525
# test open-coroutine-core mod
2626
cd "${PROJECT_DIR}"/core
27-
"${CARGO}" test --target "${TARGET}"
28-
"${CARGO}" test --target "${TARGET}" --release
27+
"${CARGO}" test --target "${TARGET}" --features ci
28+
"${CARGO}" test --target "${TARGET}" --features ci --release
2929

3030
# test open-coroutine
3131
cd "${PROJECT_DIR}"/open-coroutine
32-
"${CARGO}" test --target "${TARGET}"
33-
"${CARGO}" test --target "${TARGET}" --release
32+
"${CARGO}" test --target "${TARGET}" --features ci
33+
"${CARGO}" test --target "${TARGET}" --features ci --release
3434

3535
# test io_uring
3636
if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ]; then
3737
cd "${PROJECT_DIR}"/core
38-
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring
39-
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring --release
38+
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,ci
39+
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,ci --release
4040
cd "${PROJECT_DIR}"/open-coroutine
41-
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring
42-
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring --release
41+
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,ci
42+
"${CARGO}" test --target "${TARGET}" --no-default-features --features io_uring,ci --release
4343
fi
4444

4545
# test IOCP

.github/workflows/ci.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on:
44
push:
55
paths-ignore:
66
- '**.md'
7+
- '**.png'
78
pull_request:
89
paths-ignore:
910
- '**.md'
11+
- '**.png'
1012

1113
env:
1214
CARGO_TERM_COLOR: always
@@ -53,7 +55,7 @@ jobs:
5355
PROJECT_DIR: ${{ github.workspace }}
5456
run: sh .github/workflows/ci.sh
5557
- name: Run preemptive tests
56-
if: always()
58+
if: ${{ contains(matrix.os, 'ubuntu') && !contains(matrix.target, 'loongarch64') || contains(matrix.os, 'macos') }}
5759
env:
5860
CHANNEL: ${{ matrix.channel }}
5961
CROSS: ${{ !startsWith(matrix.target, 'x86_64') && contains(matrix.target, 'linux') && '1' || '0' }}
@@ -72,8 +74,8 @@ jobs:
7274
armv7-unknown-linux-gnueabihf,
7375
riscv64gc-unknown-linux-gnu,
7476
thumbv7neon-unknown-linux-gnueabihf,
77+
loongarch64-unknown-linux-gnu,
7578
# mips64-unknown-linux-muslabi64,
76-
# loongarch64-unknown-linux-gnu,
7779
# s390x-unknown-linux-gnu,
7880

7981
x86_64-apple-darwin,
@@ -84,7 +86,7 @@ jobs:
8486
x86_64-pc-windows-msvc,
8587
i686-pc-windows-msvc,
8688
]
87-
channel: [ 1.81.0, nightly-2024-08-02 ]
89+
channel: [ stable, nightly ]
8890
include:
8991
- target: x86_64-unknown-linux-gnu
9092
os: ubuntu-latest
@@ -98,10 +100,10 @@ jobs:
98100
os: ubuntu-latest
99101
- target: thumbv7neon-unknown-linux-gnueabihf
100102
os: ubuntu-latest
103+
- target: loongarch64-unknown-linux-gnu
104+
os: ubuntu-latest
101105
# - target: mips64-unknown-linux-muslabi64
102106
# os: ubuntu-latest
103-
# - target: loongarch64-unknown-linux-gnu
104-
# os: ubuntu-latest
105107
# - target: s390x-unknown-linux-gnu
106108
# os: ubuntu-latest
107109

.github/workflows/coverage.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '**.md'
7+
- '**.png'
8+
pull_request:
9+
paths-ignore:
10+
- '**.md'
11+
- '**.png'
12+
13+
env:
14+
CARGO_TERM_COLOR: always
15+
CODECOV_TOKEN: 86ae569f-70d3-4c7b-833e-6e8fc97ea9f3
16+
17+
jobs:
18+
coverage:
19+
name: Run cargo coverage
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout sources
23+
uses: actions/checkout@v4
24+
- name: Install toolchain
25+
uses: actions-rs/toolchain@v1
26+
with:
27+
toolchain: 1.81.0
28+
profile: minimal
29+
override: true
30+
components: llvm-tools-preview
31+
- name: Install cargo-llvm-cov
32+
uses: taiki-e/install-action@cargo-llvm-cov
33+
- name: Generate code coverage
34+
run: bash -c "ulimit -Sl 512 && ulimit -Hl 512 && /home/runner/.cargo/bin/cargo llvm-cov --release --all --lcov --output-path lcov.info"
35+
- name: Generate code coverage with all features
36+
run: bash -c "ulimit -Sl 512 && ulimit -Hl 512 && /home/runner/.cargo/bin/cargo llvm-cov --all-features --release --all --lcov --output-path lcov-all-features.info"
37+
- name: Upload coverage to Codecov
38+
run: |
39+
bash <(curl -s https://codecov.io/bash) -f lcov.info -t ${{ env.CODECOV_TOKEN }}
40+
bash <(curl -s https://codecov.io/bash) -f lcov-all-features.info -t ${{ env.CODECOV_TOKEN }}

CHANGELOG.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
### 0.6.x
2+
3+
- [x] support custom task and coroutine priority.
4+
- [x] support scalable stack
5+
6+
### 0.5.x
7+
8+
- [x] refactor syscall state, distinguish between state and innerState
9+
10+
### 0.4.x
11+
12+
- [x] Supports and is compatible with io_uring in terms of local file IO
13+
- [x] elegant shutdown
14+
- [x] use log instead of println
15+
- [x] enhance `#[open_coroutine::main]` macro
16+
- [x] refactor hook impl, no need to publish dylibs now
17+
- [x] `Monitor` follow the `thread-per-core` guideline
18+
- [x] `EventLoop` follow the `thread-per-core` guideline
19+
20+
### 0.3.x
21+
22+
- [x] ~~support `genawaiter` as low_level stackless coroutine (can't support it due to hook)~~
23+
- [x] use `corosensei` as low_level coroutine
24+
- [x] support backtrace
25+
- [x] support `#[open_coroutine::co]` macro
26+
- [x] refactor `WorkStealQueue`
27+
28+
### 0.2.x
29+
30+
- [x] use correct `epoll_event` struct
31+
- [x] use `rayon` for parallel computing
32+
- [x] support `#[open_coroutine::main]` macro
33+
- [x] hook almost all `read` syscall
34+
<details>
35+
<summary>read syscalls</summary>
36+
37+
- [x] recv
38+
- [x] readv
39+
- [x] pread
40+
- [x] preadv
41+
- [x] recvfrom
42+
- [x] recvmsg
43+
44+
</details>
45+
46+
- [x] hook almost all `write` syscall
47+
<details>
48+
<summary>write syscalls</summary>
49+
50+
- [x] send
51+
- [x] writev
52+
- [x] sendto
53+
- [x] sendmsg
54+
- [x] pwrite
55+
- [x] pwritev
56+
57+
</details>
58+
59+
- [x] hook other syscall
60+
<details>
61+
<summary>other syscalls</summary>
62+
63+
- [x] sleep
64+
- [x] usleep
65+
- [x] nanosleep
66+
- [x] connect
67+
- [x] listen
68+
- [x] accept
69+
- [x] shutdown
70+
- [x] poll
71+
- [x] select
72+
73+
</details>
74+
75+
### 0.1.x
76+
77+
- [x] basic suspend/resume supported
78+
- [x] use jemalloc as memory pool
79+
- [x] higher level coroutine abstraction supported
80+
- [x] preemptive scheduling supported
81+
- [x] work stealing supported
82+
- [x] sleep syscall hooks supported

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ members = [
88
]
99

1010
[workspace.package]
11-
version = "0.6.10"
11+
version = "0.6.14"
1212
edition = "2021"
1313
authors = ["[email protected]"]
1414
repository = "https://github.com/acl-dev/open-coroutine"
1515
license = "Apache-2.0"
1616
readme = "README.md"
1717

1818
[workspace.dependencies]
19-
open-coroutine-core = { path = "core", version = "0.6.0" }
20-
open-coroutine-hook = { path = "hook", version = "0.6.0" }
21-
open-coroutine-macros = { path = "macros", version = "0.6.0" }
19+
open-coroutine-core = { path = "core", version = "0.6.14" }
20+
open-coroutine-hook = { path = "hook", version = "0.6.14" }
21+
open-coroutine-macros = { path = "macros", version = "0.6.14" }
2222

2323
tracing = { version = "0.1", default-features = false }
2424
tracing-subscriber = { version = "0.3", default-features = false }
2525
tracing-appender = { version = "0.2", default-features = false }
26-
cargo_metadata = { version = "0.18", default-features = false }
26+
cargo_metadata = { version = "0.19", default-features = false }
2727
mio = { version = "1.0", default-features = false }
2828

2929
cfg-if = "1.0.0"
@@ -38,6 +38,7 @@ time = "0.3"
3838
corosensei = "0.2"
3939
core_affinity = "0.8"
4040
crossbeam-utils = "0.8"
41+
crossbeam-skiplist = "0.1"
4142
nix = "0.29"
4243
io-uring = "0.7"
4344
windows-sys = "0.59"

0 commit comments

Comments
 (0)