qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] make vfio and DAX cache work together
@ 2021-04-26 20:50 Dev Audsin
  2021-04-26 21:22 ` Alex Williamson
  0 siblings, 1 reply; 17+ messages in thread
From: Dev Audsin @ 2021-04-26 20:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.williamson, dgilbert

Hi Alex and David

@Alex:

Justification on why this region cannot be a DMA target for the device,

virtio-fs with DAX is currently not compatible with NIC Pass through.
When a SR-IOV VF attaches to a qemu process, vfio will try to pin the
entire DAX Window but it is empty when the guest boots and will fail.
A method to make VFIO and DAX to work together is to make vfio skip
DAX cache.

Currently DAX cache need to be set to 0, for the SR-IOV VF to be
attached to Kata containers. Enabling both SR-IOV VF and DAX work
together will potentially improve performance for workloads which are
I/O and network intensive.

@David

1. If DAX mode of virtiofs isn't yet in qemu, what is the best project
that this could be discussed?
2a. Regarding your comment on hard coding the name, I am referring to
the device by its name, which has been initialised in
hw/virtio/vhost-user-fs.c. I downloaded the source code of qemu with
virtiofs support which I obtained in reference to the Kata container
project and analysed it.  I see the following  code snippet in
hw/virtio/vhost-user-fs
  if (fs->conf.cache_size) {
        /* Anonymous, private memory is not counted as overcommit */
        cache_ptr = mmap(NULL, fs->conf.cache_size, DAX_WINDOW_PROT,
                         MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
        if (cache_ptr == MAP_FAILED) {
            error_setg(errp, "Unable to mmap blank cache");
            return;
        }

        memory_region_init_ram_ptr(&fs->cache, OBJECT(vdev),
                                   "virtio-fs-cache",
                                   fs->conf.cache_size, cache_ptr);
    }

In the above code snippet, the memory region is initialised with
device name  "virtio-fs-cache",which I am referring to in my source
code.

2b. Regarding, needing a way for the cache to declare it wants to be
omitted, I am not sure thats what is needed. Currently virtio-fs with
DAX is currently not compatible with vfio. I want to overcome this
problem by making vfio not using the cache.
What I want is cache to be used for purposes other than the VFIO
device. For example, in my deployment scenario, I want DAX cache to be
not used by SR-IOV VF (which is a VFIO device) but used by all other
system.

3. Moved to  vfio_listener_skip_section () and patch resubmitted.

Best
Dev


^ permalink raw reply	[flat|nested] 17+ messages in thread
* [PATCH] make vfio and DAX cache work together
@ 2021-04-26  9:50 Edge NFV
  2021-04-26 12:19 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 17+ messages in thread
From: Edge NFV @ 2021-04-26  9:50 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

 Signed-off-by: Edge NFV <edgenfv@gmail.com>
---
 hw/vfio/common.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index ae5654fcdb..83e15bf7a3 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -668,6 +668,15 @@ static void vfio_listener_region_add(MemoryListener
*listener,
                 int128_get64(int128_sub(section->size, int128_one())));
         return;
     }
+
+    /* Do not add virtio fs cache section */
+    if (!strcmp(memory_region_name(section->mr), "virtio-fs-cache")) {
+        trace_vfio_listener_region_add_skip(
+                section->offset_within_address_space,
+                section->offset_within_address_space +
+                int128_get64(int128_sub(section->size, int128_one())));
+        return;
+    }

     if (unlikely((section->offset_within_address_space &
                   ~qemu_real_host_page_mask) !=
-- 
2.25.1

[-- Attachment #2: Type: text/html, Size: 1305 bytes --]

^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH] make vfio and DAX cache work together
@ 2021-04-26  5:45 Edge NFV
  0 siblings, 0 replies; 17+ messages in thread
From: Edge NFV @ 2021-04-26  5:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: edgenfv


I am using Kata containers and create containers inside the virtual machine. The hypervisor used is QEMU.
My workload is I/O and network intensive. So, I prefer SR-IOV VF (which provides better network isolation) and DAX caching to work together.
However, I was unable to create a QEMU based virual machine when the above mentioned featires are enabled together.

Currently DAX cache need to be set to 0, to boot the VM successfully with the SR-IOV VF to be attached.
Enabling both SR-IOV VF and DAX work together will potentially improve performance for workloads which are I/O and network intensive.
This patch enables SR-IOV VF and DAX to work together.



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-05-04  9:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 20:50 [PATCH] make vfio and DAX cache work together Dev Audsin
2021-04-26 21:22 ` Alex Williamson
2021-04-27 16:29   ` Dev Audsin
2021-04-27 18:18     ` Alex Williamson
2021-04-27 19:00       ` Dr. David Alan Gilbert
2021-04-28 12:04         ` Dev Audsin
2021-04-28 19:17           ` Dr. David Alan Gilbert
2021-04-28 19:37             ` Alex Williamson
2021-04-29  8:44               ` Dr. David Alan Gilbert
2021-04-29 13:09                 ` Alex Williamson
2021-04-29 17:55                   ` Dr. David Alan Gilbert
2021-04-30 17:41                     ` Dev Audsin
2021-05-04  9:58                       ` Dr. David Alan Gilbert
  -- strict thread matches above, loose matches on Subject: below --
2021-04-26  9:50 Edge NFV
2021-04-26 12:19 ` Dr. David Alan Gilbert
2021-04-26 14:56   ` Alex Williamson
2021-04-26  5:45 Edge NFV

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).