From patchwork Mon May 15 07:57:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 13240934 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32D51C77B7D for ; Mon, 15 May 2023 08:07:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6577B280002; Mon, 15 May 2023 04:06:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DFF4280001; Mon, 15 May 2023 04:06:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BCB1280002; Mon, 15 May 2023 04:06:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 27111280001 for ; Mon, 15 May 2023 04:06:54 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0005B81331 for ; Mon, 15 May 2023 08:06:53 +0000 (UTC) X-FDA: 80791758306.09.8A3D577 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf22.hostedemail.com (Postfix) with ESMTP id 4C48BC000C for ; Mon, 15 May 2023 08:06:52 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=jDA5YrBA; spf=none (imf22.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684138012; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:references:dkim-signature; bh=qQ97W8DjtNWYNvTOAleOKLKZr+6FI4styhSio5/BDPE=; b=RlyJiyTX86KW4Zp4U19yajjahULv1f6DPcvTL2r2huKWhQIi8jQOo6YK20zLotCEWjFsJ5 4CIfSXRugJ7ucAsHu0/0JyXE9AIONfAOFseRjziZJ2VC7zol0QaJKx17luzXks1IAJN7Ak j7Jmnio70u0TAXz9BiwCiNiXd2HhFoc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=jDA5YrBA; spf=none (imf22.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684138012; a=rsa-sha256; cv=none; b=5JL1p+sAxvTZZkkE+U5Lz5RpFeG6UuK8rOJZkS8NO2bvE6P0kXYh8nKMEHjIWkwJzisl1r WfnCumFANi/4JFhRg781cCWxXQtGmD+YgfuOCAMwbSiv/8LuTEpfZwv5KuAYxsT1nDK+21 siPwISRcePTPGHKsMLImCH+2u3nUNgU= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=qQ97W8DjtNWYNvTOAleOKLKZr+6FI4styhSio5/BDPE=; b=jDA5YrBAqv2XXwX2hyoap3XhWh FUFqXWI9xbofaUhrnD/ux504IzigT+5UAWA2nMY5JWOA6Oqia5Te8jXiDxFNK8pNpovPpq5Ipx4Tp BoP1Xn/k2yhszEl4J3D1i1ULvw2aVOT2NmbFxiAt/QCeyGGnPAoLUpB5+TENS4VG9T0BTK9qeOYph j0IJUDpNmFgbT4b5PUux6ZW+r1nWua3QIgMmTlB8o48//Is03yKfVTJtReG1SFLB/GbnnyxmvNPD4 42RHsxPs8LP1AfUAk0r3kC5W2n+QFqPC+el6SkJJV5JBjO1M1OFIEMoIuucEObRX9HHJj+weRarpG WQ5sFIOg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pyTDl-00BQN6-1z; Mon, 15 May 2023 08:06:18 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 934F2305ECF; Mon, 15 May 2023 10:06:15 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id D82FB202FCEA8; Mon, 15 May 2023 10:06:10 +0200 (CEST) Message-ID: <20230515080554.657068280@infradead.org> User-Agent: quilt/0.66 Date: Mon, 15 May 2023 09:57:10 +0200 From: Peter Zijlstra To: torvalds@linux-foundation.org Cc: corbet@lwn.net, will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com, mark.rutland@arm.com, catalin.marinas@arm.com, dennis@kernel.org, tj@kernel.org, cl@linux.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, joro@8bytes.org, suravee.suthikulpanit@amd.com, robin.murphy@arm.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, Arnd Bergmann , Herbert Xu , davem@davemloft.net, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, Andrew Morton , vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH v3 11/11] s390/cpum_sf: Convert to cmpxchg128() References: <20230515075659.118447996@infradead.org> MIME-Version: 1.0 X-Stat-Signature: ayw3bwwart4zcxms6usqrs819i5ah8ky X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4C48BC000C X-Rspam-User: X-HE-Tag: 1684138012-819472 X-HE-Meta: U2FsdGVkX19mGaF0+D9yAnoczljgez2aT+QAihUFnpBDpEfHDxJqQ+a40YSAMfg4MriFm1mxymYqpoiHGAqf0E3MUdL6lpvxKYlckHeuX+iZV4iyPk+r0t9G/JJvWlpe+N+Uq+WkGG4uZwnGHb2wDf+A6tdwdbwgsb0aoWRmwXQzoseJMC0ok7LLSj96PqEiErGffJInkx0HzxZC7HkF35XqKbeAqP71Ns503QGxrpkKdqLQyr7JIrph2B89eTgcDmR1jdJ04SVQs3iMBtAsHsBS6Gl/P1640bIBa4Tbuo0/Hyr86l1gtTOF0py39xp668iZzWW05g1QM2EvWumKIsgETgNGzfj/5xVbO8BHJrDTUVLhcRhCok0ZSBeZN49AorJ6WnEa8AXAt7D36wLdT3nzkcKtqSGmECBkSiOfnE8YrL9kdZZm0o5KpeP+X81BtjMqipW2X3u9dy6xuQrb0WfLs2E+uYuWMBgrKkdlV21OZC47MadsrD66zaHjxW45T3ZIOnVqRS+w4RBVYYG7Py/+Foeku8m80B660eJQ/UzCs4MWOidZrJK2zJ7E1lAQ4Uf6hKyA841zo2545USCPC4MvdHUWApWY8Jcx5wyYTCM3WbrJ0QtLmPg0wEX3ZrLYLISX58vzx0OxJZoLAccb1pwWu/A6IZAZYzVtZ78iJr+UeKqW/tcXkdGaWnlVwvCYei/S5Jye3PB2lhAVDncRdfm/BHpp2xjxY/fHEaVviQmEmi+PS0AHHk74+DP/sglO5dSy4DdFgFFf0g8FL8sFp9D7LAKb4a0apXI+thYLFXOiBZMg+7V06mBw2OlgSRRjRAzQeMWGvbI7njcNSN9vWLnIRKxJBPA/EhABTml2KqRzHFWOQaDr4fKDOXQ8udKukeFadaYlH9LIOB8q/9iaDxv5OKv1JX+/8sfDohccRsLtmjkuY2G5Gx1YdLFhY3cT//+XxLWIyrQa5LyPd+ Hp1ENGtM iCqWwutjqob6Tuq6NS0dmKErsvwWqM8m+nzhMwx2IFXSNpsZ4PJumriCyPPqLJELGMrymOKJKbYMVZp5dg1V1xNeJJiFPeSWKgMjorsoMgha0vcuZYEdjU1D06nOlLzE+zFsUT5EEqQOb5R6CRF4g8UGEzMNlugUJqOX/J5FaUyxcXNhXKEw5uayaQJBo7fBmXTTRXPHk5JriikVmBHOeBpZpCmDHu1Du+PxWGf0TdZfwcsq/oJtD+2g8Pz4q2tJWzUn3n/uD5CbC4bnR+O6lnXL1tF0wQSF/KcH4h6YREBcE6XgYYBqc+xQI55qpQtUKHSr10rPrq3sZWkyQHM//bF01/Ke6TNTpVgj0oN6UYyLOuldnfjZwwgvp1lcimSAQvnUJMjKUtGWy6lIWKrUn1FIsDjmj4uJuh89w X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Now that there is a cross arch u128 and cmpxchg128(), use those instead of the custom CDSG helper. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Heiko Carstens --- arch/s390/include/asm/cpu_mf.h | 2 +- arch/s390/kernel/perf_cpum_sf.c | 16 +++------------- 2 files changed, 4 insertions(+), 14 deletions(-) --- a/arch/s390/include/asm/cpu_mf.h +++ b/arch/s390/include/asm/cpu_mf.h @@ -140,7 +140,7 @@ union hws_trailer_header { unsigned int dsdes:16; /* 48-63: size of diagnostic SDE */ unsigned long long overflow; /* 64 - Overflow Count */ }; - __uint128_t val; + u128 val; }; struct hws_trailer_entry { --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c @@ -1275,16 +1275,6 @@ static void hw_collect_samples(struct pe } } -static inline __uint128_t __cdsg(__uint128_t *ptr, __uint128_t old, __uint128_t new) -{ - asm volatile( - " cdsg %[old],%[new],%[ptr]\n" - : [old] "+d" (old), [ptr] "+QS" (*ptr) - : [new] "d" (new) - : "memory", "cc"); - return old; -} - /* hw_perf_event_update() - Process sampling buffer * @event: The perf event * @flush_all: Flag to also flush partially filled sample-data-blocks @@ -1362,7 +1352,7 @@ static void hw_perf_event_update(struct new.f = 0; new.a = 1; new.overflow = 0; - prev.val = __cdsg(&te->header.val, old.val, new.val); + prev.val = cmpxchg128(&te->header.val, old.val, new.val); } while (prev.val != old.val); /* Advance to next sample-data-block */ @@ -1572,7 +1562,7 @@ static bool aux_set_alert(struct aux_buf } new.a = 1; new.overflow = 0; - prev.val = __cdsg(&te->header.val, old.val, new.val); + prev.val = cmpxchg128(&te->header.val, old.val, new.val); } while (prev.val != old.val); return true; } @@ -1646,7 +1636,7 @@ static bool aux_reset_buffer(struct aux_ new.a = 1; else new.a = 0; - prev.val = __cdsg(&te->header.val, old.val, new.val); + prev.val = cmpxchg128(&te->header.val, old.val, new.val); } while (prev.val != old.val); *overflow += orig_overflow; }