Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3029207imj; Mon, 11 Feb 2019 12:34:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IbK7yGBvTKg1iDAGD8BmVwzOhlL4txDOPhCDq1qhY+bZWepjZwkTkJcvRdnj5f0w1j7iYEr X-Received: by 2002:a17:902:7204:: with SMTP id ba4mr105038plb.186.1549917292253; Mon, 11 Feb 2019 12:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917292; cv=none; d=google.com; s=arc-20160816; b=xPcHPd5cjVCts0fxqAciEMNelTxgqxNO3dQjfE9lVCsMHwUH8zdIygl2jtcR/u4+Tv gUNMcb+HCyhBz5zcyqCdvs0p8B7n/2WNZlLImFfC5Mqqc18EoUe3T2uj62jhRk5RWoSG KphrhI1k+1IDtOe+HvxNHu0Djc1z1uTaT1kOX0Mg0Pa1zixxGdXKcogHiZI4JUNLcdd8 4p4og5T8zSWF4YoBt9pawMhoQXFKgWLdNAoKHqjPTCzwIgWhUDF59TwpG9CdG+LTApDq WHx4YhBaYBrKmx3KSbQrTygJQYMgn0swgN+skUAu3ykkngfrHfw5LmmDuBDCL8UKexsb k/sw== 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=QEi1EHIIELqWBsp0hkUVkZo55YiPgkhZYiMVZ0QI0Ds=; b=MGLGVTvT57M0lMQeVTY3Znve4e/ZK3GlVp3FvU28Va8TiuI3dMcWC1Ku6gGSefAAKq MsxCfYP4vtjbu0OYFjXqWOM/26aL4YoDakSgADCTG4FElobC0URMfa8Tj5za4A4U6BlP K13CNLX/wwIbOI/jbjUkzSLatat5Lcq5kRUhEaPPK7qOKsFaXbl6wzDB7/MhmlUczhyn 0EXRhVC3f0roEgGLI4mRBsAM/GCKp3MAdH0jCxNl4B85/qg8L6GjR7lSX3y6MA8pgCc9 GA3UdGCx+uKXHEnRj7W7IFZ4CK8WmnUvuzKLRCE0rS4dzHJ9crRZGIYDsYePlfAYRL9R W+tQ== 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 e37si11517165plb.172.2019.02.11.12.34.36; Mon, 11 Feb 2019 12:34:52 -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 S1729052AbfBKRso (ORCPT + 99 others); Mon, 11 Feb 2019 12:48:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35158 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726914AbfBKRsn (ORCPT ); Mon, 11 Feb 2019 12:48:43 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F53640229; Mon, 11 Feb 2019 17:48:43 +0000 (UTC) Received: from redhat.com (ovpn-120-40.rdu2.redhat.com [10.10.120.40]) by smtp.corp.redhat.com (Postfix) with SMTP id 161A95D736; Mon, 11 Feb 2019 17:48:40 +0000 (UTC) Date: Mon, 11 Feb 2019 12:48:35 -0500 From: "Michael S. Tsirkin" To: Dave Hansen Cc: Alexander Duyck , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, rkrcmar@redhat.com, alexander.h.duyck@linux.intel.com, x86@kernel.org, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, pbonzini@redhat.com, tglx@linutronix.de, akpm@linux-foundation.org Subject: Re: [RFC PATCH 2/4] kvm: Add host side support for free memory hints Message-ID: <20190211124203-mutt-send-email-mst@kernel.org> References: <20190204181118.12095.38300.stgit@localhost.localdomain> <20190204181546.12095.81356.stgit@localhost.localdomain> <20190209194108-mutt-send-email-mst@kernel.org> <39c915a7-e317-db01-0286-579230f37da2@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <39c915a7-e317-db01-0286-579230f37da2@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 11 Feb 2019 17:48:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 11, 2019 at 09:41:19AM -0800, Dave Hansen wrote: > On 2/9/19 4:44 PM, Michael S. Tsirkin wrote: > > So the policy should not leak into host/guest interface. > > Instead it is better to just keep the pages pinned and > > ignore the hint for now. > > It does seems a bit silly to have guests forever hinting about freed > memory when the host never has a hope of doing anything about it. > > Is that part fixable? Yes just not with existing IOMMU APIs. It's in the paragraph just above that you cut out: Yes right now assignment is not smart enough but generally you can protect the unused page in the IOMMU and that's it, it's safe. So e.g. extern int iommu_remap(struct iommu_domain *domain, unsigned long iova, phys_addr_t paddr, size_t size, int prot); I can elaborate if you like but generally we would need an API that allows you to atomically update a mapping for a specific page without perturbing the mapping for other pages. -- MST