Skip to content

Conversation

@kernel-patches-daemon-bpf-rc
Copy link

Pull request for series with
subject: barrier: Add smp_cond_load_*_timewait()
version: 4
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 98857d1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 98857d1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 98857d1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 6417ca8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: e4980fa
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: c9110e6
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: abc8a95
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 929adf8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 2d92ef7
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: b338cf8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

Add smp_cond_load_relaxed_timewait(), which extends
smp_cond_load_relaxed() to allow waiting for a finite duration.

The additional parameter allows for the timeout check.

The waiting is done via the usual cpu_relax() spin-wait around the
condition variable with periodic evaluation of the time-check.

The number of times we spin is defined by SMP_TIMEWAIT_SPIN_COUNT
(chosen to be 200 by default) which, assuming each cpu_relax()
iteration takes around 20-30 cycles (measured on a variety of x86
platforms), amounts to around 4000-6000 cycles.

Cc: Arnd Bergmann <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: [email protected]
Signed-off-by: Ankur Arora <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Add smp_cond_load_relaxed_timewait(), a timed variant of
smp_cond_load_relaxed().

This uses __cmpwait_relaxed() to do the actual waiting, with the
event-stream guaranteeing that we wake up from WFE periodically
and not block forever in case there are no stores to the cacheline.

For cases when the event-stream is unavailable, fallback to
spin-waiting.

Cc: Will Deacon <[email protected]>
Cc: [email protected]
Suggested-by: Catalin Marinas <[email protected]>
Signed-off-by: Ankur Arora <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
In preparation for defining smp_cond_load_acquire_timewait(), remove
the private copy. Lacking this, the rqspinlock code falls back to using
smp_cond_load_acquire().

Cc: Kumar Kartikeya Dwivedi <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Signed-off-by: Ankur Arora <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Add the acquire variant of smp_cond_load_relaxed_timewait(). This
reuses the relaxed variant, with an additional LOAD->LOAD
ordering.

Cc: Arnd Bergmann <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: [email protected]
Signed-off-by: Ankur Arora <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Use smp_cond_load_acquire_timewait() to define
res_atomic_cond_read_acquire() and res_smp_cond_load_acquire_timewait().

The timeout check for both is done via RES_CHECK_TIMEOUT(). Define
res_smp_cond_load_acquire_waiting() to allow it to amortize the
check for spin-wait implementations.

Cc: Kumar Kartikeya Dwivedi <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Signed-off-by: Ankur Arora <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 9621eb6
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996802
version: 4

@kernel-patches-daemon-bpf-rc
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=996802 irrelevant now. Closing PR.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants