Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7652135rdb; Thu, 4 Jan 2024 03:35:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCS0SeLSFVs0/0D4YLSR9eSdjgKoMCvz4gJcNwn4EBzMSCPYtiIsjtxJhD4tJGm0Ouiq2Z X-Received: by 2002:a05:6214:48d:b0:67f:43dd:4687 with SMTP id pt13-20020a056214048d00b0067f43dd4687mr486224qvb.1.1704368107326; Thu, 04 Jan 2024 03:35:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704368107; cv=none; d=google.com; s=arc-20160816; b=BXCvu1ul4R4nmYHfklL7kSJgAilXY3h9eHOsicLXFc45bTx8BtXVB/LzjELnbqpRzU iZHvG+bDdguyZ/kLsPXKQErpJL42mLzaBJaZmau+qO0bLbRJQZyHze35BE8j81zP6ATa X1k5irdH52vKZCkQM72yv5kOGkCOuBCfpqD+kLYjD5hdUQah5arAnVACaV8kG5Tj0ISW WBLbBI4zxTKys86CcCMmt1eWbjAKtzXWNnGkoQEl0FJVCbcwvaFsEnvDkp5QH9SSKaIC TO2P+76avA/v4xxipJpkOGhX6aK12Yo0rSKYYQUJpJxk+yONXg3WgNes08Ho9O7eh5Du esmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=DaA85JZ3rfzvuiZT2nU5IqFu1BqiLfSbMwxD/EB8i9Q=; fh=5zv/1k28Cz78IWthD5Q0549Jo3JHhYnPiCDnRz79T60=; b=yQCb2KrPKIjLHyY6yrm7E47k8/37mdazIcIyJDR7t5dZulEI1ULEMnnJ79G53kD+6E A43DsWsPzlY6ACqEnUyfBcIK6sfz7y9PSAx09K3U204uGvWzwYC1KKxgT8lSRhUukjQW 54u2zbp+wJwzNBvG618cnMn0PY3EahcrniD/8Twgb4/1WZ5AO3JKIBaPpu6WRFhvfZjE 7ZtG7gfALwT3Uqf2NYDb0b8JQ9GE7Ax9/sW4Hb797PxUzLl/AMln1ho6PSfSjw50X4ba nJkLkdodMkKW/EH9Gwv6kTCLIu9R4pWCuRXjg3Jo0Ecg5vv0fmTXM5ItqhK6rf9iTPuU kBWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QtvPnqN9; spf=pass (google.com: domain of linux-kernel+bounces-16593-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16593-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jm10-20020ad45eca000000b0067f6f705a9asi19982199qvb.101.2024.01.04.03.35.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 03:35:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16593-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QtvPnqN9; spf=pass (google.com: domain of linux-kernel+bounces-16593-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16593-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5F67C1C21217 for ; Thu, 4 Jan 2024 11:35:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88DFD21369; Thu, 4 Jan 2024 11:34:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="QtvPnqN9" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 349B621113; Thu, 4 Jan 2024 11:34:51 +0000 (UTC) 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 (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 404AHvBh020357; Thu, 4 Jan 2024 11:34:20 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=DaA85JZ3rfzvuiZT2nU5IqFu1BqiLfSbMwxD/EB8i9Q=; b=QtvPnqN97N2k9foVZDhNtmrMCiDh7vZfB6hiFUM5ej2zaAvoM+sROVyv5NyHqzzOg5n6 RgSHCzptstyh3CJ/WWyw6m7AYL/F82+Qtzmx0roLaWwQIfTcmIXw2wcsy5/BgJOKFnMs sPE3aaWlq0RTr7xFhuRQMnX5bih59Vg4qmM9NBcPjmnAcwDk283/BdX/HxPq3jL4Lp63 GFpvdj037rJweGJ0Wre17ufeeVGDwg9GHVqVIbVSPuKasR8zriF2S7rZz7Ad/dX2o8f6 u98Yv0CD/Lu7URpDfBB+Fvmn1aQTWWyDRcSQJjdHukhi1gacyi7PgDoI/kL1234Gao4v eg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vdm4p87u7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jan 2024 11:34:20 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 404BQTXx032285; Thu, 4 Jan 2024 11:34:19 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 3vdm4p87tp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jan 2024 11:34:19 +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 404AUHJA019397; Thu, 4 Jan 2024 11:34:18 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vc30sr1yw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jan 2024 11:34:18 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 404BYFI428508726 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Jan 2024 11:34:15 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1912520040; Thu, 4 Jan 2024 11:34:15 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 347CD20043; Thu, 4 Jan 2024 11:34:14 +0000 (GMT) Received: from osiris (unknown [9.171.1.64]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTPS; Thu, 4 Jan 2024 11:34:14 +0000 (GMT) Date: Thu, 4 Jan 2024 12:34:12 +0100 From: Heiko Carstens To: Alexander Gordeev Cc: Ilya Leoshkevich , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka , 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 Subject: Re: [PATCH v3 28/34] s390/mm: Define KMSAN metadata for vmalloc and modules Message-ID: <20240104113412.7040-A-hca@linux.ibm.com> References: <20231213233605.661251-1-iii@linux.ibm.com> <20231213233605.661251-29-iii@linux.ibm.com> <20240102150531.6306-F-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: A-r5ni_NxO1svHGVXf-nj62fil3Gwpze X-Proofpoint-ORIG-GUID: OVn0-Bn5itLqAoOpBhaSOLkGr5KeaBNy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-04_07,2024-01-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 impostorscore=0 bulkscore=0 mlxscore=0 mlxlogscore=678 malwarescore=0 spamscore=0 priorityscore=1501 adultscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040088 On Thu, Jan 04, 2024 at 11:03:42AM +0100, Alexander Gordeev wrote: > On Tue, Jan 02, 2024 at 04:05:31PM +0100, Heiko Carstens wrote: > Hi Heiko, > ... > > > @@ -253,9 +253,17 @@ static unsigned long setup_kernel_memory_layout(void) > > > MODULES_END = round_down(__abs_lowcore, _SEGMENT_SIZE); > > > MODULES_VADDR = MODULES_END - MODULES_LEN; > > > VMALLOC_END = MODULES_VADDR; > > > +#ifdef CONFIG_KMSAN > > > + VMALLOC_END -= MODULES_LEN * 2; > > > +#endif > > > > > > /* allow vmalloc area to occupy up to about 1/2 of the rest virtual space left */ > > > vmalloc_size = min(vmalloc_size, round_down(VMALLOC_END / 2, _REGION3_SIZE)); > > > +#ifdef CONFIG_KMSAN > > > + /* take 2/3 of vmalloc area for KMSAN shadow and origins */ > > > + vmalloc_size = round_down(vmalloc_size / 3, _REGION3_SIZE); > > > + VMALLOC_END -= vmalloc_size * 2; > > > +#endif > > > > Please use > > > > if (IS_ENABLED(CONFIG_KMSAN)) > > > > above, since this way we get more compile time checks. > > This way we will get a mixture of CONFIG_KASAN and CONFIG_KMSAN > #ifdef vs IS_ENABLED() checks within one function. I guess, we > would rather address it with a separate cleanup? I don't think so, since you can't convert the CONFIG_KASAN ifdef to IS_ENABLED() here: it won't compile. But IS_ENABLED(CONFIG_KMSAN) should work. I highly prefer IS_ENABLED() over ifdef since it allows for better compile time checks, and you won't be surprised by code that doesn't compile if you just change a config option. We've seen that way too often.