Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2770574imw; Wed, 6 Jul 2022 11:26:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sWp5OGFKLnPNHeZWQQLj0x+MwJA3NSW+uO0lyDp4BMTC9ZWD4B9tS0+eiGk7on/XtGLMzx X-Received: by 2002:a17:902:bd47:b0:16a:71a4:9bfd with SMTP id b7-20020a170902bd4700b0016a71a49bfdmr48274345plx.109.1657131961670; Wed, 06 Jul 2022 11:26:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657131961; cv=pass; d=google.com; s=arc-20160816; b=e8EtrXEGFX+fqnqXeb3xSRnK92P2klyqYFEpgn2vCM4x4f1CL88gPm8aeB9Jw8LXAz AkwnJggGXJEmDy9Vm5ZMcghcP76/b+SZpclbYIu1TYwsNXq6op6z49Z1LCtf8xmC4lHw ypriCKoFTcy2rDYHxPPO/biSq3RX/krKjbYj8TZUfc/kEEb5/+UgDKcRxafZLfjOmHUv RLXSPgEWM2AP0WRLesoQzCjHXWvhozJgcJ3MRDHp/E8Ew4VEntDd7/8mRtTPZwpDpU9G EApRMRIRI6q6JnnIf6OeuMScEFV4GpcRKyMYd8MiwNlXybbqLa2dAkynNUYwSRlvbqqV VkUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GMNb6Gd9xeLGsPXvzyvZnidg9BndostaRgV2CEO0VcE=; b=FW8NgZWfwN7eZFg9Q136ohAXDPMjUW2gC7CMcYOBsyIsX0Y92iwtpW4Jyj4tN9G8W5 FCjsncf798R3rLhaJTqnEoMi/XcluTTGqyHuzipr8b5aMHQqj563PDcfnbZd41JQO3xX tSa87b0D3WenOb0+6IL6Lt5n6sd7moy6I2XUDgBqkANqfDI8OK/WFsmfgP9F3gBANRTC upxlo4NvVSDloc+tAeitqp3MzhFe5cCWSwHN0HgbTqb60fJ4WVD0PyaQgOSYc4X+rQ8r f9Hasah53tnTcbgWDVQXs9onARfp0GczT8LN+eFga/k5RUQjSEoIo09zzKVHrfEJBH+E xIAg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=IQ8uR2kQ; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qe14-20020a17090b4f8e00b001efbdf44c12si1788395pjb.97.2022.07.06.11.25.49; Wed, 06 Jul 2022 11:26:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=IQ8uR2kQ; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233850AbiGFSSP (ORCPT + 99 others); Wed, 6 Jul 2022 14:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229810AbiGFSSO (ORCPT ); Wed, 6 Jul 2022 14:18:14 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2062.outbound.protection.outlook.com [40.107.102.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 900CB5FF0; Wed, 6 Jul 2022 11:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KPnjCVrLTuBZtzVcFPYDvlqsmB4QBs+9IqVB20z8dcDVGdId67+jfB8/OcmD794ENhSUx9RZxK7sBFZQ9rgDtpfHKMFvI8pwon/Lnhps7d/xa/4AnpukQIeNgiLGt3hvFdxXwarfaq0sOLZXYQsuEze/IRRv+uhj8Rt00WGRRody5yCg8CvBvXtfIABTI5XnH3FENdY/IeAcnbVvNa7c+y0bHucFkO4wIi3rs5wo9tR2rJMAyxWK+8AVha5ewcsL6eWMGIuO57N9DCWaRMlwIBL/y/8AdRjJ93/l7Q86bx3BXQg82FmkmnlWrnWg7/PnVCYfYzxJ5avO4DLQqQE1rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GMNb6Gd9xeLGsPXvzyvZnidg9BndostaRgV2CEO0VcE=; b=OvF2di9g+MtsxYV+mm9u6d++Uer53njfA6cVAcvmI1otEnUtPbgiBwlPrmspQbOd7D64beiUCUcb9NzYs3l4OwhP7C7Y+j/dJFK9KjBHj4cf7/g1mgCVIR/uAg4s6XVmfoESDZwclvuSTuMMEfcBAfzCC+Fhe8+P86+h9n8C0/8q2alQ4ShCjdIo3Pw7WfaVIR+a1Rqql8lig7jN/1Hsk7glVP3Ya75t15Y7vdpn3UAIPPKDKllwgPN9sFTRHQBr4/a4YXBOzBI4eU3C8zZTcgqfrpRsDcSPwCY4Cxic9YGNq1UFg4BfINLJi2sqbjur0x/jNGi8oimdUCs06hMaMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GMNb6Gd9xeLGsPXvzyvZnidg9BndostaRgV2CEO0VcE=; b=IQ8uR2kQmoeEED9rj9pVWjuVBKbopmrT4roCmBzLA7F9IdwRLtU5sPpoEBlp0i1Ern8MHewoF2PvSNBkqbJ9m1bQVU6w+W3xAKkMTlvlo37ScalPNeXEEgZBVlQRNfnmGOFgj6wQIhUGNh+aGm0qppQKBAPyQczN40VRceyYmakoRXsEuBJuhIfR3KFlHOs2Qqz3XQRZCCRRSKg1lH1oeymRiVKhaPp8LDy1cKUatT8YCIJQ/Ko4igpyXlgKFyiPi1gAhSbjiZ2JCw+Q31QjSrpdTi8cQk8jERPKrV5VlWebCAc6GbV4o8ETYrA81ZM7SMF1qXJSP18nLCxO3TXCzA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4192.namprd12.prod.outlook.com (2603:10b6:208:1d5::15) by IA1PR12MB6601.namprd12.prod.outlook.com (2603:10b6:208:3a3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21; Wed, 6 Jul 2022 18:18:12 +0000 Received: from MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::ac35:7c4b:3282:abfb]) by MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::ac35:7c4b:3282:abfb%3]) with mapi id 15.20.5395.021; Wed, 6 Jul 2022 18:18:12 +0000 Date: Wed, 6 Jul 2022 15:18:10 -0300 From: Jason Gunthorpe To: Nicolin Chen Cc: kwankhede@nvidia.com, corbet@lwn.net, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, zhenyuw@linux.intel.com, zhi.a.wang@intel.com, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, tvrtko.ursulin@linux.intel.com, airlied@linux.ie, daniel@ffwll.ch, farman@linux.ibm.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, vneethv@linux.ibm.com, oberpar@linux.ibm.com, freude@linux.ibm.com, akrowiak@linux.ibm.com, jjherne@linux.ibm.com, alex.williamson@redhat.com, cohuck@redhat.com, kevin.tian@intel.com, hch@infradead.org, jchrist@linux.ibm.com, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: Re: [RFT][PATCH v2 9/9] vfio: Replace phys_pfn with pages for vfio_pin_pages() Message-ID: <20220706181810.GQ693670@nvidia.com> References: <20220706062759.24946-1-nicolinc@nvidia.com> <20220706062759.24946-10-nicolinc@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220706062759.24946-10-nicolinc@nvidia.com> X-ClientProxiedBy: BL0PR02CA0074.namprd02.prod.outlook.com (2603:10b6:208:51::15) To MN2PR12MB4192.namprd12.prod.outlook.com (2603:10b6:208:1d5::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8207b41e-fbe3-42c2-8022-08da5f7be2e7 X-MS-TrafficTypeDiagnostic: IA1PR12MB6601:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jttkk9mPpHSzsoULSp5i2CvHVEq2kHxnr9j+OSNh2PqecARo1i2xAWgsG++q/0ks9lK+6UTItIKWIFTdnWWxLBFufDxTuCejvSotmr5RkUq3Pzi7wtD9CtTGibntX+Wy59rryA/wCFO0ydDmiJ3Roix2mPYO//d8Fb4kzb0nKaGVww1K0KW86/M25zuQShLYkw3SUpTrRqvKc9IWs1hqS76cM2sYPutnnx7vVHMQ86Pm1+AwLUd+vardl2Ad1kT43S6QYsGnl7WhZtyh71jkVUL0l3J4ERTGJ27qcyclpfuSmcRaC+z+uNpr2ivguCXy5rhREZpMxuPqTvZysuUt+kJBpimtOSKBUEzonqc/Z8mi3XUbFjZ/VFDCcQTMOUgwuF5v6ZWIDv9QW9W22cNJZKoRIYNDDkX3dpWdWccgka2fh9JJzk7Nhg9mWiHnD8xHX4k8nbtqs40zdsdgVfXnq1K6PE080gFWefBZOgOB41IUliroHC1FFhofS1R83tV3EDn8yd0EXGbcefy1bNRfMz2Alarexjwpe3KmUKke/Iuc6hVno5tJPFafcBWVKJ97htY0NrvN4dwK4AddHjg9OmS/dTQ2A67gHSn71T3jeI8Yr6jCG3nUVPk7QJPlc6Z6kQ14/XFmnPIdQIkC/E0os9qCKtBmpTvbwCMobsH0LaluHqoLC4jZwMO9cNOJmIeNih0ERWDa1IqFKX04g/RGTMx9pqho2jDFa5Rhy2VgjeO+HdMRlfOs5kFm/Mm4P96Puf7maFiyGZnHdnmEFqmcX6lmfRW0VQtAe/xQoIDGadC8LSMi9GzUgGtAKtNULABC X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4192.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(376002)(39860400002)(136003)(366004)(396003)(346002)(1076003)(66946007)(8676002)(4326008)(38100700002)(7406005)(5660300002)(66476007)(66556008)(7416002)(2906002)(86362001)(6506007)(2616005)(8936002)(6862004)(6486002)(478600001)(41300700001)(83380400001)(37006003)(6636002)(316002)(33656002)(6512007)(36756003)(26005)(186003)(27376004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1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YUsPSw3ozLnEp3Ky8mELqwueDC4UxHvuwJ7k7Dv4qWeUUMi+VfRfX2lsp21?= =?us-ascii?Q?U8yV2wQS7+RRDHTgnTEC+9pe1/rBSm50TO7vpwSOy/MT7IwT6137ide+Yfem?= =?us-ascii?Q?NPy9d1y+OM94NN/5yEGX/b0ptQwe7IlnkPhUea5rveIC6xcTBhntZ9Iq3JNP?= =?us-ascii?Q?t3NLBIUAwobyLvxPeyNWNxD1sXQkZtNiNN2IgtoWB7zoiirUL38qrXx2EbWt?= =?us-ascii?Q?Wb14HImN1I8BL7mjNTf/M5nnJsL2pUypQI7zVXQF50whH6Ppc992Hu2B4zAk?= =?us-ascii?Q?rgeMw8kRUPZkiEPHg7REUoUZOayooetXacfIQqY1PaxuKjxD6E9JAluYfqkG?= =?us-ascii?Q?OQ1PiTjqf46/MsTNlagUpaGHqutWlxTtY+YNqgY0wihNWhhWD6O2Kr9Mdm1P?= =?us-ascii?Q?TBTaUhVyd1vmwpKlAmQoQLNsEC2myFOp3oapCK951ZzYn0pCzLqm6nj2WrkI?= =?us-ascii?Q?PiO6FgiBvX57RmcEFvtDazfQVj0KFqUvyA9HwNmbeAtvaW+aryOYx3E16La3?= =?us-ascii?Q?ZIFDcxvvB9pe3z69ARMchfb1SrLSICI289BHNzEOs4uPloIq2Et2ylx0osr8?= =?us-ascii?Q?WEfSC75XLx7DTzK9Qv8Xv5e5Tvh+WAB03Mt/wMQx1+uAWFkDoTCMLe8Uem9v?= =?us-ascii?Q?VRuTd1fB8nK5iW0jr9zjoPs9lRD9gymF4tN71j8sWNwePtZxqlpuk44Bw0wX?= =?us-ascii?Q?cr9nWQM3ErkcnSOmxg75aj3PUy8zuskmnwdHFXbJ?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8207b41e-fbe3-42c2-8022-08da5f7be2e7 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4192.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2022 18:18:11.9878 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2eUvxFAUVxGMGVUvHsNX0h6pmRelLngx5jxWHot0QX28txwvBQtpSXyHfZDPleUb X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6601 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 05, 2022 at 11:27:59PM -0700, Nicolin Chen wrote: > Most of the callers of vfio_pin_pages() want "struct page *" and the > low-level mm code to pin pages returns a list of "struct page *" too. > So there's no gain in converting "struct page *" to PFN in between. > > Replace the output parameter "phys_pfn" list with a "pages" list, to > simplify callers. This also allows us to replace the vfio_iommu_type1 > implementation with a more efficient one. > > For now, also update vfio_iommu_type1 to fit this new parameter too. > > Signed-off-by: Nicolin Chen > --- > .../driver-api/vfio-mediated-device.rst | 2 +- > drivers/gpu/drm/i915/gvt/kvmgt.c | 19 ++++++------------- > drivers/s390/cio/vfio_ccw_cp.c | 19 +++++++++---------- > drivers/s390/crypto/vfio_ap_ops.c | 6 +++--- > drivers/vfio/vfio.c | 8 ++++---- > drivers/vfio/vfio.h | 2 +- > drivers/vfio/vfio_iommu_type1.c | 19 +++++++++++-------- > include/linux/vfio.h | 2 +- > 8 files changed, 36 insertions(+), 41 deletions(-) Reviewed-by: Jason Gunthorpe Jason