Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp540364rdb; Wed, 17 Jan 2024 09:26:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsalnZOZw4gZXIjb9H7GPDRa0tqnas+i2s2YLlCPe6C/wgydKD4xkkTAU1Fot9TK3txByM X-Received: by 2002:a92:4a0c:0:b0:361:93d5:9abf with SMTP id m12-20020a924a0c000000b0036193d59abfmr1732411ilf.63.1705512404594; Wed, 17 Jan 2024 09:26:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705512404; cv=pass; d=google.com; s=arc-20160816; b=LwsHKkQp9bTyPSs+iN8V9u9CwL8UFFTalY2yyFhbXpprCbhU7cxh56AFdRWEALI8Nc EZXI8nb6iEbMc6+SKRTXLorOBf/pd2jOWtW+bDuZINVg0wVAbmbr+TOgVFK/rH0ffBAs GQ9KlIXkUQDejjoSa+xOcUvf/xTAJkvsfvB2EumL6eeeo77j0NA9V1FP5Eau/+/wSzm4 8/pRNWtHcnUpSN/jMx8apltDBio6qdhgx7jMmBVFsjV7akgA/4MC9YnPMndAO5N6Y3ZE sA3FAhZ8/0Du8QfmG+uE/hM614/sWq/Q9Z9hh6c5yxUMbDatKKHf2GNBpFBY5k/huil8 OINw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=BjzH4P7XF/Z7lgo69jkWio9jEYkRlOZwcG6M8wtf1ZM=; fh=2iFG3pRYbzJD6knrRPg5Cv4kkZbHCA1PFkzPl1H3eNE=; b=R5apuVlYrzYShTL20uZ+IxToDtxrR4rw76JB7WHWGY/8fBT6+qoVLoXbguSvM7wOIb vnaH7r6bs+SPYfp0iLBjot4G/YwOeAyAH3sGPIeaMYRx+Epcz+3NLzU3X/DeZ27YXSaw kQTmEbroWkL9rPwOrOaecxZ595DMqfW4pZSYTYslU1pR0f7qQ9E6Us7OdPEPW8vYgvCS bOfe33BTAZK62VT2HwAX8vaTWGUtNwuim9hFumCMQYp3AzPVXSYSsrrsOnC8L15669cZ sJoYEMp7sg8GAm9EMFZWt2gF8/2ixqkVh2ygU+NxFnzfxgnNjU0N6P3GVgTwuO+6jzyE kdiw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZlAHJZfN; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-29269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29269-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u24-20020a656718000000b005cdba90861dsi9892786pgf.68.2024.01.17.09.26.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 09:26:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZlAHJZfN; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-29269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29269-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 159A2285D27 for ; Wed, 17 Jan 2024 17:25:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D547D22EE0; Wed, 17 Jan 2024 17:25:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZlAHJZfN" Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) (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 7DFE122618; Wed, 17 Jan 2024 17:25:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705512346; cv=none; b=ZtkrC5k4KMJlLy7nDyhdSo57SQUMgaN/d0EQV5uQBS75cqC2Jcw+tvkDTIg36/3DCyPbFBqweEDnNcHIX6nYcut1Eq8FqEGdD38xf4h9840sqMqwejlxbV6Bx4gfJqOgQ359NMy2pfYUzOowomBRQ+lPx0FQvKMsWeRBVvip01w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705512346; c=relaxed/simple; bh=26W2fi/I3gYEO5TQsqjCR4QzAvNJBWa6WX4V8X+dIgk=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:MIME-Version: References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc: Content-Type; b=sFwXtHGa6gwQvantABuC3a/Wq38OluAcpzpWeh+Z1iREQJmATMf151GQ629Ky5RTiGUHejus5V4bay+m7cCOrPqBkZWQWmHSM5yrqCNAk8zH2Sokx27chDeruH10HnV2BtrnTkGfUO8aa2uy0tHozoXlVrSeXRk3/zcKW3Mbf8o= 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=ZlAHJZfN; arc=none smtp.client-ip=209.85.217.53 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 Received: by mail-vs1-f53.google.com with SMTP id ada2fe7eead31-467021612acso2656175137.1; Wed, 17 Jan 2024 09:25:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705512343; x=1706117143; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BjzH4P7XF/Z7lgo69jkWio9jEYkRlOZwcG6M8wtf1ZM=; b=ZlAHJZfN/8Ly8qgur7EhCccEh+HaKwUtBAbANPk0FKyelqbWci0N+p0L3eWecuZ4e9 gQfbk0UhPrAWcmQ23rpYnHF53rFR+bzif8oVAShYX7ZljFwbKu96omziIWu34pcXK9Bb NfdMiWYRN6fOe3IzmlqWaJuzaDUiYMBUdbHUkNx7uFTmp6EoKDW/KqCba0Quhg+Tya4C BkMmNwpmJPRRmX+QQiN+GU3a2hkq9g9u3zc1V0ra7Z3eQUQq/taI5tBNejMTctz17VYG /D1MebiSP95ux7bQmHuLD9LI+WdPu3cfmnmsJc4ziaHLyUxmC0/V68F3mxvpNkt+30cQ +XOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705512343; x=1706117143; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BjzH4P7XF/Z7lgo69jkWio9jEYkRlOZwcG6M8wtf1ZM=; b=IjQfOWiYszUFB0IvaGlRKfHrcLHSq4J6ocVOoOIIkzI3n8Yr+ppykdOp17IBz4NDDR PzkH2GG6zEV7T5hqnKaxynikiGCK1hNHvTBdt/n+wiFk5QT0Ptzsx50a73JXKyzpoCt5 FFlpKRIVutpptgticBeTmsMUM3TZwcF3/Ol1qOCKemme2BQJL5Iot3c9pUXA0Ge3/L6P dON7hRwY+2q5InW8a7lemgHPcYa3rk6eMIX70cop8cd0NJpESSXoegaENgeYhEVJtcnz A0TgjCh7vl0p6GnECMhOO2yz/k1ZN+1bna9sLbJSxjTXvmCaQJxZxyK7/a+IePmUannh 4tng== X-Gm-Message-State: AOJu0YwymkoAW2xdo0mwkIXxXrCxbwavb/h2iZWrZYq8xVoKp2KaL0Cp u6gowBvqfSfCCJXO5TogbQu0Ygd0g2RMRj9PQzs= X-Received: by 2002:a67:fc47:0:b0:469:7c82:fcaf with SMTP id p7-20020a67fc47000000b004697c82fcafmr1972649vsq.12.1705512342916; Wed, 17 Jan 2024 09:25:42 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231206151600.26833-1-quic_pintu@quicinc.com> <20231208203128.GA2646347-robh@kernel.org> <20240116143509.GA3845101-robh@kernel.org> In-Reply-To: <20240116143509.GA3845101-robh@kernel.org> From: Pintu Agarwal Date: Wed, 17 Jan 2024 22:55:31 +0530 Message-ID: Subject: Re: [PATCH] of: reserved_mem: fix error log for reserved mem init failure To: Rob Herring Cc: vichy.kuo@gmail.com, Pintu Kumar , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, frowand.list@gmail.com, devicetree@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Tue, 16 Jan 2024 at 20:05, Rob Herring wrote: > > On Sat, Jan 06, 2024 at 11:31:12PM +0530, Pintu Agarwal wrote: > > Hi, > > > > On Thu, 14 Dec 2023 at 22:47, Pintu Agarwal wrote: > > > > > > On Mon, 11 Dec 2023 at 20:13, Pintu Agarwal wrote: > > > > > > > > Hi, > > > > > > > > On Sat, 9 Dec 2023 at 02:01, Rob Herring wrote: > > > > > > > > > > On Wed, Dec 06, 2023 at 08:46:00PM +0530, Pintu Kumar wrote: > > > > > > During fdt_init_reserved_mem() when __reserved_mem_init_node() > > > > > > fail we are using pr_info to print error. > > > > > > > > > > > > So, if we change the loglevel to 4 (or below), this error > > > > > > message will be missed. > > > > > > > > > > > > Thus, change the pr_info to pr_err for fail case. > > > > > > > > > > > > Signed-off-by: Pintu Kumar > > > > > > --- > > > > > > drivers/of/of_reserved_mem.c | 2 +- > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c > > > > > > index 7ec94cfcbddb..473665e76b6f 100644 > > > > > > --- a/drivers/of/of_reserved_mem.c > > > > > > +++ b/drivers/of/of_reserved_mem.c > > > > > > @@ -334,7 +334,7 @@ void __init fdt_init_reserved_mem(void) > > > > > > if (err == 0) { > > > > > > err = __reserved_mem_init_node(rmem); > > > > > > if (err != 0 && err != -ENOENT) { > > > > > > - pr_info("node %s compatible matching fail\n", > > > > > > + pr_err("node %s compatible matching fail\n", > > > > > > > > > > Isn't the message just wrong. If compatible match fails, we return > > > > > ENOENT. The failure here would be from the init function. > > > > > > > > > Okay. > > > > You mean to say, if __reserved_mem_init_node fails with default err > > > > (ENOENT) then it may not hit this condition. > > > > Instead it will hit the 'else' case which is wrong ? > > > > Also, the "initfn" inside "__reserved_mem_init_node" may fail in which > > > > case also it may return default err. > > > > > > > > Maybe, the initial author's intention was to free the memory only if > > > > the failure type is not the default ENOENT type. > > > > > > > > This seems to be a different issue. > > > > Can we address this separately in a different patch ? > > > > > > > > And how do we fix this ? > > > > One option is to add another "if" condition with just ENOENT error check ? > > > > if (err == -ENOENT) { > > > > pr_err("node %s compatible matching fail\n", rmem->name); > > > > return; > > > > } > > > > Then, correct the existing log with a different message: > > > > pr_err("node %s matching reserved mem not found.\n", rmem->name); > > > > Or, add one more "if else" condition ? > > > > Or, fix the calling function itself : __reserved_mem_init_node ? > > > > > > > > > > Any further comments on this ? > > > > Any further comments or suggestions on the above ? > > Shall we just fix the log message, or correct the if/else case as well ? > > It looked to me like the original author's intent was this is not an > error. Either convince me otherwise or wait for me to study this > further. This code gets a lot of drive-by patches and what is "correct" > isn't always clear. > Thank you so much for looking into this. Yes, I agree that the author's intention might be to present this as an info message to the user. But I think he might have not realised that info msg may not be printed always. If we change loglevel to 4 (quiet) this info msg may be missed. Normally, in the final production system we do this. So, ideally, I think, error msg logging is more suitable in either case. Sure, I will wait for your further findings. I will also have a further look and see if I can convince you more with another set :) Thanks, Pintu