Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/cpum_sf: Convert to cmpxchg128()

Now that there is a cross arch u128 and cmpxchg128(), use those
instead of the custom CDSG helper.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20230531132324.058821078@infradead.org

+4 -14
+1 -1
arch/s390/include/asm/cpu_mf.h
··· 140 140 unsigned int dsdes:16; /* 48-63: size of diagnostic SDE */ 141 141 unsigned long long overflow; /* 64 - Overflow Count */ 142 142 }; 143 - __uint128_t val; 143 + u128 val; 144 144 }; 145 145 146 146 struct hws_trailer_entry {
+3 -13
arch/s390/kernel/perf_cpum_sf.c
··· 1271 1271 } 1272 1272 } 1273 1273 1274 - static inline __uint128_t __cdsg(__uint128_t *ptr, __uint128_t old, __uint128_t new) 1275 - { 1276 - asm volatile( 1277 - " cdsg %[old],%[new],%[ptr]\n" 1278 - : [old] "+d" (old), [ptr] "+QS" (*ptr) 1279 - : [new] "d" (new) 1280 - : "memory", "cc"); 1281 - return old; 1282 - } 1283 - 1284 1274 /* hw_perf_event_update() - Process sampling buffer 1285 1275 * @event: The perf event 1286 1276 * @flush_all: Flag to also flush partially filled sample-data-blocks ··· 1342 1352 new.f = 0; 1343 1353 new.a = 1; 1344 1354 new.overflow = 0; 1345 - prev.val = __cdsg(&te->header.val, old.val, new.val); 1355 + prev.val = cmpxchg128(&te->header.val, old.val, new.val); 1346 1356 } while (prev.val != old.val); 1347 1357 1348 1358 /* Advance to next sample-data-block */ ··· 1552 1562 } 1553 1563 new.a = 1; 1554 1564 new.overflow = 0; 1555 - prev.val = __cdsg(&te->header.val, old.val, new.val); 1565 + prev.val = cmpxchg128(&te->header.val, old.val, new.val); 1556 1566 } while (prev.val != old.val); 1557 1567 return true; 1558 1568 } ··· 1626 1636 new.a = 1; 1627 1637 else 1628 1638 new.a = 0; 1629 - prev.val = __cdsg(&te->header.val, old.val, new.val); 1639 + prev.val = cmpxchg128(&te->header.val, old.val, new.val); 1630 1640 } while (prev.val != old.val); 1631 1641 *overflow += orig_overflow; 1632 1642 }