From nobody Tue Feb 10 01:16:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543329997953295.97301988862864; Tue, 27 Nov 2018 06:46:37 -0800 (PST) Received: from localhost ([::1]:42823 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRedI-0004ZB-NM for importer@patchew.org; Tue, 27 Nov 2018 09:46:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gReU9-00040k-7G for qemu-devel@nongnu.org; Tue, 27 Nov 2018 09:37:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gReU6-0001wx-BM for qemu-devel@nongnu.org; Tue, 27 Nov 2018 09:37:08 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:46026) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gReU6-0001wA-3h for qemu-devel@nongnu.org; Tue, 27 Nov 2018 09:37:06 -0500 Received: by mail-wr1-x42d.google.com with SMTP id v6so22923831wrr.12 for ; Tue, 27 Nov 2018 06:37:06 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n62sm2821869wmd.25.2018.11.27.06.37.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Nov 2018 06:37:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ipdoyuvwf9l2yucceOFmRwNot578FQzmMKXusZ/66TI=; b=eBdxulQNHuKs7JRtc71CgWEe5zhlSjz/4j+jG71m1hbe3zTLgw2a7Mh85yB+nO/mnD e2oYwaDwHNBb9gBbHS/dJuNBdjWQf58OfH0I+4looB6AsDp6jZiaOgGolhn8NlHH8+SO vZVh2fIq8rb/IYg7Y6Bh1Mll2Own6/DDZKBwSuSYHctWQl2M772XYTGRgL57Y083TfON 3GcLxY8Yz0WJDFAXj8XcVS9M0DIluTnQVuRrpOgufRUQeIDOHA2HKSgD4radu5XMmEYk 71qSnA9s7gLI6osBZHOufdrN6Mi1CZLaj1VnozWtRIOKXtK0o2NkrhVYsNXik5NOj4ao 90jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Ipdoyuvwf9l2yucceOFmRwNot578FQzmMKXusZ/66TI=; b=TWjv4eaOSeSsfa1pxYbDWVYgL5Yy3notKd8jJ6qfUZzvLWFF4yMSfqEa6w91koD7IH pMcAR3S2tjFzssNWLN3lw27DBo5Plhhk3pA3hh08AHQ2x4UxQFeJsGjsX2J40hatHjq3 EyBgvjITOV5eRjHfMgupWdPiTD2Wg/a96LhklkDbhSsFLbJky268Bc6ztz/o9nv/sMP7 YXliX3wAq59aCZvPMdXpIpCmeJSa16bczFZhIuROGIvSRLM8WilXexCRzuJLjppp7x/N 4KcCVqS2RhKE5dIV2LcYSboe2vD8FBUkhR8iGXd95CX9FykD7IFlCPXIbYeCyYoEEJxV vnig== X-Gm-Message-State: AA+aEWZFrhnqwl3M/5z68X5q3TJf9uKSh4FptUD0BrpmJSW1Z8H40yBu x/pI+MoUuBt/IgJOdDNaZ8imXR28 X-Google-Smtp-Source: AFSGD/Vg5Kzt8DcrR+Cr6uFeVkSEUhXWahdQh+FtCFLgXdPNvrqN0n2sJeQuwlFivPnnJxuT6HlEvw== X-Received: by 2002:a5d:4f10:: with SMTP id c16mr28550797wru.177.1543329424737; Tue, 27 Nov 2018 06:37:04 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 15:36:36 +0100 Message-Id: <1543329397-48407-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543329397-48407-1-git-send-email-pbonzini@redhat.com> References: <1543329397-48407-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42d Subject: [Qemu-devel] [PULL 14/15] hostmem-memfd: honour share=on/off property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau The share=3Don/off property is used to modified mmap() MAP_SHARED setting. Make it on by default for convenience and compatibility reasons. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- backends/hostmem-memfd.c | 4 +++- qemu-options.hx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index b6836b2..1c3579e 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -59,7 +59,8 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Er= ror **errp) =20 name =3D object_get_canonical_path(OBJECT(backend)); memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), - name, backend->size, true, fd, errp); + name, backend->size, + backend->share, fd, errp); g_free(name); } =20 @@ -131,6 +132,7 @@ memfd_backend_instance_init(Object *obj) =20 /* default to sealed file */ m->seal =3D true; + MEMORY_BACKEND(m)->share =3D true; } =20 static void diff --git a/qemu-options.hx b/qemu-options.hx index f7df472..269eda7 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4025,7 +4025,7 @@ Memory backend objects offer more control than the @o= ption{-m} option that is traditionally used to define guest RAM. Please refer to @option{memory-backend-file} for a description of the options. =20 -@item -object memory-backend-memfd,id=3D@var{id},merge=3D@var{on|off},dump= =3D@var{on|off},prealloc=3D@var{on|off},size=3D@var{size},host-nodes=3D@var= {host-nodes},policy=3D@var{default|preferred|bind|interleave},seal=3D@var{o= n|off},hugetlb=3D@var{on|off},hugetlbsize=3D@var{size} +@item -object memory-backend-memfd,id=3D@var{id},merge=3D@var{on|off},dump= =3D@var{on|off},share=3D@var{on|off},prealloc=3D@var{on|off},size=3D@var{si= ze},host-nodes=3D@var{host-nodes},policy=3D@var{default|preferred|bind|inte= rleave},seal=3D@var{on|off},hugetlb=3D@var{on|off},hugetlbsize=3D@var{size} =20 Creates an anonymous memory file backend object, which allows QEMU to share the memory with an external process (e.g. when using @@ -4047,6 +4047,8 @@ with the @option{seal} option (requires at least Linu= x 4.16). Please refer to @option{memory-backend-file} for a description of the other options. =20 +The @option{share} boolean option is @var{on} by default with memfd. + @item -object rng-random,id=3D@var{id},filename=3D@var{/dev/random} =20 Creates a random number generator backend which obtains entropy from --=20 1.8.3.1