From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
Sergio Lopez <slp@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Julio Montes <julio.montes@intel.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 1/2] elf-ops.h: Map into memory the ELF to load
Date: Tue, 23 Jul 2019 11:49:13 +0200 [thread overview]
Message-ID: <a4ec2c49-7b21-26bf-42a0-61427539d5d2@redhat.com> (raw)
In-Reply-To: <20190723094241.7znxmk3wa6gti6tr@steredhat>
On 23/07/19 11:42, Stefano Garzarella wrote:
> "If writable is TRUE, the mapped buffer may be modified, otherwise it is an
> error to modify the mapped buffer. Modifications to the buffer are not visible
> to other processes mapping the same file, and are not written back to the file."
>
> I don't know what "error" means, but reading the second part I thought
> the changes in that case were only visible at the current process.
My reading would be that the second part applies to the writable==TRUE
case. In fact, the glib source code agrees:
file->contents = (gchar *) mmap (NULL, file->length,
writable ? PROT_READ|PROT_WRITE : PROT_READ,
MAP_PRIVATE, fd, 0);
meaning that we could after all just use writable == true.
Paolo
> I'll test it to understand better the behavior. If we can't touch it, then we
> have to make a copy in these cases.
>
>> (We can't get out of this by just passing writable=true, because
>> we definitely don't want to be writing back to the underlying file.)
> Yes, I agree.
next prev parent reply other threads:[~2019-07-23 9:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-23 9:07 [Qemu-devel] [PATCH 0/2] pc: mmap kernel (ELF image) and initrd Stefano Garzarella
2019-07-23 9:07 ` [Qemu-devel] [PATCH 1/2] elf-ops.h: Map into memory the ELF to load Stefano Garzarella
2019-07-23 9:32 ` Peter Maydell
2019-07-23 9:42 ` Stefano Garzarella
2019-07-23 9:49 ` Paolo Bonzini [this message]
2019-07-23 10:10 ` Stefano Garzarella
2019-07-23 9:50 ` Peter Maydell
2019-07-23 10:12 ` Stefano Garzarella
2019-07-23 9:07 ` [Qemu-devel] [PATCH 2/2] hw/i386/pc: Map into memory the initrd Stefano Garzarella
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=a4ec2c49-7b21-26bf-42a0-61427539d5d2@redhat.com \
--to=pbonzini@redhat.com \
--cc=ehabkost@redhat.com \
--cc=julio.montes@intel.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=sgarzare@redhat.com \
--cc=slp@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).