From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751796AbdCPIOh (ORCPT ); Thu, 16 Mar 2017 04:14:37 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34617 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751037AbdCPIOe (ORCPT ); Thu, 16 Mar 2017 04:14:34 -0400 Date: Thu, 16 Mar 2017 09:14:29 +0100 From: Ingo Molnar To: Borislav Petkov Cc: Baoquan He , tglx@linutronix.de, hpa@zytor.com, mingo@redhat.com, linux-kernel@vger.kernel.org, x86@kernel.org, keescook@chromium.org, yinghai@kernel.org, anderson@redhat.com, luto@kernel.org, thgarnie@google.com, kuleshovmail@gmail.com Subject: Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE Message-ID: <20170316081429.GA28585@gmail.com> References: <20170226040908.GB14810@x1> <20170303114349.krl6s5qfjmwz3mrg@pd.tnic> <20170303120616.GE18391@x1> <20170303121614.7cgyb6gfhtgmcide@pd.tnic> <20170303125213.GF18391@x1> <20170303131152.GG18391@x1> <20170303142830.pkkvn2iz7dwceei6@pd.tnic> <20170303150751.GH18391@x1> <20170303150857.GI18391@x1> <20170303152319.yensbclmz6uomoyy@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170303152319.yensbclmz6uomoyy@pd.tnic> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Borislav Petkov wrote: > Ok, > > TBH, I still don't like adding yet another define and paying attention > to whether I should use image size or mapping size. After your patch, > KERNEL_IMAGE_SIZE is used to enforce the actual image size from > exploding: > > arch/x86/include/asm/page_32_types.h:43:#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024) > arch/x86/include/asm/page_32_types.h:49:#define KERNEL_MAPPING_SIZE KERNEL_IMAGE_SIZE > arch/x86/include/asm/page_64_types.h:56:#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024) > arch/x86/include/asm/pgtable_32.h:83: * (KERNEL_IMAGE_SIZE/4096) / 1024 pages (worst case, non PAE) > arch/x86/include/asm/pgtable_32.h:84: * (KERNEL_IMAGE_SIZE/4096) / 512 + 4 pages (worst case for PAE) > arch/x86/include/asm/pgtable_32.h:91: * KERNEL_IMAGE_SIZE should be greater than pa(_end) > arch/x86/kernel/vmlinux.lds.S:356:. = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE), > arch/x86/kernel/vmlinux.lds.S:357: "kernel image bigger than KERNEL_IMAGE_SIZE"); > arch/x86/kernel/vmlinux.lds.S:370:. = ASSERT((_end - _text <= KERNEL_IMAGE_SIZE), > arch/x86/kernel/vmlinux.lds.S:371: "kernel image bigger than KERNEL_IMAGE_SIZE"); > > So what I'd do is keep KERNEL_IMAGE_SIZE and make it default 1G and use it > everywhere. > > Then, define a separate define which is used only in vmlinux.lds.S to > enforce the size check. Having MAPPING_SIZE and IMAGE_SIZE is just > needlessly confusing. That sounds like the right solution to me - having two values is asking for trouble. Thanks, Ingo