Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp398359rwe; Wed, 31 Aug 2022 04:57:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR62osd19AWhMwYOuKpcwoluBWkM1kYxkDU0UtB4g87vJI4y3sEJES0jY39/uxvxAIA407y1 X-Received: by 2002:a17:90a:4fa3:b0:1fb:a751:6a71 with SMTP id q32-20020a17090a4fa300b001fba7516a71mr2926686pjh.157.1661947029744; Wed, 31 Aug 2022 04:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661947029; cv=none; d=google.com; s=arc-20160816; b=WLg6/AZDgLa9aO631HOMAwLjnnBA885/+IK2nHtbfz/OQdPXlrpdnxm03a7JirNg8p O1fPGaEZRD6rHcl4r38AXtR3XbLhpbLlnNbggocWSaISu677EVLaiMh11XJaHcwQRi48 DYW0C7dgUv9d9WqgSJ2qytqggjh/2bfFZvl6UU6FXrvX8NuZ5cBS5G/xzRoV8OQmFGJ7 yQyS1FBoL2kc82DnsF9bt5O89h046cq3nXaj3uwxYc4uecrPmdrL8geUpRq4e+fDL7gq llHNtUUhhad4Sq595ez9UcpW+/T858zD3zeD2nfvfw1g+HQxl3BarITfsXj/RkWFwUsU q1/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :in-reply-to:from:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature:dkim-filter; bh=Nxlfym3ND6i/YRJglggezX4ww7hOMachCwDzRO1d2yI=; b=IZiktFySygVE3kVfZtL2nrlPgigM5tDvyTau3aLboygcMYEnklpJCaOndd2p5Q3HLR pD0Mr56/xfGX0Oa5QYP2/vmqscdVNtmzvkaQN+Hvsfrcrb9hZ+v6yt2nYmdpfNk5txwA b8Q550PB5VAVt2x6UNx14mvb+/my9h30LNstnDjLChDludeA01HxODu2eRtzaxRblNW4 L0mXmImFbHgcdkALa21PpJ2cJwgOJB3NZeRh8DhVq2gIwXE9IQlx2IV2+Soh1XqBXinQ HwB9q/fQCDaSHwmRgVhywRsiizS4yQ0L8xvntiYwi3wfX1E4AVSUYjQZimdLrecyfBec 6cOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lyKfTnmj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x186-20020a6386c3000000b0042b32127ed1si4609568pgd.534.2022.08.31.04.56.58; Wed, 31 Aug 2022 04:57:09 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lyKfTnmj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229943AbiHaLxL (ORCPT + 99 others); Wed, 31 Aug 2022 07:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229652AbiHaLxJ (ORCPT ); Wed, 31 Aug 2022 07:53:09 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CFA5C7F9B for ; Wed, 31 Aug 2022 04:53:05 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220831115258euoutp01711728c076d00ae9f805a79ff1516340~Qa8o6w21P3194731947euoutp01k for ; Wed, 31 Aug 2022 11:52:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220831115258euoutp01711728c076d00ae9f805a79ff1516340~Qa8o6w21P3194731947euoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1661946778; bh=Nxlfym3ND6i/YRJglggezX4ww7hOMachCwDzRO1d2yI=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=lyKfTnmjoKXjfIqJwFrgtTajFsmL9zOHZpwNF3QtXqJ49hMaw3N0dreGNQDrhyoaD b5X/CJwnoRxd0nuOYEAiICiYnNdDJMXxIERKUFuqFGupJsvOAyViDyiVULdnkwHbly YbGRaNZ498oAozrcxAx17eo6ffCbxTa4FsQR51Fk= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220831115258eucas1p2096c19867288ec5578b4199c5e2c62fc~Qa8olfodV3267932679eucas1p2W; Wed, 31 Aug 2022 11:52:58 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 36.80.07817.A9B4F036; Wed, 31 Aug 2022 12:52:58 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220831115257eucas1p20d37a01c51e42767860920a936255bd7~Qa8oCEOoU2649726497eucas1p2b; Wed, 31 Aug 2022 11:52:57 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220831115257eusmtrp14866fa61df5b58b1cf2cd02726e27927~Qa8oBIECS0765907659eusmtrp1L; Wed, 31 Aug 2022 11:52:57 +0000 (GMT) X-AuditID: cbfec7f4-8abff70000011e89-cf-630f4b9a8237 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 02.33.07473.99B4F036; Wed, 31 Aug 2022 12:52:57 +0100 (BST) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220831115257eusmtip106c11b8029e14f7219082ce264467265~Qa8nR2dEv1207712077eusmtip1R; Wed, 31 Aug 2022 11:52:57 +0000 (GMT) Message-ID: <9a425a51-9460-6c4d-e331-5cd5873f8a43@samsung.com> Date: Wed, 31 Aug 2022 13:52:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH] ARM: mmu: fix access to illegal address when using earlycon & memblock=debug Content-Language: en-US To: Victor Hassan , 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, allwinner-opensource-support@allwinnertech.com From: Marek Szyprowski In-Reply-To: <20220316023356.120595-1-victor@allwinnertech.com> Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrHKsWRmVeSWpSXmKPExsWy7djP87qzvPmTDXbfFbM49beX0eLnl/eM Fn8nHWO3mPJnOZPFpsfXWC0u75rDZnFo6l5Gi2/PTzFaXOqfyGSxedNUZovvP+ayWmy4/IDN gcfjVdszJo/L1y4ye/z+NYnRY9OqTjaPO9f2sHm8O3eO3WPzknqPWW372Dw+b5LzWL9lK1MA VxSXTUpqTmZZapG+XQJXRufMJ6wFX/grdvV1sDcwPuLpYuTkkBAwkTg+/z9TFyMXh5DACkaJ xR9nMUM4Xxgl+uZuZYdwPjNKTH/+hQ2m5dasP1Atyxkl3rztZYFwP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W372Dw+b5LzWL9lK1MA V5SeTVF+aUmqQkZ+cYmtUrShhZGeoaWFnpGJpZ6hsXmslZGpkr6dTUpqTmZZapG+XYJeRufM J6wFX/grdvV1sDcwPuLpYuTkkBAwkbg16w9TFyMXh5DAUkaJ+7+bmCASMhInpzWwQtjCEn+u dbFBFL1nlJjatpAZJMErYCfxsuchC4jNIqAqsfPaR1aIuKDEyZlPwOKiAskSSxrug8WFgewf jV1gNrOAuMStJ/PBNosIPGWUONZ4jA0iUSExY91BsGYhoAW7Tr4DW8YmYCjR9bYLrIZTwF7i 9rKFjBD1ZhJdW7ugbHmJ7W/nME9gFJqF5I5ZSPbNQtIyC0nLAkaWVYwiqaXFuem5xYZ6xYm5 xaV56XrJ+bmbGIGRve3Yz807GOe9+qh3iJGJg/EQowQHs5II7/dzPMlCvCmJlVWpRfnxRaU5 qcWHGE2BgTGRWUo0OR+YWvJK4g3NDEwNTcwsDUwtzYyVxHk9CzoShQTSE0tSs1NTC1KLYPqY ODilGpjMvY6xq2+8ai8ay7BaY1nOnOtXxfYyP7qYeCfhGLuhYrnkEuEF8d7durnRh2Ye3fTr lv/MdWc3Muzz4ebbaf2gPkONRXsab3E0T7LNvr8vfbl7t3tO+BLJJVlsr3fR66Gc4cOs944n r2nv5Pj623+2Tdlnm4v3vlzbE/3swNIFB8LM51wXNs/c3tLb5SUz+++2R26mHNYmJ+6xX74V OmHCjK+Sf9Luvm/jPBZl47ijSlHOf6aUq/lBdTNbfh+T6Kd/LMqPXJjeu3ujz834pAKTz8s+ Ky32Mug5aOEZszvOcKnZ89WbFc85aZ5OXRlZtCiflWH3raVCE1LEZA/3qy/2sFD8r3D++I8e nZTrKu5KLMUZiYZazEXFiQCm24zRdQMAAA== X-CMS-MailID: 20220831115257eucas1p20d37a01c51e42767860920a936255bd7 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220831115257eucas1p20d37a01c51e42767860920a936255bd7 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220831115257eucas1p20d37a01c51e42767860920a936255bd7 References: <20220316023356.120595-1-victor@allwinnertech.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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 -- Marek Szyprowski, PhD Samsung R&D Institute Poland