From nobody Sun Feb 8 19:24:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579801788; cv=none; d=zohomail.com; s=zohoarc; b=Gp6XPmSZnKD/J4MCMNWfZUZ+AG0ay+cw/fruYK+5b7e2XtFy+F91eRBpzwNZFfsBHYZDgacfBdM8k5VGX9gbXMGH4nhbuO/OX+ZSH4UCdxjEq3mKECkW3z5pk6t0WrnMwby1LfG/032aAo6lEczLv6s2UFN4nuLQDgwy8NsYcNU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801788; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yJDbV0dVMJVYK5BHA8eeOUpZPc/qwodyk4amyCYijHo=; b=M+QWKuN350iAF5scKhFsk+vvUcaSK7Q0lqhY8sgY48NTBs+V1bwRK33C0t3+9al5WvlnK6LxR8DIy2TSKI5ABpNnRWjBUds3zYn/vh/wZy7tq/piJvajVBO6Btpq9yCFvFX9TaoVhd3jD4x40tyk+e7/Zha5nIy2j0R2HiNd/m0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1579801788021897.2122930096011; Thu, 23 Jan 2020 09:49:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-1-Ky0gxymZMaORXjxnQB8i_A-1; Thu, 23 Jan 2020 12:46:44 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 197C9DB6B; Thu, 23 Jan 2020 17:46:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E60C986455; Thu, 23 Jan 2020 17:46:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 96A02180CB3B; Thu, 23 Jan 2020 17:46:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NHkQVd020975 for ; Thu, 23 Jan 2020 12:46:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id B6DCE5D9E2; Thu, 23 Jan 2020 17:46:26 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4109D5DA2C for ; Thu, 23 Jan 2020 17:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801786; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yJDbV0dVMJVYK5BHA8eeOUpZPc/qwodyk4amyCYijHo=; b=BDl2Omff3JvFA3Y+B8SCWbfTTu8mwtmHvEpOSaByQgW1CDe4U1NbFp56I3dZoDhImAuh+d RhVwC7otQeYK5iiWzT8t5unfSkiEFov6l432zzwCuiAL1XBvhCkxNvnKdcQtiDNsqWDBPV zXlamFLCLEchaOSngIXmYQjbLmDYizw= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 10/10] docs: add virtiofs kbase Date: Thu, 23 Jan 2020 18:46:11 +0100 Message-Id: <065c6282f7fd9422b9c6c1acd36710fea71adcad.1579801508.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: Ky0gxymZMaORXjxnQB8i_A-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a document describing the usage of virtiofs. --- docs/kbase.html.in | 3 + docs/kbase/virtiofs.rst | 153 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 docs/kbase/virtiofs.rst diff --git a/docs/kbase.html.in b/docs/kbase.html.in index c156414c41..7d6caf3cb1 100644 --- a/docs/kbase.html.in +++ b/docs/kbase.html.in @@ -29,6 +29,9 @@
Backing chain management=
Explanation of how disk backing chain specification impacts li= bvirt's behaviour and basic troubleshooting steps of disk problems.
+ +
Virtio-FS
+
Share a filesystem between the guest and the host
=20 diff --git a/docs/kbase/virtiofs.rst b/docs/kbase/virtiofs.rst new file mode 100644 index 0000000000..83351e0a28 --- /dev/null +++ b/docs/kbase/virtiofs.rst @@ -0,0 +1,153 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D +Sharing files with Virtio-FS +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D + +=3D=3D=3D 8< delete before merging 8< =3D=3D=3D +NOTE: if you're looking at this note, this is just a proposal. +See the up-to-date version on: https://libvirt.org/kbase/virtiofs.html +=3D=3D=3D 8< --------------------- 8< =3D=3D=3D + +.. contents:: + +=3D=3D=3D=3D=3D=3D=3D=3D=3D +Virtio-FS +=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Virtio-FS is a delicious delicacy aiming to provide an easy-to-configure +way of sharing filesystems between the host and the virtual machine. + +See https://virtio-fs.gitlab.io/ + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Host setup +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The host-side virtiofsd daemon, like other vhost-user backed devices, +requres shared memory between the host and the guest. As of QEMU 4.2, this +requires specifying a NUMA topology for the guest and explicitly specifying +a memory backend. Multiple options are available: + +Either of the following: + +1. Use file-backed memory + +Configure the directory where the files backing the memory will be stored +with the ``memory_backing_dir`` option in ``/etc/libvirt/qemu.conf`` + +:: + + # This directory is used for memoryBacking source if configured as file. + # NOTE: big files will be stored here + memory_backing_dir =3D "/dev/shm/" + +2. Use hugepage-backed memory + +Make sure there are enough huge pages allocated for the requested guest me= mory. +For exmaple, for one guest with 2 GiB of RAM backed by 2 MiB hugepages: + +:: + + # virsh allocpages 2M 1024 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Guest setup +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +1. Specify the NUMA topology + +in the domain XML of the guest. +For the simplest one-node topology for a guest with 2GiB of RAM and 8 vCPU= s: + +:: + + + ... + + + + + + ... + + +Note that the CPU element might already be specified and only one is allow= ed. + +2. Specify the memory backend + +Either of the following: + +2.1. File-backed memory + +:: + + + ... + + + + ... + + +This will create a file in the directory specified in ``qemu.conf`` + +2.2. Hugepage-backed memory + +:: + + + ... + + + + + + + ... + + +3. Add the ``vhost-user-fs`` QEMU device via the ``filesystem`` element + +:: + + + ... + + ... + + + /usr/libexec/virtiofsd + + + + + ... + + + +Note that despite its name, the ``target dir`` is actually a mount tag and= does +not have to correspond to the desired mount point in the guest. + +So far, ``passthrough`` is the only supported access mode and it requires +running the ``virtiofsd`` daemon as root. + +4. Boot the guest and mount the filesystem + +:: + + guest# mount -t virtiofs mount_tag /mnt/mount/path + +Note: this requires virtiofs support in the guest kernel (Linux v5.4 or la= ter) + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Optional parameters +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +More optional elements can be specified + +:: + + + /usr/libexec/virtiofsd + + + --=20 2.21.0