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: 101489 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2889529vqr; Wed, 31 May 2023 06:42:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7qV8RbDVi4WV0Pno7yLHgSeudKKLcc57INgxmY/zs3+1Zjl/sa7wCiQIITnbgsUGRjYoI+ X-Received: by 2002:a17:902:d50e:b0:1aa:fd48:f5e2 with SMTP id b14-20020a170902d50e00b001aafd48f5e2mr4830173plg.32.1685540576224; Wed, 31 May 2023 06:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685540576; cv=none; d=google.com; s=arc-20160816; b=aQSLEjONXWBB6fuDZtI2Cp7qY+9iWFkECB9wbKNyV0xD+oYm2wegz6UtlW2T4ek7iH sqv0PfCuo3f5DUPJ3jaN8QWTlcYNe7MVPn3Kqbw9vgozGoSf0spJJ2c8qVAycwhJPNST JIjJo7xLeVKfSp+qWsVcfsC1FvVPesnOFBC+/yu9FeE9u8BdCWoUs6VVKu7M8jqrwRPy rsH6MPLV9i7FowFi2QQJWeztNOMV5a4HWo54tdMJeQmdqjBCca5sIFZGJy5nePpZbcEf fInrE/L0NEm33uUXw45ueCbHHgXF5fmjd+ZGVz4f4V7neCygy2bn4m8+P4HbwspzlOch xjTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=1cvnhq64QQSvdQ/ThzyQEhZhPISdvBfB1iYqdfSw3+U=; b=f4yNF0f4lTSYzXA2oLCed3kRJVu437z+6QFqovDDkKHjdNGiUN0jloRef7cRAxwcaz qxajScVJ+1d9P7cd1bu6WyCpyB19D+fxuhvM9fqsTMU9+BtO/vKrwZc/E/a9Bg3CBhvI qUZPJPKf13KpYlFb/KgViACcehUTw0BRGsbIuc5vtEaW5XktVZHgXs9t8ADpmqklan4I gBlhKSXL1IYGVayiqn3Vfioqeg/ipifq0rCmoFeSRBRDZBlenuwMAzW3eeOps4wUXEyT y8mVeHzq/AFSf5qgNnAWQmg5X+O80nMHvFzWR+/RTA4cetCs+AI+V2S8P9UaF+sxWc7U uvkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=dEAiPyJ7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p12-20020a170902eacc00b001a97e24eb34si897216pld.201.2023.05.31.06.42.41; Wed, 31 May 2023 06:42:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=dEAiPyJ7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236524AbjEaN2v (ORCPT + 99 others); Wed, 31 May 2023 09:28:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236314AbjEaN2V (ORCPT ); Wed, 31 May 2023 09:28:21 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DA6812B; Wed, 31 May 2023 06:28:19 -0700 (PDT) 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767417394990419153?= X-GMAIL-MSGID: =?utf-8?q?1767417394990419153?= 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; }