From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938575AbdAEOTH convert rfc822-to-8bit (ORCPT ); Thu, 5 Jan 2017 09:19:07 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:43533 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937137AbdAEOS7 (ORCPT ); Thu, 5 Jan 2017 09:18:59 -0500 Subject: Re: [PATCH] x86/head: Refactor 32-bit pgtable setup To: Ingo Molnar References: <1481215471-9639-1-git-send-email-boris.ostrovsky@oracle.com> <20170105085252.GA15715@gmail.com> Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, matt@codeblueprint.co.uk From: Boris Ostrovsky Message-ID: Date: Thu, 5 Jan 2017 09:17:43 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170105085252.GA15715@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8BIT X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/05/2017 03:52 AM, Ingo Molnar wrote: > > Yeah, so (belatedly) I tried to merge this to latest upstream, via the commit > below (note the slight edits to the changelog) - but 32-bit defconfig fails to > build: > > arch/x86/kernel/head_32.S:615: Error: can't resolve `init_thread_union' {*UND* section} - `SIZEOF_PTREGS' {*UND* section} When you dropped MAPPING_BEYOND_END (that I indeed should have removed) you left comment opening in the wrong place: > diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S > index 4e8577d03372..eca1c93c38e8 100644 > --- a/arch/x86/kernel/head_32.S > +++ b/arch/x86/kernel/head_32.S > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > > /* Physical address */ > #define pa(X) ((X) - __PAGE_OFFSET) > @@ -42,43 +43,8 @@ > #define X86_VENDOR_ID new_cpu_data+CPUINFO_x86_vendor_id This one: > > /* > - * This is how much memory in addition to the memory covered up to > - * and including _end we need mapped initially. > - * We need: > - * (KERNEL_IMAGE_SIZE/4096) / 1024 pages (worst case, non PAE) > - * (KERNEL_IMAGE_SIZE/4096) / 512 + 4 pages (worst case for PAE) > - * > - * Modulo rounding, each megabyte assigned here requires a kilobyte of > - * memory, which is currently unreclaimed. > - * > - * This should be a multiple of a page. > - * > - * KERNEL_IMAGE_SIZE should be greater than pa(_end) > - * and small than max_low_pfn, otherwise will waste some page table entries > - */ > - > -#if PTRS_PER_PMD > 1 > -#define PAGE_TABLE_SIZE(pages) (((pages) / PTRS_PER_PMD) + PTRS_PER_PGD) > -#else > -#define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD) > -#endif > - > #define SIZEOF_PTREGS 17*4 > In other words, this version of the patch needs: diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index eca1c93..1f85ee8 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S @@ -42,9 +42,10 @@ #define X86_CAPABILITY new_cpu_data+CPUINFO_x86_capability #define X86_VENDOR_ID new_cpu_data+CPUINFO_x86_vendor_id -/* + #define SIZEOF_PTREGS 17*4 +/* * Worst-case size of the kernel mapping we need to make: * a relocatable kernel can live anywhere in lowmem, so we need to be able * to map all of lowmem. -boris