Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2120316rdb; Mon, 20 Nov 2023 02:31:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmH2UV95A9Bdk6Y2crQzATSYmM5yM5tjQ1rkK7SWcO/UqDYJDS608JgeMRHVNsNf2Tmytz X-Received: by 2002:a6b:5017:0:b0:78b:b892:e334 with SMTP id e23-20020a6b5017000000b0078bb892e334mr8533365iob.11.1700476283930; Mon, 20 Nov 2023 02:31:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700476283; cv=none; d=google.com; s=arc-20160816; b=QaWkT7F+mV8Fxu38i4nVYsbFB4WJXNs41o4s84A/cigEsZ/zYLWl/dtnX/YN07u2dI gImCW9fJvPR8+PvZI2LUFQ2m+DPUzQhy1M/F3oe5PFDl3MWNmyL1+E7iRwZ7B9zGRPrW 4LPlTTAa/OILOHY8rxKWaGau/3cKiQfDWdls1SYRFsu+E51zKIT8ao5Pq4+d2+4Ro7X+ g2Ql0YbNloUtezGw3FuepeO6utXWzVrggD1svMfEpPRrRvTV6IiLAci3/ReTTvXPH6Wq UNsfdONSCT0aJrC/ZbCWK8BA6LlLsrF2acJjurDsfAq0hgO38Gyu02ga0cffprtvZhZy Uh/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Uo1wtnwccDNWWlbVDxfBne1aY1UjuhZc/WQo8sZV3KY=; fh=cZYhCIXeFQihRJa58ZPqyZ6LPPRkNNP1A3GDumZ/1bQ=; b=yeSKk0EqQ+0SDI7Av71EwNEHtlt81bD818HsCtMgyjlm0OjAqzVq20mU60taWMNHit WVOomhpKQ0LfMTXWr0lpCfKRRPFssq8GQ4WJ9PSM4z17207blG2c2ZYk/0h88K2R4H3t YF+Hp/zs1wOq5Dw16FH06HTcz08UvxQbxV0esA7X+gOJxPnMHx4cC07YUmqG2mrXXYJL Bk+X5jNd8QXUWjU7xHzqv4kTehmOopI1LQ1deo16kWW0YqXWQj3zR95nEb4sUz5cXWKP g18zBXc50DnOK8dw+d9aO1GloN7JztG+8WW2lMx4k8YHjlfDm1Q2Iae4NiXbB7KBoS5a bliQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rQ0zh17j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id n186-20020a6327c3000000b005a0018ec785si7778706pgn.375.2023.11.20.02.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 02:31:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rQ0zh17j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0C1A2805B063; Mon, 20 Nov 2023 02:31:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233114AbjKTK2P (ORCPT + 99 others); Mon, 20 Nov 2023 05:28:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232565AbjKTK2H (ORCPT ); Mon, 20 Nov 2023 05:28:07 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82020BA; Mon, 20 Nov 2023 02:28:01 -0800 (PST) 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 3AKACF43009197; Mon, 20 Nov 2023 10:27:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=Uo1wtnwccDNWWlbVDxfBne1aY1UjuhZc/WQo8sZV3KY=; b=rQ0zh17jeREnaIa5XxqPASiFNVN0N1mCBPy4sgj5FegwQGwsGzvoOIGNtCQAcBjdUUgA LY5upxgEWc/kauyW2RYPDvo1jQO9OSERJnXvnGIr8WaPLtUzm9OXUY6AJ+MdUxYhZgVY VJuJcXQ7k5vAhCWohUTiLtH0pGUhFvCM/tzTPyWtd2KZNDyz8k40Il8jmkLJwd8zBgGn si9fCo/DsROCVpVxl4/VG7t6is/H+PLPb9WbJh0bg6ZTFVwNui21208NotOR/Q166BOu 5ZnZAp7JL8A3u6pvPRmifJ0fVydbEwXhM700MlhJjSa7pHoI035VKBCkr91X5LQAE/6G zA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ug5g98abn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 10:27:49 +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 3AKALb9T002614; Mon, 20 Nov 2023 10:27:49 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 3ug5g98ab6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 10:27:48 +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 3AKAJJtm008904; Mon, 20 Nov 2023 10:27:47 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uf7yy8nhq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 10:27:47 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AKARiRu46989688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Nov 2023 10:27:44 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73CF120043; Mon, 20 Nov 2023 10:27:44 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3947C2004B; Mon, 20 Nov 2023 10:27:44 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 20 Nov 2023 10:27:44 +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 , Alexander Gordeev , Heiko Carstens , Vasily Gorbik , linux-s390 , LKML , Subject: [PATCH v2 0/3] mm/memory_hotplug: fixes for memory hotplug altmap support Date: Mon, 20 Nov 2023 11:27:31 +0100 Message-Id: <20231120102734.2001576-1-sumanthk@linux.ibm.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: JsnuuIsft4kusm8B_UhVLlI3082NoJ1X X-Proofpoint-GUID: KaDoiLzFpFH_N9VrVmPT-0BP05SnvgC7 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-20_08,2023-11-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 mlxlogscore=594 bulkscore=0 clxscore=1015 phishscore=0 priorityscore=1501 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311200070 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 20 Nov 2023 02:31:15 -0800 (PST) Patch 1 adds the missing lock in memory hotplug operations, ensuring that the mem_hotplug_lock is held during critical operations like mhp_init_memmap_on_memory() and mhp_deinit_memmap_on_memory() Patch 2 deals with error handling in add_memory_resource() and considers the possibility of altmap support. This ensures proper deallocation of struct pages, aligning with the allocation strategy. Patch 3 relocates the vmem_altmap code to sparse-vmemmap.c, enabling the utilization of vmem_altmap_free() and vmem_altmap_offset() without the dependency on CONFIG_ZONE_DEVICE. v2: * cc: stable@vger.kernel.org * made vmem_altmap_offset()/vmem_altmap_free() inline. * added Acked-by for patch 1 and patch 2. v1: Changes since patch series "implement "memmap on memory" feature on s390: Patch 1 (Feedback from David): * Fixed subject for memory hotplug lock. * Added locking comments before memory_block_online()/memory_block_offline(). Patch 2 (Feedback from David): * Fixed Fixes-by commit. Patch 3 (lkp report): * when CONFIG_SPARSEMEM_VMEMMAP is disabled, resolve undefined reference to `vmem_altmap_offset' error. * Request for Reviewed-by once again due to the change in patch3. Thank you Sumanth Korikkar (3): mm/memory_hotplug: add missing mem_hotplug_lock mm/memory_hotplug: fix error handling in add_memory_resource() mm: use vmem_altmap code without CONFIG_ZONE_DEVICE drivers/base/memory.c | 18 +++++++++++++++--- include/linux/memremap.h | 12 ------------ include/linux/mm.h | 26 ++++++++++++++++++++++++++ mm/memory_hotplug.c | 15 +++++++-------- mm/memremap.c | 14 +------------- 5 files changed, 49 insertions(+), 36 deletions(-) -- 2.41.0