linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>
To: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>,
	"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>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@kernel.org>,
	Li Ming <ming.li@zohomail.com>,
	Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
	Ying Huang <huang.ying.caritas@gmail.com>,
	"Xingtao Yao (Fujitsu)" <yaoxt.fnst@fujitsu.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Nathan Fontenot <nathan.fontenot@amd.com>,
	Terry Bowman <terry.bowman@amd.com>,
	Robert Richter <rrichter@amd.com>,
	Benjamin Cheatham <benjamin.cheatham@amd.com>,
	PradeepVineshReddy Kodamati <PradeepVineshReddy.Kodamati@amd.com>
Subject: Re: [PATCH v5 0/7] Add managed SOFT RESERVE resource handling
Date: Mon, 21 Jul 2025 07:38:11 +0000	[thread overview]
Message-ID: <1e2046f3-6fe5-432f-b5e8-a9d9be99e7cd@fujitsu.com> (raw)
In-Reply-To: <20250715180407.47426-1-Smita.KoralahalliChannabasappa@amd.com>

Smita,

I have not yet to complete all of my local patterns. Nonetheless, in addition to the issues highlighted by Alison, I have also encountered some regressions.

Based on your conversation with Alison, it appears you have decided to have a refactor. Thus, I intend to stop testing on this version until the updated iteration is available.

Here is what I have verified thus far (kernel built upon the cxl/next 20250718):

A) No Soft reserved (BIOS did not expose EFI_SPECIAL_PURPOSE)
- A.1 Decoder not committed (default QEMU emulation)

Before:
```
fffc0000-ffffffff : Reserved
100000000-27fffffff : System RAM
5c0001128-5c00011b7 : port1
5d0000000-6cfffffff : CXL Window 0
6d0000000-7cfffffff : CXL Window 1
7000000000-700000ffff : PCI Bus 0000:0c
   7000000000-700000ffff : 0000:0c:00.0
7000010000-700001ffff : PCI Bus 0000:0e
   7000010000-700001ffff : 0000:0e:00.0
     7000011080-70000110d7 : mem0
```
After (CXL window is absent):
```
fed00000-fed003ff : PNP0103:00
fed1c000-fed1ffff : Reserved
feffc000-feffffff : Reserved
fffc0000-ffffffff : Reserved
100000000-27fffffff : System RAM
7000000000-700000ffff : PCI Bus 0000:0c
   7000000000-700000ffff : 0000:0c:00.0
7000010000-700001ffff : PCI Bus 0000:0e
   7000010000-700001ffff : 0000:0e:00.0
7000020000-703fffffff : PCI Bus 0000:00
```
- A.2 Decoder is committed

Before:
```
100000000-27fffffff : System RAM
5c0001128-5c00011b7 : port1
5d0000000-6cfffffff : CXL Window 0
   5d0000000-6cfffffff : region0
     5d0000000-6cfffffff : dax0.0
       5d0000000-6cfffffff : System RAM (kmem)
7000000000-700000ffff : PCI Bus 0000:0c
   7000000000-700000ffff : 0000:0c:00.0
```
After (CXL window is absent):
```
feffc000-feffffff : Reserved
fffc0000-ffffffff : Reserved
100000000-27fffffff : System RAM
7000000000-700000ffff : PCI Bus 0000:0c
   7000000000-700000ffff : 0000:0c:00.0
7000010000-700001ffff : PCI Bus 0000:0e
   7000010000-700001ffff : 0000:0e:00.0
7000020000-703fffffff : PCI Bus 0000:00
```

B) EFI_SPECIAL_PURPOSE is set
- B.1 Decoder not committed

Before:
```
5d0000000-7cfffffff : Soft Reserved
   5d0000000-6cfffffff : CXL Window 0
   6d0000000-7cfffffff : CXL Window 1
```
After (fallback to hmem):
```
5d0000000-7cfffffff : Soft Reserved
   5d0000000-7cfffffff : dax0.0
     5d0000000-7cfffffff : System RAM (kmem)
```

