Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8271572ybl; Tue, 24 Dec 2019 18:52:55 -0800 (PST) X-Google-Smtp-Source: APXvYqyFPzPkZTe/7crsaoyxW5RGCZJ4WRf7LLAIcW1TnUsCXfffl0i8MoKWgevG3L33gVGjw/qo X-Received: by 2002:a9d:799a:: with SMTP id h26mr40412508otm.240.1577242375545; Tue, 24 Dec 2019 18:52:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577242375; cv=none; d=google.com; s=arc-20160816; b=kednTVNGnHpXIoncxtHSSq5XzRLUypl8TVSjNK/ypQ3S3gFOCgB9GConsopk2+k50v KHmQlVfTmFsYGjylzhPCL/BDgsCKx+EN0QImy7DLYEqpwQ3GUhv3d9iKm0Tr1+wbEsAB 5ndnbSgyHD7Mu4Z2PHeYjZQTHDThZWsConMjRWrVOozSG0uxzaUq+KsEpal+AOaPqlc4 vafW+fMvymjtVNCk8TmKqI2Mr7eFWkMAddxGt6snduJkWYINpoZjcvK3kG9FYpv0eSZw +tfC7MMEo3DgcGcHxj3LUUh8vTCvDL8pjXCz1D4RW+qyTnaibnltJDBjYJXViGXVGczR gJUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=MNG7I1EGcilYjtZ1TidHN2Pt0A813HPn4VjQCJNmOQA=; b=AD1oz+/8+Pg3koD7cAHe7vzfLSWQQmpu7OuZJ4v9tYqfJPS2B/n59wchblwEMXnIVj 61HNgvKB5kZzqJj5DOVYnCdrpwSy1XzRyT4ySyh/v21IpONSrGDt1Rvnd6dz0htXMXa+ BaxL4WBSCP1VK6+HCYQIFiEbxyCtrLtOrjtp+lnYN1R+HKCXsiCN7u1B55O5k3awo3iT lBo+d8HIklsxjKiMQrvK5uOFOWGSvWugB7bBPddRm4/HkXmCt/dgOXTX7QQv1oinfa7J ZnyS3aGLW7CXEUWXEju3r4hXpycic1SEzehNFKfGdWI0V8C5Jrvraz65wIcCuZNCNZG9 gEIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m17si11362402otr.17.2019.12.24.18.52.28; Tue, 24 Dec 2019 18:52:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726328AbfLYCvG (ORCPT + 99 others); Tue, 24 Dec 2019 21:51:06 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:59083 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbfLYCvG (ORCPT ); Tue, 24 Dec 2019 21:51:06 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07486;MF=zhabin@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0TlrxobV_1577242263; Received: from localhost(mailfrom:zhabin@linux.alibaba.com fp:SMTPD_---0TlrxobV_1577242263) by smtp.aliyun-inc.com(127.0.0.1); Wed, 25 Dec 2019 10:51:03 +0800 From: Zha Bin To: linux-kernel@vger.kernel.org Cc: mst@redhat.com, jasowang@redhat.com, slp@redhat.com, virtio-dev@lists.oasis-open.org, gerry@linux.alibaba.com, zhabin@linux.alibaba.com, jing2.liu@intel.com, chao.p.peng@intel.com Subject: [PATCH v1 0/2] support virtio mmio specification Version 3 Date: Wed, 25 Dec 2019 10:50:21 +0800 Message-Id: X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In cloud native environment, we need a lightweight and secure system. It should benefit from the speed of containers and the security of VM, which is classified as secure containers. The traditional solution of cloud VM is Qemu. In fact we don't need to pay for the legacy devices. Currently, more userspace VMMs, e.g. Qemu, Firecracker, Cloud Hypervisor and Alibaba Cloud VMM which is called Dragonball, began to pay attention to a lightweight solution. The lightweight VMM is suitable to cloud native infrastructure which is designed for creating secure sandbox to address the requirements of multi-tenant. Meanwhile, with faster startup time and lower memory overhead, it makes possible to launch thousands of microVMs on the same machine. This VMM minimizes the emulation devices and uses virtio-mmio to get a more lightweight transport layer. The virtio-mmio devices have less code than virtio-pci, which can decrease boot time and increase deploy density by customizing kernel such as setting pci=off. From another point of view, the minimal device can reduce the attack surface. We have compared the number of files and the lines of code between virtio-mmio and virio-pci. Virtio-PCI Virtio-MMIO number of files(Linux) 161 1 lines of code(Linux) 78237 538 number of files(Qemu) 24 1 lines of code(Qemu) 8952 421 But the current standard virtio-mmio spec has some limitations which is only support legacy interrupt and will cause performance penalties. To address such limitation, we proposed to update virtio-mmio spec to version 3 to add the MSI interrupt and doorbell notify features[1], which can achieve the same performance as virtio-pci devices with only around 400 lines of code. Here are the performance gain of MSI interrupt in virtio-mmio. Each case is repeated three times. netperf -t TCP_RR -H 192.168.1.36 -l 30 -- -r 32,1024 Virtio-PCI Virtio-MMIO Virtio-MMIO(MSI) trans/s 9536 6939 9500 trans/s 9734 7029 9749 trans/s 9894 7095 9318 With the virtio spec proposal[1], other VMMs (e.g. Qemu) can also make use of the new features to get a enhancing performance. [1] https://lkml.org/lkml/2019/12/20/113 Liu Jiang (2): x86/msi: Enhance x86 to support platform_msi virtio-mmio: add features for virtio-mmio specification version 3 arch/x86/Kconfig | 6 ++ arch/x86/include/asm/hw_irq.h | 5 + arch/x86/include/asm/irqdomain.h | 9 ++ arch/x86/kernel/apic/msi.c | 74 +++++++++++++ drivers/base/platform-msi.c | 4 +- drivers/virtio/virtio_mmio.c | 226 ++++++++++++++++++++++++++++++++++++--- include/linux/msi.h | 1 + include/uapi/linux/virtio_mmio.h | 28 +++++ 8 files changed, 337 insertions(+), 16 deletions(-) -- 1.8.3.1