From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 670A73254A8 for ; Mon, 15 Dec 2025 18:16:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765822574; cv=none; b=UnMhrIi+kzszGclLqD51gDk2I8KKjwLqv2DDEwka/ddGQYXvK78Mq19Y8ZgbJwSAUe4PC7U3EHqB+zEeBAzFqVJjlhutDa/zH6Mb9sYE+2RWDGz58ntv9hSXxEhuT892t0FA80g0pIHMbRcZIe2yXiaecdRfY568mDNnHtmfTeA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765822574; c=relaxed/simple; bh=rH2oLqCELwkq5mfbOUlAXZDf7vdg0Z1tuG/5ioLFx7E=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tTV6ztY10AQyd5/vTZ778nc/1nS6uAEENbmBenJeMjOGDaWXgDE/HJ8S5IT28gsKGUBgai4agmtZU2j9dxTlfwuMcWaw4T6QcJ0khvN1SGHTsFo5s0W2Yl5rMXwKBOOJMkzHKEf4ujefN67b1N4CFtV23gxhTPgM7qoxdTsIrI0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hmxC/da0; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hmxC/da0" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-42e2d52c24dso1952780f8f.1 for ; Mon, 15 Dec 2025 10:16:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765822571; x=1766427371; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=mgNHGQuNqJYS8SDNw0YQDcQ0j9dj4XHzKQA/e9DbvTI=; b=hmxC/da0gEemdD4josRsMwpO/rp8yC7/xGSMYpoaZv3N1nJfAs6M76AdaUrAM0M5m/ 2AgcVQsejTAVKTmO3NxfSYpwc3vZhhGkpwy9wQhVP9VYwcq8XS+qfbyIdP25dtzSSkZo L+Lh1ltfM4qwKl0de1+Kqbzg2WpsybqZZyAgsIzFWIrmBUcz+kEvlAAB5ZqD4knXAriG GAccrz0WWob6WzMGBBiDzvdpZ9QG6XsHZoXJLRcgaLogf9wNqcnG/V4S8fjnk5N1HEZH cAFAQb2ni+hc2Ew4hZEn9HZ2Djh6zB226R5CxeyxtfAX5KH9hpph0KY8jBYcjOI6tt25 h8bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765822571; x=1766427371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mgNHGQuNqJYS8SDNw0YQDcQ0j9dj4XHzKQA/e9DbvTI=; b=t8h+yF/Ex4d/4QBXsF/R1PgfoVaB9zVqoS4D0vaFXx6k9jbVe2M+Ruoxtarg4egfrk YV3KOEvMABraqJP805MX5qsHnxUs19wLkfF5ufB16aDgoD1DPwkqh4ks3tGMyZD/gLjh b6l/zLXBBvIeP1tARWBipGWMnkyK5xKcUEu8gMJb5eZx7E9QCO88vnwA4EYr+vzvlrxF FXoBsEqkFJ8km4M3drC57lWECfkLVpTozPEODuy2xDgnRnML55HNaqPANvKw7oH0Vcjo i8XBUXTKXEZOxXeGKV0vAVXem5ZpcjaSKcov6oCrMSw7+6pLk4bmC8pjbdhrv80JRkDo v0jQ== X-Forwarded-Encrypted: i=1; AJvYcCVXqxZcftgWgPPshnjZxHIo2J7amcOz2lMLkFh374Z8KUAOb0IrMssZ6Bo5lNl8go7wxQc/NC2xdht7III=@vger.kernel.org X-Gm-Message-State: AOJu0YzDA9BgGjVZxDnlMx8L284sX6qhaDgsCCQLn5DYQGWW8TkoxmK2 d2wxJNQE4X9ToCss1l0PJggEhHTYoFkG7c1AJ2S/tpdmALYyDOyEIwXY X-Gm-Gg: AY/fxX4jX/O3AdY0ETU6BrhBH/2M6NC2pV/u2+85ZylpXc/6ZBvLZ7cIXerBXJsDbMh pnSaMbs2js00KgNm0D6hYIXsahHRvZ3CphC0S6J0pBoFAdWjx2iAvB1cTgN+iP3CWddBJqXOlNN EHm5Z4Gij8oGSf4T9lKpjDsnqiLaWFXw9vQakL/24roUmtR1ts7q1AqfPKtCrnHrTTfh4ez+P/u U0MDQjDMIOL78vdL8c8AahpoadORNlwAL6tDmSHLXY0K1NWtJEk7aytJQTjIlXpWKaHRMTaGyZs 6cCvjVfOy5AOPGTYFOIzqbaGFzLu41KSnUPjN/8RPbh7ot2GrPon4R02CYwWzskuLTj3GGgpVmu 7zBmb8Lyv2gwqKKqo9kWrxleUIQcEx2Od4KDojAg34KW7zyWbbljWHYc7NMY7C9Uy9lNaHnjAYJ DxCxr4JkFD+uxSTKyXyAWK7z1V2X0EZiMi/rfpjgxcxO19s4tpYuUQsgBzR5rJic4= X-Google-Smtp-Source: AGHT+IHyDJpQHBms/ienI8KAmWZu5MhqukBnjyYtenMu2CYLWW1CjFUhtTLo4yMnCvX9Pd/MmTJfXQ== X-Received: by 2002:a5d:6643:0:b0:42f:bad9:20c9 with SMTP id ffacd0b85a97d-42fbad92628mr9345753f8f.19.1765822570360; Mon, 15 Dec 2025 10:16:10 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-430f9339d86sm11129355f8f.29.2025.12.15.10.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Dec 2025 10:16:10 -0800 (PST) Date: Mon, 15 Dec 2025 18:16:05 +0000 From: David Laight To: Daniel Stone Cc: Nicolas Frattaroli , Sandy Huang , Heiko =?UTF-8?B?U3TDvGJuZXI=?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chaoyi Chen , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Daniel Stone , kernel@collabora.com Subject: Re: [PATCH v4 1/8] drm/rockchip: vop2: Switch impossible format conditional to WARN_ON Message-ID: <20251215181605.29f6afcc@pumpkin> In-Reply-To: References: <20251211-vop2-atomic-fixups-v4-0-5d50eda26bf8@collabora.com> <20251211-vop2-atomic-fixups-v4-1-5d50eda26bf8@collabora.com> <20251211223822.6eeabb4d@pumpkin> <14738785.uLZWGnKmhe@workhorse> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 15 Dec 2025 17:55:13 +0000 Daniel Stone wrote: > Hi, > > On Fri, 12 Dec 2025 at 12:46, Nicolas Frattaroli > wrote: > > On Thursday, 11 December 2025 23:38:22 Central European Standard Time David Laight wrote: > > > Except that all the systems with PANIC_ON_WARN set will panic. > > > I believe that is somewhere over 90% of systems. > > > > I also like making up statistics. Warning here is the correct move > > in my opinion because this warning being triggered indicates a bug > > in the kernel code, and with PANIC_ON_WARN the user explicitly says > > they would rather panic in such a case than treat it as an abnormal > > condition that is recoverable. > > > > The reason why this condition ever occurring should be treated as an > > abnormal condition is because the DRM subsystem should guarantee we > > don't get a framebuffer of a format we didn't explicitly declare > > support for in the first place. So this condition being hit either > > means drm_universal_plane_init is broken, or the array of formats > > that's passed to it is out of sync with the conversion code, which > > is also a bug. Or someone managed to thoroughly hose DRM's internal > > kernel-side data structures, which is precisely the kind of thing > > PANIC_ON_WARN users want to abort for. > > Yes, that's exactly it. We make all kinds of load-bearing assumptions > everywhere: that PM code won't pass in a NULL struct device pointer to > the resume handler, that our driver callbacks won't get called whilst > the device is runtime-suspended, etc. We could try to handle every > single one of those with if (clk == NULL) return 0; /* ??? */, or we > could not. > > If you'd like, we could just delete every one of these checks and > replace them with comments, explaining what we assume the invariants > to be, and wait for an OOPS due to dereferencing invalid pointers. But > the MISRA style of 'handling' every possible impossible case is not > tractable. Especially since it is often easier to debug the NULL pointer reference that the work out why a BUG_ON(!ptr) happened. (In the former case you should have the contents of all the registers making it easier to backtrack to where the NULL came from.) David > > Cheers, > Daniel