Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp709522pxy; Wed, 21 Apr 2021 13:01:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7W9r002Yn3yMPzcGxLZcrfF9+DCnF23r6j/yKIS9PxRacrq7rpw1f6ZpeF1lS4F/yPDNm X-Received: by 2002:a62:f84a:0:b029:245:17e4:bde2 with SMTP id c10-20020a62f84a0000b029024517e4bde2mr31085077pfm.64.1619035280819; Wed, 21 Apr 2021 13:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619035280; cv=none; d=google.com; s=arc-20160816; b=vLyOgxgfY5gxbN1jlLOjCPtbwVcgV1GAZg6mRk2lr78IUTNNMpXWZfTabSqmw1mKqI /87jQmE21k/Jdf9SDp08aRl6LefyiomSF7aR632w0aUx3mJ+9wGZtc9Z9lNM4pPfkDYt sqTdR9HK6s+SIrJulpfXw13P3EBI3lNz33GSzLGFlYji/eQ2wYqcxbVrBI5VclJ5GO6a fro3vVmwwUPave4K3i/GP5YP6hUhgMFyTNCSZG2j8iIBOaPBynUe+49rdkG5fJ3+LUni XkDvJmoAxDrBB0NCTb2aNq20RzoKeu6UCNz4EFQNsI3qXUFhToZsnxACLORVtjqARE9/ ZAfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=1MMJc9E2vJ4S7Mny58l5zqOl5ND0C+JpidbUw7b0wr8=; b=IObHiPGNStTMsd3pncHNKaHCv+obWnLrOgMJSQwPc7LZD6zDc8Fh/d+jHa25JYj43o m5S0MNSVplRXbQ3vvGiRlXGN2aJJVab02X0aQiJfg8QwQQLOeIOpr49RneEtuvZTFlxW tzRjo8Ml91EYlgkVMt17mzBm/yUj8xc8xaVOaQAJd1HgQ1SpL9pX00mlYju2MNKEzALA Y+pe2zZAAqP3c/bqUboIYTYmv4wc3/QxN/Nj0PEqQWXn6LZfpC7OpMLcn+0GdFZ1SM0R whDIZeW7TR+ADKArlxWXTiu6Ios+lGfmzOIOxR6+XADY3tnAPphzbWgzhHGHo0LgZ5mf AWRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hmCLQPuk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h1si512671plc.296.2021.04.21.13.01.01; Wed, 21 Apr 2021 13:01:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hmCLQPuk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235304AbhDUOej (ORCPT + 99 others); Wed, 21 Apr 2021 10:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243607AbhDUOeh (ORCPT ); Wed, 21 Apr 2021 10:34:37 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54E2DC06174A; Wed, 21 Apr 2021 07:34:04 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id s22so8915056pgk.6; Wed, 21 Apr 2021 07:34:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1MMJc9E2vJ4S7Mny58l5zqOl5ND0C+JpidbUw7b0wr8=; b=hmCLQPukuwX5xjaiFufvuWOBk/GDwoQezj8xLqvWrNJKbeXdhYEcx9oQOKRoQgN9VD O1ZpkhRTflPPxkWOsy3GiUNM9gcl0aypYx5HNwhsaG56YoSCEmUeEc4D1PqNoE2Hzjv7 t3Rzdx7S2zIx1OU6Lrq9zofN703C9q3CYsiAMnOLMYPbsqDsYn7BiXSb3irOPD1wCDLU rxIsiw63E4Q0jR0M7gfeob9kGUQmH1CwZZKE7QPyXUilwshoKeofozWas1Q/QDpgxumQ 1zpS8n03cBXQ3iPvump4FS51nouHFpO9NKPYmLWISCTk+BVe+L9Y3u0WTXIqScpU/oMf CmwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1MMJc9E2vJ4S7Mny58l5zqOl5ND0C+JpidbUw7b0wr8=; b=ngCJeapmzi62YN0qnnKIyoFM7KLGm313tqtlaU4yGORsNQSRBTMHLoQqncf68CfDCw uNHWYEteQ3ctyQ9Bo5Yjy21uPeEKbW5iHFj8PZ3vsAWucAYDM4PQpyaTeoEcN9VibIRW kW9HKXbPiRYsJpCXRe0RCAhQyh2CmXqCUfuodt5oldcqvuKAmswI7YEeaClaWXzz0j22 0XrlLIeYkxkCVDw3QvEaeZgEUdisGiAvZ8Kx9TFrNBTFYu0WcJZKfMEjSPLGxhdXEAj4 X5WgqTBB4Vd5iLqT1/k0lHrvUzAKGKT0+5HyO4mYKy/o+jmhahx4zHJyxRQRl7091PeT XUKA== X-Gm-Message-State: AOAM530j44crAyu4EqU1dQ1fv0AGAXPzHRazTVZXrAktsXQ+1IRqoPUj SdjyyzjjV7FMAI0HEuM3rL8= X-Received: by 2002:a17:90a:684d:: with SMTP id e13mr11225600pjm.161.1619015643726; Wed, 21 Apr 2021 07:34:03 -0700 (PDT) Received: from [10.230.29.202] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 14sm2072289pfi.145.2021.04.21.07.33.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Apr 2021 07:34:02 -0700 (PDT) Subject: Re: [v5.4 stable] arm: stm32: Regression observed on "no-map" reserved memory region To: Quentin Perret Cc: Ard Biesheuvel , Rob Herring , Alexandre TORGUE , Greg Kroah-Hartman , Sasha Levin , stable , Arnd Bergmann , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" , Nicolas Boichat , Stephen Boyd , KarimAllah Ahmed , Android Kernel Team , Architecture Mailman List , Frank Rowand , linux-arm-kernel References: <4a4734d6-49df-677b-71d3-b926c44d89a9@foss.st.com> <001f8550-b625-17d2-85a6-98a483557c70@foss.st.com> From: Florian Fainelli Message-ID: Date: Wed, 21 Apr 2021 07:33:52 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/21/2021 1:31 AM, Quentin Perret wrote: > On Tuesday 20 Apr 2021 at 09:33:56 (-0700), Florian Fainelli wrote: >> I do wonder as well, we have a 32MB "no-map" reserved memory region on >> our platforms located at 0xfe000000. Without the offending commit, >> /proc/iomem looks like this: >> >> 40000000-fdffefff : System RAM >> 40008000-40ffffff : Kernel code >> 41e00000-41ef1d77 : Kernel data >> 100000000-13fffffff : System RAM >> >> and with the patch applied, we have this: >> >> 40000000-fdffefff : System RAM >> 40008000-40ffffff : Kernel code >> 41e00000-41ef3db7 : Kernel data >> fdfff000-ffffffff : System RAM >> 100000000-13fffffff : System RAM >> >> so we can now see that the region 0xfe000000 - 0xfffffff is also cobbled >> up with the preceding region which is a mailbox between Linux and the >> secure monitor at 0xfdfff000 and of size 4KB. It seems like there is >> >> The memblock=debug outputs is also different: >> >> [ 0.000000] MEMBLOCK configuration: >> [ 0.000000] memory size = 0xfdfff000 reserved size = 0x7ce4d20d >> [ 0.000000] memory.cnt = 0x2 >> [ 0.000000] memory[0x0] [0x00000040000000-0x000000fdffefff], >> 0xbdfff000 bytes flags: 0x0 >> [ 0.000000] memory[0x1] [0x00000100000000-0x0000013fffffff], >> 0x40000000 bytes flags: 0x0 >> [ 0.000000] reserved.cnt = 0x6 >> [ 0.000000] reserved[0x0] [0x00000040003000-0x0000004000e494], >> 0xb495 bytes flags: 0x0 >> [ 0.000000] reserved[0x1] [0x00000040200000-0x00000041ef1d77], >> 0x1cf1d78 bytes flags: 0x0 >> [ 0.000000] reserved[0x2] [0x00000045000000-0x000000450fffff], >> 0x100000 bytes flags: 0x0 >> [ 0.000000] reserved[0x3] [0x00000047000000-0x0000004704ffff], >> 0x50000 bytes flags: 0x0 >> [ 0.000000] reserved[0x4] [0x000000c2c00000-0x000000fdbfffff], >> 0x3b000000 bytes flags: 0x0 >> [ 0.000000] reserved[0x5] [0x00000100000000-0x0000013fffffff], >> 0x40000000 bytes flags: 0x0 >> >> [ 0.000000] MEMBLOCK configuration: >> [ 0.000000] memory size = 0x100000000 reserved size = 0x7ca4f24d >> [ 0.000000] memory.cnt = 0x3 >> [ 0.000000] memory[0x0] [0x00000040000000-0x000000fdffefff], >> 0xbdfff000 bytes flags: 0x0 >> [ 0.000000] memory[0x1] [0x000000fdfff000-0x000000ffffffff], >> 0x2001000 bytes flags: 0x4 >> [ 0.000000] memory[0x2] [0x00000100000000-0x0000013fffffff], >> 0x40000000 bytes flags: 0x0 >> [ 0.000000] reserved.cnt = 0x6 >> [ 0.000000] reserved[0x0] [0x00000040003000-0x0000004000e494], >> 0xb495 bytes flags: 0x0 >> [ 0.000000] reserved[0x1] [0x00000040200000-0x00000041ef3db7], >> 0x1cf3db8 bytes flags: 0x0 >> [ 0.000000] reserved[0x2] [0x00000045000000-0x000000450fffff], >> 0x100000 bytes flags: 0x0 >> [ 0.000000] reserved[0x3] [0x00000047000000-0x0000004704ffff], >> 0x50000 bytes flags: 0x0 >> [ 0.000000] reserved[0x4] [0x000000c3000000-0x000000fdbfffff], >> 0x3ac00000 bytes flags: 0x0 >> [ 0.000000] reserved[0x5] [0x00000100000000-0x0000013fffffff], >> 0x40000000 bytes flags: 0x0 >> >> in the second case we can clearly see that the 32MB no-map region is now >> considered as usable RAM. >> >> Hope this helps. >> >>> >>> In any case, the mere fact that this causes a regression should be >>> sufficient justification to revert/withdraw it from v5.4, as I don't >>> see a reason why it was merged there in the first place. (It has no >>> fixes tag or cc:stable) >> >> Agreed, however that means we still need to find out whether a more >> recent kernel is also broken, I should be able to tell you that a little >> later. > > FWIW I did test this on Qemu before posting. With 5.12-rc8 and a 1MiB > no-map region at 0x80000000, I have the following: > > 40000000-7fffffff : System RAM > 40210000-417fffff : Kernel code > 41800000-41daffff : reserved > 41db0000-4210ffff : Kernel data > 48000000-48008fff : reserved > 80000000-800fffff : reserved > 80100000-13fffffff : System RAM > fa000000-ffffffff : reserved > 13b000000-13f5fffff : reserved > 13f6de000-13f77dfff : reserved > 13f77e000-13f77efff : reserved > 13f77f000-13f7dafff : reserved > 13f7dd000-13f7defff : reserved > 13f7df000-13f7dffff : reserved > 13f7e0000-13f7f3fff : reserved > 13f7f4000-13f7fdfff : reserved > 13f7fe000-13fffffff : reserved > > If I remove the 'no-map' qualifier from DT, I get this: > > 40000000-13fffffff : System RAM > 40210000-417fffff : Kernel code > 41800000-41daffff : reserved > 41db0000-4210ffff : Kernel data > 48000000-48008fff : reserved > 80000000-800fffff : reserved > fa000000-ffffffff : reserved > 13b000000-13f5fffff : reserved > 13f6de000-13f77dfff : reserved > 13f77e000-13f77efff : reserved > 13f77f000-13f7dafff : reserved > 13f7dd000-13f7defff : reserved > 13f7df000-13f7dffff : reserved > 13f7e0000-13f7f3fff : reserved > 13f7f4000-13f7fdfff : reserved > 13f7fe000-13fffffff : reserved > > So this does seem to be working fine on my setup. I'll try again with > 5.4 to see if I can repro. > > Also, 8a5a75e5e9e5 ("of/fdt: Make sure no-map does not remove already > reserved regions") looks more likely to cause the issue observed here, > but that shouldn't be silent. I get the following error message in dmesg > if I if place the no-map region on top of the kernel image: > > OF: fdt: Reserved memory: failed to reserve memory for node 'foobar@40210000': base 0x0000000040210000, size 1 MiB > > Is that triggering on your end? It is not, otherwise I would have noticed earlier, can you try the same thing that happens on my platform with a reserved region (without no-map) adjacent to a reserved region with 'no-map'? I will test different and newer kernels than 5.4 today to find out if this is still a problem with upstream. I could confirm that v4.9.259 also have this problem now. -- Florian