Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp563484lqp; Wed, 12 Jun 2024 09:26:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXecadKhqfjNi5jJPtGQR+bA7uf8g4Tvcqld011NBSaU3yYGHvfCw+prGktYIiP7hb4tO6grIS5Y9Xp9UIJlUvB7bDA3XX9MIDcizAh1A== X-Google-Smtp-Source: AGHT+IGTH/ca/ZbsVeZ+ipN1uOoKY/QheKBK23BzJWAnb7po7wg6PeenoZ8UkUobbrzStWMYkhKs X-Received: by 2002:a05:6a00:92a9:b0:704:2243:32c with SMTP id d2e1a72fcca58-705bcdef472mr2916104b3a.4.1718209605905; Wed, 12 Jun 2024 09:26:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718209605; cv=pass; d=google.com; s=arc-20160816; b=gakryIB6Xp0XvlQzLKfu/QvYiDDSBg6xBA4MA4+MiA2DwV0rEA4RZcDvTW12UIcC5C B0adR/7YEDnhJGR+oOtSSLvbwChVQBrgDTOWiF0T0vceUU1N4tN5p8rHMCE5ciRS/fSV 2ze6MoReJu9vP9uX6p68ezK965DDL4hwlFqDN7UObPW4Cj8Z9LsfcVZbMDmN+qHtNwt3 AhQ7xhmz5eLCS1+bSFn7CXRlKFNV4VfE5oANYQ8gsiMUowTot/k+P4OAr7dvks0igR0O mrvFXzIcZbsbdf9dolSJxOsqO/ijaw3g1ezFNWzD3w46NOVcA2hWR8NlUpnGJI+Fndhg hf5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=j3rEd/N79zsTx5bN2Ceul3LBY+GMeO3ZQ5xYcqq+Lx8=; fh=wmRE0vgW3URgxPyY0yH4J0rIap5YHDYFiyzHhVUAGEE=; b=FH3uTIRv49fFV/t7kmKTaccACSy0m6hfptM5G67QNg13Poj/v5sz8N3efuV+o+zXlU RSLnYW7rk5xw8edf7mfoBHkipXCupb3M98wXk99+k1Vdf8kSvNJFsVC7IAfdCAPEleH2 BzsVNqN0uXHLxxxwzeUk5m+LkQXdzN0OG9GClA+2kjSx/W4DeqH2S2/5tXw/wXUsmAsa ei7tt5g5pDWMy/u/bo1cC+rObLMF+A7Hx4LJqGSc8eztjKzcP5Aj3kR5tZb2VbJ4kXQ0 8GqhI0HZnjv+eB5r4TZvmejQjCsUrZFrecgH//Qhvqw6Bw9ZQNUs4VTHUHqDTStoL5kJ 0fVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="EZb/lZIH"; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-211766-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211766-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-7042ba1d558si7989140b3a.218.2024.06.12.09.26.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 09:26:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211766-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="EZb/lZIH"; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-211766-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211766-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 25A8C282CA9 for ; Wed, 12 Jun 2024 15:13:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E4ABD1802A8; Wed, 12 Jun 2024 15:11:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="EZb/lZIH" Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3692317F507 for ; Wed, 12 Jun 2024 15:11:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718205072; cv=none; b=BVlV7eln9dFHkB/GwV/92RGp8EueBfjGQjs9ZjooX6OHHLbRjsRVRILBu61bGTUWyKEewyndojS7RphbNqptpe9LGFNcn/Nyk6z2PikB/f/JpH8dOm7KojH+obIWiGaDO7wIL7hlRJ6eLBVY61xeXyuP1LEf+NrTJT3FrXERpEg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718205072; c=relaxed/simple; bh=G0+hLd6oELx91zxUvRGFLWG7LPKQ6qmGL0/jI3fP+Vw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JLvMGNB9XCyiPhts/fbkNRKRymXq4vTRExpm31c2QtAGJ7JtGXA6bApuUkgtFcLIkiLGau8maN0K53nYbq+kKSzNDL5Swx7ID1gyFEAlLpvNZg9rF6Q9G7+Q5ReZdGC/habogwlu7Os7RTO5+w1H/LBpb+GKS6LOiNqSBi/PHbg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch; spf=none smtp.mailfrom=ffwll.ch; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b=EZb/lZIH; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ffwll.ch Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-42110872bf9so7232415e9.3 for ; Wed, 12 Jun 2024 08:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1718205069; x=1718809869; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=j3rEd/N79zsTx5bN2Ceul3LBY+GMeO3ZQ5xYcqq+Lx8=; b=EZb/lZIHRdr9rDuV6Ufuh9HnxicTYLbfBGtSoLa4m9UPFnRBLqwekpMXWN7ziVgUL6 KN567xYdKn+9BJS3NyW9JrlyATO+gNWXNyC24xQcbzIYZwiZkIsdsLZ697K80/KSLcRr bhEXiKDefUIM1h1NcnTw3KDSKvzxdTG6HK/zM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718205069; x=1718809869; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=j3rEd/N79zsTx5bN2Ceul3LBY+GMeO3ZQ5xYcqq+Lx8=; b=ZoYEQol3AR8PlgC27F7SKHLqtwq0IwrPT5JoztphUoPcduqjBBT7X0kl+KxNH5MYf7 r3kTIZrJVdOW3AV4gJBjIBV1zXgZMYh0M+sNH1g63fbKwb2AXd63iNjRKsT0JgJemAjZ XdG28yTTNWbtw5AcjznfN8MzQpqC14eEh5hKnrgdQ1gKUNUeDxQ+Td9af3OxuXwojJWX cKuODgJeQywmq2NLPaqRogPYAn6iXHn7wt6m7PsIUfdPmWcgRvnw//itAQ/Lr4Lym5/i m/h2dIJg6mow80L1fx3n7NAIwFHPzrMMZ14tF5XxJmN5ylAFPfBHIz+e+zFxGLFgeSVL l3ug== X-Forwarded-Encrypted: i=1; AJvYcCXsE2yfYdWgkP1JhLF5SkrFAqFHEUSb2u1WvckdSB0uGUwyjm5663D7IG7q5vJjwyzlU8eVTEvx93E2CeOt2oLudb3DrviEbSJreN2d X-Gm-Message-State: AOJu0YyktQb9iq2qDaYjxCZkmgDu1looa3/kHtlfbZci2s48ikKuxrj1 +HqmAeMdmkioHMz5WgLbwILofe2273M/KJr6TEQb9b7MbLXehV1YuR4w1TEkfYE= X-Received: by 2002:a05:600c:1c85:b0:421:de31:76 with SMTP id 5b1f17b1804b1-422866bcc38mr14735365e9.3.1718205069428; Wed, 12 Jun 2024 08:11:09 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42286fe919bsm28783255e9.19.2024.06.12.08.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 08:11:09 -0700 (PDT) Date: Wed, 12 Jun 2024 17:11:07 +0200 From: Daniel Vetter To: Doug Anderson Cc: dri-devel@lists.freedesktop.org, Neil Armstrong , Maxime Ripard , Linus Walleij , Yuran Pereira , Chris Morgan , David Airlie , Jessica Zhang , Maarten Lankhorst , Thomas Zimmermann , linux-kernel@vger.kernel.org, Daniel Vetter Subject: Re: [PATCH] drm/panel: Avoid warnings w/ panel-simple/panel-edp at shutdown Message-ID: Mail-Followup-To: Doug Anderson , dri-devel@lists.freedesktop.org, Neil Armstrong , Maxime Ripard , Linus Walleij , Yuran Pereira , Chris Morgan , David Airlie , Jessica Zhang , Maarten Lankhorst , Thomas Zimmermann , linux-kernel@vger.kernel.org References: <20240611074846.1.Ieb287c2c3ee3f6d3b0d5f49b29f746b93621749c@changeid> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: Linux phenom 6.8.9-amd64 On Wed, Jun 12, 2024 at 07:49:31AM -0700, Doug Anderson wrote: > Hi, > > On Wed, Jun 12, 2024 at 1:58 AM Daniel Vetter wrote: > > > > On Tue, Jun 11, 2024 at 07:48:51AM -0700, Douglas Anderson wrote: > > > At shutdown if you've got a _properly_ coded DRM modeset driver then > > > you'll get these two warnings at shutdown time: > > > > > > Skipping disable of already disabled panel > > > Skipping unprepare of already unprepared panel > > > > > > These warnings are ugly and sound concerning, but they're actually a > > > sign of a properly working system. That's not great. > > > > > > It's not easy to get rid of these warnings. Until we know that all DRM > > > modeset drivers used with panel-simple and panel-edp are properly > > > calling drm_atomic_helper_shutdown() or drm_helper_force_disable_all() > > > then the panel drivers _need_ to disable/unprepare themselves in order > > > to power off the panel cleanly. However, there are lots of DRM modeset > > > drivers used with panel-edp and panel-simple and it's hard to know > > > when we've got them all. Since the warning happens only on the drivers > > > that _are_ updated there's nothing to encourage broken DRM modeset > > > drivers to get fixed. > > > > > > In order to flip the warning to the proper place, we need to know > > > which modeset drivers are going to shutdown properly. Though ugly, do > > > this by creating a list of everyone that shuts down properly. This > > > allows us to generate a warning for the correct case and also lets us > > > get rid of the warning for drivers that are shutting down properly. > > > > > > Maintaining this list is ugly, but the idea is that it's only short > > > term. Once everyone is converted we can delete the list and call it > > > done. The list is ugly enough and adding to it is annoying enough that > > > people should push to make this happen. > > > > > > Implement this all in a shared "header" file included by the two panel > > > drivers that need it. This avoids us adding an new exports while still > > > allowing the panel drivers to be modules. The code waste should be > > > small and, as per above, the whole solution is temporary. > > > > > > Signed-off-by: Douglas Anderson > > > --- > > > I came up with this idea to help us move forward since otherwise I > > > couldn't see how we were ever going to fix panel-simple and panel-edp > > > since they're used by so many DRM Modeset drivers. It's a bit ugly but > > > I don't hate it. What do others think? > > > > I think it's terrible :-) > > Well, we're in agreement. It is terrible. However, in my opinion it's > still a reasonable way to move forward. > > > > Why does something like this now work? > > > > drm_panel_shutdown_fixup(panel) > > { > > /* if you get warnings here, fix your main drm driver to call > > * drm_atomic_helper_shutdown() > > */ > > if (WARN_ON(panel->enabled)) > > drm_panel_disable(panel); > > > > if (WARN_ON(panel->prepared)) > > drm_panel_unprepare(panel); > > } > > > > And then call that little helper in the relevant panel drivers? Also feel > > free to bikeshed the name and maybe put a more lengthly explainer into the > > kerneldoc for that ... > > > > Or am I completely missing the point here? > > The problem is that the ordering is wrong, I think. Even if the OS was > calling driver shutdown functions in the perfect order (which I'm not > convinced about since panels aren't always child "struct device"s of > the DRM device), the OS should be calling panel shutdown _before_ > shutting down the DRM device. That means that with your suggestion: > > 1. Shutdown starts and panel is on. > > 2. OS calls panel shutdown call, which prints warnings because panel > is still on. > > 3. OS calls DRM driver shutdown call, which prints warnings because > someone else turned the panel off. Uh, that's a _much_ more fundamental issue. The fix for that is telling the driver core about this dependency with device_link_add. Unfortuantely, despite years of me trying to push for this, drm_bridge and drm_panel still don't automatically add these, because the situation is a really complex mess. Probably need to read dri-devel archives for all the past attempts around device_link_add. But the solution is definitely not to have a manually tracked list, what's very architectural unsound way to tackle this problem. > Certainly if I goofed and the above is wrong then let me know--I did > my experiments on this many months ago and didn't try repeating them > again now. Oh the issue is very real and known since years. It also wreaks module unload and driver unbinding, since currently nothing makes sure your drm_panel lives longer than your drm_device. > In any case, the only way I could figure out around this was some sort > of list. As mentioned in the commit message, it's super ugly and > intended to be temporary. Once we solve all the current in-tree > drivers, I'd imagine that long term for new DRM drivers this kind of > thing would be discovered during bringup of new boards. Usually during > bringup of new boards EEs measure timing signals and complain if > they're not right. If some EE cared and said we weren't disabling the > panel correctly at shutdown time then we'd know there was a problem. You've stepped into an entire hornets nest with this device dependency issue unfortunately, I'm afraid :-/ Cheers, Sima -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch