From nobody Thu Nov 6 19:53:33 2025 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 1543261792546695.0578751195327; Mon, 26 Nov 2018 11:49:52 -0800 (PST) Received: from localhost ([::1]:38473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRMt8-0007qX-Uk for importer@patchew.org; Mon, 26 Nov 2018 14:49:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRMkf-0008H0-JT for qemu-devel@nongnu.org; Mon, 26 Nov 2018 14:41:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRMkb-0004qq-3k for qemu-devel@nongnu.org; Mon, 26 Nov 2018 14:41:01 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:35895) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRMka-0004qb-SD for qemu-devel@nongnu.org; Mon, 26 Nov 2018 14:40:57 -0500 Received: by mail-wr1-x42e.google.com with SMTP id t3so20234591wrr.3 for ; Mon, 26 Nov 2018 11:40:56 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id s139sm2412468wmd.3.2018.11.26.11.40.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 11:40:54 -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=PkxRjo8pey14S4e5COodOneVIjytgf2tqUUeA9fuxsM=; b=L/Nrc6q2m/L89MZod0L5Bvr8GE5RZeK+bbYy84//Z0HORKYrzkYMXN7cxRec0Aecxx BdK+Rgs0AZ+9Mx8y9DBPg4hWoiSAy6kSJiWbfOjvbQonwmirY3QdvBsEBACVnuESIvSS 38RU0CMXtuYv47AtmBylz0V+UTZt0YhQgG3IyxCxGihm5hLi8OQ+Plq9iPYy0l/f/aku ypF6MHnHaB2evYLoxSKdG63AkAFRbL2CMhFL3rOWb1WyMfmoZfTa8iQowhCzIX8oGR/f qK7t8eW9hbs65n1TcljGEXPdgtMTux9cLQcvdq+RWMv9g+3fYBq6fUqx/arb3nDHHfYN cVwQ== 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=PkxRjo8pey14S4e5COodOneVIjytgf2tqUUeA9fuxsM=; b=NhvqCJjtDi3HpI+wwpNLvxDCgtpg7xzFlIw5nkR7bGrwr4KVSmHRjaBp0XslLMyAtz VnX3tyJYPI7mDdCx3jVuDw05nU7/tP3TSJZYcoBOPZYuuMHV6dwxIZpPvBy+Lj5TV4FC AFaAwH5Jn9QzcIr5Zy+YkO3h+uJJPB6xitNEkQanOGMDoKftGCRgR9WqYw2dWO3UBz65 TPTNgs+H+dMFHT6jJWLEW/LCtrrNjzeaI0GhSDfDBhmbH3Od2yUzDl91JghU2uCuqVOD /r0abQHwZl9fURZF82hmAB4m1b+CmB12S2VcbmscBBDn4e2k57Vxdqzio0alv5bUYdha 2uBw== X-Gm-Message-State: AA+aEWZ3NqquJEWlRBQFfSRuE3KxVQwJDBozVbrs73OEX7zik6A/ISt4 +cDpQZn7IgY2+TChcv5vK47a2cXx X-Google-Smtp-Source: AFSGD/X+l5Scv8zA00epqvodbl/Z7hGGOEfkE4YHmrQ7fpS6JJXzhkwyA6OKaiopeGAZ6DeeseceYw== X-Received: by 2002:adf:f703:: with SMTP id r3mr24319176wrp.93.1543261255561; Mon, 26 Nov 2018 11:40:55 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 20:40:34 +0100 Message-Id: <1543261235-2834-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543261235-2834-1-git-send-email-pbonzini@redhat.com> References: <1543261235-2834-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::42e 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=83=C2=A9 Lureau Signed-off-by: Paolo Bonzini Signed-off-by: Marc-Andr=C3=A9 Lureau --- 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