From patchwork Fri Sep 11 13:48:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Dufour X-Patchwork-Id: 11770649 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F814746 for ; Fri, 11 Sep 2020 13:48:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C4A0322275 for ; Fri, 11 Sep 2020 13:48:48 +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 C4A0322275 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4F88B900007; Fri, 11 Sep 2020 09:48:45 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org 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-Original-To: linux-mm@kvack.org 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-Spam-Summary: 1,0,0,1657b15b79ae528d,d41d8cd98f00b204,ldufour@linux.ibm.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1311:1314:1345:1359:1437:1515:1535:1544:1711:1730:1747:1777:1792:2393:2559:2562:2902:3138:3139:3140:3141:3142:3355:3622:3865:3866:3867:3870:3871:4119:4321:4605:5007:6261:6653:7875:8603:10004:11026:11232:11473:11658:11914:12043:12048:12296:12297:12438:12555:12895:12986:13894:13972:14096:14181:14394:14721:21080:21433:21451:21627:21939:21990:30029:30034:30046:30054,0,RBL:148.163.158.5:@linux.ibm.com:.lbl8.mailshell.net-62.2.0.100 64.100.201.201;04yge9tiz4smxruoqyjot8dfcb5poocfh4oueu11fh1rtg8axacjnz9w9cxud4g.fwfwsrzh3ouiey7awpa7mqwr1e8rntdnsnzkaznii3gzief4pmzbx7cmxd98x4n.k-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:31,LUA_SUMMARY:none 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 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 the 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 Acked-by: Michal Hocko --- 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 memory_block *mem_blk, ret = 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 != -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); - return sysfs_create_link_nowarn(&mem_blk->dev.kobj, + ret = sysfs_create_link_nowarn(&mem_blk->dev.kobj, &node_devices[nid]->dev.kobj, kobject_name(&node_devices[nid]->dev.kobj)); + if (ret && ret != -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 memory_block *mem_blk) kobject_name(&node_devices[mem_blk->nid]->dev.kobj)); } -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) { struct rmsun_args args = { .nid = nid, .context = context, }; - 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); } #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 *); #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 @@ -130,8 +129,8 @@ static inline int register_one_node(int nid) if (error) return error; /* link memory sections under this node */ - error = link_mem_sections(nid, start_pfn, end_pfn, - MEMPLUG_EARLY); + link_mem_sections(nid, start_pfn, end_pfn, + MEMPLUG_EARLY); } 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 resource *res) } /* link memory sections under this node.*/ - ret = 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); /* create new memmap entry */ if (!strcmp(res->name, "System RAM"))