From patchwork Fri Jun 21 00:24:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706572 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 BC640C2BA18 for ; Fri, 21 Jun 2024 00:27:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 242436B0162; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CB646B0163; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE6EB6B0166; Thu, 20 Jun 2024 20:26:56 -0400 (EDT) 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 CBE216B0162 for ; Thu, 20 Jun 2024 20:26:56 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 82D9EC06DB for ; Fri, 21 Jun 2024 00:26:56 +0000 (UTC) X-FDA: 82253005632.20.F375D56 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf28.hostedemail.com (Postfix) with ESMTP id 39C36C0005 for ; Fri, 21 Jun 2024 00:26:54 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=s7jYJbCG; spf=pass (imf28.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718929604; 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=OuTJsGR9CKQp5KU/moT9q7/MyfMfBzEfOFMR8s/AFMc=; b=Ng4z+mMLfW1zzfzPbXUOKsfkxsKF6MQTl4TcoGe7S1hes/hLg3jJKMeJJlcpmFDQR6FxaM u/jYkKhADFIxVgCJtmzgQbZo6SZOp4bUfr7YaHj3RZLNxJzLX3oABW8p4+yikl8xO/BSXn O5Abcb4jHHBI4Y3MOI5bjRWzStdHztY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929604; a=rsa-sha256; cv=none; b=CG5SQuevk9j5ozSSXcbhTmXPvEWvuGxM3/r+Epluhk+jty7fwBxgPjJihXAulk6wC8ICIB 0pYIrg+IYGJHSjoBcg7u4gGjXmikd04O9tGY1r5E8iYRobkPUgTlpln9od6EIwIikOZjcn HX8CghoVRdkdURZG8R8TySMlTvN4K+I= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=s7jYJbCG; spf=pass (imf28.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L0QQ9Y007784; Fri, 21 Jun 2024 00:26:47 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=OuTJsGR9CKQp5 KU/moT9q7/MyfMfBzEfOFMR8s/AFMc=; b=s7jYJbCG6yxpR8mK4DsWbU1FeA0XH 4dM0Zg1AMMQg6R18G9yk8We2bf0nMJUIRUB9MCgEZO56akknYth0HO5iohGDPw0e 7+B6FuunWI0tzMevqV8Huu5/ZzNRdnifY8uhQbZ6TdkhGf6V0YyrY3hv8jBJpJH0 WiRjnIMd1TWjKBYepE/Ypiwt7vmr5CbU1yEx5vWp/INBXEBYwQfhes43wf7NAsRf SISs2ALtSnLB6MuQ3Pp9xhTpXHG+wrCKkzeZxp9TdnBA2Jc/NcO8e0nK+40+g3ob pugGCRJ2zzVjzdZt7tmnHnotqDS1qbBj5bdIVO6IRE8SNv/YRdqoonoTw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c875n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:46 +0000 (GMT) Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45L0Qkd4007867; Fri, 21 Jun 2024 00:26:46 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 3yvw8c875f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:45 +0000 (GMT) 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 45L0IDHa030896; Fri, 21 Jun 2024 00:26:44 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrsstn22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:44 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QcWh49676562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:40 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56BB92004E; Fri, 21 Jun 2024 00:26:38 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 332632004B; Fri, 21 Jun 2024 00:26:37 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:37 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 15/39] kmsan: Do not round up pg_data_t size Date: Fri, 21 Jun 2024 02:24:49 +0200 Message-ID: <20240621002616.40684-16-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: l6sxtiSRHhh5e4E51hgME4dLqY6SYYPN X-Proofpoint-ORIG-GUID: Syt3v-DmTGAUXBEEF_AcFeIe-H4mnIzm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=982 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Stat-Signature: tcd7fg66y8937hbwqk8zq93u9661eq5e X-Rspamd-Queue-Id: 39C36C0005 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718929614-833147 X-HE-Meta: U2FsdGVkX19dsd7F6ylnQertRhzO3w42FI/44A4AcYi6NV6L+mvijHw6sKss/z6Wz9da2XAwnAV89V8z8qEmBeELT/9DOy1w06ImWAhGjX96HBkCzqJ2SP2jEX/j9RD4FSQuiYtX4Yv14gbT5nhxkoCrWDxytMt0qUm4vQS/0xf6YEwGnvKtew8ztm0SQ9IhNzbONYg8OhIdSsY7MCHEKzGHbEruylRsbJL5dHK4y+A14U0VD+Zvo30lcBmYVW2QifV4l+Me7jWT/ZFyIYER+P+EWLg/3WpEEjKAOBpYLUYThmBQB6D43gFllItZ93XtwuejS8fkPBFBRBBxE+oYIUUKIxolemXaTZ/wrjUnKRjBWJk8JCTbYteUTFPENylbjM5F/llCN4t1iLOo0UmLHSD/6fxCGlDdzqRu3Wl5fz8ZggaJzVMT3U8srsTz1ivL5Xth1OGAvdBSY+kiZHpBLPNGpz0gfPDtow5ALryfe6rcR3EHMzkmJ3sr7Frtj2H/bYYqC1/UItKfNM4TKEFYcy74EmLS4XlfmoFwxSS5tybeQGdfGZeFtyeTyjwyNbbmAoDWtgIFpJ6rZKagqdgNNHI23ojtzeeRb5fqIF3TjSTMsdq1m+zt+fuXm2b/l5H6nRlzwFKnx5XITq6L7kFjgY5F7Z9E/VXT6m47PaJWGplWbxMoaLQJE9fIn6Slz/8pOTa/IZhLTNrsBK/B1v3MDh41e/FJNeIcBAHMClLrf4bFSVof6oHTlNxZQcrvXq2smHu2puJo3HBcGuyzUDg0yQ3E2r8u9UeYrilUpxS5fbdaiR/eDPScSJCZmBIdyCVm7hhjzfNmMpBWvfydZGN05xQ7UoPubqdmXQk3de1tu3RhzMN9f7liMX42IDySAkx/pn5hSUi7XZYBqo/kbXWe7crGZBvbV67WiVXnS+vVnjOh+3b4wRgbX/tiXkmrWm/8L4F7UXYw2Yfgfpedo1o ++bhppI2 udYRq0Nf+QgS7HPAD/+FYeF0AfPjzznCy0FuIJb7sYWW0OlYAht9ChDLNi1GXqF9CCUejTkMU9HSh2ikboak0pFq/95aoHqkwolKXsWYAWl0XYru2w19oMvGZAq9ektdc3Xy4DACGmd01E0Z/hFyNZ0aiDxalBao62fnNlXWZLtTEFDXek5FMJtwviJ1/qNeXO5+HNcdIfnw6vKSctINGIrYp3L7P64f5ZyMxwd1Zx53GVUNqDDNGjqkIdkXjqxf1astz5aZQEuSO8TZkK4Yf4GGO0JsDM6Hg4mcee2YTm8VSIiilgkTL2+q6DvxNdDeIawtX X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: x86's alloc_node_data() rounds up node data size to PAGE_SIZE. It's not explained why it's needed, but it's most likely for performance reasons, since the padding bytes are not used anywhere. Some other architectures do it as well, e.g., mips rounds it up to the cache line size. kmsan_init_shadow() initializes metadata for each node data and assumes the x86 rounding, which does not match other architectures. This may cause the range end to overshoot the end of available memory, in turn causing virt_to_page_or_null() in kmsan_init_alloc_meta_for_range() to return NULL, which leads to kernel panic shortly after. Since the padding bytes are not used, drop the rounding. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kmsan/init.c b/mm/kmsan/init.c index 3ac3b8921d36..9de76ac7062c 100644 --- a/mm/kmsan/init.c +++ b/mm/kmsan/init.c @@ -72,7 +72,7 @@ static void __init kmsan_record_future_shadow_range(void *start, void *end) */ void __init kmsan_init_shadow(void) { - const size_t nd_size = roundup(sizeof(pg_data_t), PAGE_SIZE); + const size_t nd_size = sizeof(pg_data_t); phys_addr_t p_start, p_end; u64 loop; int nid;