From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E879AC2BA19 for ; Mon, 13 Apr 2020 15:47:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AB29320732 for ; Mon, 13 Apr 2020 15:47:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VJDBnUhG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB29320732 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2F0048E0127; Mon, 13 Apr 2020 11:47:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A1848E0104; Mon, 13 Apr 2020 11:47:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 190928E0127; Mon, 13 Apr 2020 11:47:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id F15968E0104 for ; Mon, 13 Apr 2020 11:47:22 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A4A6B181AEF30 for ; Mon, 13 Apr 2020 15:47:22 +0000 (UTC) X-FDA: 76703261124.11.spot68_7a929faa2e70d X-HE-Tag: spot68_7a929faa2e70d X-Filterd-Recvd-Size: 4186 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Mon, 13 Apr 2020 15:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586792841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I4bWrwiElnw+d7X99Bis3FxuOxIFuXPdODeS5fzReoQ=; b=VJDBnUhG1NLfdSHtC8ODFPj9zgEvePYE40coc4/RhZGxi8h3kOlYyp2fnhxy+PaGSsUAmG S4uDySpYEL+D8b8VwvqfiWJm9K7iSk55ZHw1atanft+9nMjHTXbt3JFW/mbo1PZXjjzBux aADvFeHJFnRO12eHapykTDMN+KnIbTk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-374-hZu3iWvfOrGndcnQ8Et5Ng-1; Mon, 13 Apr 2020 11:47:19 -0400 X-MC-Unique: hZu3iWvfOrGndcnQ8Et5Ng-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B8E4107ACC7; Mon, 13 Apr 2020 15:47:18 +0000 (UTC) Received: from w520.home (ovpn-112-162.phx2.redhat.com [10.3.112.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id D576C60BE1; Mon, 13 Apr 2020 15:47:14 +0000 (UTC) Date: Mon, 13 Apr 2020 09:47:14 -0600 From: Alex Williamson To: Dave Hansen Cc: Alexander Duyck , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrea Arcangeli , Dan Williams , David Hildenbrand , Michal Hocko , Andrew Morton , "Raj, Ashok" Subject: Re: [RFC PATCH 0/4] mm: Add PG_zero support Message-ID: <20200413094714.432b5841@w520.home> In-Reply-To: <7a064e81-6bc1-b3e7-5f82-292ffa392058@intel.com> References: <20200412090728.GA19572@open-light-1.localdomain> <20200413084915.1bae0007@w520.home> <7a064e81-6bc1-b3e7-5f82-292ffa392058@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, 13 Apr 2020 08:14:32 -0700 Dave Hansen wrote: > On 4/13/20 7:49 AM, Alex Williamson wrote: > >> VFIO's unconditional page pinning is the real problem here IMNHO. They > >> don't *really* need to pin the memory. We just don't have good > >> paravirtualized IOMMU support or want to pay the runtime cost for > >> pin/unpin operations. You *could* totally have speedy VM startup if > >> only the pages being accessed or having DMA performed to them were > >> allocated. But, the hacks that are in place mean that everything must > >> be pinned. > > Maybe in an SEV or Secure Boot environment we can assume the VM guest > > OS uses the IOMMU exclusively for DMA, but otherwise the IOMMU is > > optional (at least for x86, other archs do require IOMMU support > > afaik). Therefore, how would we know which pages to pin when there are > > only limited configs where we might be able to lean on the vIOMMU to > > this extent? Thanks, > > You can delay pinning until the device is actually used. That should be > late enough for the host to figure out whether a paravirtualized IOMMU > is in place. So the guest enables the bus master bit in the command register and at that point we'd stall the VM for an indeterminate length of time while we potentially pin all memory, and hope that both the user and the host has the resources to account and allocate that memory, otherwise the VM suddenly crashes? All of this potentially taking place in the pre-boot environment to support option ROMs as well. A delay starting the VM seems a lot more predictable. Thanks, Alex