From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796266703; b=45/9l+mSi2x8lgMEsFFaXGKSSSAr6ifzetma6IiK6X920eo97NkLL5bwIxo16FwysCru MR8r/qSssP8RXxBOMgD7SEra0zQcy7x/DA/849btyz4KlvtnFGSIX9cMB0Tq9tDoR+KRE xc0qhlPezoxdSFwvNGgRc0XH+rFE3COkRTYXtOOFeM/tWO4w3aZdX+OqDWuw158CU7O0d sRf65jEw6ZUQP8lcsaw7uys6vsxf6igOx9jtN0qz7FPmBxv6M4u08mBsHEPt/TNfHWCaY SXgDpIDS7CvETr8qjBKI58xhX8o0Et+8erz6gzpu2AUuU18bhdYMojISxSEacO/BlDA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796266703; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent; bh=WpWoiqM1sQaKmawupr4t61Op49rdqjR2+ecyls6gY7s=; b=zoLQS3AvgQHV//hy3xIbIZIV7DaFfCZLYWAdnfVASmQX90CdGGhe2a6kPmqdcJX6AX3G BtqfYS3e2bruwHcw2GaPhoPErY5DjNuDMIH9NXp5BXj5iUyJ5CdxS0i0mXHKRyyQrv/WS ZSMqDSxFpE4F0KEpcogYbHq9GqcMZq7IbCG63JNjRCAnoLuig6TwE43CL2ddOrMdij0KK bUjfHj2xlfC+ysytvFxTGv9CYsA8R8G1JIczXJn+iF+8EDaZ2cDvZEUgJt10Rva9/6P6H my5n1CH1RT/LPpM6TSqMmDhL9GjLNo6WnIGCNdMIl+W2BZdh6zC3fF4JmsEOsUUql+Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=chrisdown.name; spf=pass smtp.mailfrom=chrisdown.name; dkim=pass header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=qa3P+Ag0; arc=none smtp.remote-ip=209.85.128.180 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F0C5606A32C for ; Thu, 3 Dec 2026 02:58:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4F0C5606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=chrisdown.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chrisdown.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=qa3P+Ag0 Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-8b2d14968c9so134368867b3.0 for ; Wed, 02 Dec 2026 18:58:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; t=1796266702; x=1796871502; darn=vger.kernel.org; h=user-agent:content-disposition:content-type:mime-version:message-id :references:in-reply-to:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=WpWoiqM1sQaKmawupr4t61Op49rdqjR2+ecyls6gY7s=; b=qa3P+Ag0peSPd74rNWOyunK47wD5WAVJ4RXG1Z6Lv7mhPJkcmza1lBrkz5DOQWzdzi odlLA7l+z6IISRMyHxfTFKHTqEhLL+utoIxkJOBCs00s7tXq9D6ORh4j+GwQd25xQB07 1Icowa4lpOq+QmpKxzuUCoNAnNlCvCb0Pb6ao= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796266702; x=1796871502; h=user-agent:content-disposition:content-type:mime-version:message-id :references:in-reply-to:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=WpWoiqM1sQaKmawupr4t61Op49rdqjR2+ecyls6gY7s=; b=L1jbRpja8utWIG8o0E95yIz9I3oquEhtXEgHrJqby8C3ntWqMXhDkHgg76TVCQbHOn /6yjWL6rwVOJzTLAl8t9N8c2L8vn1H/jibWuE9VuRQsvAS+T48uWdrQgVRDOoQhDtchS WFi0I/1Vgik2C4w4+YBCNav7/x/qnjddVoyBTuJI1Jt9jWN4dRP77+ruxuCIXsHRhMP1 0BkpcX3DTe3ZQoNMyuXABOe4YcoMCHYwzn7A8q/yeFMWOx6tTP++LbwQwA5OMnqbKt+s +a8Aa3X1N2BnrLPnAqFpQGNrdoOHsRdTYyYGCPBQsdqEh+eGeoKveDXWHf07xQ5d9lth iCYw== X-Forwarded-Encrypted: i=1; AL+hErGfQ53TnxdANIwU4/x9hDdbVNfUpZL8XDknM0hx5fgMPD/1+BPFj3RUDsuX+mZ88+svBhM/EW3aodwwTH0=@vger.kernel.org X-Gm-Message-State: APuU4Z94jTdnlppcPlEoZbRyohF1sNCxDH9P2lWRt5k36imlOcLYS/3a R1jgbCACi8z4wDeL8lXneJNw/CXXubDOrCi0k0UreEpVFykPUi/tKqb+rfbp+JhcXcY= X-Gm-Gg: AZFdTZcQlKm4doaUHEOd5eJh3MGmhdLvyOWqYviQjMneE/9GUjbNi/qTZZPHQ7yAPff uTVDwJZhyCtP1RFZndfeNViTT2I1UsoY+Rqw9mGw53dLYLx3WTRhi8XRDCZgi5+y7T7mzpOl7to pmRS4FmOD9IfAqNXDIFt01pr5GsIy3YoJsSF3v01XdvsVXLkWE6kYMyyXehtRKu+jSWJ8KRQM3P HSaLE/BYc+zuwngj/GSjGfYB3hOMyfDa6mLE0CBRnfr1zv9h+Jbr736dzdexR9Pw/8bfLI2GUqb oEzSH8ITP7co4vTYn7fQnYM940MsRKskWY77mwQ0NDpcaO7PckEL1GdIWCLlmWRWzJe4L/5dAlB CPCe0wLewRIzgK40UKJ6dwKc+NE/CPT8IUhqx19SEsPxdrFneEISFx11I3zeRjM43YNw/tK/+vg CDgo8wEMJMSzazd5VGhr5t0U7agG1fv2mKHSySIj3S4NbtfJcFvObUOY2IDhSfUfevQXwnjWHPk 77s6BOuS5NHM7gJhdYaWxeAM5gpJ6QQXzC+hzb0NYeGkaixR07qb9De9U0/OEROq6NjAIYGYgo4 +KecSpi3SBE0BlF3WtOdew7dk8PY2kLXxOZKNfoZwXgZxck/bK9zRRkOjZsW+b2S+0jp9CM6Az8 l728r2BkidcWMGsbH010UMAn26oG+LWS6oMivkkIyJblBumfELwF8bycGuwJBnpf8wdXcB49q2N Cw3OwyzRYDu4plRCmGirKPLSC9iqhCDlodIcJ14g/bVPtNGdG81vkKYJozmc7TSJuY/RNo+2cxc zIUyP6OF/95zHAjHI0go2M= X-Received: by 2002:a05:690c:3745:b0:8b3:7f47:8ad4 with SMTP id 00721157ae682-8b5204b50f5mr150462197b3.41.1796266702220; Wed, 02 Dec 2026 18:58:22 -0800 (PST) Received: from [172.18.0.2] (c-73-207-185-9.hsd1.ga.comcast.net. [73.207.185.9]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b52036d72csm164535387b3.45.2026.12.02.18.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 18:58:21 -0800 (PST) Date: Wed, 02 Dec 2026 18:58:18 -0800 From: Chris Down To: Mike Rapoport Cc: pasha.tatashin@soleen.com, pratyush@kernel.org, graf@amazon.com, kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH v2 0/2] kho: handle failures to reserve preserved memory In-Reply-To: References: Message-ID: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/2.4.3 (cc9e3943) (2026-10-09) Hi Mike, Mike Rapoport writes: >If memblock_reserve() fails we are in a very unhappy place. >Do you think we really should worry about KHO state when we won't pass >through mm_core_init() anyway? I am not an expert in memblock for sure, but as far as I can see the following can happen reasonably: 1. The memory map is allocated in mm_core_init_early(), so the walk has its memory already. 2. kho_memory_init() is the last thing before memblock_free_all(), so nothing between the walk and memblock_free_all() allocates from memblock. 3. memblock_free_all() may have to grow the reserved array itself, but it stops restricting allocations to bootmem before it does. Once it has run, the kernel has plenty to work with, including whatever the walk failed to reserve. Or am I missing something? I've now also managed to hit this without forcing the failure. I preserved a memfd whose 140000 pages are interleaved with another file's, so that each page is a range of its own, and used reserve_mem= to fill most of the next kernel's bootmem. Without the series, that kernel logs memblock: Failed to double reserved array from 131072 to 262144 entries ! for each range it can no longer reserve, and then boots to userspace as usual. Retrieving the memfd there fails with -EIO, with kho_restore_page() warning that the magic is gone. With the series, it logs the failure once, drops the handover and boots. It's still unlikely, since it needs badly fragmented preserved memory and a bootmem that's close to full, although it will get easier to hit if we manage to shrink bootmem. But the kernel doesn't die when it happens. It carries on with preserved memory in the page allocator, so I think it's worth handling, but please do tell me if there's context I'm missing here. Thanks, Chris