Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2F6EC433F5 for ; Mon, 11 Oct 2021 18:06:37 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 9636E60E94 for ; Mon, 11 Oct 2021 18:06:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9636E60E94 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.206450.362028 (Exim 4.92) (envelope-from ) id 1mZzgy-0005t6-Rn; Mon, 11 Oct 2021 18:06:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 206450.362028; Mon, 11 Oct 2021 18:06:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mZzgy-0005sz-OP; Mon, 11 Oct 2021 18:06:28 +0000 Received: by outflank-mailman (input) for mailman id 206450; Mon, 11 Oct 2021 18:06:27 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mZzgx-0005qd-Le for xen-devel@lists.xenproject.org; Mon, 11 Oct 2021 18:06:27 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f35f8330-2abd-11ec-80ee-12813bfff9fa; Mon, 11 Oct 2021 18:06:26 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f35f8330-2abd-11ec-80ee-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1633975586; h=from:to:cc:subject:date:message-id:mime-version; bh=6l4sucSPMUqJsOfp/047IHE/7+bYZodn28EqnpvUcYo=; b=PnSN8GrCF//ZXQW8AHFYrI6FTdT6VFBhLRXzG4FxZB8YtlSfgpYGmLxk hPAt1Ve8rYf0Hh4US3CHFe4zLPnNQ+UMUM9WbDBUdYfIyQgqNo3K7Wts2 0iuoJ5L7NapDHJO4L72Z5spFsrqtDMIGgA8b3mOKbrsr4w9liKpmWR3LS Y=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: +ogEBk8GCsDXjYLs6PWZGIh+8G2yISCEm2dHnVn3ySIQ3uXhEAGv+JiEPyzXv924mf3EnoyQ8q Ero9A1bbJM/yhs9Ab5ffKj92Snmn3v+bEU38k2cJubItZo29cj6f0R2b2Ot8p0mKKrAn1dBGj6 +X3WEz0QRsqxKs5dWTUAvwHdGR8SfZk4Etx5QX6ot83fRYs0DDTQ2oLAHUvvnadtracV3g0BhK 3yBwqv4N5d/7B9ozw50h3WHRoXGUwqDRInOGrpemf+9qkLWQslxin6ug6GplNwLRpvYxZgCr03 5Z2Qu7OVSZUkb11BKRPN9O/Z X-SBRS: 5.1 X-MesageID: 55311564 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:v4/QG6Na1L5tGBzvrR2NkMFynXyQoLVcMsEvi/4bfWQNrUpz3z0Fn DEdCz3SOPvfMzTwLdgkYIjioB9QvsLUnIAyQAto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCY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6JOF16Ox5wPdoZ PAZYMHcUO9XQzHK9m1FP5nwpYBvbjqxggeKM3b3aTQzZcc4FQfI5sXlbk3k8yxXVni7ss43o ruB0ALHQMVcG1Q+XZiOMP/2lgG/p3kQnu52TnDkGNgLdRW+6pVuJgzwkuQzf5MGJyLcy2bIz A2RGxoZ+7XA+tdn7NnTiKmYhI61CO8iTFFCFmzW4LvqZynX+m2vnd1JXOqSJG2PUWr1/OOpZ PlPzuG6O/oCxQ4Yv415Grdt7KQ/+9qw+OMKklU6RC3GPwaxF7dtAniaxs0e5KRCy4hQtRayR k/SqMJRPq+EOZ+9HVMcTOb/gj9vCR3AduHu0MkI IronPort-HdrOrdr: A9a23:EToQC6EGnTFVO4TCpLqE7MeALOsnbusQ8zAXPidKOHtom62j5q STdZEgviMc5wx8ZJhNo7+90cq7IU80l6Qa3WB5B97LNmTbUQCTTb1K3M/PxCDhBj271sM179 YET0GmMqySMbGtt7eZ3DWF X-IronPort-AV: E=Sophos;i="5.85,365,1624334400"; d="scan'208";a="55311564" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper Subject: [PATCH 0/1] x86/pv: Split pv_hypercall() in two Date: Mon, 11 Oct 2021 19:05:40 +0100 Message-ID: <20211011180541.24501-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain Full perf anlaysis. Time is raw TSC cycles for a xen_version() hypercall, compared across the change in patch 1, with obvious obvious outliers excluded. i.e. Idealised best case improvement. Some general notes. pv64 is `syscall`, while pv32 is `int $0x82` and therefore has more overhead to begin with. Consequently, dropping two lfences is less of an overall change in the path. First, AMD Milan (Zen3): $ ministat -A milan-hcall-pv64-{before,after} x milan-hcall-pv64-before + milan-hcall-pv64-after N Min Max Median Avg Stddev x 98 420 460 440 438.97959 6.6564899 + 98 360 440 380 370.81633 12.57337 Difference at 95.0% confidence -68.1633 +/- 2.81674 -15.5277% +/- 0.641656% (Student's t, pooled s = 10.0598) $ ministat -A milan-hcall-pv32-{before,after} x milan-hcall-pv32-before + milan-hcall-pv32-after N Min Max Median Avg Stddev x 98 1900 2100 1980 1984.2857 22.291416 + 96 1740 1960 1760 1767.5 35.688713 Difference at 95.0% confidence -216.786 +/- 8.35522 -10.9251% +/- 0.421069% (Student's t, pooled s = 29.6859) Second, AMD Naples (Zen1): $ ministat -A naples-hcall-pv64-{before,after} x naples-hcall-pv64-before + naples-hcall-pv64-after N Min Max Median Avg Stddev x 97 294 336 315 311.75258 10.207259 + 97 252 273 252 257.41237 9.2328135 Difference at 95.0% confidence -54.3402 +/- 2.73904 -17.4306% +/- 0.878593% (Student's t, pooled s = 9.73224) $ ministat -A naples-hcall-pv32-{before,after} x naples-hcall-pv32-before + naples-hcall-pv32-after N Min Max Median Avg Stddev x 98 1260 1470 1260 1276.2857 42.913483 + 95 1218 1470 1239 1250.9368 52.491298 Difference at 95.0% confidence -25.3489 +/- 13.5082 -1.98614% +/- 1.0584% (Student's t, pooled s = 47.8673) Third, Intel Coffeelake-R: $ ministat -A cflr-hcall-pv64-{before,after} x cflr-hcall-pv64-before + cflr-hcall-pv64-after N Min Max Median Avg Stddev x 100 774 1024 792 825.04 73.608563 + 95 734 966 756 787.74737 70.580114 Difference at 95.0% confidence -37.2926 +/- 20.2602 -4.5201% +/- 2.45567% (Student's t, pooled s = 72.1494) $ ministat -A cflr-hcall-pv32-{before,after} x cflr-hcall-pv32-before + cflr-hcall-pv32-after N Min Max Median Avg Stddev x 100 2176 3816 2198 2288.84 196.18218 + 99 2180 2434 2198 2232.4646 75.867677 Difference at 95.0% confidence -56.3754 +/- 41.4084 -2.46305% +/- 1.80914% (Student's t, pooled s = 149.013) Fourth, Intel Skylake Server: $ ministat -A skx-hcall-pv64-{before,after} x skx-hcall-pv64-before + skx-hcall-pv64-after N Min Max Median Avg Stddev x 99 5642 5720 5686 5686.303 17.909896 + 98 5520 5544 5540 5536.0816 8.20821 Difference at 95.0% confidence -150.221 +/- 3.89729 -2.64181% +/- 0.0685382% (Student's t, pooled s = 13.9542) $ ministat -A skx-hcall-pv32-{before,after} x skx-hcall-pv32-before + skx-hcall-pv32-after N Min Max Median Avg Stddev x 99 9296 9500 9308 9309.3131 20.418402 + 96 9110 9266 9180 9175.2292 27.860358 Difference at 95.0% confidence -134.084 +/- 6.84111 -1.44032% +/- 0.0734868% (Student's t, pooled s = 24.3673) I'm honestly not sure why Naples PV32's improvement is so small, but I've double checked the numbers. Clearly there's something on the `int $0x82` path which is radically higher overhead on Naples vs Milan. For the Intel numbers, both setups are writing to MSR_SPEC_CTRL on entry/exit, but for Skylake it is the microcode implementation whereas for CLF-R, it is the hardware implemenation. Skylake has XPTI adding further overhead to the paths. Andrew Cooper (1): x86/pv: Split pv_hypercall() in two xen/arch/x86/pv/hypercall.c | 24 +++++++++++++++++++----- xen/arch/x86/pv/traps.c | 11 ----------- 2 files changed, 19 insertions(+), 16 deletions(-) -- 2.11.0