Received: by 10.223.185.116 with SMTP id b49csp3819756wrg; Tue, 13 Feb 2018 08:14:02 -0800 (PST) X-Google-Smtp-Source: AH8x224ighOZC7LIz7IBqDyeOBqr4n8Vx1vOfvPNflksX+x6QV+HIjITFQaosKvOo8IlDPC7gkFl X-Received: by 10.99.105.132 with SMTP id e126mr1379368pgc.250.1518538442336; Tue, 13 Feb 2018 08:14:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518538442; cv=none; d=google.com; s=arc-20160816; b=oec7qZZzGHKVvb0sMlhmS6qpuOQlEgvSBP++iUTeM2Tl9ZiOa2wwkLHl/t605FsfTA Imsjoz0++3EL1zyy0dK4LKxLhSKg8HXJjHcEs5paizejNaf35ZuIDWGDxx91te88QI3x kcBkUEi8M6IwujORnOLHI53utoBm9b/os+MTE+SuQPT+qZLvBT/a3IoTFdaLj/J/4vll YQZXMOC9Q6S1J5OL7mlakzw+Vl+RgAZpgSDuy0vB6NMjB4SK2v4gm3kadW1LwQPFfiYP gXv0wabxV29kPre0uWvyvwouHCBYSxgGgoP6vGAsb4A7FaklLImF3aIjB6xK1vbWzYzv 8XuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=UY+9fZ+Rbkem9Zh6OgUuIFqc8gec0+SFvMYmKkHFQC4=; b=iUs/a3CXhDu6i4Ps2Zj7+0KEHbHKqAMdUpgcTBfIkHIZMwG6ePGIUml9RmWo1SVo/i jGwuNd6k+/CHKOYgDOwHoBmjVvvKQDMugqNWu+cuhDTQjuHEZbmqvSx7yFZA600WLehX vtdr4JarHJFv5bM0ux/JX8fU8tu4G3PJZ/vpW3RRJXvq0SDlbCKTh+4xO1Y8DyNtmwN+ 6gr7bLvmvn5T59j6xbQoLbaKDul/Yp8OY8JnUJA6/JteovP7/uT4Q1Vdbz/t0Sv71jLQ RmPaNlJ7Qiq/tj8F0peS8E5UF5i0+ZM1ytQEUBZBszuVxApM6byVQjzxOnrNQC0x9qLV sZpA== 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 k193si5511931pge.377.2018.02.13.08.13.47; Tue, 13 Feb 2018 08:14:02 -0800 (PST) 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 S934761AbeBMQMs (ORCPT + 99 others); Tue, 13 Feb 2018 11:12:48 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59894 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934056AbeBMQMq (ORCPT ); Tue, 13 Feb 2018 11:12:46 -0500 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 C9BE940FB645; Tue, 13 Feb 2018 16:12:45 +0000 (UTC) Received: from [10.36.116.223] (ovpn-116-223.ams2.redhat.com [10.36.116.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D20A11008577; Tue, 13 Feb 2018 16:12:44 +0000 (UTC) Subject: Re: [PATCH v4 3/3] KVM: X86: Don't use PV TLB flush with dedicated vCPUs and steal time disabled To: Wanpeng Li , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Eduardo Habkost References: <1518483942-14741-1-git-send-email-wanpengli@tencent.com> <1518483942-14741-4-git-send-email-wanpengli@tencent.com> From: Paolo Bonzini Message-ID: Date: Tue, 13 Feb 2018 17:12:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1518483942-14741-4-git-send-email-wanpengli@tencent.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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.7]); Tue, 13 Feb 2018 16:12:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 13 Feb 2018 16:12:45 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/02/2018 02:05, Wanpeng Li wrote: > From: Wanpeng Li > > vCPUs are very unlikely to get preempted when they are the only task > running on a CPU. PV TLB flush is slower that the native flush in that > case. In addition, avoid traversing all the cpus for pv tlb flush when > steal time is disabled since pv tlb flush depends on the field in steal > time for shared data. > > Cc: Paolo Bonzini > Cc: Radim Krčmář > Cc: Eduardo Habkost > Signed-off-by: Wanpeng Li > --- > arch/x86/kernel/kvm.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > index c5566d9..285822f 100644 > --- a/arch/x86/kernel/kvm.c > +++ b/arch/x86/kernel/kvm.c > @@ -545,7 +545,9 @@ static void __init kvm_guest_init(void) > pv_time_ops.steal_clock = kvm_steal_clock; > } > > - if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH)) > + if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) && > + !kvm_para_has_feature(KVM_HINTS_DEDICATED) && > + !kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) > pv_mmu_ops.flush_tlb_others = kvm_flush_tlb_others; > > if (kvm_para_has_feature(KVM_FEATURE_PV_EOI)) > @@ -638,7 +640,9 @@ static __init int kvm_setup_pv_tlb_flush(void) > { > int cpu; > > - if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH)) { > + if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) && > + !kvm_para_has_feature(KVM_HINTS_DEDICATED) && This should have checked the hints word. In general, I'm going to change in the whole series kvm_hint_has_feature with kvm_para_has_hint, and kvm_arch_hint_features with kvm_arch_para_hints. But apart from this small naming issue, the series looks good, and I'm applying it to kvm/queue. Paolo > + !kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) { > for_each_possible_cpu(cpu) { > zalloc_cpumask_var_node(per_cpu_ptr(&__pv_tlb_mask, cpu), > GFP_KERNEL, cpu_to_node(cpu)); >