From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: "David Hildenbrand" <david@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Thiner Logoer" <logoerthiner1@163.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
"Jagannathan Raman" <jag.raman@oracle.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Ani Sinha" <anisinha@redhat.com>,
"Xiao Guangrong" <xiaoguangrong.eric@gmail.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Greg Kurz" <groug@kaod.org>, "Eric Blake" <eblake@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>
Subject: [PATCH v4 00/11] memory-backend-file related improvements and VM templating support
Date: Wed, 6 Sep 2023 14:04:52 +0200 [thread overview]
Message-ID: <20230906120503.359863-1-david@redhat.com> (raw)
If there are no more comments, I'll queue this myself soon.
---
This is the result of the previous discussion of:
* "[PATCH v2] softmmu/physmem: try opening file readonly before failure
in file_ram_open" [1]
* "[PATCH v1 0/3] softmmu/physmem: file_ram_open() readonly
improvements" [2]
After looking into various ways to avoid a new parameter for
memory-backend-file to cleanly support VM templating with R/O files, I
concluded that it might be easier and cleaner to hust have a new parameter.
The alternatives all had their own problems.
Looking back, we could have designed the "readonly=on/off" parameter
slightly differently.
So this series adds a new "rom=on/off/auto" option and wires it up
internally. It uses new internal RAM flags to improve qemu_ram_remap() and
ram_block_discard_range().
Further, improve file_ram_open() with readonly=on and update+add some
documentation.
While working on this and testing some configurations, I realized that
an NVDIMM with label data on ROM does not work as expected (QEMU crashes).
Fix included as patch #1.
v3 -> v4:
- "machine: Improve error message when using default RAM backend id"
-> Use error_append_hint()
v2 -> v3:
- "softmmu/physmem: Distinguish between file access mode and mmap
protection"
-> Use !!(ram_flags & RAM_READONLY);
- "backends/hostmem-file: Add "rom" property to support VM templating with
R/O files"
-> Improved documentation in qapi/qom.json and qemu-options.hx
- "docs: Start documenting VM templating"
-> Create proper RST and link it
-> Add "Security Alert" section
-> Add MAINTAINER entry
- "softmmu/physmem: Hint that "readonly=on,rom=off" exists when opening
file R/W for private mapping fails"
-> Added
- "machine: Improve error message when using default RAM backend id"
-> Added
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Thiner Logoer <logoerthiner1@163.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Cc: Jagannathan Raman <jag.raman@oracle.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Ani Sinha <anisinha@redhat.com>
Cc: Xiao Guangrong <xiaoguangrong.eric@gmail.com>
Cc: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: Greg Kurz <groug@kaod.org>
Cc: Eric Blake <eblake@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Eduardo Habkost <eduardo@habkost.net>
[1] https://lkml.kernel.org/r/20230726145912.88545-1-logoerthiner1@163.com
[2] https://lkml.kernel.org/r/20230807190736.572665-1-david@redhat.com
David Hildenbrand (11):
nvdimm: Reject writing label data to ROM instead of crashing QEMU
softmmu/physmem: Distinguish between file access mode and mmap
protection
backends/hostmem-file: Add "rom" property to support VM templating
with R/O files
softmmu/physmem: Remap with proper protection in qemu_ram_remap()
softmmu/physmem: Bail out early in ram_block_discard_range() with
readonly files
softmmu/physmem: Fail creation of new files in file_ram_open() with
readonly=true
softmmu/physmem: Never return directories from file_ram_open()
docs: Don't mention "-mem-path" in multi-process.rst
docs: Start documenting VM templating
softmmu/physmem: Hint that "readonly=on,rom=off" exists when opening
file R/W for private mapping fails
machine: Improve error message when using default RAM backend id
MAINTAINERS | 1 +
backends/hostmem-file.c | 61 ++++++++++++++++-
docs/devel/multi-process.rst | 5 +-
docs/system/index.rst | 1 +
docs/system/vm-templating.rst | 125 ++++++++++++++++++++++++++++++++++
hw/acpi/nvdimm.c | 11 ++-
hw/core/machine.c | 11 ++-
hw/mem/nvdimm.c | 10 ++-
hw/ppc/spapr_nvdimm.c | 3 +-
include/exec/memory.h | 14 ++--
include/exec/ram_addr.h | 8 +--
include/hw/mem/nvdimm.h | 6 ++
qapi/qom.json | 17 ++++-
qemu-options.hx | 16 ++++-
softmmu/memory.c | 8 +--
softmmu/physmem.c | 93 +++++++++++++++++++------
16 files changed, 341 insertions(+), 49 deletions(-)
create mode 100644 docs/system/vm-templating.rst
--
2.41.0
next reply other threads:[~2023-09-06 12:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 12:04 David Hildenbrand [this message]
2023-09-06 12:04 ` [PATCH v4 01/11] nvdimm: Reject writing label data to ROM instead of crashing QEMU David Hildenbrand
2023-09-06 12:04 ` [PATCH v4 02/11] softmmu/physmem: Distinguish between file access mode and mmap protection David Hildenbrand
2023-09-06 12:04 ` [PATCH v4 03/11] backends/hostmem-file: Add "rom" property to support VM templating with R/O files David Hildenbrand
2023-09-06 12:04 ` [PATCH v4 04/11] softmmu/physmem: Remap with proper protection in qemu_ram_remap() David Hildenbrand
2023-09-06 12:04 ` [PATCH v4 05/11] softmmu/physmem: Bail out early in ram_block_discard_range() with readonly files David Hildenbrand
2023-09-06 12:04 ` [PATCH v4 06/11] softmmu/physmem: Fail creation of new files in file_ram_open() with readonly=true David Hildenbrand
2023-09-06 12:04 ` [PATCH v4 07/11] softmmu/physmem: Never return directories from file_ram_open() David Hildenbrand
2023-09-07 10:31 ` Mario Casquero
2023-09-07 10:35 ` David Hildenbrand
2023-09-06 12:05 ` [PATCH v4 08/11] docs: Don't mention "-mem-path" in multi-process.rst David Hildenbrand
2023-09-06 12:05 ` [PATCH v4 09/11] docs: Start documenting VM templating David Hildenbrand
2023-09-06 12:05 ` [PATCH v4 10/11] softmmu/physmem: Hint that "readonly=on, rom=off" exists when opening file R/W for private mapping fails David Hildenbrand
2023-09-06 12:05 ` [PATCH v4 11/11] machine: Improve error message when using default RAM backend id David Hildenbrand
2023-09-11 7:41 ` [PATCH v4 00/11] memory-backend-file related improvements and VM templating support David Hildenbrand
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=20230906120503.359863-1-david@redhat.com \
--to=david@redhat.com \
--cc=anisinha@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=danielhb413@gmail.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=elena.ufimtseva@oracle.com \
--cc=groug@kaod.org \
--cc=imammedo@redhat.com \
--cc=jag.raman@oracle.com \
--cc=logoerthiner1@163.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=xiaoguangrong.eric@gmail.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).