Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp508838rwe; Wed, 31 Aug 2022 06:36:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR7PvCRzQiF6C48EueHDNtcmg6zm/0Bagjya1ukpl1z7QKIvQXFBfmIuobeaNipuoHwjtWXf X-Received: by 2002:a05:6402:401a:b0:448:2ce5:652a with SMTP id d26-20020a056402401a00b004482ce5652amr12115566eda.322.1661952960932; Wed, 31 Aug 2022 06:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661952960; cv=none; d=google.com; s=arc-20160816; b=dcGbLMG3NHPvV0jzdY7MHzKajAOplLeYmIn8Oamb08J6vGt37U/omTcctmc+5SdPSs Ku7dr3+Q/VMaJCl9fC0lencl0Tti/2Jqlohp196Z0AZ/PHu2wWlo1YTlUfQLOHX/gzvW po/LgEVFi7arApX9hbXu29RijZhpIb84Hn2M3pjBJ9uqda+B9KDzp8kEJCmH3kmj8vTp 4CKL4XifW1th3pM7GpmPAMQkhUh28VaW1LmdM5smOWNAeRmdkMHmdjXYKhyHrrlLbF83 zBEP6mX5SOltDp4o6a2ipGS1NO3xEdoCQEthcAcRhaEeSxc/ig1y+lDcsBXvZPJ2FWQE +LxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=NLEcrXI+XjhVPOi6GP4cp8ajB8DHBcmvDNnL+9DcfXs=; b=N66M5PW7TRFa3PKcn39GtkrzzGvgVgkbVynp3wnvHmace1AWycQ3r0KRP23pNx7OLI 11618el9FbzP6nsC7fluKYCKIPc8UN0Ec2ySdsUK5yXbdXtEoPKbLmK0vCre/PxvOyW6 VNuceQqLQV6nUn7JdjbpLt4KcBORAdZJlhzDFvcDyf0y+sbMGs7pcrn7UgKP4ntiooMV mRQKtV9kM88yYePK/zm+4H5B7u9yqzzwa7mwNbLENYV215vl3yxpE1kFRfgcq3psv7Qm rkh1luY2bxghjJ81xHCuehflYXMJp6bsVabkerHZID2lhfls0MdtoCxO88qJeR/zT9Rb wXhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a056402520d00b004487c209b0asi7499629edd.490.2022.08.31.06.35.35; Wed, 31 Aug 2022 06:36:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229449AbiHaMhp (ORCPT + 99 others); Wed, 31 Aug 2022 08:37:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiHaMho (ORCPT ); Wed, 31 Aug 2022 08:37:44 -0400 Received: from out28-148.mail.aliyun.com (out28-148.mail.aliyun.com [115.124.28.148]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC2F0167D9 for ; Wed, 31 Aug 2022 05:37:42 -0700 (PDT) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07722721|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_news_journal|0.0675243-0.00153387-0.930942;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047198;MF=victor@allwinnertech.com;NM=1;PH=DS;RN=11;RT=11;SR=0;TI=SMTPD_---.P4QJDlq_1661949456; Received: from 192.168.220.136(mailfrom:victor@allwinnertech.com fp:SMTPD_---.P4QJDlq_1661949456) by smtp.aliyun-inc.com; Wed, 31 Aug 2022 20:37:39 +0800 Message-ID: Date: Wed, 31 Aug 2022 20:37:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] ARM: mmu: fix access to illegal address when using earlycon & memblock=debug Content-Language: en-US To: Marek Szyprowski , linux@armlinux.org.uk, rmk+kernel@armlinux.org.uk, linus.walleij@linaro.org, yanfei.xu@windriver.com, ardb@kernel.org, tglx@linutronix.de, mirq-linux@rere.qmqm.pl, arnd@arndb.de Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20220316023356.120595-1-victor@allwinnertech.com> <9a425a51-9460-6c4d-e331-5cd5873f8a43@samsung.com> From: Victor Hassan In-Reply-To: <9a425a51-9460-6c4d-e331-5cd5873f8a43@samsung.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/31/2022 7:52 PM, Marek Szyprowski wrote: > Hi Victor, > > On 16.03.2022 03:33, Victor Hassan wrote: >> earlycon uses fixmap to create a memory map, >> So we need to close earlycon before closing fixmap, >> otherwise printk will access illegal addresses. >> After creating a new memory map, we open earlycon again. >> >> Signed-off-by: Victor Hassan > > This patch landed in linux next-20220831 as commit a76886d117cb ("ARM: > 9223/1: mmu: fix access to illegal address when using earlycon & > memblock=debug"). Unfortunately it breaks booting of all my test boards > which *do not* use earlycon. It can be easily reproduced even with QEMU. > > With kernel compiled from multi_v7_defconfig the following setup boots: > > $ qemu-system-arm -nographic -kernel arch/arm/boot/zImage -append > "console=ttyAMA0 earlycon" -M virt -smp 2 -m 512 > > while this one doesn't: > > $ qemu-system-arm -nographic -kernel arch/arm/boot/zImage -append > "console=ttyAMA0" -M virt -smp 2 -m 512 > > >> --- >> arch/arm/mm/mmu.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c >> index 274e4f73fd33..f3511f07a7d0 100644 >> --- a/arch/arm/mm/mmu.c >> +++ b/arch/arm/mm/mmu.c >> @@ -14,6 +14,7 @@ >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -1695,6 +1696,9 @@ static void __init early_fixmap_shutdown(void) >> pmd_clear(fixmap_pmd(va)); >> local_flush_tlb_kernel_page(va); >> >> +#ifdef CONFIG_FIX_EARLYCON_MEM >> + console_stop(console_drivers); >> +#endif >> for (i = 0; i < __end_of_permanent_fixed_addresses; i++) { >> pte_t *pte; >> struct map_desc map; >> @@ -1713,6 +1717,9 @@ static void __init early_fixmap_shutdown(void) >> >> create_mapping(&map); >> } >> +#ifdef CONFIG_FIX_EARLYCON_MEM >> + console_start(console_drivers); >> +#endif >> } >> >> /* > > Best regards Dear Marek, Thank you for the notice. I'll figure it out and feed back to you as soon as possible. Regards, Victor