From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3C6C3A0B1B for ; Tue, 24 Feb 2026 14:49:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771944595; cv=none; b=ElJy2TwOtnWKsOcGQmkTl5JKGYGivgHa+6u1ehukl/xSDVRvIQbfKof3MRz3abbR0JP/8n2rJb6kjxt9W95Llw7p+GlEUMFQabV3ctBuGf9KJCi2MaWvd3aGWIgtM9fgdkKoPhUOpjmnaIStyZjNhJZFBIXBXnQ5CRTSjXM7SrU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771944595; c=relaxed/simple; bh=jEiyT8dfTlxDGSI1lY2HI8ZHU67cajouuwQo5juVFSg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N8T62ZbmrvzZWCBDuuKbJioL6ttZqZ5ulho1sR10x3Vj6NOe9FVeM0WCESzA72nbqgonRt0ugODbI+4mNqm5s1u5aAOKVXbLaNT5+j6QZ7WNOgOdEOHhNsvmNg4FfDWYSuFVf9zg0Z9yEQYGVLbQyRVmt3wDaPYj7BqvpuSKK5g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Vc1ho45x; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Vc1ho45x" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-4362507f0feso3517044f8f.0 for ; Tue, 24 Feb 2026 06:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771944592; x=1772549392; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=k+1bS4AlfDLIzgL+JVJWv3OSTrDYwWs1WsgLNJHhwj4=; b=Vc1ho45xZGRAcnkw3+q8iJCHIWkE4+LVhMHj7qXvTPgvDsNjcmdGpA83E+CH4EyY6U BOpSeXGAkrGskWqC0gVk6Ri3pGN3ip1FCFkGPQNh5c0DRzG0Kf975lm8UrGK8dutCnqB IzKTTKGyHp9ncysoa9iqGnFaY5gFZ7kRlgR4OErOvQJ3f9k1B6/KNty2iYCZu3UYhVub UICqwKBLLlH8Yw0XOivfFVYzlXc+oK/024UdE+w50Hi6Q1T8Ou4LaautD9Ex5LTw0d7K uc3X94F4tXqcp6pedB0GllzLzPCqXRuudyjQ0/R9hQ1gZDdweoy4CAO3AMquoBC6VccI s7jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771944592; x=1772549392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=k+1bS4AlfDLIzgL+JVJWv3OSTrDYwWs1WsgLNJHhwj4=; b=C6sS0CrXyVkTVjNZ8dpjjISapPI/bVR3DS4opiiduaQrC2L9qUivCQRQloC0YC6zf9 yMqtbUsSojgmjIiWjNgpZNtUlkls+TpnZ//v6eLA1+s4WUDZx9Y3fRS3F3h7gqlHHQHb W21LnY4kxzLt1OW9io9hmxkO2Kanv7ZsXX8xOfAnP/rE92Hrzdp5+OPxXbGqEIy1wYhK Ruv5fUICGUlsGQW7BgMBwY2Ipul2TSKH5HwRowvRiK11ETkxICS+Hiw7uhi0bmWrGiIH KR7tlyCfTiLDjyxkaGnl9bKVWcODlb1urdbg4qgduiHLL03N0Pj11UliCD2jBhtfXEC+ P/bg== X-Forwarded-Encrypted: i=1; AJvYcCVb7Jcdxmfz1TVVeFQVeVezc62WXTpRdKy64foudlLga4fN6EfCd0NvsmngxFbjAInGxFiiEwVlUBy/Rz4=@vger.kernel.org X-Gm-Message-State: AOJu0YxhY8HwzrzrFvPB1TtpNzO0gxIPRszWOHZFrnbLhuGcZBA/kDAv dtkeFF7Ih+ph0yoodGMOPJa5rSXOtoe6J5fwJs7Pj/e3IMP97vKfD7Zn X-Gm-Gg: AZuq6aLvotg5+OdjyF8SsbqHrpJFA+FSanOubeQlxDiN/fXvVTyHb3M/GkqI0q1Ghks NttEEoZfxxiOt/C0qjwRfSS24fIALYvj0iejVyuzs8m/ntkTC7fM+BpvK5kOh8D+AAbi6Sql6zy kqE5xIbKplqU+dZNo/P82Ptbe0JiEF1qTJfhEl7rYw1Cc0/ehAicMZtBMANRDIz1r8yNrwmXDZV S09Ubd2jXfafTVG+BoEdFqACT6fDNbxUxR/aY08PP5LPYaa3/6pfjXqJhMAWK7amYmO75rGecxR Elm4YEL4bdRdQ+cjxpQ+yP8IyOYTxmaZlexCicWsawbLXlFfDZfLhwwkVAq0GooReHteBXn5e82 efyQPOR+dn1ptZx3fhx2+OCj5YXvbxZdY+jU7c6/aPAVvIDwTZxpFHxoV4fc5UsHzNmXr/ZxSL1 vYjFcCTI9NHUMyCrYqx4oQmXQFW3Yv7F6G0XzZAduQHJsDDyz/vpfeK+bAbuncrmMT X-Received: by 2002:a05:600d:6445:20b0:483:abeb:7a5c with SMTP id 5b1f17b1804b1-483abeb7b61mr136630425e9.12.1771944591893; Tue, 24 Feb 2026 06:49:51 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483bd75dfaasm2571275e9.12.2026.02.24.06.49.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Feb 2026 06:49:51 -0800 (PST) Date: Tue, 24 Feb 2026 14:49:50 +0000 From: David Laight To: Mathieu Desnoyers Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Thomas Gleixner , Mark Rutland , cmarinas@kernel.org, maddy@linux.ibm.com, hca@linux.ibm.com, ryan.roberts@arm.com Subject: Re: [RFC] in-kernel rseq Message-ID: <20260224144950.38f6a632@pumpkin> In-Reply-To: References: <20260223163843.GR1282955@noisy.programming.kicks-ass.net> <20260223175357.481c161e@pumpkin> <20260223215436.GS1282955@noisy.programming.kicks-ass.net> <20260224102728.1273c080@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 24 Feb 2026 08:33:23 -0500 Mathieu Desnoyers wrote: > On 2026-02-24 05:27, David Laight wrote: > [...] > > > > No scaling, in this case it is fine to add the rseq just before needing it. > > In all cases it is fine to set the per-task rseq pointer just before > needing it. That's how the userspace rseq was implemented. > > > But if they have to be set in advance then you start getting a long list > > to check - I'm sure that must happen with userspace rseq? > > No, userspace declares rseq_cs descriptors in its data, and populates > the rseq_abi->rseq_cs field (thread-local) with a pointer to that > descriptor at the very beginning of the critical section. > > So return to userspace after context switch either finds a NULL pointer > or only needs to load from a single rseq_cs descriptor from userspace. So all of the program has to use a single (per thread) 'rseq' structure? And you better not try to use it in a signal handler. I'm sure I should know the main use-case for user-space rseq. I do remember a big problem with short-duration 'hot mutex' used for (eg) removing work items from a linked list. Although the 'hold time' is usually only a few instructions (so contention is unlikely) if you get hit by an ethernet interrupt while the mutex is held it can take milliseconds for all the softint code to complete before the mutex is released - not good for system throughput. David > > Thanks, > > Mathieu >