Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1617376pxp; Thu, 17 Mar 2022 12:50:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysdzYwjG363hme8fjl7ObBa8yrtaFZ5SDJ5D28aLAcQjcZL0vI6/+y58iyp/2mB4VpT0fw X-Received: by 2002:a17:90b:1a89:b0:1c6:4398:673 with SMTP id ng9-20020a17090b1a8900b001c643980673mr15462299pjb.40.1647546599951; Thu, 17 Mar 2022 12:49:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1647546599; cv=pass; d=google.com; s=arc-20160816; b=FHT7oDIhLJzO1cSXJ6mm5yy2eX2auWPzLPjADS6Zd5s6Fj7Mdeq5zkz6rss2MVK4zu ZHNUv7SEChxd03BfyD7CrmvV7XDyaWJsZKNGQtFSu7/3XJNPtgBg3/xJOCI4mFLwQQJq 6rl8w/6V31/eAl9yaSufY/2fXZYnEA4kWedjp9K7OP7u56/v/xceuni8BUNSnZ6csy4a Dx0hVnPiwgFAojfD66GjlqhduxPl9SnKcYiJkgN+7OdtDsHL/+8JzPgrIukv9m/fjHC7 DuMWW+sP3qEyICrkSpYYEwZuunZUguoJrHTsopkxa2I3mT3epk4DbeMSyQLmt71mI0U9 lwpg== 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=yUZnYOsoAYlFR6kl+DIrmDSDloBHCLicnBDqLC4k5Jg=; b=AjO3GV4sdhAk3CAmA/byclH67S+BcxVrkt5iQmI0a9t22+ao0cjUzKpecPYSjkS+m9 XPHbgwT+JhIPhriBc2yfBDW9kq7zEjyX8cz2T/I3bgr/YMQkv0X4tVlpU1GztmTKqH32 FDJNB1HloiBOfmgIvcBsmoLx7e7ERtPfppU5t4AaCKuZ0pn2TcbHjJCLRmJqpzQgR0iY b8HWkcDNlwfWw8CaMIJLsQWphHyWfzADkxlti9Sv9e2SPO7H4ZxKWyNkQwdI2TgkVtG9 4WRxos8pgAZWg3wEtn2O0+YfYuvVCrpOpNjeWOH6kAo5HRm7KVXXGrrTBFcfUtwlnUQV hT2g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=mmZ0S+b7; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m20-20020a634c54000000b003816043eef0si2918550pgl.229.2022.03.17.12.49.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 12:49:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=mmZ0S+b7; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AC86822FD87; Thu, 17 Mar 2022 12:47:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237234AbiCQSLx (ORCPT + 99 others); Thu, 17 Mar 2022 14:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236915AbiCQSLw (ORCPT ); Thu, 17 Mar 2022 14:11:52 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2049.outbound.protection.outlook.com [40.107.92.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07762217C70; Thu, 17 Mar 2022 11:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kYVvvKCfcUA9UJgLBo6IUWjwY5Fif3E/Q+d4bqB6TxsvRnIwEiWXZqEtfo3xiMHMfB4oYoKrWA1yiP5vDbPuwgT6gKw6fLwOo0UAItWt0uJkDrNeufblJeARVS93wqmONsv/e9VEnXLy5WKw/E9z+TZVDcwCjZSltL4OJud7jyu/S6iL0XxRJkTFADCaNyuSc4WcDj/NKtF8GZDpS6/UYlUhH7sRH69hzBlfKjmo60eSnOFctrGKECav9t5Dh2TDkqyChrTL75ji5JFTwfj4tLkIR8/6PmrK034qLzRhdL9cN+9s3Q9Ie45mbBfFkpV1UhcDc3hVEavuRL18NlbP/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=yUZnYOsoAYlFR6kl+DIrmDSDloBHCLicnBDqLC4k5Jg=; b=QE1xFjpWmatC1Hwat9rDQMAV87CQkdL1JSM2A6TKv5Dhev26+DWstfRw4RFCFZK7upIqUeoienKvZHbUtYSyt0HULjyMCm6gQGCaN3enU2CeCUniZFyeUjIA40TMSrL93BBDiCeH+7O31NPYGMsn+fu3YaI5E5zEp/iG2sUZD2LAk8/DvjvTdyDbp1Z68sdAodLvvPPGN9qf0dkSoJFj1C3HiOzAKIejFso6wmSB5tGyHCpvtju6nJdAHH/lrYTCjlFvUkn0cgud49ScYfn2h2jdEXAyk56uiuWjacMK1RctAkwSCDiMa89O5ztAU1ntak39oVJBHedPGM+JO7e6MQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yUZnYOsoAYlFR6kl+DIrmDSDloBHCLicnBDqLC4k5Jg=; b=mmZ0S+b7UI2IZ37VbWYEB2L8JI9mqDTV5JOkEqqC6OTRVllbT5DaQQPeH8szF/zANCxZ+iT1CtUHaYJtt3e1Ukgdji0KGAZETXxNWupULwniMR90/0oZ1ixAV9Zzn6VBxKP0hUxxzfCK4/Vf5ATKZEmeA5Yi95K/SJYr7QWNF20= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM5PR12MB1947.namprd12.prod.outlook.com (2603:10b6:3:111::23) by CO6PR12MB5475.namprd12.prod.outlook.com (2603:10b6:5:354::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14; Thu, 17 Mar 2022 18:10:33 +0000 Received: from DM5PR12MB1947.namprd12.prod.outlook.com ([fe80::90bd:5b12:918d:5703]) by DM5PR12MB1947.namprd12.prod.outlook.com ([fe80::90bd:5b12:918d:5703%6]) with mapi id 15.20.5081.017; Thu, 17 Mar 2022 18:10:32 +0000 Message-ID: <3a475e5a-1090-e2f4-779c-6915fc8524b1@amd.com> Date: Thu, 17 Mar 2022 14:10:28 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 2/3] drm/msm/gpu: Park scheduler threads for system suspend Content-Language: en-US To: Rob Clark , =?UTF-8?Q?Christian_K=c3=b6nig?= Cc: dri-devel , freedreno , linux-arm-msm , Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Akhil P Oommen , Jonathan Marek , AngeloGioacchino Del Regno , Bjorn Andersson , Vladimir Lypak , open list References: <20220310234611.424743-1-robdclark@gmail.com> <20220310234611.424743-3-robdclark@gmail.com> <3945551d-47d2-1974-f637-1dbc61e14702@amd.com> <865abcff-9f52-dca4-df38-b11189c739ff@amd.com> <915537e2-ac5b-ab0e-3697-2b16a9ec8f91@amd.com> From: Andrey Grodzovsky In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: YT1PR01CA0095.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2d::34) To DM5PR12MB1947.namprd12.prod.outlook.com (2603:10b6:3:111::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7716cd27-8ab4-42ad-eaf6-08da08416ceb X-MS-TrafficTypeDiagnostic: CO6PR12MB5475:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DcZWPkCFFQAdOI4i2ERHpey6pKXWv25uUUi5pZbHRfvedfrwTZCu47rOPktbCeLxgyCPhp4ZwLhJtq8RviYe+OzXfuJUy5vE+vbKC/Mxkla5tKOjpcclGYYlxplGnR6Au9HtuttQIxPl/JPMLb0ZqSoyN3X7oMK300RyFxBgeTM8agbT2UdDc6Kn/VT3mpG7nW4ezT8xYATTmun5Y7cOmcCAoBKPryOJz0eTitP1a2jfvwewykGPsIR/O3AQpje/OviZW1LhMRPWZv7LwHu7c9b3gkFZhuOjpsqfE35ZFNDu2yEtnwG/kd1JinaqX8gjlPlZKZCG58Hu99SEceLirF0PY7rlZqOHluGNjRHOV9hg/Vbin+MgEeVfYtTNkYQcnNADN15U5Jxdrl7XHj4USi73WixTacRWwjQH6u4sTBxv5LhGD//oVFfosyKsPC+05a5oDpxPzyFvkwpWHzcQj0WwqW96NfaH6B132u9vlg9il7bpSctIV2Ep792WD3vDenmehEIFl55gJbw4Iho8haVnxqFIZ8ItjDVSZb2NPIhFDEFKxoXjXslt7Yf4Dvkw4PCsR7d66mEbWtcqPN4CZb1eVknhcg9iXhuzVt10YakfFgcoJJBi0ysVClO6AJpZIofb8/FW4KCbAFjo9/LcGuwtreQZOTcZfISZuyHTEz0kNdT0jTndTB61YulY6Xt26ixXLTIIM9nA08VELo84eDTjIXANjVpc/oWmqETk30zoNmOG3ADMWCx7PBQxSS9F X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1947.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(36756003)(15650500001)(2616005)(54906003)(110136005)(6666004)(31686004)(6636002)(316002)(6506007)(31696002)(2906002)(53546011)(6512007)(38100700002)(6486002)(83380400001)(4326008)(186003)(44832011)(5660300002)(66946007)(66574015)(66476007)(66556008)(86362001)(508600001)(7416002)(8676002)(8936002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UlNQK3E5SzQ2VTc3a1pYdVZxYVpBODkvQ2M1amVkSXM2ajE5eWZ1T3dCSDZR?= =?utf-8?B?b0RHS3ZGa3ozVWsyTStsS1pzN0J4a1ppVWlneFhlNU1DdU9XL3l2OWpEc3NO?= =?utf-8?B?a09MTDdJYzZ1d0IxV0dkZHZST1VCdllmVm42anBRTmdpd3RxaWZRYVlMcHhK?= =?utf-8?B?VERmQzBBUThVZXV4SmJNM01CQ2UvMENlUjdkTS9HdCtwV1cvUGRvMFV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hyWDJJNld5NUEyZDVPb0kvOTRkNW9xZUgzSys3WHlhSVEz?= =?utf-8?Q?LjVyyA?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7716cd27-8ab4-42ad-eaf6-08da08416ceb X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1947.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 18:10:32.1518 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Z1AKCK7v0U7XAwsEuHy8HF0IolW7emRGGdAbLbNX1ShIFED/6OWFPK6qFzQUBkAnMpQEp6LjOgCf0gLD5uKINw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5475 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_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 2022-03-17 13:35, Rob Clark wrote: > On Thu, Mar 17, 2022 at 9:45 AM Christian König > wrote: >> Am 17.03.22 um 17:18 schrieb Rob Clark: >>> On Thu, Mar 17, 2022 at 9:04 AM Christian König >>> wrote: >>>> Am 17.03.22 um 16:10 schrieb Rob Clark: >>>>> [SNIP] >>>>> userspace frozen != kthread frozen .. that is what this patch is >>>>> trying to address, so we aren't racing between shutting down the hw >>>>> and the scheduler shoveling more jobs at us. >>>> Well exactly that's the problem. The scheduler is supposed to shoveling >>>> more jobs at us until it is empty. >>>> >>>> Thinking more about it we will then keep some dma_fence instance >>>> unsignaled and that is and extremely bad idea since it can lead to >>>> deadlocks during suspend. >>> Hmm, perhaps that is true if you need to migrate things out of vram? >>> It is at least not a problem when vram is not involved. >> No, it's much wider than that. >> >> See what can happen is that the memory management shrinkers want to wait >> for a dma_fence during suspend. > we don't wait on fences in shrinker, only purging or evicting things > that are already ready. Actually, waiting on fences in shrinker path > sounds like a pretty bad idea. > >> And if you stop the scheduler they will just wait forever. >> >> What you need to do instead is to drain the scheduler, e.g. call >> drm_sched_entity_flush() with a proper timeout for each entity you have >> created. > yeah, it would work to drain the scheduler.. I guess that might be the > more portable approach as far as generic solution for suspend. > > BR, > -R I am not sure how this drains the scheduler ? Suppose we done the waiting in drm_sched_entity_flush, what prevents someone to push right away another job into the same entity's queue  right after that ? Shouldn't we first disable further pushing of jobs into entity before we wait for  sched->job_scheduled ? Andrey > >> Regards, >> Christian. >> >>>> So this patch here is an absolute clear NAK from my side. If amdgpu is >>>> doing something similar that is a severe bug and needs to be addressed >>>> somehow. >>> I think amdgpu's use of kthread_park is not related to suspend, but >>> didn't look too closely. >>> >>> And perhaps the solution for this problem is more complex in the case >>> of amdgpu, I'm not super familiar with the constraints there. But I >>> think it is a fine solution for integrated GPUs. >>> >>> BR, >>> -R >>> >>>> Regards, >>>> Christian. >>>> >>>>> BR, >>>>> -R >>>>>