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 DC4C7C021B2 for ; Tue, 25 Feb 2025 07:48:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 719D36B0085; Tue, 25 Feb 2025 02:48:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CA1B6B0088; Tue, 25 Feb 2025 02:48:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 591FD280001; Tue, 25 Feb 2025 02:48:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 376AB6B0085 for ; Tue, 25 Feb 2025 02:48:08 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D9DBE120C4B for ; Tue, 25 Feb 2025 07:48:07 +0000 (UTC) X-FDA: 83157688614.23.4E1A293 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf03.hostedemail.com (Postfix) with ESMTP id 51FB520003 for ; Tue, 25 Feb 2025 07:48:06 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MfehpgzA; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of rppt@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740469686; a=rsa-sha256; cv=none; b=Mhuq7BaHBblzo+kULaAEeNmFxA5TAKn0ar0w9LNmNxirZr7NI/hKArb7r0Dgt6Wu7hSLrI hN247KxKdD/6qE7srMxfum1eZ2GpaQ7jqP+VWpdTPpgLhus7tOpKplfnOcsyIyO9UPCjQC xMYAirOky5eAbfsddMVYLV4IdKbyOkE= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MfehpgzA; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of rppt@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740469686; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=a+nNbrVcpzRfg0cVt9oM4NlAg5n7LMGEi6yC9l2ygE4=; b=j6vrzieDeIBKJDtCO+8UEmWsxYUnXpt9a1ysGw1DxLs7Wy90uXcE2LOgplLswkFQBaI7zs 4XM/C6fimO47nwMs7G+xqyV9Evmo2PYc+k2zyu7egbYf8YqUavNf3ts6iIYha4gaaLEflW Q8cSbFMfTp2NkyqVrzBhwQ4+1GNvCvQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id F0F7C6122F; Tue, 25 Feb 2025 07:47:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7196C4CEDD; Tue, 25 Feb 2025 07:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740469685; bh=eClZUkFpGoFoPisFcTGx3FOMVVxAN549qNzYuXDaN6Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MfehpgzAULJOLOZKi9leXW7NoihGeIwZGfgqqDeu5KiV1mGWrDwPVnYfTRgxdvz/x eUEiMbxM3XxYo/gmkSSg4xx8xTFkRQppUlh3HUxKONPfFFg/CDnfnacUmmTxgJ/Nl0 p03c6jGvE33coM+dHriSIwpAGcEALD6rf9GR0yiK3xOwkPBH/7Aw7fEccJA5pPsujz ioZNQPMfXKd7AoR2Kqkh+jT67yt7GirH7eFeS9NW11qqcNBhAVIKkRdeHuNLA4FcsI VWFcsDgf2SamOyzaQaxOBPvKzWILeKBO0pYTSGt//hRXbLnUc8avjE5frZYFP0WbVU ypiGxCjITbKtg== Date: Tue, 25 Feb 2025 09:47:44 +0200 From: Mike Rapoport To: Wei Yang Cc: linux-kernel@vger.kernel.org, Alexander Graf , Andrew Morton , Andy Lutomirski , Anthony Yznaga , Arnd Bergmann , Ashish Kalra , Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Dave Hansen , David Woodhouse , Eric Biederman , Ingo Molnar , James Gowans , Jonathan Corbet , Krzysztof Kozlowski , Mark Rutland , Paolo Bonzini , Pasha Tatashin , "H. Peter Anvin" , Peter Zijlstra , Pratyush Yadav , Rob Herring , Rob Herring , Saravana Kannan , Stanislav Kinsburskii , Steven Rostedt , Thomas Gleixner , Tom Lendacky , Usama Arif , Will Deacon , devicetree@vger.kernel.org, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Subject: Re: [PATCH v4 03/14] memblock: Add support for scratch memory Message-ID: References: <20250206132754.2596694-1-rppt@kernel.org> <20250206132754.2596694-4-rppt@kernel.org> <20250224025034.g4htzqgm3r3ja4yy@master> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250224025034.g4htzqgm3r3ja4yy@master> X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 51FB520003 X-Stat-Signature: y7aduyaw1pe4dqbwz5ezrirwbnjja93h X-Rspam-User: X-HE-Tag: 1740469686-925216 X-HE-Meta: U2FsdGVkX1+ae0W4Xo4nAtnA6hay1oOh5sm3BjsUz2CRmv5mVUaaGA5jT3b9VBPF2G3rg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mr88hWE18C//YmzYsA4pVbdKyvpm5L/mBngvNiggoOAAuiFDXAcqoiBwJC60NeBo7xjytqfF7ZSmVq9uduyE0mEYftiJQ5eKzluDw6srnWOXuak2vw4rjocHHifdRejMCU4fhgXhmk4RpKd2WuVUtCtJ69X6fWHbME0AYPYBv6XYCdkVuxXTMEfEPNnYWxhx2v9ZH 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 Mon, Feb 24, 2025 at 02:50:34AM +0000, Wei Yang wrote: > On Thu, Feb 06, 2025 at 03:27:43PM +0200, Mike Rapoport wrote: > >From: Alexander Graf > > > >With KHO (Kexec HandOver), we need a way to ensure that the new kernel > >does not allocate memory on top of any memory regions that the previous > >kernel was handing over. But to know where those are, we need to include > >them in the memblock.reserved array which may not be big enough to hold > >all ranges that need to be persisted across kexec. To resize the array, > >we need to allocate memory. That brings us into a catch 22 situation. > > > >The solution to that is limit memblock allocations to the scratch regions: > >safe regions to operate in the case when there is memory that should remain > >intact across kexec. > > > >KHO provides several "scratch regions" as part of its metadata. These > >scratch regions are contiguous memory blocks that known not to contain any > >memory that should be persisted across kexec. These regions should be large > >enough to accommodate all memblock allocations done by the kexeced kernel. > > > >We introduce a new memblock_set_scratch_only() function that allows KHO to > > memblock_set_kho_scratch_only? > > >indicate that any memblock allocation must happen from the scratch regions. > > > >Later, we may want to perform another KHO kexec. For that, we reuse the > >same scratch regions. To ensure that no eventually handed over data gets > >allocated inside a scratch region, we flip the semantics of the scratch > >region with memblock_clear_scratch_only(): After that call, no allocations > > memblock_clear_kho_scratch_only? Right, I missed those in the commit message. > >may happen from scratch memblock regions. We will lift that restriction > >in the next patch. > > > > -- > Wei Yang > Help you, Help me -- Sincerely yours, Mike.