From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH V14] mm/debug: Add tests validating architecture page table helpers Date: Wed, 26 Feb 2020 20:03:53 -0800 Message-ID: <20200226200353.ea5c8ec2efacfb1192f3f3f4@linux-foundation.org> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <52db1e9b-83b3-c41f-ef03-0f43e2159a83@arm.com> Sender: linux-kernel-owner@vger.kernel.org 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 List-Id: linux-arch.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; _ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 26 Feb 2020 20:03:53 -0800 From: Andrew Morton 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+rppt=linux.ibm.com@lists.infradead.org To: Anshuman Khandual Cc: Benjamin Herrenschmidt , Heiko Carstens , linux-mm@kvack.org, Paul Mackerras , "H. Peter Anvin" , linux-riscv@lists.infradead.org, Will Deacon , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Michael Ellerman , x86@kernel.org, Mike Rapoport , Christian Borntraeger , Ingo Molnar , Catalin Marinas , James Morse , linux-snps-arc@lists.infradead.org, Vasily Gorbik , Qian Cai , Paul Walmsley , "Kirill A . Shutemov" , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Vineet Gupta , linux-kernel@vger.kernel.org, Palmer Dabbelt , Borislav Petkov , linuxppc-dev@lists.ozlabs.org List-ID: Message-ID: <20200227040353.miIfxRVotAxdH67xVVqTzl39wzhNfTOP2YJUiPirR84@z> 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; _ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Date: Wed, 26 Feb 2020 20:03:53 -0800 From: Andrew Morton 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: linux-s390-owner@vger.kernel.org List-ID: 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 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; _ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C25DC4BA06 for ; Thu, 27 Feb 2020 04:04:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E48F324689 for ; Thu, 27 Feb 2020 04:04:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TiDAEHCA"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="hEshnkY+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E48F324689 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Message-Id:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8cxBRIJTetNWyuVd4X7YPwvP2wBWH08O/nOTFpdNHIM=; b=TiDAEHCAPKa8Qi ymP5zz1v28zp8XS3Qe5x+WHv0ejg5xAtQH+33RTmwjs6AhoqddLxN+afNGC9o/iIrtMZn58O81bAn cX1Iof3Y3x+/h9Y3bGgux5Z4GaSEL18KQaoGW8lbnCcD6p1GhEKyOuVjejl/fLcuKhb6bZz/1vDpi fnpRHsnvjRGJz6e8X/7j1ODt07p1ffxklJUw2ooliCQ74joFgwjMmTVQl9gaSsSdp9ekFe2mgGHce O8cqp5dTVb/xDslXMYsHBv3zuLkPJYU9uladHoaEagkDyPl1oV4ZHpxKkzddCGlaXPWNJblLod4Qn dLOT80/lZ66WzN4dhMGA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7APB-0001ay-RN; Thu, 27 Feb 2020 04:04:09 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7AOx-0001NZ-MG; Thu, 27 Feb 2020 04:03:57 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200226_200355_774378_1AED5004 X-CRM114-Status: GOOD ( 18.14 ) X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin Herrenschmidt , Heiko Carstens , linux-mm@kvack.org, Paul Mackerras , "H. Peter Anvin" , linux-riscv@lists.infradead.org, Will Deacon , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Michael Ellerman , x86@kernel.org, Mike Rapoport , Christian Borntraeger , Ingo Molnar , Catalin Marinas , James Morse , linux-snps-arc@lists.infradead.org, Vasily Gorbik , Qian Cai , Paul Walmsley , "Kirill A . Shutemov" , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Vineet Gupta , linux-kernel@vger.kernel.org, Palmer Dabbelt , Borislav Petkov , linuxppc-dev@lists.ozlabs.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org On Thu, 27 Feb 2020 08:04:05 +0530 Anshuman Khandual wrote: > > Must be something wrong with the following in debug_vm_pgtable() > > = > > =A0=A0=A0=A0paddr =3D __pa(&start_kernel); > > = > > Is there any explaination why start_kernel() is not in linear memory on= ARM64 ? > = > = > Cc: + James Morse > = > 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. > = > __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(). > = > 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. = 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); = pte_aligned =3D (paddr & PAGE_MASK) >> PAGE_SHIFT; pmd_aligned =3D (paddr & PMD_MASK) >> PAGE_SHIFT; _ _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18896C4BA24 for ; Thu, 27 Feb 2020 04:06:04 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BC38124687 for ; Thu, 27 Feb 2020 04:06:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="hEshnkY+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC38124687 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48SfGx5bgRzDqsG for ; Thu, 27 Feb 2020 15:06:01 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux-foundation.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=akpm@linux-foundation.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=default header.b=hEshnkY+; dkim-atps=neutral Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48SfDY09YLzDqsZ for ; Thu, 27 Feb 2020 15:03:56 +1100 (AEDT) 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 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 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Carstens , linux-mm@kvack.org, Paul Mackerras , "H. Peter Anvin" , linux-riscv@lists.infradead.org, Will Deacon , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, Mike Rapoport , Christian Borntraeger , Ingo Molnar , Catalin Marinas , James Morse , linux-snps-arc@lists.infradead.org, Vasily Gorbik , Qian Cai , Paul Walmsley , "Kirill A . Shutemov" , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Vineet Gupta , linux-kernel@vger.kernel.org, Palmer Dabbelt , Borislav Petkov , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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; _ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35238C4BA06 for ; Thu, 27 Feb 2020 04:04:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C2D32468A for ; Thu, 27 Feb 2020 04:04:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pmQQZJh0"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="hEshnkY+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C2D32468A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Message-Id:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WvvXpAWv50YUWR2/l+aw8ZALwSa87P6FXnJ3lu37LnU=; b=pmQQZJh0Ck0826 ES4mLzdjANI9AiMxfc/QH3jjYfO1ByfxGYu0nPHKLSKh7S0m6B52TGyaCMHAIkcs+CqrMs7/c22PL 9PZgD/AXR2oaNt100N1EXMjJGfLCJHAZoI7JUulHSSgPmcR1DiKfN1kSf4BH1TALfW/YWlwpuryY0 Q2mK+5VsWOy1ZVKV4cmjlOJ2HCk8pplcX3fKLUZFp2+V5Mq225Ms7iZMWWyzcnqNnc9Crg80RdZCl bgYZe5WQFuZMutBFpjLJo3YrJj0Fachv+l7XjeAJjEFRbK1JTV96l7xhl6DI6lgOqWrVzVIqOpsKE WgtcnS1u7dKp5Pa/9ycw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7AP1-0001OY-9s; Thu, 27 Feb 2020 04:03:59 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7AOx-0001NZ-MG; Thu, 27 Feb 2020 04:03:57 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200226_200355_774378_1AED5004 X-CRM114-Status: GOOD ( 18.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin Herrenschmidt , Heiko Carstens , linux-mm@kvack.org, Paul Mackerras , "H. Peter Anvin" , linux-riscv@lists.infradead.org, Will Deacon , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Michael Ellerman , x86@kernel.org, Mike Rapoport , Christian Borntraeger , Ingo Molnar , Catalin Marinas , James Morse , linux-snps-arc@lists.infradead.org, Vasily Gorbik , Qian Cai , Paul Walmsley , "Kirill A . Shutemov" , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Vineet Gupta , linux-kernel@vger.kernel.org, Palmer Dabbelt , Borislav Petkov , linuxppc-dev@lists.ozlabs.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 27 Feb 2020 08:04:05 +0530 Anshuman Khandual wrote: > > Must be something wrong with the following in debug_vm_pgtable() > > = > > =A0=A0=A0=A0paddr =3D __pa(&start_kernel); > > = > > Is there any explaination why start_kernel() is not in linear memory on= ARM64 ? > = > = > Cc: + James Morse > = > 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. > = > __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(). > = > 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. = 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); = pte_aligned =3D (paddr & PAGE_MASK) >> PAGE_SHIFT; pmd_aligned =3D (paddr & PMD_MASK) >> PAGE_SHIFT; _ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel