Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2614578imm; Sun, 14 Oct 2018 00:29:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV6111HSx/PsEUmAAUV2tyVI3unYYsB9kd4DXIsk1KdcZ1CKQytAKT3RnAFLEhBojq6e+91pt X-Received: by 2002:a62:120b:: with SMTP id a11-v6mr12806271pfj.165.1539502194127; Sun, 14 Oct 2018 00:29:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539502194; cv=none; d=google.com; s=arc-20160816; b=eCE+dOsTdwF65ztt8Lx6L6/3X5m8RErcRFY/rpiFsRavCmzG2an07h0MEibbFH1fLu Vn/Tb/JTwqcEAmWZY8KozG5S5ppA8j3XhXOWilX+yRNZzUJgUsjoEpd6TmjQ0rgHsdvc LDnNZog8ZxEEEzhsaDpXsQX0nAfmxrv0uhFWqTe5H4dz5WYhzl1MJfqBDkOuU0uvaWsx IiBhTmXcCvbHXx3YWGpw81fVSeZRISPeyBcH4lWSRgDlqe9f/i6s3UlFZi9HmZ51D0QT V564VduWhxMl10yHmad8PmMR1f/e5zmojdFyW16ErGHxrQJwEBUpWaEflLARdZySuK2N /NqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=x1rPStnyMjgTZ4kR6etWB0TFzQLk4cy1o7iAyMPR8Vo=; b=ERh9z1fztwXlIwqeFhvgQs+ZOgm30T4Wj81g9UCGu8Ht4mt4QxiTCoL9R81RYygMTK rapUgvtGR+ymHG5rt4sqTHqxwmf/uYFoyWEVwK9naklbfZ5fLSG13icWYVDOfBQGRWBw eFXKu5F0nykCExsikHvQquDON+NANmGNDjuaJmARPEk7ruD2vU2C5sl2rO+m3phxy9c/ TJpxaTG4aKFx6vLIXYv0TMypHL3uP065/oWImT2xjVa312EAea/lroLtCXT8lP2NC5vg RUJ1LdamuEzrgUMrzNEJ7F/NB7QWn+p9wXjMWG/CuAVRAoWjaX59DP9nDC3JwgSu+HBJ Z5CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=Ro7LCiAd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14-v6si7294472plk.130.2018.10.14.00.29.05; Sun, 14 Oct 2018 00:29:54 -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=@oracle.com header.s=corp-2018-07-02 header.b=Ro7LCiAd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726377AbeJNPIT (ORCPT + 99 others); Sun, 14 Oct 2018 11:08:19 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:36586 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbeJNPIT (ORCPT ); Sun, 14 Oct 2018 11:08:19 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9E7KWth090057; Sun, 14 Oct 2018 07:27:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=corp-2018-07-02; bh=x1rPStnyMjgTZ4kR6etWB0TFzQLk4cy1o7iAyMPR8Vo=; b=Ro7LCiAdB43Hgv9VAbgRuwwoo7nGoz/tvkwJLuKy3j7bitZKDEZ+2cSIX2wYLRDCTjC8 8+bn/O6I+ifjC9ZwEv4/7hFQOrR1EOtCdtYhKm4n6xRiJbuhiRHBi039uY42lugiJ+67 yw0Xte6X4P5YTH47Cuvc4QwzEDpNHhK+7+6L0YAXZ/pHxCU5f08WMQ3sKH2tvjPodQ63 Y39eRtFhkCqrOp1q/g9DtCsmrdATn4VGH9oLAWmm7OCvNrpAhMs5yTir0HlalJ1jPIBV g2ZSs3Mr+XPejy7vLLWEZPtUrKRPnJVvi2O0RiErPB2WqgGtUUspqH898xM5nWodTu3i 7w== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2n38npmcvd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Oct 2018 07:27:00 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9E7QvEd010730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Oct 2018 07:26:57 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9E7Qq6c027817; Sun, 14 Oct 2018 07:26:53 GMT Received: from [192.168.14.112] (/79.182.224.107) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 14 Oct 2018 07:26:51 +0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.1 \(3445.4.7\)) Subject: Re: [PATCH V4 2/15] KVM/MMU: Add tlb flush with range helper function From: Liran Alon In-Reply-To: <20181013145406.4911-3-Tianyu.Lan@microsoft.com> Date: Sun, 14 Oct 2018 10:26:41 +0300 Cc: Lan Tianyu , christoffer.dall@arm.com, marc.zyngier@arm.com, linux@armlinux.org, catalin.marinas@arm.com, will.deacon@arm.com, jhogan@kernel.org, ralf@linux-mips.org, paul.burton@mips.com, paulus@ozlabs.org, benh@kernel.crashing.org, mpe@ellerman.id.au, kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devel@linuxdriverproject.org, kvm@vger.kernel.org, michael.h.kelley@microsoft.com, vkuznets@redhat.com Content-Transfer-Encoding: quoted-printable Message-Id: <4D709C3A-A91C-4CA7-922A-E77618EF21B4@oracle.com> References: <20181013145406.4911-1-Tianyu.Lan@microsoft.com> <20181013145406.4911-3-Tianyu.Lan@microsoft.com> To: lantianyu1986@gmail.com X-Mailer: Apple Mail (2.3445.4.7) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9045 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=865 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810140071 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 13 Oct 2018, at 17:53, lantianyu1986@gmail.com wrote: >=20 > From: Lan Tianyu >=20 > This patch is to add wrapper functions for tlb_remote_flush_with_range > callback. >=20 > Signed-off-by: Lan Tianyu > --- > Change sicne V3: > Remove code of updating "tlbs_dirty" > Change since V2: > Fix comment in the kvm_flush_remote_tlbs_with_range() > --- > arch/x86/kvm/mmu.c | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) >=20 > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c > index c73d9f650de7..ff656d85903a 100644 > --- a/arch/x86/kvm/mmu.c > +++ b/arch/x86/kvm/mmu.c > @@ -264,6 +264,46 @@ static void mmu_spte_set(u64 *sptep, u64 spte); > static union kvm_mmu_page_role > kvm_mmu_calc_root_page_role(struct kvm_vcpu *vcpu); >=20 > + > +static inline bool kvm_available_flush_tlb_with_range(void) > +{ > + return kvm_x86_ops->tlb_remote_flush_with_range; > +} Seems that kvm_available_flush_tlb_with_range() is not used in this = patch=E2=80=A6 > + > +static void kvm_flush_remote_tlbs_with_range(struct kvm *kvm, > + struct kvm_tlb_range *range) > +{ > + int ret =3D -ENOTSUPP; > + > + if (range && kvm_x86_ops->tlb_remote_flush_with_range) > + ret =3D kvm_x86_ops->tlb_remote_flush_with_range(kvm, = range); > + > + if (ret) > + kvm_flush_remote_tlbs(kvm); > +} > + > +static void kvm_flush_remote_tlbs_with_list(struct kvm *kvm, > + struct list_head *flush_list) > +{ > + struct kvm_tlb_range range; > + > + range.flush_list =3D flush_list; > + > + kvm_flush_remote_tlbs_with_range(kvm, &range); > +} > + > +static void kvm_flush_remote_tlbs_with_address(struct kvm *kvm, > + u64 start_gfn, u64 pages) > +{ > + struct kvm_tlb_range range; > + > + range.start_gfn =3D start_gfn; > + range.pages =3D pages; > + range.flush_list =3D NULL; > + > + kvm_flush_remote_tlbs_with_range(kvm, &range); > +} > + > void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask, u64 mmio_value) > { > BUG_ON((mmio_mask & mmio_value) !=3D mmio_value); > --=20 > 2.14.4 >=20