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 X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29823C2D0E4 for ; Fri, 11 Sep 2020 13:48:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 657BE20731 for ; Fri, 11 Sep 2020 13:48:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="RicVnspy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 657BE20731 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 71DA78E0001; Fri, 11 Sep 2020 09:48:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F88B900007; Fri, 11 Sep 2020 09:48:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 34B806B0068; Fri, 11 Sep 2020 09:48:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id 147536B005D for ; Fri, 11 Sep 2020 09:48:45 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D36DC180AD801 for ; Fri, 11 Sep 2020 13:48:44 +0000 (UTC) X-FDA: 77250910968.22.magic63_4103d4d270ef Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id AC29918038E67 for ; Fri, 11 Sep 2020 13:48:44 +0000 (UTC) X-HE-Tag: magic63_4103d4d270ef X-Filterd-Recvd-Size: 8643 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Fri, 11 Sep 2020 13:48:44 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08BDbmuT094124; Fri, 11 Sep 2020 09:48:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=/DlSfj+qc/DKFfnxqp/QaMVjzQLq0SBZzTsv8j+fWSw=; b=RicVnspy5d63Y6X25prYN377f+LRKdK/q3Xjo+Nsn2aC+TlLrCvfIlSxvg2lz+N/KABB IJPYJofo2YZbkyJ97mVp4O9gStaNwFjOnpwtAwnhBhHkAessXAxVNZ21FvOvEG/nzsgy ZJUwc+P5jKEzZ46BkUL9RvOCj0q4bkXrwINyZOtdMGuGGwgZXKtgObusq4HC/Kdav5F7 7utc8xrMaAq/aofBtyW+dz7u4COGIp2cotgSSaVd0ZZCrmISCFaNNtD2lRsgfcPYhGGC qicrJwSNE5cJvKe8rg8SjYPXB1jc912bm7pV9C7eKzuPYx7x/BDiKoTPKiIk6TcqFIhu pw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33ga35ghmh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Sep 2020 09:48:40 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 08BDc8o9095555; Fri, 11 Sep 2020 09:48:40 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 33ga35ghks-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Sep 2020 09:48:39 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08BDh2jx029635; Fri, 11 Sep 2020 13:48:38 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 33c2a8f9u4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Sep 2020 13:48:38 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08BDmZoj35324388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 Sep 2020 13:48:35 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 37973AE04D; Fri, 11 Sep 2020 13:48:35 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BED6BAE053; Fri, 11 Sep 2020 13:48:34 +0000 (GMT) Received: from pomme.tlslab.ibm.com (unknown [9.145.47.39]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 11 Sep 2020 13:48:34 +0000 (GMT) From: Laurent Dufour To: akpm@linux-foundation.org, David Hildenbrand , Oscar Salvador , mhocko@kernel.org, Greg Kroah-Hartman Cc: linux-mm@kvack.org, "Rafael J . Wysocki" , nathanl@linux.ibm.com, cheloha@linux.ibm.com, Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] mm: don't panic when links can't be created in sysfs Date: Fri, 11 Sep 2020 15:48:31 +0200 Message-Id: <20200911134831.53258-4-ldufour@linux.ibm.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911134831.53258-1-ldufour@linux.ibm.com> References: <20200911134831.53258-1-ldufour@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-11_05:2020-09-10,2020-09-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 bulkscore=0 impostorscore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 spamscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009110109 X-Rspamd-Queue-Id: AC29918038E67 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 Content-Transfer-Encoding: quoted-printable 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: At boot time, or when doing memory hot-add operations, if the links in sysfs can't be created, the system is still able to run, so just report t= he error in the kernel log. Since the number of memory blocks managed could be high, the messages are rate limited. As a consequence, link_mem_sections() has no status to report anymore. Signed-off-by: Laurent Dufour Cc: David Hildenbrand --- drivers/base/node.c | 25 +++++++++++++++++-------- include/linux/node.h | 17 ++++++++--------- mm/memory_hotplug.c | 5 ++--- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/drivers/base/node.c b/drivers/base/node.c index 862516c5a5ae..749a1c8ea992 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -811,12 +811,21 @@ static int register_mem_sect_under_node(struct memo= ry_block *mem_blk, ret =3D sysfs_create_link_nowarn(&node_devices[nid]->dev.kobj, &mem_blk->dev.kobj, kobject_name(&mem_blk->dev.kobj)); - if (ret) - return ret; + if (ret && ret !=3D -EEXIST) + pr_err_ratelimited( + "can't create %s to %s link in sysfs (%d)\n", + kobject_name(&node_devices[nid]->dev.kobj), + kobject_name(&mem_blk->dev.kobj), ret); =20 - return sysfs_create_link_nowarn(&mem_blk->dev.kobj, + ret =3D sysfs_create_link_nowarn(&mem_blk->dev.kobj, &node_devices[nid]->dev.kobj, kobject_name(&node_devices[nid]->dev.kobj)); + if (ret && ret !=3D -EEXIST) + pr_err_ratelimited( + "can't create %s to %s link in sysfs (%d)\n", + kobject_name(&mem_blk->dev.kobj), + kobject_name(&node_devices[nid]->dev.kobj), + ret); } /* mem section does not span the specified node */ return 0; @@ -837,17 +846,17 @@ void unregister_memory_block_under_nodes(struct mem= ory_block *mem_blk) kobject_name(&node_devices[mem_blk->nid]->dev.kobj)); } =20 -int link_mem_sections(int nid, unsigned long start_pfn, unsigned long en= d_pfn, - enum memplug_context context) +void link_mem_sections(int nid, unsigned long start_pfn, unsigned long e= nd_pfn, + enum memplug_context context) { struct rmsun_args args =3D { .nid =3D nid, .context =3D context, }; =20 - return walk_memory_blocks(PFN_PHYS(start_pfn), - PFN_PHYS(end_pfn - start_pfn), (void *)&args, - register_mem_sect_under_node); + walk_memory_blocks(PFN_PHYS(start_pfn), + PFN_PHYS(end_pfn - start_pfn), (void *)&args, + register_mem_sect_under_node); } =20 #ifdef CONFIG_HUGETLBFS diff --git a/include/linux/node.h b/include/linux/node.h index 8ff08520488c..6bdd6f3ed3aa 100644 --- a/include/linux/node.h +++ b/include/linux/node.h @@ -99,15 +99,14 @@ extern struct node *node_devices[]; typedef void (*node_registration_func_t)(struct node *); =20 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA) -extern int link_mem_sections(int nid, unsigned long start_pfn, - unsigned long end_pfn, - enum memplug_context context); +void link_mem_sections(int nid, unsigned long start_pfn, + unsigned long end_pfn, + enum memplug_context context); #else -static inline int link_mem_sections(int nid, unsigned long start_pfn, - unsigned long end_pfn, - enum memplug_context context) +static inline void link_mem_sections(int nid, unsigned long start_pfn, + unsigned long end_pfn, + enum memplug_context context) { - return 0; } #endif =20 @@ -130,8 +129,8 @@ static inline int register_one_node(int nid) if (error) return error; /* link memory sections under this node */ - error =3D link_mem_sections(nid, start_pfn, end_pfn, - MEMPLUG_EARLY); + link_mem_sections(nid, start_pfn, end_pfn, + MEMPLUG_EARLY); } =20 return error; diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 912d355ca446..668418071a49 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1080,9 +1080,8 @@ int __ref add_memory_resource(int nid, struct resou= rce *res) } =20 /* link memory sections under this node.*/ - ret =3D link_mem_sections(nid, PFN_DOWN(start), PFN_UP(start + size - 1= ), - MEMPLUG_HOTPLUG); - BUG_ON(ret); + link_mem_sections(nid, PFN_DOWN(start), PFN_UP(start + size - 1), + MEMPLUG_HOTPLUG); =20 /* create new memmap entry */ if (!strcmp(res->name, "System RAM")) --=20 2.28.0