From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758730AbcIPOpv (ORCPT ); Fri, 16 Sep 2016 10:45:51 -0400 Received: from foss.arm.com ([217.140.101.70]:58744 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755500AbcIPOpm (ORCPT ); Fri, 16 Sep 2016 10:45:42 -0400 Date: Fri, 16 Sep 2016 15:45:20 +0100 From: Mark Rutland To: Matt Fleming Cc: Mike Galbraith , Ingo Molnar , LKML , linux-efi@vger.kernel.org, Peter Jones , Ard Biesheuvel Subject: Re: [tip regression] efi: Allow drivers to reserve boot services forever == toxic Message-ID: <20160916144519.GA3179@leverpostej> References: <1474005912.3930.10.camel@gmail.com> <20160916093149.GC16797@codeblueprint.co.uk> <1474020059.3881.3.camel@gmail.com> <20160916143007.GF16797@codeblueprint.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160916143007.GF16797@codeblueprint.co.uk> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 16, 2016 at 03:30:07PM +0100, Matt Fleming wrote: > On Fri, 16 Sep, at 12:00:59PM, Mike Galbraith wrote: > > > > Ok, here's the whole thing just in case. Hope it's not too big. > > [...] > > > [ 0.000000] esrt: Reserving ESRT space from 0x00000000def87998 to 0x00000000def879d0. > > OK, that's 56 bytes and yet I realise that at no point in the > efi_mem_reserve() call path do we round up to the nearest page size > even though the EFI memory map only deals with EFI_PAGE_SIZE regions. I note that the base is also not aligned to EFI_PAGE_SIZE. Shouldn't we round that down, too? [...] > diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c > index f14b7a9da24b..e881b4b2ffd6 100644 > --- a/arch/x86/platform/efi/quirks.c > +++ b/arch/x86/platform/efi/quirks.c > @@ -201,8 +201,10 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size) > return; > } > > + size = round_up(size, EFI_PAGE_SIZE); i.e. have: size += addr % EFI_PAGE_SIZE; size = round_up(size, EFI_PAGE_SIZE); addr = round_down(base, EFI_PAGE_SIZE); Thanks, Mark. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Rutland Subject: Re: [tip regression] efi: Allow drivers to reserve boot services forever == toxic Date: Fri, 16 Sep 2016 15:45:20 +0100 Message-ID: <20160916144519.GA3179@leverpostej> References: <1474005912.3930.10.camel@gmail.com> <20160916093149.GC16797@codeblueprint.co.uk> <1474020059.3881.3.camel@gmail.com> <20160916143007.GF16797@codeblueprint.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20160916143007.GF16797-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org> Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Matt Fleming Cc: Mike Galbraith , Ingo Molnar , LKML , linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Peter Jones , Ard Biesheuvel List-Id: linux-efi@vger.kernel.org On Fri, Sep 16, 2016 at 03:30:07PM +0100, Matt Fleming wrote: > On Fri, 16 Sep, at 12:00:59PM, Mike Galbraith wrote: > > > > Ok, here's the whole thing just in case. Hope it's not too big. > > [...] > > > [ 0.000000] esrt: Reserving ESRT space from 0x00000000def87998 to 0x00000000def879d0. > > OK, that's 56 bytes and yet I realise that at no point in the > efi_mem_reserve() call path do we round up to the nearest page size > even though the EFI memory map only deals with EFI_PAGE_SIZE regions. I note that the base is also not aligned to EFI_PAGE_SIZE. Shouldn't we round that down, too? [...] > diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c > index f14b7a9da24b..e881b4b2ffd6 100644 > --- a/arch/x86/platform/efi/quirks.c > +++ b/arch/x86/platform/efi/quirks.c > @@ -201,8 +201,10 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size) > return; > } > > + size = round_up(size, EFI_PAGE_SIZE); i.e. have: size += addr % EFI_PAGE_SIZE; size = round_up(size, EFI_PAGE_SIZE); addr = round_down(base, EFI_PAGE_SIZE); Thanks, Mark.