From patchwork Wed Mar 22 20:14:54 2023 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: 73663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2561198wrt; Wed, 22 Mar 2023 13:44:32 -0700 (PDT) X-Google-Smtp-Source: AK7set8JsTzxuWK2T7ozM//QqtjlZx8Bu+zbWD+SZ1YpEgF9QZ4dDnabQtzqa9bB2g8qZBQfNNW1 X-Received: by 2002:a17:903:4093:b0:1a0:57dd:b340 with SMTP id z19-20020a170903409300b001a057ddb340mr3106573plc.64.1679517872212; Wed, 22 Mar 2023 13:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679517872; cv=none; d=google.com; s=arc-20160816; b=Ta12+epsb/Yln0fQnVUoGr9FT19slpeYcaRGa+t/IvWL7s8aZLxfkezDZ7mGehFnTQ 91qCP1fR0ItjW0e0iO/VdAmu3EfuZ6gIr2Fy2GX4d2c4P6N3/JgPi+zcGQ1Qygg4ADAN dUGRiPCKYZ/3V1QowxXlxw6FmwdnggdxX5jDlbGyExgnrpXmdoPmmTNJsH5lWQwzNB6D p4ppaC7C34nSpFHMtv23CspxRXrfN8X8blsdtzG1Uoq63zYTP96dqut0mH5uxhdRTVNd ohZ+b74XMKc8bBft6pThWuX9y/qCoSAGgaF75qb5KBtlEUQZzfg7VqOVvDGfx7VbC/D2 Mdww== 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:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=5u8tyN+IU56rA9DJvsFKN9/HGFOyV3KihMrCzYE7Tig=; b=wqz4hwLL7Ic/5eqGWSv+80DZIoN7TyfsKuYBLtBbaf/QRyVy8wv9kgX2A7CrbP56JT FO6SwAEEvXtMps6sDx2ot10M+y7JmY2xstp3E5MXf9Y30eqnLglF5F21NBGV/0xZAO4A bJh41fGAR5IXUUfwBYenjl1k2coN6584g5GYP2Y5rdtvIHTFYvEBROtFauKXd5aqRz3A AAsFsHS6qpwvu8A/mjAIx4fZfK/0EU/30o/PANc2PW+a1jVRBjzTnSeznAnuVOSUHjSd sHt/aeNcqJRGXmbUyTG3UKJj/hVzYtBRCNshHzhVSPw/ZmKGX66Hp85pUAcTH4BFtPaC pHRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dOeThJs2; dkim=neutral (no key) header.i=@linutronix.de; 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 li12-20020a170903294c00b001a1f5f00f59si1550621plb.452.2023.03.22.13.44.20; Wed, 22 Mar 2023 13:44:32 -0700 (PDT) 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=dOeThJs2; dkim=neutral (no key) header.i=@linutronix.de; 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 S232298AbjCVU0p (ORCPT + 99 others); Wed, 22 Mar 2023 16:26:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231558AbjCVU0Z (ORCPT ); Wed, 22 Mar 2023 16:26:25 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7D3C8C971; Wed, 22 Mar 2023 13:16:36 -0700 (PDT) Date: Wed, 22 Mar 2023 20:14:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1679516094; 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; bh=5u8tyN+IU56rA9DJvsFKN9/HGFOyV3KihMrCzYE7Tig=; b=dOeThJs2aeTXzpx6JcZq+XQffdxkbkYU4iW/Ck0hMkCJIPg3UmvUxrsu1WLMWjRL5+YNOY W5Ku3K+I4i74ynHAbw6YXVLFzc2DR2f7AihHdBOjuN025dJEUoRjmvn1KBe2TXz3M468iM mPWQ30KN+AMFzRqGhzI2abc/Wj/X/6avhZxL2kpuZ1/YON0fJyoi+Lt3yTuD3HRArlUsam e00tSQHakKVKCz6UCzmEm/3kH98lnvaQ2dn9EfkNEuxksZivaaFvhQ05tEelhKwoREuqQV aPleWxSu5Kyg4PLTvE5Gic7tQAXi6YKni7x2gI6Ck5I/VySG82dQGVrDdy6Uqw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1679516094; 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; bh=5u8tyN+IU56rA9DJvsFKN9/HGFOyV3KihMrCzYE7Tig=; b=ukjSOLfG1veKNlteUs+nRsbN0kr8p9dRUory59YUF88uC046s/4vnPnaky5VSq7i7lMI7E 5WBrgJKJr0Coe5AA== From: "tip-bot2 for Chang S. Bae" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/fpu] Documentation/x86: Explain the purpose for dynamic features Cc: "Chang S. Bae" , Dave Hansen , Tony Luck , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <167951609417.5837.17571344184577472295.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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?1761102132771807346?= X-GMAIL-MSGID: =?utf-8?q?1761102132771807346?= The following commit has been merged into the x86/fpu branch of tip: Commit-ID: ad9c29f3c29197aa25d26a5f258a98e4cb901996 Gitweb: https://git.kernel.org/tip/ad9c29f3c29197aa25d26a5f258a98e4cb901996 Author: Chang S. Bae AuthorDate: Fri, 20 Jan 2023 16:18:57 -08:00 Committer: Dave Hansen CommitterDate: Wed, 22 Mar 2023 13:02:18 -07:00 Documentation/x86: Explain the purpose for dynamic features This summary will help to guide the proper use of the enabling model. Signed-off-by: Chang S. Bae Signed-off-by: Dave Hansen Reviewed-by: Tony Luck Link: https://lore.kernel.org/all/20230121001900.14900-2-chang.seok.bae%40intel.com --- Documentation/x86/xstate.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/x86/xstate.rst b/Documentation/x86/xstate.rst index 5cec7fb..e954e79 100644 --- a/Documentation/x86/xstate.rst +++ b/Documentation/x86/xstate.rst @@ -11,6 +11,22 @@ are enabled by XCR0 as well, but the first use of related instruction is trapped by the kernel because by default the required large XSTATE buffers are not allocated automatically. +The purpose for dynamic features +-------------------------------- + +Legacy userspace libraries often have hard-coded, static sizes for +alternate signal stacks, often using MINSIGSTKSZ which is typically 2KB. +That stack must be able to store at *least* the signal frame that the +kernel sets up before jumping into the signal handler. That signal frame +must include an XSAVE buffer defined by the CPU. + +However, that means that the size of signal stacks is dynamic, not static, +because different CPUs have differently-sized XSAVE buffers. A compiled-in +size of 2KB with existing applications is too small for new CPU features +like AMX. Instead of universally requiring larger stack, with the dynamic +enabling, the kernel can enforce userspace applications to have +properly-sized altstacks. + Using dynamically enabled XSTATE features in user space applications --------------------------------------------------------------------