Linux CXL
 help / color / mirror / Atom feed
From: Gregory Price <gregory.price@memverge.com>
To: nifan.cxl@gmail.com
Cc: qemu-devel@nongnu.org, jonathan.cameron@huawei.com,
	linux-cxl@vger.kernel.org, ira.weiny@intel.com,
	dan.j.williams@intel.com, a.manzanares@samsung.com,
	dave@stgolabs.net, nmtadam.samsung@gmail.com,
	jim.harris@samsung.com, Jorgen.Hansen@wdc.com,
	wj28.lee@gmail.com, Fan Ni <fan.ni@samsung.com>
Subject: Re: [PATCH v7 11/12] hw/cxl/cxl-mailbox-utils: Add superset extent release mailbox support
Date: Fri, 19 Apr 2024 14:20:15 -0400	[thread overview]
Message-ID: <ZiK136P4/tNU2AZZ@memverge.com> (raw)
In-Reply-To: <20240418232902.583744-12-fan.ni@samsung.com>

On Thu, Apr 18, 2024 at 04:11:02PM -0700, nifan.cxl@gmail.com wrote:
> From: Fan Ni <fan.ni@samsung.com>
> 
> With the change, we extend the extent release mailbox command processing
> to allow more flexible release. As long as the DPA range of the extent to
> release is covered by accepted extent(s) in the device, the release can be
> performed.
> 
> Signed-off-by: Fan Ni <fan.ni@samsung.com>
> ---
>  hw/cxl/cxl-mailbox-utils.c | 21 ++++++++-------------
>  1 file changed, 8 insertions(+), 13 deletions(-)
>

Hmmm.  This will complicate MHD accounting, but it looks ok to me as-is.

Reviewed-by: Gregory Price <gregory.price@memverge.com>

> diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
> index 57f1ce9cce..89f0ab8116 100644
> --- a/hw/cxl/cxl-mailbox-utils.c
> +++ b/hw/cxl/cxl-mailbox-utils.c
> @@ -1704,6 +1704,13 @@ static CXLRetCode cxl_dc_extent_release_dry_run(CXLType3Dev *ct3d,
>          dpa = in->updated_entries[i].start_dpa;
>          len = in->updated_entries[i].len;
>  
> +        /* Check if the DPA range is not fully backed with valid extents */
> +        if (!ct3_test_region_block_backed(ct3d, dpa, len)) {
> +            ret = CXL_MBOX_INVALID_PA;
> +            goto free_and_exit;
> +        }
> +
> +        /* After this point, extent overflow is the only error can happen */
>          while (len > 0) {
>              QTAILQ_FOREACH(ent, updated_list, node) {
>                  range_init_nofail(&range, ent->start_dpa, ent->len);
> @@ -1718,14 +1725,7 @@ static CXLRetCode cxl_dc_extent_release_dry_run(CXLType3Dev *ct3d,
>                      if (range_contains(&range, dpa + len - 1)) {
>                          len2 = ent_start_dpa + ent_len - dpa - len;
>                      } else {
> -                        /*
> -                         * TODO: we reject the attempt to remove an extent
> -                         * that overlaps with multiple extents in the device
> -                         * for now. We will allow it once superset release
> -                         * support is added.
> -                         */
> -                        ret = CXL_MBOX_INVALID_PA;
> -                        goto free_and_exit;
> +                        dpa = ent_start_dpa + ent_len;
>                      }
>                      len_done = ent_len - len1 - len2;
>  
> @@ -1752,14 +1752,9 @@ static CXLRetCode cxl_dc_extent_release_dry_run(CXLType3Dev *ct3d,
>                      }
>  
>                      len -= len_done;
> -                    /* len == 0 here until superset release is added */
>                      break;
>                  }
>              }
> -            if (len) {
> -                ret = CXL_MBOX_INVALID_PA;
> -                goto free_and_exit;
> -            }
>          }
>      }
>  free_and_exit:
> -- 
> 2.43.0
> 

  reply	other threads:[~2024-04-19 18:20 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18 23:10 [PATCH v7 00/12] Enabling DCD emulation support in Qemu nifan.cxl
2024-04-18 23:10 ` [PATCH v7 01/12] hw/cxl/cxl-mailbox-utils: Add dc_event_log_size field to output payload of identify memory device command nifan.cxl
2024-04-19 16:40   ` Gregory Price
2024-04-18 23:10 ` [PATCH v7 02/12] hw/cxl/cxl-mailbox-utils: Add dynamic capacity region representative and mailbox command support nifan.cxl
2024-04-19 16:44   ` Gregory Price
2024-04-18 23:10 ` [PATCH v7 03/12] include/hw/cxl/cxl_device: Rename mem_size as static_mem_size for type3 memory devices nifan.cxl
2024-04-19 16:45   ` Gregory Price
2024-04-18 23:10 ` [PATCH v7 04/12] hw/mem/cxl_type3: Add support to create DC regions to " nifan.cxl
2024-04-19 16:47   ` Gregory Price
2024-05-14  8:14   ` Zhijian Li (Fujitsu)
2024-05-16 17:06     ` fan
2024-04-18 23:10 ` [PATCH v7 05/12] hw/mem/cxl-type3: Refactor ct3_build_cdat_entries_for_mr to take mr size instead of mr as argument nifan.cxl
2024-04-19 16:39   ` Gregory Price
2024-04-18 23:10 ` [PATCH v7 06/12] hw/mem/cxl_type3: Add host backend and address space handling for DC regions nifan.cxl
2024-04-19 17:27   ` Gregory Price
2024-04-22 11:55     ` Jonathan Cameron
2024-04-22 11:52   ` Jonathan Cameron
2024-05-14  8:28   ` Zhijian Li (Fujitsu)
2024-05-16 17:07     ` fan
2024-04-18 23:10 ` [PATCH v7 07/12] hw/mem/cxl_type3: Add DC extent list representative and get DC extent list mailbox support nifan.cxl
2024-04-19 16:52   ` Gregory Price
2024-04-18 23:10 ` [PATCH v7 08/12] hw/cxl/cxl-mailbox-utils: Add mailbox commands to support add/release dynamic capacity response nifan.cxl
2024-04-19 18:12   ` Gregory Price
2024-04-18 23:11 ` [PATCH v7 09/12] hw/cxl/events: Add qmp interfaces to add/release dynamic capacity extents nifan.cxl
2024-04-19 18:13   ` Gregory Price
2024-04-22 12:01   ` Jonathan Cameron
2024-04-26  9:12   ` Markus Armbruster
2024-04-26 17:31     ` fan
2024-04-29  7:58       ` Markus Armbruster
2024-04-30 17:17         ` fan
2024-05-01 14:58           ` Jonathan Cameron
2024-05-01 22:36             ` fan
2024-06-04  9:18             ` Markus Armbruster
2024-06-04 11:54               ` Jonathan Cameron
2024-06-04 12:13                 ` Jonathan Cameron
2024-06-04 12:28                 ` Markus Armbruster
2024-04-30 17:21         ` Jonathan Cameron
2024-05-01 22:29         ` fan
2024-05-20 16:50           ` Jonathan Cameron
2024-05-20 17:55             ` fan
2024-05-21 23:32             ` fan
2024-05-23 15:31               ` Jonathan Cameron
2024-05-21 23:38             ` fan
2024-05-23 15:32               ` Jonathan Cameron
2024-05-14  2:35   ` Zhijian Li (Fujitsu)
2024-04-18 23:11 ` [PATCH v7 10/12] hw/mem/cxl_type3: Add DPA range validation for accesses to DC regions nifan.cxl
2024-04-19 16:57   ` Gregory Price
2024-04-18 23:11 ` [PATCH v7 11/12] hw/cxl/cxl-mailbox-utils: Add superset extent release mailbox support nifan.cxl
2024-04-19 18:20   ` Gregory Price [this message]
2024-04-18 23:11 ` [PATCH v7 12/12] hw/mem/cxl_type3: Allow to release extent superset in QMP interface nifan.cxl
2024-04-19 18:20   ` Gregory Price
2024-04-19 18:24 ` [PATCH v7 00/12] Enabling DCD emulation support in Qemu Gregory Price
2024-04-19 18:43   ` fan
2024-04-20 20:35     ` Gregory Price
2024-04-22 12:04       ` Jonathan Cameron
2024-04-22 14:23         ` Jonathan Cameron
2024-04-22 15:07           ` Jonathan Cameron
2024-04-22 15:42         ` Gregory Price
2024-05-16 17:05   ` fan
2024-05-17 12:18     ` Jonathan Cameron
2024-05-17 16:03       ` fan
2024-05-28 18:10     ` Gregory Price
2024-05-14  2:16 ` Zhijian Li (Fujitsu)
2024-05-16 17:12   ` fan
2024-05-17  2:20     ` Zhijian Li (Fujitsu)

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=ZiK136P4/tNU2AZZ@memverge.com \
    --to=gregory.price@memverge.com \
    --cc=Jorgen.Hansen@wdc.com \
    --cc=a.manzanares@samsung.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave@stgolabs.net \
    --cc=fan.ni@samsung.com \
    --cc=ira.weiny@intel.com \
    --cc=jim.harris@samsung.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nifan.cxl@gmail.com \
    --cc=nmtadam.samsung@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wj28.lee@gmail.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