Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

2020-08-25 Thread Peter Oskolkov
On Tue, Aug 25, 2020 at 9:58 AM Mathieu Desnoyers wrote: > [...] > > Concretely speaking, let's just add a new membarrier command for the use-case > at hand. All other ways of doing things we have discussed are tricky to expose > in a way that is discoverable by user-space through the QUERY comman

Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

2020-08-25 Thread Mathieu Desnoyers
- On Aug 20, 2020, at 1:42 PM, Peter Oskolkov p...@posk.io wrote: > On Wed, Aug 12, 2020 at 12:44 PM Mathieu Desnoyers > wrote: >> > [...] >> >> > One way of doing what you suggest is to allow some commands to be >> > bitwise-ORed. >> > >> > So, for example, the user could call >> > >> > mem

Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

2020-08-20 Thread Peter Oskolkov
On Wed, Aug 12, 2020 at 12:44 PM Mathieu Desnoyers wrote: > [...] > > > One way of doing what you suggest is to allow some commands to be > > bitwise-ORed. > > > > So, for example, the user could call > > > > membarrier(CMD_PRIVATE_EXPEDITED_SYNC_CORE | CMD_PRIVATE_EXPEDITED_RSEQ, > > cpu_id) >

Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

2020-08-12 Thread Mathieu Desnoyers
- On Aug 12, 2020, at 2:48 PM, Peter Oskolkov p...@posk.io wrote: > On Wed, Aug 12, 2020 at 11:30 AM Mathieu Desnoyers > wrote: > > [...] > >> "flags" is there to allow extensibility without requiring to add new >> membarrier commands for every change. Even though it is not used now, >> I d

Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

2020-08-12 Thread Peter Oskolkov
On Wed, Aug 12, 2020 at 11:30 AM Mathieu Desnoyers wrote: [...] > "flags" is there to allow extensibility without requiring to add new > membarrier commands for every change. Even though it is not used now, > I don't think re-purposing it is a good idea. What is wrong with just > adding an addit

Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

2020-08-12 Thread Mathieu Desnoyers
- On Aug 11, 2020, at 5:08 PM, Peter Oskolkov p...@posk.io wrote: > On Mon, Aug 10, 2020 at 11:27 PM Peter Zijlstra wrote: >> >> On Mon, Aug 10, 2020 at 05:09:58PM -0700, Peter Oskolkov wrote: >> > @@ -27,6 +35,12 @@ >> > >> > static void ipi_mb(void *info) >> > { >> >> The #ifdef wants

Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

2020-08-11 Thread Peter Oskolkov
On Mon, Aug 10, 2020 at 11:27 PM Peter Zijlstra wrote: > > On Mon, Aug 10, 2020 at 05:09:58PM -0700, Peter Oskolkov wrote: > > @@ -27,6 +35,12 @@ > > > > static void ipi_mb(void *info) > > { > > The #ifdef wants to behere, otherwise you'll get a compile warning for > !RSEQ builds. Ack. Will do

Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

2020-08-11 Thread Peter Zijlstra
On Tue, Aug 11, 2020 at 08:27:33AM +0200, Peter Zijlstra wrote: > SYSCALL_DEFINE2(membarrier, int, cmd, int, flags) > { > + int cflags = 0, int cpuid = -1; > + > if (unlikely(flags) && cmd != MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ) > return -EINVAL; > + > + if (cmd & (M

Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

2020-08-10 Thread Peter Zijlstra
On Mon, Aug 10, 2020 at 05:09:58PM -0700, Peter Oskolkov wrote: > @@ -27,6 +35,12 @@ > > static void ipi_mb(void *info) > { The #ifdef wants to behere, otherwise you'll get a compile warning for !RSEQ builds. > + int *flags = info; > + > +#ifdef CONFIG_RSEQ > + if (flags && (*flags ==

[PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

2020-08-10 Thread Peter Oskolkov
This patchset is based on Google-internal RSEQ work done by Paul Turner and Andrew Hunter. When working with per-CPU RSEQ-based memory allocations, it is sometimes important to make sure that a global memory location is no longer accessed from RSEQ critical sections. For example, there can be two