- B.2 Decoder is committed

Before:
```
5d0000000-6cfffffff : CXL Window 0
   5d0000000-6cfffffff : region0
     5d0000000-6cfffffff : Soft Reserved
       5d0000000-6cfffffff : dax0.0
         5d0000000-6cfffffff : System RAM (kmem)
```
After (fallback to hmem):
```
5d0000000-6cfffffff : Soft Reserved
   5d0000000-6cfffffff : dax0.0
     5d0000000-6cfffffff : System RAM (kmem)
```

Thanks
Zhijian



On 16/07/2025 02:04, Smita Koralahalli wrote:
> This series introduces the ability to manage SOFT RESERVED iomem
> resources, enabling the CXL driver to remove any portions that
> intersect with created CXL regions.
> 
> The current approach of leaving SOFT RESERVED entries as is can result
> in failures during device hotplug such as CXL because the address range
> remains reserved and unavailable for reuse even after region teardown.
> 
> To address this, the CXL driver now uses a background worker that waits
> for cxl_mem driver probe to complete before scanning for intersecting
> resources. Then the driver walks through created CXL regions to trim any
> intersections with SOFT RESERVED resources in the iomem tree.
> 
> The following scenarios have been tested:
> 
> Example 1: Exact alignment, soft reserved is a child of the region
> 
> |---------- "Soft Reserved" -----------|
> |-------------- "Region #" ------------|
> 
> Before:
>    1050000000-304fffffff : CXL Window 0
>      1050000000-304fffffff : region0
>        1050000000-304fffffff : Soft Reserved
>          1080000000-2fffffffff : dax0.0
>            1080000000-2fffffffff : System RAM (kmem)
> 
> After:
>    1050000000-304fffffff : CXL Window 0
>      1050000000-304fffffff : region0
>        1080000000-2fffffffff : dax0.0
>          1080000000-2fffffffff : System RAM (kmem)
> 
> Example 2: Start and/or end aligned and soft reserved spans multiple
> regions
> |----------- "Soft Reserved" -----------|
> |-------- "Region #" -------|
> or
> |----------- "Soft Reserved" -----------|
>              |-------- "Region #" -------|
> 
> Before:
>    850000000-684fffffff : Soft Reserved
>      850000000-284fffffff : CXL Window 0
>        850000000-284fffffff : region3
>          850000000-284fffffff : dax0.0
>            850000000-284fffffff : System RAM (kmem)
>      2850000000-484fffffff : CXL Window 1
>        2850000000-484fffffff : region4
>          2850000000-484fffffff : dax1.0
>            2850000000-484fffffff : System RAM (kmem)
>      4850000000-684fffffff : CXL Window 2
>        4850000000-684fffffff : region5
>          4850000000-684fffffff : dax2.0
>            4850000000-684fffffff : System RAM (kmem)
> 
> After:
>    850000000-284fffffff : CXL Window 0
>      850000000-284fffffff : region3
>        850000000-284fffffff : dax0.0
>          850000000-284fffffff : System RAM (kmem)
>    2850000000-484fffffff : CXL Window 1
>      2850000000-484fffffff : region4
>        2850000000-484fffffff : dax1.0
>          2850000000-484fffffff : System RAM (kmem)
>    4850000000-684fffffff : CXL Window 2
>      4850000000-684fffffff : region5
>        4850000000-684fffffff : dax2.0
>          4850000000-684fffffff : System RAM (kmem)
> 
> Example 3: No alignment
> |---------- "Soft Reserved" ----------|
> 	|---- "Region #" ----|
> 
> Before:
>    00000000-3050000ffd : Soft Reserved
>      ..
>      ..
>      1050000000-304fffffff : CXL Window 0
>        1050000000-304fffffff : region1
>          1080000000-2fffffffff : dax0.0
>            1080000000-2fffffffff : System RAM (kmem)
> 
> After:
>    00000000-104fffffff : Soft Reserved
>      ..
>      ..
>    1050000000-304fffffff : CXL Window 0
>      1050000000-304fffffff : region1
>        1080000000-2fffffffff : dax0.0
>          1080000000-2fffffffff : System RAM (kmem)
>    3050000000-3050000ffd : Soft Reserved
> 
> Link to v4:
> https://lore.kernel.org/linux-cxl/20250603221949.53272-1-Smita.KoralahalliChannabasappa@amd.com
> 
> v5 updates:
>   - Handled cases where CXL driver loads early even before HMEM driver is
>     initialized.
>   - Introduced callback functions to resolve dependencies.
>   - Rename suspend.c to probe_state.c.
>   - Refactor cxl_acpi_probe() to use a single exit path.
>   - Commit description update to justify cxl_mem_active() usage.
>   - Change from kmalloc -> kzalloc in add_soft_reserved().
>   - Change from goto to if else blocks inside remove_soft_reserved().
>   - DEFINE_RES_MEM_NAMED -> DEFINE_RES_NAMED_DESC.
>   - Comments for flags inside remove_soft_reserved().
>   - Add resource_lock inside normalize_resource().
>   - bus_find_next_device -> bus_find_device.
>   - Skip DAX consumption of soft reserves inside hmat with
>     CONFIG_CXL_ACPI checks.
> 
> v4 updates:
>   - Split first patch into 4 smaller patches.
>   - Correct the logic for cxl_pci_loaded() and cxl_mem_active() to return
>     false at default instead of true.
>   - Cleanup cxl_wait_for_pci_mem() to remove config checks for cxl_pci
>     and cxl_mem.
>   - Fixed multiple bugs and build issues which includes correcting
>     walk_iomem_resc_desc() and calculations of alignments.
>   
> 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 mem drivers to load.
> 
> Smita Koralahalli (7):
>    cxl/acpi: Refactor cxl_acpi_probe() to always schedule fallback DAX
>      registration
>    cxl/core: Rename suspend.c to probe_state.c and remove
>      CONFIG_CXL_SUSPEND
>    cxl/acpi: Add background worker to coordinate with cxl_mem probe
>      completion
>    cxl/region: Introduce SOFT RESERVED resource removal on region
>      teardown
>    dax/hmem: Save the DAX HMEM platform device pointer
>    dax/hmem, cxl: Defer DAX consumption of SOFT RESERVED resources until
>      after CXL region creation
>    dax/hmem: Preserve fallback SOFT RESERVED regions if DAX HMEM loads
>      late
> 
>   drivers/acpi/numa/hmat.c                      |   4 +
>   drivers/cxl/Kconfig                           |   4 -
>   drivers/cxl/acpi.c                            |  50 +++++--
>   drivers/cxl/core/Makefile                     |   2 +-
>   drivers/cxl/core/{suspend.c => probe_state.c} |  10 +-
>   drivers/cxl/core/region.c                     | 135 ++++++++++++++++++
>   drivers/cxl/cxl.h                             |   4 +
>   drivers/cxl/cxlmem.h                          |   9 --
>   drivers/dax/hmem/Makefile                     |   1 +
>   drivers/dax/hmem/device.c                     |  62 ++++----
>   drivers/dax/hmem/hmem.c                       |  14 +-
>   drivers/dax/hmem/hmem_notify.c                |  29 ++++
>   include/linux/dax.h                           |   7 +-
>   include/linux/ioport.h                        |   1 +
>   include/linux/pm.h                            |   7 -
>   kernel/resource.c                             |  34 +++++
>   16 files changed, 307 insertions(+), 66 deletions(-)
>   rename drivers/cxl/core/{suspend.c => probe_state.c} (62%)
>   create mode 100644 drivers/dax/hmem/hmem_notify.c
> 

  parent reply	other threads:[~2025-07-21  7:38 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 18:04 [PATCH v5 0/7] Add managed SOFT RESERVE resource handling Smita Koralahalli
2025-07-15 18:04 ` [PATCH v5 1/7] cxl/acpi: Refactor cxl_acpi_probe() to always schedule fallback DAX registration Smita Koralahalli
2025-07-22 21:04   ` dan.j.williams
2025-07-23  0:45     ` Alison Schofield
2025-07-23  7:34       ` dan.j.williams
2025-07-15 18:04 ` [PATCH v5 2/7] cxl/core: Rename suspend.c to probe_state.c and remove CONFIG_CXL_SUSPEND Smita Koralahalli
2025-07-22 21:44   ` dan.j.williams
2025-07-15 18:04 ` [PATCH v5 3/7] cxl/acpi: Add background worker to coordinate with cxl_mem probe completion Smita Koralahalli
2025-07-17  0:24   ` Dave Jiang
2025-07-23  7:31   ` dan.j.williams
2025-07-23 16:13     ` dan.j.williams
2025-08-05  3:58       ` Zhijian Li (Fujitsu)
2025-08-20 23:14         ` Alison Schofield
2025-08-21  2:30           ` Zhijian Li (Fujitsu)
2025-08-22  3:56             ` Koralahalli Channabasappa, Smita
2025-08-25  7:50               ` Zhijian Li (Fujitsu)
2025-08-27  6:30                 ` Zhijian Li (Fujitsu)
2025-08-28 23:21                   ` Koralahalli Channabasappa, Smita
2025-09-01  2:46                     ` Zhijian Li (Fujitsu)
2025-07-29 15:48     ` Koralahalli Channabasappa, Smita
2025-07-30 16:09       ` dan.j.williams
2025-07-15 18:04 ` [PATCH v5 4/7] cxl/region: Introduce SOFT RESERVED resource removal on region teardown Smita Koralahalli
2025-07-17  0:42   ` Dave Jiang
2025-07-15 18:04 ` [PATCH v5 5/7] dax/hmem: Save the DAX HMEM platform device pointer Smita Koralahalli
2025-07-15 18:04 ` [PATCH v5 6/7] dax/hmem, cxl: Defer DAX consumption of SOFT RESERVED resources until after CXL region creation Smita Koralahalli
2025-07-15 18:04 ` [PATCH v5 7/7] dax/hmem: Preserve fallback SOFT RESERVED regions if DAX HMEM loads late Smita Koralahalli
2025-07-15 21:07 ` [PATCH v5 0/7] Add managed SOFT RESERVE resource handling Alison Schofield
2025-07-16  6:01   ` Koralahalli Channabasappa, Smita
2025-07-16 20:20     ` Alison Schofield
2025-07-16 21:29       ` Koralahalli Channabasappa, Smita
2025-07-16 23:48         ` Alison Schofield
2025-07-17 17:58           ` Koralahalli Channabasappa, Smita
2025-07-17 19:06             ` Dave Jiang
2025-07-17 23:20               ` Koralahalli Channabasappa, Smita
2025-07-17 23:30                 ` Dave Jiang
2025-07-23 15:24     ` dan.j.williams
2025-07-21  7:38 ` Zhijian Li (Fujitsu) [this message]
2025-07-22 20:07 ` dan.j.williams

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=1e2046f3-6fe5-432f-b5e8-a9d9be99e7cd@fujitsu.com \
    --to=lizhijian@fujitsu.com \
    --cc=PradeepVineshReddy.Kodamati@amd.com \
    --cc=Smita.KoralahalliChannabasappa@amd.com \
    --cc=alison.schofield@intel.com \
    --cc=benjamin.cheatham@amd.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=huang.ying.caritas@gmail.com \
    --cc=ira.weiny@intel.com \
    --cc=jack@suse.cz \
    --cc=jeff.johnson@oss.qualcomm.com \
    --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=ming.li@zohomail.com \
    --cc=nathan.fontenot@amd.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=pavel@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rrichter@amd.com \
    --cc=terry.bowman@amd.com \
    --cc=vishal.l.verma@intel.com \
    --cc=willy@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).