Received: by 10.213.65.68 with SMTP id h4csp857983imn; Wed, 28 Mar 2018 14:20:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/1o7lWNjI89VJcKsuXPCOlFlextreVOna8jBJ5bNxKoYrxBbQK8vJiMemRoSA9Cv7lMJ6B X-Received: by 2002:a17:902:30f:: with SMTP id 15-v6mr5190437pld.365.1522272025067; Wed, 28 Mar 2018 14:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522272025; cv=none; d=google.com; s=arc-20160816; b=AdnOarUw/Shgp9eOuzv++dfh+1VoMJyd7ipB0fTTdqqhyhLwnSVsx4A7o020g8ehzV kO6wW7wBBObT8XGgyeFDTQ4rlo5iVerrJff8XXz/Kr14T7xjsU3TE3NnKzPrHn8f1xDe LQSJ3Ya+d135HjXIf05SxcaxdSa0G+nNpP44KJ5UkzYx/DS9ib74+t98ArjgUYlvW/YF 7UJ30AyS5a7aH9zCf/ckaHnTfJqepmTA7t6JtN2A/VWhXk5g3W13N8qtnMVMLJbL2dYE XDbGtEkA5d7ystEGF6u02IyTs70/8rLPH4Mjv2tlMRIKx45VGBoJCwgI3sdVIWnaarJJ pAbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=pzEAbI6WXxzeVbkb6KD8AJizpEGy3yoJzEaVRVkXvwY=; b=w1ffyd0bm+fQ3HAeksv5f0KCFl1qPsHo9vplAiT1059gkIU5JBRuiF8gOnTp1n1fcx duMdV3/uGutPTsB1JiLv5f15mY1WcEduxzTIrDTSHAHfZxoFpbmR6FYTmLCSPTR39YZb OxNAmSDyeItLPRSp47u5NHu5VFYBNcYFq2RHydMBBIprBUA6DuEdRSG82RAHOociSivy +OrcX6bKxmRG3PrmKu4jqCcu+FVXaUkiIOK+YVra7+BBiNKFIVMNQuXyZUMpAvOWC4vv 01TvaWa5QBxwCZ1F/czZGWlI5KzGi/1R1NRZL23AK5G25t6+b9gfB5k9y9sZoZpzc6l2 NX4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=t2u4u+Rk; 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 i4-v6si730072plt.264.2018.03.28.14.20.10; Wed, 28 Mar 2018 14:20:25 -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=t2u4u+Rk; 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 S1753293AbeC1VOL (ORCPT + 99 others); Wed, 28 Mar 2018 17:14:11 -0400 Received: from mail-sn1nam01on0044.outbound.protection.outlook.com ([104.47.32.44]:15136 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752447AbeC1VOJ (ORCPT ); Wed, 28 Mar 2018 17:14:09 -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=pzEAbI6WXxzeVbkb6KD8AJizpEGy3yoJzEaVRVkXvwY=; b=t2u4u+RkmUPMutK0eOFPmj2QwSeIR7IF545PMUOdKuyY/Klozu6B2SSWgRQQORm1c3/TR7mTgLOTvh+qTmVuCGQgivas3ICzRu+7mEhBpEF/K6gnIhwi8pnQVgc1Njf+3SL7b2CRzp/OJMgqqux4DDmZEqOmyz+Q2vVJ8u58wik= Received: from CY4PR12MB1768.namprd12.prod.outlook.com (10.175.63.10) by CY4PR12MB1926.namprd12.prod.outlook.com (10.175.82.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Wed, 28 Mar 2018 21:14:06 +0000 Received: from CY4PR12MB1768.namprd12.prod.outlook.com ([fe80::4873:8395:24d2:8f6f]) by CY4PR12MB1768.namprd12.prod.outlook.com ([fe80::4873:8395:24d2:8f6f%13]) with mapi id 15.20.0609.012; Wed, 28 Mar 2018 21:14:06 +0000 From: "Moger, Babu" To: =?iso-8859-2?Q?Radim_Kr=E8m=E1=F8?= CC: "joro@8bytes.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "pbonzini@redhat.com" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v2 5/5] KVM: SVM: Implement pause loop exit logic in SVM Thread-Topic: [PATCH v2 5/5] KVM: SVM: Implement pause loop exit logic in SVM Thread-Index: AQHTvWaz2NOsI7DuJ0Oj6ElmMltSFaPmLHWAgAALztA= Date: Wed, 28 Mar 2018 21:14:06 +0000 Message-ID: References: <1521232646-79580-1-git-send-email-babu.moger@amd.com> <1521232646-79580-6-git-send-email-babu.moger@amd.com> <20180328203036.GK26753@flask> In-Reply-To: <20180328203036.GK26753@flask> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; x-originating-ip: [165.204.77.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY4PR12MB1926;7:OLYTfb8ZyvqcYxLl298wReJeZDOVqPalRlbrkEjYXPeqa5HSxrcEHij+/3iT5OWRVOt9vHVZsyh9dTf4sMq/Hje+IDM5veaY6YnHS/EBdC5zq/a8g6K45YTslIUcDkxQge1duZpUXHEVdeyZ0RHyGseIUbdkdUTBFJrCciZNfMSRqL0aa86KcOsL6oYiSTGUG+aP3bFuEFxcrGdG6cD0j390Hm4M6oc82YOZg1MAtp87fCqqLKedoUeN+8wj1Sp7;20:zOE18BsKjlCuXL9YWh66n7wsinKruVeaWrL7oQyLKdGsQw6qKdeAdPYWCFGGGplCrr8Sp/XB9lkpn9zAP0XFtybS3y2BO/kNH6l9SK1VkDGbSWsro9xdTqQzbYCE+qXXwhtTPJmZwu6VOIWaUUqY/9h8IBuzxAvYhEKHaeFd8rO54Xb5+sNaVqo6K0YaP60c/2WtMhHNcJShjoBgDwMw1cpqyUdJmsUu0GzeGVC5mAK/TfLnnvObkVkyfC7X4je3 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: aec07374-6071-42a5-ecdc-08d594f0d6f9 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:CY4PR12MB1926; x-ms-traffictypediagnostic: CY4PR12MB1926: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863)(9452136761055)(767451399110); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:CY4PR12MB1926;BCL:0;PCL:0;RULEID:;SRVR:CY4PR12MB1926; x-forefront-prvs: 06259BA5A2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(396003)(346002)(366004)(39380400002)(39860400002)(13464003)(189003)(199004)(377424004)(4326008)(5660300001)(99286004)(316002)(2900100001)(54906003)(7736002)(478600001)(6916009)(33656002)(229853002)(305945005)(6246003)(25786009)(74316002)(53546011)(6506007)(66066001)(5250100002)(53936002)(76176011)(486005)(476003)(11346002)(26005)(486005)(105586002)(81156014)(102836004)(186003)(446003)(72206003)(2906002)(14454004)(68736007)(3660700001)(3280700002)(6116002)(7696005)(3846002)(8676002)(6436002)(81166006)(86362001)(8936002)(55016002)(9686003)(106356001)(97736004);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1926;H:CY4PR12MB1768.namprd12.prod.outlook.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-antispam-message-info: HMHwbfICo0q+etKL0jTNElwcr7g3LoGkofPc3aZYsbFygQvX0Ir7B05+Y/FSMoEallbuN37Vtw75S6svZv6jCrDAjdCN5SkHRJ9CZmZ29PHSo/5WP/Ic7LOic3TmimIs28CLcplRDd6fyylIr63s62sFn4TJFd8TJ4TALbSoY8QoxAGV7nj7ubBK6mZFqsakg/9iS/6ps33JL0+NremOJb+lb1H8U43PAj0h8cOriqtbOlNDZpAxe02uWcecxYbsbkWYIK1Mxc1NpGvnNE8salkQqoAgdRTWPeZQCo/8OKECO/Qi9b7l119BMSFjmec1t/A/qLGk4CtUAbgEeOhoSA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: aec07374-6071-42a5-ecdc-08d594f0d6f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Mar 2018 21:14:06.1933 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1926 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Radim Kr=E8m=E1=F8 > Sent: Wednesday, March 28, 2018 3:31 PM > To: Moger, Babu > Cc: joro@8bytes.org; tglx@linutronix.de; mingo@redhat.com; > hpa@zytor.com; x86@kernel.org; pbonzini@redhat.com; > kvm@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH v2 5/5] KVM: SVM: Implement pause loop exit logic in > SVM >=20 > 2018-03-16 16:37-0400, Babu Moger: > > Bring the PLE(pause loop exit) logic to AMD svm driver. > > > > While testing, we found this helping in situations where numerous > > pauses are generated. Without these patches we could see continuos > > VMEXITS due to pause interceptions. Tested it on AMD EPYC server with > > boot parameter idle=3Dpoll on a VM with 32 vcpus to simulate extensive > > pause behaviour. Here are VMEXITS in 10 seconds interval. > > > > #VMEXITS Before the change After the change > > Pauses 810199 504 > > Total 882184 325415 > > > > Signed-off-by: Babu Moger > > --- > > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > > @@ -1046,6 +1094,42 @@ static int avic_ga_log_notifier(u32 ga_tag) > > return 0; > > } > > > > +static void grow_ple_window(struct kvm_vcpu *vcpu) > > +{ > > + struct vcpu_svm *svm =3D to_svm(vcpu); > > + struct vmcb_control_area *control =3D &svm->vmcb->control; > > + int old =3D control->pause_filter_count; > > + > > + control->pause_filter_count =3D __grow_ple_window(old, > > + pause_filter_count, > > + > pause_filter_count_grow, > > + > pause_filter_count_max); > > + > > + if (control->pause_filter_count !=3D old) > > + mark_dirty(svm->vmcb, VMCB_INTERCEPTS); > > + > > + trace_kvm_ple_window_grow(vcpu->vcpu_id, > > + control->pause_filter_count, old); > > +} > > + > > +static void shrink_ple_window(struct kvm_vcpu *vcpu) > > +{ > > + struct vcpu_svm *svm =3D to_svm(vcpu); > > + struct vmcb_control_area *control =3D &svm->vmcb->control; > > + int old =3D control->pause_filter_count; > > + > > + control->pause_filter_count =3D > > + __shrink_ple_window(old, > > + pause_filter_count, > > + pause_filter_count_shrink, > > + 0); >=20 > I've used pause_filter_count as minumum here as well and in all patches > used 'unsigned int' instead of 'uint' in the code too match the rest of > the kernel. >=20 > The series is in kvm/queue, please look at the changes and tell me if > you'd like something done differently, thanks. Ok. Looks good to me. Thanks.