Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp236662lqs; Thu, 13 Jun 2024 08:43:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTW7lOZOivZBs84RIRUVwbpUvR6+vggH7N7ZgARhGCEv6gJKREoC65fc557b32JtuXq2HKEIua1PPssx0VHR302Oun/7qOmHyMKSpbsQ== X-Google-Smtp-Source: AGHT+IH5rDe1xCZg8YtrYcku6XSztrHPR2h9OUrYqTmZHYx7N1SdxfNIsD5KmaKjGlcm9NP9xYxb X-Received: by 2002:a05:6870:f10c:b0:254:e924:be62 with SMTP id 586e51a60fabf-25514bdc0ccmr6502667fac.13.1718293432396; Thu, 13 Jun 2024 08:43:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718293432; cv=pass; d=google.com; s=arc-20160816; b=ngc68X/8EkV4s/j+zpAoX3Nb/IkpU+Oour4vEeMy0D2KWoSVDm7ntb49HLAW2bt9s3 p8STyWrFnM8hzWYcyywzmqiOrbPt3t7Xx6VUcs3Br2t4zoBF/P5SA1KypESJJkJ2pATK 5aZEbnRg5ckMDkrLW5043UE9gj0Jqu9SbndxEc+bfe8Gpezw0ueZTMRFXaqQEjWL+kWo MZ5Z+/kayZP11nBiT1nTQ7GZnbFtmqLREMOPC7FQCClc/Z/amF22VA5Ft73ILcORZfLw owKT9V7SUzX6nOLdS+38laLNrY14DsQU8Fi6tubp2QXwifAw6tMH1K9S+8BxnSoNcZNS 1fFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tBymUKmYGVkfKp+NYWRuNAVgpQDLNZiEwntKKs+J4wk=; fh=TQATEbdDZNcnk8L2eDP6eFL9HlexFaHIexhR1TH2IlY=; b=jGWz6Swm5Ux8CVZBZaOy30Crg5xaJQSRs2yKih+Ackz4JSag8x9QAKas/eh4lhbLMJ jX10Ys6VRGqgk3zknBwDAbvVAmehjdARkQkaELb+TEAZ/QUH/snVUf5Dx84QWymU1OWj 2YyMgn6fyulSfTmU9HE6zNdDHupYROOacHTIDjVJSGWOfW9vLSpikgKnOZWu2KzdGkLW xmUZNd78Dehetki0kpb9tY7MULZ8XWwEqfU8hXlwrlBxaTGPF7216QSFOtofl5q+zlFk 5sQaEiN+XM5UlFC9l46CLKecEQtzoZ+vzvJ4rGnIoiHILs2rHTVEZCkLuCJf0dsFaWCL n1XQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=iLauG0BU; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-213565-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213565-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-700db17b0c1si509143a12.796.2024.06.13.08.43.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 08:43:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213565-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=iLauG0BU; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-213565-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213565-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BD8C3B222CF for ; Thu, 13 Jun 2024 15:41:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54EB914B08E; Thu, 13 Jun 2024 15:40:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="iLauG0BU" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DBD612FF9D; Thu, 13 Jun 2024 15:40:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718293212; cv=none; b=UulqIHPV+e04QcyjyITBUR3upLfAa8qvzYfmC4iU20ztL4+RagOMMpK2pu6joU59yfSu1GtVfd96veJVVWJR33l+bvji4OpwiqRwhcKuPrfOGogP0GhI4jy/Mu8VCkLEyAutjU92/EIflAMy1XYyZuIsBp0W9HZoYN8rG4V6Oek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718293212; c=relaxed/simple; bh=xLMPoAUWgd/tXMMq9vmeAvuElxC3HPpe2xuho7UTB3I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hLyoR4o2umI04/rtcVwuy8vth+2/iZ8/4eCvQi10Wc7b8mm4JtW3L6jf0z0blzXmF2FVaMEmx73uxJuViH437n2lwgNcGSuLUKnWgGWnHS4xV47uooBdeJGl/Fdcgji+EDylhnLfqKj2Yjr6e4xSNCt0qLQxxOsmv4HsfS3J5Sk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=iLauG0BU; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.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 45DEPwf0006202; Thu, 13 Jun 2024 15:39:48 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=tBymUKmYGVkfK p+NYWRuNAVgpQDLNZiEwntKKs+J4wk=; b=iLauG0BUiKWfEaqNwd59IcZBOfqbR EbGn1lchGFBbnfLGYAm9I6xAtCUE8UaD9DVkXwK575o/qnTW+FrKsdCp36VZNH32 QV9Qgzp1e8W9oJjMFKcge/uO59pO4syvsSvl3xxJiwLMTSU2xiUjPAFfgzh90L9h N+n82iKMgLwWS/z/oy6BwlfQTLuMSA/DpHvcvyjs6n1/1/8NQ1wAHRf9c0izBRWR DKsLh8KP2/sDXxfAxNDyl0H7jSaXhix74RcCPYTe5rRzz4h1QX/WT/StZ+PZaFoN 17EoOEm7gUAF6ETKp5CqYWaoONIZ26p6afBpVgAZ3T/47RQiyC41kbTzA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqr0vsy4r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:47 +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 45DFdlod023951; Thu, 13 Jun 2024 15:39:47 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqr0vsy4m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:47 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DE8bfb023566; Thu, 13 Jun 2024 15:39:46 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn3un0qgc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:46 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdeue17826126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:42 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 931992004D; Thu, 13 Jun 2024 15:39:40 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2097820043; Thu, 13 Jun 2024 15:39:40 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:40 +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 v4 14/35] kmsan: Do not round up pg_data_t size Date: Thu, 13 Jun 2024 17:34:16 +0200 Message-ID: <20240613153924.961511-15-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 07ZKKkdK6o7tKTl5G9IR_pDdctzTxY50 X-Proofpoint-ORIG-GUID: vPXYqilIID-TtrsSk_2C-JQrK4-P1oKn 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 clxscore=1015 malwarescore=0 mlxscore=0 bulkscore=0 impostorscore=0 mlxlogscore=951 priorityscore=1501 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 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. 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; -- 2.45.1