Received: by 10.213.65.68 with SMTP id h4csp824503imn; Wed, 28 Mar 2018 13:32:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx48B2Oz1w+nUIBHsNXs7S33aoYdYhtMifZSOo7pt150vAX+N6KIY3lYqY/Y3y8sSPhYBp/pX X-Received: by 10.101.78.202 with SMTP id w10mr3501664pgq.404.1522269153698; Wed, 28 Mar 2018 13:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522269153; cv=none; d=google.com; s=arc-20160816; b=d/jzuyQlOYIZ6WDyPVIOMgVg/he8aTxd+oayORTsFAow6Znwngkdn4MfQV+6GEvI05 HTJkEcw2LVEsj4gJNdsUVkonRVkaDHJO0vYwGcvDM488Bw7wdLN45hXNTcV8WvuBuLEs Pc1CG/XMT2eaLwC2NAHacALwls0ZsOIGQbsdPBgHY878s4+dSENE6FZQzf7g/2y6s1Bc /7OYWBEQYW/3tUVuzZzQntcQ85VeB7HMYmnRvf2toGowqX77DRCds2HRNTKrZ8NHVtV/ odnSAjcs68243qdDKswc/ilPS2Zo27cldUheYe/9uSyWyzdAq+GJ98NsCxV2BpLCiEfe in4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=ylXxSSEjEWhO0EWF5rNcr333wevgi4OcBccgNEcUVb4=; b=QvRuhXHVplsYaPwpcJ+C0W7xQLUbEeb9gsnFW2DGh/Lktt6F+zfPZb+yrPlURMs6r9 HhuKIb6X904LvLmhuYcbNj7NebAyuboSwFmWKd7UMa9mGeGAsUTn1VvkJELcHVH2UT3K bZ9LSfzg2MCXAS8qWRyl2Bw7AH68povw5jMzCTm82Ji3G2IW2VlCcc/GnKGcQJbJKhk0 VGPbKmXdfpa8ZUkRxgN/DmJhQJpS5ysJf96pVJHKYjeKURV4wDkQXSelI6HrF5e1o0b8 GXmzYDeXuh/D6aWrkBYhiYKUy0QOmwzluaP0klpB+kj24eW8rnhIWAUmTYUJ08qFvy/1 r+oQ== 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 x14si3313253pfk.119.2018.03.28.13.32.18; Wed, 28 Mar 2018 13:32:33 -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 S1753190AbeC1Ual (ORCPT + 99 others); Wed, 28 Mar 2018 16:30:41 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52008 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752606AbeC1Uak (ORCPT ); Wed, 28 Mar 2018 16:30:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3D098A27F1; Wed, 28 Mar 2018 20:30:40 +0000 (UTC) Received: from flask (unknown [10.43.2.80]) by smtp.corp.redhat.com (Postfix) with SMTP id DF46810B2B26; Wed, 28 Mar 2018 20:30:37 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Wed, 28 Mar 2018 22:30:37 +0200 Date: Wed, 28 Mar 2018 22:30:37 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Babu Moger 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 Message-ID: <20180328203036.GK26753@flask> References: <1521232646-79580-1-git-send-email-babu.moger@amd.com> <1521232646-79580-6-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1521232646-79580-6-git-send-email-babu.moger@amd.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 28 Mar 2018 20:30:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 28 Mar 2018 20:30:40 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'rkrcmar@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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=poll 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 = to_svm(vcpu); > + struct vmcb_control_area *control = &svm->vmcb->control; > + int old = control->pause_filter_count; > + > + control->pause_filter_count = __grow_ple_window(old, > + pause_filter_count, > + pause_filter_count_grow, > + pause_filter_count_max); > + > + if (control->pause_filter_count != 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 = to_svm(vcpu); > + struct vmcb_control_area *control = &svm->vmcb->control; > + int old = control->pause_filter_count; > + > + control->pause_filter_count = > + __shrink_ple_window(old, > + pause_filter_count, > + pause_filter_count_shrink, > + 0); 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. The series is in kvm/queue, please look at the changes and tell me if you'd like something done differently, thanks.