Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2984830rdg; Tue, 17 Oct 2023 00:23:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIGcPXmtgLNLtMo+mMpmSyraaELNTAYTgOKoYdy/QYi/86zvht6O1JdVAjNw6lwE2A1m8R X-Received: by 2002:a05:6a21:7802:b0:15d:9ee7:1816 with SMTP id be2-20020a056a21780200b0015d9ee71816mr1349431pzc.10.1697527416709; Tue, 17 Oct 2023 00:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697527416; cv=none; d=google.com; s=arc-20160816; b=ojyR7nPpkVCz19Hx2a3UaIOHA6mAfrlAYGqRKi4zGUEgjUd4/dcl6oBsTSFd2TjiUK dPl1Zitp7/9QLzqeKA3G6UFwIbAcaiBB2PWbCMYieK0ObWMHfzFm9aCjGttfhidW13Bq C9KZQrgEVl0n4Lddn6h8+wt2cEPwF6WiKTXJYzm8Qi35TggUti835icHtVYgc88oaShe kd7NJDWvuiaIqq+CP/+MdCYhmVR+pfyL8KRA5encAIAViZIMIkFzz1MC+Q67lL5n3iGM jPJJWWAZ9Otl9nEObiEquid1h5GCktPRAnKxOwL1Z9R7QSRgioYmQ+ZEEWx6/C1VHlfT mRRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=X6919Ey/B90MU8UdidHytxO89z0kAH1Nema/nA3asEA=; fh=JtlsLIyDAF0AyCFE2/rtYfOy2zyGRNkJ1YC0ceGAzPE=; b=n2QM/pMeIla+RiRPdgLj84oLDWkRCNrg4+E5O35jW1MK9z3JhBUEOVougl6tqH3HQT pA1hj9n1/2Zet1CMwlF/PWCJgvinuE3CBeHnOHk1GmCP03kPtGPm06l0nEn27qFluu/f NeoVotyhKKv0TeOZHd23YQX0jU6SAyHeeJrSkif00t6ldG8dwSIp6GwvoLChmTtAuaCc SolsxlxDzKHTrEQJ1sGmrNNS4GwV5heaF/TJi01Oym8VwUkZkeSFuDFnzdyElD7+rD+9 9EVf8EEUXiJyEdIjmjfHEve7sf5OMWMiVtl/r4Co5pBeQbzShkQvN7zt61I6I3moeA9/ nPAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id y191-20020a638ac8000000b00588fa0def24si1203209pgd.777.2023.10.17.00.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 00:23:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8D0978082861; Tue, 17 Oct 2023 00:23:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234593AbjJQHXU (ORCPT + 99 others); Tue, 17 Oct 2023 03:23:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234469AbjJQHXS (ORCPT ); Tue, 17 Oct 2023 03:23:18 -0400 Received: from out0-209.mail.aliyun.com (out0-209.mail.aliyun.com [140.205.0.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4E4E8E for ; Tue, 17 Oct 2023 00:23:15 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R271e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047212;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---.V10sGCn_1697527391; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.V10sGCn_1697527391) by smtp.aliyun-inc.com; Tue, 17 Oct 2023 15:23:12 +0800 Date: Tue, 17 Oct 2023 15:23:11 +0800 From: "Hou Wenlong" To: Ingo Molnar Cc: , "Lai Jiangshan" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , "=?UTF-8?B?bWFpbnRhaW5lcjpYODYgQVJDSElURUNUVVJFIDMyLUJJVCBBTkQgNjQtQklU?=" , "H. Peter Anvin" , "Josh Poimboeuf" , "Anshuman Khandual" , "Mike Rapoport" , "Pasha Tatashin" Subject: Re: [PATCH RFC 1/7] x86/head/64: Mark startup_gdt and startup_gdt_descr as __initdata Message-ID: <20231017072311.GA46993@k08j02272.eu95sqa> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 17 Oct 2023 00:23:34 -0700 (PDT) On Mon, Oct 16, 2023 at 07:57:06PM +0800, Ingo Molnar wrote: > > * Hou Wenlong wrote: > > > As startup_gdt and startup_gdt_descr are only used in booting, make them > > as __initdata to allow them to be freed after boot. > > > > Signed-off-by: Hou Wenlong > > --- > > arch/x86/kernel/head64.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c > > index 49f7629b17f7..dd357807ffb5 100644 > > --- a/arch/x86/kernel/head64.c > > +++ b/arch/x86/kernel/head64.c > > @@ -69,7 +69,7 @@ EXPORT_SYMBOL(vmemmap_base); > > /* > > * GDT used on the boot CPU before switching to virtual addresses. > > */ > > -static struct desc_struct startup_gdt[GDT_ENTRIES] = { > > +static struct desc_struct startup_gdt[GDT_ENTRIES] __initdata = { > > [GDT_ENTRY_KERNEL32_CS] = GDT_ENTRY_INIT(0xc09b, 0, 0xfffff), > > [GDT_ENTRY_KERNEL_CS] = GDT_ENTRY_INIT(0xa09b, 0, 0xfffff), > > [GDT_ENTRY_KERNEL_DS] = GDT_ENTRY_INIT(0xc093, 0, 0xfffff), > > @@ -79,7 +79,7 @@ static struct desc_struct startup_gdt[GDT_ENTRIES] = { > > * Address needs to be set at runtime because it references the startup_gdt > > * while the kernel still uses a direct mapping. > > */ > > -static struct desc_ptr startup_gdt_descr = { > > +static struct desc_ptr startup_gdt_descr __initdata = { > > .size = sizeof(startup_gdt), > > .address = 0, > > Yeah, so I think this and patch #1 are independently useful of the PIE > feature, and I merged them into tip:x86/boot for a v6.7 merge. > > Mind re-sending any other patches for x86 that can be merged? For example > patch #6 looks good too, but was mixed up a bit with a previous > PIE-enablement patch. Moving the __head definition to a header should also > probably done as a separate patch, followed by the widening of its use. > Hi Ingo, I have sent patch #6 separately for x86. Do you have any ideas about building the head code as PIE? Should I resend the patchset for the PIE feature? Thanks! > Thanks, > > Ingo