Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7222944rwr; Tue, 2 May 2023 11:11:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7sT9UHmiab2cAIZPBognUrncXFc/6bOUdN92WTZL6llj1ihuTD5QLa1lRszV6SFeOQfy87 X-Received: by 2002:a17:902:d2d0:b0:1a9:5e33:72db with SMTP id n16-20020a170902d2d000b001a95e3372dbmr22933904plc.28.1683051102974; Tue, 02 May 2023 11:11:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683051102; cv=pass; d=google.com; s=arc-20160816; b=zNaUH6Mh//9pG0AmMs1RzsXlaXOqhZLNO3VwQxgUZCGMFPYf3U/lhQjwOWauFJ2PE4 khPM76i6GW06Dy2PccJ7WgoRH6Q3zfdl2BZRuUsW+mjuvGDMaMC6sZHCF6lKtEzwjQ62 imGP4z+OMS/XEUg7bjjnaA2L/U2Af3nw3bzVnkhffLQ1IR2ccbxiXpCEBxWP+tSJzVSZ kfFRb+grpIiUOTy6NSxY8udjm3pNFm/Bc60Ed62DFqIW98PH5WhNQ1Sz0mifZOLtktM2 Kcd6+jAeDCAZ8Igp9lKlVMFmL32SoQfwPWhNWXMQmQ8rXQJJUdrtt5KklLCUr+XBKz62 jzRA== 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=J7+2MIEVoGgjMoFqsaFaiOHF2G2Y2Z3pQ7O/Pmm5vHk=; b=n8ulEwTgEY6xkJDeIL1sgviqHS2NG4nV5PT9Ul4QjD/sXkJR46Nyd0Pq0l/G7e/aO5 9reHoScyYQybC2yI7nVtWWOFVh/toVVr7Ln0FERsL8/Vd1nLgIUAwPNOtKZPEQOscx5Q MCUL22T8h8cEZHlmqgxIPsxWw6ZU5yc01J8bZTjr+VSxzmdkc49vA+kVeEL72F4rZVJM vKJBisLhDmpNDzq40l5K+W1CtMAbEC4IsnlTnKLqV1SNabgPBwtgszHZMDwP5NAAJW5S SbnGsXaWYtXvfHrjZlJpAcPkoJIDt6ubgeTCUy4pF3Ep0hzsmPaf5ckJ4tJ011EZIpbr ztnw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="stk/Ofcs"; 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 c17-20020a170903235100b001ab109ea531si1565772plh.558.2023.05.02.11.11.26; Tue, 02 May 2023 11:11:42 -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="stk/Ofcs"; 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 S233968AbjEBSKC (ORCPT + 99 others); Tue, 2 May 2023 14:10:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233971AbjEBSJ7 (ORCPT ); Tue, 2 May 2023 14:09:59 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2069.outbound.protection.outlook.com [40.107.93.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67B56173A; Tue, 2 May 2023 11:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VKy52yGeYLK1zoI7wxJ+imcn9iYlZ0PPbWZkjM7PRscAaSF2YcdXGu6GZsHHByuTQUUf8allT04Vv4dW6/qC5xtVB+je19bSP1imAcSFRMeAFYuE53+7wDqSvXUzFnuy5FtgyDxb/90nHey7QKDbZicIYtVRQNylfd4UxV+FU9paBQJcxtD+5ZQ8rG2aX+pN5zbLIPpsdBlg7/V5ET1wxHe60ICCj4mCpZBxmR3E9BvbdYFTFYYZjGzGKuSSBEXB45b6oDR0EX6vJkNcM8BRjikabwCtpGygzh7xRQBag9ylhDqxhh/9GbuAlluXtJaUcrABf6/SS5RLyLw4vHP6+Q== 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=J7+2MIEVoGgjMoFqsaFaiOHF2G2Y2Z3pQ7O/Pmm5vHk=; b=WbZCIv8AfkLkhqeD1B8aC5XYJQKafh+MHG3XJE19eF7lvYBTzO9wyr6caZV1zUxYMWvRgrTR7TRDm7c3HAiA6DQXC4kMNMKjHHaOrxyShAcTYyLeToCCchKztS4xVtv9DXBN5xjY4cErDBKtc7msDST9rvzyuQ7NO0Io6es4VkA+nkiCfe+VKFITT9WXM6iWLv5mLmbHZaDxyJtyVy7EFTl/aui0TuDP2zx3ELHJLjCZokz6J5uPrI1relXc/X9d7UvJPSPIGur5F9ib2yKUrT974/bF6V5rxmhRPDFmu2EvMeXHACnzcgG59F0arqbJQ6Af/XKXYTJgj5P6MpTeCw== 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=J7+2MIEVoGgjMoFqsaFaiOHF2G2Y2Z3pQ7O/Pmm5vHk=; b=stk/Ofcsi0M+8qQlQ8pJjm7/FMix5WHIt1dUBaIF/kR+A52DnXo3DYQOwUQ2fkMV0y/FhlHIPr4u/3ppuOPkwfYXlTSumMO1+lJ6MRw1cBBq7lnIXiic3vGSmgGLwd8rTkonoZRTReFQ/4jHiRI7kd6LAiWBSwCUjBaUmgR3QesRKA7JzLzhtAZ207NXTlOmJMT0Wr88jXhTfRORn1nt8jM9UiYD48o5sMXhiRufVIeMUDsA5nrjRxEjN1lghtDW+PcmrySZSLOZKKwF/b4ZtatU6ZafAjbPHbo7sPq+s4zR8dmT9AYq1Bi1IZitxp2Qk0/u09w/CFevK11YWQUIDw== 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 MW3PR12MB4474.namprd12.prod.outlook.com (2603:10b6:303:2e::7) 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 18:09:50 +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 18:09:50 +0000 Date: Tue, 2 May 2023 15:09:48 -0300 From: Jason Gunthorpe To: Matthew Rosato Cc: David Hildenbrand , Peter Xu , 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 Subject: Re: [PATCH v6 3/3] mm/gup: disallow FOLL_LONGTERM GUP-fast writing to file-backed mappings Message-ID: References: <4fd5f74f-3739-f469-fd8a-ad0ea22ec966@redhat.com> <1f29fe90-1482-7435-96bd-687e991a4e5b@redhat.com> <6681789f-f70e-820d-a185-a17e638dfa53@redhat.com> <2d023b34-643f-33f7-af5e-7e6dce2eed46@linux.ibm.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2d023b34-643f-33f7-af5e-7e6dce2eed46@linux.ibm.com> X-ClientProxiedBy: MN2PR13CA0015.namprd13.prod.outlook.com (2603:10b6:208:160::28) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MW3PR12MB4474:EE_ X-MS-Office365-Filtering-Correlation-Id: d340836a-bf36-45d0-b972-08db4b386b83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yW8y0QunysQoIAZE5PlT1kp8ESnqtRd1wWxuwNPYFWXHYrPxfjkXfr94y3oJa5z3AmVoxYPC906EZYcUC75gjYjhuX2RXCxey44p56KyHX/bAUZKw7jVjj6KZJ8gNmpq7zPuA972EZl9OVqHdiDB5a1t13F+iulz4rnBoPqB5RcDlje5GSLxcTjPFtQGVYp1PQBifwlf4spriR5CBBKOSXs8lKF1OtjQerV+BGkVsmsh6uMRiAjCw4q+LIguiEDwNAbFP9i/RNgnfjjeJExDCCXtaSgzYRjAfz6Gl/F4WXu6zlGwyGV4egZeRwMwFLN5iNkVPoxOwGt3OT41qzStBszwnXEnUk/6lSjdtXCKDmJ7/niR0z4ubVVr3o/MvfXnbkijCw18slTLXx7HeNOQUoHmLsoWgbLKBM9ZbnIFJSyF4QIe/EH45K+sJVX5Dxqncjpo+QwzrXa4HmoTpsLih8F8bT7szntHovYnNkerWDMSsPnq2vKC4ps0iz/7NmbD3jzykRlGYRO/7/Ou3Q2pBcaUNel4uR56aqs8GnIoqtZUYxaZIMiNS7M8Dy/WWxKo 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)(39860400002)(366004)(376002)(346002)(396003)(136003)(451199021)(41300700001)(5660300002)(83380400001)(2906002)(2616005)(7406005)(8676002)(8936002)(7416002)(316002)(6486002)(6916009)(38100700002)(66556008)(66476007)(4326008)(54906003)(86362001)(478600001)(36756003)(26005)(186003)(6506007)(6512007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?HZhfMHn/Dp51vtyUbqyNy6p5XOu5KFHhkl5VDbb9WEoJXWhq8Wwr6EoDzu0i?= =?us-ascii?Q?yOPNxo9yHf+FUtT8rNlyMMnmtoUuj6WacN1p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yk5/FfcjCP5chAaFvNPo41K7cts6QGYYieLAoKtVjvROuirjRVeLOZkHqCDU?= =?us-ascii?Q?vhvt6o0l7POErfFLoJ0Qg84bkRx1uhKA549ufPxywvMZf3EBdc/s5irvSzSB?= =?us-ascii?Q?pgpTTY0i5zPiULo5j5R+hE5oVxgXGrVxw5/LmrlNpFUI6fYXSKekZ58jO+9K?= =?us-ascii?Q?edkrDEmYsJxOa6vnKILsb7knw/9wyAXJ58Kg2gwwf34/Mq1Jd+5dJU+Dgz9D?= =?us-ascii?Q?+R4aeG1FQEOhY5aINWjKF/t0Cgc5w1JUPBNVpcXLLQJhdXEEoaeykMtbn9hs?= =?us-ascii?Q?Up/uzAGQLm2iwJ8h358GhFpkAkZ7e9Z2DoAv/JXsMSH6ZhdjONTXq9mFotol?= =?us-ascii?Q?8ONilEUT3sDhfMLPdLAsc6cb0ZUqkRMm9m+iV0HUUmbGZiTw5afKBwic91ag?= =?us-ascii?Q?8doBnPJt0mMQwXWJPDnaXv5DxL92pmqhcXB6dBYjvJlDC/CrUzaiqy/HYdcJ?= =?us-ascii?Q?sF9Nz89Y4ZXwI1K0vOx6ENtf1lcBhfCU/tFTbBqIJL95XLAN+0NI4oWZ+pj7?= =?us-ascii?Q?edFJdrtPgMBwPkCw+V1QJ9LMAxXEY+mhh+KyP5SpAJAOr/anRwu8bXNAXXag?= =?us-ascii?Q?jR3wjHST5bUP1nxLRP/Tf58O4MAJsmLKgtMV546y?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d340836a-bf36-45d0-b972-08db4b386b83 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2023 18:09:49.9596 (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: ARE9B6aPzX3CuAJaD4uIljG5Ie+2lAO5Fkzejmc5KnpMfrpr+N2F9b8u402zbd4E X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4474 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 01:59:09PM -0400, Matthew Rosato wrote: > >> I'd really be happy to learn how a better approach would look like that does > >> not use longterm pinnings. > > > > Sounds like the FW sadly needs pinnings. This is why I said it looks > > like DMA. If possible it would be better to get the pinning through > > VFIO, eg as a mdev > > Hrm, these are today handled as a vfio-pci device (e.g. no mdev) so that would be a pretty significant change. I was thinking more of having your vIRQ controller as a vfio-mdev, so qemu would have to open the irq controller as well as the kvm and the PCI device > > Otherwise, it would have been cleaner if this was divorced from KVM > > and took in a direct user pointer, then maybe you could make the > > argument is its own thing with its own lifetime rules. (then you are > > kind of making your own mdev) > > Problem there is that firmware needs both the location (where to > indicate the event) and the identity of the KVM instance (what guest > to ship the GISA alert to) so I don't think we can completely > divorce them. I should have said "kvm page table", being in the KVM ioctls is sort of OK - but I'm really skeptical that KVM is a good place to put HW device wrappers. > > Or, perhaps, this is really part of some radical "irqfd" that we've > > been on and off talking about specifically to get this area of > > interrupt bypass uAPI'd properly.. > > I investigated that at one point and could not seem to get it to > fit; I'll have another look there. It is a long journey, but other arches have problems here too Jason