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 1001DC2BA2B for ; Mon, 13 Apr 2020 15:47:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D665A20735 for ; Mon, 13 Apr 2020 15:47:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VJDBnUhG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730745AbgDMPrY (ORCPT ); Mon, 13 Apr 2020 11:47:24 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:45362 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728597AbgDMPrX (ORCPT ); Mon, 13 Apr 2020 11:47:23 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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