From mboxrd@z Thu Jan 1 00:00:00 1970 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 3C5C6C28B20 for ; Wed, 2 Apr 2025 19:12:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C749280004; Wed, 2 Apr 2025 15:12:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54EAD280001; Wed, 2 Apr 2025 15:12:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F08F280004; Wed, 2 Apr 2025 15:12:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 22A1E280001 for ; Wed, 2 Apr 2025 15:12:47 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DE62B160230 for ; Wed, 2 Apr 2025 19:12:46 +0000 (UTC) X-FDA: 83290050732.21.11B32CE Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) by imf25.hostedemail.com (Postfix) with ESMTP id DE53BA001C for ; Wed, 2 Apr 2025 19:12:44 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b="hLc/Vw3U"; spf=pass (imf25.hostedemail.com: domain of naresh.kamboju@linaro.org designates 209.85.221.175 as permitted sender) smtp.mailfrom=naresh.kamboju@linaro.org; dmarc=pass (policy=none) header.from=linaro.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743621165; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ufQZbME7cCWTlfUFUJg7J87wZvmjwZWF7BNQvB4L4UM=; b=ZW47bobZa7u9nMx2O2PY/M0tGGI6maDc4ais5dKwTQhfRmEhbjhTTGVYwMwqgWLpru+ZMH b3s8VhxvOrP2hZ5yvlG9dq3uhdQ80eMmIbhusO395Bhkhp6iF1v+IxfcE+mo1y8Y0ZKDCJ T4SFWbwG2mC9knuFV7m9AioAwFDGSmg= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b="hLc/Vw3U"; spf=pass (imf25.hostedemail.com: domain of naresh.kamboju@linaro.org designates 209.85.221.175 as permitted sender) smtp.mailfrom=naresh.kamboju@linaro.org; dmarc=pass (policy=none) header.from=linaro.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743621165; a=rsa-sha256; cv=none; b=6fJ78d+umJplIsv4bmS1frqy/VMcanLMNfSQ7AMQx5RS15+nSh9UwVWgkkmwcaCpVRvkIn pvLEH3R5FrZBjhIPFAOOOuOeowJn3g9qgep7oeBdbtN7vzuygCNJlCwUfv9nYdPKTWkijO YqbOiaLCTtvLyzZKpMDnbUeFlDLApFU= Received: by mail-vk1-f175.google.com with SMTP id 71dfb90a1353d-5241abb9761so75630e0c.1 for ; Wed, 02 Apr 2025 12:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1743621164; x=1744225964; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ufQZbME7cCWTlfUFUJg7J87wZvmjwZWF7BNQvB4L4UM=; b=hLc/Vw3UaMHeSIeaFsjJsqR3CzBKtwHQdJBDUF2bnSscNwzkGnU0m22FOJLReL5CyI vTMp7UjGkFpQaM8H0O5wqKRy1otJARsRgcH5b2ypkXcw6QM5CrAfDXlDvbwi+LH3I9dB RBHoGci7AKHEkE0AVwimGXgNBtc3ukMKPXfFVOCdYce8oFoBULc33sX4Fj6ijHF4Wvzf yFyApQuN8bd7HvQR+5rMdGs3pgluA4G3OpKEVnoRo6+3WtDxeBFJMQWLAw3JRg5Vom94 p80T6zCClkIVxfBKArXmhtFKxrZUnoWX/L1iSWEo+L60GiFR4RDylynILJSfTdM62vjJ FymA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743621164; x=1744225964; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ufQZbME7cCWTlfUFUJg7J87wZvmjwZWF7BNQvB4L4UM=; b=uLCEOP1cQoBvMghgpUpBY+EI4Jeuo+0nZipJhOhQnY8tO5mwPpigrF6za20st0MD/m yJELklZlJRLSgU+ttuRcr5jg56b5l1lF240lO/oaWRbs36+nmo2cbl0r+n12rhh0ZHn4 yhBFwk+VFdMFV5xQ5CCj35xFBUfwuPEgHpBW6wnZyIQ0T8gMs+0Ci9PNJtlmrSU4Jsf5 AB8rEb91NQtn8FWOYp/qtnnDb8FPouD9g2wDBQ9RdXa5b8N7SxJLDm2csDZ//zBjcCiW iaJgOuW/BBSwuu0sCIFZ+SU8xOb7bRFOYnzVAMUeo2KXPc9t7w6Z1rT+moZHEtFFkDRK 21cQ== X-Forwarded-Encrypted: i=1; AJvYcCWL5vrCEwBJkfGYWJsIOQ0BtQ98HCwcJ029xLLLM5zVZ7d1nv+2owKLm/JG8/MWB4Qjt5jPl43Htw==@kvack.org X-Gm-Message-State: AOJu0YwWpO/rRmRmJ/OHPbPHZyonvzmwwcRZUqmvEEAEIgZaAi7kHKQx cYPOx5dYzORtUQHHDAruD0kFufvnNuIPClhYwkgPGepGJZERt9WTKgf8Prh4mRHyMFa0AC7FX0n od6Uromf0lPLfeFK+/shkKNyGVscxX5nmC/A7cw== X-Gm-Gg: ASbGncuudFhTFLVhc6moGjWteuWyDHW7kX610eZxSY2UOWboOmyzfNbKFE9awRjcWrr PDQtFOwc50niqeUn8fx1eYAj5y0ZRx9JuYryR2Ob83VcdtHuW3dERKfebDZWhlR3DzYDjee0J5r ix96Yu1qQLkm6D7xw2Hq0MrSiZcM3u0h3GRjcNlH5WnrO8icTbs5ZKJ54+UqM= X-Google-Smtp-Source: AGHT+IHwLcsi3BX8Jz57ZZBx4yNh0gsPGUL4LlIBXdD4VmESoE42IUlvk+9eP+LcFYoQddReWmd77wMhRr7Yoibb+IA= X-Received: by 2002:a05:6122:a07:b0:518:a261:adca with SMTP id 71dfb90a1353d-5261d4759bcmr11728250e0c.8.1743621163716; Wed, 02 Apr 2025 12:12:43 -0700 (PDT) MIME-Version: 1.0 References: <20250313135003.836600-1-rppt@kernel.org> <20250313135003.836600-11-rppt@kernel.org> <20250402140521-bf9b3743-094e-4097-a189-10cdf1db9255@linutronix.de> <20250402145330-3ff21a6b-fb03-4bc8-8178-51a535582c6f@linutronix.de> <20250402181842-f25872a1-00f7-4a8f-ae6d-3927899ee3a6@linutronix.de> In-Reply-To: <20250402181842-f25872a1-00f7-4a8f-ae6d-3927899ee3a6@linutronix.de> From: Naresh Kamboju Date: Thu, 3 Apr 2025 00:42:32 +0530 X-Gm-Features: ATxdqUEPLfNJB2FSv1nTGKqf_ZE3BXsv2R3C6KxSgMELRNHzW7jhhAvjwROmbyc Message-ID: Subject: Re: [PATCH v2 10/13] arch, mm: set high_memory in free_area_init() To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= Cc: Mike Rapoport , Andrew Morton , Dave Hansen , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , "David S. Miller" , Geert Uytterhoeven , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, lkft-triage@lists.linaro.org, Linux Regressions Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: DE53BA001C X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 7ea5sfkceipm3p5o3uhghfrjtg9usbkj X-HE-Tag: 1743621164-839557 X-HE-Meta: U2FsdGVkX19WiN7jqXAQ7VoZGmCLesYQhJjagzS4QwyUnLJsASx7aZRjWY2IxAs2KaDbwYeSB6a0pYBtdiaI0pqfZ9NO8HbD2ZXVwAepRUSEySOaOyi9qVq6kuR6jRNGxrIcSMv26g9UoWxO3HK2R0xK5pHGxx2nhntzyMV6z1KdJ2Dl8d36IQ1w6i+jq1C8HuCLykOpsb9aEL18h3x/AuKycYpElCPhm+oqHFMmIlPsF34maV4gSJ4ljA6yEhG7s2WnI/M43Em1Ii+msp16eeRkdZ9V7CgO4aoHLUMrQdnTVQAkRuCNnC6x2AtnVatOLWW/5d8w9Is3aJbo6CLuUeDK7ChHpuLubatlirxP6TbnZB58ZavIK9+13uxFtADXou7oU1YSDw0wkrkHfBT+DE1B8fuw41Q391/6Za8uq7xEeYt67t8dwczZ6pfcgeTz200h5zyIV/zR4HLaFpqdxeLIsEoL+5Clu+FhjBFManF8R1iDCLjnDm2JsSzME7dOtIP+K2oAkB6KALw2M11gDVF91OPbgnKTcRyZTkjTDDcyBeS8qL8efJ6eM+4KAepY/0gTc2UHPyG8ugzzFrSu195XF2121+atZE8wvsy4oJpRxbewzd7Yr7BsqDRB4Bnm7/+33VZIICKYmBMFrMtRXfoFyWC0jebUjnN3CszKVchDDs5HZyNtjMNG5jyFWWzy2OfONwV37mh54QAodlSK9kiTWN7M0XawgKorCy/EF43LE1wpF+tELvEQo9Pl2Wi9kfxmBR6qngTUoQskJDu9ZhL3qbFerhJInHy250IoAJv+7KgUdyVgA5SoB3oZ4ktwPRDsqUIKWtI7mHRHWrZfmRpuGFrMbzYl6icrYL2g6HsqT8ZChcOojlInJMHkjNkhFJ9V7RfvHPQxLhiy7zbZbf5K6rXyEV0ZVYwXt4Rjz4Jsn66zUGphkzfTHPNyRwgx8whuvgoRwJBaYyLpxtA 7jHm1U9F nDW3HVPNODTgOqmmPaQG75miW3HZrYtOWUputkQC2lt65wXOmUE6gkYYJUSaccGL2w1XpTK3lvSByzHDP6hOW4A+wJ71WuG727uVILVaz4p4Xznyt90L0tDQmf4NKF6d0FxJj+LkcKzLhl1vONMTy7pc6Xv5oMy8lPlqU+sMwpjI63DhklQArbkxVGj2DKs+ZvHMpQoeCPmj4CauIoLTaCt3dkijm+5PtlDvnqZY4LPNzPF85sEmeVV6pcimTEeD6yIqwTgVDBqgrzg7qBbzCq7qcyLc+6YJtyIFjiLjxSznSiH6+sgokUb374NK415br7xqhhgstgGEvwFmC949iV9yu5w== 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: List-Subscribe: List-Unsubscribe: On Wed, 2 Apr 2025 at 22:01, Thomas Wei=C3=9Fschuh wrote: > > On Wed, Apr 02, 2025 at 03:07:51PM +0200, Thomas Wei=C3=9Fschuh wrote: > > On Wed, Apr 02, 2025 at 03:46:37PM +0300, Mike Rapoport wrote: > > > On Wed, Apr 02, 2025 at 02:19:01PM +0200, Thomas Wei=C3=9Fschuh wrote= : > > > > (drop all the non-x86 and non-mm recipients) > > > > > > > > On Thu, Mar 13, 2025 at 03:50:00PM +0200, Mike Rapoport wrote: > > > > > From: "Mike Rapoport (Microsoft)" > > > > > > > > > > high_memory defines upper bound on the directly mapped memory. > > > > > This bound is defined by the beginning of ZONE_HIGHMEM when a sys= tem has > > > > > high memory and by the end of memory otherwise. > > > > > > > > > > All this is known to generic memory management initialization cod= e that > > > > > can set high_memory while initializing core mm structures. > > > > > > > > > > Add a generic calculation of high_memory to free_area_init() and = remove > > > > > per-architecture calculation except for the architectures that se= t and > > > > > use high_memory earlier than that. > > > > > > > > This change (in mainline as commit e120d1bc12da ("arch, mm: set hig= h_memory in free_area_init()") > > > > breaks booting i386 on QEMU for me (and others [0]). > > > > The boot just hangs without output. > > > > > > > > It's easily reproducible with kunit: > > > > ./tools/testing/kunit/kunit.py run --arch i386 > > > > > > > > See below for the specific problematic hunk. > > > > > > > > [0] https://lore.kernel.org/lkml/CA+G9fYtdXHVuirs3v6at3UoKNH5keuq0t= pcvpz0tJFT4toLG4g@mail.gmail.com/ > > > > > > > > > > > > > diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c > > > > > index 6d2f8cb9451e..801b659ead0c 100644 > > > > > --- a/arch/x86/mm/init_32.c > > > > > +++ b/arch/x86/mm/init_32.c > > > > > @@ -643,9 +643,6 @@ void __init initmem_init(void) > > > > > highstart_pfn =3D max_low_pfn; > > > > > printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", > > > > > pages_to_mb(highend_pfn - highstart_pfn)); > > > > > - high_memory =3D (void *) __va(highstart_pfn * PAGE_SIZE -= 1) + 1; > > > > > -#else > > > > > - high_memory =3D (void *) __va(max_low_pfn * PAGE_SIZE - 1= ) + 1; > > > > > #endif > > > > > > > > Reverting this hunk fixes the issue for me. > > > > > > This is already done by d893aca973c3 ("x86/mm: restore early initiali= zation > > > of high_memory for 32-bits"). > > > > Thanks. Of course I only noticed this shortly after sending my mail. > > But this usecase is indeed broken on mainline. > > Some further bisecting lead to the mm merge commit being broken, while = both its > > parents work. That lead the bisection astray. > > eb0ece16027f ("Merge tag 'mm-stable-2025-03-30-16-52' of git://git.kern= el.org/pub/scm/linux/kernel/git/akpm/mm") > > > > As unlikely as it sounds, it's reproducible. I'll investigate a bit. > > The issue is fixed with the following diff: I have applied this patch, > > diff --git a/mm/memblock.c b/mm/memblock.c > index 284154445409..8cd95f60015d 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -2165,7 +2165,8 @@ static unsigned long __init __free_memory_core(phys= _addr_t start, > phys_addr_t end) > { > unsigned long start_pfn =3D PFN_UP(start); > - unsigned long end_pfn =3D PFN_DOWN(end); > + unsigned long end_pfn =3D min_t(unsigned long, > + PFN_DOWN(end), max_low_pfn); > > if (start_pfn >=3D end_pfn) > return 0; > > > Background: > > This reverts part of commit 6faea3422e3b ("arch, mm: streamline HIGHMEM f= reeing") > which is the direct child of the partially reverted > commit e120d1bc12da ("arch, mm: set high_memory in free_area_init()"). > The assumptions the former commit became invalid with the partial revert = the latter. > > This bug only triggers when CONFIG_HIGHMEM=3Dn. When mm was branched from= mainline > the i386 configuration generated by kunit ended up with CONFIG_HIGHMEM=3D= y. > With some recent changes in mainline the kunit configuration switched to > CONFIG_HIGHMEM=3Dn, triggering this specific reproducer only when mm got = merged > into mainline again. > > New kunit reproducer: > ./tools/testing/kunit/kunit.py run --arch i386 example --timeout 10 --kco= nfig_add CONFIG_HIGHMEM=3Dn > > Does this sound reasonable? If so I'll send a patch tomorrow. > > @Naresh, could you test this, too? I have applied the proposed fix patch and tested. The boot test and LTP smoke test pass. Links: - https://tuxapi.tuxsuite.com/v1/groups/linaro/projects/naresh/tests/2vBZg= uDGiZclS394TDRdwW61twC > > > Thomas