Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6913899rwr; Tue, 2 May 2023 07:11:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4D+2c/3JpHOPGk7dL0qDpFtYeI1UN3nAxVkVY3fne1d564Tr4pRjQSk13+CTrMy/FzZo9b X-Received: by 2002:a17:90a:4cc3:b0:24e:3e07:9e27 with SMTP id k61-20020a17090a4cc300b0024e3e079e27mr377888pjh.10.1683036703588; Tue, 02 May 2023 07:11:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683036703; cv=pass; d=google.com; s=arc-20160816; b=Ip/CdBfWNlHHs1RB13uK59GY4b24G3Hox8PN/FQ/1Ir+LKfs7D1aJiW0x3qdoREv85 yX5AKO7rHQ09w8nJ2UxFjbBG9BIBHw/q0taF6aGHT3lrZExwxSUuN4ITLGFIm9k+q07M G8Up++nXaAxwSd3uyCrtIb+jpCDFUTujpK9QkFHTWemYyZYkaznHMt5QDUM5NSXJ4y0b Jk+VX1QgS1kme6O3dBs/O4rj4tI5eTSsoJnMYbKT7Cf6POishonhBn3WWbjhYu0xE7gA 0SfPN+vGdWWhXEa3SL9ehKzsww7FmCPdLge6B0LJ+aZhYvw3KHFthvtuHXgjoUP9KvcJ 5R/w== 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=YWyb8CqJytYwagtqVf04XG779EIGuTcRyCVfyx5n65E=; b=JFlX1A2GxcD3hox1Nk0mcDV2A1u77CMTUrlwPNF4q/+wN3Z+0RbSvA19BwnNxKdCA8 xtjCjI1F/NOi2+9u9T1plhUXMNHsx9AT447BheQlPkQwBiKXYkAfr1HUkNuvqwBO6U0J fy72jHIuH8iqyYx3qp7hdM6X5+tvR6AV8DLmys9pOx73ZxpEVuhutRuoahoF0uL9kx/7 TzpREUaj7rOc+eHj6xtnLNoK6iVaLq3V9EJ/7IVGLkrEhyFQzl7ywSxgIwfVkI8Xu5V9 1A6EHfM6yf7Jka3WNbCrpTJBT9MmEzZo4DLJmNCgRQY6zA19Skr7VLzPArsHZPl79S2I xvuw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=N6YLmN4o; 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 w70-20020a638249000000b0050f6aaf7f27si32554711pgd.331.2023.05.02.07.11.22; Tue, 02 May 2023 07:11:43 -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=N6YLmN4o; 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 S234304AbjEBOEn (ORCPT + 99 others); Tue, 2 May 2023 10:04:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbjEBOEk (ORCPT ); Tue, 2 May 2023 10:04:40 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2044.outbound.protection.outlook.com [40.107.223.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72C0318E; Tue, 2 May 2023 07:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vf2u+hq69bmLBrr92m0BZG7RQub7yAuKYjDlTvK7xzyf2g0/FWMFjyDM4n+Bj0pBEHMrix+ieA5IecqYfRiXdYTPvDW5gyot9c8W3OAJC/Z7IYzA9Gj3E4bJ3zHUKyEZXV8Dj/mvaaXbdl7JSYkGq98jmSaoRMt0ohTLcuo/mjgF2lxquvNLyCuHuyrkEbxvpSsDG/3vD+DvyqI8M8S8ZtBliChdKQURpRaW0YwGu5REobQdWbNEU1B7P/KDUQH93g+uW1xsum8Z5VG/tuWkTs/qKbEpn0TqyFKC08k8LdfhjVLwD4v1TF8JCcHEwnGLaBbYcun/E0NoGTsb9d+P5w== 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=YWyb8CqJytYwagtqVf04XG779EIGuTcRyCVfyx5n65E=; b=ETptffBPU8x1wbxqUm2Y+70XUHUZGzMRNa4yDTAGiUA0mmsuppoKizPD8nk2ZzIjdOlz0CoELRkay9eUdWLGtIUQCMH3nObbKZmUdo9TJjXGFF0b4vb/3lRdaCsgZakNIAZQEuxnXqXU1xYtMPjaXrPyv1m+RCTDHMBbBLrL5Byq8tl+ePgbCMHdXrehkTL0bdDzFC4H2LGytKVrIpmdda0PcT9wxnQttzpdXnQ/C2dwep3PHxaCtPY05NIy1LL5yovm7PfI3cUJ6ehWz/nv40eYNhTc9xST39Of+dfmWiPy0CUpCe/kiyWBFczaNNhckacZOQOkNlPStMGXAQSfrA== 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=YWyb8CqJytYwagtqVf04XG779EIGuTcRyCVfyx5n65E=; b=N6YLmN4o43ttBf56/thx73WBBPnbEnXplXUMPy1wduelYenzMlDNqd2PMDR2SkehsBQGp+THabxKb0WyKkFFgxx8bXoofdNZsNEG5dBiUAR0YEA96ahNUitMt+1FiZ9n8OLsVRTBV91TUbr65JI5Xlwpk048DTT/Uvpcyk7b1pQMvMNZ36ezM2dsu30Vo//zVFfXwBexrucZIMMoEybzrOVAWH6WEWgFIFbvI8/dm+nSu6TwZofs85KX4Qucg/deB8azF1fq0RmVjQpb7KotlaxhzPxEHIvhBGOgzzGbHABRwbS48CQnLKc8KERaRhKSXjHrehddr1dK/Dqfp53AUw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by MW3PR12MB4492.namprd12.prod.outlook.com (2603:10b6:303:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.31; Tue, 2 May 2023 14:04:36 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab%6]) with mapi id 15.20.6340.030; Tue, 2 May 2023 14:04:36 +0000 Date: Tue, 2 May 2023 11:04:30 -0300 From: Jason Gunthorpe To: David Hildenbrand Cc: Matthew Rosato , Christian Borntraeger , Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Jens Axboe , Matthew Wilcox , Dennis Dalessandro , Leon Romanovsky , Christian Benvenuti , Nelson Escobar , Bernard Metzler , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Bjorn Topel , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christian Brauner , Richard Cochran , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , linux-fsdevel@vger.kernel.org, linux-perf-users@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Oleg Nesterov , John Hubbard , Jan Kara , "Kirill A . Shutemov" , Pavel Begunkov , Mika Penttila , Dave Chinner , Theodore Ts'o , Peter Xu Subject: Re: [PATCH v6 3/3] mm/gup: disallow FOLL_LONGTERM GUP-fast writing to file-backed mappings Message-ID: References: <7d56b424-ba79-4b21-b02c-c89705533852@lucifer.local> <1ffbbfb7-6bca-0ab0-1a96-9ca81d5fa373@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1ffbbfb7-6bca-0ab0-1a96-9ca81d5fa373@redhat.com> X-ClientProxiedBy: BL1PR13CA0336.namprd13.prod.outlook.com (2603:10b6:208:2c6::11) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MW3PR12MB4492:EE_ X-MS-Office365-Filtering-Correlation-Id: c546156f-6cde-46b3-b97b-08db4b162935 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U1GA36bOEYwtOLRpwp2p4RCTcX+SPRA/9BZZXTSrjk4MQoFiv2jMDxPDeud0tVlFB+uwbjdSkp3agIBZJD+VweeCg0/lqp4WGA7bubZa5FlMg+riNC2rYxpvelfwGqmUmCSVTg2uf5fCsQLELtKEw+G1CEO/7sDxlQ2apBDaj1rkOlk5/M0s0ahe7Z0k/awqa2uY2jme4zlR50y3LNeo1qigvgDETXs62z7WIBRW1gSrLFWt1FNebtGzpfgbjhy5rJxCgw9rbiGLglv5cFyxjsRCyfGtUnxQb9AjP+tPhzJm+fTi5SUx1OVppB0UGcjhUCdWT2GKBLHbYkv8SXjI8pS54f4ifMDcDl0fwYMItyCPk128K3pG2UQzCy43yqspFuTzY0txUECwflefYDCyElJffJEeHVb2EzUxVbwMOihVldIb1rnLgtuxfw/qL0yNQgwrYqgCbSInhbyXqeX4KPO+HS1jROBy7+0h61lAXmDaw3zXDzX72z2SESFuumrPnBukZEkXkM+WL+Y6+JTacwYvc57c6R9K3EYYpH8uLXyQOP7pAcwUzyXE5meX8qQW X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(39860400002)(346002)(136003)(366004)(451199021)(6486002)(6666004)(83380400001)(36756003)(2616005)(186003)(38100700002)(86362001)(26005)(53546011)(6512007)(6506007)(2906002)(316002)(66946007)(6916009)(66556008)(66476007)(4326008)(478600001)(5660300002)(8676002)(8936002)(41300700001)(7416002)(7406005)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?gdkk57Lig6+JmaV9iszwCGK+OpaREgDrZRreyK30Sk0FWLAS63KJpy1oaJgZ?= =?us-ascii?Q?+IbYUnwxLnRY/mPF/15UvthVrsCQCUdQy8VHZSMNuBaRwixwiWsjUbMLogHJ?= =?us-ascii?Q?2+qqw5q/OHvTy3ZEejogJHKEFvw/jrH7Oq4DijEeWXBi73Cge5fRU0lD2/CU?= =?us-ascii?Q?f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miEudx942F8DgSgC4tgiCn?= =?us-ascii?Q?yarVK5cT/MgbJe0snkSArWsNrTWtR8aksnB9dv0tfT1ejWy23l3rJOLv+ynM?= =?us-ascii?Q?rSfW0PbSLtKDIMVBZm7fSDnlfbLjKzpoiMlHRsFbfQns7b7F9LX5nYh/usFR?= =?us-ascii?Q?aR7sQhFnR7qpVB9c6URN3hym1GUJzAqG8kBYMpgZVhCjGV5ZdmYpymwLOAk8?= =?us-ascii?Q?B07Y6Psri4D07etK1PZco/fiqucK3rohZArXp0jkP0Oi8v0nkn/r6cF/gleJ?= =?us-ascii?Q?P+afQ1XGDGzPLYP0YdyhRwWVXpxka6cxXdpCHq/dHQvCAzBuRaqWuGI+ku0G?= =?us-ascii?Q?y/gFI0HjhB+BFprJsy0cJGiJJcR4/y327HY6VDhaZjsP9DmHTwjUdcV9rlPk?= =?us-ascii?Q?M1jma0utuYIavhSQd6gbG5pjkTaZOpy0PT3CzS1JD21tBFU6/7dhIpUVBGjR?= =?us-ascii?Q?P9ReUXfx7ttImwz1LgA4dPNxbyu5ZgRaEOeHvQKmeQb3Z4aCNlZ5vARL/jaB?= =?us-ascii?Q?kGQJyFxfci5eujstGCXumBz8Jwp/DoUaz8mboxIT?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c546156f-6cde-46b3-b97b-08db4b162935 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2023 14:04:35.8464 (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: s6cxgGEN17ViNVOfhHSbG9ogqt3N1ETAkLIrQF8/R2oNl0zKF1hQcp8YqLDksRNk X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4492 X-Spam-Status: No, score=-1.3 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=no 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, May 02, 2023 at 03:57:30PM +0200, David Hildenbrand wrote: > On 02.05.23 15:50, Jason Gunthorpe wrote: > > On Tue, May 02, 2023 at 03:47:43PM +0200, David Hildenbrand wrote: > > > > Eventually we want to implement a mechanism where we can dynamically pin in response to RPCIT. > > > > > > Okay, so IIRC we'll fail starting the domain early, that's good. And if we > > > pin all guest memory (instead of small pieces dynamically), there is little > > > existing use for file-backed RAM in such zPCI configurations (because memory > > > cannot be reclaimed either way if it's all pinned), so likely there are no > > > real existing users. > > > > Right, this is VFIO, the physical HW can't tolerate not having pinned > > memory, so something somewhere is always pinning it. > > > > Which, again, makes it weird/wrong that this KVM code is pinning it > > again :\ > > IIUC, that pinning is not for ordinary IOMMU / KVM memory access. It's for > passthrough of (adapter) interrupts. > > I have to speculate, but I guess for hardware to forward interrupts to the > VM, it has to pin the special guest memory page that will receive the > indications, to then configure (interrupt) hardware to target the interrupt > indications to that special guest page (using a host physical address). Either the emulated access is "CPU" based happening through the KVM page table so it should use mmu_notifier locking. Or it is "DMA" and should go through an IOVA through iommufd pinning and locking. There is no other ground, nothing in KVM should be inventing its own access methodology. Jason