Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3902606imu; Tue, 18 Dec 2018 06:09:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wu9ZbHcv/ckfwuE581GTSQdmaZUyI7Ga9C87JGi5Pmu9zJom5hE3A4t7qmD+/kDA/INqki X-Received: by 2002:a63:151f:: with SMTP id v31mr2963345pgl.34.1545142140779; Tue, 18 Dec 2018 06:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545142140; cv=none; d=google.com; s=arc-20160816; b=OKYelFagbQNWxRcTzFGH4jyoGhOZdjkOoH0PNYgcD1oHYsVh0xXhufArwdGtMCvsaG g2ysfwxLpyBahCZpdMUN5UWfeNsA14F2jFvsaAEbSddI9wm4oDkqVYH9q9eCVlUYf0h3 SGNpW9zLO9q4udkfqMnyjFcbLI8oMMYiODx2uBsyhR+WfAJ3aQt2pLiJbBW2msjbG3Xb WL2LPg4JgFffFSrkEDV3bXqiKWUs/P4TvHxvYiuFlk25MPRaOJ0m375ePysHsGMFQyln hPANof4yRtvXhjcJSEe7EKJkfU1qn0yvs6Pyt9HpQBKOERybWYQq/koOkwe+0rya3y6c 4L5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=Z+CJPeqDGh1ZDMHMnut0UPOASTEJZllWFPvMXBni1Ek=; b=loKXyo+KXZUHZVH3CrFnxa3WTmugCbQT7Hdhd9nV8QnsFURCPPsZG7j+1BBjaF48Nh BqTGHOPuP4nf45o19CUZNn1Nx/Yw1qhmOC/YmN0wIsPzf2mv9LImvPs1V7NXAGyOot5L qO8VpGhsdLCeFmg+LrWuXR3k16zWaOnm7Ql0SrDuPZJTOARtjo/0jwYK5NTnIFEymvhN ICgHaO0Zi3UDBaS5uJqzxhh+odWtOeUc7CwobtUheZTLpXgutmfyGXHYyORqEVb4K8St 0PeydmlnJ3T4q83bKIqwCOGP8EyDOKJIxuQ8BtWRkWjK9LuEZ6RwgTtz7KyUCyB+nU8O 6iTg== ARC-Authentication-Results: i=1; mx.google.com; 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 j24si13944041pgh.362.2018.12.18.06.08.42; Tue, 18 Dec 2018 06:09:00 -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; 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 S1726787AbeLROGP (ORCPT + 99 others); Tue, 18 Dec 2018 09:06:15 -0500 Received: from ozlabs.org ([203.11.71.1]:45499 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbeLROGO (ORCPT ); Tue, 18 Dec 2018 09:06:14 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 43K0Dg4LFBz9s3Z; Wed, 19 Dec 2018 01:06:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au From: Michael Ellerman To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v3] powerpc: implement CONFIG_DEBUG_VIRTUAL In-Reply-To: References: Date: Wed, 19 Dec 2018 01:06:11 +1100 Message-ID: <87y38nrkto.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe Leroy writes: > This patch implements CONFIG_DEBUG_VIRTUAL to warn about > incorrect use of virt_to_phys() and page_to_phys() This commit is breaking my p5020ds booting a 32-bit kernel with: smp: Bringing up secondary CPUs ... __ioremap(): phys addr 0x7fef5000 is RAM lr ioremap_coherent Unable to handle kernel paging request for data at address 0x00000000 Faulting instruction address: 0xc002e950 Oops: Kernel access of bad area, sig: 11 [#1] BE SMP NR_CPUS=24 CoreNet Generic Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.20.0-rc2-gcc-7.0.1-00138-g9a0380d299e9 #148 NIP: c002e950 LR: c002eb20 CTR: 00000001 REGS: e804bd20 TRAP: 0300 Not tainted (4.20.0-rc2-gcc-7.0.1-00138-g9a0380d299e9) MSR: 00021002 CR: 28004222 XER: 00000000 DEAR: 00000000 ESR: 00000000 GPR00: c002eb20 e804bdd0 e8050000 00000000 00021002 00000000 00000050 00021002 GPR08: 2d3f0000 00000001 00000000 00000004 24000842 00000000 c00026d0 00000000 GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 GPR24: 00029002 7fef5140 30000000 00000000 00000000 00000040 00000001 00000000 NIP [c002e950] smp_85xx_kick_cpu+0x120/0x410 LR [c002eb20] smp_85xx_kick_cpu+0x2f0/0x410 Call Trace: [e804bdd0] [c002eb20] smp_85xx_kick_cpu+0x2f0/0x410 (unreliable) [e804be20] [c0012e38] __cpu_up+0xc8/0x230 [e804be50] [c0040b34] bringup_cpu+0x34/0x110 [e804be70] [c00418a8] cpu_up+0x128/0x250 [e804beb0] [c0b84b14] smp_init+0xc4/0x10c [e804bee0] [c0b75c1c] kernel_init_freeable+0xc8/0x250 [e804bf20] [c00026e8] kernel_init+0x18/0x120 [e804bf40] [c0011298] ret_from_kernel_thread+0x14/0x1c Instruction dump: 7fb3e850 57bdd1be 2e1d0000 41d20250 57bd3032 393dffc0 7e6a9b78 5529d1be 39290001 7d2903a6 60000000 60000000 <7c0050ac> 394a0040 4200fff8 7c0004ac ---[ end trace edcab2a1dfd5b38c ]--- Which is obviously this hunk: > diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c > index 4fc77a99c9bf..68d204a45cd0 100644 > --- a/arch/powerpc/mm/pgtable_32.c > +++ b/arch/powerpc/mm/pgtable_32.c > @@ -143,7 +143,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call > * Don't allow anybody to remap normal RAM that we're using. > * mem_init() sets high_memory so only do the check after that. > */ > - if (slab_is_available() && (p < virt_to_phys(high_memory)) && > + if (slab_is_available() && virt_addr_valid(p) && > page_is_ram(__phys_to_pfn(p))) { > printk("__ioremap(): phys addr 0x%llx is RAM lr %ps\n", > (unsigned long long)p, __builtin_return_address(0)); I'll try and come up with a fix tomorrow. cheers