Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp274725lqs; Thu, 13 Jun 2024 09:38:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX9LA8t4IAX13R+Nxzz06yi/eRTyj4lmWaeNnskGyo2VtlkV4QNm2iQ5J9sG9bkUWVUdVXyx8HFl7xpZO93G3Ty5Ozz9GA4gUc1QfOYLQ== X-Google-Smtp-Source: AGHT+IH37zWjIn77Ap1gfjObtSgcwCPdcedp/i1ePzAkUxm0u6fLHtefslwmf8ejSkhFyXAEJZ0B X-Received: by 2002:a05:6402:3403:b0:57c:7ed7:897a with SMTP id 4fb4d7f45d1cf-57cbd69e802mr262235a12.27.1718296715131; Thu, 13 Jun 2024 09:38:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718296715; cv=pass; d=google.com; s=arc-20160816; b=pgePGP2x/OMcjzL0iXQ2gK1B95Lrnd1EXM3p4w3gxLwrCyORYJNkVcDqKFAIPoyl8A 88SYzG0wjE0A7BzlQghTYJjYDYpHaimINQrXmbcMKmv/HARXX7oqoZV/1xuSWnjkAQRa lKcY2p+Of6leY0LwnpLvw7UTMfQTKzJKPVWmwZG1HABjkG1gWtl4ERf5lFgcReEYWsSe OemFfrSNNfCfYo4NlKAgJucMxl3Nkp7mXNHp2wJAWzT/BX03jezR15O34F8MzZGOYFeD kIVAiRWrQkjgKoYW/73TDhBRDYJRCylA+wXXw+ClcfFPs21fIEABsT8tFn5jWIowhILz PTrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=U2Kw7rTrRf6+lYxcAtlaLrllda+m7V/m2nHSxvWCMBo=; fh=c6BExTvLXlqE4ZLWvvxV0soMPrixBTjJZ5MM/AiZIZ8=; b=a5nOtbEFLSUmjxyxTfp//5y8cXFfyaPbXDXRZ47L0wVGlffcS6cQ9DXpCRKEWJVzUG Bf9OYPZCOsNifNSqYsCJE8IWiEOF5uu5vRxN5B7TU9GqQ77gW2CjIhJtFAJEfe8ZFP9x 5rKzin+cbVeHXZCL40MpD18reAcSsKA3HsunYEOSVIVhO3Jy28sVvVSjYmvfcVgpQZYi fnFrkk404kvHKSsMX194C7Ca8ONSZd9t0J2kk7Q88IxInFf54fm8W5Iw5xtMEBj+S6kd RCR3ty6VkSayHtEWSC0h+BRVN4ibYMGbCHx3uaRtnJ8yTRswO9HccikRMAN5rdqf6Lxn Vr7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-213656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213656-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57cb72d5fa3si919481a12.135.2024.06.13.09.38.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 09:38:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-213656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213656-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D5CB71F235FB for ; Thu, 13 Jun 2024 16:38:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34C7C1494AB; Thu, 13 Jun 2024 16:38:28 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C85A12D757; Thu, 13 Jun 2024 16:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718296707; cv=none; b=lhtRYlkcIZcPjpKtUTZkT12vOLNyhDn4BWA6zVXv8vJA5pP6j3ML7Oa9w4BWzf/iUeME48ukqSZhHXczhUGgPB88DYcvKYA+SsdzURbb4Ou0p53Oy3k853ig+W6wozVOtnoE021nyj9OVlHMHDSruWG8mZUXkJFK8TMGuWpg7xk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718296707; c=relaxed/simple; bh=aKOhNOdB7ccnzq+ofFI1uzD4Kj+zLwM5PbYdAt6B0RE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sLC+0GJyMO0S8//xNn0ih0i57pxGQRe02D40h3MhIPF+kMu3BDTKXIv8mlUOjSHO6SO8yRtrcRnwCZVU9DZ4XyEkwMGVYDPJZog1JCrU5hzOlrM/ifndMUjxL71yGnnjJ8oPPzsXUOKyqk59a0h06DJ08R1NhdAa30SaHFUuK2s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2F821FEC; Thu, 13 Jun 2024 09:38:48 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 012363F73B; Thu, 13 Jun 2024 09:38:21 -0700 (PDT) Message-ID: <002b6176-41b3-4888-abb1-978399d108b8@arm.com> Date: Thu, 13 Jun 2024 17:38:20 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 1/4] of: reserved_mem: Restruture how the reserved memory regions are processed To: Conor Dooley , Oreoluwa Babatunde Cc: Mark Brown , Nathan Chancellor , robh@kernel.org, saravanak@google.com, hch@lst.de, m.szyprowski@samsung.com, will@kernel.org, catalin.marinas@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, kernel@quicinc.com References: <20240528223650.619532-1-quic_obabatun@quicinc.com> <20240528223650.619532-2-quic_obabatun@quicinc.com> <20240610213403.GA1697364@thelio-3990X> <20240613-goldfish-unpicked-1bc9f786aaed@spud> From: Robin Murphy Content-Language: en-GB In-Reply-To: <20240613-goldfish-unpicked-1bc9f786aaed@spud> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 13/06/2024 5:17 pm, Conor Dooley wrote: > On Thu, Jun 13, 2024 at 09:05:18AM -0700, Oreoluwa Babatunde wrote: >> >> On 6/10/2024 2:47 PM, Mark Brown wrote: >>> On Mon, Jun 10, 2024 at 02:34:03PM -0700, Nathan Chancellor wrote: >>>> On Tue, May 28, 2024 at 03:36:47PM -0700, Oreoluwa Babatunde wrote: >>>>> fdt_init_reserved_mem() is also now called from within the >>>>> unflatten_device_tree() function so that this step happens after the >>>>> page tables have been setup. >>>>> Signed-off-by: Oreoluwa Babatunde >>>> I am seeing a warning when booting aspeed_g5_defconfig in QEMU that I >>>> bisected to this change in -next as commit a46cccb0ee2d ("of: >>>> reserved_mem: Restruture how the reserved memory regions are >>>> processed"). >>> I'm also seeing issues in -next which I bisected to this commit, on the >>> original Raspberry Pi the cpufreq driver fails to come up and I see >>> (potentially separate?) backtraces: >>> >>> [ 0.100390] ------------[ cut here ]------------ >>> [ 0.100476] WARNING: CPU: 0 PID: 1 at mm/memory.c:2835 __apply_to_page_range+0xd4/0x2c8 >>> [ 0.100637] Modules linked in: >>> [ 0.100665] CPU: 0 PID: 1 Comm: swapper Not tainted 6.10.0-rc2-next-20240607 #1 >>> [ 0.100692] Hardware name: BCM2835 >>> [ 0.100705] Call trace: >>> [ 0.100727] unwind_backtrace from show_stack+0x18/0x1c >>> [ 0.100790] show_stack from dump_stack_lvl+0x38/0x48 >>> [ 0.100833] dump_stack_lvl from __warn+0x8c/0xf4 >>> [ 0.100888] __warn from warn_slowpath_fmt+0x80/0xbc >>> [ 0.100933] warn_slowpath_fmt from __apply_to_page_range+0xd4/0x2c8 >>> [ 0.100983] __apply_to_page_range from apply_to_page_range+0x20/0x28 >>> [ 0.101027] apply_to_page_range from __dma_remap+0x58/0x88 >>> [ 0.101071] __dma_remap from __alloc_from_contiguous+0x6c/0xa8 >>> [ 0.101106] __alloc_from_contiguous from atomic_pool_init+0x9c/0x1c4 >>> [ 0.101169] atomic_pool_init from do_one_initcall+0x68/0x158 >>> [ 0.101223] do_one_initcall from kernel_init_freeable+0x1ac/0x1f0 >>> [ 0.101267] kernel_init_freeable from kernel_init+0x1c/0x140 >>> [ 0.101309] kernel_init from ret_from_fork+0x14/0x28 >>> [ 0.101344] Exception stack(0xdc80dfb0 to 0xdc80dff8) >>> [ 0.101369] dfa0: 00000000 00000000 00000000 00000000 >>> [ 0.101393] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 >>> [ 0.101414] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 >>> [ 0.101428] ---[ end trace 0000000000000000 ]--- >>> >>> Full boot log at: >>> >>> https://lava.sirena.org.uk/scheduler/job/374962 >>> >>> You can see the report of cpufreq not being loaded in the log. >>> >>> NFS boots also fail, apparently due to slowness bringing up a Debian >>> userspace which may well be due to cpufreq isues: >> Hi Mark & Nathan, >> >> Taking a look at this now and will provide a fix soon if >> needed. >> >> At first glance, it looks like there are a couple of WARN_ON* >> function calls in __apply_to_page_range(). Please could >> you run faddr2line and tell me which of the WARN_ON* >> cases we are hitting? > > That shouldn't be needed, right? The line is in the WARNING: mm/memory.c:2835 > which, in next-20240607, is: if (WARN_ON_ONCE(pmd_leaf(*pmd))). Indeed, and the overall implication there would seem to be that, because the dynamic CMA region wasn't allocated and reserved before we created the pagetables, we thus haven't created the pagetables in a shape which can accommodate chopping it out again later. Note that on arm64 at least, this is liable to be hidden by other options like rodata_full and debug_pagealloc - see can_set_direct_map(). Thanks, Robin.