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>
Cc: "Schofield, Alison" <alison.schofield@intel.com>,
	"Jiang, Dave" <dave.jiang@intel.com>,
	"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>,
	"Weiny, Ira" <ira.weiny@intel.com>
Subject: Re: [ndctl PATCH v2 05/10] libcxl: add low level APIs for region creation
Date: Thu, 11 Aug 2022 21:34:49 +0000	[thread overview]
Message-ID: <7dcfaa439df6cdd4f5019f4eea557011221cf617.camel@intel.com> (raw)
In-Reply-To: <62f54da3f6bd_3ce68294d9@dwillia2-xfh.jf.intel.com.notmuch>

On Thu, 2022-08-11 at 11:42 -0700, Dan Williams wrote:
> Verma, Vishal L wrote:
> > On Wed, 2022-08-10 at 20:05 -0700, Dan Williams wrote:
> > 
> > 
> > [snip]
> > 
> > > 
> > > > +CXL_EXPORT struct cxl_region *
> > > > +cxl_decoder_create_pmem_region(struct cxl_decoder *decoder)
> > > > +{
> > > > +       struct cxl_ctx *ctx = cxl_decoder_get_ctx(decoder);
> > > > +       char *path = decoder->dev_buf;
> > > > +       char buf[SYSFS_ATTR_SIZE];
> > > > +       struct cxl_region *region;
> > > > +       int rc;
> > > > +
> > > > +       sprintf(path, "%s/create_pmem_region", decoder->dev_path);
> > > > +       rc = sysfs_read_attr(ctx, path, buf);
> > > > +       if (rc < 0) {
> > > > +               err(ctx, "failed to read new region name: %s\n",
> > > > +                   strerror(-rc));
> > > > +               return NULL;
> > > > +       }
> > > > +
> > > > +       rc = sysfs_write_attr(ctx, path, buf);
> > > > +       if (rc < 0) {
> > > > +               err(ctx, "failed to write new region name: %s\n",
> > > > +                   strerror(-rc));
> > > > +               return NULL;
> > > > +       }
> > > 
> > > I think there either needs to be a "decoder->regions_init = 0" here, or
> > > a direct call to "add_cxl_region(decoder...)" just in case this context
> > > had already listed regions before creating a new one.
> > > 
> > > I like the precision of "add_cxl_region()", but that needs to open code
> > > some of the internals of sysfs_device_parse(), so maybe
> > > "decoder->regions_init = 0" is ok for now.
> > 
> > Yes, I found that out - and added this - in patch 10 (I can instead
> > move it here - it makes sense).
> > 
> > Until patch 10, during region creation, nothing had done regions_init
> > until this point, so this happens to work. Patch 10 where we do walk
> > the regions before this point to calculate the max available space,
> > necessitates the reset here.
> > 
> > That being said, potentially all of patch 10 is squash-able into
> > different bits of the series - I left it at the end so the
> > max_available_extent stuff can be reviewed on its own.
> > 
> > I'm happy to go either way on squashing it or keeping it standalone.
> 
> If this was the kernel I would say squash, since bisecting might be
> impacted, but as long as the fix is there later in the series I think
> that's ok.
> 
> Note, I was less worried about the cxl-cli tool tripping over this, and
> more about 3rd party applications using libcxl, but those are even less
> likely to use a mid-release commit.


I think moving just the invalidation here to preserve bisectability for
non cxl-cli users makes sense. 

  reply	other threads:[~2022-08-11 21:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10 23:09 [ndctl PATCH v2 00/10] cxl: add region management Vishal Verma
2022-08-10 23:09 ` [ndctl PATCH v2 01/10] libcxl: add a depth attribute to cxl_port Vishal Verma
2022-08-10 23:09 ` [ndctl PATCH v2 02/10] cxl/port: Consolidate the debug option in cxl-port man pages Vishal Verma
2022-08-10 23:09 ` [ndctl PATCH v2 03/10] libcxl: Introduce libcxl region and mapping objects Vishal Verma
2022-08-10 23:09 ` [ndctl PATCH v2 04/10] cxl-cli: add region listing support Vishal Verma
2022-08-11  2:24   ` Dan Williams
2022-08-10 23:09 ` [ndctl PATCH v2 05/10] libcxl: add low level APIs for region creation Vishal Verma
2022-08-11  3:05   ` Dan Williams
2022-08-11  4:08     ` Verma, Vishal L
2022-08-11 18:42       ` Dan Williams
2022-08-11 21:34         ` Verma, Vishal L [this message]
2022-08-10 23:09 ` [ndctl PATCH v2 06/10] cxl: add a 'create-region' command Vishal Verma
2022-08-11 19:34   ` Dan Williams
2022-08-11 21:53     ` Verma, Vishal L
2022-08-11 23:02       ` Dan Williams
2022-08-10 23:09 ` [ndctl PATCH v2 07/10] cxl: add commands to {enable,disable,destroy}-region Vishal Verma
2022-08-10 23:09 ` [ndctl PATCH v2 08/10] cxl/list: make memdevs and regions the default listing Vishal Verma
2022-08-10 23:09 ` [ndctl PATCH v2 09/10] test: add a cxl-create-region test Vishal Verma
2022-08-11 19:47   ` Dan Williams
2022-08-10 23:09 ` [ndctl PATCH v2 10/10] cxl/decoder: add a max_available_extent attribute Vishal Verma
2022-08-11 20:22   ` Dan Williams
2022-08-11 21:57     ` Verma, Vishal L

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=7dcfaa439df6cdd4f5019f4eea557011221cf617.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    /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