Skip to content

memory-backend-file related improvements and VM templating support

David Hildenbrand qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest11 patches 3 repliesIn review
  2. v311 patches 18 repliesSuperseded
  3. v29 patches 15 repliesSuperseded

Changes in v4 from the cover letter

- "machine: Improve error message when using default RAM backend id" -> Use error_append_hint()

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11nvdimm: Reject writing label data to ROM instead of crashing QEMUhw/acpi/nvdimm.c hw/mem/nvdimm.c hw/ppc/spapr_nvdimm.c +1 more+23 -70 replies
2/11softmmu/physmem: Distinguish between file access mode and mmap protectionbackends/hostmem-file.c include/exec/memory.h include/exec/ram_addr.h +2 more+30 -250 replies
3/11backends/hostmem-file: Add "rom" property to support VM templating with R/O filesbackends/hostmem-file.c qapi/qom.json qemu-options.hx+89 -30 replies
4/11softmmu/physmem: Remap with proper protection in qemu_ram_remap()softmmu/physmem.c+6 -40 replies
5/11softmmu/physmem: Bail out early in ram_block_discard_range() with readonly filessoftmmu/physmem.c+10 -00 replies
6/11softmmu/physmem: Fail creation of new files in file_ram_open() with readonly=truesoftmmu/physmem.c+9 -70 replies
7/11softmmu/physmem: Never return directories from file_ram_open()softmmu/physmem.c+19 -02 replies
8/11docs: Don't mention "-mem-path" in multi-process.rstdocs/devel/multi-process.rst+3 -20 replies
9/11docs: Start documenting VM templatingMAINTAINERS docs/system/index.rst docs/system/vm-templating.rst+127 -00 replies
10/11softmmu/physmem: Hint that "readonly=on, rom=off" exists when opening file R/W for private mapping failssoftmmu/physmem.c+19 -00 replies
11/11machine: Improve error message when using default RAM backend idhw/core/machine.c+8 -30 replies

Reviews trailers per patch

9 of 11 patches have a Reviewed-by or Acked-by.

PatchStefan HajnocziPeter XuPhilippe Mathieu-DaudéMario CasqueroMarkus Armbruster
1/11R-b
2/11A-b
3/11A-b
4/11R-b R-b
5/11R-b
6/11A-b
7/11R-b T-b
8/11
9/11R-b
10/11
11/11R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/11] memory-backend-file related improvements and VM templating support

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 <[email protected]>
Cc Peter Xu <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Thiner Logoer <[email protected]>
Cc "Philippe Mathieu-Daudé" <[email protected]>
Cc Daniel P. Berrangé <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc Elena Ufimtseva <[email protected]>
Cc Jagannathan Raman <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Cc Ani Sinha <[email protected]>
Cc Xiao Guangrong <[email protected]>
Cc Daniel Henrique Barboza <[email protected]>
Cc Greg Kurz <[email protected]>
Cc Eric Blake <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc "Daniel P. Berrangé" <[email protected]>
Cc Eduardo Habkost <[email protected]>

[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]

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
Signature · 1 line
2.41.0