Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1034005ybm; Wed, 27 May 2020 14:24:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHx0dkbuIEkdzgI56cIFa0s0B3ghYPNVr7TjFrbAg469i6uSuYWnZfJpHGBYYoh+lQ1VSd X-Received: by 2002:a17:907:20e5:: with SMTP id rh5mr279571ejb.72.1590614660412; Wed, 27 May 2020 14:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590614660; cv=none; d=google.com; s=arc-20160816; b=rrTln5Qz8QJLMOF7MACAikyrR8ECeRv3yypIoyMn43lfhKKAIDY3iSHe95hf66itzp 18IrVu6/Eemyqkm9WSI8p8y/5l7yDljZ4tLgXDyWzO2WCnA6jxn/M3z/MpPKvBuFQX8b D4f1rQ6isAKWNg6QAv96+t9hB+QfME20CJdbt/KXlm4rP+KzoSX5hHA9wWGUtwbJuykS VGW9pWcnsAFdmwquzkptrRSWmk3oXIw3n3mDkllwn+N9QjCkNluXoWxJLsImTN/30di4 UOR9KHlbuB9dQISEzbcLnLZYafVKguj9aoQf4hrsDM2R39cjhYfsU5r8LfjUD6z29FNl nabg== 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 :dkim-signature; bh=v8wCIHNzuki4iTF1g8AoWf5aP46pj5VisNjWioZhB3A=; b=uLr8kb/Uf1JVfxx3EwU4kmgOHsc/zLa16/Qmfdf0+gNWVAlx7b5+qvVN8dJbYWwV4D KwpKM8RXI/ookVFNENcfLwWop15k/jbbb6IdZ+p4hGm8vwvTqugSi4uErSB1yhDdrAZf osZGLsVdNKsK+KMfdKA1IMpxm7qJT20fHlu83WGS/QHV9O6pr1h5zeb31PMYsrG1s1gv XoK2oYBol48Tn+cgbxYICn+VEmPxawohHeHg/n2tjeql/QLXnDSMqXpoj8ZgezJSntRB b7bBOEGrNuAKNYdAHK5VfIn7kzR2knz/W40b8icBMnJCcVpn4E/T7GN4sRUgKx/8mp25 ml2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j2ZgK8Ew; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x22si2521564eje.542.2020.05.27.14.23.57; Wed, 27 May 2020 14:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j2ZgK8Ew; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727969AbgE0VWK (ORCPT + 99 others); Wed, 27 May 2020 17:22:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:41854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726114AbgE0VWK (ORCPT ); Wed, 27 May 2020 17:22:10 -0400 Received: from kernel.org (unknown [87.71.78.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 612E52078C; Wed, 27 May 2020 21:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590614529; bh=ZfN6TjCih4KRWkakKKG5b5uklqfy1UErCB1lMEJOcfo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j2ZgK8EwwFrGozUSttXAmBtw0/ayQsFW5FCRyot+Db9RnnnICgh26zIKdwlOtXgep 2EUvcj6Zr4e0h0wGRqXx9com35n6GlA4rF8kTsDjfz5KwKqryTTeihjFRrSjvVfgCF Q6EnS/w7tfSWhWnJJg4ICc5DWPCfTn2ITCaFND10= Date: Thu, 28 May 2020 00:22:00 +0300 From: Mike Rapoport To: Dave Hansen Cc: Liran Alon , "Kirill A. Shutemov" , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , David Rientjes , Andrea Arcangeli , Kees Cook , Will Drewry , "Edgecombe, Rick P" , "Kleen, Andi" , x86@kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: Re: [RFC 00/16] KVM protected memory extension Message-ID: <20200527212200.GH48741@kernel.org> References: <20200522125214.31348-1-kirill.shutemov@linux.intel.com> <42685c32-a7a9-b971-0cf4-e8af8d9a40c6@oracle.com> <20200526061721.GB48741@kernel.org> <8866ff79-e8fd-685d-9a1d-72acff5bf6bb@oracle.com> <20200526113844.GC48741@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 27, 2020 at 08:45:33AM -0700, Dave Hansen wrote: > On 5/26/20 4:38 AM, Mike Rapoport wrote: > > On Tue, May 26, 2020 at 01:16:14PM +0300, Liran Alon wrote: > >> On 26/05/2020 9:17, Mike Rapoport wrote: > >>> On Mon, May 25, 2020 at 04:47:18PM +0300, Liran Alon wrote: > >>>> On 22/05/2020 15:51, Kirill A. Shutemov wrote: > >>>> > >>> Out of curiosity, do we actually have some numbers for the "non-trivial > >>> performance cost"? For instance for KVM usecase? > >>> > >> Dig into XPFO mailing-list discussions to find out... > >> I just remember that this was one of the main concerns regarding XPFO. > > > > The XPFO benchmarks measure total XPFO cost, and huge share of it comes > > from TLB shootdowns. > > Yes, TLB shootdown when pages transition between owners is huge. The > XPFO folks did a lot of work to try to optimize some of this overhead > away. But, it's still a concern. > > The concern with XPFO was that it could affect *all* application page > allocation. This approach cheats a bit and only goes after guest VM > pages. It's significantly more work to allocate a page and map it into > a guest than it is to, for instance, allocate an anonymous user page. > That means that the *additional* overhead of things like this for guest > memory matter a lot less. > > > It's not exactly measurement of the imapct of the direct map > > fragmentation to workload running inside a vitrual machine. > > While the VM *itself* is running, there is zero overhead. The host > direct map is not used at *all*. The guest and host TLB entries share > the same space in the TLB so there could be some increased pressure on > the TLB, but that's a really secondary effect. It would also only occur > if the guest exits and the host runs and starts evicting TLB entries. > > The other effects I could think of would be when the guest exits and the > host is doing some work for the guest, like emulation or something. The > host would see worse TLB behavior because the host is using the > (fragmented) direct map. > > But, both of those things require VMEXITs. The more exits, the more > overhead you _might_ observe. What I've been hearing from KVM folks is > that exits are getting more and more rare and the hardware designers are > working hard to minimize them. Right, when guest stays in the guest mode, there is no overhead. But guests still exit sometimes and I was wondering if anybody had measured difference in the overhead with different page size used for the host's direct map. My guesstimate is that the overhead will not differ much for most workloads. But still, it's still interesting to *know* what is it. > That's especially good news because it means that even if the > situation > isn't perfect, it's only bound to get *better* over time, not worse. The processors have been aggressively improving performance for decades and see where are we know because of it ;-) -- Sincerely yours, Mike.