Commit 5e02c749 authored by Heiko Carstens's avatar Heiko Carstens

s390/cpum_sf: use READ_ONCE_ALIGNED_128() instead of 128-bit cmpxchg

Use READ_ONCE_ALIGNED_128() to read the previous value in front of a
128-bit cmpxchg loop, instead of (mis-)using a 128-bit cmpxchg operation to
do the same.

This makes the code more readable and is faster.

Link: https://lore.kernel.org/r/20230224100237.3247871-3-hca@linux.ibm.comSigned-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 434b2660
...@@ -1355,8 +1355,7 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all) ...@@ -1355,8 +1355,7 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)
num_sdb++; num_sdb++;
/* Reset trailer (using compare-double-and-swap) */ /* Reset trailer (using compare-double-and-swap) */
/* READ_ONCE() 16 byte header */ prev.val = READ_ONCE_ALIGNED_128(te->header.val);
prev.val = __cdsg(&te->header.val, 0, 0);
do { do {
old.val = prev.val; old.val = prev.val;
new.val = prev.val; new.val = prev.val;
...@@ -1558,8 +1557,7 @@ static bool aux_set_alert(struct aux_buffer *aux, unsigned long alert_index, ...@@ -1558,8 +1557,7 @@ static bool aux_set_alert(struct aux_buffer *aux, unsigned long alert_index,
struct hws_trailer_entry *te; struct hws_trailer_entry *te;
te = aux_sdb_trailer(aux, alert_index); te = aux_sdb_trailer(aux, alert_index);
/* READ_ONCE() 16 byte header */ prev.val = READ_ONCE_ALIGNED_128(te->header.val);
prev.val = __cdsg(&te->header.val, 0, 0);
do { do {
old.val = prev.val; old.val = prev.val;
new.val = prev.val; new.val = prev.val;
...@@ -1637,8 +1635,7 @@ static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range, ...@@ -1637,8 +1635,7 @@ static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range,
idx_old = idx = aux->empty_mark + 1; idx_old = idx = aux->empty_mark + 1;
for (i = 0; i < range_scan; i++, idx++) { for (i = 0; i < range_scan; i++, idx++) {
te = aux_sdb_trailer(aux, idx); te = aux_sdb_trailer(aux, idx);
/* READ_ONCE() 16 byte header */ prev.val = READ_ONCE_ALIGNED_128(te->header.val);
prev.val = __cdsg(&te->header.val, 0, 0);
do { do {
old.val = prev.val; old.val = prev.val;
new.val = prev.val; new.val = prev.val;
......
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