From patchwork Thu Nov 23 09:23:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumanth Korikkar X-Patchwork-Id: 13466034 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 34A0DC61D85 for ; Thu, 23 Nov 2023 09:58:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9273D8D001C; Thu, 23 Nov 2023 04:58:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D5D38D0002; Thu, 23 Nov 2023 04:58:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7772C8D001C; Thu, 23 Nov 2023 04:58:41 -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 646B68D0002 for ; Thu, 23 Nov 2023 04:58:41 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 314A4B66E6 for ; Thu, 23 Nov 2023 09:58:41 +0000 (UTC) X-FDA: 81488769642.13.44185CE Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf26.hostedemail.com (Postfix) with ESMTP id 5F29E140008 for ; Thu, 23 Nov 2023 09:58:38 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Vc4+O1y+; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf26.hostedemail.com: domain of sumanthk@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=sumanthk@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700733518; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HYgtCZxFyEih59yMBfurLMGboumwZXHsg8XyOU1jf9U=; b=VJPpcXr4uPS0g6YLs/VVbLsMT7Rq8SKWrO27WrUrN7ueJfIhcsA2aCn8VrsCgKCJKjtuQl vhItUrrLtY+lAPE1c47ioSrQFJ2L6N6P7IHqfYqX/HcRe2n9UPKbGImfpuWd5Qz4CFSaHN 145iYvMgafmJPXyiOJintRzvOWkpN/8= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Vc4+O1y+; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf26.hostedemail.com: domain of sumanthk@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=sumanthk@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700733518; a=rsa-sha256; cv=none; b=XP6rf3t1h+5YerWtWXIzw68p3j2udAYbW0EI7GQbQVpRzQ1HDlg16aZhxBxLfXGktiD1zA d/SAKPBF1CCvvgrqv+lIun1CAxbfaICHF0TAxU07F/elrlmKulVvyNGJLIWiGZg0JBuzQH l6CamVKSvSfM+x5ZM1w0hFGVpxinqo4= Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN97SOE030489; Thu, 23 Nov 2023 09:24:02 GMT 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=HYgtCZxFyEih59yMBfurLMGboumwZXHsg8XyOU1jf9U=; b=Vc4+O1y+QnWgZoO0+wVbdg6ae+z4jqwMk/Ws7zP2dNJO8E/MxWGbarmZ6q41B2n3aDak oX8SobRQYsO4XYSOFktWOfr6Vqx7H3w0rHahmf1buRqmK7WD2HPkTmuJdpnw0wroQkrP O/rU08cbXksW+pNdMs6n7I7qfKLOUXqAArJemAtJTfNxxB8ivpbTLH/bCas17tYa8P3a hcNnQ4Pj6iCjNxRXr7GlQaEJptjmXoi6rGrsltjuoNzbUac4cDqKaGhdAZ231oU8Ex4t OylgpPPoQLMWfKexJyXEkJc+QJOHv1Rz+lOmfalm7Gz1Ccj9OsxZiEzC7DN84IjRj5P1 Xg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uj3twrepv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:24:01 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AN98Cl1001750; Thu, 23 Nov 2023 09:24:01 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uj3twrep2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:24:00 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN8nG1e021112; Thu, 23 Nov 2023 09:23:59 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uf8kp67bb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:23:59 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AN9Nugb35979694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Nov 2023 09:23:56 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6387C20040; Thu, 23 Nov 2023 09:23:56 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 34A712004B; Thu, 23 Nov 2023 09:23:56 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Nov 2023 09:23:56 +0000 (GMT) From: Sumanth Korikkar To: linux-mm , Andrew Morton , David Hildenbrand Cc: Oscar Salvador , Michal Hocko , "Aneesh Kumar K.V" , Anshuman Khandual , Gerald Schaefer , Sumanth Korikkar , Alexander Gordeev , Heiko Carstens , Vasily Gorbik , linux-s390 , LKML Subject: [PATCH v2 3/7] mm/memory_hotplug: introduce MEM_PREPARE_ONLINE/MEM_FINISH_OFFLINE notifiers Date: Thu, 23 Nov 2023 10:23:39 +0100 Message-Id: <20231123092343.1703707-4-sumanthk@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231123092343.1703707-1-sumanthk@linux.ibm.com> References: <20231123092343.1703707-1-sumanthk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Yp3vEj8jyuT_QEU8ZsHP0Gw5R-tAowx- X-Proofpoint-ORIG-GUID: vfXWQ1jzYRqboH9Tkb3l5IQQkwYio78y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-23_07,2023-11-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=473 adultscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311230067 X-Rspam-User: X-Stat-Signature: 6yf35m7q3897dohpuobajp9zxfbo6s5r X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 5F29E140008 X-HE-Tag: 1700733518-584358 X-HE-Meta: U2FsdGVkX19vgVEOO8+op9hEsUX2C/Y6z3mf/4y7rsDx3Go6MzI9GuHMnVB5oJNyQZpxbS4EAMYNi9N1vUPT19EnVUDHUJFPBwWXBg3Ghv8qH9mZ+fmV9AbMN8xUhDYC3dU+884rNlEV3aDhfl2HWzUMp7YFYhRZsIUrQeMgXz5ZIqC3pRqHczVTOd8/Gk5AUdFaZZpvPM5mXCisHkRq6CMaiORD+K/UlzFG7TaloCTlo2vH7C4I/SCeCeb56TgR2+bSIgY0EItezbIfCOHH3wtF09uz6ru55FvoQSwCaWBpHLHqA8vgO/GHlnuFQwZyeTlEB5+E+Ga0NxITB+2BCzeFlrsTY0TLKVSsoQLCeGiEo2VndBFg8bDa3Cs8iC1qkBWvreG1lEDHJbZ9NOfHgzX/YOH0spAcWH9Lj6n9VK5p8MZ0eX229EkxGDNdHN7YMJST8GWSuphDTLG5Gb8BVXudh4s3CNXcQhWtrOivEx+HV7TzipYOVaMqZzJ6k2FidsQ1YwyTrRossZHOeReQszaTV6meWgLa/5nw9eX7ZZj2LTKA+w+3qkazrvyX9NcyeLyNCGDT8QnuBlKKzDqz7JS8LCAjADNojVSCG+SKRUuoFhJdRlgxy/dlDYulTCzjimoqCKHbhoGj5bGeFqsttBFs2ld47LAXNRwI65NFO19b7pgoTYhoyzERLv2S+jz5ekW1zdQ/KsfAkZ8yslJjM4S+cnjSj4sSFA7k+vMXSIWBosb+p+K14fpwF88j7sOsz0XUP5/qRRWCNYKUgiaVOoPyILx/Gf4XXxfJ9M3fz3BGknAhS3W461ckfnvJM6+Z/3v/koCAEAkZ1yQrSh+aXIEmEOZlOKI4Jd55GpJJ4XFf82gCBn1kqOXbJs+FN9qzjEJNj4GS7A9o3bH9rjDzt6I+VPKtK9NLd9Y1QvnCXj1v27EvFI8ng/vx7cTnyQ94iTDjsJX5PhL8BZlLi65 cpTcENz2 Sogz17ByC7/tIR3wUs+1gryywko1ZCq1ZdgnpaZp8kkpW8i8ptKkjn9DqUDO+82V9PtrSoAENYbM2OYkjSW+jcs3NDZVD0hkhJNa219ZutFkXrJduNfq+JHPH7U/61wA397GjF5NSRkBNtjTf8yWzAalJyynGyV/x0EDeAOHtXpSmTqrpjJIBXFk5JpIwQSsbXGIN 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: Introduce MEM_PREPARE_ONLINE/MEM_FINISH_OFFLINE memory notifiers to prepare the transition of memory to and from a physically accessible state. This enhancement is crucial for implementing the "memmap on memory" feature for s390 in a subsequent patch. Platforms such as x86 can support physical memory hotplug via ACPI. When there is physical memory hotplug, ACPI event leads to the memory addition with the following callchain: acpi_memory_device_add() -> acpi_memory_enable_device() -> __add_memory() After this, the hotplugged memory is physically accessible, and altmap support prepared, before the "memmap on memory" initialization in memory_block_online() is called. On s390, memory hotplug works in a different way. The available hotplug memory has to be defined upfront in the hypervisor, but it is made physically accessible only when the user sets it online via sysfs, currently in the MEM_GOING_ONLINE notifier. This is too late and "memmap on memory" initialization is performed before calling MEM_GOING_ONLINE notifier. During the memory hotplug addition phase, altmap support is prepared (but not yet accessed) and during the memory onlining phase s390 requires memory to be physically accessible and then subsequently initiate the "memmap on memory" initialization process. The new MEM_PREPARE_ONLINE notifier allows to work around the problem, by providing a hook to prepare the memory and make it physically accessible. Similarly, the MEM_FINISH_OFFLINE notifier allows to make the memory physically inaccessible at the end of memory_block_offline(). All architectures ignore unknown memory notifiers, so this patch should not introduce any functional changes. Reviewed-by: Gerald Schaefer Signed-off-by: Sumanth Korikkar --- drivers/base/memory.c | 18 +++++++++++++++++- include/linux/memory.h | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index cbff43b2ef44..a06a0b869992 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -188,6 +188,7 @@ static int memory_block_online(struct memory_block *mem) unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; unsigned long nr_vmemmap_pages = 0; + struct memory_notify arg; struct zone *zone; int ret; @@ -197,6 +198,14 @@ static int memory_block_online(struct memory_block *mem) zone = zone_for_pfn_range(mem->online_type, mem->nid, mem->group, start_pfn, nr_pages); + arg.start_pfn = start_pfn; + arg.nr_pages = nr_pages; + mem_hotplug_begin(); + ret = memory_notify(MEM_PREPARE_ONLINE, &arg); + ret = notifier_to_errno(ret); + if (ret) + goto out_notifier; + /* * Although vmemmap pages have a different lifecycle than the pages * they describe (they remain until the memory is unplugged), doing @@ -207,7 +216,6 @@ static int memory_block_online(struct memory_block *mem) if (mem->altmap) nr_vmemmap_pages = mem->altmap->free; - mem_hotplug_begin(); if (nr_vmemmap_pages) { ret = mhp_init_memmap_on_memory(start_pfn, nr_vmemmap_pages, zone, mem->inaccessible); @@ -232,7 +240,11 @@ static int memory_block_online(struct memory_block *mem) nr_vmemmap_pages); mem->zone = zone; + mem_hotplug_done(); + return ret; out: + memory_notify(MEM_FINISH_OFFLINE, &arg); +out_notifier: mem_hotplug_done(); return ret; } @@ -245,6 +257,7 @@ static int memory_block_offline(struct memory_block *mem) unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; unsigned long nr_vmemmap_pages = 0; + struct memory_notify arg; int ret; if (!mem->zone) @@ -276,6 +289,9 @@ static int memory_block_offline(struct memory_block *mem) mhp_deinit_memmap_on_memory(start_pfn, nr_vmemmap_pages); mem->zone = NULL; + arg.start_pfn = start_pfn; + arg.nr_pages = nr_pages; + memory_notify(MEM_FINISH_OFFLINE, &arg); out: mem_hotplug_done(); return ret; diff --git a/include/linux/memory.h b/include/linux/memory.h index 655714d4e65a..76e5ab68dab7 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h @@ -97,6 +97,8 @@ int set_memory_block_size_order(unsigned int order); #define MEM_GOING_ONLINE (1<<3) #define MEM_CANCEL_ONLINE (1<<4) #define MEM_CANCEL_OFFLINE (1<<5) +#define MEM_PREPARE_ONLINE (1<<6) +#define MEM_FINISH_OFFLINE (1<<7) struct memory_notify { unsigned long start_pfn; From patchwork Thu Nov 23 09:23:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumanth Korikkar X-Patchwork-Id: 13465976 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 680CEC61D85 for ; Thu, 23 Nov 2023 09:24:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 447778D0016; Thu, 23 Nov 2023 04:24:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F7E88D0002; Thu, 23 Nov 2023 04:24:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2BECB8D0016; Thu, 23 Nov 2023 04:24:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1F7A28D0002 for ; Thu, 23 Nov 2023 04:24:08 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E9AAB160C81 for ; Thu, 23 Nov 2023 09:24:07 +0000 (UTC) X-FDA: 81488682534.01.953D756 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf23.hostedemail.com (Postfix) with ESMTP id 9FD01140003 for ; Thu, 23 Nov 2023 09:24:05 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=CzoF3zoc; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf23.hostedemail.com: domain of sumanthk@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=sumanthk@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700731445; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=41K4icimMJIT45DxBnMIJJ2CEMSN8J+yKTR1FikXIs0=; b=hsR4UUjRPaAyMOTj26w/kXRKuob6SAOj3XGAocfn7TYwBGp/hVjRUdVrJ6MX7vSYIf8M3f RsZpxMxQkrbaNWcbXdRjDfgyu0fPo5tnGf9LCOhD6qxijpH5fz3f51ln6dYx3ofkXEBHSt 3LZfAoQeqKa89r/rr6UUi/X05U98zn4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=CzoF3zoc; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf23.hostedemail.com: domain of sumanthk@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=sumanthk@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700731445; a=rsa-sha256; cv=none; b=d5RnQURYIhTrnX3GZRkhjUatGpJbS2VFwc5ws6vOlhVIh/crO7P469uzrdyQOv6sEW9MO+ z9vAKQcKSvp1/+KVvoWSkkM5ejf+HdnPimP6yCmkZdiXbPXnRvaQyVvOH0tTlumXjOg6WR Ht6Y64Tb/6iGsGdsT8hHALDF8xLKyds= Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN9GJZX001602; Thu, 23 Nov 2023 09:24:02 GMT 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=41K4icimMJIT45DxBnMIJJ2CEMSN8J+yKTR1FikXIs0=; b=CzoF3zocC3/hffz59bu5ojGuDiayP+RkLom6Fu6Wl/+hnSD39LFB6JlaGYqlQ5+ecvEW BGvjIMYlOKgwcBXlU5dZa7gslkSIbAv3kqN/wddSt0y2gXSxtoo+pU9Xe9xRJrdo+NKW 19ZCpzBqz4h1Q5iMEuMcZZ5rMOfvgRt/BG9hhow6naZHa8JlPYILlzjEWvRnElcjkmm5 8Szh92hc+0i1/tGUo+sDeUOZ4X8LzI1/dIiKYQ2V6fKBC7xzsoYWu91W/4spkhVgLGMU 0qBJyXW5iAvzF6Y8aTn23RSA2/SPT3dYSQMFMKRKPPSgsJVMOeUyRRAcJ69OrSvjvG5f nA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uj2qpt38u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:24:01 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AN9HwFg007550; Thu, 23 Nov 2023 09:24:01 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uj2qpt38d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:24:01 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN8n9CQ019199; Thu, 23 Nov 2023 09:23:59 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uf7yyxcmk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:23:59 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AN9NuNg29229742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Nov 2023 09:23:56 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9DE3A20040; Thu, 23 Nov 2023 09:23:56 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6871520043; Thu, 23 Nov 2023 09:23:56 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Nov 2023 09:23:56 +0000 (GMT) From: Sumanth Korikkar To: linux-mm , Andrew Morton , David Hildenbrand Cc: Oscar Salvador , Michal Hocko , "Aneesh Kumar K.V" , Anshuman Khandual , Gerald Schaefer , Sumanth Korikkar , Alexander Gordeev , Heiko Carstens , Vasily Gorbik , linux-s390 , LKML Subject: [PATCH v2 4/7] s390/mm: allocate vmemmap pages from self-contained memory range Date: Thu, 23 Nov 2023 10:23:40 +0100 Message-Id: <20231123092343.1703707-5-sumanthk@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231123092343.1703707-1-sumanthk@linux.ibm.com> References: <20231123092343.1703707-1-sumanthk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: aT6V4RuQRLbsRdxflQw3IeQf8R6_w5ys X-Proofpoint-ORIG-GUID: pflV894kYMasUOBdS7P6s82-BPDeEhJO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-23_07,2023-11-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 impostorscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxlogscore=939 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311230067 X-Rspamd-Queue-Id: 9FD01140003 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 3awc7go9kx4hqsa4mdn9phbpuigs55dm X-HE-Tag: 1700731445-7898 X-HE-Meta: U2FsdGVkX18thoOng8zbPoZonIjscZiLgaw/B+leq1+Oop3rpUELLcyZpX+O3lNgHt0gTfkh05VHFTvZr8dVxjF/hIcQkltug31EPW6WahcMv6N1tPoRT6h/zJ1jIAqkrcRAZPe9LLcY5KisX9MKOjyuOEs7T3BMQrf/5p/htDI9HMV8AO9uF3sZHOqVKKR2/sIV/BPZrLW/FnETqfbbxq2iHYRiedYO97fVbesGeTFYTZ7R4v7rNPsDoiHUXi0HanLaWMeqd8TC85TGYzG3Aq2wwyr+FD4ttzelYcfZX6eNFL4acU5eYxniCAmBUEyEUwFqOcm2XZTJct1F1jrDpEu9aPRhhU4xKWE2Wqm1X1XcIbfahp2JoLxTY2mUHAfJkSgUoHklkjBIOefRX9nrY5rnJGa2qA5XGocmNgG9N4GF3ty5FLnQoXYc2ZeMyFuctYzeVOXf9YEkt7tdKjmlZcjo7Aru0YP6YBaosN2u124fthc7JdMClbvP84XPjalcG1I8LRQSt2GuKyEzrWjC6m0OCQBWJ9UAp5v+73BxYih+qVZ5EPXzaWYGHoh/7flXBhQ6EqsWcqfRSAhFDnAEFWFf8IDK2jLJHf21QIpi9iR8hGZDsfKWNzOkeLSOL5VGPu4EmQCrW4ZNGLCYp2g8Re7CDfCWn/cSJ88CHfjtaaqPeKgQ+0qziWbFaGzQ0A1tslDKzwRABD3oqVTT3iBOh+qyiDaiW2P1QsLw2etR58iVDYfpvalqnR+gysMGeDuaZRlrZwY51fel3dAF36Y1pEYsW4sLYpCsDFojrgw28JIdcAkayMEMxLyN59SqHgaOsRmKV+SHaOudVM5O8DEL8tEuOQBDsBErQL6AQ9+ORSqveh+4ZXlmO4yj+K3oLdtlG6HNKTk8l0ppzVnAPF4RKL+UvHIluxvcYT82/mK7hQAL4vtxoVjxO9CmBokhl3NPV3GcR6ovJjcSMinxAoh mjtMrazP yh+YR3lWNoZA/sXYgz/qG1rrURLcykljwICwDxABSKt8/lJzwFTYT4kVJRln5REsBu4HUcV8NkKuM7mg8qeKkxAEzGws8AHZA7X/UaqGoJnA5I86GALARire/TN1M2W6xxyHGmhIzpeW0hhE= 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: Allocate memory map (struct pages array) from the hotplugged memory range, rather than using system memory. The change addresses the issue where standby memory, when configured to be much larger than online memory, could potentially lead to ipl failure due to memory map allocation from online memory. For example, 16MB of memory map allocation is needed for a memory block size of 1GB and when standby memory is configured much larger than online memory, this could lead to ipl failure. To address this issue, the solution involves introducing "memmap on memory" using the vmem_altmap structure on s390. Architectures that want to implement it should pass the altmap to the vmemmap_populate() function and its associated callchain. This enhancement is discussed in the commit 4b94ffdc4163 ("x86, mm: introduce vmem_altmap to augment vmemmap_populate()"). Provide "memmap on memory" support for s390 by passing the altmap in vmemmap_populate() and its callchain. The allocation path is described as follows: * When altmap is NULL in vmemmap_populate(), memory map allocation occurs using the existing vmemmap_alloc_block_buf(). * When altmap is not NULL in vmemmap_populate(), memory map allocation still uses vmemmap_alloc_block_buf(), but this function internally calls altmap_alloc_block_buf(). For deallocation, the process is outlined as follows: * When altmap is NULL in vmemmap_free(), memory map deallocation happens through free_pages(). * When altmap is not NULL in vmemmap_free(), memory map deallocation occurs via vmem_altmap_free(). While memory map allocation is primarily handled through the self-contained memory map range, there might still be a small amount of system memory allocation required for vmemmap pagetables. To mitigate this impact, this feature will be limited to machines with EDAT1 support. Reviewed-by: Gerald Schaefer Signed-off-by: Sumanth Korikkar --- arch/s390/mm/init.c | 3 --- arch/s390/mm/vmem.c | 62 +++++++++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index 43e612bc2bcd..8d9a60ccb777 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c @@ -281,9 +281,6 @@ int arch_add_memory(int nid, u64 start, u64 size, unsigned long size_pages = PFN_DOWN(size); int rc; - if (WARN_ON_ONCE(params->altmap)) - return -EINVAL; - if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot)) return -EINVAL; diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c index 186a020857cf..eb100479f7be 100644 --- a/arch/s390/mm/vmem.c +++ b/arch/s390/mm/vmem.c @@ -33,8 +33,12 @@ static void __ref *vmem_alloc_pages(unsigned int order) return memblock_alloc(size, size); } -static void vmem_free_pages(unsigned long addr, int order) +static void vmem_free_pages(unsigned long addr, int order, struct vmem_altmap *altmap) { + if (altmap) { + vmem_altmap_free(altmap, 1 << order); + return; + } /* We don't expect boot memory to be removed ever. */ if (!slab_is_available() || WARN_ON_ONCE(PageReserved(virt_to_page((void *)addr)))) @@ -156,7 +160,8 @@ static bool vmemmap_unuse_sub_pmd(unsigned long start, unsigned long end) /* __ref: we'll only call vmemmap_alloc_block() via vmemmap_populate() */ static int __ref modify_pte_table(pmd_t *pmd, unsigned long addr, - unsigned long end, bool add, bool direct) + unsigned long end, bool add, bool direct, + struct vmem_altmap *altmap) { unsigned long prot, pages = 0; int ret = -ENOMEM; @@ -172,11 +177,11 @@ static int __ref modify_pte_table(pmd_t *pmd, unsigned long addr, if (pte_none(*pte)) continue; if (!direct) - vmem_free_pages((unsigned long) pfn_to_virt(pte_pfn(*pte)), 0); + vmem_free_pages((unsigned long)pfn_to_virt(pte_pfn(*pte)), get_order(PAGE_SIZE), altmap); pte_clear(&init_mm, addr, pte); } else if (pte_none(*pte)) { if (!direct) { - void *new_page = vmemmap_alloc_block(PAGE_SIZE, NUMA_NO_NODE); + void *new_page = vmemmap_alloc_block_buf(PAGE_SIZE, NUMA_NO_NODE, altmap); if (!new_page) goto out; @@ -213,7 +218,8 @@ static void try_free_pte_table(pmd_t *pmd, unsigned long start) /* __ref: we'll only call vmemmap_alloc_block() via vmemmap_populate() */ static int __ref modify_pmd_table(pud_t *pud, unsigned long addr, - unsigned long end, bool add, bool direct) + unsigned long end, bool add, bool direct, + struct vmem_altmap *altmap) { unsigned long next, prot, pages = 0; int ret = -ENOMEM; @@ -234,11 +240,11 @@ static int __ref modify_pmd_table(pud_t *pud, unsigned long addr, if (IS_ALIGNED(addr, PMD_SIZE) && IS_ALIGNED(next, PMD_SIZE)) { if (!direct) - vmem_free_pages(pmd_deref(*pmd), get_order(PMD_SIZE)); + vmem_free_pages(pmd_deref(*pmd), get_order(PMD_SIZE), altmap); pmd_clear(pmd); pages++; } else if (!direct && vmemmap_unuse_sub_pmd(addr, next)) { - vmem_free_pages(pmd_deref(*pmd), get_order(PMD_SIZE)); + vmem_free_pages(pmd_deref(*pmd), get_order(PMD_SIZE), altmap); pmd_clear(pmd); } continue; @@ -261,7 +267,7 @@ static int __ref modify_pmd_table(pud_t *pud, unsigned long addr, * page tables since vmemmap_populate gets * called for each section separately. */ - new_page = vmemmap_alloc_block(PMD_SIZE, NUMA_NO_NODE); + new_page = vmemmap_alloc_block_buf(PMD_SIZE, NUMA_NO_NODE, altmap); if (new_page) { set_pmd(pmd, __pmd(__pa(new_page) | prot)); if (!IS_ALIGNED(addr, PMD_SIZE) || @@ -280,7 +286,7 @@ static int __ref modify_pmd_table(pud_t *pud, unsigned long addr, vmemmap_use_sub_pmd(addr, next); continue; } - ret = modify_pte_table(pmd, addr, next, add, direct); + ret = modify_pte_table(pmd, addr, next, add, direct, altmap); if (ret) goto out; if (!add) @@ -302,12 +308,12 @@ static void try_free_pmd_table(pud_t *pud, unsigned long start) for (i = 0; i < PTRS_PER_PMD; i++, pmd++) if (!pmd_none(*pmd)) return; - vmem_free_pages(pud_deref(*pud), CRST_ALLOC_ORDER); + vmem_free_pages(pud_deref(*pud), CRST_ALLOC_ORDER, NULL); pud_clear(pud); } static int modify_pud_table(p4d_t *p4d, unsigned long addr, unsigned long end, - bool add, bool direct) + bool add, bool direct, struct vmem_altmap *altmap) { unsigned long next, prot, pages = 0; int ret = -ENOMEM; @@ -347,7 +353,7 @@ static int modify_pud_table(p4d_t *p4d, unsigned long addr, unsigned long end, } else if (pud_large(*pud)) { continue; } - ret = modify_pmd_table(pud, addr, next, add, direct); + ret = modify_pmd_table(pud, addr, next, add, direct, altmap); if (ret) goto out; if (!add) @@ -370,12 +376,12 @@ static void try_free_pud_table(p4d_t *p4d, unsigned long start) if (!pud_none(*pud)) return; } - vmem_free_pages(p4d_deref(*p4d), CRST_ALLOC_ORDER); + vmem_free_pages(p4d_deref(*p4d), CRST_ALLOC_ORDER, NULL); p4d_clear(p4d); } static int modify_p4d_table(pgd_t *pgd, unsigned long addr, unsigned long end, - bool add, bool direct) + bool add, bool direct, struct vmem_altmap *altmap) { unsigned long next; int ret = -ENOMEM; @@ -394,7 +400,7 @@ static int modify_p4d_table(pgd_t *pgd, unsigned long addr, unsigned long end, goto out; p4d_populate(&init_mm, p4d, pud); } - ret = modify_pud_table(p4d, addr, next, add, direct); + ret = modify_pud_table(p4d, addr, next, add, direct, altmap); if (ret) goto out; if (!add) @@ -415,12 +421,12 @@ static void try_free_p4d_table(pgd_t *pgd, unsigned long start) if (!p4d_none(*p4d)) return; } - vmem_free_pages(pgd_deref(*pgd), CRST_ALLOC_ORDER); + vmem_free_pages(pgd_deref(*pgd), CRST_ALLOC_ORDER, NULL); pgd_clear(pgd); } static int modify_pagetable(unsigned long start, unsigned long end, bool add, - bool direct) + bool direct, struct vmem_altmap *altmap) { unsigned long addr, next; int ret = -ENOMEM; @@ -445,7 +451,7 @@ static int modify_pagetable(unsigned long start, unsigned long end, bool add, goto out; pgd_populate(&init_mm, pgd, p4d); } - ret = modify_p4d_table(pgd, addr, next, add, direct); + ret = modify_p4d_table(pgd, addr, next, add, direct, altmap); if (ret) goto out; if (!add) @@ -458,14 +464,16 @@ static int modify_pagetable(unsigned long start, unsigned long end, bool add, return ret; } -static int add_pagetable(unsigned long start, unsigned long end, bool direct) +static int add_pagetable(unsigned long start, unsigned long end, bool direct, + struct vmem_altmap *altmap) { - return modify_pagetable(start, end, true, direct); + return modify_pagetable(start, end, true, direct, altmap); } -static int remove_pagetable(unsigned long start, unsigned long end, bool direct) +static int remove_pagetable(unsigned long start, unsigned long end, bool direct, + struct vmem_altmap *altmap) { - return modify_pagetable(start, end, false, direct); + return modify_pagetable(start, end, false, direct, altmap); } /* @@ -474,7 +482,7 @@ static int remove_pagetable(unsigned long start, unsigned long end, bool direct) static int vmem_add_range(unsigned long start, unsigned long size) { start = (unsigned long)__va(start); - return add_pagetable(start, start + size, true); + return add_pagetable(start, start + size, true, NULL); } /* @@ -483,7 +491,7 @@ static int vmem_add_range(unsigned long start, unsigned long size) static void vmem_remove_range(unsigned long start, unsigned long size) { start = (unsigned long)__va(start); - remove_pagetable(start, start + size, true); + remove_pagetable(start, start + size, true, NULL); } /* @@ -496,9 +504,9 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, mutex_lock(&vmem_mutex); /* We don't care about the node, just use NUMA_NO_NODE on allocations */ - ret = add_pagetable(start, end, false); + ret = add_pagetable(start, end, false, altmap); if (ret) - remove_pagetable(start, end, false); + remove_pagetable(start, end, false, altmap); mutex_unlock(&vmem_mutex); return ret; } @@ -509,7 +517,7 @@ void vmemmap_free(unsigned long start, unsigned long end, struct vmem_altmap *altmap) { mutex_lock(&vmem_mutex); - remove_pagetable(start, end, false); + remove_pagetable(start, end, false, altmap); mutex_unlock(&vmem_mutex); } From patchwork Thu Nov 23 09:23:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumanth Korikkar X-Patchwork-Id: 13465975 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 53370C5AD4C for ; Thu, 23 Nov 2023 09:24:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D97158D0015; Thu, 23 Nov 2023 04:24:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D467B8D0002; Thu, 23 Nov 2023 04:24:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE6CA8D0015; Thu, 23 Nov 2023 04:24:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id ADA078D0002 for ; Thu, 23 Nov 2023 04:24:07 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8628E141000 for ; Thu, 23 Nov 2023 09:24:07 +0000 (UTC) X-FDA: 81488682534.03.9187F46 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf26.hostedemail.com (Postfix) with ESMTP id 33CA8140017 for ; Thu, 23 Nov 2023 09:24:05 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=tEwLHAqp; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf26.hostedemail.com: domain of sumanthk@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=sumanthk@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700731445; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DwHOG1newJu1qjx/f0p46r3XXYNsOT2O58COXkYKOuc=; b=MOHfSaaJmFUykmNWV+O3KKLPzYQGR7uqjMkyfdQMAMtih62TsvGQSvouQ4O48IrlaPKDFN H64zJjrfgU9Kx5RqsrzeSRmnj0L4OWwBROVVXXJocG/0VFaxUxi5sitj6nk94x9/QyzBWE P7QSKBaDb3c03HPKWg3zIUryZj41rqE= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=tEwLHAqp; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf26.hostedemail.com: domain of sumanthk@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=sumanthk@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700731445; a=rsa-sha256; cv=none; b=LKaA2gdmmLrFa3WA6P/D+niP8hiRy9uqWtEoBBIaQnraHzak+7ZGMygvOX3AEiKaA0o+gz /9jW06Q6tQzu30cssIMCzhiALTGSBDAK7w8qSV1n4iSn3/4gC8MYKXQJeh3c+JMwRTIxeO 9z/fOZKYiD2+oSbmJTv1Y8jfQWSMKIE= Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN9GBo7011369; Thu, 23 Nov 2023 09:24:01 GMT 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=DwHOG1newJu1qjx/f0p46r3XXYNsOT2O58COXkYKOuc=; b=tEwLHAqpNwhif0+Ag62KIocPybR/tNk1cSj5MMY8kPdTaJS/EWQx8jaifMNNAqqi2Nq7 Ki3UdWR3EnRGhXPJfmZgpRsCWcuzCVrYUrdSygnnmBly9cr8vddRDUg+p9nGgBJOlJgi 91R1ik2d7bF48J4MLH5o60gJZFyJswaGH0XWeW4lOXhdrgcxfL6Kq9NflyXC3TI5SDL2 0C2n/pOw4aB9XEetOUfBTsDlHcCFgiO3jrhkNonp8gNqNlxT1OE1KOHoL4F0WNpZ0sCH 2X3NH24Vos+O2ThHz60ehYpoTYiM0GW6OaXkSbBM0287dsy+79hvuw7yp4fbsKJFLapB 5Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uj3txrdc5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:24:01 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AN9GUei013633; Thu, 23 Nov 2023 09:24:00 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uj3txrdbj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:24:00 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN8nLq6023559; Thu, 23 Nov 2023 09:23:59 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uf9tknun1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:23:59 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AN9Nu0V43188718 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Nov 2023 09:23:57 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9B3720040; Thu, 23 Nov 2023 09:23:56 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A29792004B; Thu, 23 Nov 2023 09:23:56 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Nov 2023 09:23:56 +0000 (GMT) From: Sumanth Korikkar To: linux-mm , Andrew Morton , David Hildenbrand Cc: Oscar Salvador , Michal Hocko , "Aneesh Kumar K.V" , Anshuman Khandual , Gerald Schaefer , Sumanth Korikkar , Alexander Gordeev , Heiko Carstens , Vasily Gorbik , linux-s390 , LKML Subject: [PATCH v2 5/7] s390/sclp: remove unhandled memory notifier type Date: Thu, 23 Nov 2023 10:23:41 +0100 Message-Id: <20231123092343.1703707-6-sumanthk@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231123092343.1703707-1-sumanthk@linux.ibm.com> References: <20231123092343.1703707-1-sumanthk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: eFLCguzwJR0xI4ArxCKRpAwSv_nwpZA3 X-Proofpoint-GUID: wjBewFb2_JFDdMGvDJlHQOQoAm403n7C X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-23_07,2023-11-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=734 malwarescore=0 phishscore=0 clxscore=1015 bulkscore=0 mlxscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311230067 X-Rspam-User: X-Stat-Signature: ahgdq9hcrm1q8am4i87c5xiksqitb1j4 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 33CA8140017 X-HE-Tag: 1700731445-691911 X-HE-Meta: U2FsdGVkX19iwZvSHZOS6bMLtjiziDnwt2PQKbUmr+7h6SetVCebcFn3dkBmMA29UnBAOFNV3fbNm4EA7OdyIIWjPvS11z4xim9519RLhgRmN+2B1lThgCBPScac0JHBXdk7wRDiVO2KQgtwoTbPNGfAYZ0Ze3A6ZJn5xRm1Auozu5tLDtc8NdKLo3qbE6ehE2ctijyO1ZwTaZGK+YpaHY3CBUtYOBGQIH9vCAyFZyVPue/ubzjTNbrOkGq3AhAkx37TSHusfxerGNGEEixjp9hKNUCf43LkmBf21Tu/8A9NV1sHN+14rSFwcPkWuiVDA3GLVJNjtdv2/GumVuR6zoawgi5P6XdHb+ci691aKn7CgR6uhfFy5hhzraGJ0BIBVROAF3ZlG2XgdqrecsHsOF7x4x1XjvjQTTITgHV+dawami2acdjzU51bOBaqntAvwfJClV8O9ryYNxP7KKpRPnhxG/hwANDE8+3lzlWds8t1Q8Kkt589BXIdRNqpu3lFPrbhd88b1fPhNh3ASsOjMWD1gbVf/DlKmgrkQ9pS6iQDwtqR65w+mHE7XmuObAhbz5+bjIjUvLKNNlBl7IctHgTS+La74pf9lr7Teipx9+jIAXIWS7tnG48Ms+PiDZaXsec8mqpXdPvin1vYjUHhN6EzWfPzAyTT1PvhBHaKs3W5wUTTWAOtFrYrEekGyEduz915s6xFKZsSQXYnlx793CWd40IObFUsEwNza08Kvlqa0EcGcj+vwNRhfbkzvuJnnmbtA9FI53DoGymwJbQfwNdZa2UbA5BQzvvtq8CKlPj45iftqC83FsysYUfVNCZghxuGfc5IdITAChSJeH3h5nydvMcc7LbbzOeqbDsoScCtsFKwHj9FVpZxNhNxLqj/dhWlfVfgwipHot4y47aw+r6QjXFpjPxp31TWN0HXfuz4IAMcyWWRezT42p4w4bO4bsA+uIG0zuLReVQtlQV PWQkPIwf t0bYMHp8hrYvMAIXwiBWGS6ZpuOyYr3JHXVXdM0xn7Rb0edcC7X5+N9mJCXgvkUEkZuxJiww/f0SjlESNaUBbV8DUrVK5jIK+rVaFx6/3oBdHM8bG4RYzRy/7NtGO+l9iIcHs7hpIZJIH+fwIRSu+p/4fOPNjYS3UWR9MX/IPV0GZZaTtjkMdzo++x8mPTV8IQgW8Hw8pwsMeKJhI3orv/ifHFkImNceGYyhEzXDtJv1tAME= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Remove memory notifier types which are unhandled by s390. Unhandled memory notifier types are covered by default case. Suggested-by: Alexander Gordeev Signed-off-by: Sumanth Korikkar --- drivers/s390/char/sclp_cmd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 11c428f4c7cf..355e63e44e95 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c @@ -340,9 +340,6 @@ static int sclp_mem_notifier(struct notifier_block *nb, if (contains_standby_increment(start, start + size)) rc = -EPERM; break; - case MEM_ONLINE: - case MEM_CANCEL_OFFLINE: - break; case MEM_GOING_ONLINE: rc = sclp_mem_change_state(start, size, 1); break; From patchwork Thu Nov 23 09:23:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumanth Korikkar X-Patchwork-Id: 13466070 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 D332DC5AD4C for ; Thu, 23 Nov 2023 10:28:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6EBAB8D001F; Thu, 23 Nov 2023 05:28:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 69BD68D0002; Thu, 23 Nov 2023 05:28:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58AA68D001F; Thu, 23 Nov 2023 05:28:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4A8E18D0002 for ; Thu, 23 Nov 2023 05:28:44 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 213F01CBC26 for ; Thu, 23 Nov 2023 10:28:44 +0000 (UTC) X-FDA: 81488845368.10.E21C7C2 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf07.hostedemail.com (Postfix) with ESMTP id 83D544001A for ; Thu, 23 Nov 2023 10:28:40 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=jKsXgpfE; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf07.hostedemail.com: domain of sumanthk@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=sumanthk@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700735321; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KPRlQtJdP2SQXlU1DKJM3r95nlRPrmMCK5sKODwSOzA=; b=Mp3g4EtEt1JzvoZPCwUguvYSxhzBNA2533haDYMV9tSe9WxeU3vWh/EYjMPjncknXE0XUA Cp55cR2jbj3oZVw/8FlSctwz7G4yyt/g0qBtOL2tbNup4BPw4IIhloK2ldSwVwoFrL0bxf k43Nd244Anx/9kMKfxS8u5TWRjViXn8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=jKsXgpfE; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf07.hostedemail.com: domain of sumanthk@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=sumanthk@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700735321; a=rsa-sha256; cv=none; b=3qWH9zWu+KPiXJI+I6/NslbX6ICm/a/He8oeSeWbN4Q3Q31xcFKuE1w2MBc8JN/jD1tXUu kAGT6LNzb/PbW3n1HPj3WBpHpy6TMiL0PhgyHROJmce+W4roU/+8CqYCy5y1ioFVlKYtV1 FiiYGqjWOfPnjCOROV/GRy5FVNAl19I= Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN97W5U030640; Thu, 23 Nov 2023 09:24:02 GMT 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=KPRlQtJdP2SQXlU1DKJM3r95nlRPrmMCK5sKODwSOzA=; b=jKsXgpfE8uTD8DkWewDFNsQIV76G5OCDgmpj+/Dch0O5EHpYNv7wGYdt1U4YrQ9fQU69 C9TGeylUy0SCKdMogksk8tsXRL1A/sw2g0oeep2fPL8UHqkyjhFn9a+q5fzGy9pecCfl n6Zi43Am6VEJ8K3GyvKgXet7LI1H20GPpsA0hHQgj1Y5BTluK19VeHKAInsUisyaOfk6 NhpMougB1kbcai5bawSSC7MeRl9HVoTDOyOXu1RrOMDwOLE6Sl2WrZqihPomj1rZc2DI OAvC/aom2gpLyn/IEWYgKFQCcHAwLh/019VwerFD2EOcCGMbMHa4ObU/pAvl0I04Jzxg tw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uj3twreq5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:24:02 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AN9GJCQ029906; Thu, 23 Nov 2023 09:24:01 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uj3twrepp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:24:01 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN8nDUT022805; Thu, 23 Nov 2023 09:24:00 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uf93m61sy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 09:24:00 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AN9NvIZ2163294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Nov 2023 09:23:57 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 53A7320040; Thu, 23 Nov 2023 09:23:57 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1CCE62004B; Thu, 23 Nov 2023 09:23:57 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Nov 2023 09:23:57 +0000 (GMT) From: Sumanth Korikkar To: linux-mm , Andrew Morton , David Hildenbrand Cc: Oscar Salvador , Michal Hocko , "Aneesh Kumar K.V" , Anshuman Khandual , Gerald Schaefer , Sumanth Korikkar , Alexander Gordeev , Heiko Carstens , Vasily Gorbik , linux-s390 , LKML Subject: [PATCH v2 7/7] s390: enable MHP_MEMMAP_ON_MEMORY Date: Thu, 23 Nov 2023 10:23:43 +0100 Message-Id: <20231123092343.1703707-8-sumanthk@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231123092343.1703707-1-sumanthk@linux.ibm.com> References: <20231123092343.1703707-1-sumanthk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: yS8mHflc-hQ0QxnqPWywWogbjP7kcYb5 X-Proofpoint-ORIG-GUID: 0kVFvKCEU7cKCqrnqQ1w2WWgDLzYcr_Z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-23_07,2023-11-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=806 adultscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311230067 X-Rspamd-Queue-Id: 83D544001A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: gp65s4sogng7tst6mc4mu8ygisfjr5x5 X-HE-Tag: 1700735320-180969 X-HE-Meta: U2FsdGVkX192WFFuUBsOPvA0pzgk/L2kIfXgieJ8mn4iU+7vUm4EkCMBouN7RF7DWmaG5yQA24YmNGuXcfqbBmaOl0ammP9vTWIav1lZPlOk1Nw0zrU4Akkf+SSKvUyt3QHhJAbcWXnqoz08sawElEsDlYrvkSBBcHXR/HndOGycj/OaTQPNDAWcP09y1/T8KvLZhp1EPUt8xWmkvaOnzrOvZ3gZAb/dQ8tmuwK0Qjs6zPdCOHI0RhhbTizVVTojQ14r9GY4vwuU+yEUWVWLcs0n6h0KJ2gaD8ysLc8/hJ6jSqKLHwsK4nq3EzYe2dedAUV3bNcdPAmEnbCNm7hAzwtod6a6pnYsyYe2TfJmk4FqLIoKUbc3Byq/5PeS7wkGaoGDGfyALdGEN8ecPYtUrHh9CTl9iK4+0M3wr0hACUt4+DH4fkao6XHg9o4wjcxh4ZsQoYguQVnDoR5sobnqQNEuH/QQZ+eDzmvQ42eauFrV5rwNtCZdVdB6SGb9VEaiIXOtGpEIKI5IqI6jJevinnlWsnZu9kdw6foy+3hpl3tt2dpJkDjuT4qr2oe/RRfx4DGMLo4+oZ9t9r08pkrcwDTfZvsbJWIcbbBDW2Ke0OHUXLNvy9Ky5qzvu3Lp44ezZJRLa4V9vMExaDA8MpOPoEDSdG+IGA22vwB7vWCqZ9SReKfRhwDFezIS65/6+1FFTGfEWqLxYBxBnqzvIzN55mpYqSonRys4w0Iey2bsB2Z7gqOiGOfDz95CSdnDpJpYqPqfxpPm3BykauwD9FulWpMSealQS+i3TwAlIH9TOYGSvjc6Bz1FWT5lmDc6x1sIMzF1KmdcBUJwqoZ6M1kYuAHE4r/Hf64J5C/7WCHvNpOt4sZH58jX3UNr92FWXQwS6+A2D+VL+ILLA08R3uacjeLlPdwdsHi1ADWp4+r2+9w2fsQ717JUcxMQxDNoBE/kctsjhY1EHcwvRrSp72v WrJhuZ6j DHTXJ9VssYcwP6r9N0YwAixXpPZcxuIIrI/gZ2OAn+8xcBYCpAtasAl+ylO52bjTv6rlOHHlJ95XWrOtnUhT/X7/LRv4hUuoBVyFpW7aGFjnlCb9f5fGjPtG39BviTPZwkXdVxrQieshBknQ0MRYCc61c+RNDihSWfzYnXM6e9mum4ptu9XFasavzIxGNaQ8bu9Ro 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: Enable MHP_MEMMAP_ON_MEMORY to support "memmap on memory". memory_hotplug.memmap_on_memory=true kernel parameter should be set in kernel boot option to enable the feature. Reviewed-by: Gerald Schaefer Signed-off-by: Sumanth Korikkar --- arch/s390/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 3bec98d20283..4b9b0f947ddb 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -113,6 +113,7 @@ config S390 select ARCH_INLINE_WRITE_UNLOCK_BH select ARCH_INLINE_WRITE_UNLOCK_IRQ select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE + select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE select ARCH_STACKWALK select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_DEBUG_PAGEALLOC