Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4420983ybv; Tue, 25 Feb 2020 19:54:31 -0800 (PST) X-Google-Smtp-Source: APXvYqyXi847Uo9EmpNlanRSfzDknc+17R+HJ3N/nCld2ug+GKTkokq+6eFXxTdB9RR+6c2ML8YP X-Received: by 2002:a05:6830:1f03:: with SMTP id u3mr1532351otg.152.1582689271459; Tue, 25 Feb 2020 19:54:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582689271; cv=none; d=google.com; s=arc-20160816; b=GbR6w6WzZ14ly/KjWorzoIjmRAEYonxAPoue6PVd1nhdZ+YABY8dvtw3dDqbELHCx3 xNt/7xWaL2M8K9LYfnPZ8A27bF6NjmIfHgenzvbZbPg5AUN1l/B6bg/8dxaBBJdkkQwE +hYR1qOHYK7e1Xb0gk3QbDwpDTAZNQtu6SAAKbFxWC/pWtLVCt0xKV/XrLCPoLd0QYCY WnKDvlRQv0i8dsNo2G5Ylone5Iff73EPSzaJlbNDHPRLSjpUkrgdqg2qSDyprZ6KjyPY xRDZj4N3nLFCtmU+fFbNuEOqZ5wAgBe279SEXwr3aI77vYuGLXNrjw+ZgWVWrpX4fBrN gnPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=exTa4V5GT58+3zXWxZHPQae7jPzZ97tMG3gr3P5XvQo=; b=RmegNoUW2sksOdK60YQgcjOOeDQa7pqrfgVMI0Z60JVuXVWuTLw3pvAqFy+/0Ypzn8 t5MiupYkIsxWV8YE0igTLn5YkK4kR9jJlLtVNdNMkJsoQqAiFaQVTwswD16t2cJVZqku QUpxWGnj2opg8tZaU33Dx0yWb576+o47XviADmgcOLW04KTSjEv0lOIrLnHxRdN1VIir Dyh/pMGcG6mIlf6A0gZUBcFTiRLBtUxu/EJXltRygOvGx6rJmRw4GXTWdt5FNoAuKq0Z tWgK7VyLbsLLNdObUvnzxb6/zQMbX5blQaCjuy5mvEqtmAvNFBacbKXRvRM6BIdwf+SK IUFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ent5dnpk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i13si551775otc.228.2020.02.25.19.53.52; Tue, 25 Feb 2020 19:54:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ent5dnpk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726413AbgBZDxr (ORCPT + 99 others); Tue, 25 Feb 2020 22:53:47 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:41299 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbgBZDxr (ORCPT ); Tue, 25 Feb 2020 22:53:47 -0500 Received: by mail-yw1-f66.google.com with SMTP id l22so1862846ywc.8; Tue, 25 Feb 2020 19:53:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=exTa4V5GT58+3zXWxZHPQae7jPzZ97tMG3gr3P5XvQo=; b=ent5dnpkhIONW4+hFnA6fcEibNW0RC5xdbTbqNvOc/wpujsZnK2j+Aujr798Na7+1E GRTLSyTggVio39H9XH2t1zfCE0ux0sau00Ln0ykDWJjQm9/xri/aZUG+Ug9aEmmjW6cp PwHp0YE0oOWSTaKsDWEoabJTSI/5EqcEaDJjLuh5ou8a+GelJGupXRIMXEXY28xEVN+R TqZ/GqDklP/76V3GLpy78BAQTEhMRAZb7nz8artxCr99SGm+rmJMcEhjmE2b/q/B6N4k RMfamEXPMlnfSsxsJuioCQJ8ZhJWM30hTksZpMSONuUX5N6nTnXg5hpV6UTqyDyXaEPH /amQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=exTa4V5GT58+3zXWxZHPQae7jPzZ97tMG3gr3P5XvQo=; b=ZszfkdvrRsCrt51hFZZlTMfREZk8VhUmp2kcXD9fN/A9ekIyVUme8J0Qw17TKLMb+/ f6aVResJKdecYqPt4Pzjaf3b1GqN8qxEbkHbfiAuenHKM456tMuie3PMZaq1nM+rrUQ+ ErlpNJ3XAjJeHK4a12Yrz96EuSy/t56DdtSWKnd2Mi6EvrbCg3xZjIdejXxla7P29YsW 0DBSsRWkmzdJeQFZcjj9BrMmlPrNlRpIM8Q1JM3Olr7CN7PmqX91DD1HUf1awlOOo6W3 VH7r1C/J+1iW48UIoNjDIgB0OwPks2ajwma4Y1m2733CC/donK6t6RLT+P/ii//DS8fn 6jSA== X-Gm-Message-State: APjAAAXgNNhrqcftdm/eRw9TRc66vlhERBWMfvFEk+wy5qhYwh+MITR1 QMu94aLCKY1AIs6QW50IkGQ= X-Received: by 2002:a25:4f42:: with SMTP id d63mr2782165ybb.236.1582689226074; Tue, 25 Feb 2020 19:53:46 -0800 (PST) Received: from [192.168.1.46] (c-73-88-245-53.hsd1.tn.comcast.net. [73.88.245.53]) by smtp.gmail.com with ESMTPSA id w15sm397709ywg.1.2020.02.25.19.53.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Feb 2020 19:53:45 -0800 (PST) Subject: Re: [PATCH v2] of: overlay: log the error cause on resolver failure To: Luca Ceresoli , devicetree@vger.kernel.org, Geert Uytterhoeven Cc: Pantelis Antoniou , Rob Herring , linux-kernel@vger.kernel.org, Geert Uytterhoeven References: <20200225164540.4520-1-luca@lucaceresoli.net> From: Frank Rowand Message-ID: Date: Tue, 25 Feb 2020 21:53:44 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200225164540.4520-1-luca@lucaceresoli.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/25/20 10:45 AM, Luca Ceresoli wrote: > For some of its error paths, of_resolve_phandles() only logs a very generic > error which does not help much in finding the origin of the problem: > > OF: resolver: overlay phandle fixup failed: -22 > > Add error messages for all the error paths that don't have one. Now a > specific message is always emitted, thus also remove the generic catch-all > message emitted before returning. > > For example, in case a DT overlay has a fixup node that is not present in > the base DT __symbols__, this error is now logged: > > OF: resolver: node gpio9 not found in base DT, fixup failed > > Signed-off-by: Luca Ceresoli > Cc: Geert Uytterhoeven > --- > > I don't know in detail the meaning of the adjust_local_phandle_references() > and update_usages_of_a_phandle_reference() error paths, thus I have put > pretty generic messages. Any suggestion on better wording would be welcome. If you have not read the code to understand what the meaning of the errors are, you should not be suggesting changes to the error messages. Only one of the issues detected as errors can possibly be something other than an error either in the resolver.c code or the dtc compiler -- a missing symbol in the live devicetree. This may be because of failing to compile the base devicetree without symbols, depending on a symbol from another overlay where the other overlay has not been applied, or depending on a symbol from another overlay where the other overlay is applied but the overlay was not compiled with symbols. (Not meant to be an exhaustive list, but it might be.) Thus the missing symbol problem might be fixable without a fix to kernel code. The error message philosophy for overlay related errors is to minimize error messages that help diagnose the precise cause of a kernel code bug, with the intent of keeping the code more compact and readable. When a bug occurs, debugging messages can be added for the debug session. Following this philosophy, only the message in the second patch chunk is ok. I will include an example of more precise error messages in the other locations, just for education on what is going wrong at those points. > > Changed in v2: > > - add a message for each error path that does not have one yet > --- > drivers/of/resolver.c | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c > index 83c766233181..a80d673621bc 100644 > --- a/drivers/of/resolver.c > +++ b/drivers/of/resolver.c > @@ -291,8 +291,10 @@ int of_resolve_phandles(struct device_node *overlay) > break; > > err = adjust_local_phandle_references(local_fixups, overlay, phandle_delta); > - if (err) > + if (err) { > + pr_err("cannot adjust local phandle references\n"); > goto out; > + } Delete this message. But if there was a message, it could be: "invalid overlay, adjust local phandle references failed\n" > > overlay_fixups = NULL; > > @@ -321,11 +323,15 @@ int of_resolve_phandles(struct device_node *overlay) > > err = of_property_read_string(tree_symbols, > prop->name, &refpath); > - if (err) > + if (err) { > + pr_err("node %s not found in base DT, fixup failed\n", > + prop->name); "symbol '%s' not found in live devicetree symbols table\n", prop->name > goto out; > + } > > refnode = of_find_node_by_path(refpath); > if (!refnode) { > + pr_err("cannot find node for %s\n", refpath); > err = -ENOENT; > goto out; > } > @@ -334,13 +340,14 @@ int of_resolve_phandles(struct device_node *overlay) > of_node_put(refnode); > > err = update_usages_of_a_phandle_reference(overlay, prop, phandle); > - if (err) > + if (err) { > + pr_err("cannot update usages of a phandle reference (%s)\n", > + prop->name); > break; > + } Delete this message. But if there was a message, it could be: "invalid fixup for symbol '%s'\n", prop->name > } > > out: > - if (err) > - pr_err("overlay phandle fixup failed: %d\n", err); Do not remove this message. The other messages do not explain that phandle fixup failed - they provide a more detailed description of a specific reason _why_ the phandle fixup failed. > of_node_put(tree_symbols); > > return err; >