Commit c119a8a3 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by Vasily Gorbik

s390/qdio: fine-tune SLSB update

xchg() for a single-byte location assembles to a 4-byte Compare&Swap,
wrapped into a non-trivial amount of retry code that deals with
concurrent modifications to the unaffected bytes.

Change it to a simple byte-store, but preserve the memory ordering
semantics that the CS provided.
This simplifies the generated code for a hot path, and in theory also
allows us to amortize the memory barriers over multiple SLSB updates.

CC: Andreas Krebbel <krebbel@linux.ibm.com>
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent b3a9e3b9
...@@ -254,10 +254,17 @@ static inline int set_buf_states(struct qdio_q *q, int bufnr, ...@@ -254,10 +254,17 @@ static inline int set_buf_states(struct qdio_q *q, int bufnr,
if (is_qebsm(q)) if (is_qebsm(q))
return qdio_do_sqbs(q, state, bufnr, count); return qdio_do_sqbs(q, state, bufnr, count);
/* Ensure that all preceding changes to the SBALs are visible: */
mb();
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
xchg(&q->slsb.val[bufnr], state); WRITE_ONCE(q->slsb.val[bufnr], state);
bufnr = next_buf(bufnr); bufnr = next_buf(bufnr);
} }
/* Make our SLSB changes visible: */
mb();
return count; return count;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment