Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4434348pxu; Wed, 9 Dec 2020 17:43:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYw/F+dq6Kv3w6msWJV4FrPDN7N9v1myCQ6Y7WykXX68OyyqOo53pJRoCn5MLzTjDWqKU1 X-Received: by 2002:a17:906:1a01:: with SMTP id i1mr4431933ejf.315.1607564625215; Wed, 09 Dec 2020 17:43:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607564625; cv=none; d=google.com; s=arc-20160816; b=FrrACGxZsakAAbN7xEprv+9XJP1LdQmyMPIoEm5gi6Nqg2ok6Omsj9ciELjiiEpxLL pOwBfmHNu7JJuMCMG7ZD2fwHE0I+9JhlvX3+IjkRp8oPJUpXD1KyzASXJt9xtIds4riB qiV7On3qM9CknCmrstVXUstOuQX2BqttRD5loCmhUeyPzM8wLYKaE71+wWcwGR2/AG8o WZy9PUAKot2h4AGPrSlVbdnNq32jjQoqwLaWe7qUmBPeJDtWXUVCxAGmgBm13lSahEPh DA5V1BgNE/7u/cXW+lMJ21L1OaO22A13xdgk9vYeN4B2A0QLZtDGl5xHY9yQxPVxeVGc fBGA== 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=9rqM1yV5HCd1G1JHSlYx/u8/TFPCo5Lt6nrGr4WlAGg=; b=dUXnIgpuNaOuB98QS9WL7pYNUVm420i/DnwkYf6KYPTQEsw+aez/SWCZHNz3PCAGus 5XNznLJxdlgJfQFxEdHUxKyXgpEsTNI/6Qewj5gk8px5N+TV+pszXLHqpUW7a2LeWI5y Pq9O+cphi3AOpbHOzfY5LJ/p8kq4N5ihDRLUJGbtsSRqV3qEbSXY0NLM1GPg3R1L0WO8 e8fKkbI28dy0grPJYFm/+K4QWi9uDkRWBNYiDirm7zVsABucUxKwUk61w/dau78XRRKu Qagw3VBuce+FGj5JsMv0NnFBx599zv65p5TWN+ZLnFIuzTN0PZXSfSf9ZTH8cF3gMV/I oEzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="QHHx/e59"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s21si1807084edc.368.2020.12.09.17.43.22; Wed, 09 Dec 2020 17:43:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="QHHx/e59"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733233AbgLIO7i (ORCPT + 99 others); Wed, 9 Dec 2020 09:59:38 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54480 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727526AbgLIO7c (ORCPT ); Wed, 9 Dec 2020 09:59:32 -0500 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0B9EvbGE047445; Wed, 9 Dec 2020 09:58:40 -0500 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=9rqM1yV5HCd1G1JHSlYx/u8/TFPCo5Lt6nrGr4WlAGg=; b=QHHx/e59DWoxkKOIq6hy3MNMT/oToB8KN0lfZ+NrMdtbNNMVaiT/Yw1wOoNhExXb5Si+ fYbl/Zyx/pOSHOxnsLcZ+fuZQvRsu8OlpgRa5avVb8p1flKYBNE1uRRupc1DkxBk+ZWz xZSikdy/IqTmq8NNWEPDCpJgYm3hjEynDunbg+mq7J2Kk+BqrrU3po+VUPndwLhYgqjj qJUiXWaAeJeTj6BtQayrxLkEKdInE6DdL89kAf+wOd/aCEK5q9+dZhXHD5nG4jxu+bsL ImKlHV2TxqmeJTiMYo5jHOk+4l+9ULN7dfCjq0UXft1vJOvvqsp9mPYw0UzAwqhrphRb yw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 35afekmgkr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Dec 2020 09:58:39 -0500 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0B9EvpME049302; Wed, 9 Dec 2020 09:58:38 -0500 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 35afekmgk4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Dec 2020 09:58:38 -0500 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B9EqKQ6001485; Wed, 9 Dec 2020 14:58:36 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03fra.de.ibm.com with ESMTP id 3581u8pyy9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Dec 2020 14:58:35 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0B9EvJM811010532 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Dec 2020 14:57:19 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F0BF24C06A; Wed, 9 Dec 2020 14:57:18 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 814FC4C050; Wed, 9 Dec 2020 14:57:18 +0000 (GMT) Received: from osiris (unknown [9.171.90.105]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 9 Dec 2020 14:57:18 +0000 (GMT) Date: Wed, 9 Dec 2020 15:57:17 +0100 From: Heiko Carstens To: Anshuman Khandual Cc: linux-mm@kvack.org, akpm@linux-foundation.org, david@redhat.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Vasily Gorbik , Will Deacon , Ard Biesheuvel , Mark Rutland Subject: Re: [PATCH 3/3] s390/mm: Define arch_get_mappable_range() Message-ID: <20201209145717.GD7160@osiris> References: <1607400978-31595-1-git-send-email-anshuman.khandual@arm.com> <1607400978-31595-4-git-send-email-anshuman.khandual@arm.com> <20201208152709.GA26979@osiris> <7484e153-6c77-8325-6195-621fe144011e@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7484e153-6c77-8325-6195-621fe144011e@arm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2020-12-09_13:2020-12-09,2020-12-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 priorityscore=1501 adultscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 suspectscore=1 impostorscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012090100 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 09, 2020 at 08:07:04AM +0530, Anshuman Khandual wrote: > >> + if (seg->end + 1 > VMEM_MAX_PHYS || seg->end + 1 < seg->start_addr) { > >> + rc = -ERANGE; > >> + goto out_resource; > >> + } > >> + ... > >> +struct range arch_get_mappable_range(void) > >> +{ > >> + struct range memhp_range; > >> + > >> + memhp_range.start = 0; > >> + memhp_range.end = VMEM_MAX_PHYS; > >> + return memhp_range; > >> +} > >> + > >> int arch_add_memory(int nid, u64 start, u64 size, > >> struct mhp_params *params) > >> { > >> @@ -291,6 +300,7 @@ int arch_add_memory(int nid, u64 start, u64 size, > >> if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot)) > >> return -EINVAL; > >> > >> + VM_BUG_ON(!memhp_range_allowed(start, size, 1)); > >> rc = vmem_add_mapping(start, size); > >> if (rc) > > Is there a reason why you added the memhp_range_allowed() check call > > to arch_add_memory() instead of vmem_add_mapping()? If you would do > > As I had mentioned previously, memhp_range_allowed() is available with > CONFIG_MEMORY_HOTPLUG but vmem_add_mapping() is always available. Hence > there will be a build failure in vmem_add_mapping() for the range check > memhp_range_allowed() without memory hotplug enabled. > > > that, then the extra code in __segment_load() wouldn't be > > required. > > Even though the error message from memhp_range_allowed() might be > > highly confusing. > > Alternatively leaving __segment_load() and vmem_add_memory() unchanged > will create three range checks i.e two memhp_range_allowed() and the > existing VMEM_MAX_PHYS check in vmem_add_mapping() on all the hotplug > paths, which is not optimal. Ah, sorry. I didn't follow this discussion too closely. I just thought my point of view would be clear: let's not have two different ways to check for the same thing which must be kept in sync. Therefore I was wondering why this next version is still doing that. Please find a way to solve this.