Re: [RFC PATCH 0/3] restartable sequences v2: fast user-space percpu critical sections

From: Dave Watson
Date: Wed Oct 28 2015 - 10:45:09 EST


On 10/27/15 04:56 PM, Paul Turner wrote:
> This series is a new approach which introduces an alternate ABI that does not
> depend on open-coded assembly nor a central 'repository' of rseq sequences.
> Sequences may now be inlined and the preparatory[*] work for the sequence can
> be written in a higher level language.

Very nice, it's definitely much easier to use.

> Exactly, for x86_64 this looks like:
> movq <failed>, rcx [1]
> movq $1f, <commit_instr> [2]
> cmpq <start value>, <current value> [3] (start is in rcx)
> jnz <failed> (4)
> movq <to_write>, (<target>) (5)
> 1: movq $0, <commit_instr>
>
> There has been some related discussion, which I am supportive of, in which
> we use fs/gs instead of TLS. This maps naturally to the above and removes
> the current requirement for per-thread initialization (this is a good thing!).
>
> On debugger interactions:
>
> There are some nice properties about this new style of API which allow it to
> actually support safe interactions with a debugger:
> a) The event counter is a per-cpu value. This means that we can not advance
> it if no threads from the same process execute on that cpu. This
> naturally allows basic single step support with thread-isolation.

I think this means multiple processes would no longer be able to use
per-cpu variables in shared memory, since they would no longer restart
with respect to each other?

> b) Single-step can be augmented to evalute the ABI without incrementing the
> event count.
> c) A debugger can also be augmented to evaluate this ABI and push restarts
> on the kernel's behalf.
>
> This is also compatible with David's approach of not single stepping between
> 2-4 above. However, I think these are ultimately a little stronger since true
> single-stepping and breakpoint support would be available. Which would be
> nice to allow actual debugging of sequences.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/