Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4666214ybb; Tue, 14 Apr 2020 11:42:07 -0700 (PDT) X-Google-Smtp-Source: APiQypJhyrFqbxB4IU9CRlTeiAZS03QzIGokXer3zeBTdjxW9qQns7QL4WWi1izCBZ97aNdf+bmu X-Received: by 2002:a17:906:548:: with SMTP id k8mr1406026eja.259.1586889726799; Tue, 14 Apr 2020 11:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586889726; cv=none; d=google.com; s=arc-20160816; b=ByTV3878Ic3sNqQO684FzX2ll59LHqRqs8s3m8fqHlLI1VnvQvePn/7zjvTXi+QG5u OrJtldqFdZLbpvvHFp9yXSCXFScaDvXkJrpBloc+pxipiVSULBylgF80yGUAqSNte96I vna3zFGfPYZFfVtK4plXMYWM0jLmcVMMrIYjBm5dFhpwIXou3naqh1ieS1iBz3qpCBr4 LhwrjErRHI9oP5EUwp3MzPxOFSfGsw8/t3AV2EWJcz/Jbg5gkyPf/7A/zjMXHLiNxUKP wqDY0Rq1+g68ExcSZyfvBmza2qNB8/ymtJi85iy9LxWnMsQGMNVwmO1WJtOhvQWXP+RA 6WiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=z+v9hw4Kmb7EPYxVS7oIG+Ta6906cOePJmYHsHY5X+Q=; b=tNs/3mwfheNuVpxNHhvNO7BDcIRLSOxEZG1m+9eFufPmbXXmry8Yprsjso1TD98bPW /ayXxq7ZTjzbIx0+/R3flAyzODy5rpICIwO0nbGlgpOlDU2JBbncHlN1DDsIMDAhU/Jo wxWQfuMqexOnOGKwHg68bIqHbNlV35MbyPVU+fe50F7sRyXeWvfY0Ruoj2Vxwbcf8XFs DcC6tZGaTmjcA9b4nY8ACjVwZOGmG7xrqlGkKuP1glWUYrHDZze0X+6DgCXh8XY4u2rA t4v7XFZ5yXJVo4ZEYePtTKzuGtWWRs2eb1RC+/G8qzsnTYrtXsy8G469Nd5i9O5oDlRQ +53w== 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 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m9si8691129eja.420.2020.04.14.11.41.41; Tue, 14 Apr 2020 11:42:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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; spf=pass (google.com: best guess record for 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730066AbgDMPZa (ORCPT + 99 others); Mon, 13 Apr 2020 11:25:30 -0400 Received: from mga03.intel.com ([134.134.136.65]:64151 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729910AbgDMPZa (ORCPT ); Mon, 13 Apr 2020 11:25:30 -0400 IronPort-SDR: yk9xMZAahcSTAfJs0Jn7fcKJbraOH+ta5apXUqMmSz6U/+kYb0qqgUZaIMOpnI1pG9mmNQpiwZ 9neyao4F49aw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2020 08:25:28 -0700 IronPort-SDR: W0dDkPbPivnevCHh26CIB+Ht0FHcfckngVjnr3EelLm9ViaKBmuEt1zUPDoE/NA7N118bhfOhP L2TkZVU8JTCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,378,1580803200"; d="scan'208";a="363096529" Received: from araj-mobl1.jf.intel.com ([10.255.32.166]) by fmsmga001.fm.intel.com with ESMTP; 13 Apr 2020 08:25:24 -0700 Date: Mon, 13 Apr 2020 08:25:24 -0700 From: "Raj, Ashok" To: Dave Hansen Cc: Alex Williamson , Alexander Duyck , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrea Arcangeli , Dan Williams , David Hildenbrand , Michal Hocko , Andrew Morton , Ashok Raj Subject: Re: [RFC PATCH 0/4] mm: Add PG_zero support Message-ID: <20200413152523.GL23186@araj-mobl1.jf.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-Disposition: inline In-Reply-To: <7a064e81-6bc1-b3e7-5f82-292ffa392058@intel.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 13, 2020 at 08:14:32AM -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. When you have a device assigned to a guest, it is used when the guest starts probing the device. Some devices like VF's need DMA even to probe and get resources assigned from the PF. The only way we can do this is when device support ATS and PRS. And host iommu driver to know if this fault needs to be handled by the host (if the 2nd level is at fault), or the guest if the walk in first level isn't resolved. 2nd level faults need to be resolved by the VMM.