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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 386A9C433EF for ; Tue, 19 Oct 2021 03:55:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B07176134F for ; Tue, 19 Oct 2021 03:55:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B07176134F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=quicinc.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1F3ED6B006C; Mon, 18 Oct 2021 23:55:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A4746B0071; Mon, 18 Oct 2021 23:55:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09286900002; Mon, 18 Oct 2021 23:55:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0180.hostedemail.com [216.40.44.180]) by kanga.kvack.org (Postfix) with ESMTP id EA0D46B006C for ; Mon, 18 Oct 2021 23:55:45 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 85B483C7A2 for ; Tue, 19 Oct 2021 03:55:45 +0000 (UTC) X-FDA: 78711823050.03.AF649B0 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by imf21.hostedemail.com (Postfix) with ESMTP id 5BA6BD042B65 for ; Tue, 19 Oct 2021 03:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1634615745; x=1666151745; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=jUxsFfhZv+xMH7L8aJp/W+aFtEjJbyj+vI7OiNG8kPU=; b=o8WoHoTYfxJmBtBbQnw4ES/xwa8f4JrK9SuKvVI7ze+NgOo52gqZq3qo uZkWTE8J1wosGVC9RJ6Z8rrjXwWXMDOMwPJph+W2KVzYBuouFJR3BKgn8 5SK2MNUh6W83TeccIvPHKa/LXWF4dh1wwmc9/3lTv3p4jpCKyNhEogST7 Y=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 18 Oct 2021 20:55:44 -0700 X-QCInternal: smtphost Received: from nalasex01a.na.qualcomm.com ([10.47.209.196]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2021 20:55:43 -0700 Received: from [10.111.172.190] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Mon, 18 Oct 2021 20:55:41 -0700 Message-ID: Date: Mon, 18 Oct 2021 23:55:40 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH] memblock: exclude NOMAP regions from kmemleak Content-Language: en-US To: Mike Rapoport , CC: Andrew Morton , Catalin Marinas , Mike Rapoport , Vladimir Zapolskiy , , Linus Torvalds References: <20211013054756.12177-1-rppt@kernel.org> From: Qian Cai In-Reply-To: <20211013054756.12177-1-rppt@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcdkim header.b=o8WoHoTY; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf21.hostedemail.com: domain of quic_qiancai@quicinc.com designates 129.46.98.28 as permitted sender) smtp.mailfrom=quic_qiancai@quicinc.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5BA6BD042B65 X-Stat-Signature: b1ha57jgawim3focwnuf5yyr86bc34j3 X-HE-Tag: 1634615743-924279 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 10/13/2021 1:47 AM, Mike Rapoport wrote: > From: Mike Rapoport > > Vladimir Zapolskiy reports: > > commit a7259df76702 ("memblock: make memblock_find_in_range method private") > invokes a kernel panic while running kmemleak on OF platforms with nomaped > regions: > > Unable to handle kernel paging request at virtual address fff000021e00000 > [...] > scan_block+0x64/0x170 > scan_gray_list+0xe8/0x17c > kmemleak_scan+0x270/0x514 > kmemleak_write+0x34c/0x4ac > > Indeed, NOMAP regions don't have linear map entries so an attempt to scan > these areas would fault. > > Prevent such faults by excluding NOMAP regions from kmemleak. > > Link: https://lore.kernel.org/all/8ade5174-b143-d621-8c8e-dc6a1898c6fb@linaro.org > Fixes: a7259df76702 ("memblock: make memblock_find_in_range method private") > Signed-off-by: Mike Rapoport > Tested-by: Vladimir Zapolskiy Mike, reverting this commit on the top of today's linux-next fixed the early booting hang on an arm64 server with kmemleak. Even with "earlycon", it could only print out those lines. EFI stub: Booting Linux Kernel... EFI stub: EFI_RNG_PROTOCOL unavailable EFI stub: ERROR: FIRMWARE BUG: kernel image not aligned on 128k boundary EFI stub: ERROR: FIRMWARE BUG: Image BSS overlaps adjacent EFI memory region EFI stub: Using DTB from configuration table EFI stub: Exiting boot services… I could help to confirm if it hangs right in the early boot somewhere if needed. start_kernel() setup_arch() paging_init() map_mem() memblock_mark_nomap( > --- > mm/memblock.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/mm/memblock.c b/mm/memblock.c > index 184dcd2e5d99..5c3503c98b2f 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -936,7 +936,12 @@ int __init_memblock memblock_mark_mirror(phys_addr_t base, phys_addr_t size) > */ > int __init_memblock memblock_mark_nomap(phys_addr_t base, phys_addr_t size) > { > - return memblock_setclr_flag(base, size, 1, MEMBLOCK_NOMAP); > + int ret = memblock_setclr_flag(base, size, 1, MEMBLOCK_NOMAP); > + > + if (!ret) > + kmemleak_free_part_phys(base, size); > + > + return ret; > } > > /** > > base-commit: 64570fbc14f8d7cb3fe3995f20e26bc25ce4b2cc >