Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.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 3AB3247798B for ; Wed, 17 Jun 2026 15:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781709393; cv=none; b=gUmfM/ATZCBkKJxKAqRzXoYONFcEerev6ft65THf/TjGVjlvs16znDK1aDYPAM6SFzOHL1YzfT/PLmkoSpuOY0IWYAepgGN9fD5u6EYkPP/gxHXrGxQWD4UPG9TKm+V6nEqzMYxNQcQKhTk4oEn5WzJb+ggbFTKQvY0xb0bYxNY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781709393; c=relaxed/simple; bh=CazmtZo3TFdV78cmNa8UzDlIEDZDUOsp0cNIk98WwdU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=A3qWPTvEtJvkTqTQ/ZF4GgeSlBiI+T2htSrrFqm0vTEh1a5ULHubMdFVxYk4YnCKB1OkB0SsgUup+Fj/OBUDbNfrcQujz9p51WsgUs93nDhbZoEf72mNtwJaHbeOuWQIGSV0iNB/5bAcuAdGB1n2VHOv/wDC12dVMr2AdK/gjVU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=konsulko.com; spf=pass smtp.mailfrom=konsulko.com; dkim=pass (1024-bit key) header.d=konsulko.com header.i=@konsulko.com header.b=eQMATIFg; arc=none smtp.client-ip=209.85.161.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=konsulko.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=konsulko.com header.i=@konsulko.com header.b="eQMATIFg" Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-69d7cdd3b8eso2561434eaf.2 for ; Wed, 17 Jun 2026 08:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1781709389; x=1782314189; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=zcQANifycSqoBIHjw+ZFSYM5UwNDdQEMUit4tNnvSmg=; b=eQMATIFgfXI+dBYC8ziT/E1Hcs6TdKQiEVX6780uLY4FzGnoDl/yXJ6ATaX02JXMHq GU4OloBHV2fM6g3h8TKdAC/Op1T35asvLx16HRcs22eANLyifrX121B+Mzqvhof4lZAw HzbvXP5k3K10vKC6gWFgKY4dksZSMZWoNPz9A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781709389; x=1782314189; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zcQANifycSqoBIHjw+ZFSYM5UwNDdQEMUit4tNnvSmg=; b=CxmqXuN1tQnTTK3ozrurep/jp3iMLO8mkVpZsDZBXN8nL9anUZ8dbw4XsUDpY1u6Iu IRq0Qaz0pYMVAiccvFAFevflOvFp5Qn4MXaYdOEzfB8/DyMb7/Ug7GPMVZ1KmJYWfh0H ti1/uejFM2L3ElXEf6y9f0RIBl9XSkIjgt47FC3w5xC+Noa9WjLbKyT0FaPK4kvkvrFI 4jLXqwKi/EWRizd4zn9YRJQxHPMEaIqkFStEPtYRltMnq8yRzaFYqaFyCwPdK9tP8mO1 BsfuTgnu1PdrasxxygzbwFVOcVhaYFbP0Eg/LDPAbm1tqtws8w+0mPVVlQG30Oy9ohBN Y0yA== X-Gm-Message-State: AOJu0YzjVohvENjFy9bWnAeQbh4EBItOKNZDjWtNCCmxCnmL7TIcxA4U JAsCToRSibjyzb5TkITQGjZs/2DtFyD9LqZC0pABhlCy/uRIEaTnSHWtqe7Kse5ujqWAABI0Nlv nbf1hb2s= X-Gm-Gg: Acq92OGp/KKyE8Ah0qkvApzDZkifN19fm9ZTJUFOI3+NWYRYsAvxCKUmUZT/SG5FxUM wpLkEro9iXmW/iNpL48RNmMHNytJXJNxOIQ4zAyKxVKG1UmetOBMBXxjzXDIKRyAd1AmVFbLriR B8MXlDvDGubPWHisHTJOxwEeJTnkmBk+Sxu472kHGXvI9K/nH43W2awgQCV85hb+6Aw0gsWSH99 MKIQcjIVPxWBnkgBojElBH4p8SF4Sg4th5OcigVo0fG33Iueb888mDnTXUjw4LbTZ1EG1IUC+rz nLWC/hqTFjtosQ55qS+dT0frq6LYC1pAVvSI+ScF4qcYQVBWRc5WXURNOgoc1e1RwhFUfHNhRdK DP+G1IgBJk44q+lX14n4yy22guvXnAPa0lpfRIF+EXOp2tR8yAHrZu6ws3aRcpv4xZ1Vroi0uCZ MyHeoItX7jnW0W+F7wM7JDAJ6wG/RYQg+1IKgbPYPzJInHCW8rIIooi6Pods3fdoIaGrKreh4WO hSZX2yoC1Wxvyl8vDu/VlllBR1XjN+4Rnb9spqk X-Received: by 2002:a05:6820:88b:b0:69e:46dc:2905 with SMTP id 006d021491bc7-6a0b6370aa5mr2831051eaf.45.1781709388499; Wed, 17 Jun 2026 08:16:28 -0700 (PDT) Received: from bill-the-cat (fixed-187-190-197-245.totalplay.net. [187.190.197.245]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-69f00d232e1sm7265489eaf.6.2026.06.17.08.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2026 08:16:28 -0700 (PDT) Date: Wed, 17 Jun 2026 09:16:26 -0600 From: Tom Rini To: David Gibson Cc: devicetree-compiler@vger.kernel.org Subject: Re: [PATCH] libfdt: fdt_check_full: Add can_assume(PERFECT) check Message-ID: <20260617151626.GQ382693@bill-the-cat> References: <20260526203022.4006434-1-trini@konsulko.com> <20260527043859.GC1858239@bill-the-cat> <20260605222054.GC382693@bill-the-cat> Precedence: bulk X-Mailing-List: devicetree-compiler@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett On Wed, Jun 17, 2026 at 03:38:19PM +1000, David Gibson wrote: > On Fri, Jun 05, 2026 at 04:20:54PM -0600, Tom Rini wrote: > > On Tue, May 26, 2026 at 10:38:59PM -0600, Tom Rini wrote: > > > On Wed, May 27, 2026 at 02:23:20PM +1000, David Gibson wrote: > > > > On Tue, May 26, 2026 at 02:30:22PM -0600, Tom Rini wrote: > > > > > In this function from fdt_check.c we have (reasonably and as the name > > > > > implies) a number of checks on the DTB. However, there are cases where > > > > > we may wish to assume that we have been given a perfect DTB already and > > > > > do nothing here. Add a test for can_assume(PERFECT) as the first check > > > > > in this function and if true, perform no checks. > > > > > > > > > > Signed-off-by: Tom Rini > > > > > --- > > > > > Along the lines of the patches I posted back in December, in U-Boot SPL > > > > > we just don't have the space for this check much of the time and so have > > > > > always omitted it (going back to at least when Simon posted the initial > > > > > patch to make libfdt/fdt_check.c here). This is another case where it's > > > > > a noticeable size win for us. I had missed this change in particular > > > > > because we had in turn missed catching up on fdt_check_full being moved > > > > > out of fdt_ro.c and in to fdt_check.c. > > > > > > > > I'm not necessarily against this, but I have some misgivings. > > > > > > > > fdt_check_full() is (deliberately) not called from anywhere else in > > > > libfdt - it's intended to allow the user to explicitly do a full > > > > validity check on the tree. Given that meaning, I'm not sure it's > > > > wise to turn it into a no-op based on the assume flags. > > > > > > > > Your comment seems to imply that the issue here is size - simply > > > > having this function compiled - rather than being too expensive when > > > > (explicitly) called. That's a little surprising to me - it's in its > > > > own compilation unit, specifically so that the linker can omit it if > > > > it's not used. Is there something unusual about your build > > > > environment that's not letting that happen? > > > > > > So, we have code like this: > > > /* Get the total space reserved for FDT in blob */ > > > live_fdt = bloblist_get_blob(BLOBLISTT_CONTROL_FDT, &blob_size); > > > if (live_fdt != gd->fdt_blob) > > > return -ENOENT; > > > > > > ret = fdt_check_full(live_fdt, blob_size); > > > if (ret) > > > return fdtdec_ret_to_errno(ret); > > > > > > And this is compiled on TPL, SPL and full U-Boot builds. On the first > > > two, we're just too space constrained to do this check. So it's not the > > > linker doing the right thing or not, it's avoiding having to #if the > > > code directly (or rather, CONFIG_VAL(...)). My line of thinking was that > > > since ASSUME_PERFECT is that everything is really perfect, this is the > > > way to go. Yes, it's a little odd to have both "call the validation > > > function" and "the validation function does not validate" but that's > > > just because in the second case, we explicitly configured ourself to not > > > validate anything. > > > > > > And FWIW, that's really how we use the assume mask in U-Boot, either > > > 0xff or 0x0. It's a case where we're either passing along the tree we > > > bundled with ourself (and so we can assume it's fine) or it's passed > > > along (and we verify). > > > > Hey, just checking if there's any further discussion here? I want to try > > and get the delta between U-Boot and upstream down to zero if we can. > > No further discussion, I just have approximately zero time for dtc > maintenance :(. Ah, I understand. Thanks for merging! -- Tom