From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 A04AA2737E3 for ; Thu, 23 Apr 2026 12:24:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776947093; cv=none; b=IbP+VtTued2vYk5BCoYeCvl+SkLsFeHqREbSBYn0FEKl3tj3aQZ0nGXQw6nC5IdaHbognhll5lBVE12nO4gNh7VZclMSqSBdhQezgscKd6iWBP0mHX/5eGWRDVL+YP8P8N+DJc1zyRYWWy9kwiRtxJPIh2RDNlLdV5snAWfLNWk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776947093; c=relaxed/simple; bh=22csvG9GRaf/BX6GuMwQHlvP8c0dhRAphlpB2jAkWO0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dUElTm+u3l56NrqLNtBVlySdtSXAMnGCw7HLtLgoCvg+QL2ZPeIWgGhsKsgrBLp+FuKs5B9vjCOXPXr5KUljALTydHP2zYdRxmaRdFsGvDUmya3zvkiU2vIJvC/n2Ps2Yyi3rmoyVgl11EF53br+gAO6TrPXqUmqPg9Pxm580uI= 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=aPl4O9Su; arc=none smtp.client-ip=209.85.221.43 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="aPl4O9Su" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-43d74086e5bso6450750f8f.0 for ; Thu, 23 Apr 2026 05:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776947088; x=1777551888; 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=VtlmVXsrBR7qEczShYHnYwWDm+M14LhdN7rkrKGVul8=; b=aPl4O9SutdkPoOu5eUvsyG+DNN818D/eDmIfqPup67YXe8BTEGbr3KlqY82Qa+ClrE ZRkQy1wGQvuE01ykTPgfzeig8J4sOvuVtBMW8NOb6IPJ+PBh/GRNEx6IJjSpZMvEt4VU PHfXfyeI21XW86Dc/B1i4uMDtdacFd4g8Se27xtgPdcUkjb7FNjfmzbpU4hAf4s+3ZQ/ VGfsvWdpSuJUz3ymDJ1Xn/HxStwcL7IVYxPgh/kIKtOpMv8XBS1cdSlnOFP4VAGJvllt 5aMtbonZUEbt2Z4R/ZYqQh0nKG/l3llM1J7k2nYfxfPHPFzWw8eDgTwjo7AqzNZ2EmHV te2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776947088; x=1777551888; 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=VtlmVXsrBR7qEczShYHnYwWDm+M14LhdN7rkrKGVul8=; b=eTDNs7ilJtNIwY7Q6cUhpr4LH8AFxCTaUw03feoMK5hPTCiPEwTkPFIS1AJ5lj6CPr qH1l2g9eax6bLunWqGT9NkTPav1vx6IpS6yO3wgTaDJeWVZh/Fhmwjp+2mVqA05/K81j F3GUHWCJRXBH1o/0ZCMItgQG7QazqWWmOVWLzAVScRCOeUJwNTRVja59CNHYTKovn3/V SRG78aIoLOkls2Yi/97RRtaVW3nwEPhjCUs2hCDBE+qRK58WbHH2H00WeUmlu0fpreaT MmdwUeTNRlUhU8osvFy4XN29VgVf9So0wOnenoBw37EOtLT3LH8HlQNvfTr6z0g5quPU o3Cw== X-Forwarded-Encrypted: i=1; AFNElJ+dCBgae8VWsvULVMbYpSAm2ewi/1YrcxZQ66Kp/VrLZiDHf4bNo3rMjIV2A7vD6gutTchcHzuTBT6VDg0=@vger.kernel.org X-Gm-Message-State: AOJu0Yym7pkLhdmTujFqD1WLsvkLdtyYG0zNrpOAymh6j/TJDrgOQu2U rSvKswHc+mJ5pSjRNVX5+8kGo2OJZyJKwfrDegkLmmtjVfmZdDS74Qai X-Gm-Gg: AeBDieuBNAff1pKvJnyweSARq2OZYGvdC1JmS0o5wt3mp4h4byOWZQ9tUR4bMb16O6m T53ctiSfyA9oWFAL8W64j2Ewb0T9U/yfsUVprWJLE427IiSpntIVzshVXVCOgTxZngAAYD2c+Pi FAXY1qp2pmzIgEQNki/c0Y7gNK25srCP9yd4175Oi+yZiOPcXIeQV2DtJkXuNyibVfNb/zU8C0g s4Rk8NGlMsUfvpSmn17MeZ8JUfm0LCbM1kb1Kkvm2DqcjWelhDvTHWtCupJPjNDW0Pu+pk9oM3P bB6hRkUvpMu3gIM4Kkhjxbpam2hOpJj6r5Bc+l5hrMJhimHffksfUribBLn6jmYwpd2YnVU7xiF 8b4Cz1bpDZSjd3Rv9IvcRheggawMlJmcewoWZtnApv9I35lWgO+79nVAvSTnhHrMM+JnLVWxOLo Hzn2Pq5alZGgMsHKW74SR8UKwAyrK3NZ1x30p9GsPSgShxW1LH04cJ/MWF+LJGC+RJPK4HYEUwS LM= X-Received: by 2002:a05:6000:25c6:b0:43d:7af0:3a7c with SMTP id ffacd0b85a97d-43fe3e0d44emr40367257f8f.29.1776947088049; Thu, 23 Apr 2026 05:24:48 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e3a341sm57552815f8f.24.2026.04.23.05.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 05:24:47 -0700 (PDT) Date: Thu, 23 Apr 2026 13:24:46 +0100 From: David Laight To: Mathias Stearn Cc: Thomas Gleixner , Dmitry Vyukov , Jinjie Ruan , linux-man@vger.kernel.org, Mark Rutland , Mathieu Desnoyers , Catalin Marinas , Will Deacon , Boqun Feng , "Paul E. McKenney" , Chris Kennelly , regressions@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peter Zijlstra , Ingo Molnar , Blake Oler Subject: Re: [REGRESSION] rseq: refactoring in v6.19 broke everyone on arm64 and tcmalloc everywhere Message-ID: <20260423132446.70478a78@pumpkin> In-Reply-To: References: <87zf2u28d1.ffs@tglx> <87wlxy22x7.ffs@tglx> <87ik9i0xlj.ffs@tglx> 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=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, 23 Apr 2026 12:51:22 +0200 Mathias Stearn wrote: > On Thu, Apr 23, 2026 at 12:39=E2=80=AFPM Thomas Gleixner wrote: > > The kernel clears rseq_cs reliably when user space was interrupted and: > > > > the task was preempted > > or > > the return from interrupt delivers a signal > > > > If the task invoked a syscall then there is absolutely no reason to do > > either of this because syscalls from within a critical section are a > > bug and catched when enabling rseq debugging. > > > > The original code did this along with unconditionally updating CPU/MMCID > > which resulted in ~15% performance regression on a syscall heavy > > database benchmark once glibc started to register rseq. =20 >=20 > Just to be clear TCMalloc does not need either rseq_cs to be cleared > or cpu_id_start to be written to on syscalls because it doesn't do > syscalls from critical sections. It will actually benefit (slightly) > from not updating cpu_id_start on syscalls. >=20 > It is specifically in the cases where an rseq would need to be aborted > (preemption, signals, migration, and membarrier IPI with the rseq > flag) that TCMalloc relies on cpu_id_start being written. It does rely > on that write even when not inside the critical section, because it > effectively uses that to detect if there were any would-cause-abort > events in between two critical sections. But since it leaves the > rseq_cs pointer non-null between critical sections, so you dont need > to add _any_ overhead for programs that never make use of rseq after > registration, or add any overhead to syscalls even for those who do. >=20 That sounds like one long rseq sequence where the 'restart' path detects that some of the operations have already been done. David