From: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>
To: Terry Bowman <terry.bowman@amd.com>,
"dave@stgolabs.net" <dave@stgolabs.net>,
"jonathan.cameron@huawei.com" <jonathan.cameron@huawei.com>,
"dave.jiang@intel.com" <dave.jiang@intel.com>,
"alison.schofield@intel.com" <alison.schofield@intel.com>,
"vishal.l.verma@intel.com" <vishal.l.verma@intel.com>,
"ira.weiny@intel.com" <ira.weiny@intel.com>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"willy@infradead.org" <willy@infradead.org>,
"jack@suse.cz" <jack@suse.cz>,
"rafael@kernel.org" <rafael@kernel.org>,
"len.brown@intel.com" <len.brown@intel.com>,
"pavel@ucw.cz" <pavel@ucw.cz>,
"ming.li@zohomail.com" <ming.li@zohomail.com>,
"nathan.fontenot@amd.com" <nathan.fontenot@amd.com>,
"Smita.KoralahalliChannabasappa@amd.com"
<Smita.KoralahalliChannabasappa@amd.com>,
"huang.ying.caritas@gmail.com" <huang.ying.caritas@gmail.com>,
"Xingtao Yao (Fujitsu)" <yaoxt.fnst@fujitsu.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"quic_jjohnson@quicinc.com" <quic_jjohnson@quicinc.com>,
"ilpo.jarvinen@linux.intel.com" <ilpo.jarvinen@linux.intel.com>,
"bhelgaas@google.com" <bhelgaas@google.com>,
"andriy.shevchenko@linux.intel.com"
<andriy.shevchenko@linux.intel.com>,
"mika.westerberg@linux.intel.com"
<mika.westerberg@linux.intel.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"gourry@gourry.net" <gourry@gourry.net>,
"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"rrichter@amd.com" <rrichter@amd.com>,
"benjamin.cheatham@amd.com" <benjamin.cheatham@amd.com>,
"PradeepVineshReddy.Kodamati@amd.com"
<PradeepVineshReddy.Kodamati@amd.com>
Cc: "Yasunori Gotou (Fujitsu)" <y-goto@fujitsu.com>
Subject: Re: [PATCH v3 0/4] Add managed SOFT RESERVE resource handling
Date: Mon, 7 Apr 2025 07:31:37 +0000 [thread overview]
Message-ID: <00489171-8e9d-4c97-9538-c5a97d4bac97@fujitsu.com> (raw)
In-Reply-To: <20250403183315.286710-1-terry.bowman@amd.com>
Hi Terry,
If I understand correctly, this patch set has only considered the situation where the
soft reserved area and the region are exactly the same, as in pattern 1.
However, I believe we also need to consider situations where these two are not equal,
which are outlined in pattern 2 and 3 below. Let me explain them:
===========================================
Pattern 1:
- region0 will be created during OS booting due to programed hdm decoder
- After OS booted, region0 can be re-created again after destroy it
┌────────────────────┐
│ CFMW │
└────────────────────┘
┌────────────────────┐
│ reserved0 │
└────────────────────┘
┌────────────────────┐
│ mem0 │
└────────────────────┘
┌────────────────────┐
│ region0 │
└────────────────────┘
Pattern 2:
The HDM decoder is not in a committed state, so during the kernel boot process,
egion0 will not be created automatically. In this case, the soft reserved area will
not be removed from the iomem tree. After the OS starts,
users cannot create a region (cxl create-region) either, as there should
be an intersection between the soft reserved area and the region.
┌────────────────────┐
│ CFMW │
└────────────────────┘
┌────────────────────┐
│ reserved0 │
└────────────────────┘
┌────────────────────┐
│ mem0* │
└────────────────────┘
┌────────────────────┐
│ N/A │ region0
└────────────────────┘
*HDM decoder in mem0 is not committed.
Pattern 3:
Region0 is a child of the soft reserved area. In this case, the soft reserved area will
not be removed from the iomem tree, resulting in being unable to be recreated later after destroy.
┌────────────────────┐
│ CFMW │
└────────────────────┘
┌────────────────────┐
│ reserved │
└────────────────────┘
┌────────────────────┐
│ mem0 | mem1* │
└────────────────────┘
┌────────────────────┐
│region0 | N/A │ region1
└────────────────────┘
*HDM decoder in mem1 is not committed.
Thanks
Zhijian
On 04/04/2025 02:33, Terry Bowman wrote:
> Add the ability to manage SOFT RESERVE iomem resources prior to them being
> added to the iomem resource tree. This allows drivers, such as CXL, to
> remove any pieces of the SOFT RESERVE resource that intersect with created
> CXL regions.
>
> The current approach of leaving the SOFT RESERVE resources as is can cause
> failures during hotplug of devices, such as CXL, because the resource is
> not available for reuse after teardown of the device.
>
> The approach is to add SOFT RESERVE resources to a separate tree during
> boot. This allows any drivers to update the SOFT RESERVE resources before
> they are merged into the iomem resource tree. In addition a notifier chain
> is added so that drivers can be notified when these SOFT RESERVE resources
> are added to the ioeme resource tree.
>
> The CXL driver is modified to use a worker thread that waits for the CXL
> PCI and CXL mem drivers to be loaded and for their probe routine to
> complete. Then the driver walks through any created CXL regions to trim any
> intersections with SOFT RESERVE resources in the iomem tree.
>
> The dax driver uses the new soft reserve notifier chain so it can consume
> any remaining SOFT RESERVES once they're added to the iomem tree.
>
> V3 updates:
> - Remove srmem resource tree from kernel/resource.c, this is no longer
> needed in the current implementation. All SOFT RESERVE resources now
> put on the iomem resource tree.
> - Remove the no longer needed SOFT_RESERVED_MANAGED kernel config option.
> - Add the 'nid' parameter back to hmem_register_resource();
> - Remove the no longer used soft reserve notification chain (introduced
> in v2). The dax driver is now notified of SOFT RESERVED resources by
> the CXL driver.
>
> v2 updates:
> - Add config option SOFT_RESERVE_MANAGED to control use of the
> separate srmem resource tree at boot.
> - Only add SOFT RESERVE resources to the soft reserve tree during
> boot, they go to the iomem resource tree after boot.
> - Remove the resource trimming code in the previous patch to re-use
> the existing code in kernel/resource.c
> - Add functionality for the cxl acpi driver to wait for the cxl PCI
> and me drivers to load.
>
> Nathan Fontenot (4):
> kernel/resource: Provide mem region release for SOFT RESERVES
> cxl: Update Soft Reserved resources upon region creation
> dax/mum: Save the dax mum platform device pointer
> cxl/dax: Delay consumption of SOFT RESERVE resources
>
> drivers/cxl/Kconfig | 4 ---
> drivers/cxl/acpi.c | 28 +++++++++++++++++++
> drivers/cxl/core/Makefile | 2 +-
> drivers/cxl/core/region.c | 34 ++++++++++++++++++++++-
> drivers/cxl/core/suspend.c | 41 ++++++++++++++++++++++++++++
> drivers/cxl/cxl.h | 3 +++
> drivers/cxl/cxlmem.h | 9 -------
> drivers/cxl/cxlpci.h | 1 +
> drivers/cxl/pci.c | 2 ++
> drivers/dax/hmem/device.c | 47 ++++++++++++++++----------------
> drivers/dax/hmem/hmem.c | 10 ++++---
> include/linux/dax.h | 11 +++++---
> include/linux/ioport.h | 3 +++
> include/linux/pm.h | 7 -----
> kernel/resource.c | 55 +++++++++++++++++++++++++++++++++++---
> 15 files changed, 202 insertions(+), 55 deletions(-)
>
>
> base-commit: aae0594a7053c60b82621136257c8b648c67b512
next prev parent reply other threads:[~2025-04-07 7:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 18:33 [PATCH v3 0/4] Add managed SOFT RESERVE resource handling Terry Bowman
2025-04-03 18:33 ` [PATCH v3 1/4] kernel/resource: Provide mem region release for SOFT RESERVES Terry Bowman
2025-04-03 18:40 ` Andy Shevchenko
2025-04-03 18:50 ` Bowman, Terry
2025-04-04 12:57 ` kernel test robot
2025-04-04 13:16 ` Jonathan Cameron
2025-04-04 13:25 ` Andy Shevchenko
2025-04-10 15:07 ` Bowman, Terry
2025-04-10 14:49 ` Bowman, Terry
2025-04-03 18:33 ` [PATCH v3 2/4] cxl: Update Soft Reserved resources upon region creation Terry Bowman
2025-04-04 13:32 ` Jonathan Cameron
2025-04-10 15:57 ` Bowman, Terry
2025-04-04 13:58 ` kernel test robot
2025-04-03 18:33 ` [PATCH v3 3/4] dax/mum: Save the dax mum platform device pointer Terry Bowman
2025-04-04 13:34 ` Jonathan Cameron
2025-04-10 18:27 ` Bowman, Terry
2025-04-03 18:33 ` [PATCH v3 4/4] cxl/dax: Delay consumption of SOFT RESERVE resources Terry Bowman
2025-04-04 13:38 ` Jonathan Cameron
2025-04-07 7:31 ` Zhijian Li (Fujitsu) [this message]
2025-04-07 22:35 ` [PATCH v3 0/4] Add managed SOFT RESERVE resource handling Bowman, Terry
2025-04-14 14:11 ` Bowman, Terry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=00489171-8e9d-4c97-9538-c5a97d4bac97@fujitsu.com \
--to=lizhijian@fujitsu.com \
--cc=PradeepVineshReddy.Kodamati@amd.com \
--cc=Smita.KoralahalliChannabasappa@amd.com \
--cc=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=benjamin.cheatham@amd.com \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=gourry@gourry.net \
--cc=gregkh@linuxfoundation.org \
--cc=huang.ying.caritas@gmail.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=ira.weiny@intel.com \
--cc=jack@suse.cz \
--cc=jonathan.cameron@huawei.com \
--cc=len.brown@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=ming.li@zohomail.com \
--cc=nathan.fontenot@amd.com \
--cc=nvdimm@lists.linux.dev \
--cc=pavel@ucw.cz \
--cc=peterz@infradead.org \
--cc=quic_jjohnson@quicinc.com \
--cc=rafael@kernel.org \
--cc=rrichter@amd.com \
--cc=terry.bowman@amd.com \
--cc=vishal.l.verma@intel.com \
--cc=willy@infradead.org \
--cc=y-goto@fujitsu.com \
--cc=yaoxt.fnst@fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox