Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp634847ybf; Wed, 26 Feb 2020 20:04:31 -0800 (PST) X-Google-Smtp-Source: APXvYqy3Xp3yKYWPljC6OatikPmwn1i7PqhLSLs5qmYV3f6EFf6NOdINF7kYG/0+4I8vYLlLVXaR X-Received: by 2002:a05:6830:95:: with SMTP id a21mr1732037oto.171.1582776271433; Wed, 26 Feb 2020 20:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582776271; cv=none; d=google.com; s=arc-20160816; b=KmiVxeGqc+Xa8w5JNlRJvT8kirvVlhRpCQu3DH/EA37xGGzMftSebENoFn9abemfKI cEVOxlA3FqZSVk0E04kX+/jKfu8L5LlhVoFEduYgMgUnTQ506M4ZfJMto89nCIbU5UoR h154YOY4P4Mm989AzWkPBzzCAuFZDbBwkgVZQ/59UqoDaQ2KwTTfBz4JIryOrHJIzqcm CyH4kXhZjOnxyjzqW44V3IU/PiiYXdLtPqcIihr1+bz19dq96WFEUaW6zVSCcHCyZVxR ly1Kn6m+8CyEVCSR0/fWYf3CGV0jKNmFrOa8Zx+xMEk5vKeal22RYg/wkvrwYC/UGtuC aboA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=N46TkGmJeEVwSldQB0zOVw2kGLcNhjqd1CBeetTF/NM=; b=gqRXMArgcozwKBGbnuOSgyzsdhvYo4gFWPZrAgp5Ml3DjxJRxcSglTpscCUuvGPlY1 Sv72R2zdzRjdR62V1QWFkLSPx9JFzbeJDCX+v5haNQ7ZV3B0SYcRVBbMBLu5CvzysMs4 YDJwjqrCYnOtoHVbSQkZF9odeDkkWGLUg0YpaozlKk8+tBb8R4/hp6GGoj98KmeqfaxK vTFFaJ3tn02d9Mn1qDa6aDcW4zU+mWn0e296Ac/lknSV3CEHHvFRsLBochj8prszI75r GqOmR7aEA+LeAxf3sduZ0RgMPDePRO2ZdT9KoMhHSmXcHtOw9lP5KBcPyspuEBMBRo2N 8Klw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hEshnkY+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m17si211317oie.187.2020.02.26.20.04.18; Wed, 26 Feb 2020 20:04:31 -0800 (PST) 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=@kernel.org header.s=default header.b=hEshnkY+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728354AbgB0ED4 (ORCPT + 99 others); Wed, 26 Feb 2020 23:03:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:57896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728252AbgB0EDz (ORCPT ); Wed, 26 Feb 2020 23:03:55 -0500 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D80E124685; Thu, 27 Feb 2020 04:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582776234; bh=dlJV6X0I7IrGWbU/KtcbtANr08nwFCVTfE1alETj44U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hEshnkY+tvGit0cKDfeluAySLkQ4Xled8zmc5jvOITOHKbmYgwRCgZhr11yYlZCaI QkeZdgAbSbrNzA3JROFuXOzJ0V7vmn3oqMn/+vctVVCl4wtBE8lv4P5PYNPqJ5zhBr 6sL43sJMfYsduFtDrJ6WJ+ZOQLAYvoMayLwJqBKk= Date: Wed, 26 Feb 2020 20:03:53 -0800 From: Andrew Morton To: Anshuman Khandual Cc: Christophe Leroy , Qian Cai , linux-mm@kvack.org, Mike Rapoport , Vineet Gupta , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "Kirill A . Shutemov" , Paul Walmsley , Palmer Dabbelt , linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-riscv@lists.infradead.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, James Morse Subject: Re: [PATCH V14] mm/debug: Add tests validating architecture page table helpers Message-Id: <20200226200353.ea5c8ec2efacfb1192f3f3f4@linux-foundation.org> In-Reply-To: <52db1e9b-83b3-c41f-ef03-0f43e2159a83@arm.com> References: <1581909460-19148-1-git-send-email-anshuman.khandual@arm.com> <1582726182.7365.123.camel@lca.pw> <1582726340.7365.124.camel@lca.pw> <52db1e9b-83b3-c41f-ef03-0f43e2159a83@arm.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Feb 2020 08:04:05 +0530 Anshuman Khandual wrote: > > Must be something wrong with the following in debug_vm_pgtable() > >=20 > > =A0=A0=A0=A0paddr =3D __pa(&start_kernel); > >=20 > > Is there any explaination why start_kernel() is not in linear memory on= ARM64 ? >=20 >=20 > Cc: + James Morse >=20 > This warning gets exposed with DEBUG_VIRTUAL due to __pa() on a kernel sy= mbol > i.e 'start_kernel' which might be outside the linear map. This happens du= e to > kernel mapping position randomization with KASLR. Adding James here in ca= se he > might like to add more. >=20 > __pa_symbol() should have been used instead, for accessing the physical a= ddress > here. On arm64 __pa() does check for linear address with __is_lm_address(= ) and > switch accordingly if it is a kernel text symbol. Nevertheless, its much = better > to use __pa_symbol() here rather than __pa(). >=20 > Rather than respining the patch once more, will just send a fix replacing= this > helper __pa() with __pa_symbol() for Andrew to pick up as this patch is a= lready > part of linux-next (next-20200226). But can definitely respin if that wil= l be > preferred. I didn't see this fix? I assume it's this? If so, are we sure it's OK to = be added to -next without testing?? From: Andrew Morton Subject: mm-debug-add-tests-validating-architecture-page-table-helpers-fix A warning gets exposed with DEBUG_VIRTUAL due to __pa() on a kernel symbol i.e 'start_kernel' which might be outside the linear map. This happens due to kernel mapping position randomization with KASLR. __pa_symbol() should have been used instead, for accessing the physical address here. On arm64 __pa() does check for linear address with __is_lm_address() and switch accordingly if it is a kernel text symbol.=20 Nevertheless, its much better to use __pa_symbol() here rather than __pa(). Reported-by: Qian Cai Cc: Anshuman Khandual Cc: James Morse Cc: Christophe Leroy Signed-off-by: Andrew Morton --- mm/debug_vm_pgtable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/debug_vm_pgtable.c~mm-debug-add-tests-validating-architecture-page= -table-helpers-fix +++ a/mm/debug_vm_pgtable.c @@ -331,7 +331,7 @@ void __init debug_vm_pgtable(void) * helps avoid large memory block allocations to be used for mapping * at higher page table levels. */ - paddr =3D __pa(&start_kernel); + paddr =3D __pa_symbol(&start_kernel); =20 pte_aligned =3D (paddr & PAGE_MASK) >> PAGE_SHIFT; pmd_aligned =3D (paddr & PMD_MASK) >> PAGE_SHIFT; _