Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3188459rdh; Mon, 27 Nov 2023 08:12:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeChnspeFs8nHq8k4zkCTBrU2X2Eq7ang7Dk6sC8AgV+E87ciroawow5Z+IFJQb7IrK5t1 X-Received: by 2002:a05:6a20:7f86:b0:187:f2f7:2383 with SMTP id d6-20020a056a207f8600b00187f2f72383mr12998799pzj.45.1701101577544; Mon, 27 Nov 2023 08:12:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701101577; cv=none; d=google.com; s=arc-20160816; b=ymltVgDRQrb6wbN57YTIa1fYyTR4rgjJa+Hstp+rmzBcbztAYj1Jiq4es2s3+DT7U+ z8YaRqiRbhI0u6Z2sJ6++wgmofIOBBYXLvVRE9hv6Ep5kRctVQ8D5EkHkcm8802JLI2o hVD1NkLrorR/OTXfRoMIAadRgAYATTvqv6uWhC7cqc7jfqCnlswCCzEOqkegMvbFwTFy la0uFNpxQaZFlhwNX7p5qjm5UGAD6os109HE6SmPNoiLgkxh9Vo/n2LKnaaMX5F91x5I 1/Om01NHQ3qdIoxu7AEkdiPMPRk79kybRH/M9Kgl+cE9Ya8IMRrShYglUygZCDmP1GHv 1s9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NgfyGpTOtdTXmgIR1rMBGdvKmiMRXmvY4dwrfxHclcc=; fh=zSdfwdfY54C9/udZTRlhmjTBbI0CKWDSGiWvzuMGAEs=; b=z6dfY4c5rrtIboJu1RX9h1MJlV8LCA9xh+enDem+i+vpWQSzaUudW0k4m2KZRXZzyH lMUqQvnr3C3bRl6txMoISOcSq64eO46SWBwDB52b5cX7byoOcxOnrJKysOf4rCbdTD0V Cy2A2YF0w0MteNOZYb9ej/FJ+V0OV5ReigLnmkYD6DNcxSNS6dJznZIWS3lmNghd8+nz Eg27WwY1qFKjwXRtBlCSKgcQCd7hA6KPdjFdU7uB1w9v6oI1e+nu7pnJPYEW30w/3rBA epacUth4Q3qXMfttiCzmY8qE8GLYj8jinRGZ5aIEb6tCD7otC5iJn3RkNlgLKKXIv93X v6nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="AJOOxDQ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 29-20020a630c5d000000b005bdbd1fe067si10294238pgm.141.2023.11.27.08.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 08:12:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="AJOOxDQ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 198F58057E78; Mon, 27 Nov 2023 08:12:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234348AbjK0QMq (ORCPT + 99 others); Mon, 27 Nov 2023 11:12:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233906AbjK0QMo (ORCPT ); Mon, 27 Nov 2023 11:12:44 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FD20CE; Mon, 27 Nov 2023 08:12:51 -0800 (PST) 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 3ARGAsdj022874; Mon, 27 Nov 2023 16:12:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=NgfyGpTOtdTXmgIR1rMBGdvKmiMRXmvY4dwrfxHclcc=; b=AJOOxDQ/nRk1hfmtJ5zt5aNpSOODAahLCP9p5CKCzXfhqVNUa22qolMyDiObDTiMK+vG rtztcKamG43wbzerM5eBYccm2y06BEu6Hnnv1N1gS+ngqGXlw0IrqrxesZwHjpBRXNm9 RUxoK45Pqkx2rmUiQdfJnOLDtO8amVRfOMM0lZzFXob+2+rlBpdj6WaJm8V5B0zkwff+ oCtQehGzHFFT+Wk7JU+4h9fIDAcr972X8AcYYlg/Lh6yruMJurAOha7AFu3qTpuVzjyh SP0NHKBX167tmu8pbSLEAhI4jZtYRHpLbD10R7jomLG1b5yHPwQ+Pt4c+sAIOWPCD7Bd 0Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3umxd782fj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 16:12:36 +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 3ARGAliM022636; Mon, 27 Nov 2023 16:12:36 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 3umxd7827t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 16:12:36 +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 3AREJqhY025568; Mon, 27 Nov 2023 16:12:27 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ukvrk9m32-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 16:12:27 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3ARGCOMj22217220 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Nov 2023 16:12:24 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 073C220043; Mon, 27 Nov 2023 16:12:24 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41B6320040; Mon, 27 Nov 2023 16:12:23 +0000 (GMT) Received: from li-2b55cdcc-350b-11b2-a85c-a78bff51fc11.ibm.com (unknown [9.179.15.167]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTPS; Mon, 27 Nov 2023 16:12:23 +0000 (GMT) Date: Mon, 27 Nov 2023 17:12:21 +0100 From: Sumanth Korikkar To: David Hildenbrand Cc: linux-mm , Andrew Morton , Oscar Salvador , Michal Hocko , "Aneesh Kumar K.V" , Anshuman Khandual , Gerald Schaefer , Alexander Gordeev , Heiko Carstens , Vasily Gorbik , linux-s390 , LKML Subject: Re: [PATCH v3 4/5] s390/mm: implement MEM_PREPARE_ONLINE/MEM_FINISH_OFFLINE notifiers Message-ID: References: <20231127082023.2079810-1-sumanthk@linux.ibm.com> <20231127082023.2079810-5-sumanthk@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: PN3NCHQsMzDUckP9r7W1BHaI7o_e-YHN X-Proofpoint-ORIG-GUID: zOq4w70tYDpTEwcLVE4xumYiWm_-H8vH 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-27_14,2023-11-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxlogscore=385 suspectscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311270111 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 27 Nov 2023 08:12:56 -0800 (PST) On Mon, Nov 27, 2023 at 04:11:05PM +0100, David Hildenbrand wrote: > > diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c > > index 355e63e44e95..30b829e4c052 100644 > > --- a/drivers/s390/char/sclp_cmd.c > > +++ b/drivers/s390/char/sclp_cmd.c > > @@ -18,6 +18,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -26,6 +27,7 @@ > > #include > > #include > > #include > > +#include > > #include "sclp.h" > > @@ -319,6 +321,7 @@ static bool contains_standby_increment(unsigned long start, unsigned long end) > > static int sclp_mem_notifier(struct notifier_block *nb, > > unsigned long action, void *data) > > { > > + struct memory_block *memory_block; > > unsigned long start, size; > > struct memory_notify *arg; > > unsigned char id; > > @@ -340,18 +343,29 @@ static int sclp_mem_notifier(struct notifier_block *nb, > > if (contains_standby_increment(start, start + size)) > > rc = -EPERM; > > break; > > - case MEM_GOING_ONLINE: > > + case MEM_PREPARE_ONLINE: > > + memory_block = find_memory_block(pfn_to_section_nr(arg->start_pfn)); > > + if (!memory_block) { > > + rc = -EINVAL; > > + goto out; > > + } > > rc = sclp_mem_change_state(start, size, 1); > > + if (rc || !memory_block->altmap) > > + goto out; > > + /* > > + * Set CMMA state to nodat here, since the struct page memory > > + * at the beginning of the memory block will not go through the > > + * buddy allocator later. > > + */ > > + __arch_set_page_nodat((void *)__va(start), memory_block->altmap->free); > > Looking up the memory block and grabbing the altmap from there is a bit > unfortunate. > > Why can't we do that when adding the altmap? Will the hypervisor scream at > us? > calling __arch_set_page_nodat() before making memory block accessible will lead to crash. Hence, we think this is the only safe location to place it. > ... would we want to communicate any altmap start+size via the memory > notifier instead? Passing start, size of memory range via memory notifier looks correct approach to me, as we try to make the specified range accessible. If we want to pass altmap size (nr_vmemmap_pages), then we might need a new field in struct memory_notify, which would prevent access of memory_block->altmap->free in the notifier. Do you want to take this approach instead? If yes, Then I could add a new field nr_vmemmap_pages in struct memory_notify and place it in PATCH : introduce MEM_PREPARE_ONLINE/MEM_FINISH_OFFLINE notifiers. Thanks