Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3961732imj; Tue, 19 Feb 2019 12:36:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IakHKs+N0Kx9zOPYDUcYsZKdpaH+JoGdbBuL9W3HXA9JjxoJhnbaY60dfU2HJ8SaeYsY7Yz X-Received: by 2002:a63:197:: with SMTP id 145mr10201137pgb.329.1550608600492; Tue, 19 Feb 2019 12:36:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550608600; cv=none; d=google.com; s=arc-20160816; b=jOr8it8m/xlDDJAtNJ5lh2Nfl41pscapNEHztcfLJGlfYa5MzNIfoTN6bDdWeIyF+w 9+2pCNNhW4fBo2Stn0xDIq7BpvEWXS4zwDnboNuOnjRyKOl7SpavmLrk8+yYxPURUDuK S9nSO5JYuWhtjk0zqAiJpXiRXyPMkJQNeJIVL2je5XmlR1UHIGvdTWy5FWfuLzbKStYs HrQ/QMBMYjwlsSodv3NukvjR9huQVZaXszxNYuFuczTJ1PG1Ek+hijeoSESrKhjgSBHq pIgURmcoEPjC7joQQiM5/ftH/3x8It9eLiKn5UGTbhlklSRkwqXavchncXtzuwS9X/Qv QUUA== 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; bh=hUt6sJ49rTCFCTY7OXH0axGKeFz1kBU+YkLIo7sABdY=; b=ILfMYMU5L2xXxFXU4Gg90qPjrPL/9GBxsY3gAWoYytPfHnVRnIAVmORIG58kik8WbL pY2vg/HqeHVcaNDamT6kLf8yzjs+zMbowscgLIbEjid6DTz0gYO5yhyOi1zXmwDV/TuJ 1G7j+crh2Rb3jL4dGOevW1KGJnvpP7KwUGStWM7WgCRWfB4ar3of9VXYZsvNa/h630eo 3Jjmbb+SbDqNbkDjHc5d5b2BgRVKd577RzwHm3rHekwCelFfADazZoAxtFnczOYdV51l 7MmyAgztuA/6Gv2yNdjmT1WP2PSP2yBBlVIT28GZRklxBTqlLMo4aoE2kUQ7lk8ruzUv sUKQ== 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 f5si16164257pfn.259.2019.02.19.12.36.24; Tue, 19 Feb 2019 12:36:40 -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 S1728795AbfBSUfe (ORCPT + 99 others); Tue, 19 Feb 2019 15:35:34 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:44696 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbfBSUfe (ORCPT ); Tue, 19 Feb 2019 15:35:34 -0500 Received: by mail-qk1-f195.google.com with SMTP id r21so523113qkl.11 for ; Tue, 19 Feb 2019 12:35:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hUt6sJ49rTCFCTY7OXH0axGKeFz1kBU+YkLIo7sABdY=; b=ZEHN7hkaQg9MpVEFCe4hi9Nf4II21NbYfje7NeCHCISEjnHrt2pMCcbmjBhcTK7WfO aFi82CU6wC6QQiFTXBPO/34ZmkI7PREdgiun3uAM81tzurVoPI77CTkNGNumtF11Buni 75b+ihmNocyWBwqA2h2bo0FnbLEwBm8+5M928FHyGhbli+rR2kIQMJ98dt1LF9qQCwcQ NWaP3cKDWhDc3M6S/jyhYGvwrn8XKdDE7tYmico3eRdlBXMOIKoH1hI7GKpmeWxJHwTo Zao0Z8VZoEz0fE63YsW1wFsBDEisAVYjBuAyvtqJ8Ir7igixdUqJzpOj3oK7KzVgZmZo pFOA== X-Gm-Message-State: AHQUAuZFFiK5CSmJ1htmZBYQZqQXInk9be4t0vZIJhoS4tQybo4G1A6n DhWTu4jJB43zjstobYe1oCeiIA== X-Received: by 2002:a37:9fd7:: with SMTP id i206mr19203091qke.278.1550608533151; Tue, 19 Feb 2019 12:35:33 -0800 (PST) Received: from redhat.com (pool-173-76-246-42.bstnma.fios.verizon.net. [173.76.246.42]) by smtp.gmail.com with ESMTPSA id 188sm9729628qkd.67.2019.02.19.12.35.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 12:35:32 -0800 (PST) Date: Tue, 19 Feb 2019 15:35:29 -0500 From: "Michael S. Tsirkin" To: David Hildenbrand Cc: Alexander Duyck , Nitesh Narayan Lal , kvm list , LKML , Paolo Bonzini , lcapitulino@redhat.com, pagupta@redhat.com, wei.w.wang@intel.com, Yang Zhang , Rik van Riel , dodgen@google.com, Konrad Rzeszutek Wilk , dhildenb@redhat.com, Andrea Arcangeli Subject: Re: [RFC][Patch v8 0/7] KVM: Guest Free Page Hinting Message-ID: <20190219152504-mutt-send-email-mst@kernel.org> References: <20190218152021-mutt-send-email-mst@kernel.org> <18d87846-72c7-adf0-5ca3-7312540bb31b@redhat.com> <478a9574-a604-0aa9-d569-6a5cd98d7cdc@redhat.com> <77e71dc3-640b-bbf6-6a47-bb2371c06172@redhat.com> <20190219145241-mutt-send-email-mst@kernel.org> <0118482c-e633-3949-6797-94d7deb8a382@redhat.com> <20190219151552-mutt-send-email-mst@kernel.org> <488d4113-fef5-17cb-c000-41ece1cdd4ca@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <488d4113-fef5-17cb-c000-41ece1cdd4ca@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 19, 2019 at 09:21:20PM +0100, David Hildenbrand wrote: > On 19.02.19 21:17, Michael S. Tsirkin wrote: > > On Tue, Feb 19, 2019 at 09:02:52PM +0100, David Hildenbrand wrote: > >> On 19.02.19 20:58, Michael S. Tsirkin wrote: > >>> On Tue, Feb 19, 2019 at 10:06:35AM -0800, Alexander Duyck wrote: > >>>>> I tend to like an asynchronous reporting approach as discussed in this > >>>>> thread, we would have to see if Nitesh could get it implemented. > >>>> > >>>> I agree it would be great if it could work. However I have concerns > >>>> given that work on this patch set dates back to 2017, major issues > >>>> such as working around device assignment have yet to be addressed, > >>> > >>> BTW for device assignment to work, your idea of sending > >>> data directly to kvm won't work, will it? > >>> You need to update userspace so it can update VFIO right? > >>> Another blocker for assignment is ability to make holes > >>> an an existing mapping - supported by hardware but > >>> not by IOMMU drivers. > >> > >> I had the exact same thought and then realized that we decided to block > >> the balloon in user space until we figured out how to handle this properly. > >> > >> I wonder if MADV_FREE behaves differently compared to MADV_DONTNEED when > >> finding pinned pages, but I doubt it. Most probably we'll have to > >> disable hinting for device assignments as well. > > > > OK but let's recognize it as a bug not a feature. > > > > Yes, btw interesting read: https://lwn.net/Articles/198380/ There's also slideware from Rik van Riel circa 2011. His idea was tagging pages in guest memory, freeing a page involves - drop the EPT PTE - check page is still free - unpin page This way you can hint without exits at all if you like. > > "Pages which have been locked into memory pose an extra challenge here - > they can be part of the page cache, but they still shouldn't be taken > away by the host system. So such pages cannot be marked as "volatile." > The problem is that figuring out if a page is locked is harder than it > might seem; it can involve scanning a list of virtual memory area (VMA) > structures, which is slow. So the hinting patches add a new flag to the > address_space structure to note that somebody has locked pages from that > address space in memory." > > I assume locked here actually means pinned. Locked seems to mean mlock there. This seems to also resemble Xen's tmem a bit. > -- > > Thanks, > > David / dhildenb