Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3572141iob; Sun, 1 May 2022 23:10:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjxgnqGkRH79xqYEash8KqpL21w5Fuvi3uCTAWQK02L+g/AHDLYDg3aLrjLYOb6CYRJzgQ X-Received: by 2002:a05:6512:1513:b0:448:39c0:def0 with SMTP id bq19-20020a056512151300b0044839c0def0mr8003437lfb.469.1651471817067; Sun, 01 May 2022 23:10:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1651471817; cv=pass; d=google.com; s=arc-20160816; b=hIzvLIKzWZWWmRI37F5oJF5q6k2X/H0FJD/WfpqBKSylTM6ASOZ1kmkLG87VK+8KZf 6udWvVPEdg7k7V5FgPf9rlauHwS+AGel0MUJnE01WQXDSuMbTMxu82kKRSFDR8f9/2j6 oCu29LhXDSxz53jgHygvsl/p8VDDKnC+pHxwCU5PZux0gmjLUw3e2b88Av+mw22WhRxE l0GxssZrks5ZRlxJrbzbaf3oyeyO3DPoViBP0h6xCiftofwqigOwHQSxX4VWhIECgTCX tq+G6gBgBlGD6ue6UNlJ8ASJUEa1H/TjxQLmn6YLxGo1gmQMdOegwx564nCwyNQjrXeY fgzw== 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=GGIu3ogSPoDt76sjYAMlPHZnf8zBLSkwQxkKcY8oTwQ=; b=zc0tID1lYWe3friq1U+R/MKoFMnxfO9H4lDVsN4XB6T02oZLN84lJYo2WE9brqhZSV Jzm4/ZXnHl+aS5vLmeBRKdrXTTQa/xa/s8iLs6lRnCL9uRJwLV6RrPA7x9aalwFY3ySk e/39c3dHIJtSrrBR5iWPphenBgTeD2KNqHDLBpkYxKUnCk+2L+6T/4rjxMeHDz1NyhO0 dA8qrfST2/jPta/Qy9N9N0/86boUQMXiNPEwQWOBEOw2n2HMIqRFPQNvo79eHuSZux4Q 0ZRly5Cr+Z2ookCSmST/NwoKRp1c8ydsT5Cl1BH1pgTAQ0k3eEbWvkMLEbQv1rSujTLG JoqQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=z5Dsn2UU; 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 z20-20020a056512371400b00471a9144179si12466985lfr.376.2022.05.01.23.09.50; Sun, 01 May 2022 23:10:17 -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=z5Dsn2UU; 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 S234943AbiD2Qho (ORCPT + 99 others); Fri, 29 Apr 2022 12:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234823AbiD2Qhn (ORCPT ); Fri, 29 Apr 2022 12:37:43 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2052.outbound.protection.outlook.com [40.107.101.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BCEBDA6F5 for ; Fri, 29 Apr 2022 09:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g4bFo8mO3d6j/kBnsfB1Rm9iWJLKBFGlutr82ceavuNKrb9SwK2Gu7AkMvpWpzzLxVFcPU/sWq2dbE9ddcZDzMEUcc93eG5HsTWE8TPr25vObXkGpGgFJT/S7VticBMpEe1XjDxNrNijWTROqf9sO6koIf87e4uk3enc7ISytSPG2nCYU30JE8Lu3bPyNAfdFxaN1h7YSe9zPoxlBcPczBJm7z0L4U2FEKvGdYriAas+Lv6cGN9TMsc14c6N+uE9b4aml5AcTVLnnTD2M3O4dwqk+9bRQCYfSvxs1AphMr4ZbTfBYeaGL5+wnlQgujq7ebHRlJIHOa0iewxinPpkvw== 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=GGIu3ogSPoDt76sjYAMlPHZnf8zBLSkwQxkKcY8oTwQ=; b=IZ4b1TO26KoRcgKJQv6y5oCx8Cv1UjOzIMIgM5k5gxu6J7DDX5NhbNAmdYdRd5ePiUPqeTiDCeK6XomDsmiMahnvPDMUs48anEQH1lxHxLQTBTRGaTD8g+fDL8ytirZt8CCj0TcZt8SmVC0bO40jEBtKM60QPwE/FAepqCahs51s3NFCxMl56/xXLpRHdEcUZNO5wsV+DcjISEUGGu3ds5NowHH2rgB2m4h7KXqk0Hi+ck6Ox+iAE05hmpmAPZc5Xt4uwhDvpX7k1eQMJ2HQodJ4m1GeXhesLsapLLt5Czy0WxOfbyuCyo2JTTAIyl44XRx3NT0CafebSYSwvpq6og== 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=GGIu3ogSPoDt76sjYAMlPHZnf8zBLSkwQxkKcY8oTwQ=; b=z5Dsn2UUfNa1xPa+Ya1+89fHP//SVoMzpPmG47AdXZEH8m4J/tuHOPx2Ux0sD0WRE9eyxj2jim2T+NmMovdLz8D4ffqiW1eTUh4x98g5jo25J7zWcmdhVgKhEGhIm06F8eBvwLleUbgCd+ETv7+/nxvbfXTYRztIQ6ST5StWRzE= 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 BL1PR12MB5063.namprd12.prod.outlook.com (2603:10b6:208:31a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Fri, 29 Apr 2022 16:34:22 +0000 Received: from DM5PR12MB1947.namprd12.prod.outlook.com ([fe80::1ce8:827f:a09:f6e]) by DM5PR12MB1947.namprd12.prod.outlook.com ([fe80::1ce8:827f:a09:f6e%5]) with mapi id 15.20.5186.023; Fri, 29 Apr 2022 16:34:21 +0000 Message-ID: Date: Fri, 29 Apr 2022 12:34:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] gpu: drm: remove redundant dma_fence_put() when drm_sched_job_add_dependency() fails Content-Language: en-US To: Hangyu Hua , yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch Cc: dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20220425083645.25922-1-hbh25y@gmail.com> <79b198d0-eff2-d658-4b5e-9084a834fc93@gmail.com> <88dd5d67-7dd5-2f58-5254-adaa941deb0f@gmail.com> <65b6cc23-1a77-7df0-5768-f81cd03b6514@amd.com> <9b91e06c-50fd-b567-7d2b-a2597d01c4dc@amd.com> <37a48008-0700-7c60-30d6-ac2f4152114c@gmail.com> From: Andrey Grodzovsky In-Reply-To: <37a48008-0700-7c60-30d6-ac2f4152114c@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MN2PR12CA0016.namprd12.prod.outlook.com (2603:10b6:208:a8::29) 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: f72f448e-15a4-4cb9-77d5-08da29fe1d3c X-MS-TrafficTypeDiagnostic: BL1PR12MB5063: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: HTk30GIPm8rPy5pF4zhe9MOGUwG318tZSNs7LnyCIWIVKi2P0nVQFfS9FpYG2IeIrti66J1OZ+iBE77dRJrFm2SD0G0Qsyq/UVkqNz+R+qqgvXv+omSiSTgdprfAZAI8Ct3VAN3G5ASgETihnhpWotgE8uV8nC6262zboa0MWqrmXI3PjX9YJ+PaUv7A02BJ9OBnspFAwHwU2/5x6HbcnMcnZ8pPVaaD3npyOdNj02Rx/+mjFt31x0DMYp8+wLrR+oDK23YnNJZ71QpOXUV4pBOJ55XC6VF+NSD12knpCEy0W2qN4fI/RRKI1NTqZ1iDlrkk0GAE2F2+lACZ/huby1ZJgJg/txSAmU8T8lJz09c375CLrfeG14ScJo364kyYaLZ33dYDRVi/6UA/dS8yKMLVoDAunxFNO/e4OP9ff8E7TWZ6O9NrSlt2nwKVhbGBU9md55GqwB5+NAzUOznfZvcYP5kkz4bMJK9amlUXvxaDT7zWaQ61zeQr3w9abqI3Fe47Uzql2gF0+Ly0h8mdiIWPIyRpcBiFEwksT8qb24p+t3dfbjkxTnz7h+3EkLEMB1P8qiGSfgBCf0TH+n4jKVE/iKOwmeqifhpMv3quGOLV+d5eMfd3S6xRLIsz2DKc14uWtCa2yexegezHqpbV/qXL29v3x1X2OAIUcs8ismfYJsCeTRMNQHoOQ/iv6oJ7oIhtLcZ1vjC8AFoSPoozVj4mw5f+MnkTOpzkBUsKD7E= 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)(6512007)(508600001)(6486002)(6506007)(31696002)(5660300002)(53546011)(8936002)(4744005)(186003)(2616005)(38100700002)(36756003)(44832011)(316002)(2906002)(4326008)(66556008)(8676002)(66946007)(31686004)(86362001)(66476007)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bW51YkNuQklUL0pNaVFlUXAxTXZkaDF0aXMwVzNOTDVkbmZRMWo2UGhXTUlM?= =?utf-8?B?ZlAydFFsQXY2WjUxOVIvVUd4Z29IK2hiQTNhN1FSQllYLzV6UUxyKzd5bzVB?= =?utf-8?B?eEhlSUZDMVZham4wVUw4eW45c3VxSlpuSDZrbU02Q0duR2ZoTGpMVDFhYUhI?= =?utf-8?B?TkYxbDRXVzVQS1RaSnFrbGt4WVNnZ0JacUNzcktjUWhmUXE3NnNXUzQrRUZ1?= =?utf-8?B?WGljaUppOEx6QVkrZTFGcngwK21TZVJuZldPSjNaeTZxRk8xZHZiV3R0d1dy?= =?utf-8?B?WHFiZHByajEvRFZ5TGE2MW56QjZPWXZwck51U08vR2pLMjNiMEYxc1BEZEVp?= =?utf-8?B?UXdYMkxsSFBaZXdoVVZla1J1eTg0VXI5WHRzT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utf-8?B?UkhrZENlZHEzR3ZBWDVjUHNBL0tkVjR2cXh6VWN6K0FvMWljbXluMHczZGh0?= =?utf-8?B?T3lQaHJnbDYvWHg5YktJVXZXc2gxV3hUVTQ0K2krVi9xMHNNTkp1b2RHbFRw?= =?utf-8?B?STJWYXM4bjFTVWxMZnlYSnhtR3ZSWWJHaEMyNHdnYWlWTWovenJZUlVUdk5P?= =?utf-8?Q?65hH4zlVymtsdfL8Hl+0wjkW3TbULXxWRO1ofmp+1Oiad?= X-MS-Exchange-AntiSpam-MessageData-1: LrMhmjbojx9z5A== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f72f448e-15a4-4cb9-77d5-08da29fe1d3c X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1947.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2022 16:34:21.7311 (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: 6uZNxbwXJNcKICs1oLiQmitewIdVn+KgwuA98+UFLIaX8O7Ln9IRhW8AX1oUm658UB6U7MwARAyE8w6IS18WHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5063 X-Spam-Status: No, score=-5.0 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 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 Now it's easy to see it's redundant, it's a problematic design where the fence 'get' part is happening outside the job->dependencies array logic but the fence 'put' part is happening inside, leads to confusions such as adding this 'put' in the first place. I will look into improving this if possible. Patch is Reviewed-by: Andrey Grodzovsky Andrey On 2022-04-28 23:03, Hangyu Hua wrote: > If fence is released in drm_sched_job_add_implicit_dependencies(), a > dangling pointer will be in obj->resv. > > specific scenario: > recount = 1 init, obj->resv->fence_excl = fence > recount = 1 before drm_sched_job_add_implicit_dependencies > recount = 2 in [2] > recount = 1 in [1] > recount = 0 in [3] <--- fence release. But fence still in obj->resv > > Thanks, > Hangyu