From nobody Wed Sep 17 01:25:27 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2B70C4708E for ; Tue, 27 Dec 2022 12:16:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232054AbiL0MP5 (ORCPT ); Tue, 27 Dec 2022 07:15:57 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 18c2355838e76788f61849f4d83513b103d68b95 Gitweb: https://git.kernel.org/tip/18c2355838e76788f61849f4d83513b10= 3d68b95 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/selfte= sts/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; =20 /* + * 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); } =20 +static inline bool rseq_mm_cid_available(void) +{ + return (int) rseq_feature_size >=3D 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);