Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp116115rwb; Mon, 26 Sep 2022 15:44:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64VS/KulZNQL06KSDS0tO+n2ACTCQQWDIdpCuOBk/P+UGNRDBURizKW19D9ylJki3BgA8v X-Received: by 2002:a17:90b:4b03:b0:202:a7e1:2c9a with SMTP id lx3-20020a17090b4b0300b00202a7e12c9amr1013749pjb.195.1664232271714; Mon, 26 Sep 2022 15:44:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1664232271; cv=pass; d=google.com; s=arc-20160816; b=AJTk4HB/5O0RiksIstD6WWarKF/6BSwBtEVzPGKEvBd2lf0USzVgXQN7WerdQd2AzT nQa9/3L7tZTkqopRwVKaXl4aUXcBknCwyNvSi/O+jfxEoqIUk0oSay4+4Ky7jIzcDfbn 3DjbKPCGKXaeOfHWULrEUQOJ7IcfiFrOYvYIjdQW66/zMXaltNhIdWM/h4Cgj+ThS7hS XtmtGX6gCBcY6xQoEcEIZYINVFFIJpbEj0vctSpiFM9et4pZa7/b1rHKv8gKWJD//iCS bJrbKy+7RETgR2QPMqyOnyyRvBqfZSctjiz4zCTbGe2bDdifs/KlPLC2491xHCp2vYBT P+PQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=2g+LvgGu5HmjnIQ4e+1YaJenZ4HHO0ohx4KHPWb0i8E=; b=QfcCKjJGClJaZdrAjMPm/npUIuUr2KblS32OeiBy9OS4TMGPLkywVOkV9bNPRQWJhh xLSzJZAB6w3+m0LBkjIVIRsBDAvoB7hZGIfqgy2uC3kvXOZUklYBq+6utMMEiyhZIEja yjzNtAl1QyJNL9Uk4ga3ZDsbxLPAWUac8dsVu03QsEDys92f31tqXYc01PCg1XYU2yJM CR1TpJHksFuhlgU+q2kCWouen+81Vlp3U67r+IPYds3bb+mKrNMEJ/jRLg9PdUWliRiP A+EDaGetgcy8YbAY2voXqNNCyiXNu6eb0zYwFTUDHOHtT/dty5K1Kx5kolaew/XCjhlz +Hmw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=QndPviO5; 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 20-20020a630d54000000b00435b2509951si18769425pgn.439.2022.09.26.15.44.19; Mon, 26 Sep 2022 15:44:31 -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=QndPviO5; 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 S231320AbiIZWQa (ORCPT + 99 others); Mon, 26 Sep 2022 18:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231459AbiIZWQS (ORCPT ); Mon, 26 Sep 2022 18:16:18 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2050.outbound.protection.outlook.com [40.107.93.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 039E6E0AF for ; Mon, 26 Sep 2022 15:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nsJGQ0Ql4OQ+m29ViM+ss8ESWfXCVyL6wBk6Tbpyo/q+HqbWO/CMcJpDU0C1iJWsy/OPCB19VKv9BZelODXX+9oJIBWzJ+QAAitpFvaOXkwgH++0p+AiX+mLNpAoc0uSAitUNez5SaUzpWG0p8nGvt2mzdsX1fe9y43jq05oafZCmwHEwjzvq8bvGutzjxc6js+fQ5NUwOZxvzUy1Qk9SCpR8N8E4eB3qnLedtifa569qJLj3mHnefqYaB0feJAxC8CWZfaBOh9dZfVqoRy2AKojyRGelv6ldv2j/E0iRWzeVGRZ31taBcS6MSaRQJh4RvqMgmDbsf+Nwbi+Ped2+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=2g+LvgGu5HmjnIQ4e+1YaJenZ4HHO0ohx4KHPWb0i8E=; b=BV3hLaCt3X7KvscbFiAEkBE0ydAUiT8uK6B9RA6hxr1rS/Spdur0KPFqQwEToe61xbSwifPkaqbqakyIhYMOQgNML3/R6lTNhbadUw6IHXHT2X7pC64ewOet1CB0q0TVEsSq+QnkKIpBJAWILdmwdezabi39n2aMkI63i+HPycq7MoWdp+U8f4AdhN55cCz24kHEFhYIL57c0yYXEj5vWBlZ9cHFxlO+qXEf+cTZSTOpwunLyQxD4/YsVhYO/cHjLkuiwf5DmDYExdg9IKsarhHIpOsw7pLNPOF6SwmdJ6+kCjZx/SUmY1VQKZEbJkyI5XZGx8Qj2gX0Tl2vRaB/Jg== 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=2g+LvgGu5HmjnIQ4e+1YaJenZ4HHO0ohx4KHPWb0i8E=; b=QndPviO56XxQJUoDJHQMA1km+h13U/EjWhc5+m12ObRTQuNmeZYdgMocYaSS4Vi3OUjfp+O/buxf+tEOPO929wjYO0EMyBHdAxDNlNVrpJh1kJU34kj+uG0rG3gKd/a1MpWaRtMyLbss8IIwpsn7TFg0B561PctlJ4pY9v9mtn+3uLujVD1F7Xjf2OWRzRo2eQM1AahJNgfg4hMFW8ElWUSdxkqYqHMOoiP7FGUMayeTRoLG7GjSEYmS0YdbGQJDgYTbNj6pCJ1rQ1vG+h8yKEsK7gID0qB6dYT++b9ePcNnp+uRvlcSxlajfgRL1+xhZzHbPkaGuSOABW8XTr0kmA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by BN9PR12MB5383.namprd12.prod.outlook.com (2603:10b6:408:104::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26; Mon, 26 Sep 2022 22:14:13 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::51d9:c02b:e5a1:254b]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::51d9:c02b:e5a1:254b%4]) with mapi id 15.20.5654.025; Mon, 26 Sep 2022 22:14:13 +0000 Message-ID: <6ff9dcc5-c34b-963f-f5e7-7038eecae98b@nvidia.com> Date: Mon, 26 Sep 2022 15:14:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH 6/7] nouveau/dmem: Evict device private memory during release Content-Language: en-US To: Lyude Paul , Alistair Popple , linux-mm@kvack.org, Andrew Morton Cc: Michael Ellerman , Nicholas Piggin , Felix Kuehling , Alex Deucher , =?UTF-8?Q?Christian_K=c3=b6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Ben Skeggs , Karol Herbst , Ralph Campbell , "Matthew Wilcox (Oracle)" , Alex Sierra , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Jason Gunthorpe , Dan Williams References: <072e1ce590fe101a4cdbd5e91b1702efebb6d0fd.1664171943.git-series.apopple@nvidia.com> <881735bda9b1ba0ecf3648af201840233508f206.camel@redhat.com> From: John Hubbard In-Reply-To: <881735bda9b1ba0ecf3648af201840233508f206.camel@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SJ0PR03CA0182.namprd03.prod.outlook.com (2603:10b6:a03:2ef::7) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|BN9PR12MB5383:EE_ X-MS-Office365-Filtering-Correlation-Id: ed5d9840-5741-4d29-e200-08daa00c716f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vg69X1cQAKzsLKXWR7uVyOU9iUyRbfBDv0NI8jjV8kGr75hFHbC+B1apucQUOrLgFt/SlJEh/iND3OkqZ/ZINp5BA+I+JB8PUHZ032UCWuF21bW/KPo7/QlRacKAxoAHMgn9XXQntW/hxZChViYKdJdfxvMeHdqxpGLPYC/Yh63pq+IzplPgQW0SZvHApGJBEhFLxRPxOhp4ZaudGp5kLjobpzhlEvoWHHUn5gu6eB//i6t4AFiyvJu7SKpVqCeTUW7mJB6GvTRWI1uHEvjrd2Rk4L8e30+A0W62/uHOSHII6xqMnfzrTq8hPz46bBUmSzb5S5mfQcumyH9WweI5Vxp2/7Z5OjZ7JhlZZvKtRnS1BKQt/kGxthh4pO8fPQsFoM+Q146814R24KYCRvUzPdE64HxvForfP/tYzLN6Qk8dduGnkia30ferRazT2iIlap7Bq7zKJSjJo3mqiA2XVUXZRuaxSf9vxy8VGjnxnyL1IZZOu64BxFauhnERdoV7AkDBEe1fNhBuw0mEMH5Qx2je3E+TO7Z24USJc7XjnAc0cttZxhkLlrb+01R+e1xgLaeoHt4R5mfyS0fM0vIZUCNVATlTxmbpwldTTUfihOL372B0ZHU37/P8Orb5pOlK629h+yWDeuSG5TuqbLdWYK/orHeNhBVRvTgm4lSmhcH3t4etJi642fHvYMOaNiWttkyY3XUmdVQRTWtlhfP7ZI38HV58/s4yxAw5lakDlYMXWuLcCPpdcmhINetfRG9bm7UKWqvnCJHnsunXbajpqY4GtCnbz7qwiHb8Mq+402w= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(376002)(396003)(366004)(39860400002)(136003)(451199015)(6486002)(478600001)(31686004)(2616005)(66476007)(66556008)(8676002)(4326008)(186003)(36756003)(53546011)(66946007)(6512007)(2906002)(7416002)(5660300002)(6506007)(54906003)(26005)(316002)(110136005)(6666004)(86362001)(8936002)(31696002)(38100700002)(41300700001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cGNJNVh5c2tXOWxzUXEwNUNGVldVblZCbHRTRUlJSWl0dEJkajY2RXI4TVZh?= =?utf-8?B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3NiVThxLzhYcTdic1R6ZGoxRWZWcTM2cmx2U2JqK3B1S01HZU9kRnUy?= =?utf-8?B?Wm51NWdCYjdaR2h0TGREK0lwVVdaQmVtamlsOGJCR2xiZjEyNkNtelU5ZkE5?= =?utf-8?B?dHIzazd6Q3l3bzhNbmptM0RXdktWaUxVSjY3L2tpNVYwQkdreGczOUJIcUFo?= =?utf-8?B?K0ZZUmVnSjFpU2k0eFdMVnd3VXVIemgyNTY0cTNQZ09SRTVJUWhUSzFzZ2tF?= =?utf-8?B?dU1BR25nUHo2ZWRYWlBXY1dPK3ptM1RjcjNvZWo5cHVsWkJWYUZiOXZvTGJp?= =?utf-8?Q?e5LXjD0x1ZheO89uOIrgPG98K?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed5d9840-5741-4d29-e200-08daa00c716f X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2022 22:14:13.1430 (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: 3HDQQNZg2glLVeW+9HZ7gEyMW2/HvB9UejVgflsOwiimpDsVxpXp94mlS1oTzcuvqAeHONVaUbrsEGSL8qt3Ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5383 X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE 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 9/26/22 14:35, Lyude Paul wrote: >> + for (i = 0; i < npages; i++) { >> + if (src_pfns[i] & MIGRATE_PFN_MIGRATE) { >> + struct page *dpage; >> + >> + /* >> + * _GFP_NOFAIL because the GPU is going away and there >> + * is nothing sensible we can do if we can't copy the >> + * data back. >> + */ > > You'll have to excuse me for a moment since this area of nouveau isn't one of > my strongpoints, but are we sure about this? IIRC __GFP_NOFAIL means infinite > retry, in the case of a GPU hotplug event I would assume we would rather just > stop trying to migrate things to the GPU and just drop the data instead of > hanging on infinite retries. > Hi Lyude! Actually, I really think it's better in this case to keep trying (presumably not necessarily infinitely, but only until memory becomes available), rather than failing out and corrupting data. That's because I'm not sure it's completely clear that this memory is discardable. And at some point, we're going to make this all work with file-backed memory, which will *definitely* not be discardable--I realize that we're not there yet, of course. But here, it's reasonable to commit to just retrying indefinitely, really. Memory should eventually show up. And if it doesn't, then restarting the machine is better than corrupting data, generally. thanks, -- John Hubbard NVIDIA