From patchwork Fri Jul 22 17:32:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 72637 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1128426qga; Fri, 22 Jul 2016 11:03:39 -0700 (PDT) X-Received: by 10.98.135.13 with SMTP id i13mr8628723pfe.44.1469210619639; Fri, 22 Jul 2016 11:03:39 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id 18si16940476pfk.163.2016.07.22.11.03.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jul 2016 11:03:39 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bQemJ-0000LB-0D; Fri, 22 Jul 2016 18:02:27 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bQeJu-0001rN-2l for linux-arm-kernel@lists.infradead.org; Fri, 22 Jul 2016 17:33:16 +0000 Received: by mail-wm0-x229.google.com with SMTP id f65so65469135wmi.0 for ; Fri, 22 Jul 2016 10:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qM6x7/Ag+cD2xk/QHbA5uxW7xaqSs1PJ33dWZybts1A=; b=B6TzjoTjiSmpU3TwseSmNPoP5RxcQrA+GuVYz18IwGHiSaBbBr9CizQiWuS+nuQA5s A9K9aoT3dvKXOR8gN6bOcJHK6gplerE74e4jCbLNTJXnui+/FbzLSs3nxH8Br13pVHLJ SHon5Y/2v0e1w6jX1OaqGd/biC3fmMMOPhAk4= 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:in-reply-to :references; bh=qM6x7/Ag+cD2xk/QHbA5uxW7xaqSs1PJ33dWZybts1A=; b=bo8BLPR1XTyJ3BBs/+UbFIxqhl5+FNi7exnJ/PbeBWv+sJ3lP0Q9gJMtk/zIV5zm4m YLZ6PFNDbuka93DQ08QPEWB0d6Cyv/PsGQxQlhxxZW95RB+cd6Vd8XvkAjdqMZKG3Sje W9aqdN4c1g7CTPLZx+OcuTPprJPYCU3LrDCuT0oPHqZU7qf5/3G+hN5Jo8Ah5PSbBm+t PsKKovparf/vvITSYamSiFQBEYxkNRK9s55P+zfrwVjiDOayFNJx4EkftfhDnvTfPAUx ig7RiqXxDa943uZ9QhlIhU0DhYFfvv0eVHp2AaGTpfAlTYQN+yDJVOVqYepvS7MTb6BC fzoA== X-Gm-Message-State: AEkooutccmXaQRgxgo3EVzWDo2JeVeqtFNRPfA3P/jlLf+lNkvPG4LJwbk9US4+dSJF5pkMB X-Received: by 10.194.127.163 with SMTP id nh3mr2014547wjb.74.1469208764162; Fri, 22 Jul 2016 10:32:44 -0700 (PDT) Received: from localhost.localdomain (154.red-83-36-182.dynamicip.rima-tde.net. [83.36.182.154]) by smtp.gmail.com with ESMTPSA id q23sm13553098wme.17.2016.07.22.10.32.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Jul 2016 10:32:43 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, sudeep.holla@arm.com, suzuki.poulose@arm.com Subject: [PATCH 2/2] arm64: mm: run pgtable_page_ctor() on non-swapper translation table pages Date: Fri, 22 Jul 2016 19:32:25 +0200 Message-Id: <1469208745-6693-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469208745-6693-1-git-send-email-ard.biesheuvel@linaro.org> References: <1469208745-6693-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160722_103307_057078_6E4506A5 X-CRM114-Status: GOOD ( 11.64 ) 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 [2a00:1450:400c:c09:0:0:0:229 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 Message has at least one valid DKIM or DK signature -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 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, Ard Biesheuvel , labbott@fedoraproject.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org The kernel page table creation routines are accessible to other subsystems (e.g., EFI) via the create_pgd_mapping() entry point, which allows mappings to be created that are not covered by init_mm. Since generic code such as apply_to_page_range() may expect translation table pages that are not associated with init_mm to be covered by fully constructed struct pages, add a call to pgtable_page_ctor() in the alloc function used by create_pgd_mapping. Since it is no longer used by create_mapping_late(), also update the name of this function to better reflect its purpose. Signed-off-by: Ard Biesheuvel --- arch/arm64/mm/mmu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 33f36cede02d..51a558195bb9 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -268,10 +268,11 @@ static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys, } while (pgd++, addr = next, addr != end); } -static phys_addr_t late_pgtable_alloc(void) +static phys_addr_t pgd_pgtable_alloc(void) { void *ptr = (void *)__get_free_page(PGALLOC_GFP); - BUG_ON(!ptr); + if (!ptr || !pgtable_page_ctor(virt_to_page(ptr))) + BUG(); /* Ensure the zeroed page is visible to the page table walker */ dsb(ishst); @@ -298,8 +299,10 @@ void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, unsigned long virt, phys_addr_t size, pgprot_t prot, bool allow_block_mappings) { + BUG_ON(mm == &init_mm); + __create_pgd_mapping(mm->pgd, phys, virt, size, prot, - late_pgtable_alloc, allow_block_mappings); + pgd_pgtable_alloc, allow_block_mappings); } static void create_mapping_late(phys_addr_t phys, unsigned long virt,