Received: by 10.213.65.68 with SMTP id h4csp625575imn; Fri, 16 Mar 2018 13:41:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELuWPtFe09SJaisKNXFlg6Y61ds1h+VuKHy4DEVCAhaApjwx7jjiCr+jR0aVhtW4X8V1VnOX X-Received: by 2002:a17:902:7d93:: with SMTP id a19-v6mr3554274plm.160.1521232860030; Fri, 16 Mar 2018 13:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521232859; cv=none; d=google.com; s=arc-20160816; b=UaIb/C+l8iuDuKLKFpoqHyAnad2Ne02HlMQ8B09txlwfrvfBcfWGnVrIqpZWmoMrFY YnZ7AfrSXAJI8D+yo5DJS3Ax7/wANTldogWyT22G94VQyhh/yzEYBIQJ4w4pPbue7PVn /TBgposi9ZSOLGg4IaWyVtfUOPfnOV0YkUQneTRyr5SYE6fV8YO039v7o9xD/p/tr2BF NxRvZbUcXlEBQMAchevY2p7uoVoijDIaNWHMrSEuanowhAEy9rlWzdyDgxWKVx+fsNhp oL88htjMSFqcAFq0fDxXHszH52Ks4XiSd7fMxirhkHQ23++fJ2N2WNZ9mLKK/yB4gXkg Mj+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=Y+RJ/dzAVg5hDtv/vkoHPzOaHztYr7gjkMcpXSGovFo=; b=g/RBYvBqECm9eKP1KwKko+NaQyNjDWyys2Ewns418ad6WObljWHmsdzrK0tTcvnS1d OHhY8aNPcox9dRjckZOQCEVbPlhmuglfNg5JGQDy91kDboloT0zwFvRFLpeMpUuZ7yhm u7j8L15oehI+17inPanCthEFscMp/fdb/MSGWSRBEJzrfvWgJ8Z7BsX66xZ+kOD41HXB VVNtTQJgeuT0Tiiq7HEms4G3qM35KhdII9mY1H5w1+/Bc+f2oKRqDIzlWsE9M1ek16oS 5d3zaX1chKizRv60oNoCBkpkW1rmF9zehQ6q2r2XHncpvfcNiJYSkPUy3ADhDr8zywux jEqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=oxSAQ1fh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6-v6si6772759pll.328.2018.03.16.13.40.46; Fri, 16 Mar 2018 13:40:59 -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; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=oxSAQ1fh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753546AbeCPUh4 (ORCPT + 99 others); Fri, 16 Mar 2018 16:37:56 -0400 Received: from mail-by2nam03on0050.outbound.protection.outlook.com ([104.47.42.50]:52192 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751672AbeCPUhw (ORCPT ); Fri, 16 Mar 2018 16:37:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Y+RJ/dzAVg5hDtv/vkoHPzOaHztYr7gjkMcpXSGovFo=; b=oxSAQ1fhobrsFhr1xayD/itaLrA7DQwxUZTrbKawtfaRdlZc0EAqE93S9smw27NSZ4SnJowFmvMABesN0q6hk1pa3ly9F4WUAz5lrg/YfV5KNv0/gsITmePn7cNha7QRlwQUckkqk9L95M7lGmP7rLlJOGzQ7ZMS8Gj+jZgfSzI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-pyp0.amd.com (165.204.77.1) by MWHPR12MB1776.namprd12.prod.outlook.com (2603:10b6:300:113::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Fri, 16 Mar 2018 20:37:49 +0000 From: Babu Moger To: joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, babu.moger@amd.com Subject: [PATCH v2 0/5] KVM: x86: Implement Pause Loop Exit for SVM Date: Fri, 16 Mar 2018 16:37:21 -0400 Message-Id: <1521232646-79580-1-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR17CA0018.namprd17.prod.outlook.com (2603:10b6:404:65::28) To MWHPR12MB1776.namprd12.prod.outlook.com (2603:10b6:300:113::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f2036fe8-3a60-4902-5bf5-08d58b7dc92e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:MWHPR12MB1776; X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1776;3:QsVmUPDlNnbuotJupIAr6YY+208Jd2CU3qnythd7IIbI3mHz8NjZYWeZpNgABzPNQ3QnixUgO0BmZ9lG2VfchjOBwuln7UjNKNQS1CxPYl6NEcV6l3Sq7PHjS1oVab+lZ4cfnbOYCXu4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VdGl7VcMKb5CerNU5yDBTMna51uA6JkLXWgmR6p+MgIylsKqOwEmtUAaCHxtU84HYWPg00Vtq6x40Y9OjIxT+8/ybG+IoAHV+fQUtOpD7sXW7GWxNFouAFb1yfkna9rwn/5TQQIyogy5eY8tgmRXPvS9MRyJtXOE5cf5NR1QqUq03pHIkzMxiJbwPxIobrNzMSoIXuBBPN6;4:+cH3UrLJz5Idn6DmxqOS3xVG7Cjnh8sqRpQgnvtaMHIWTDg1+Ug0VxOHpoL5CQS/uURAngjJQVXxYa6tsLvLG8itM653ZgLGIGTRCqL9hv17FqV6l4uWIgDKJ9RrUJguskLX+kZ8Dz/uTdZeKyEs3I9vis0FoZHfHzQVYFF3R88OQHDX86NiUfFLXE5Xpev8XUT65XXj2XPWVd46yOX2BKkM+HcroC/sh0Va2KCVf8acpdUSuuMRyZ380QlzhGgN/rg1ttEScnQnxBAXgj3H/w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501244)(52105095)(3002001)(10201501046)(6055026)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MWHPR12MB1776;BCL:0;PCL:0;RULEID:;SRVR:MWHPR12MB1776; X-Forefront-PRVS: 0613912E23 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(376002)(396003)(366004)(39860400002)(346002)(39380400002)(189003)(199004)(81166006)(8676002)(81156014)(50226002)(6116002)(7736002)(186003)(16526019)(3846002)(26005)(305945005)(106356001)(16586007)(478600001)(4720700003)(386003)(6666003)(25786009)(316002)(66066001)(97736004)(8936002)(4326008)(50466002)(48376002)(52116002)(51416003)(7696005)(68736007)(53936002)(72206003)(36756003)(105586002)(53416004)(2906002)(6486002)(47776003)(5660300001)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR12MB1776;H:linux-pyp0.amd.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR12MB1776;23:bOh7wMNZR/CMnyhm7LSn+tV0rs9R/gQkuCFNfhE0Z?= =?us-ascii?Q?hdpeiSSEk6WtHFiJzKdFePmVTgJD5O13uuYr9esY2Aus4BZzGvFBrWUmbBVy?= =?us-ascii?Q?NtuKA0eBUCbx+5fHK6UlCr3W4fbqNfR8vDsn4xtRirT0YCiIy6Yxl2m/cFgA?= =?us-ascii?Q?kdgQlm0VvstbbjmcxXOU179ipXjnVZwsGRaILn0UEK/MXh1W3mvO7VvzPUKQ?= =?us-ascii?Q?XDVX1EZK9GluH6Kv8VMiPZ8Dt3yASMUf8JonUSAnCFWm5xM6BPKcQbDVFojd?= =?us-ascii?Q?KVc8YpSaHXTrg95GIXgMxWdodJxGX85+Yk6t2DNywSr0uzKSxSThLcm0I0tA?= =?us-ascii?Q?o6iKwtMqeq7uGdY58eqPMSG9OS1dL9fmVedrG7Ag9z/gTiqKyDfkvOciOpBk?= =?us-ascii?Q?ETG8CTf9uP8HJFQMM3jGl4fc2789RxE5fM06fYEREBCeHpJYPUkgNVBKTYBG?= =?us-ascii?Q?CqDNvmTxqOHCeEb3Y/1vC4QibnHzj+twD7h8ugohIZ4Iu39clVB37lk1OfRw?= =?us-ascii?Q?fRybcMV6IQ3iku75SMp4aOkItgBT45p0A+U3D6rUdFKl9aRpt6PTGguOFBpX?= =?us-ascii?Q?0cCyyV0jeMDoTt9eSl13I225pTvxbVRKPEJLmEwTIwIO17796bAMIpgyD29y?= =?us-ascii?Q?Nsvf7UGskBmfuCIZj6xtXSNQ6Ibe7vcBp4iIUKWtCW0wz28Q0oLda0utgSlh?= =?us-ascii?Q?epUYFtrEMKpMLnVRjxB9bfkOcWar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sl9D7RaDFchzkPSpgHUTx4MtNQyDjt8BaxtjXuH2JvJM7fNetQU2TxW9x2bbM5LmymOggdK4yO+k2b0w+ywbXP1RpZnPihcL3zpoqQajGkOtKnTa7N5/1SpqCiiQzZPLeo7aRZJO9ChnDTb9eVRkoj0r2gw=;24:5q6J/98LsYjEdQHqKLE0IZdNM5DVJDYO06kCbID5V5ZuiZ3QXG7SW9Tz/ixF5alIvVPgogkNFULzX1wDJ69KoqQ40V9LnISOFK6KAIa+JwI=;7:NRy/x+OOXHWMLIDDEdMwrAPagGMahIUTnjcMqAO39CJ5rd44Ddjsr1TYXSDHxTzggBeHN6R5wrB0yL2rF8Yh9aZhoU/2Ht3R6WtDNqExXCgsXbZiTtRG2uU9kspNSkyBoNGaUSYcHGIPBzoElBm/Rc8o1QNUL9ddCWrGcZSu2wnsinxVezvqW4m7lcFFN0VHDrxr1QtM+YNTQDHsKuIoFY40upAwWzNy3bjJzfJGJkG/FlziKZaoVuQeYjllc02+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1776;20:JvN7PWwyQvb0L2LVd6pebw185TSLfBPx5lyY37Vfebi9b/i16m1NIe4BQifMZKm+addw/y529zvZCd+lWtF6Q7H+hGxmngeNX1J1+c0cJ4SlZDpI+mLmGN+l1gJ5SAnFdBM97tlWujA+JzPynbP2voVdIZQ5O3hqsy2HzhwXli6bfh0AqGcVZuKoiLfuWCgYOC2799RHlS8b/FislurXAkbTAQ4Ia8K4s8Da2X1gbu6+cxiZ9ofZ1McF67kMBrt9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2018 20:37:49.0537 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f2036fe8-3a60-4902-5bf5-08d58b7dc92e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1776 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds PLE(pause loop exit) logic from VMX to SVM. We have noticed considerable reduction in number of VMEXITS due to pause interceptions after these changes. Here are the numbers on one guest with 32 vcpus on AMD EPYC system. We have used boot parameter idle=poll to simulate extensive pauses on the guest. Here are VMEXITS in 10 seconds interval. #VMEXITS(in 10s) Before the change After the change Pauses 810199 504 Total 882184 325415 v2: Handled most of the Radim's comments. Here are the changes. 1. Fixed the module parameters to unsigned variants 1. Kept the default pause_filter_count = 3000 for AMD. 2. Removed the ple_window_actual_max parameter. Added a check in __grow_ple_window to avoid overflow. 3. Fixed the naming conventions for SVM module parameters. They are now called as pause_filter_count, pause_filter_thresh, pause_filter_shrink and pause_filter_grow. 4. Taken care of intercept setting and clearing. 5. Fixed few more text changes. v1: Initial RFC version Babu Moger (5): KVM: VMX: Fix the module parameters for vmx KVM: VMX: Remove ple_window_actual_max KVM: VMX: Bring the common code to header file KVM: SVM: Add pause filter threshold KVM: SVM: Implement pause loop exit logic in SVM arch/x86/include/asm/svm.h | 3 +- arch/x86/kvm/svm.c | 108 ++++++++++++++++++++++++++++++++++++++++++++- arch/x86/kvm/vmx.c | 82 +++++++--------------------------- arch/x86/kvm/x86.h | 37 ++++++++++++++++ 4 files changed, 161 insertions(+), 69 deletions(-) -- 1.8.3.1