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 5B55DE80A8E for ; Wed, 27 Sep 2023 05:44:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F08A78D007A; Wed, 27 Sep 2023 01:44:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB6AD8D0002; Wed, 27 Sep 2023 01:44:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA5D78D007A; Wed, 27 Sep 2023 01:44:53 -0400 (EDT) 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 CAB168D0002 for ; Wed, 27 Sep 2023 01:44:53 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9511DC0F6E for ; Wed, 27 Sep 2023 05:44:53 +0000 (UTC) X-FDA: 81281288466.13.B04881E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 2DE51140002 for ; Wed, 27 Sep 2023 05:44:50 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KAzSPl01; spf=pass (imf23.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695793491; a=rsa-sha256; cv=none; b=ZJKMCgg8sVVEbA6DYTzdpKKWoacUgrqiLi1z7RIw/RFmFvuG3+234wajW8bH3oQOGskbLN oQbIul9w1nQFhuE+uEA74Xqb5hLUCMvMTRlxWg5qkyyuLZYszXdEP3AwmEmGGSWCLvnk0u BGWbKaz3O+jzjLvC/fvwQyKvjWH/XDg= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KAzSPl01; spf=pass (imf23.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695793491; 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=FXF3ES7XN1Pl7q/U2YCy77+dCD8e5lolOS847DdNDAY=; b=a15S+D7dx+FdD5C29SW3v8SCWNvuKn+LVVYy4fx2D5ZB8/79cDHjf8wRD7Qtg8A6bJyCOj q+yKVpmjB7tf1PjKgaU3Zcyi6ulSGdr/F4K/GSwHGCk3FeovWZo5Z6Lt6bdlXB9ucZGCOn 3bA0dnjc29LYqBo8ltMu55a+3pP7Hjo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695793489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FXF3ES7XN1Pl7q/U2YCy77+dCD8e5lolOS847DdNDAY=; b=KAzSPl01FQd8UCpRyUQKZTdfasUl5Ltf4GVr3JuO9+0S/Qk0CWhID48slozqxhOcdze2qn U+E2kGxXHxWPU1FZLkA4p8RqpFbTfEnTOiNz4PUpGY5go96MZgk2x/gEBfhOHaFejfiaOb hYkydezBP88k9WB8xsK6SqIFDAYohQc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-294-O_z9u9y5N2y72j6BNqnfEQ-1; Wed, 27 Sep 2023 01:44:44 -0400 X-MC-Unique: O_z9u9y5N2y72j6BNqnfEQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 992B085A5BE; Wed, 27 Sep 2023 05:44:42 +0000 (UTC) Received: from localhost (unknown [10.72.112.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76FA12026D4B; Wed, 27 Sep 2023 05:44:41 +0000 (UTC) Date: Wed, 27 Sep 2023 13:44:38 +0800 From: Baoquan He To: Stanislav Kinsburskii Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ebiederm@xmission.com, akpm@linux-foundation.org, stanislav.kinsburskii@gmail.com, corbet@lwn.net, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-mm@kvack.org, kys@microsoft.com, jgowans@amazon.com, wei.liu@kernel.org, arnd@arndb.de, gregkh@linuxfoundation.org, graf@amazon.de, pbonzini@redhat.com Subject: Re: [RFC PATCH v2 0/7] Introduce persistent memory pool Message-ID: References: <01828.123092517290700465@us-mta-156.us.mimecast.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01828.123092517290700465@us-mta-156.us.mimecast.lan> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2DE51140002 X-Stat-Signature: q5q6b3bhri7j9wqur6wzeek9rs9fia1w X-Rspam-User: X-HE-Tag: 1695793490-696105 X-HE-Meta: U2FsdGVkX1+4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w7gP6uDN4Cr5OtDSIgCxUBQsHdMfJnNCuRHk8XqiRRPtAyQEjTHeZIIW0ct1kw6+ynbnQehtai2tf9613cOhslqaTt/RIf/fisBy4Ildl0X+EkNYP05AAqSq3bvEwCAib1/ewdHBJrvmXxp5IWLFNALYA8SRR/6i3EPPWZWFwGaqSVnpbxk77qhsukoo6v2UnrfN6hVf7eMv2Uy5XVySdynTxyJiNG50RY/hE2Pu00cAzQxw6hFFCAl3lGwlHGX8/d5gDQwomy56Eb0A1A2NZgoYoaL1XzvHnQr20= 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: Hi Stanislav, On 09/25/23 at 02:27pm, Stanislav Kinsburskii wrote: > This patch introduces a memory allocator specifically tailored for > persistent memory within the kernel. The allocator maintains > kernel-specific states like DMA passthrough device states, IOMMU state, and > more across kexec. Can you give more details about how this persistent memory pool will be utilized in a actual scenario? I mean, what problem have you met so that you have to introduce persistent memory pool to solve it? Thanks Baoquan > > The current implementation provides a foundation for custom solutions that > may be developed in the future. Although the design is kept concise and > straightforward to encourage discussion and feedback, it remains fully > functional. > > The persistent memory pool builds upon the continuous memory allocator > (CMA) and ensures CMA state persistency across kexec by incorporating the > CMA bitmap into the memory region instead of allocation it from kernel > memory. > > Persistent memory pool metadata is passed across kexec by using Flattened > Device Tree, which is added as another kexec segment for x86 architecture. > > Potential applications include: > > 1. Enabling various in-kernel entities to allocate persistent pages from > a unified memory pool, obviating the need for reserving multiple > regions. > > 2. For in-kernel components that need the allocation address to be > retained on kernel kexec, this address can be exposed to user space > and subsequently passed through the command line. > > 3. Distinct subsystems or drivers can set aside their region, allocating > a segment for their persistent memory pool, suitable for uses such as > file systems, key-value stores, and other applications. > > Notes: > > 1. The last patch of the series represents a use case for the feature. > However, the patch won't compile and is for illustrative purposes only > as the code being patched hasn't been merged yet. > > 2. The code being patched is currently under review by the community. The > series is named "Introduce /dev/mshv drivers": > > https://lkml.org/lkml/2023/9/22/1117 > > > Changes since v1: > > 1. Persistent memory pool is now a wrapper on top of CMA instead of being a > new allocator. > > 2. Persistent memory pool metadata doesn't belong to the pool anymore and > is now passed via Flattened Device Tree instead over kexec to the new > kernel. > > The following series implements... > > --- > > Stanislav Kinsburskii (7): > kexec_file: Add fdt modification callback support > x86: kexec: Transfer existing fdt to the new kernel > x86: kexec: Enable fdt modification in callbacks > pmpool: Introduce persistent memory pool > pmpool: Update device tree on kexec > pmpool: Restore state from device tree post-kexec > Drivers: hv: Allocate persistent pages for root partition > > > arch/x86/Kconfig | 16 +++ > arch/x86/kernel/kexec-bzimage64.c | 97 +++++++++++++++++ > drivers/hv/hv_common.c | 13 ++ > include/linux/kexec.h | 7 + > include/linux/pmpool.h | 22 ++++ > kernel/kexec_file.c | 24 ++++ > mm/Kconfig | 9 ++ > mm/Makefile | 1 > mm/pmpool.c | 208 +++++++++++++++++++++++++++++++++++++ > 9 files changed, 394 insertions(+), 3 deletions(-) > create mode 100644 include/linux/pmpool.h > create mode 100644 mm/pmpool.c > > > _______________________________________________ > kexec mailing list > kexec@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec >