Thread (17 messages) 17 messages, 3 authors, 2016-08-15

Re: [RFC PATCH v7 7/7] Restartable sequences: self-tests

flat view

From: Mathieu Desnoyers <hidden>
Date: 2016-08-12 19:36:18
Also in: lkml

Possibly related (same subject, not in this thread)

----- On Aug 11, 2016, at 7:26 PM, Mathieu Desnoyers mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org wrote:
----- On Jul 24, 2016, at 2:01 PM, Dave Watson davejwatson-b10kYP2dOMg@public.gmane.org wrote:
quoted
quoted
quoted
+static inline __attribute__((always_inline))
+bool rseq_finish(struct rseq_lock *rlock,
+ intptr_t *p, intptr_t to_write,
+ struct rseq_state start_value)
quoted
quoted
This ABI looks like it will work fine for our use case. I don't think it
has been mentioned yet, but we may still need multiple asm blocks
for differing numbers of writes. For example, an array-based freelist push:
quoted
quoted
void push(void *obj) {
if (index < maxlen) {
freelist[index++] = obj;
}
}
quoted
quoted
would be more efficiently implemented with a two-write rseq_finish:
quoted
quoted
rseq_finish2(&freelist[index], obj, // first write
&index, index + 1, // second write
...);
quoted
Would pairing one rseq_start with two rseq_finish do the trick
there ?
Yes, two rseq_finish works, as long as the extra rseq management overhead
is not substantial.
I've added a commit implementing rseq_finish2() in my rseq volatile
dev branch. You can fetch it at:

https://github.com/compudj/linux-percpu-dev/tree/rseq-fallback

I also have a separate test and benchmark tree in addition to the
kernel selftests here:

https://github.com/compudj/rseq-test

I named the first write a "speculative" write, and the second write
the "final" write.

Would you like to extend the test cases to cover your intended use-case ?
Hi Dave!

I just pushed a rseq_finish2() test in my rseq-fallback branch. It implements
a per-cpu buffer holding pointers, and pushes/pops items to/from it.

To use it:

cd tools/testing/selftests/rseq
./param_test -T b

(see -h for advanced usage)

Let me know if I got it right!

Thanks,

Mathieu
Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help