All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny@intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: <linux-cxl@vger.kernel.org>,
	Vishal Verma <vishal.l.verma@intel.com>, <dave.jiang@intel.com>,
	<alison.schofield@intel.com>
Subject: Re: [PATCH] cxl/hdm: Fix skip allocations vs multiple pmem allocations
Date: Fri, 5 Aug 2022 15:36:53 -0700	[thread overview]
Message-ID: <Yu2bhYYdfQtkQBDS@iweiny-desk3> (raw)
In-Reply-To: <165973754730.1558392.15466392461645857658.stgit@dwillia2-xfh.jf.intel.com>

On Fri, Aug 05, 2022 at 03:12:27PM -0700, Dan Williams wrote:
> Vishal notes that when attempting to define a second pmem region on a
> device the DPA allocation fails with a message of the form:
> 
>     decoder11.1: failed to reserve skipped space
> 
> Recall that the skip setting is used when there is a pmem allocation in
> the presence of free ram DPA space. The first pmem allocation skips over
> the free ram and subsequent pmem allocations do not require a skip. The
> bug is that a skip is still attempted and the DPA reservation code
> flags the double skip allocation conflict.
> 
> Fixes: cf880423b6a0 ("cxl/hdm: Add support for allocating DPA to an endpoint decoder")
> Reported-by: Vishal Verma <vishal.l.verma@intel.com>
> Tested-by: Vishal Verma <vishal.l.verma@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> ---
>  drivers/cxl/core/hdm.c |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index e096f74e19df..d1d2caea5c62 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -445,7 +445,16 @@ int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size)
>  		start = free_pmem_start;
>  		avail = cxlds->pmem_res.end - start + 1;
>  		skip_start = free_ram_start;
> -		skip_end = start - 1;
> +
> +		/*
> +		 * If some pmem is already allocated, then that allocation
> +		 * already handled the skip.
> +		 */
> +		if (cxlds->pmem_res.child &&
> +		    skip_start == cxlds->pmem_res.child->start)
> +			skip_end = skip_start - 1;
> +		else
> +			skip_end = start - 1;
>  		skip = skip_end - skip_start + 1;
>  	} else {
>  		dev_dbg(dev, "mode not set\n");
> 

      reply	other threads:[~2022-08-05 22:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 22:12 [PATCH] cxl/hdm: Fix skip allocations vs multiple pmem allocations Dan Williams
2022-08-05 22:36 ` Ira Weiny [this message]

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=Yu2bhYYdfQtkQBDS@iweiny-desk3 \
    --to=ira.weiny@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.