Received: by 10.213.65.68 with SMTP id h4csp625043imn; Fri, 16 Mar 2018 13:40:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELvv99yjtfeKyt51Tnf9zvGMUNLMNH0BkUbSNDylMG34eaoBv53JaPGHSpamz28iUFxpec5l X-Received: by 2002:a17:902:983:: with SMTP id 3-v6mr3572149pln.278.1521232801376; Fri, 16 Mar 2018 13:40:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521232801; cv=none; d=google.com; s=arc-20160816; b=erwPL4OzRs0J+zwGIO7CM9HPOBwviBpUqgg5BEgmL2aoaDwKLgaE14apA7DLzn9Gf4 qC6YM65gNohY0hiDsdIl3FH/iUPkT1TzVh6Da4tUzRyfHRV5O88Vl0SLCtRdw3ifS6Nz 8KWz+2/TpH5vtzLePLPMv0x3qEHHorAA28TumrgXlgRrI9xpw/XohWhq6yU1i6jXF3SG Cook+D+PkXSRfGEyNE/poJxXrpEV5Gg/2bcWITRGMOlqHtaC7DxCV2gV87FOgJQ40RdN 0ijwdJZUzaXpzZmwXfsH87CjsKHhYw114nB9ytnHCz7RYzXeOyrCdO7rEMKzlTQkh1M/ B4lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=bR49wDvWJs4Fcwhr1qCq2voCMCAb+TRF+2Iwoc0rODk=; b=VTtSNe5ttF/qi/LqXRUpHkRfzHno+bAj/GaOSPxl9o9/S3EVSO1aI0R4C7hr3ZPFzQ +nr8ir2KZWXXazB+iXbVV06BubMSoY7k99/T+OiTftzUI4n4Fz47v55gw5CipmlxW6IC lZUf6ojuX6R+ohX7IF2LOpWLqnmlZsy1n2iAo1hcA2v0Bw8ZhQIAdccuUjb48LI2+ECg 8fDwLDT11zFzQz4bpOLaVcjlp5x4OrYYX3hv0xUefIxpgZlviu7DjeKyP7gfd4od0009 LpxvjctbwGfbLc8YF5jWwkAs6OWlCe0mIAPS/5NOcK+IPpUiave4kOEfQ05hDLyNaQ51 gEtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=BSNPSfFH; 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 v3-v6si6847548plo.32.2018.03.16.13.39.47; Fri, 16 Mar 2018 13:40:01 -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=BSNPSfFH; 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 S932354AbeCPUiC (ORCPT + 99 others); Fri, 16 Mar 2018 16:38:02 -0400 Received: from mail-by2nam03on0059.outbound.protection.outlook.com ([104.47.42.59]:55584 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753536AbeCPUh4 (ORCPT ); Fri, 16 Mar 2018 16:37:56 -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=bR49wDvWJs4Fcwhr1qCq2voCMCAb+TRF+2Iwoc0rODk=; b=BSNPSfFHthBloteMKK7bVjFaVF7y0Oifn2D7oYzvcpfefCs2GU7K/qR587mGhuoajObxFRA+2zlsuEiQL6XCHLaB25Htwoy5KLTB8qZ1SOdgBLP6XMz0x4bpbhCpCmNPKr58A463hUIXrQ0u7o9lbyFFYSt+rrFq3UorGS9WvfI= 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:52 +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 2/5] KVM: VMX: Remove ple_window_actual_max Date: Fri, 16 Mar 2018 16:37:23 -0400 Message-Id: <1521232646-79580-3-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1521232646-79580-1-git-send-email-babu.moger@amd.com> References: <1521232646-79580-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: 12150ad9-4e78-422e-5062-08d58b7dcb6f 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:/MXoBzoUKK22vFvsP6mH+canABAXI81fsCiBoc2342U8FIYtJWTBYps6Kz35ljEeKZm0gPNOGaecdPbNvXtEYz0Rgw0iVU3rN9U0etRpnffdYXsqvccGY7toEpdJ+IIGhnFlD+4jm23LaPKBWYnvQy+9t/WRHPVJ0DWXp7aVOJlkFJVmsQ7x5hlNeT1D6B85Q5PulELheg3xvsLZb5r/2sjuKWNuMzTaWrdko3UBkBBG/2blK7HqfcDUG09PSSxG;25:9VFA2yo5wl2JwN/Gz7bwvKJHEJf9aGk3Ib7QPj9TBukXLCZbyV68eFFpuSfYEKUzXTxoaOzAQvMTEbhCNmP2MElaIblw0WC6BF07C9rhgJlbXo+nWNnAnLoElob/fkayawoYOx0tQc39KBRwoiQPNlU4/Ej79g6i7R23QQVvH8CY7MYGdnlMBuo+mGHUZJ+uCzlDSD08LLJhL1c2rkqODAekDAa1EivrEoQMHq9JWl5gXnTxXF4Qa9nz+E+hV8407OHwO+RKEWry6EPkzDKWSDfstelHOrjKhqtZZpv4arGHtWeVjL+woUqy71U6GE9OGU7HVJuQSwv1N84ffS5Apg==;31:GvARgqrBoY58drV+2OulmlLN7KINh76MUZUIVWThJflUYpVVvRT/gSPq+gV7kLuhUVx4YYaMs80Pz59eaMZdgovl6RLSptdhfCp8pvySncE9f0kYJr8ALZSQfW1QbzkyXW6txJY9o35NHgNtyvCamMHQha74qKfs5n0WomPMObBgDLOw86rBnwyqm1emnzuMwlVxS3Z16V+usXe86g3Mcwi1UhhqTD8qxMZePlDi+xs= X-MS-TrafficTypeDiagnostic: MWHPR12MB1776: X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1776;20:fKCqaBJYyTTHISiQ6xWw8tg/Wlh68tAdUhKr+dysJqsY4KpuU0dQOzZ7YEge4O1F8TB2p4/Q9GmbqqstOl99cYUVPSzYt+uscey1HakTaP1BFRoheCxIaJTCysa10ceBMMYKSaSdvtzsJh06+dJnK8z2RJ5psSrAp55+0bYPtnXXsplv7qj3V6ijAY+HuG6IHauMdBoksgdqx9QqCzjJssslBqIrgY6GMpeYhjcIqIjFCX8Ea49w5GBH+eoR7m2NwRgMYs4h9/yY40LnrbB/fECGG8SbdA5TeswrXZgNVZLW0/h486T5hKMLIL4grhXBn+K9rfIeOkJeeJ3jGwThqfC+LjjCK03X+aGYcjt6IoxKUOSwT9Sgrp7NwWZccr+3avUe91RaabZNCugrxFis9928lqSegKjAQCAc030HGV46gagnZHM4BcbjNnxIWxO8cBqhbf5XcfHkEPszczoUM/pvPK6s64h0i01jPZqF+QgzNjgIBAzzPglbKwJ0tKb/;4:tPKDSGjc/6i9UFAVODaoSio4cz3qAUKz/DxVw6+ACddUhn98qXWP7lDZ3NoYz4U7X8mT2pz/emn/DaVAgHL91FTx9eH8BRcr/D9DK0c3hxkQ25Vh3dxD/MhtIntPTA8TQBbKRXJ6GCNalV/2ftlQHYW648xNdIvkbGfW6uDBe77oDBC3Jjra1IRjjwBeqb6MQ89whqdOw+19Dhy2aM6gdN01uMNsXlk3bQGT6W4UT9ig23dCq8dBTE0W9CL13H176QAKWce7Sn28wSU0gdJMuMMd/M9sL53QP5cQ5CdgTOyR8dhzvdSC3sxzBP6OceUC X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); 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)(2950100002)(478600001)(4720700003)(386003)(6666003)(25786009)(316002)(59450400001)(66066001)(97736004)(8936002)(4326008)(50466002)(23676004)(52116002)(7696005)(68736007)(53936002)(76176011)(72206003)(36756003)(2870700001)(105586002)(53416004)(2906002)(6486002)(47776003)(5660300001)(86362001)(358055004);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: =?utf-8?B?MTtNV0hQUjEyTUIxNzc2OzIzOlI1TU5aMVNCMldva01QUmcxdnB5cE5wTDlr?= =?utf-8?B?dVVyNkFvLzAvTm9yM0h5bmFxOWZ4MExSeU9NWFRWb2VDSmRFbDVyYkN5UTE4?= =?utf-8?B?TkNBdmNodVczTFhwakJjLzFGWTI5aC9JTndqbjQzRWRINTFLQWh4VWVtRVNv?= =?utf-8?B?a0RiMUlvbk1MdUZOcVluRzhVTjhabzJ4QmE2Z201TEFTY092SjFidlVOQVpV?= =?utf-8?B?WTNWRlBreEVKdzhYVGQ2d3hwaXlMeUp3QnE4eG9qQW5mTzU2UmZIN2dhekVr?= =?utf-8?B?WTMwTS9KSnE0bkNWd0ZDMm1IMkszUlFyRFlXYzF3QnA3aDVmZ0gycmVnNGtR?= =?utf-8?B?ZWtHWHB5ckFleXJ0d2JPUTZsWXhWRkZlRE95TUw5cFdZYTdJek1aWHNEVTgr?= =?utf-8?B?SDV2aWU5MUpvMHFTQWdYVkN3SzVIaGI1U1pRa1pXMzhzSW1oWFZVWlVkbnZl?= =?utf-8?B?YlRadjB0YUxHdGlmSFpHV3UyVmQ5MWZ1UTUxd2tIY3E3SnZHcU0yK1lyRzkz?= =?utf-8?B?SndKTGx1OHVSUEFUUXdVb1IwdjIrSjRNeWxRZ1RnZnBRa3UrTk80bmlhWHg3?= =?utf-8?B?M2F2Z0wrSGhpQjVtTHo3Z3hJQ0lt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BN9FnVA0vSIqlh41dg+VFsW0opwOFsUpO7BoDnb3VNdbwlKQiRctr9P8/cp9lx48wykJXEzUe7atRe0BkIaSfAO28X8cbFZ9uIqUTNk3ObDsnvbr387SMiF/VbSb7peZrlaSRK0CG9LerdpMpaZx+bmnLn0Tz71M256D8qB1GdONj9xO8R8ElfKQVgpqRF6K6dip SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1776;20:rKoheN1ILhNeIVxUBHR65aCbj+dbvG5uyPa/gjgv+WkO5AsTVvkRS940qJwCYurcefLkQWTlTj2X8a1ROo3djzOH51QXQ/8CKqsOo++s/VS9WkyBGENkSE2LdbVHQ0ixMOyGR3dEA7M+5trpOzRcbxUpyiZpT6jV9b5/irKFzmk6mk4ctT9OlcBk9pzwmpKeWYeGN/hEm8kNrWmr60KvoZLYpBO7bCOO/T7sHpRTmolEHN0rjE4fUKeJlE2x36s4 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2018 20:37:52.8348 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12150ad9-4e78-422e-5062-08d58b7dcb6f 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 Get rid of ple_window_actual_max, because its benefits are really minuscule and the logic is complicated. The overflows(and underflow) are controlled in __ple_window_grow and _ple_window_shrink respectively. Suggested-by: Radim Krčmář Signed-off-by: Babu Moger --- arch/x86/kvm/vmx.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c9a9080..b992d81 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -178,7 +178,6 @@ module_param(ple_window_shrink, uint, 0444); /* Default is to compute the maximum so we can never overflow. */ -static uint ple_window_actual_max = KVM_VMX_DEFAULT_PLE_WINDOW_MAX; static uint ple_window_max = KVM_VMX_DEFAULT_PLE_WINDOW_MAX; module_param(ple_window_max, uint, 0444); @@ -6645,14 +6644,12 @@ static uint __grow_ple_window(uint val) if (ple_window_grow < 1) return ple_window; - val = min(val, ple_window_actual_max); - if (ple_window_grow < ple_window) val *= ple_window_grow; else val += ple_window_grow; - return val; + return min(val, ple_window_max); } static uint __shrink_ple_window(uint val, uint modifier, uint minimum) @@ -6696,21 +6693,6 @@ static void shrink_ple_window(struct kvm_vcpu *vcpu) } /* - * ple_window_actual_max is computed to be one grow_ple_window() below - * ple_window_max. (See __grow_ple_window for the reason.) - * This prevents overflows, because ple_window_max is int. - * ple_window_max effectively rounded down to a multiple of ple_window_grow in - * this process. - * ple_window_max is also prevented from setting vmx->ple_window < ple_window. - */ -static void update_ple_window_actual_max(void) -{ - ple_window_actual_max = - __shrink_ple_window(max(ple_window_max, ple_window), - ple_window_grow, INT_MIN); -} - -/* * Handler for POSTED_INTERRUPT_WAKEUP_VECTOR. */ static void wakeup_handler(void) @@ -6876,8 +6858,6 @@ static __init int hardware_setup(void) else kvm_disable_tdp(); - update_ple_window_actual_max(); - /* * Only enable PML when hardware supports PML feature, and both EPT * and EPT A/D bit features are enabled -- PML depends on them to work. -- 1.8.3.1