All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: <alison.schofield@intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	Dave Jiang <dave.jiang@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	<linux-cxl@vger.kernel.org>
Subject: Re: [PATCH v3 3/4] cxl/core: Add locked variants of the poison inject and clear funcs
Date: Wed, 16 Jul 2025 11:58:09 +0100	[thread overview]
Message-ID: <20250716115809.000057db@huawei.com> (raw)
In-Reply-To: <fce084f133cd1d53fe442ae67dc0cf3b00b2c2af.1752365427.git.alison.schofield@intel.com>

On Sat, 12 Jul 2025 19:37:56 -0700
alison.schofield@intel.com wrote:

> From: Alison Schofield <alison.schofield@intel.com>
> 
> The core functions that validate and send inject and clear commands
> to the memdev devices require holding both the dpa_rwsem and the
> region_rwsem.
> 
> In preparation for another caller of these functions that must hold
> the locks upon entry, split the work into a locked and unlocked pair.
> 
> Consideration was given to moving the locking to both callers,
> however, the existing caller is not in the core (mem.c) and cannot
> access the locks.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>

Trivial comment to cleanup inline.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> @@ -324,9 +319,26 @@ int cxl_inject_poison(struct cxl_memdev *cxlmd, u64 dpa)
>  
>  	return 0;
>  }
> +
> +int cxl_inject_poison(struct cxl_memdev *cxlmd, u64 dpa)
> +{
> +	int rc;
> +
> +	ACQUIRE(rwsem_read_intr, region_rwsem)(&cxl_rwsem.region);
> +	if ((rc = ACQUIRE_ERR(rwsem_read_intr, &region_rwsem)))
> +		return rc;
> +
> +	ACQUIRE(rwsem_read_intr, dpa_rwsem)(&cxl_rwsem.dpa);
> +	if ((rc = ACQUIRE_ERR(rwsem_read_intr, &dpa_rwsem)))
> +		return rc;
> +
> +	rc = cxl_inject_poison_locked(cxlmd, dpa);
> +
> +	return rc;

	return cxl_inject_poison_locked(cxlmd, dpa);

> +}
>  EXPORT_SYMBOL_NS_GPL(cxl_inject_poison, "CXL");

> +
> +int cxl_clear_poison(struct cxl_memdev *cxlmd, u64 dpa)
> +{
> +	int rc;
> +
> +	ACQUIRE(rwsem_read_intr, region_rwsem)(&cxl_rwsem.region);
> +	if ((rc = ACQUIRE_ERR(rwsem_read_intr, &region_rwsem)))
> +		return rc;
> +
> +	ACQUIRE(rwsem_read_intr, dpa_rwsem)(&cxl_rwsem.dpa);
> +	if ((rc = ACQUIRE_ERR(rwsem_read_intr, &dpa_rwsem)))
> +		return rc;
> +
> +	rc = cxl_clear_poison_locked(cxlmd, dpa);
> +
> +	return rc;
> +}

	return cxl_clear_poison_locked(cxlmd, dpa);

I wondered if this was to save churn in a later patch, but
not seeing anything related in patch 4.

>  EXPORT_SYMBOL_NS_GPL(cxl_clear_poison, "CXL");



  parent reply	other threads:[~2025-07-16 10:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-13  2:37 [PATCH v3 0/4] cxl: Support Poison Inject & Clear by Region Offset alison.schofield
2025-07-13  2:37 ` [PATCH v3 1/4] cxl: Define a SPA->CXL HPA root decoder callback for XOR Math alison.schofield
2025-07-13  2:37 ` [PATCH v3 2/4] cxl/region: Introduce SPA to DPA address translation alison.schofield
2025-07-16 10:52   ` Jonathan Cameron
2025-07-16 21:26     ` Alison Schofield
2025-07-21 10:35       ` Jonathan Cameron
2025-07-22  0:49     ` Alison Schofield
2025-07-13  2:37 ` [PATCH v3 3/4] cxl/core: Add locked variants of the poison inject and clear funcs alison.schofield
2025-07-15 21:33   ` Dave Jiang
2025-07-16 10:58   ` Jonathan Cameron [this message]
2025-07-22  1:11     ` Alison Schofield
2025-07-13  2:37 ` [PATCH v3 4/4] cxl/region: Add inject and clear poison by region offset alison.schofield
2025-07-13 17:23   ` kernel test robot
2025-07-16 11:02   ` Jonathan Cameron

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=20250716115809.000057db@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@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.