From patchwork Tue Mar 8 14:09:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 63680 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2049743lbc; Tue, 8 Mar 2016 06:11:37 -0800 (PST) X-Received: by 10.98.18.212 with SMTP id 81mr42480718pfs.104.1457446297025; Tue, 08 Mar 2016 06:11:37 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id wu1si5022380pab.71.2016.03.08.06.11.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Mar 2016 06:11:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1adILC-0001xA-Np; Tue, 08 Mar 2016 14:10:26 +0000 Received: from mail-pf0-x236.google.com ([2607:f8b0:400e:c00::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1adIL5-0000ha-RJ for linux-arm-kernel@lists.infradead.org; Tue, 08 Mar 2016 14:10:23 +0000 Received: by mail-pf0-x236.google.com with SMTP id 63so13732351pfe.3 for ; Tue, 08 Mar 2016 06:09:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=0RGycElA7fJvrLZv3QGyIJBM7TMZfeZ+Ut5xE74BWGs=; b=eZmEmcqOseT2sUeHdzxHj6fINHVxhs2nupOUo1CZHCIpe2U1xhRjAgqR9Dx1f+gJnM 7aoHfqCNebREnVdGiQIW79zRaCETSV8Y+j1mH98n5+KZotVnR1dLnELJbEKw6U16pAB5 A/ZOcjgVIOM5pPUYRqtJJnEAfEg0xOoAH2yZ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0RGycElA7fJvrLZv3QGyIJBM7TMZfeZ+Ut5xE74BWGs=; b=BJrJtzBii7sY/s69dwRqZmcZ8SzqHMXWQNFdfhKq7A99LLWChMFNagmCr7/QNdy5ne HnBwhThDCTY07ZdY9VEPipn7tB6kasKkMHpIiUoxbUnIgccn2y/GCpKhSSJyHOcmpDch jhywwYFuLWzHOfw306GBK77ufnccxts8jhdg3Vfg9nzM+XP59cF/d2RjoenxAYHxV1V1 PRKLKhaQ0tvlG1l6DKQsyNOxGcWpvwLQ8c6/k69HPt+QaKSin8YXVWgRICAEoh6wAEwv io7knG5OZ50xu2nHpG3pObxq6p/fUABK5cih2uTnQim37bJmOy5gmlBUz2awS84OFcXr m8Bw== X-Gm-Message-State: AD7BkJKKPs9zrI0RyUFtmimPxrRZlOXf+3K0c5BE59Ml80ztubVdJjLKGZx+FjRxwqgFDK71 X-Received: by 10.98.71.91 with SMTP id u88mr42121571pfa.161.1457446198576; Tue, 08 Mar 2016 06:09:58 -0800 (PST) Received: from ards-macbook-pro.IMGCGCW.net (110-170-137-3.static.asianet.co.th. [110.170.137.3]) by smtp.gmail.com with ESMTPSA id q4sm5392445pfi.75.2016.03.08.06.09.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Mar 2016 06:09:57 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH] arm64: account for sparsemem section alignment when choosing vmemmap offset Date: Tue, 8 Mar 2016 21:09:29 +0700 Message-Id: <1457446169-23099-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160308_061020_136294_C4615B63 X-CRM114-Status: GOOD ( 12.22 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c00:0:0:0:236 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, mlangsdo@redhat.com, Ard Biesheuvel , gregkh@linuxfoundation.org, ddaney.cavm@gmail.com, labbott@fedoraproject.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Commit dfd55ad85e4a ("arm64: vmemmap: use virtual projection of linear region") fixed an issue where the struct page array would overflow into the adjacent virtual memory region if system RAM was placed so high up in physical memory that its addresses were not representable in the build time configured virtual address size. However, the fix failed to take into account that the vmemmap region needs to be relatively aligned with respect to the sparsemem section size, so that a sequence of page structs corresponding with a sparsemem section in the linear region appears naturally aligned in the vmemmap region. So round up vmemmap to sparsemem section size. Since this essentially moves the projection of the linear region up in memory, also revert the reduction of the size of the vmemmap region. Fixes: dfd55ad85e4a ("arm64: vmemmap: use virtual projection of linear region") Tested-by: Mark Langsdorf Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/pgtable.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel Acked-by: Catalin Marinas diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index f50608674580..819aff5d593f 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -40,7 +40,7 @@ * VMALLOC_END: extends to the available space below vmmemmap, PCI I/O space, * fixed mappings and modules */ -#define VMEMMAP_SIZE ALIGN((1UL << (VA_BITS - PAGE_SHIFT - 1)) * sizeof(struct page), PUD_SIZE) +#define VMEMMAP_SIZE ALIGN((1UL << (VA_BITS - PAGE_SHIFT)) * sizeof(struct page), PUD_SIZE) #ifndef CONFIG_KASAN #define VMALLOC_START (VA_START) @@ -52,7 +52,8 @@ #define VMALLOC_END (PAGE_OFFSET - PUD_SIZE - VMEMMAP_SIZE - SZ_64K) #define VMEMMAP_START (VMALLOC_END + SZ_64K) -#define vmemmap ((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT)) +#define vmemmap ((struct page *)VMEMMAP_START - \ + SECTION_ALIGN_DOWN(memstart_addr >> PAGE_SHIFT)) #define FIRST_USER_ADDRESS 0UL