From patchwork Tue Dec 27 12:13:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 36867 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1361394wrt; Tue, 27 Dec 2022 04:17:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXuwVHkjfSSSBBANRkRoyTilpWsWAWZ3yCeNFswNqJOvPkRQvfT9Qn5xRGmJz0UkjlxuZSdY X-Received: by 2002:aa7:db53:0:b0:45c:835c:c6d0 with SMTP id n19-20020aa7db53000000b0045c835cc6d0mr17944063edt.1.1672143428064; Tue, 27 Dec 2022 04:17:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672143428; cv=none; d=google.com; s=arc-20160816; b=fAZQFa3Sb4qcot3O4W2G20tIpXY/xq0g7Dvz2dTZrnn/GEafRUiAbqSBVibjN0/xa0 RrKqWcY1bunc2sfJSihnYMK1cqV38w8h3ZC0RsVTwykLQIkErg41m3LFU1dAQnTNziVY U4tvvR9mBvpw3+TofOYRtdQxldut/BB/nIVDwfPzSlkGpQ9lFn1e6kOfPqryvQR0bN8N bbDY3ANQ6ekPw0wXRnE/kz8C03NgzE0Wy+ZtlSilDd0apvX1fMTdENI9M9XUADgQDUHc o345FuJIIYQeMfx0KRQ0RR5MgCVqLZnCrFif2zsHPSIaA+G0DUe+CialHuMM+B+wWeYH gr8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=uEI2h/BRCO33DzPTWoOw6K+Y/WyQpvpk6lfZm4s29SM=; b=01TxDhpp+5L5AO4RuVOUj/z1A2OeEYlxrSjEsZkrTjqQe/t+cPYCosSKzCHlVnCKWI 9Q42zAuzvKyq77kYl1aYu8IGFVSlyyFzQqTZqFrpWqir4i0PxAd9qUYWgP03CD8b8Jms YEGQa/0YHg2cI0UbO1tPbcj7xKUfPZKwE89YmICavPh6VmoHD8jEj4IN8+JK18hEqt9U ZSujSLLlIpTkyKbk0iFb5n7KO/ZhCEf8+/g7xqhlmPnH/bP3OW/rEwPILghkQkPOs95d 1t9cLcNZAhRN+puGnglpFCv1oQ9xtozYkwePSr1asomHjMgWmUSePE3eDghrjlg+oZJn Y++A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=i6adXOC4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Qsy1piDn; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l23-20020a056402029700b0045938ab7129si9872993edv.330.2022.12.27.04.16.41; Tue, 27 Dec 2022 04:17:08 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=i6adXOC4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Qsy1piDn; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231826AbiL0MPz (ORCPT + 99 others); Tue, 27 Dec 2022 07:15:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231899AbiL0MOl (ORCPT ); Tue, 27 Dec 2022 07:14:41 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90C2BE97; Tue, 27 Dec 2022 04:13:54 -0800 (PST) Date: Tue, 27 Dec 2022 12:13:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1672143231; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uEI2h/BRCO33DzPTWoOw6K+Y/WyQpvpk6lfZm4s29SM=; b=i6adXOC4ZtiVB3QhOIhGRnX+ByYG1Jbcqb7fjAv/PfdCFLfCo7qhctq5gNedQqwvwv+CMT f4fCpdW5DA/HCpBGOfXnzf5589b2n/aX2O5ayPFPXVl+8jbrGYvgKdI1ET6PmVHd2Izmzt 9LTBXkUG98IS2ODmA9cDy+Qki3p2biP8alpw+dXcom2VIXq5T68ngckPzKHbOX1m95g4T5 dgrYJHbLpZOYuFAuhHOJ3mHLkY4O7EYhsM+2ioLBC+kajC26O32ZuCepjHiKJevjbmQlYO bFifKe3yGZOSKmfMxeeIYH7su8X8PvalXELaZwa67QIx22vGqpAaaQZ9BARa4w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1672143231; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uEI2h/BRCO33DzPTWoOw6K+Y/WyQpvpk6lfZm4s29SM=; b=Qsy1piDnaPlM8pgZD0aPZFycWaL9hdPaIi/pASnHXUt5t/DKkOaqJ10k+xAcyjUzceCmS4 1Y4+ZAFTuFDs+mBA== From: "tip-bot2 for Mathieu Desnoyers" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] selftests/rseq: Implement rseq mm_cid field support Cc: Mathieu Desnoyers , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221122203932.231377-11-mathieu.desnoyers@efficios.com> References: <20221122203932.231377-11-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Message-ID: <167214323114.4906.1139384318093660637.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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_PASS 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?1750230364313063439?= X-GMAIL-MSGID: =?utf-8?q?1753369466851601500?= The following commit has been merged into the sched/core branch of tip: Commit-ID: 18c2355838e76788f61849f4d83513b103d68b95 Gitweb: https://git.kernel.org/tip/18c2355838e76788f61849f4d83513b103d68b95 Author: Mathieu Desnoyers AuthorDate: Tue, 22 Nov 2022 15:39:12 -05:00 Committer: Peter Zijlstra CommitterDate: Tue, 27 Dec 2022 12:52:12 +01:00 selftests/rseq: Implement rseq mm_cid field support Add support for the mm_cid field (per-memory-map concurrency ID) of struct rseq to rseq selftests. Signed-off-by: Mathieu Desnoyers Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20221122203932.231377-11-mathieu.desnoyers@efficios.com --- tools/testing/selftests/rseq/rseq-abi.h | 9 +++++++++ tools/testing/selftests/rseq/rseq.h | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/tools/testing/selftests/rseq/rseq-abi.h b/tools/testing/selftests/rseq/rseq-abi.h index a1faa91..fb4ec8a 100644 --- a/tools/testing/selftests/rseq/rseq-abi.h +++ b/tools/testing/selftests/rseq/rseq-abi.h @@ -156,6 +156,15 @@ struct rseq_abi { __u32 node_id; /* + * Restartable sequences mm_cid field. Updated by the kernel. Read by + * user-space with single-copy atomicity semantics. This field should + * only be read by the thread which registered this data structure. + * Aligned on 32-bit. Contains the current thread's concurrency ID + * (allocated uniquely within a memory map). + */ + __u32 mm_cid; + + /* * Flexible array member at end of structure, after last feature field. */ char end[]; diff --git a/tools/testing/selftests/rseq/rseq.h b/tools/testing/selftests/rseq/rseq.h index fd17d0e..10ebf13 100644 --- a/tools/testing/selftests/rseq/rseq.h +++ b/tools/testing/selftests/rseq/rseq.h @@ -191,6 +191,16 @@ static inline uint32_t rseq_current_node_id(void) return RSEQ_ACCESS_ONCE(rseq_get_abi()->node_id); } +static inline bool rseq_mm_cid_available(void) +{ + return (int) rseq_feature_size >= rseq_offsetofend(struct rseq_abi, mm_cid); +} + +static inline uint32_t rseq_current_mm_cid(void) +{ + return RSEQ_ACCESS_ONCE(rseq_get_abi()->mm_cid); +} + static inline void rseq_clear_rseq_cs(void) { RSEQ_WRITE_ONCE(rseq_get_abi()->rseq_cs.arch.ptr, 0);