Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4092764img; Tue, 26 Mar 2019 02:53:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqztWiq1S2Zq4HtBJwOM38a1Fy6c4nr7S0yUy+VvHQ0Od8XjAoqPLjbxDi5WOtXpBV3YqtDC X-Received: by 2002:a65:51c5:: with SMTP id i5mr843593pgq.189.1553593983435; Tue, 26 Mar 2019 02:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553593983; cv=none; d=google.com; s=arc-20160816; b=0+058gPz/n0yWVMjv4AbgiMR1flzxRK180vJ8DYgv8sGDcr5/JxBpizQAbIbRZ/73s YOjA8UgZs2PnhjjbYZoNJuDXnpqq9rz9tCRXe7tmLHv532/14O71PmOvdLNhPN2FC1c+ iJbTOrZux9ouYQW6cAptYonIM/1qtzr7L6FehuDmCHAQXeUErYD82Elu7VMAVca3w31H 81oONwcV8XUabLqPdLtv34jNM64H6B0TMoGqnnqS1xE/HtHjMLxHxcxCQZPjNFGDA9KS +1wFfrcCmFEH4qfn7y00op7Veh3qPNOuc9S75nqy7Wy5IND+dFEYMiJTkVHlVrfAy7y0 iAJw== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=C/Oa9w8rQyYiNn4d7evd/SZMAgN3XsxxY8wv0qHwxFk=; b=ARkykic0IVH02iHMcic9OESrinOjZBDSZ4fKzLVXaV9Ydl5FCkbUAFPTGShIy3Q9pV ac9PESyX0BlDxoJcCKMFSrPFINi8EM7Y8B3uPjsNpAUK6vuJewwKhuxIWxRQK8t1PXZu VLf0GHWtlHmFwSRksoYHq8CCQAZrECHDb2Eb+IFYRoerJrTjB35x53kOu6xJyPivXfr9 ICl6ZkugAhFOkaBPBlKifzHqYZ/6j/B8DIlQR7wnjSpm5Sbp/uEKctunKVcWJF86ZNDl ZeD5nK2yHBIm3Kqjo74A+MQdnaq/nUOiQSjnOlGFj0+ldH+lca5bzekTiNdMBwi6t6ks bbyQ== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si6703792pfi.214.2019.03.26.02.52.48; Tue, 26 Mar 2019 02:53:03 -0700 (PDT) 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727617AbfCZJu4 (ORCPT + 99 others); Tue, 26 Mar 2019 05:50:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45170 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfCZJu4 (ORCPT ); Tue, 26 Mar 2019 05:50:56 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C10CF308620D; Tue, 26 Mar 2019 09:50:55 +0000 (UTC) Received: from dhcp-4-67.tlv.redhat.com (dhcp-4-67.tlv.redhat.com [10.35.4.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id B16FA1712F; Tue, 26 Mar 2019 09:50:48 +0000 (UTC) Message-ID: Subject: Re: [PATCH 0/9] RFC: NVME VFIO mediated device [BENCHMARKS] From: Maxim Levitsky To: Stefan Hajnoczi Cc: linux-nvme@lists.infradead.org, Fam Zheng , Keith Busch , Sagi Grimberg , kvm@vger.kernel.org, Wolfram Sang , Greg Kroah-Hartman , Liang Cunming , Nicolas Ferre , linux-kernel@vger.kernel.org, Kirti Wankhede , "David S . Miller" , Jens Axboe , Alex Williamson , John Ferlan , Mauro Carvalho Chehab , Paolo Bonzini , Liu Changpeng , "Paul E . McKenney" , Amnon Ilan , Christoph Hellwig Date: Tue, 26 Mar 2019 11:50:47 +0200 In-Reply-To: <20190326093858.GI21018@stefanha-x1.localdomain> References: <20190319144116.400-1-mlevitsk@redhat.com> <20190326093858.GI21018@stefanha-x1.localdomain> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 26 Mar 2019 09:50:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-03-26 at 09:38 +0000, Stefan Hajnoczi wrote: > On Mon, Mar 25, 2019 at 08:52:32PM +0200, Maxim Levitsky wrote: > > Hi > > > > This is first round of benchmarks. > > > > The system is Intel(R) Xeon(R) Gold 6128 CPU @ 3.40GHz > > > > The system has 2 numa nodes, but only cpus and memory from node 0 were used to > > avoid noise from numa. > > > > The SSD is IntelĀ® Optaneā„¢ SSD 900P Series, 280 GB version > > > > > > https://ark.intel.com/content/www/us/en/ark/products/123628/intel-optane-ssd-900p-series-280gb-1-2-height-pcie-x4-20nm-3d-xpoint.html > > > > > > ** Latency benchmark with no interrupts at all ** > > > > spdk was complited with fio plugin in the host and in the guest. > > spdk was first run in the host > > then vm was started with one of spdk,pci passthrough, mdev and inside the > > vm spdk was run with fio plugin. > > > > spdk was taken from my branch on gitlab, and fio was complied from source for > > 3.4 branch as needed by the spdk fio plugin. > > > > The following spdk command line was used: > > > > $WORK/fio/fio \ > > --name=job --runtime=40 --ramp_time=0 --time_based \ > > --filename="trtype=PCIe traddr=$DEVICE_FOR_FIO ns=1" --ioengine=spdk \ > > --direct=1 --rw=randread --bs=4K --cpus_allowed=0 \ > > --iodepth=1 --thread > > > > The average values for slat (submission latency), clat (completion latency) and > > its sum (slat+clat) were noted. > > > > The results: > > > > spdk fio host: > > 573 Mib/s - slat 112.00ns, clat 6.400us, lat 6.52ms > > 573 Mib/s - slat 111.50ns, clat 6.406us, lat 6.52ms > > > > > > pci passthough host/ > > spdk fio guest > > 571 Mib/s - slat 124.56ns, clat 6.422us lat 6.55ms > > 571 Mib/s - slat 122.86ns, clat 6.410us lat 6.53ms > > 570 Mib/s - slat 124.95ns, clat 6.425us lat 6.55ms > > > > spdk host/ > > spdk fio guest: > > 535 Mib/s - slat 125.00ns, clat 6.895us lat 7.02ms > > 534 Mib/s - slat 125.36ns, clat 6.896us lat 7.02ms > > 534 Mib/s - slat 125.82ns, clat 6.892us lat 7.02ms > > > > mdev host/ > > spdk fio guest: > > 534 Mib/s - slat 128.04ns, clat 6.902us lat 7.03ms > > 535 Mib/s - slat 126.97ns, clat 6.900us lat 7.03ms > > 535 Mib/s - slat 127.00ns, clat 6.898us lat 7.03ms > > > > > > As you see, native latency is 6.52ms, pci passthrough barely adds any latency, > > while both mdev/spdk added about (7.03/2 - 6.52) - 0.51ms/0.50ms of latency. > > Milliseconds is surprising. The SSD's spec says 10us read/write > latency. Did you mean microseconds? Yea, this is typo - all of this is microseconds. > > > > > In addtion to that I added few 'rdtsc' into my mdev driver to strategically > > capture the cycle count it takes it to do 3 things: > > > > 1. translate a just received command (till it is copied to the hardware > > submission queue) > > > > 2. receive a completion (divided by the number of completion received in one > > round of polling) > > > > 3. deliver an interupt to the guest (call to eventfd_signal) > > > > This is not the whole latency as there is also a latency between the point the > > submission entry is written and till it is visible on the polling cpu, plus > > latency till polling cpu gets to the code which reads the submission entry, > > and of course latency of interrupt delivery, but the above measurements mostly > > capture the latency I can control. > > > > The results are: > > > > commands translated : avg cycles: 459.844 avg time(usec): 0.135 > > commands completed : avg cycles: 354.61 avg time(usec): 0.104 > > interrupts sent : avg cycles: 590.227 avg time(usec): 0.174 > > > > avg time total: 0.413 usec > > > > All measurmenets done in the host kernel. the time calculated using tsc_khz > > kernel variable. > > > > The biggest take from this is that both spdk and my driver are very fast and > > overhead is just a thousand of cpu cycles give it or take. > > Nice! > > Stefan Best regards, Maxim Levitsky