linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Larsson <andreas@gaisler.com>
To: Mike Rapoport <rppt@linux.ibm.com>
Cc: Sparc kernel list <sparclinux@vger.kernel.org>,
	linux-mm@kvack.org, Mike Rapoport <rppt@linux.vnet.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Sam Ravnborg <sam@ravnborg.org>, Michal Hocko <mhocko@kernel.org>
Subject: Re: sparc32: boot fails with > 256 MB memory after switch to NO_BOOTMEM
Date: Thu, 28 Jan 2021 12:05:28 +0100	[thread overview]
Message-ID: <fd127ef4-7890-8274-7642-c8affcd5b384@gaisler.com> (raw)
In-Reply-To: <20210128093541.GC299309@linux.ibm.com>

On 2021-01-28 10:35, Mike Rapoport wrote:
> On Wed, Jan 27, 2021 at 04:03:00PM +0100, Andreas Larsson wrote:
>>
>>
>> Commit cca079ef8ac29a7c02192d2bad2ffe4c0c5ffdd0 makes sparc32 use
>> memblocks instead of the previous bootmem solution. Unfortunately, due
>> to this:
>>
>> #define PAGE_OFFSET  0xf0000000
>> #define __va(x)	     ((void *)((unsigned long) (x) - phys_base +
>> PAGE_OFFSET))
>> #define phys_to_virt __va
>>
>> it makes physical addresses >= 0x10000000 past phys_base wrap around the
>> 32-bit memory space when converted to virtual addresses, e.g. in
>> memblock_alloc_try_nid. Physical memory exactly 0x10000000 past
>> phys_base is returned as an unintended NULL pointer, leading to a panic
>> in my boot when percpu memory allocation fails due to it.
>>
>> Unfortunately I have had 256 MB memory or less in a lot of my testing,
>> so this old one has slipped by me.
>>
>> Does anyone has any ideas or pointers on how to resolve this?
> 
> I think the simplest way to work around this is to limit early allocations
> to 256M with addition of
> 
> 	memblock_set_current_limit(SZ_256M);
>   
> somewhere at setup_arch().
> 
> The page allocator will anyway see the entire memory, so I cannot think of
> any downside here.

That works like a charm! Thank you! I'll submit a patch.

-- 
Andreas Larsson
Cobham Gaisler




      reply	other threads:[~2021-01-28 11:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27 15:03 Andreas Larsson
2021-01-28  9:35 ` Mike Rapoport
2021-01-28 11:05   ` Andreas Larsson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd127ef4-7890-8274-7642-c8affcd5b384@gaisler.com \
    --to=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=rppt@linux.ibm.com \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox