From patchwork Wed Jul 12 03:30:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Wenlong X-Patchwork-Id: 118796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp889287vqm; Tue, 11 Jul 2023 20:41:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlHHg75XtMUpe3rOiV4c/7sEvyzcdd6r710IhPjuT8WnKPGUG/G/zSbgg+bFSjNq6cNc3jBu X-Received: by 2002:a17:907:8186:b0:983:ba44:48af with SMTP id iy6-20020a170907818600b00983ba4448afmr15404297ejc.53.1689133286762; Tue, 11 Jul 2023 20:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689133286; cv=none; d=google.com; s=arc-20160816; b=x57oO57Rr2j45ETHMaJxihX1pKhL4OkadAuuYc/mS0/88AyTA4WL+VeibnHht62kFg Joz+HTxHKVuyyxBpTboqw3+A49DairN9zV6zThrB8FLJ/ANICyQ605N9SWZTN+XVKBe/ MiwDNymSR4E00GNWWLqP8Imk3Wv6A2CLpw1sRgDWtYcYe6uME9HWnY5D4h5WdMjXQi5e yd8fEzfFq3kGurAPFYsRS6YhQBzPckBfupiCUucPZlXWMGe47yfO/Tk3Rjklz0KJKpEk 4rXgSCe2Bd6VvtpfFj+1l/xnOY4/gewiPiBp7WCu8VEvJBMiRS++4GZv4fuAayLCBEMc UE/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gqqTT4QCfa6L3lWH/ZJ9TDK+7cjlkDZowSBlDkgFYzo=; fh=H+xol+m9/22gljVAiQKilKMt6BHHgyiL3H+/V9q01Lk=; b=vUOzc0/pBMX7OBmlVzRi3BnbgkRm4zmA+cFUT+Rq4hcDHaMVjje33nf/Km5h2DA/9c vqvbfoB3nOVm3Houz2r3hwwjcjMw+5qWFaceJPeOlOSwwwxqTDO5a/Ybh8f7u9IT8dXO h/ybwzi4Rq7Sfy7CyTZ6UWfcIB8HL+E8/L6J/iTA+toGoGWbSXxam8BWfHnAwr53vwIs MknHN8Ls+MhGGhta0snrfJiGwVnEHOW75fq8lWsvas6IA00/SPAHOMkbU5Y7S4rbMT6+ 95V8UJB2Ot5FRbjM5FS/g6aSm4YQ8asgngFLz2lFXgMpzIow+9SB4zp7bKfQ1vXPMjnD 6csg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170906140200b009591dd6c71esi3168518ejc.896.2023.07.11.20.41.01; Tue, 11 Jul 2023 20:41:26 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230254AbjGLDbY (ORCPT + 99 others); Tue, 11 Jul 2023 23:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229843AbjGLDbU (ORCPT ); Tue, 11 Jul 2023 23:31:20 -0400 Received: from out0-201.mail.aliyun.com (out0-201.mail.aliyun.com [140.205.0.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97704E5F for ; Tue, 11 Jul 2023 20:31:19 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047206;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---.TrdHwby_1689132672; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.TrdHwby_1689132672) by smtp.aliyun-inc.com; Wed, 12 Jul 2023 11:31:13 +0800 From: "Hou Wenlong" To: linux-kernel@vger.kernel.org Cc: "Lai Jiangshan" , "Hou Wenlong" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , " =?utf-8?q?maintainer=3AX86_A?= =?utf-8?q?RCHITECTURE_32-BIT_AND_64-BIT?= " , "H. Peter Anvin" , "Josh Poimboeuf" , "Anshuman Khandual" , "Mike Rapoport" , "Pasha Tatashin" Subject: [PATCH RFC 1/7] x86/head/64: Mark startup_gdt and startup_gdt_descr as __initdata Date: Wed, 12 Jul 2023 11:30:05 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham 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: INBOX X-GMAIL-THRID: 1771184625265233636 X-GMAIL-MSGID: 1771184625265233636 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, };