Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4598169rdb; Fri, 15 Sep 2023 07:06:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHI62Uh3wIMeYJMeCg7zrSi/PlzDFjkwcwVp5XuMfjlhpFgtvzhusPNMw+hGiGs5wjAelCc X-Received: by 2002:a17:902:dacf:b0:1bb:85cd:9190 with SMTP id q15-20020a170902dacf00b001bb85cd9190mr2134027plx.18.1694786763474; Fri, 15 Sep 2023 07:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694786763; cv=none; d=google.com; s=arc-20160816; b=I55bMj6Yt7zxJpt66FceW4GRhMm+n2ep3ZeoQK99eLdeQDq++AXgamVP0OYmx6owIl 0KEcgkdLYZ8JOszcLpb0WoS1StbF6JoFPALRfUKNkoNIeqPiX9Ys3lOmHS6S0ETm38sj s59/CMkemRF5hYnZlE2kGrXvqmi7TZB1e42jFBK39dRmILuxW/Cvk3CHl3HnfTyp1Ect 4vmQlCD8dgoWwlKfcWNrcr+8ygn0NvFn3ida4/AnL1Ng9Mf7fHg6ToUg9QMgDH4N3mLs zV9QrDJVYrExeNJ/3DH2zDFm0fX9uZzfib0+61uOO2i/wYzT2CC2K11HASsbNVeYuJ3u BGOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=4U4g/XDiCJElRGzFusu4V14UcGbLbruRMn5W34WIAGQ=; fh=qcAkVWKjS2kX609nxAf/YfmzrfW2SG3+mu/F8Auxjqo=; b=mWf8Al4Ta1ly7gEmQzj+RCg/inT8MOlcFYNrnEtx1HBMaQTFJuEwGu5636l/5EcvNj OVpbJgpLSNRjnWswEQoWdpnIZbznlZujEp5ySjeY+rGcJMgBJozV5NMFyp8H4WtVilu1 9/i53LpzcvBJ5fuR52GxiWFkSMyBQUo/ESqkJuu+jFZsBxeEYEIfAjPteG3Fltyo5No2 BYxyd2I0xSIjoqqZ26GVWXoKabXEhspPO/bKnjwgZF1629wfABgAfaXZL01Uvl0nf7h7 bEK4w0/4P6Lt2n3as7hYzMkbZWXavCUuoL9Jwsu/TBAKeMcgmzJvVkwaFVQiVcEWOpkU R3Gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id y9-20020a17090322c900b001bd94d06ce4si3709836plg.171.2023.09.15.07.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:06:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BDE868066628; Fri, 15 Sep 2023 07:03:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235487AbjIOODE (ORCPT + 99 others); Fri, 15 Sep 2023 10:03:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235203AbjIOODD (ORCPT ); Fri, 15 Sep 2023 10:03:03 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3FA1B1FD0; Fri, 15 Sep 2023 07:02:52 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8CxtPAKZARlTX4oAA--.13156S3; Fri, 15 Sep 2023 22:02:50 +0800 (CST) Received: from [10.20.42.43] (unknown [10.20.42.43]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cxvdz9YwRl_WEHAA--.14359S3; Fri, 15 Sep 2023 22:02:48 +0800 (CST) Message-ID: <743e062e-17e8-dec0-30ba-c7682ea3109e@loongson.cn> Date: Fri, 15 Sep 2023 22:02:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [RFT PATCH 2/6] drm: Call drm_atomic_helper_shutdown() at shutdown time for misc drivers Content-Language: en-US To: Doug Anderson Cc: dri-devel@lists.freedesktop.org, Maxime Ripard , airlied@gmail.com, airlied@redhat.com, alain.volmat@foss.st.com, alexander.deucher@amd.com, alexandre.belloni@bootlin.com, alison.wang@nxp.com, bbrezillon@kernel.org, christian.koenig@amd.com, claudiu.beznea@microchip.com, daniel@ffwll.ch, drawat.floss@gmail.com, javierm@redhat.com, jernej.skrabec@gmail.com, jfalempe@redhat.com, jstultz@google.com, kong.kongxinwei@hisilicon.com, kraxel@redhat.com, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, liviu.dudau@arm.com, nicolas.ferre@microchip.com, paul.kocialkowski@bootlin.com, sam@ravnborg.org, samuel@sholland.org, spice-devel@lists.freedesktop.org, stefan@agner.ch, sumit.semwal@linaro.org, tiantao6@hisilicon.com, tomi.valkeinen@ideasonboard.com, tzimmermann@suse.de, virtualization@lists.linux-foundation.org, wens@csie.org, xinliang.liu@linaro.org, yongqin.liu@linaro.org, zackr@vmware.com References: <20230901234015.566018-1-dianders@chromium.org> <20230901163944.RFT.2.I9115e5d094a43e687978b0699cc1fe9f2a3452ea@changeid> From: suijingfeng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Cxvdz9YwRl_WEHAA--.14359S3 X-CM-SenderInfo: xvxlyxpqjiv03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBj93XoWxZr4rGFWDKr43JrWxXr4DKFX_yoW5Kw4xpr W5Zas0krs8JrsrArn2qr17Wa4Syw4Sy34fXrsrKr1Uurs0gFW2qF4Fqr15Cas8W397Kr42 yw42qwn8uFy5AacCm3ZEXasCq-sJn29KB7ZKAUJUUUjf529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUPSb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVWxJr0_GcWln4kS14v26r4a6rW5M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12 xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q 6rW5McIj6I8E87Iv67AKxVWxJVW8Jr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI4 8JMxk0xIA0c2IEe2xFo4CEbIxvr21lc7CjxVAaw2AFwI0_Wrv_ZF1l42xK82IYc2Ij64vI r41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xFxVAFwI0_GFv_Wrylx2IqxVAqx4xG67 AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26rWY6r4UJwCI c40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26ryj6F1UMIIF0xvE2Ix0cI8IcVCY1x0267 AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_ Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU58cTP UUUUU== X-Spam-Status: No, score=-2.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 15 Sep 2023 07:03:06 -0700 (PDT) Hi, On 2023/9/15 21:44, Doug Anderson wrote: > Hi, > > On Fri, Sep 15, 2023 at 2:11 AM suijingfeng wrote: >> Hi, >> >> >> On 2023/9/2 07:39, Douglas Anderson wrote: >>> Based on grepping through the source code these drivers appear to be >>> missing a call to drm_atomic_helper_shutdown() at system shutdown >>> time. Among other things, this means that if a panel is in use that it >>> won't be cleanly powered off at system shutdown time. >>> >>> The fact that we should call drm_atomic_helper_shutdown() in the case >>> of OS shutdown/restart comes straight out of the kernel doc "driver >>> instance overview" in drm_drv.c. >>> >>> All of the drivers in this patch were fairly straightforward to fix >>> since they already had a call to drm_atomic_helper_shutdown() at >>> remove/unbind time but were just lacking one at system shutdown. The >>> only hitch is that some of these drivers use the component model to >>> register/unregister their DRM devices. The shutdown callback is part >>> of the original device. The typical solution here, based on how other >>> DRM drivers do this, is to keep track of whether the device is bound >>> based on drvdata. In most cases the drvdata is the drm_device, so we >>> can just make sure it is NULL when the device is not bound. In some >>> drivers, this required minor code changes. To make things simpler, >>> drm_atomic_helper_shutdown() has been modified to consider a NULL >>> drm_device as a noop in the patch ("drm/atomic-helper: >>> drm_atomic_helper_shutdown(NULL) should be a noop"). >>> >>> Suggested-by: Maxime Ripard >>> Signed-off-by: Douglas Anderson >>> --- >> >> I have just tested the whole series, thanks for the patch. For drm/loongson only: >> >> >> Reviewed-by: Sui Jingfeng >> Tested-by: Sui Jingfeng > Thanks! > > >> By the way, I add 'pr_info("lsdc_pci_shutdown\n");' into the lsdc_pci_shutdown() function, >> And seeing that lsdc_pci_shutdown() will be called when reboot and shutdown the machine. >> I did not witness something weird happen at present. As you have said, this is useful for >> drm panels drivers. But for the rest(drm/hibmc, drm/ast, drm/mgag200 and drm/loongson etc) >> drivers, you didn't mention what's the benefit for those drivers. > I didn't mention it because I have no idea! I presume that for > non-drm_panel use cases it's not a huge deal, otherwise it wouldn't > have been missing from so many drivers. Thus, my "one sentence" reason > for the non-drm_panel case is just "we should do this because the > documentation of the API says we should", which is already in the > commit message. ;-) > OK, this sound fine. > If you have a specific other benefit you'd like me to list then I'm happy to. You should think about the answer of this question yourself. But I will not object if you can't find one. OK. :-) > >> Probably, you can >> mention it with at least one sentence at the next version. I also prefer to alter the >> lsdc_pci_shutdown() function as the following pattern: >> >> >> static void lsdc_pci_shutdown(struct pci_dev *pdev) >> { >> >> struct drm_device *ddev = pci_get_drvdata(pdev); >> >> drm_atomic_helper_shutdown(ddev); >> } > I was hoping to land this patch without spinning it unless there's a > good reason. How strongly do you feel about needing to change the > above? Not very strong, this version looks just fine. I will not object if you keep it as is. But I will also hear what the others reviewers say. Thanks for the patch. > > -Doug