From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 123A1C433ED for ; Tue, 27 Apr 2021 00:29:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36B8661151 for ; Tue, 27 Apr 2021 00:29:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36B8661151 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbBbe-00013t-6J for qemu-devel@archiver.kernel.org; Mon, 26 Apr 2021 20:29:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb7qT-0001RD-1U; Mon, 26 Apr 2021 16:28:41 -0400 Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]:42806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lb7qR-0006ow-BY; Mon, 26 Apr 2021 16:28:40 -0400 Received: by mail-ej1-x642.google.com with SMTP id ja3so10467562ejc.9; Mon, 26 Apr 2021 13:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LFWS3XVwYFa5pkEsOWfzLudSnckk/JghQ/frQo27JTY=; b=pPunOMTrmy+BZTn5l57rf6lF7/SQfN26QTca8metWnHMsUYypIGLGqz9e86XxICnaX CENZzo3vkzNU7xneDGrTSzHib2hpSHqx4eRYJleRy+qGvgi6vAL8pe0Jw2n+t9aw0++U 9Fae/ccaon4yR+VxiyhFoR+aTQElOkSP6VS6/SYB7lbPJ6Df9koKJUSscFsJPj9QU3sL uulcxMvbkrXjkkgjcLyxbDXRn46txdyJNtEje6ayzSk9/IVdWOi0AmsiZIxqoH0bzUln Jdp2fKZwtcThbZXul1YRi0xnARxSzrNbuPGogE/VZG050AO7FPtrPCYjFnUmjIm0k/Gm wkPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LFWS3XVwYFa5pkEsOWfzLudSnckk/JghQ/frQo27JTY=; b=QMlMTyZOTyXUhxQ1aGMI0c3s85H7kfl30HEex8cqtkK2KOv4kPwRkVtyjb8epWpVXg d2IskilfuRPV+MB5g0+IrfykywWfyPUs2SMXvGPabCO40Ou4zSbEG42o5zPMVpI8h9wk gI8x9tOREtOGkm/fgt4kCV7PS9V4Ky74jxd1RJqYZscFy5XyqtPsRiARBwbMQnt7uTCL c3RAnf/ue1s+uaQYSdhXohSlJB8P/AMdex/9C640B26cGQMAjBF4eJ/yhPOfP8gIHNIG 0mGEFIVodhxqJBl2MaZ1hsjSOcnh9bSv/ECRNEznPD8YTip1Fbsi2u2D133vAcySVWzx E8jg== X-Gm-Message-State: AOAM531WdgBcdXOUx65UDFOekOUjJwXYMXzg1nQNICD56LhOGuZ+4dkB +7vKlcgmLA6XURsEtT2ZJixmJp9jwpd5TTZLMidUNMn8eyFLgmfurkg= X-Google-Smtp-Source: ABdhPJzVzt+svxzQoeVJydW+m+prfCUPVLuT/VUoXyafcnXvaeJ8eUE0DFozjCfn+0Nr/Jw9/H9UiXAVq4SiMlm2ja4= X-Received: by 2002:a17:907:33ce:: with SMTP id zk14mr7476480ejb.372.1619468917511; Mon, 26 Apr 2021 13:28:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dev Audsin Date: Mon, 26 Apr 2021 21:27:52 +0100 Message-ID: Subject: Re: [PATCH] skip virtio fs cache section to enable NIC pass through To: qemu-devel@nongnu.org Content-Type: multipart/alternative; boundary="0000000000008d9cf005c0e5fd44" Received-SPF: pass client-ip=2a00:1450:4864:20::642; envelope-from=dev.devaqemu@gmail.com; helo=mail-ej1-x642.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 26 Apr 2021 20:21:43 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, alex.williamson@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --0000000000008d9cf005c0e5fd44 Content-Type: text/plain; charset="UTF-8" virtio-fs with DAX is currently not compatible with NIC Pass through. VM fails to boot when DAX cache is enabled and SR-IOV VF is being attached. This patch solves the problem. Hencem DAX cache and SR-IOV VF are be attached together. 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 On Mon, Apr 26, 2021 at 9:24 PM Dev Audsin wrote: > Signed-off-by: Dev Audsin > --- > hw/vfio/common.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/vfio/common.c b/hw/vfio/common.c > index 6ff1daa763..3af70238bd 100644 > --- a/hw/vfio/common.c > +++ b/hw/vfio/common.c > @@ -541,7 +541,8 @@ static int vfio_host_win_del(VFIOContainer *container, > hwaddr min_iova, > > static bool vfio_listener_skipped_section(MemoryRegionSection *section) > { > - return (!memory_region_is_ram(section->mr) && > + return (!strcmp(memory_region_name(section->mr), "virtio-fs-cache")) > || > + (!memory_region_is_ram(section->mr) && > !memory_region_is_iommu(section->mr)) || > /* > * Sizing an enabled 64-bit BAR can cause spurious mappings to > -- > 2.25.1 > --0000000000008d9cf005c0e5fd44 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
virtio-fs with DAX is currently not compatible with NIC Pass through. VM fa= ils to boot when DAX=C2=A0 cache is enabled and SR-IOV VF is being attached= . This patch solves the problem. Hencem DAX cache and SR-IOV VF are be atta= ched together.

When a SR-IOV VF attaches to a qemu process, vfio will try to pin the=20 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 cac= he.
Currently DAX cache need to be set to 0, for the SR-IOV VF to be attached t= o Kata containers.
Enabling both SR-IOV VF and DAX work together will potentially improve=20 performance for workloads which are I/O and network intensive

= On Mon, Apr 26, 2021 at 9:24 PM Dev Audsin <dev.devaqemu@gmail.com> wrote:
Signed-off-by: Dev Audsin <dev.devaqemu@gmail.com>
---
=C2=A0hw/vfio/common.c | 3 ++-
=C2=A01 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 6ff1daa763..3af70238bd 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -541,7 +541,8 @@ static int vfio_host_win_del(VFIOContainer *container, = hwaddr min_iova,

=C2=A0static bool vfio_listener_skipped_section(MemoryRegionSection *sectio= n)
=C2=A0{
-=C2=A0 =C2=A0 return (!memory_region_is_ram(section->mr) &&
+=C2=A0 =C2=A0 return (!strcmp(memory_region_name(section->mr), "vi= rtio-fs-cache")) ||
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (!memory_region_is_ram(section->mr) = &&
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!memory_region_is_iommu(sec= tion->mr)) ||
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Sizing an enabled 64-bit = BAR can cause spurious mappings to
--
2.25.1
--0000000000008d9cf005c0e5fd44--