All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Amit Tomer <amittomer25@gmail.com>,
	Stefano Stabellini <sstabellini@kernel.org>
Cc: "wei.liu2@citrix.com" <wei.liu2@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@gmail.com>,
	Andre Przywara <andre.przywara@arm.com>,
	Jan Beulich <JBeulich@suse.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"ian.jackson@citrix.com" <ian.jackson@citrix.com>,
	nd <nd@arm.com>
Subject: Re: [PATCH 0/6] iomem cacheability
Date: Fri, 8 Mar 2019 16:37:05 +0000	[thread overview]
Message-ID: <b293d89c-9ed1-2033-44e5-227643ae1b0c@arm.com> (raw)
In-Reply-To: <CABHD4K-z-x=3joJWcOb_x9m7zsjzhskDQweNBr+paLS=PFEY9Q@mail.gmail.com>

Hi,

On 3/8/19 10:10 AM, Amit Tomer wrote:
>> Yes, you are right. I made a couple of quick fixes for this issue and
>> another issue raised by Julien during review (the usage of p2m_ram_t).
>> Amit, if you would like to give it a try I have a work-in-progress
>> branch with the fixes here:
> 
> We did try new branch with new fixes but we see some other crash now.
> 
> XEN) Loading kernel from boot module @ 000000007a000000
> (XEN) Allocating 1:1 mappings totalling 2048MB for dom0:
> (XEN) No bank has been allocated below 4GB.
> (XEN) BANK[0] 0x00000500000000-0x00000540000000 (1024MB)
> (XEN) BANK[1] 0x00000600000000-0x00000640000000 (1024MB)
> (XEN) Grant table range: 0x0000073fe00000-0x0000073fe40000
> (XEN) Allocating PPI 16 for event channel interrupt
> (XEN) Loading zImage from 000000007a000000 to 0000000500080000-0000000501880000
> (XEN) Loading dom0 DTB to 0x0000000508000000-0x00000005080117d0
> (XEN) Initial low memory virq threshold set at 0x4000 pages.
> (XEN) Scrubbing free RAM on in background
> (XEN) Std. Loglevel: All
> (XEN) Guest Loglevel: All
> (XEN) *** Serial input -> DOM0 (type 'CTRL-a' three times to switch
> input to Xen)
> (XEN) Freed 292kB init memory.
> [    0.000000] Booting Linux on physical CPU 0x0
> [    0.000000] Boot CPU: AArch64 Processor [411fd073]
> [    0.000000] Machine model: Renesas H3ULCB board based on r8a7795 ES2.0+
> [    0.000000] earlycon: xenboot0 at I/O port 0x0 (options '')
> [    0.000000] bootconsole [xenboot0] enabled
> [    0.000000] Xen 4.12 support found
> [    0.000000] efi: Getting EFI parameters from FDT:
> [    0.000000] efi: UEFI not found.
> [    0.000000] Reserved memory: created CMA memory pool at
> 0x0000000057000000, size 400 MiB
> [    0.000000] OF: reserved mem: initialized node linux,cma@57000000,
> compatible id shared-dma-pool
> [    0.000000] Reserved memory: created CMA memory pool at
> 0x0000000070000000, size 256 MiB
> [    0.000000] OF: reserved mem: initialized node
> linux,multimedia@70000000, compatible id shared-dma-pool
> [    0.000000] cma: dma_contiguous_reserve(limit 100000000)
> [    0.000000] NUMA: No NUMA configuration found
> [    0.000000] NUMA: Faking a node at [mem
> 0x0000000000000000-0x000000063fffffff]
> [    0.000000] NUMA: NODE_DATA [mem 0x63ff90c00-0x63ff926ff]
> [    0.000000] Zone ranges:
> [    0.000000]   DMA      [mem 0x0000000057000000-0x00000000ffffffff]
> [    0.000000]   Normal   [mem 0x0000000100000000-0x000000063fffffff]
> [    0.000000] Movable zone start for each node
> [    0.000000] Early memory node ranges
> [    0.000000]   node   0: [mem 0x0000000057000000-0x000000007fffffff]
> [    0.000000]   node   0: [mem 0x0000000500000000-0x000000053fffffff]
> [    0.000000]   node   0: [mem 0x0000000600000000-0x000000063fffffff]
> [    0.000000] Initmem setup node 0 [mem 0x0000000057000000-0x000000063fffffff]
> [    0.000000] On node 0 totalpages: 692224
> [    0.000000]   DMA zone: 2624 pages used for memmap
> [    0.000000]   DMA zone: 0 pages reserved
> [    0.000000]   DMA zone: 167936 pages, LIFO batch:31
> [    0.000000]   Normal zone: 8192 pages used for memmap
> [    0.000000]   Normal zone: 524288 pages, LIFO batch:31
> [    0.000000] bootmem alloc of 64 bytes failed!
> [    0.000000] Kernel panic - not syncing: Out of memory
> [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted
> 4.14.75-ltsi-yocto-standard #3
> [    0.000000] Hardware name: Renesas H3ULCB board based on r8a7795 ES2.0+ (DT)
> [    0.000000] Call trace:
> [    0.000000] [<ffff000008089ae8>] dump_backtrace+0x0/0x3c0
> [    0.000000] [<ffff000008089ebc>] show_stack+0x14/0x20
> [    0.000000] [<ffff000008af20e8>] dump_stack+0x9c/0xbc
> [    0.000000] [<ffff0000080ce770>] panic+0x11c/0x28c
> [    0.000000] [<ffff0000090478fc>] free_bootmem_late+0x0/0x7c
> [    0.000000] [<ffff000009047d90>] __alloc_bootmem_low+0x2c/0x38
> [    0.000000] [<ffff0000090329fc>] setup_arch+0x258/0x4d8
> [    0.000000] [<ffff00000903083c>] start_kernel+0x64/0x3ac
> [    0.000000] ---[ end Kernel panic - not syncing: Out of memory

Interesting, the function __alloc_bootmem_low will try to allocate low 
memory. The limit for low memory is based on the physical DMA address 
limit (see ARCH_LOW_ADDRESS_LIMIT).

I guess you have CONFIG_ZONE_DMA32 (was renamed from CONFIG_ZONE_DMA is 
recent Linux) set. So the DMA limit will be computed by max_zone_dma_phys().

In your setup, if I am not mistaken, the limit will be 4GB. However, you 
have no available memory below 4GB because it is used for 
reserved-memory. So it makes sense for __alloc_bootmem_low to fail.

In your previous setup (i.e without reserved memory), all the memory was 
probably still above 4GB. In that case max_zone_dma_phys() will return 
an higher "lower" limit. So __alloc_bootmem_low is going to succeed.

AFAICT, this is probably a Linux bug. Now the question is whether 
__alloc_bootmem_low should be switch to alloc_bootmem or we need to fix 
the implementation of the function. Note that recent Linux (5.0 and 
onwards) have switch to memblock API, yet I think the issue is still here.

Fixing Linux is probably a good idea, but this means that upgrade of Xen 
may break Linux boot. In one hand, reserved-memory never worked with Xen 
(user have to manually disable it). So this is not a regression. On the 
other hand, a user will now need to upgrade their Linux (could be 
difficult if tie to a BSP kernel) or apply a fix (see above).

It might be possible to rework Dom0 memory allocation to limit the 
damage or even re-order the binary in memory. Amit, could you post the 
full Xen log with earlyprintk enabled?

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-03-08 16:37 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 23:06 [PATCH 0/6] iomem cacheability Stefano Stabellini
2019-02-26 23:07 ` [PATCH 1/6] xen: extend XEN_DOMCTL_memory_mapping to handle cacheability Stefano Stabellini
2019-02-26 23:18   ` Julien Grall
2019-04-20  0:02     ` Stefano Stabellini
2019-04-20  0:02       ` [Xen-devel] " Stefano Stabellini
2019-04-21 17:32       ` Julien Grall
2019-04-21 17:32         ` [Xen-devel] " Julien Grall
2019-04-22 21:59         ` Stefano Stabellini
2019-04-22 21:59           ` [Xen-devel] " Stefano Stabellini
2019-04-24 10:42           ` Julien Grall
2019-04-24 10:42             ` [Xen-devel] " Julien Grall
2019-02-27 10:34   ` Jan Beulich
2019-04-17 21:12     ` Stefano Stabellini
2019-04-17 21:12       ` [Xen-devel] " Stefano Stabellini
2019-04-17 21:25       ` Julien Grall
2019-04-17 21:25         ` [Xen-devel] " Julien Grall
2019-04-17 21:55         ` Stefano Stabellini
2019-04-17 21:55           ` [Xen-devel] " Stefano Stabellini
2019-04-25 10:41       ` Jan Beulich
2019-04-25 10:41         ` [Xen-devel] " Jan Beulich
2019-04-25 22:31         ` Stefano Stabellini
2019-04-25 22:31           ` [Xen-devel] " Stefano Stabellini
2019-04-26  7:12           ` Jan Beulich
2019-04-26  7:12             ` [Xen-devel] " Jan Beulich
2019-02-27 19:28   ` Julien Grall
2019-04-19 23:20     ` Stefano Stabellini
2019-04-19 23:20       ` [Xen-devel] " Stefano Stabellini
2019-04-21 17:14       ` Julien Grall
2019-04-21 17:14         ` [Xen-devel] " Julien Grall
2019-04-22 17:33         ` Stefano Stabellini
2019-04-22 17:33           ` [Xen-devel] " Stefano Stabellini
2019-04-22 17:42           ` Julien Grall
2019-04-22 17:42             ` [Xen-devel] " Julien Grall
2019-02-27 21:02   ` Julien Grall
2019-02-26 23:07 ` [PATCH 2/6] libxc: xc_domain_memory_mapping, " Stefano Stabellini
2019-02-26 23:07 ` [PATCH 3/6] libxl/xl: add cacheability option to iomem Stefano Stabellini
2019-02-27 20:02   ` Julien Grall
2019-04-19 23:13     ` Stefano Stabellini
2019-04-19 23:13       ` [Xen-devel] " Stefano Stabellini
2019-02-26 23:07 ` [PATCH 4/6] xen/arm: keep track of reserved-memory regions Stefano Stabellini
2019-02-28 14:38   ` Julien Grall
2019-02-26 23:07 ` [PATCH 5/6] xen/arm: map reserved-memory regions as normal memory in dom0 Stefano Stabellini
2019-02-26 23:45   ` Julien Grall
2019-04-22 22:42     ` Stefano Stabellini
2019-04-22 22:42       ` [Xen-devel] " Stefano Stabellini
2019-04-23  8:09       ` Julien Grall
2019-04-23  8:09         ` [Xen-devel] " Julien Grall
2019-04-23 17:32         ` Stefano Stabellini
2019-04-23 17:32           ` [Xen-devel] " Stefano Stabellini
2019-04-23 18:37           ` Julien Grall
2019-04-23 18:37             ` [Xen-devel] " Julien Grall
2019-04-23 21:34             ` Stefano Stabellini
2019-04-23 21:34               ` [Xen-devel] " Stefano Stabellini
2019-02-26 23:07 ` [PATCH 6/6] xen/docs: how to map a page between dom0 and domU using iomem Stefano Stabellini
2019-03-03 17:20 ` [PATCH 0/6] iomem cacheability Amit Tomer
2019-03-05 21:22   ` Stefano Stabellini
2019-03-05 22:45     ` Julien Grall
2019-03-06 11:46       ` Amit Tomer
2019-03-06 22:42         ` Stefano Stabellini
2019-03-06 22:59           ` Julien Grall
2019-03-07  8:42             ` Amit Tomer
2019-03-07 10:04               ` Julien Grall
2019-03-07 21:24                 ` Stefano Stabellini
2019-03-08 10:10                   ` Amit Tomer
2019-03-08 16:37                     ` Julien Grall [this message]
2019-03-08 17:44                       ` Amit Tomer
2019-03-06 11:30     ` Amit Tomer

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=b293d89c-9ed1-2033-44e5-227643ae1b0c@arm.com \
    --to=julien.grall@arm.com \
    --cc=JBeulich@suse.com \
    --cc=amittomer25@gmail.com \
    --cc=andre.przywara@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=julien.grall@gmail.com \
    --cc=nd@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.