From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E1E4C47422 for ; Wed, 17 Jan 2024 17:25:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D27A6B0074; Wed, 17 Jan 2024 12:25:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 782866B007D; Wed, 17 Jan 2024 12:25:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64A7C6B007E; Wed, 17 Jan 2024 12:25:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 509976B0074 for ; Wed, 17 Jan 2024 12:25:46 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 01FE3120C24 for ; Wed, 17 Jan 2024 17:25:45 +0000 (UTC) X-FDA: 81689480292.02.EA3A10C Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) by imf13.hostedemail.com (Postfix) with ESMTP id 649E12001E for ; Wed, 17 Jan 2024 17:25:44 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Z2f0tCl5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of pintu.ping@gmail.com designates 209.85.222.54 as permitted sender) smtp.mailfrom=pintu.ping@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705512344; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BjzH4P7XF/Z7lgo69jkWio9jEYkRlOZwcG6M8wtf1ZM=; b=qNMrIdLFcRyPf1ntu7IpPiguOaW2UF+iL3zxDFGSeA4fXpJb/mhuvo4bhBD6dMCDQGCnCi gRPuWeR3rxPBodtIM9Upz6/9uaL5oLBawzSQ0bHJaWy6ME9vj9STEOACmaq1Q2etzAfOnF 8FZXQ5TprVp5zHmQmUTbLePbDphaA4k= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Z2f0tCl5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of pintu.ping@gmail.com designates 209.85.222.54 as permitted sender) smtp.mailfrom=pintu.ping@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705512344; a=rsa-sha256; cv=none; b=aAQ3gBI1xdXUoI6LN6luPfn+0ta+R2Te1cVNWorNnr82ClRMP8b8qCbHyb658OVY61/fWT MLGyTk9+3WsDxVCJNySmpgcFSsYqWmR6KfQKbISRXZFuuawAju9y3FamCRamNLRUfQllL9 k6YBLDqtpPybLwaRsTUYaLMtoIXjUQo= Received: by mail-ua1-f54.google.com with SMTP id a1e0cc1a2514c-7d2680697fdso730979241.3 for ; 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=kvack.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=Z2f0tCl5pJBsBPI06nC09wgncHhwB13GiIhJC4ZpqgC8lmMYOSj/+ALnfQxFdn96O2 sMG8bl7S5W/chNZ+H2auZUnMCgnejcgj5/rW7c1hgLh6HQQaMBu3/O7ILJ0rQdAz91ub 4v7l7iAW3obBiqAunFoCusm2Fsw6fxL4cxiChMqJiwDHwI4NmrNNVG0ogmu3q6D0G6e0 bdCSxQU2gPmxRTBWA5MEvB4l3IOfHE45NpKXSLBdI8SUrIergD+Yj+Le1Rvu8c0ns2yG vauyYz3yQKey/1ZkQUDYjbIfGTYCH7VESVwDsSM691q4CE65lzpxNCn3xvgjLjkx84cP tmZg== 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=Wy7jLBJK/21jLRDs5+9NZ205ZMRgxno/jik7SvaSUbX9vnikgvveeYnkowysRtua3S XbDWI4STJguFODnPTe20juux/qq9ja88fywvgzUJ7+bFIVIfKP7BXZiIc9kyEkMkOlgn 674z6+RAZm1tEp6etud2+G7CUOuMHXSO90m76pO30veul15fSyueXc/R6hrl+i1GTxDS 0EIylhWdQpf9hZwCL7HsDGi0B431KfC5EgXdox3vc8XA81tXdZTbDiKCkou4hHkjWRXx 8NFbGgZDDmQcc4+XYa3R2VLdgH5/KRFQcVWh72tWnUCoh0GixfZiIBT6UYx8uGGYLU5G aGYg== X-Gm-Message-State: AOJu0YzVC9XQVj1KaXIfSEwHSWEonlsDC6M9i2bkUYY7U43lZpNdzGXf 4G3tDrOp/BYyv06m1RCQb5xaYWHaS9GU4mVscfc= X-Google-Smtp-Source: AGHT+IHq2zmeg53TSnmQvoQ4CfpCRPj7LsRflcF7R5XS39w1ctG2Sfnn2AAL0JKpj3eArMWXOfHc1CHAO8iBUqCdSU8= 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) 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" X-Rspamd-Queue-Id: 649E12001E X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ifz87z1391x87d3zgdj5dypn7ju33mnq X-HE-Tag: 1705512344-303015 X-HE-Meta: U2FsdGVkX1+CppHi9y4i9nO7bcagw2J8EA360u90kRZt0oP1e2DGS6BLWcXoAWLPZ5eFk8ePakxGaDHiX6z35snd0w2ArmjRsEJsFvAC9hh341pIQnXuYXxzwgvqBESg/DkcK18CletFaig/q3xqpNNBBwzwhRTJ5J9+OomjV0VYtL4HjYba1r2hqH74KZRGcV/NMqoA64t/qFRZ/H4JhJ8/07GdSizXNXZD13WaiOdBxdjdT53r8QHWtzOWj8P8I+gchd3A/+HCgfPPQ8lEwFFoWpMfcpnfWymHMmAJq2EggYn1r4r3YX/18rydy8mI5vY4h/pr/W5J2NEObLO2hWN9KBnqTh8kZjSJxQZn6yeNSvIX6JD04azjVq+b9BUHxyL3zcFsdCgEzLAcKqUyl9lmRcpOMymHmMq8IRMBbKIYgKMatLmDBUmIPQwt6uLjStnMGygTQjeO2CRHdzrglCOo5cWmrPxK8W0qyWBIu/ZY7d5oxn/hYnV1m22ybG0GIRUjxUyjToDXRB+KpOTqHrenYruNoxVD/AOOq+t7w7vmf2o8Ht6ZHACdobTa7kYa1YJ7Me1h4IM+C1GTiAdGo4ItmnLGgXVBGP3NjidvpcEySAHBshnPnFdk9I41nLCI2y4faHe/59aNphFIcO36rF2LCRFllaTiul7NSwKww8YmqLSTyx3T/15q5Ph2eHr1CIV0Wf+yd/0eOXrwICmVOo6IJ3pPNA+//3bnoitHYyPZt5PJaEhgTskUS13nAEJ4WyNmsUhELvJPZyvTkJndnjTibUXE7oqZMkgtAQ+v6qrojwFL/S8uJyAxYcZ+JyCSBNo+SzF+DMyS8wRUHH+6IPooNCfbM6zPIC4bGrhRZS3qZfLWao/yFguIz/0s3o8z1gEYkoo13CQHBKvjm/T1pa/RatLE6/X/BIvRjjlTNnRcuN8fNaW2iXef6pwD0VdfoJdIg7MrTX365vni/B4 ytanYJyS wkrguiZqSZVp5fUxieMnwPvzvHBc9IrF6ON/r5juy20ETGOpgHeH2ZaWBht48k4la+Z/Cc4T5fP6WJzFU3bwoa79GEBuVA3v1L8d2YLBASgF6gg1mckVY//8UfP9B6q6fVPVNZMZI58sWL4C7oIhdhWA07mqfHjXLeXuOB/grZOZ1E+lhNzCipopawQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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