From: Ilya Maximets <i.maximets@samsung.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Ilya Maximets" <i.maximets@samsung.com>
Subject: [Qemu-devel] [PATCH v3 1/4] hostmem-memfd: disable for systems wihtout sealing support
Date: Mon, 11 Mar 2019 16:58:47 +0300 [thread overview]
Message-ID: <20190311135850.6537-2-i.maximets@samsung.com> (raw)
In-Reply-To: <20190311135850.6537-1-i.maximets@samsung.com>
If seals are not supported, memfd_create() will fail.
Furthermore, there is no way to disable it in this case because
'.seal' property is not registered.
This issue leads to vhost-user-test failures on RHEL 7.2:
qemu-system-x86_64: -object memory-backend-memfd,id=mem,size=2M,: \
failed to create memfd: Invalid argument
and actually breaks the feature on such systems.
Let's restrict memfd backend to systems with sealing support.
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
backends/hostmem-memfd.c | 18 ++++++++----------
tests/vhost-user-test.c | 5 +++--
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c
index 98c9bf3240..46b15b916a 100644
--- a/backends/hostmem-memfd.c
+++ b/backends/hostmem-memfd.c
@@ -154,15 +154,13 @@ memfd_backend_class_init(ObjectClass *oc, void *data)
"Huge pages size (ex: 2M, 1G)",
&error_abort);
}
- if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
- object_class_property_add_bool(oc, "seal",
- memfd_backend_get_seal,
- memfd_backend_set_seal,
- &error_abort);
- object_class_property_set_description(oc, "seal",
- "Seal growing & shrinking",
- &error_abort);
- }
+ object_class_property_add_bool(oc, "seal",
+ memfd_backend_get_seal,
+ memfd_backend_set_seal,
+ &error_abort);
+ object_class_property_set_description(oc, "seal",
+ "Seal growing & shrinking",
+ &error_abort);
}
static const TypeInfo memfd_backend_info = {
@@ -175,7 +173,7 @@ static const TypeInfo memfd_backend_info = {
static void register_types(void)
{
- if (qemu_memfd_check(0)) {
+ if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
type_register_static(&memfd_backend_info);
}
}
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 0c965b3b1e..3817966010 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -178,7 +178,8 @@ static void append_mem_opts(TestServer *server, GString *cmd_line,
int size, enum test_memfd memfd)
{
if (memfd == TEST_MEMFD_AUTO) {
- memfd = qemu_memfd_check(0) ? TEST_MEMFD_YES : TEST_MEMFD_NO;
+ memfd = qemu_memfd_check(MFD_ALLOW_SEALING) ? TEST_MEMFD_YES
+ : TEST_MEMFD_NO;
}
if (memfd == TEST_MEMFD_YES) {
@@ -930,7 +931,7 @@ static void register_vhost_user_test(void)
"virtio-net",
test_read_guest_mem, &opts);
- if (qemu_memfd_check(0)) {
+ if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
opts.before = vhost_user_test_setup_memfd;
qos_add_test("vhost-user/read-guest-mem/memfd",
"virtio-net",
--
2.17.1
next prev parent reply other threads:[~2019-03-11 13:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190311135911eucas1p2612665dccba27cc8b5d81b67a70480c6@eucas1p2.samsung.com>
2019-03-11 13:58 ` [Qemu-devel] [PATCH v3 0/4] memfd fixes Ilya Maximets
[not found] ` <CGME20190311135916eucas1p27b50ca29c84af5f7529d56fd43a2964d@eucas1p2.samsung.com>
2019-03-11 13:58 ` Ilya Maximets [this message]
[not found] ` <CGME20190311135919eucas1p11c7fad66884a0303b2637cd2d2b05cad@eucas1p1.samsung.com>
2019-03-11 13:58 ` [Qemu-devel] [PATCH v3 2/4] memfd: always check for MFD_CLOEXEC Ilya Maximets
[not found] ` <CGME20190311135922eucas1p2e131e72beea41ae584761ea5a62a948c@eucas1p2.samsung.com>
2019-03-11 13:58 ` [Qemu-devel] [PATCH v3 3/4] memfd: set up correct errno if not supported Ilya Maximets
[not found] ` <CGME20190311135925eucas1p21442eda0f28a7e6ae1f9a238ca0a4f0d@eucas1p2.samsung.com>
2019-03-11 13:58 ` [Qemu-devel] [PATCH v3 4/4] memfd: improve error messages Ilya Maximets
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=20190311135850.6537-2-i.maximets@samsung.com \
--to=i.maximets@samsung.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--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).