[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RESEND v6 01/36] memory: alloc RAM from file at offset
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH RESEND v6 01/36] memory: alloc RAM from file at offset |
Date: |
Wed, 13 May 2020 09:40:42 +0100 |
On Tue, May 12, 2020 at 07:56:33AM -0400, Jag Raman wrote:
>
>
> > On May 12, 2020, at 4:48 AM, Daniel P. Berrangé <address@hidden> wrote:
> >
> > On Wed, Apr 22, 2020 at 09:13:36PM -0700, address@hidden wrote:
> >> From: Jagannathan Raman <address@hidden>
> >>
> >> Allow RAM MemoryRegion to be created from an offset in a file, instead
> >> of allocating at offset of 0 by default. This is needed to synchronize
> >> RAM between QEMU & remote process.
> >
> > Can you elaborate on why remote processes require the RAM to be offset
> > from zero ?
>
> Hi Daniel,
>
> As it turns out, the RAM is scattered across the physical address space
> (system_memory) of QEMU. Therefore, the system memory is composed
> of multiple sections of RAM, and some sections start at a non-zero RAM
> offset.
>
> As a result, the remote process needs the ability to map these RAM
> sections into system_memory.
To explain a bit more, my understanding is that the offset is
specifically for mmap(2). As Jag alluded to, multiple sections can use a
single backing RAM file. These sections have different offsets in the
file.
Jag, maybe you can include a concrete explanation like the following in
the commit description:
Launch QEMU like this:
qemu-system-x86_64 -mem-path /dev/shm -m 8G
There is only one RAM file descriptor:
$ cat /proc/$(pidof qemu)/fd
...
lrwx------. 1 stefanha stefanha 64 May 13 09:34 19 ->
'/dev/shm/qemu_back_mem.pc.ram.7YAlqn (deleted)'
But the memory tree shows that single file is split into multiple ranges
of guest physical address space:
(qemu) info mtree
memory-region: system
0000000000000000-ffffffffffffffff (prio 0, i/o): system
0000000000000000-00000000bfffffff (prio 0, i/o): alias ram-below-4g @pc.ram
0000000000000000-00000000bfffffff
...
0000000100000000-000000023fffffff (prio 0, i/o): alias ram-above-4g @pc.ram
00000000c0000000-00000001ffffffff
This means QEMU needs to send two regions to the remote device process.
They both mmap the same file but from different starting file offsets.
Stefan
signature.asc
Description: PGP signature