From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2525CC07E95 for ; Tue, 13 Jul 2021 19:34:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E3B626128E for ; Tue, 13 Jul 2021 19:34:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3B626128E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 703776E11E; Tue, 13 Jul 2021 19:34:41 +0000 (UTC) Received: from mx1.smtp.larsendata.com (mx1.smtp.larsendata.com [91.221.196.215]) by gabe.freedesktop.org (Postfix) with ESMTPS id 25F466E11C for ; Tue, 13 Jul 2021 19:34:38 +0000 (UTC) Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx1.smtp.larsendata.com (Halon) with ESMTPS id 58e5d393-e411-11eb-9082-0050568c148b; Tue, 13 Jul 2021 19:34:32 +0000 (UTC) Received: from ravnborg.org (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id 61C01194B3A; Tue, 13 Jul 2021 21:34:48 +0200 (CEST) Date: Tue, 13 Jul 2021 21:34:34 +0200 X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: Daniel Vetter Subject: Re: [RFC] drm: return int error code from mode_fixup Message-ID: References: <1626196421-24595-1-git-send-email-gracan@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Grace An , linux-arm-msm , dri-devel , Stephen Boyd , Kuogee Hsieh , pdhaval@codeaurora.org, Sean Paul , Abhinav Kumar , Dmitry Baryshkov , aravindh@codeaurora.org, freedreno Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Jul 13, 2021 at 07:44:12PM +0200, Daniel Vetter wrote: > On Tue, Jul 13, 2021 at 7:14 PM Grace An wrote: > > When CONFIG_PROVE_LOCKING is defined, the kernel randomly injects > > -EDEADLK errors for all the ww_mutex. This results in > > drm_atomic_get_private_obj_state randomly returning -EDEADLK. > > However, the mode_fixup functions do not propagate these error > > codes and return false, causing the atomic commit to fail with > > -EINVAL instead of retrying. > > > > Change encoder, crtc, and bridge mode_fixup functions to return > > an int instead of a boolean to indicate success or failure. If > > any of these functions fail, the mode_fixup function now returns > > the provided integer error code instead of -EINVAL. > > > > This change needs modifications across drivers, but before submitting > > the entire change, we want to get feedback on this RFC. > > > > Signed-off-by: Grace An > > Why don't you just use the various atomic_check hooks we have for > this? There you get passed the state and everything, have a full int > return value, and things actually work. > > ->mode_fixup is for compatibility with legacy crtc modeset helpers > from the pre-atomic times. If the kerneldoc isn't clear yet, please do > a patch to fix that up so that @mode_fixup points at the relevant > @atomic_check as the recommended function. Agreed, and we need to document this better. I have posted the following patch to make it more obvious that mode_fixup is deprecated. https://lore.kernel.org/dri-devel/20210713193257.958852-1-sam@ravnborg.org/T/#u Sam