Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1764808imm; Thu, 14 Jun 2018 03:35:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLJinYH1vnBNo/QMOSe8aK4jBxM3hYD3fw+gDjGYNMSKu5nlRL0hDlxJ36Fv7f/U8joh3ZI X-Received: by 2002:a17:902:28ea:: with SMTP id f97-v6mr2324081plb.55.1528972502852; Thu, 14 Jun 2018 03:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528972502; cv=none; d=google.com; s=arc-20160816; b=JybUZ1vPgSX2NujM0m8W3nLMo0XlEkodFLoPLkCEMOw985Yuk/vCKlTyiN9wcuBIvi xXVq+cAuUlrjRHy1q7rbskaJsxuFtc+WCwI6RE90Pi62r0+fcr1yHFhBvjoCSbfWdfGr QFlXbhjL/O5/afY1bwqR7Y8RTYnENKImobgeW3ToMt/NgKRcxZ8VUmSVSrm9Es/qGKSB +m3R/woGwtMFh8okb5G9JVkTvoaE5qGtiZQ3jNgKX64hLyeObBpVllArGwsZAWoYSOdf ATX0zGTGw+UKtosbd/7pGNU80omtGjX082WmahQgSyzxXrBnXgOOffIqpyNAOdxaMUfP x73w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from :arc-authentication-results; bh=ro2n3E7mv30uX0fpFevnIFCSMNbua6mZVHUPAs24D+8=; b=D+MUmwjdd9F92Wdc628A31IGY8CtpRmE37Sx2W7eGnc4bxPa2zweIEVQq6g8J4scrX fHFKL/NQr8wW3RDde1hhwvhYJybuQsvClSKhqj5ewmNbejC+wLoEyaW2cBnkwxPVYMIw 0v3HnrK47lEj16rw39wn6nclWtz1LjZ7uBf5Qw8On/v4rWaZiB3LN7/tO48M6ysQHtEG o6Ijxv59qzow/GZ4UDHTlqLOoN8k2EehZTYZHoYiTUIm6ii+uUIEHEF9NwJQzVLPPZ25 9R1vHTcfSSdl2ZCKHmCqZJK+7hHtM/rlqvDPY/8ejYb6OAufoz+Qc8WVj1sq3ypSWsJ9 Csew== 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 e37-v6si5118114plb.400.2018.06.14.03.34.48; Thu, 14 Jun 2018 03:35:02 -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 S1755004AbeFNKeA (ORCPT + 99 others); Thu, 14 Jun 2018 06:34:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45716 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754990AbeFNKd6 (ORCPT ); Thu, 14 Jun 2018 06:33:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CFB8E818F703; Thu, 14 Jun 2018 10:33:57 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (ovpn-204-185.brq.redhat.com [10.40.204.185]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C6061C5B8; Thu, 14 Jun 2018 10:33:54 +0000 (UTC) From: Vitaly Kuznetsov To: Tianyu Lan Cc: "pbonzini\@redhat.com" , "rkrcmar\@redhat.com" , "tglx\@linutronix.de" , "mingo\@redhat.com" , "hpa\@zytor.com" , "x86\@kernel.org" , "kvm\@vger.kernel.org" , "linux-kernel\@vger.kernel.org" , KY Srinivasan Subject: Re: [RFC Patch 3/3] KVM/x86: Add tlb_remote_flush callback support for vmcs References: <20180604090749.489-1-Tianyu.Lan@microsoft.com> <20180604090749.489-4-Tianyu.Lan@microsoft.com> <87h8m8qbso.fsf@vitty.brq.redhat.com> Date: Thu, 14 Jun 2018 12:33:53 +0200 In-Reply-To: (Tianyu Lan's message of "Thu, 14 Jun 2018 10:13:46 +0000") Message-ID: <87d0wtpsha.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 14 Jun 2018 10:33:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 14 Jun 2018 10:33:57 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vkuznets@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tianyu Lan writes: > On 6/12/2018 11:12 PM, Vitaly Kuznetsov wrote: >> Tianyu Lan writes: >> >>> >>> +static int vmx_remote_flush_tlb(struct kvm *kvm) >>> +{ >>> + struct kvm_vcpu *vcpu = kvm_get_vcpu(kvm, 0); >>> + >>> + if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) >>> + return -1; >> >> Why vcpu0? Can arch.mmu.root_hpa-s differ across vCPUs? What happens if >> they do? > > Yes, it may take place that arch.mmu.root_hpa is differ across vCPUs. > We may check all vcpu root_hpa and use the hypercall when there is only > one validated ept table. If not, go back to current way. > I'd suggest an optimization: keep track of wether root_hpas are equal across all vcpus (check this on change). -- Vitaly