From patchwork Wed May 31 13:08:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 13262285 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 557F0C77B73 for ; Wed, 31 May 2023 13:28:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B07DA8E0003; Wed, 31 May 2023 09:28:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB7A68E0002; Wed, 31 May 2023 09:28:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95B5D8E0003; Wed, 31 May 2023 09:28:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 84FA58E0001 for ; Wed, 31 May 2023 09:28:01 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 59AA8AD990 for ; Wed, 31 May 2023 13:28:01 +0000 (UTC) X-FDA: 80850628362.04.9FE6A5A Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf09.hostedemail.com (Postfix) with ESMTP id 21D41140016 for ; Wed, 31 May 2023 13:27:58 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=dEAiPyJ7; dmarc=none; spf=none (imf09.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685539679; 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=1cvnhq64QQSvdQ/ThzyQEhZhPISdvBfB1iYqdfSw3+U=; b=H8/Xe+NcrSBhoAQVpWsGz240+AWG9Ug+0Q26J0rm/r0TNG4hspAcMkJlwmdRw6Zei/sPTa C1VIcOQiwNEhylzbJpdgHrZSwDpn/4U2tj1AnPKHZbfVGbrc9Nnu1AroNsJdPo3JdUp0pj VH1VInGLDMJBOSSrvTtqZfWvvYIwihk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=dEAiPyJ7; dmarc=none; spf=none (imf09.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685539679; a=rsa-sha256; cv=none; b=pM5zA00cn+vgt/EruFVS43M4FRLlv4kMKFDSbt7gopKCdt2iHX6OddCPBfbOWrPEjxiG2c J1WwFRi1nsKC8lkGMxi61BoyBrNL2PDhb+JG1Hgf64xFWBR0nZ5LGOhvYZDfL81JMr7vBb xNSkUvQkS152U2iku38LA2aIAUclvvM= 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=1cvnhq64QQSvdQ/ThzyQEhZhPISdvBfB1iYqdfSw3+U=; b=dEAiPyJ7c8GWvTXHawa9FYMa5y RcTU2/dDPs5cY4YnB6+unHRRRJkJTPocT+l9fVBL1T5GVSYwKO0qeN8JqCcETx/Inr4/AN1sfHxRe b1b7BfbYcIcDYgL13wupMtVXdr7AJtNnY68GfgKL3U7VxymWSM1OiXmYlu2qvpGzKmGMenGmWnE6R C89aJ+e5ksUXHGUNZjP1BUpQNpIOJc4I4d3iDnPyyPZC/izy9S6ksKb+nDOSLa1BGtKCDchQIM0ta uoR3tky7q07ya5MwRnFIgl2eUqTdR+xf/+DHkFrE2NSPNjZStwAPAedEsWQ/7XfmOpjc+hjtQrfuA UncWUN3Q==; 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 1q4LrH-00FTCf-0R; Wed, 31 May 2023 13:27:23 +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 63214300E3F; Wed, 31 May 2023 15:27:21 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id AB266243B8573; Wed, 31 May 2023 15:27:16 +0200 (CEST) Message-ID: <20230531132324.058821078@infradead.org> User-Agent: quilt/0.66 Date: Wed, 31 May 2023 15:08:45 +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, sfr@canb.auug.org.au, mpe@ellerman.id.au, James.Bottomley@hansenpartnership.com, deller@gmx.de, linux-parisc@vger.kernel.org Subject: [PATCH 12/12] s390/cpum_sf: Convert to cmpxchg128() References: <20230531130833.635651916@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: fjp858xo1as6zr8e1x6rdjik34poxto3 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 21D41140016 X-HE-Tag: 1685539678-952335 X-HE-Meta: U2FsdGVkX19XRI82tyt4rTBKVEfbRcbpuyF+umaYBlTdG7CiIdCqlq0EGwNK+N2v04j2ZLvXzLK8odLsGaeOovdrHQVI1rbylYz2iUiZ/Vn/e+YEfrHAH4lHAyI5fXn0QY5CG9NJoS7eNrn408EbB45Mmfw0fScsKLjg5SOItNqqi///feHGDijnHlqAkMOBoUJDRUvfGsn5oMff6BpPWMG2G7wobu1G+IskIH8Qk+k3K1SDe/ZHw4qS5fJdzUF+eZIgGRqGxHk2vji0y6k6YHJZjHrhAWDkHZxB5hU2cD9mkaL0fHOZWDUtz/oukLDz1WBPx8cGg49Q+FOQ+J4l0P2BXH6i7WbC9zWbQLqEWwsLve+y7m823ivLG2fzilN6ya/aopVdb8U9qIavd0Y71UUXE+wOI8ZMXljYGwpY4yFnySkUNOPJxUN1s1N8jWdFt3hMOxzK99KECLrtkGGKJiaf5KtSxjr/RSn1EwyhdTA7qxcDa3JC1gPvRUbjugBVubU7js/N8rzKQnRqxFzF1tdaNq7NL2u27Jya9aJRPQcaBKG+COewATrhJWIRNHUYZ8z6K6S0o4hqjncshRgURvpeoj9de5wdYh8okd+3jbpimKcoH0Evr5RjsDQX3QWFkEBeYPTKrRu4Wocb1pHTnFdFdrExe5Ru2+IA549gMNrUcR8E9slIuSPZ52umV/EqDXayc/dcq409uIVLAZ8OuYfVXG5TCgtWHsXYS1hHp1z9A1djzUxmm++SeQ1/JEq1+EUJavaG7Y1Itv6jm9oYT9KrguKsQ9kt2lyg3Q92czFWq3CC6XQ68prPHMu1lvQQy1GRykucKUvWpdXLt0awXmSJyVY8k/Um74zQzWjxAJ2JYHJ93hChJgMvjXUJ3jtkoPONt++HI9bAMgp1jc8rPle8S9Z6gd2QCuCzgoKCFXHJ5oah0zM/TSYuarqyEaa47WCJdVdokLbZh3JoaLb a0qd5NT1 dyczngPB2wZGDbPuvlM7eFR87rch7Gl+3FMxkm0vkMX4vX27hsNteENAbnO9byJelNy3xTddnSQ8xft8slevIDoTVZ0fyV/oJfhqS3um2zfAFSR0RV2ZUrsQQuG7JO+pWTvou+9esaRmt+djQFR/k3XYxsToWu8juQTMcNBe0YoJIV04TCEbQGH7sk8sMmlpj6jQ5xDmSyEEL1W/dBI540sWEUIe8xwXaMEzzaLRpKbakmrNBO8Q+i6Zps64jNvScDVd4f5CcLGOQXrFk+2Avr/fNiJOGKvxb6xXwvBp09vL2l7V+D7tO4rwA1AGp49T1ql0CReZvwTZLPwvLMixUKboLug8KkVH9x6QVHokGGiHnhO8osAjfwhaI1mJd8lNk2xbXE9vhRXXPZpox5qs0vHXGvZ74eZ1Vi2o9 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) Reviewed-by: Arnd Bergmann 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 @@ -1271,16 +1271,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 @@ -1352,7 +1342,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 */ @@ -1562,7 +1552,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; } @@ -1636,7 +1626,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; }