From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AE3FC43381 for ; Mon, 25 Feb 2019 14:53:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF54220663 for ; Mon, 25 Feb 2019 14:53:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="mLX7JUoN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727608AbfBYOxk (ORCPT ); Mon, 25 Feb 2019 09:53:40 -0500 Received: from mail.skyhub.de ([5.9.137.197]:55472 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727409AbfBYOxk (ORCPT ); Mon, 25 Feb 2019 09:53:40 -0500 Received: from zn.tnic (p200300EC2BC680005D24CC4389F6575A.dip0.t-ipconnect.de [IPv6:2003:ec:2bc6:8000:5d24:cc43:89f6:575a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 1FDA61EC0573; Mon, 25 Feb 2019 15:53:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1551106418; h=from:from: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:in-reply-to:in-reply-to: references:references; bh=nEk1Aes5fYsliCOk9VPiY8VOoNSoLmwPKMYYD64TmTc=; b=mLX7JUoN7ca1AgZ1kfZaoAq6xkYBxegQTCXhn2E8DhkgyG9J7IqFYhH/A+zGby+xqNe5Dg yVPoHFbfYjnXd2tyM54Ib5xUYuwpYuWHhEb6gDGh4Fzo740SxSnEJk2AfWe68KaNoXALAv pyGGsxuNs0cURq2Y/W2anZySXlnmAHc= Date: Mon, 25 Feb 2019 15:53:31 +0100 From: Borislav Petkov To: Jiri Slaby Cc: mingo@redhat.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org Subject: Re: [PATCH v7 11/28] x86/asm/head: annotate data appropriatelly Message-ID: <20190225145330.GF26145@zn.tnic> References: <20190130124711.12463-1-jslaby@suse.cz> <20190130124711.12463-12-jslaby@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190130124711.12463-12-jslaby@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 30, 2019 at 01:46:54PM +0100, Jiri Slaby wrote: > Use the new SYM_DATA, SYM_DATA_START, and SYM_DATA_END in both 32 and 64 > bit heads. In the 64-bit version, define also > SYM_DATA_START_PAGE_ALIGNED locally using the new SYM_START. It is used > in the code instead of NEXT_PAGE() which was defined in this file and > has been using the obsolete macro GLOBAL(). > > Now, the data in the 64-bit object file look sane: > Value Size Type Bind Vis Ndx Name > 0000 4096 OBJECT GLOBAL DEFAULT 15 init_level4_pgt > 1000 4096 OBJECT GLOBAL DEFAULT 15 level3_kernel_pgt > 2000 2048 OBJECT GLOBAL DEFAULT 15 level2_kernel_pgt ^^^^ Except that this size is kinda misleading. We end up using a whole page for this because of the alignment of the next one but because we're not filing it up properly, the symbol has the size of a half a page: ffffffff8200f000 : ffffffff8200f7f6: 00 00 add %al,(%rax) ffffffff8200f7f8: e3 01 jrcxz ffffffff8200f7fb ffffffff8200f7fa: e0 1f loopne ffffffff8200f81b ... ffffffff82010000 : That's a whole page with 2K padding. You can do this in a prepatch: --- diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index 5b7a3b430dea..93a9fd294962 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S @@ -448,6 +448,7 @@ SYM_DATA_START_PAGE_ALIGNED(level2_kernel_pgt) */ PMDS(0, __PAGE_KERNEL_LARGE_EXEC, KERNEL_IMAGE_SIZE/PMD_SIZE) + .fill 512 - KERNEL_IMAGE_SIZE/PMD_SIZE,8,0 SYM_DATA_END(level2_kernel_pgt) SYM_DATA_START_PAGE_ALIGNED(level2_fixmap_pgt) --- and then we get the proper symbol size: 69952: ffffffff8200f000 4096 OBJECT GLOBAL DEFAULT 11 level2_kernel_pgt Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.