From patchwork Fri Jun 16 11:08:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 13282626 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 860B5EB64D8 for ; Fri, 16 Jun 2023 11:09:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 20B096B0080; Fri, 16 Jun 2023 07:09:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1BC656B0081; Fri, 16 Jun 2023 07:09:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 05CB46B0082; Fri, 16 Jun 2023 07:09:33 -0400 (EDT) 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 E8CBC6B0080 for ; Fri, 16 Jun 2023 07:09:32 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A186A1A0C7D for ; Fri, 16 Jun 2023 11:09:32 +0000 (UTC) X-FDA: 80908340184.13.C136D23 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf01.hostedemail.com (Postfix) with ESMTP id 4C13340022 for ; Fri, 16 Jun 2023 11:09:30 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=ZfeIyk5y; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf01.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686913770; 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=H+uaA5+1mvtJFerKJUXsEuKB7to6xvSS0R1azlcL2R8=; b=BAi1NXZ9PhdthpMAVMRCSs8BAzShlyysiOg+mt0hyPqFaGBU5Llm23JiLuYAx6ykMyJIVd phumGTvuZVsB4RwodvAVUsGOmaVhQqbW06YLs90rdHe5D3+d5KLXoAiZM1S5I75Ggk0GHW smTWHI3gNzuGIr+Xj2BKTtCR3sfgWc0= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=ZfeIyk5y; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf01.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686913770; a=rsa-sha256; cv=none; b=uYTKA5ca93+4a2abPiJSwTg9A/r5btFCU2JLYzJ8mriIYfCHOO0IfoHlpGu9QJKlEthqbY KyAh97WogCUMpPgY6e78tTBGUuDeECeTFZ3fMtlk2b+cs22Eayfg4MCdETWk4bud8KJzCG IhV0fcV509tnQolpFkR6gEmr27awqH0= 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 35GB8VJh016651; Fri, 16 Jun 2023 11:09:20 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=H+uaA5+1mvtJFerKJUXsEuKB7to6xvSS0R1azlcL2R8=; b=ZfeIyk5y5gGXBF6IU6e3xWxUf7yrgbw5MKBu3IPu++VbAu1R9X6Erdwq8MU/GpZb+TnT TwleDZHF+u6Otu5p1y+LXrZsDn9Jta5AKsmK+7SX+azQskf3R/aVO6Fs2Rg968Fnxq9g oVBO++wBI8rUvWcaFB1Wv0vtxaYN6H+SGvfoKF3EAtQ3sq3LRqBSxS4uhnq6loZyvmB3 hmZppvSO8QTvwTP5vmMJfNmUHa06yLLk+kz12ANTOrcajkfmrMjmC47E0JzI7v1/oA6/ +cc2NjH/KkZJaKzhEIrjNb14S8b5Tzg7zIhoM4mGSBJP358MnII3DHKoFLGsIk24UpOG Dg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r8p9m8a8e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 11:09:20 +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 35GB987a018597; Fri, 16 Jun 2023 11:09:19 GMT Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r8p9m8a80-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 11:09:19 +0000 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35GADBcH002749; Fri, 16 Jun 2023 11:09:18 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([9.208.130.100]) by ppma01wdc.us.ibm.com (PPS) with ESMTPS id 3r4gt5qhru-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 11:09:18 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35GB9HjK50463216 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Jun 2023 11:09:17 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DC48B5805D; Fri, 16 Jun 2023 11:09:16 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0588458059; Fri, 16 Jun 2023 11:09:11 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.52.24]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 16 Jun 2023 11:09:10 +0000 (GMT) From: "Aneesh Kumar K.V" To: linux-mm@kvack.org, akpm@linux-foundation.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: Oscar Salvador , Mike Kravetz , Dan Williams , Joao Martins , Catalin Marinas , Muchun Song , Will Deacon , "Aneesh Kumar K.V" Subject: [PATCH v2 05/16] powerpc/mm/dax: Fix the condition when checking if altmap vmemap can cross-boundary Date: Fri, 16 Jun 2023 16:38:15 +0530 Message-Id: <20230616110826.344417-6-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230616110826.344417-1-aneesh.kumar@linux.ibm.com> References: <20230616110826.344417-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: hrPuD47xEHbXC1tgOQ9G6Kcrw85WGkYC X-Proofpoint-ORIG-GUID: IioFF6ydZQZZJRliOezZINBo_cugxYIx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-16_07,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306160099 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4C13340022 X-Stat-Signature: 63k4dpfyo7drxesxyq4ph3opna1cgqi3 X-Rspam-User: X-HE-Tag: 1686913770-935124 X-HE-Meta: U2FsdGVkX1/lO7QU7Ikinoi1okTSzXy4pWb3+os7MUdm8sXzuF879KHlM+6KTjNoEK+ofNWDB0ajIKAjI77oKBjmVkbC8x0gtB4RLVBRP6y/g9/M02urSm9t9t0+7Oqve1zcdDhUDBF/iUgFG+W/wXud7rGfRB6I4cv97LHvRRpcJoKN0vTijfPEN9FjXbxlhMmduxbFSw2GEPpYEbFKK6fV/PfAJ105gVn/c9oN4xPlEijkdLpI7RqGTXsB2O7y/tWRJ3nLpCiiojRtbRQSIgij5hXKRwXRchEocpmS17j3xg9wqtVLD7EqxVbRtqxoFdt2NCfkeuY1WlHuZeXPyWyqckRSLdd+00YXYbhSOCagvyZ5RXsZ/eeZ7CCzaCCzTGGjFct9Ysae1pAdsYpw/AofNy+SqevL/QIR+TWmk0e3R0lIlhw4UqvqlIS/hbvsDzOL/ch73RLkjdT0hr8nftf1eNgFL55iZc5dgkWRnRb+8LGsp7yGh43icsKpHRA15o6t2fVEY10mRfr8DvlIXvEq+R0APhpHsXprPr4ipUoEaEWJsehBNchc/jsz2jUsECPQONqYFhJdnYmm2VhpZN3CSLi12GtXISVz8JcNW1uGAUmlt0FggDoeu1G/racHYiy29VYDzWEfNQHRLFA9G27cIASFpGrz9Iou3r0EmFeqY5EluhW7zMuZpntJroocyuUa2Zf57MR0orgidd7cIetUs0xTvtGqblqcxv3bYUdloWh0TuX74XHNH0lbeY76W2IRqc2gA3+F01A7GZL4CShyMJqlDOgrzb/4P91PnSIem6rzZopNmgOFQAsKmjWqrJ/XC0ZT3nZxsxaCeJCbwgyxMJZywvWMycq9nxXo2b9xZEFLsMVwj3iGCTUXOxbOXDl1LrCq2MbUvbgOjE2RQw/TmDGoh0N+W7uXRKMFcId89f4c9BRETkpyS4QVelNaxQzVg+7ZfoPj+cSo+5c iM4/4hTn K/XZJE0/CDZ2bQ7qN5QjUgplYxQZvt+j98coix/oycpY9v2YXj7qmAnb6BgMY9ovZZYBwzE0FKr6oDpukJdmCYX9tHkXQOmRef1w8m0o17Rj29YkLh2cncho7GTz2fotuoJigFeqdNFpfz2g= 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: Without this fix, the last subsection vmemmap can end up in memory even if the namespace is created with -M mem and has sufficient space in the altmap area. Fixes: cf387d9644d8 ("libnvdimm/altmap: Track namespace boundaries in altmap") Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/init_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index 05b0d584e50b..fe1b83020e0d 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c @@ -189,7 +189,7 @@ static bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long star unsigned long nr_pfn = page_size / sizeof(struct page); unsigned long start_pfn = page_to_pfn((struct page *)start); - if ((start_pfn + nr_pfn) > altmap->end_pfn) + if ((start_pfn + nr_pfn - 1) > altmap->end_pfn) return true; if (start_pfn < altmap->base_pfn)