Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5915787rwb; Wed, 7 Sep 2022 09:46:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR7PfxHoAX/6SAiuzLHP4blN00Sb6fD1yFQOKmPtiotg0f+fTi+3DhY08xTrfrBosIZ1FOxj X-Received: by 2002:a17:906:6a22:b0:73b:f069:e769 with SMTP id qw34-20020a1709066a2200b0073bf069e769mr2985755ejc.544.1662569165432; Wed, 07 Sep 2022 09:46:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1662569165; cv=pass; d=google.com; s=arc-20160816; b=SPBhy9X6bMs5xviiZT34Uidw6VlufBnj4S/4EFi76b8i5PlyIJ1FiaGlrkN7vKjg2V 5naiPV+FrD68N1M+DJvzwORCVrlEAzVOs0E3etRKQmLnUZfu+FcF75Mi/0JGrfs77GDc QSQWZkx8IboxjA8h38MD25h2tlJT3ggODgh7M/37JW+5LmhrDa57uHQcdM5pacgj6Qfk qxJ1GGetYSkjnPMTTB9esE9QSt+mh87qJc+5wm2fd+inwBzVTZvXZZJqkeQHt3bXusuh KZImptZm4qp9+wODZnfHAO4uLQR3Hx0IuCOvy9bbEKmQVXYZyT614ygChCE+LRnMo1gy +BzA== 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:to:content-language:subject:user-agent :date:message-id:dkim-signature; bh=4woffgzYz5EiZjB+u8rBpdJf3XddeREq5x4RvD/3xus=; b=SWkkiKmVKTDY2goDdo2fkv+hlMDipw1Wn4rNAwA5h2ReoUlbDTBeHnO4UT41FIb1Ss 04O3gRbgW6CCk7UzSUfvgv8uFFHnPTpFdHdoELc5dmlm5AgvIyaUkI+IVZ48MXyV+jpF rnRWDRNQ8+UCKXhE/0qdOWrYynIbf2I3+LlgT21MrQqrJnoI2PHQ7sKskOGqW6Vf0lrZ LyIzCj1JunRofXkS3rUvszrkQIRBYhpajW0YPuS22j78/c+cVeItuJ1aHLutqk5zg4TV LQpjcV2eWh0wSNbMVOVEDt2suiSglbkZO1K5lDVdc10ZScX6jjVca5rR1z7KyH1CVdLw 3VzA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="QrGhtC/z"; 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht17-20020a170907609100b0076fa1e1274bsi3232518ejc.202.2022.09.07.09.45.40; Wed, 07 Sep 2022 09:46:05 -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=@amd.com header.s=selector1 header.b="QrGhtC/z"; 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:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229670AbiIGQSp (ORCPT + 99 others); Wed, 7 Sep 2022 12:18:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbiIGQSo (ORCPT ); Wed, 7 Sep 2022 12:18:44 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E75A9F777; Wed, 7 Sep 2022 09:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hTu5jveGTngdfBeo0KJwi1EQ7TGAJAmVifzkfU2/CeDigHWdFq9tTYF6MDNp4hXiqP66LbXfHo77Iuq+XTjwxqEf8kF4QNT7iO/5I3rbjJvHwU71iIHbFs6Lix6eAeQklmNvPIqokVAoV4nW12yBx/YshknoRNRtm68sMivCW7wgvcxqcu9/+tqPYhSF5+8v7w5qZUjKWamCuGGOY9gpXz3agBwrVJHJgnND6wwbkJ8yHaXqEMpuJH4p5K/ScbSrf+bVDDZgjv9vQWKg+22B52p/7WEdYjYzfqD65ThlpViS1MYJvAzU66b2t+3alVCFUUTi18iA8YRcruFZaVk3KA== 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=4woffgzYz5EiZjB+u8rBpdJf3XddeREq5x4RvD/3xus=; b=fCPiC0UcigxFBF6TXpbF4K92BmqrCuHlqUGgcqRFUF6FdBm7E5r7Nd6LgIFn9LHm1eZL6tGQd1V77f+i0YnQMpE97c1s6QEN/vJwlNq8v6+TYH5m8IooeQCVTi8iox2kwWQbduIa73wE4GQbO4d5yGAgeh3G6yrngVXB4S53Y2WYkxyEREoMuCvch3jS60Re/KfCnapfDpNyGlRY7ZKy2tJPwnVOfiYQM1+bzeuxKH1jKvkxohFPmwipFQGrMD7hiaNOmMr5gFwLF6M2eh+RBFpKsYjUS8sKCjCL6OPgf8pIGG457lacbGVKn2M1OEbcrpobKI8q6+ONee3+pgYpUg== 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=4woffgzYz5EiZjB+u8rBpdJf3XddeREq5x4RvD/3xus=; b=QrGhtC/z4Mu2G8kuv4Wx+tV5ENNMBApft+UXRSTtsN21t/Gokrr4NziuzkIWef0tSRbtVPMdxqnmF6rcwe9vWF9KSF7ljMJHGMyUsb89IC/vTj1AoqYHKb0b6w1x0Y7KcB8H3tCo0B44g6YD8NtM2lArMVF4a/1yaJzcjIRgpS0= 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 MN0PR12MB5762.namprd12.prod.outlook.com (2603:10b6:208:375::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.14; Wed, 7 Sep 2022 16:18:40 +0000 Received: from DM5PR12MB1947.namprd12.prod.outlook.com ([fe80::80ca:c97:d395:1acf]) by DM5PR12MB1947.namprd12.prod.outlook.com ([fe80::80ca:c97:d395:1acf%6]) with mapi id 15.20.5612.014; Wed, 7 Sep 2022 16:18:40 +0000 Message-ID: Date: Wed, 7 Sep 2022 12:18:37 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2 1/4] drm/sched: Enable signaling for finished fence Content-Language: en-US To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Arvind Yadav , shashank.sharma@amd.com, amaranath.somalapuram@amd.com, Arunpravin.PaneerSelvam@amd.com, sumit.semwal@linaro.org, gustavo@padovan.org, airlied@linux.ie, daniel@ffwll.ch, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org References: <20220905163502.4032-1-Arvind.Yadav@amd.com> <20220905163502.4032-2-Arvind.Yadav@amd.com> <5568fad0-1503-a0f3-222e-c238fd4eefdd@amd.com> <9b57b254-8d67-9937-5cec-783e7a4d8f56@amd.com> From: Andrey Grodzovsky In-Reply-To: <9b57b254-8d67-9937-5cec-783e7a4d8f56@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: YT3PR01CA0090.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:84::30) To DM5PR12MB1947.namprd12.prod.outlook.com (2603:10b6:3:111::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR12MB1947:EE_|MN0PR12MB5762:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a46d6da-d663-48d0-72ea-08da90eca01e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aM3+0poZjrJRAN0dTVeXUQfRrl0yr/Tn0i0OQY+TKuCd3eGYWAUAsNCA23q/1C3TpWgMyPyKDe1viY5APaBkd1zuvjjixTIBmuikWmcJOJthBI4NF7lMzpWO7ligsMiIGr+yqbCxqeqvadnCOqkPQaVMVw2+nrbB9pqDpgjlrMI6ba758Ka5QS1Ax/pKVWsIX+XsHw2Aa8UhDpPqARS+WGOlwwD5KkVFZYminyoTbiqsjsuKCOnrd01dGvGkaKbZf+9++vdOMYTba8SRbOMoQ/SGjxo+fmbIfNJ1fnhdxLKRi4yUuvy2vSNxnl+13x19nVRICeXgDGvp5VuaKESxgFRw88FL3Bw3JWztT4f7EhsrUt2FFbDgeQalf/E1uoNDDTvDqempHuarRaJK7Gfhikjpl6R3Y1Xj6Fw/H+GNx21xXkvY3Han8qRlMXmCOZD5la9M3WLeEMOhfVJ6nDezvfMIdEMSikueM+xA/04YTSI0d92XPX/6vRN15Ejq26yK2lRJq68lGg73RDMni5L5Z1SA7rdobQ1wrABZCIBoAIEi7J+xqtwAe8Bx3xh5S4OTTh/7fGD7MwokYyDrfIoiJ4gbL8wG2RB1fTAGUKupgOdxbk9jMbyzj6rWqOkhzOpGtgXdwoCEbPOc8KloXui2I205bXi96oQKRvAY3bYhyB/BfqWJlhE6pwVCP5OShosmkuwbcmtGepyU0lUkz0W0bFCXddDf/0wc9HMZiy4fCT5Dy1neHvS/dQ4rr2QVSzTzANKvLONPx6BFzoQUo/374qtMdA84OtlB7JrY1XfO8Qatp/zi32apFpwrST/RFiKB 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:(13230016)(4636009)(39860400002)(136003)(376002)(366004)(396003)(346002)(66574015)(6506007)(86362001)(6486002)(8676002)(66946007)(186003)(31696002)(66476007)(66556008)(53546011)(478600001)(44832011)(41300700001)(2616005)(8936002)(6666004)(5660300002)(2906002)(316002)(31686004)(921005)(36756003)(110136005)(6512007)(38100700002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bDFuZG5Bc2tONHYycWs0ekh4dlJ1dFBMWTM3SXhrei9yaG5mY2JJWlU0N2E1?= =?utf-8?B?TlBZOEFCR213UHExRXdzdlovQmxpc2NpUkNrUXEwVDZoMW05dlIzSktOeEhV?= =?utf-8?B?NGJ1bERoemVJNUQxQUx6WjZ2UTMxclZzek85MnZ2R0NKcXFiSDArTWNTelRU?= =?utf-8?B?QjJhckRWemMxaHYzenVydTVrVmV2SGc0UlAxNnJSQmNqOTllWjBvc05wT2ZE?= =?utf-8?B?ZVVkM0VkaUFYcjlBVGsvbjVTenNSb3pMS1RDZG5sUkVXdE1rTkhRRFo0M3h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kZjk4empMZXZNUXIwakt5WldnTGZsOXQ3U3NhTGlYYzNHSVNrOTZMTjAv?= =?utf-8?B?bGVGOHB2enFmM2pDckJpYk5IV1JGRDhGRW1PZC9kSVRFSDdxdmk4V2RXdm80?= =?utf-8?Q?Sl5I5fMMIWeezwcIDTO3JBvOEzQAUqcZZk1FQec+koHa?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a46d6da-d663-48d0-72ea-08da90eca01e X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1947.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2022 16:18:40.0940 (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: E1t7haCHM3M/HF/X5GEkzvC2s/BcGUiovV9pEYE2OV7SKkHWYmQsKcqL3bdz0J6pxxMYtUCDniVwrMt4WSTgRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5762 X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,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 2022-09-07 02:37, Christian König wrote: > Am 06.09.22 um 21:55 schrieb Andrey Grodzovsky: >> >> On 2022-09-06 02:34, Christian König wrote: >>> Am 05.09.22 um 18:34 schrieb Arvind Yadav: >>>> Here's enabling software signaling for finished fence. >>>> >>>> Signed-off-by: Arvind Yadav >>>> --- >>>> >>>> Changes in v1 : >>>> 1- Addressing Christian's comment to remove CONFIG_DEBUG_FS check from >>>> this patch. >>>> 2- The version of this patch is also changed and previously >>>> it was [PATCH 2/4] >>>> >>>> --- >>>>   drivers/gpu/drm/scheduler/sched_main.c | 2 ++ >>>>   1 file changed, 2 insertions(+) >>>> >>>> diff --git a/drivers/gpu/drm/scheduler/sched_main.c >>>> b/drivers/gpu/drm/scheduler/sched_main.c >>>> index e0ab14e0fb6b..fe72de0e2911 100644 >>>> --- a/drivers/gpu/drm/scheduler/sched_main.c >>>> +++ b/drivers/gpu/drm/scheduler/sched_main.c >>>> @@ -962,6 +962,8 @@ static int drm_sched_main(void *param) >>>>               /* Drop for original kref_init of the fence */ >>>>               dma_fence_put(fence); >>>>   + dma_fence_enable_sw_signaling(&s_fence->finished); >>> >>> Ok, this makes it a lot clearer. Previously I though that we have >>> some bug in dma_fence_add_callback(). >>> >>> This is essentially the wrong place to call this, the finished fence >>> should be enabled by the caller and not here. >>> >>> There is also another problem in dma_fence_enable_sw_signaling(), it >>> returns early when the fence is already signaled: >>> >>>         if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) >>>                 return; >>> >>> Please remove that one first. >> >> >> Why we even need this explicit call if dma_fence_add_callback calls >> __dma_fence_enable_signaling anyway ? > > Two different fence objects. > > The dma_fence_add_callback() is done on the hw fence we get in return > of submitting the job. > > The dma_fence_enable_sw_signaling() here is done on the finished fence > we use to signal the completion externally. > > Key point is the finished fence should be used by the frontend drivers > which uses the scheduler and not by the scheduler itself. > > Christian. Oh, so we need to explicitly call this because dma_fence_add_callback is not always used for finished fence right ? Yea, then it makes sense that the client needs to manage this since each one has his own logic what to do with it. Andrey > >> >> Andrey >> >> >>> >>> Thanks, >>> Christian. >>> >>> >>>> + >>>>               r = dma_fence_add_callback(fence, &sched_job->cb, >>>>                              drm_sched_job_done_cb); >>>>               if (r == -ENOENT) >>> >