From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5945B1A682A for ; Tue, 30 Jun 2026 08:29:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782808142; cv=none; b=N2KDkBZb2uNdhBLjFqM5gUQ22kl4KGnzopY/dqWDhYq4MiAqX4gcYZbCumt0f457G1vvqqTfCs63kF+Avsmu2DEDgwzLND5Eg2Wy65+74E4hvk59xHHZjfVW66TeU4byjqWhixaiZ2HyLAdMp/X90cbrlAe4O3bDi+VcOXNhubk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782808142; c=relaxed/simple; bh=yT/0m4ZS3stBm8tAmbqFYej09JiY5ZdFNfmTNNYKWP4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=rk4SR/3urGaPmx9a6OS8HxFbay0uKv69bboh7ECbI28jGIxEiOdI1DjnC6HhBUcddVKRU+OMmmujlc/pOdtX26Uto7tEcdR74lJJmf0uVL5McO3MtsiRLNTwCApJKYARzLi19kJ/vgz3bOGvw0bMbNGP7J+/+a6HC5fZhk0KJZk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QjJEArWc; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QjJEArWc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CA941F000E9; Tue, 30 Jun 2026 08:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782808141; bh=NBSQrrcP22vcidqBU5gs9JP9ZNJkO8H4LBPIYaG3eqM=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=QjJEArWc6o2bKMiByFHlpaEcIa/OX3OXGcxzE2bMrmH44w+PQBkqKu3l4ekfgXLuY fPZdoJAMcOfsGY0obVkd16FxAqon+yo5X+5azLEYSpuZOzaM0QYMEZSEB7lowm+P5s lbc3XDU2CfCGTctts8WmoPZKYYQzuVUH4jU8eDBlfa/eDFwk6dvKs6j8WdMN357NoY SU098KQy0kcFPk2EHdgkZDoeB0xk/XDWtE4PCinelV/YWa6WVt8goSGqORVnON+PJ8 4tyWSNueK3GgBBt2ZbeVJCeVtTHkxYf7oM8gxZiyGQWzPlX4y75gJecrwlnIu9x7A/ Qu2ZG+YjWsioQ== From: Thomas Gleixner To: "H. Peter Anvin" , David Stevens Cc: Pasha Tatashin , Linus Walleij , Will Deacon , Quentin Perret , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Andy Lutomirski , Xin Li , Peter Zijlstra , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Uladzislau Rezki , Kees Cook , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 12/13] x86: Add support for dynamic kernel stacks via FRED In-Reply-To: <7D930EA3-54D1-41CD-B547-8A2A69F89142@zytor.com> References: <20260424191456.2679717-1-stevensd@google.com> <20260424191456.2679717-13-stevensd@google.com> <87zf0hgc3r.ffs@fw13> <87ldbyhatz.ffs@fw13> <888C322E-BF59-4C72-BFD2-2E71FD8605C0@zytor.com> <878q7xspqu.ffs@fw13> <7D930EA3-54D1-41CD-B547-8A2A69F89142@zytor.com> Date: Tue, 30 Jun 2026 10:28:57 +0200 Message-ID: <87v7b0qvna.ffs@fw13> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Mon, Jun 29 2026 at 07:52, H. Peter Anvin wrote: > On June 29, 2026 1:41:13 AM PDT, Thomas Gleixner wrote: >>On Sun, Jun 28 2026 at 13:33, H. Peter Anvin wrote: >>> >>> To be fair, for this *specific* case, memmove() does exist for a reason :) >> >> It does, but why bother doing actual work, if you know upfront that it's >> not required :) > > Of course. > > Then there is the very open question if this thing has legs at > all. The jury is still out on that :) > I'm still interested in using SL1 for the interrupt stack as I think > that could be a performance boost. I'm not convinced that it will give you a measurable boost. It spares the trivial stack switch to/from the interrupt stack in call_on_stack() and the hardirq_stack_inuse logic around it. With an interrupt rate of 50KHz and 10 instructions spared, that gives you 0.025% performance win on a 2GHz machine. But if need_resched() is set the return path has to do the full stack pivot to the SL0 stack. That's a memcpy() of sizeof(fred_frame) + the extra stack consumption including common_interrupt(), which accumulates to ~256 bytes, i.e. four cache lines. Plus the FRED_CONFIG MSR write. IOW, if need_resched() is set, it's a guaranteed loss and latency sensitive scenarios including RT will notice. Thanks, tglx