Linux CXL
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
	"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH] cxl/region: reset the cxl endpoint decoder HPA range on teardown
Date: Fri, 5 Aug 2022 18:53:24 +0000	[thread overview]
Message-ID: <ff456afb0c3d8e7d286e38e130f32d9721e1e5ef.camel@intel.com> (raw)
In-Reply-To: <62eccfc72e340_151ced294d9@dwillia2-xfh.jf.intel.com.notmuch>

On Fri, 2022-08-05 at 01:07 -0700, Dan Williams wrote:
> Vishal Verma wrote:
> > The endpoint decoder HPA range gets set up during cxl_region_attach, but
> > cxl_region_detach() neglects to reset it back to a 'free' state. As a
> > result, a create-destroy-create cycle with the same region parameters
> > results in the second create-region failing with an EBUSY when trying to
> > reserver DPA.
> > 
> >   # cxl create-region -d decoder3.2 -m mem4 -g 1024
> >   cxl region: create_region: decoder11.1: set_dpa_size failed: Device or resource busy
> >   cxl region: cmd_create_region: created 0 regions
> > 
> > Set the endpoint decoder's hpa_range to [0, -1] to mark it as free in
> > cxl_region_detach().
> > 
> > Fixes: 292bdc6af8f2 ("cxl/region: Move HPA setup to cxl_region_attach()")
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> > ---
> >  drivers/cxl/core/region.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > Hi Dan,
> > 
> > This is a fixup-to-a-fixup, and the commit in Fixes: is only in
> > 'preview'. Feel free to squash this into the original fix if you so
> > prefer.
> 
> Will do, I think this also needs to kill the cxld_clear_hpa() helper and
> call in cxl_decoder_reset().
> 
> > Another question - should we be resetting the endpoint decoder's mode to
> > CXL_DECODER_DEAD while in here? I notice that a freed decoder still
> > lists mode:pmem in cxl-list.
> 
> The DEAD state is a internal-only hack while the decoder is being torn
> down, it's not visible to userspace. Perhaps just hide the none state
> and default the mode to 'ram' when no DPA is allocated?

Yeah that seems reasonable.

      reply	other threads:[~2022-08-05 18:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05  6:49 [PATCH] cxl/region: reset the cxl endpoint decoder HPA range on teardown Vishal Verma
2022-08-05  8:07 ` Dan Williams
2022-08-05 18:53   ` Verma, Vishal L [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=ff456afb0c3d8e7d286e38e130f32d9721e1e5ef.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    /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