From patchwork Mon Jun 26 17:23:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 9810135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65F3B60209 for ; Mon, 26 Jun 2017 17:24:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 536BF285C7 for ; Mon, 26 Jun 2017 17:24:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4795D285F1; Mon, 26 Jun 2017 17:24:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D9983285C7 for ; Mon, 26 Jun 2017 17:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=DpkRhL7nHbto8uD/LLFvsPLmNzR6J9ykmBbZ2lo6vKw=; b=hZQ kg56YybBsIhHtOrWUojX6ETrkzq4YL1gC47mqDDoHRS4D82xDL3NQXnTEcbl3nOvZk5k2ZHmHJNdd s2wDrrkiuefNG7GvqeV04aCOA13g46ak7IjhnqLMzs1R/pWEaaFjWxXgjfAu5oe9L/MKgy5INHQ2j RXczlqULnmk2FbjMIWovW/cg/zH2zyMoZZOiTS1c6v0x3LpiUHW+jImaNuvcqZuAxj7MUMsNoO2mX FdhqZ18VyNMhSCLkGgO+HVj+9bkURRF0h28Pe4uB1StWw79BOaX8W6ZJTa6y2YDbDx/TlH+S6TsBQ 9kvcUC0M+cmyGMmpdjsDM956dwS9Ftg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dPXkH-0002cd-3u; Mon, 26 Jun 2017 17:24:17 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dPXkD-0002bY-DF for linux-arm-kernel@lists.infradead.org; Mon, 26 Jun 2017 17:24:15 +0000 Received: by mail-wm0-x242.google.com with SMTP id f134so1451349wme.1 for ; Mon, 26 Jun 2017 10:23:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/JgAPzeVHjWsEfjskG/l97PEWbAFVK2middE7FC3pSk=; b=VmKCWXo5hhW14ac2ixoRG3sQ4WZD7OWFqYqzjXaYTODZNSpTWZkd7/KZfYOZVbsLVG JpE4EYHUpPzgUMrdPF6PenjE/BBUgXg8Nl/lKzXF4nLJ4wcyHnqpi4LH4b07NtF6uuJc qTeg8SBakjZju6HZD15eZzU8jmSTJiIIQJ07e6yri6+KGNG/YmHoHcdQSzqni4rG8u3K oLAHSJuG0SZgxSEwt2jAN5H/Zg9g7us180xm3WKoWLNgTYCzw/5rM7XtUtVRpmlgh7ye tCjyRvR6WyLpKzB1dX9s9ibt+GxbGwFtxOzAjh4OkB+Qox8NdjBvpt5e6IF7csx/VUox WaYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/JgAPzeVHjWsEfjskG/l97PEWbAFVK2middE7FC3pSk=; b=E05pHkxYgxN/NxPMPO/J5K9m8V0KTjeu3CgH6vdK80E6OLheUkG9uvaX92Samto2Co HhG4DEkpLSEefw7LuxshHepbrd7GUrTkXxVc7QKGclTU75FYm7NSGhiBTyqCsoJJhULN xyBbMcGBLHjpLGo9hFtGgTjha4WZvWaVdAgXYtRDwgWTcx2jdSodjJufX7vCsvyET4bP b4sadqJ63900jJkWsrzxzswG5SDICOuN8k9sTUlgqBB+wRc7YxVjUGH0ny80qnSvwU3X Jw+xdGUHSzJJbKz698+lpubzKGhgj4OBFcvtKZN4ESqL9SavZxJWSX5LaEyiSJMLtokU grJg== X-Gm-Message-State: AKS2vOyTVV7DUVDb5yQ1xq7ML0KjayiSqy8bwQmgp8y1HnYqv13A/V0g 3aui3yEetjQzKg== X-Received: by 10.28.168.145 with SMTP id r139mr442883wme.102.1498497829823; Mon, 26 Jun 2017 10:23:49 -0700 (PDT) Received: from stb-bld-02.irv.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id k89sm249947wmi.4.2017.06.26.10.23.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jun 2017 10:23:49 -0700 (PDT) From: Doug Berger To: linux@armlinux.org.uk Subject: [PATCH] ARM: memblock limit must be pmd-aligned Date: Mon, 26 Jun 2017 10:23:15 -0700 Message-Id: <20170626172315.26369-1-opendmb@gmail.com> X-Mailer: git-send-email 2.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170626_102413_601062_B2040D21 X-CRM114-Status: GOOD ( 10.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nicolas.pitre@linaro.org, tixy@linaro.org, f.fainelli@gmail.com, keescook@chromium.org, ard.biesheuvel@linaro.org, marc.zyngier@arm.com, linux-kernel@vger.kernel.org, Doug Berger , labbott@redhat.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP There is a path through the adjust_lowmem_bounds() routine where if all memory regions start and end on pmd-aligned addresses the memblock_limit will be set to arm_lowmem_limit. However, since arm_lowmem_limit can be affected by the vmalloc early parameter, the value of arm_lowmem_limit may not be pmd-aligned. This commit corrects this oversight such that memblock_limit is always rounded down to pmd-alignment. The pmd containing arm_lowmem_limit is cleared by prepare_page_table() and without this commit it is possible for early_alloc() to allocate unmapped memory in that range when mapping the lowmem. Signed-off-by: Doug Berger --- arch/arm/mm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 31af3cb59a60..2ae4f9c9d757 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1226,7 +1226,7 @@ void __init adjust_lowmem_bounds(void) if (memblock_limit) memblock_limit = round_down(memblock_limit, PMD_SIZE); if (!memblock_limit) - memblock_limit = arm_lowmem_limit; + memblock_limit = round_down(arm_lowmem_limit, PMD_SIZE); if (!IS_ENABLED(CONFIG_HIGHMEM) || cache_is_vipt_aliasing()) { if (memblock_end_of_DRAM() > arm_lowmem_limit) {