Skip to content

futex2#313

Open
sixseventysix wants to merge 14 commits into
hexagonal-sun:masterfrom
sixseventysix:futex2
Open

futex2#313
sixseventysix wants to merge 14 commits into
hexagonal-sun:masterfrom
sixseventysix:futex2

Conversation

@sixseventysix

Copy link
Copy Markdown
Contributor

No description provided.

@arihant2math

Copy link
Copy Markdown
Collaborator

I've fixed CI on master, do you mind rebasing?

@sixseventysix

Copy link
Copy Markdown
Contributor Author

I've fixed CI on master, do you mind rebasing?

just a reminder in case you missed it. I rebased my branch on master and CI is now green

Comment thread usertest/src/futex2.rs Outdated

@arihant2math arihant2math left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM

Comment thread src/clock/mod.rs
Realtime(Duration),
}

impl Deadline {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a good follow up PR would be to use Deadline in more places for more support for sleeping on realtime clock

Comment thread src/clock/mod.rs
/// wait in both directions across a step.
pub async fn sleep(self) {
loop {
let now = self.clock_now();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deadline::sleep() reads date()before clock_set_generation(). If there is a settime in that window, the wait computes remaining from the old wall clock, then subscribes starting at the new generation, so it misses the step that should retarget the timeout.

Comment thread src/clock/realtime.rs
}

if !registered {
waiters.register(cx.waker());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The token is thrown here. If a wrapping select! exits via timer/interrupt, the registration stays in the waiter set until the next realtime clock change.

nr_wake: i32,
nr_requeue: i32,
) -> Result<usize> {
// No syscall-level flags are defined.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux implements futex2 requeue differently: (kernel/futex/syscalls.c, SYSCALL_DEFINE4(futex_requeue)). Userspace can observe a successful requeue where it should get EAGAIN or EINVAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants