Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17120282ybl; Wed, 1 Jan 2020 22:30:23 -0800 (PST) X-Google-Smtp-Source: APXvYqyjZT54zvtnvEssFpQIDmYny3eVW14BHX+fP5XLBWqBdu66ypx3A7d3iad+MnRmPKMLNRAH X-Received: by 2002:a05:6830:1bf8:: with SMTP id k24mr74479402otb.215.1577946623914; Wed, 01 Jan 2020 22:30:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577946623; cv=none; d=google.com; s=arc-20160816; b=B/MnYbzvIDGV+WJDT5ZStBJzJ/ILTHNNfz8HmzQ4DYJoLg8y+hz4c1NVvZXCfuz5MH bZpSJx9s9DVuOAj4lq+kq16TLucrDZpI4HWDt9DD1zJ6roxjfDD4R1nAJ6YCuFUuyD2S Em5J3jlv16+KOS4JUA9oB03dQtguquVODaIbXGxn3tcyW4cHuMCRLy6BLj8kk3nhGbpT 7OF8fUx/DwWHcX/lXIT0MLKNT5Bl2LnDe7FTdMpsCaK5JjO6D2KGGAUCKrj6alVl5TBl QPsFnThI8qk4B40EOdb5UHKvSzVdHBJVacZ271kbLPfW8xJYQXjPIwJvEfElNK9Jfw+Y jQ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=0Wy4DlJwntDGG8Dw5wwsUzHgZ7JZO21FMH3YX0CC+uQ=; b=TBXvvbKAZO4NKGnfYEqsT2k/nn8eJPZKCrZ56D5UyKLlcjSIaTI3X0gLDu42F3YVEj oy1ifYtMlRc11EOqdInXb9EESe5ZmCapgcxtNLtRMO4FtWrvf2JtJORvwGrDC2zFRjc7 fBCuxUjCdf5LMrepHGJBp59NfCMy0FHjpfZ8Y0I/xZ4+kUGnIFePiFF17RNj4fD4UvVU Xg6gudsyp2PpvvI/DHdzRR2yg2Jhd7S3iyKWRcRUxdqkWijoVDJcWTNaLocn9SQARejD U0ij54pjc3HT9jt6kAPOystOq/sRMMsmlei5obz5/2Ob6seMCITsRRXcg9Wjf9n+6Ahd kGYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W7XXflk0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b133si26152210oif.244.2020.01.01.22.30.11; Wed, 01 Jan 2020 22:30:23 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W7XXflk0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726125AbgABG3Z (ORCPT + 99 others); Thu, 2 Jan 2020 01:29:25 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:25317 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725788AbgABG3Z (ORCPT ); Thu, 2 Jan 2020 01:29:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577946562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Wy4DlJwntDGG8Dw5wwsUzHgZ7JZO21FMH3YX0CC+uQ=; b=W7XXflk0C9E5la+QbcoIq25vLb9qlwP7n79RCcgn/JLokXFsnUpnx05UHP6RVl33P7Il6g 4hptOvVLS4OLN4jQFGCRhzOPAoCGD/8pv5zIYMql8b8iiXXFOER6b4NanOhSp4VVAInUxI 4gxC1VZY1CcHwX1O/BkltFe1DK9X8ZE= 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-137-rcyrE958ODmgO_pURC9TVg-1; Thu, 02 Jan 2020 01:29:21 -0500 X-MC-Unique: rcyrE958ODmgO_pURC9TVg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B549710054E3; Thu, 2 Jan 2020 06:29:19 +0000 (UTC) Received: from [10.72.12.230] (ovpn-12-230.pek2.redhat.com [10.72.12.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A7B460BFB; Thu, 2 Jan 2020 06:28:59 +0000 (UTC) Subject: Re: [PATCH v1 2/2] virtio-mmio: add features for virtio-mmio specification version 3 To: "Liu, Jiang" Cc: Zha Bin , linux-kernel@vger.kernel.org, mst@redhat.com, slp@redhat.com, virtio-dev@lists.oasis-open.org, jing2.liu@intel.com, chao.p.peng@intel.com References: <229e689d-10f1-2bfb-c393-14dfa9c78971@redhat.com> <0460F92A-3DF6-4F7A-903B-6434555577CC@linux.alibaba.com> <56703BDA-B7AE-4656-8061-85FD1A130597@linux.alibaba.com> From: Jason Wang Message-ID: <16000124-bf6f-5762-845c-80514d1e6ea7@redhat.com> Date: Thu, 2 Jan 2020 14:28:52 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <56703BDA-B7AE-4656-8061-85FD1A130597@linux.alibaba.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/12/26 =E4=B8=8B=E5=8D=889:16, Liu, Jiang wrote: > >> On Dec 26, 2019, at 4:09 PM, Jason Wang wrote: >> >> >> On 2019/12/25 =E4=B8=8B=E5=8D=8811:20, Liu, Jiang wrote: >>>> On Dec 25, 2019, at 6:20 PM, Jason Wang wrote: >>>> >>>> >>>> On 2019/12/25 =E4=B8=8A=E5=8D=8810:50, Zha Bin wrote: >>>>> From: Liu Jiang >>>>> >>>>> Userspace VMMs (e.g. Qemu microvm, Firecracker) take advantage of u= sing >>>>> virtio over mmio devices as a lightweight machine model for modern >>>>> cloud. The standard virtio over MMIO transport layer only supports = one >>>>> legacy interrupt, which is much heavier than virtio over PCI transp= ort >>>>> layer using MSI. Legacy interrupt has long work path and causes spe= cific >>>>> VMExits in following cases, which would considerably slow down the >>>>> performance: >>>>> >>>>> 1) read interrupt status register >>>>> 2) update interrupt status register >>>>> 3) write IOAPIC EOI register >>>>> >>>>> We proposed to update virtio over MMIO to version 3[1] to add the >>>>> following new features and enhance the performance. >>>>> >>>>> 1) Support Message Signaled Interrupt(MSI), which increases the >>>>> interrupt performance for virtio multi-queue devices >>>>> 2) Support per-queue doorbell, so the guest kernel may directly wri= te >>>>> to the doorbells provided by virtio devices. >>>>> >>>>> The following is the network tcp_rr performance testing report, tes= ted >>>>> with virtio-pci device, vanilla virtio-mmio device and patched >>>>> virtio-mmio device (run test 3 times for each case): >>>>> >>>>> 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 >>>>> >>>>> [1] https://lkml.org/lkml/2019/12/20/113 >>>> Thanks for the patch. Two questions after a quick glance: >>>> >>>> 1) In PCI we choose to support MSI-X instead of MSI for having extra= flexibility like alias, independent data and address (e.g for affinity) = . Any reason for not start from MSI-X? E.g having MSI-X table and PBA (bo= th of which looks pretty independent). >>> Hi Jason, >>> Thanks for reviewing patches on Christmas Day:) >>> The PCI MSI-x has several advantages over PCI MSI, mainly >>> 1) support 2048 vectors, much more than 32 vectors supported by MSI. >>> 2) dedicated address/data for each vector, >>> 3) per vector mask/pending bits. >>> The proposed MMIO MSI extension supports both 1) and 2), >> >> Aha right, I mis-read the patch. But more questions comes: >> >> 1) The association between vq and MSI-X vector is fixed. This means it= can't work for a device that have more than 2047 queues. We probably nee= d something similar to virtio-pci to allow a dynamic association. > We have considered both the PCI MSI-x like dynamic association design a= nd fix mapping design. > The fix mapping design simplifies both the interrupt configuration proc= ess and VMM implementations. Well, for VMM just an indirection and for guest, it can choose to use=20 fixed mapping, just need to program once during probe. > And the virtio mmio transport layer is mainly used by light VMMs to sup= port small scale virtual machines, Let's not limit the interface to be used by a specific case :).=20 Eliminating PCIE would be appealing for other scenarios. > 2048 vectors should be enough for these usage cases. > So the fix mapping design has been used. > >> 2) The mask and unmask control is missed >> >> >>> but the extension doesn=E2=80=99t support 3) because >>> we noticed that the Linux virtio subsystem doesn=E2=80=99t really mak= e use of interrupt masking/unmasking. >> >> Not directly used but masking/unmasking is widely used in irq subsyste= m which allows lots of optimizations. >> >> >>> On the other hand, we want to simplify VMM implementations as simple = as possible, and mimicking the PCI MSI-x >>> will cause some complexity to VMM implementations. >> >> I agree to simplify VMM implementation, but it looks to me introducing= masking/pending won't cost too much code in the VMM implementation. Just= new type of command for VIRTIO_MMIO_MSI_COMMAND. > We want to make VMM implementations as simple as possible:) > And based on following observations, we have disabled support of mask/u= nmask, > 1) MSI is edge triggering, which means it won=E2=80=99t be shared with = other interrupt sources, Is this true? I think the spec does not forbid such usages, e.g using=20 the same MSI address/command for different queues or devices? > so masking/unmasking won=E2=80=99t be used for normal interrupt managem= ent logic. > 2) Linux virtio mmio transport layer doesn=E2=80=99t support suspend/r= esume yet, so there=E2=80=99s no need to quiesce the device by masking in= terrupts. Yes, but it's a limitation only for virtio mmio transport. We can add it. > 3) The legacy PCI 2.2 devices doesn=E2=80=99t support irq masking/unmas= king, so irq masking/unmasking may be optional operations. Yes, but as you said, it helps for performance and some other cases. I=20 still prefer to implement that consider it is not complex. If we do MSI=20 without masking/unmasking, I suspect we will implement MSI-X finally=20 somedays then maintaining MSI will become a burden... (still takes=20 virtio-pci as an example, it choose to implement MSI-X not MSI). > So we skipped support of irq masking/unmasking. We will recheck whether= irq masking/unmasking is mandatory for MMIO devices. > On the other hand, we may enhance the spec to define command codes for = masking/unmasking, and VMM may optionally support masking/unmasking. Yes, thanks. > > Thanks, > Gerry > >> Thanks >> >> >>>> 2) It's better to split notify_multiplexer out of MSI support to eas= e the reviewers (apply to spec patch as well) >>> Great suggestion, we will try to split the patch. >>> >>> Thanks, >>> Gerry >>> >>>> Thanks