Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp452315ybl; Tue, 20 Aug 2019 23:43:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyY7iII4PEy6Zzj4lbrl5VtxNu2KQTa941GcZbQ+33N90qmOvcGbl0YWi9sUTI775q6UEge X-Received: by 2002:a65:5c02:: with SMTP id u2mr28065813pgr.367.1566369814385; Tue, 20 Aug 2019 23:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566369814; cv=none; d=google.com; s=arc-20160816; b=Vxx2bOxFbbWScpxAHWIL+xdA58Siuzn38aS4j1CqsHtlC8De7OFHjwOF3UI+ovEKfj Af02hnYF7R7OxPBJUWmZCRhKB7wSHmU9uXBv5d+0kl4iPZATpBXjH/XUXVOmHu6VF/jL MiAKE8jUDVx/mjIM+KwTkmYhv6+NTye09y2laqSPSAbYZSj4sYuv3SNLhO8YGFDe915t bh0gxJ9NvA7ZcuPYh/wSQB6Oely1Hh5dnQ5zP01CB4Nsnel+8xDJkgeqophqCIOmEHeK 5uID53hjbUbjTUPw5kES20hke13T3iGWDCfr/Ol78SOpT2PvTdPrS5ni0kON0AD5cIdv nopQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=wwWUHZYts+drKn/xffO1pjxZ/7naUbutbTGCAceSvTc=; b=aYtMiV5OHYRtGFkrJYM+erhrwYYH5rZ/axixp44NRZQwcNt4uxKLGixJfx2mjtMWYa lf/2ldlb9SZX8OeTVGP8Z5IOfALAqQWvu4C4aDlQtzIl9+ddyysCyKP5JBcSyAM9Owew NnfL69OpgsoZicH+nJG6NGHkVBwsEaTPtisqS6w1vCCHhgMiCGNIUl4lgbizO9zHSE7m J9+qKI+Do0/FdsXtDdXdR6HMtpWrIgyfxEOvLNPlvYw3D/nYB3PLCNWv6D3NZsNTjZnR Cs2+bMMWa4F5n6TGxtSewMaSpKN/htl7N4aXJV7pz7XVxD2Q4C1UZSVwyWi+lI5sJFl+ NxDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VgGxw/bt"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si13820573pgv.135.2019.08.20.23.43.09; Tue, 20 Aug 2019 23:43:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VgGxw/bt"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728007AbfHUGf1 (ORCPT + 99 others); Wed, 21 Aug 2019 02:35:27 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:50804 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727918AbfHUGf0 (ORCPT ); Wed, 21 Aug 2019 02:35:26 -0400 Received: by mail-wm1-f65.google.com with SMTP id v15so892663wml.0 for ; Tue, 20 Aug 2019 23:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wwWUHZYts+drKn/xffO1pjxZ/7naUbutbTGCAceSvTc=; b=VgGxw/btw738XPHhp/L0bKvSoT3qPerWAMK1NEHDGjQsBH1c+GvVxVdG+ELKg0a7qw Ud1ki2X8s1J6JjgxwBIEYV2QWmXlco5HDzzUcTS82y8EuC7jpBFTPQJ69lu0+gGPnNkg NQGo/pF0YwogR6K3YpQamy/tl3ggi/3YpFwf4xcg+jBAIHK0O0Ytt1vcRZYAEWzeD4LS E9qAOrvqm7wTxiX1At6+lIRbZTjLB4kwXrBEejCnH6cscYesK60qJGwX1eo5d5LF1TYN 23j+25p71iaRWc+oXZRpxrAA91j1sesOitH46KYLRalw6iyg8neOC42NukwlFkMe1Y25 BV1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wwWUHZYts+drKn/xffO1pjxZ/7naUbutbTGCAceSvTc=; b=d2AEw2obNEB9pNMtCMrEFPrJ1wF42N2Hr63SziSkQdE8o2eoXcxIulATgrg/YZXshc YouLzyXedtcvfLjkI7sTqfsLeT8oeJyUmAJ9RKlhbPTZlvrRsVmMNfg9AOLxVfhjzr9t n+c2D5KaDNi92OoTipe6MTzIy+mAmGNqVzrHYj/OcTI1IHDGKMjLIPXORhSHkZARVdge 5mOBKpT+tdO+ImtphG5O8t7gkQZEB21V2B7vW7VqvdRiAVAeWtc9E+55c6g/M0bpZhKB NXeqIfFB4YKy5Fx98wjBSovvy8HfnJMATmTWqgA+oxH1TTR0xNAZ+57njFyy0lsG2G+J Y2pA== X-Gm-Message-State: APjAAAUzT9JzH+6Ou2H4JG4x4yj0hI/6bA2XI6w7I0p+0aVnphg5Q4KG sNalZhq36vMgU3hV7wN0rFb4QRaV8OucxHRHc1t+xw== X-Received: by 2002:a7b:c21a:: with SMTP id x26mr3651362wmi.61.1566369324021; Tue, 20 Aug 2019 23:35:24 -0700 (PDT) MIME-Version: 1.0 References: <20190802053744.5519-1-clin@suse.com> <20190820115645.GP13294@shell.armlinux.org.uk> <20190821061027.GA2828@linux-8mug> In-Reply-To: <20190821061027.GA2828@linux-8mug> From: Ard Biesheuvel Date: Wed, 21 Aug 2019 09:35:16 +0300 Message-ID: Subject: Re: [PATCH] efi/arm: fix allocation failure when reserving the kernel base To: Chester Lin Cc: Juergen Gross , Joey Lee , "linux-efi@vger.kernel.org" , "guillaume.gardet@arm.com" , "linux-kernel@vger.kernel.org" , Russell King - ARM Linux admin , "rppt@linux.ibm.com" , "geert@linux-m68k.org" , "ren_guo@c-sky.com" , Gary Lin , "akpm@linux-foundation.org" , "mingo@kernel.org" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Aug 2019 at 09:11, Chester Lin wrote: > > On Tue, Aug 20, 2019 at 03:28:25PM +0300, Ard Biesheuvel wrote: > > On Tue, 20 Aug 2019 at 14:56, Russell King - ARM Linux admin > > wrote: > > > > > > On Fri, Aug 02, 2019 at 05:38:54AM +0000, Chester Lin wrote: > > > > diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c > > > > index f3ce34113f89..909b11ba48d8 100644 > > > > --- a/arch/arm/mm/mmu.c > > > > +++ b/arch/arm/mm/mmu.c > > > > @@ -1184,6 +1184,9 @@ void __init adjust_lowmem_bounds(void) > > > > phys_addr_t block_start = reg->base; > > > > phys_addr_t block_end = reg->base + reg->size; > > > > > > > > + if (memblock_is_nomap(reg)) > > > > + continue; > > > > + > > > > if (reg->base < vmalloc_limit) { > > > > if (block_end > lowmem_limit) > > > > /* > > > > > > I think this hunk is sane - if the memory is marked nomap, then it isn't > > > available for the kernel's use, so as far as calculating where the > > > lowmem/highmem boundary is, it effectively doesn't exist and should be > > > skipped. > > > > > > > I agree. > > > > Chester, could you explain what you need beyond this change (and my > > EFI stub change involving TEXT_OFFSET) to make things work on the > > RPi2? > > > > Hi Ard, > > In fact I am working with Guillaume to try booting zImage kernel and openSUSE > from grub2.04 + arm32-efistub so that's why we get this issue on RPi2, which is > one of the test machines we have. However we want a better solution for all > cases but not just RPi2 since we don't want to affect other platforms as well. > Thanks Chester, but that doesn't answer my question. Your fix is a single patch that changes various things that are only vaguely related. We have already identified that we need to take TEXT_OFFSET (minus some space used by the swapper page tables) into account into the EFI stub if we want to ensure compatibility with many different platforms, and as it turns out, this applies not only to RPi2 but to other platforms as well, most notably the ones that require a TEXT_OFFSET of 0x208000, since they also have reserved regions at the base of RAM. My question was what else we need beyond: - the EFI stub TEXT_OFFSET fix [0] - the change to disregard NOMAP memblocks in adjust_lowmem_bounds() - what else??? [0] https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git/commit/?h=next&id=0eb7bad595e52666b642a02862ad996a0f9bfcc0