Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2674652pxb; Tue, 23 Feb 2021 12:39:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfrrMPp0CqKL2hWs320U5NczVwQDwIcePhA8M/r+uQwqluHYGkfAd8rRBeBUAbuMvbD644 X-Received: by 2002:a05:6402:105a:: with SMTP id e26mr29095486edu.60.1614112775643; Tue, 23 Feb 2021 12:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614112775; cv=none; d=google.com; s=arc-20160816; b=WBizjzLRmzUTVl5f7xVEfVOE/eIQ8HyX0gzJr1XgtiOy58BIbTXsblJXdMrqxpvwBX w61v8v6yuqCvwus2cUbCjKKF7INAsL4xZEpqmZ82vgZawEjbtSP2zVq8Tl5BuL0jLJQG od57T1WKCtISDfeew+VqQYIKK9pyji2srp10Kc4cpnBQH30xfv2KyHUQOLqiaFi6zOde AWmt1eFITDlYzhXXJPR5Kd8W/b7D05sB+4c9v9EuuB9WEq+PIxndeJWUE6Id4MzOO49U sTSAIupaI4Pp8Xhtnq8NYVisjtvsSi3vGRo4RrpQtwquiqD5NPuWi6yxnWo6AGrFwsvA /X9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=aNQlCLzZcYzbOTIxENd+gbQNtMQVBm5Wl9PZiGh2RGw=; b=XTzu5rNyhtfULB6vE9jjZpREaXLfpAba3tZEK8w2KFwtBQeS5cSAHe5PoEsFkXx0RA /6hNybeXbsCbKxzYrQIJR480EwVTYEJfU9GeCtmoKfb9uUcDxLTMi6xUp/7nDrrbqd8X 5EWuv/6inloEQQJWV5Dc0ZWy6bs01aDUFso7Xbfk9+KJwYD+qtmn+B+lyyd8NrCxDjhR aSm3B66vjqcB/CLWOlRb2QDeJj8uWCRCH426qPVJ+kCmGrKguQX8rDGfnwx5OmVo2sic bBlKGWjNvKFDPH/pS0lLbu/hsiTncPTQHvhor93LggGs/SBl3ebhgm3eOeZgZWQhbrZk 27PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AqPbi7rv; spf=pass (google.com: 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si11609208ejb.602.2021.02.23.12.39.11; Tue, 23 Feb 2021 12:39:35 -0800 (PST) Received-SPF: pass (google.com: 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AqPbi7rv; spf=pass (google.com: 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233898AbhBWS0r (ORCPT + 99 others); Tue, 23 Feb 2021 13:26:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23115 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233083AbhBWS0p (ORCPT ); Tue, 23 Feb 2021 13:26:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614104719; 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=aNQlCLzZcYzbOTIxENd+gbQNtMQVBm5Wl9PZiGh2RGw=; b=AqPbi7rvnplLusxNLH73L2t8NA8bD0qy9LwVBoIMfv25Q72KiM/eba+y7wzT0WJaj0Sm/n lLleoq7z5I2gqlDFrkCfiJ1zyKoluo98s/VP8sID4ySSLqY9CuP5GNUymRUf1mjShTn8d7 y/k8tOPGYJ6advsE0Sl+LzNyoCyG51k= 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-403-_iNLiPGdPkiALx9MjROixQ-1; Tue, 23 Feb 2021 13:24:30 -0500 X-MC-Unique: _iNLiPGdPkiALx9MjROixQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA83C80197C; Tue, 23 Feb 2021 18:24:28 +0000 (UTC) Received: from omen.home.shazbot.org (ovpn-112-255.phx2.redhat.com [10.3.112.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 122F81001281; Tue, 23 Feb 2021 18:24:27 +0000 (UTC) Date: Tue, 23 Feb 2021 11:24:27 -0700 From: Alex Williamson To: Daniel Jordan Cc: Cornelia Huck , Jason Gunthorpe , Matthew Wilcox , Pavel Tatashin , Steven Sistare , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 0/3] vfio/type1: Batch page pinning Message-ID: <20210223112427.682b8ce9@omen.home.shazbot.org> In-Reply-To: <20210219161305.36522-1-daniel.m.jordan@oracle.com> References: <20210219161305.36522-1-daniel.m.jordan@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 19 Feb 2021 11:13:02 -0500 Daniel Jordan wrote: > v2: > - Fixed missing error unwind in patch 3 (Alex). After more thought, > the ENODEV case is fine, so it stayed the same. > > - Rebased on linux-vfio.git/next (no conflicts). > > --- > > The VFIO type1 driver is calling pin_user_pages_remote() once per 4k page, so > let's do it once per 512 4k pages to bring VFIO in line with other drivers such > as IB and vDPA. > > qemu guests with at least 2G memory start about 8% faster on a Xeon server, > with more detailed results in the last changelog. > > Thanks to Matthew, who first suggested the idea to me. > > Daniel > > > Test Cases > ---------- > > 1) qemu passthrough with IOMMU-capable PCI device > > 2) standalone program to hit > vfio_pin_map_dma() -> vfio_pin_pages_remote() > > 3) standalone program to hit > vfio_iommu_replay() -> vfio_pin_pages_remote() > > Each was run... > > - with varying sizes > - with/without disable_hugepages=1 > - with/without LOCKED_VM exceeded > > I didn't test vfio_pin_page_external() because there was no readily available > hardware, but the changes there are pretty minimal. > > Daniel Jordan (3): > vfio/type1: Change success value of vaddr_get_pfn() > vfio/type1: Prepare for batched pinning with struct vfio_batch > vfio/type1: Batch page pinning > > drivers/vfio/vfio_iommu_type1.c | 215 +++++++++++++++++++++++--------- > 1 file changed, 155 insertions(+), 60 deletions(-) > > base-commit: 76adb20f924f8d27ed50d02cd29cadedb59fd88f Applied to vfio next branch for v5.12. Thanks, Alex