qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Ilya Maximets <i.maximets@samsung.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	qemu-devel@nongnu.org, "Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 1/4] hostmem-memfd: disable for systems wihtout sealing support
Date: Mon, 10 Dec 2018 17:18:45 +0100	[thread overview]
Message-ID: <20181210171845.4f132e25@Igors-MacBook-Pro.local> (raw)
In-Reply-To: <20181127135030.1671-2-i.maximets@samsung.com>

On Tue, 27 Nov 2018 16:50:27 +0300
Ilya Maximets <i.maximets@samsung.com> wrote:

s/wihtout/without/ in subj

> 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  |  6 +++---
>  2 files changed, 11 insertions(+), 13 deletions(-)
> 
> diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c
> index b6836b28e5..a3455da9c9 100644
> --- a/backends/hostmem-memfd.c
> +++ b/backends/hostmem-memfd.c
> @@ -156,15 +156,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 = {
> @@ -177,7 +175,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);
that would either lead to not clear error that type doesn't exist.
it could be better to report sensible error from memfd_backend_memory_alloc() if
the feature is required but not supported by host 

>      }
>  }
> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
> index 45d58d8ea2..e3e9a33580 100644
> --- a/tests/vhost-user-test.c
> +++ b/tests/vhost-user-test.c
> @@ -169,7 +169,7 @@ static char *get_qemu_cmd(TestServer *s,
>                            int mem, enum test_memfd memfd, const char *mem_path,
>                            const char *chr_opts, const char *extra)
>  {
> -    if (memfd == TEST_MEMFD_AUTO && qemu_memfd_check(0)) {
> +    if (memfd == TEST_MEMFD_AUTO && qemu_memfd_check(MFD_ALLOW_SEALING)) {
>          memfd = TEST_MEMFD_YES;
>      }
>  
> @@ -903,7 +903,7 @@ static void test_multiqueue(void)
>      s->queues = 2;
>      test_server_listen(s);
>  
> -    if (qemu_memfd_check(0)) {
> +    if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
>          cmd = g_strdup_printf(
>              QEMU_CMD_MEMFD QEMU_CMD_CHR QEMU_CMD_NETDEV ",queues=%d "
>              "-device virtio-net-pci,netdev=net0,mq=on,vectors=%d",
> @@ -963,7 +963,7 @@ int main(int argc, char **argv)
>      /* run the main loop thread so the chardev may operate */
>      thread = g_thread_new(NULL, thread_function, loop);
>  
> -    if (qemu_memfd_check(0)) {
> +    if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
>          qtest_add_data_func("/vhost-user/read-guest-mem/memfd",
>                              GINT_TO_POINTER(TEST_MEMFD_YES),
>                              test_read_guest_mem);

  parent reply	other threads:[~2018-12-10 16:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20181127135037eucas1p18867a9ae8b1f2731ad4ce8d79fddae33@eucas1p1.samsung.com>
2018-11-27 13:50 ` [Qemu-devel] [PATCH v2 0/4] memfd fixes Ilya Maximets
     [not found]   ` <CGME20181127135045eucas1p1e259cacbab5e715f7845b9beee22f882@eucas1p1.samsung.com>
2018-11-27 13:50     ` [Qemu-devel] [PATCH v2 1/4] hostmem-memfd: disable for systems wihtout sealing support Ilya Maximets
2018-11-27 13:56       ` Marc-André Lureau
2018-12-10 16:18       ` Igor Mammedov [this message]
2018-12-11 10:29         ` Ilya Maximets
2018-12-11 15:48           ` Igor Mammedov
2019-01-05  2:43             ` Eduardo Habkost
2019-01-16 10:57               ` Ilya Maximets
2018-12-11 10:53       ` Daniel P. Berrangé
2018-12-11 11:09         ` Ilya Maximets
2018-12-12  6:49           ` Gerd Hoffmann
2019-01-16 15:30             ` Eduardo Habkost
2019-01-16 15:46               ` Ilya Maximets
2019-01-16 15:48                 ` Daniel P. Berrangé
2019-01-16 15:54                   ` Ilya Maximets
2019-01-16 15:56                     ` Daniel P. Berrangé
2019-01-16 16:10                   ` Eduardo Habkost
     [not found]   ` <CGME20181127135052eucas1p2cec316cce9b9218e4ab476315fd4596b@eucas1p2.samsung.com>
2018-11-27 13:50     ` [Qemu-devel] [PATCH v2 2/4] memfd: always check for MFD_CLOEXEC Ilya Maximets
     [not found]   ` <CGME20181127135059eucas1p2371079ab1d368d8d444d6a183719cfc7@eucas1p2.samsung.com>
2018-11-27 13:50     ` [Qemu-devel] [PATCH v2 3/4] memfd: set up correct errno if not supported Ilya Maximets
     [not found]   ` <CGME20181127135106eucas1p119ab7de9758f13ea52adc0f4829ab9cb@eucas1p1.samsung.com>
2018-11-27 13:50     ` [Qemu-devel] [PATCH v2 4/4] memfd: improve error messages Ilya Maximets
2019-03-11 12:34   ` [Qemu-devel] [PATCH v2 0/4] memfd fixes Ilya Maximets
2019-03-11 12:50     ` Marc-André Lureau
2019-03-11 12:56       ` Daniel P. Berrangé
2019-03-11 14:12         ` Eduardo Habkost
2019-03-11 14:14           ` Daniel P. Berrangé

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=20181210171845.4f132e25@Igors-MacBook-Pro.local \
    --to=imammedo@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=i.maximets@samsung.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).