From: David Hildenbrand <david@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Peter Xu" <peterx@redhat.com>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Thiner Logoer" <logoerthiner1@163.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v1 1/3] softmmu/physmem: fallback to opening guest RAM file as readonly in a MAP_PRIVATE mapping
Date: Thu, 17 Aug 2023 15:45:38 +0200 [thread overview]
Message-ID: <77c36463-e669-c6e7-77b6-f49a9b67aa5a@redhat.com> (raw)
In-Reply-To: <ZN4j1/EpXKTT99BB@redhat.com>
On 17.08.23 15:42, Daniel P. Berrangé wrote:
> On Thu, Aug 10, 2023 at 04:19:45PM +0200, David Hildenbrand wrote:
>>>> Most importantly, we won't be corrupting/touching the original file in any
>>>> case, because it is R/O.
>>>>
>>>> If we really want to be careful, we could clue that behavior to compat
>>>> machines. I'm not really sure yet if we really have to go down that path.
>>>>
>>>> Any other alternatives? I'd like to avoid new flags where not really
>>>> required.
>>>
>>> I was just thinking of a new flag. :) So have you already discussed that
>>> possibility and decided that not a good idea?
>>
>> Not really. I was briefly playing with that idea but already struggled to
>> come up with a reasonable name :)
>>
>> Less toggles and just have it working nice, if possible.
>
> IMHO having a new flag is desirable, because it is directly
> expressing the desired deployment scenario, such tat we get
> good error reporting upon deployment mistakes, while at the
> same time allowing the readonly usage.
>
>>> The root issue to me here is we actually have two resources (memory map of
>>> the process, and the file) but we only have one way to describe the
>>> permissions upon the two objects. I'd think it makes a lot more sense if a
>>> new flag is added, when there's a need to differentiate the two.
>>>
>>> Consider if you see a bunch of qemu instances with:
>>>
>>> -mem-path $RAM_FILE
>>>
>>> On the same host, which can be as weird as it could be to me.. At least
>>> '-mem-path' looks still like a way to exclusively own a ram file for an
>>> instance. I hesitate the new fallback can confuse people too, while that's
>>> so far not the major use case.
>>
>> Once I learned that this is not a MAP_SHARED mapping, I was extremely
>> confused. For example, vhost-user with "-mem-path" will absolutely not work
>> with "-mem-path", even though the documentation explicitly spells that out
>> (I still have to send a patch to fix that).
>>
>> I guess "-mem-path" was primarily only used to consume hugetlb. Even for
>> tmpfs it will already result in a double memory consumption, just like when
>> using -memory-backend-memfd,share=no.
>>
>> I guess deprecating it was the right decision.
>
> Regardless of whether its deprecated or not, I think its fine to just
> say people need to use the more verbose memory-backend-file syntax
> if they want to use an unusual deployment configuration where there is
> a readonly backing file.
>
>>> Nobody may really rely on any existing behavior of the failure, but
>>> changing existing behavior is just always not wanted. The guideline here
>>> to me is: whether we want existing "-mem-path XXX" users to start using the
>>> fallback in general? If it's "no", then maybe it implies a new flag is
>>> better?
>>
>> I think we have the following options (there might be more)
>>
>> 1) This patch.
>>
>> 2) New flag for memory-backend-file. We already have "readonly" and
>> "share=". I'm having a hard time coming up with a good name that really
>> describes the subtle difference.
>>
>> 3) Glue behavior to the QEMU machine
>>
>>
>> For 3), one option would be to always open a COW file readonly (as Thiner
>> originally proposed). We could leave "-mem-path" behavior alone and only
>> change memory-backend-file semantics. If the COW file does *not* exist yet,
>> we would refuse to create the file like patch 2+3 do. Therefore, no
>> ftruncate() errors, and fallocate() errors would always happen.
>
> I'm for (2).
(2) in the form we discussed here is wrong because "readonly" already
expresses "open this file readonly", not anything else.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-08-17 13:46 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 19:07 [PATCH v1 0/3] softmmu/physmem: file_ram_open() readonly improvements David Hildenbrand
2023-08-07 19:07 ` [PATCH v1 1/3] softmmu/physmem: fallback to opening guest RAM file as readonly in a MAP_PRIVATE mapping David Hildenbrand
2023-08-08 21:01 ` Peter Xu
2023-08-09 5:39 ` ThinerLogoer
2023-08-09 9:20 ` David Hildenbrand
2023-08-09 15:15 ` Peter Xu
2023-08-10 14:19 ` David Hildenbrand
2023-08-10 17:06 ` ThinerLogoer
2023-08-10 21:24 ` Peter Xu
2023-08-11 5:49 ` ThinerLogoer
2023-08-11 14:31 ` Peter Xu
2023-08-12 6:21 ` ThinerLogoer
2023-08-22 13:35 ` David Hildenbrand
2023-08-11 19:00 ` David Hildenbrand
2023-08-12 5:18 ` ThinerLogoer
2023-08-17 9:07 ` David Hildenbrand
2023-08-17 14:30 ` David Hildenbrand
2023-08-17 14:37 ` Daniel P. Berrangé
2023-08-17 14:37 ` David Hildenbrand
2023-08-17 14:45 ` Daniel P. Berrangé
2023-08-17 14:47 ` David Hildenbrand
2023-08-17 14:41 ` Peter Xu
2023-08-17 15:02 ` David Hildenbrand
2023-08-17 15:13 ` Stefan Hajnoczi
2023-08-17 15:15 ` David Hildenbrand
2023-08-17 15:25 ` David Hildenbrand
2023-08-17 15:31 ` Peter Xu
2023-08-17 15:43 ` David Hildenbrand
2023-08-17 13:46 ` Daniel P. Berrangé
2023-08-17 13:48 ` David Hildenbrand
2023-08-11 14:59 ` David Hildenbrand
2023-08-11 15:26 ` David Hildenbrand
2023-08-11 16:16 ` Peter Xu
2023-08-11 16:17 ` David Hildenbrand
2023-08-11 16:22 ` Peter Xu
2023-08-11 16:25 ` David Hildenbrand
2023-08-11 16:54 ` Peter Xu
2023-08-11 17:39 ` David Hildenbrand
2023-08-11 21:07 ` Peter Xu
2023-08-21 12:20 ` Igor Mammedov
2023-08-11 15:47 ` Peter Xu
2023-08-17 13:42 ` Daniel P. Berrangé
2023-08-17 13:45 ` David Hildenbrand [this message]
2023-08-17 13:37 ` Daniel P. Berrangé
2023-08-17 13:44 ` David Hildenbrand
2023-08-07 19:07 ` [PATCH v1 2/3] softmmu/physmem: fail creation of new files in file_ram_open() with readonly=true David Hildenbrand
2023-08-07 19:07 ` [PATCH v1 3/3] softmmu/physmem: never return directories from file_ram_open() David Hildenbrand
2023-08-08 17:26 ` Re:[PATCH v1 0/3] softmmu/physmem: file_ram_open() readonly improvements ThinerLogoer
2023-08-10 11:11 ` [PATCH " Philippe Mathieu-Daudé
2023-08-10 16:35 ` ThinerLogoer
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=77c36463-e669-c6e7-77b6-f49a9b67aa5a@redhat.com \
--to=david@redhat.com \
--cc=berrange@redhat.com \
--cc=imammedo@redhat.com \
--cc=logoerthiner1@163.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.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 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).