nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "Cao, Quanquan/曹 全全" <caoqq@fujitsu.com>
To: Dave Jiang <dave.jiang@intel.com>,
	linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev
Cc: vishal.l.verma@intel.com, alison.schofield@intel.com
Subject: Re: [NDCTL PATCH v2 2/2] cxl: Add check for regions before disabling memdev
Date: Thu, 30 Nov 2023 16:29:24 +0800	[thread overview]
Message-ID: <766e7de9-8f08-73f2-fc7f-253930f95625@fujitsu.com> (raw)
In-Reply-To: <170120423751.2725915.8152057882418377474.stgit@djiang5-mobl3>


>   static int action_disable(struct cxl_memdev *memdev, struct action_context *actx)
>   {
> +	struct cxl_endpoint *ep;
> +	struct cxl_port *port;
> +
>   	if (!cxl_memdev_is_enabled(memdev))
>   		return 0;
>   
> -	if (!param.force) {
> -		/* TODO: actually detect rather than assume active */
> +	ep = cxl_memdev_get_endpoint(memdev);
> +	if (!ep)
> +		return -ENODEV;
> +
> +	port = cxl_endpoint_get_port(ep);
> +	if (!port)
> +		return -ENODEV;
> +
> +	if (cxl_port_decoders_committed(port)) {
>   		log_err(&ml, "%s is part of an active region\n",
>   			cxl_memdev_get_devname(memdev));
> -		return -EBUSY;
> +		if (!param.force)
> +			return -EBUSY;
>   	}
>   
>   	return cxl_memdev_disable_invalidate(memdev);
> 
> 
Hi Dave,
Do you think adding one more prompt message would be more user-friendly?

code:
         if (cxl_port_decoders_committed(port)) {
                 log_err(&ml, "%s is part of an active region\n",
                         cxl_memdev_get_devname(memdev));
                 if (!param.force)
                         return -EBUSY;
                 else
                         log_err(&ml,"Forcing memdev disable with an 
active region\n");
         }

output:
[root@fedora-37-client ndctl]# cxl disable-memdev mem0 -f
cxl memdev: action_disable: mem0 is part of an active region
cxl memdev: action_disable: Forcing memdev disable with an active region
cxl memdev: cmd_disable_memdev: disabled 1 mem

  parent reply	other threads:[~2023-11-30  8:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 20:43 [NDCTL PATCH v2 1/2] cxl: Save the number of decoders committed to a port Dave Jiang
2023-11-28 20:43 ` [NDCTL PATCH v2 2/2] cxl: Add check for regions before disabling memdev Dave Jiang
2023-11-30  1:41   ` Cao, Quanquan/曹 全全
2023-11-30  8:29   ` Cao, Quanquan/曹 全全 [this message]
2023-11-30 16:07     ` Dave Jiang
2023-11-30 21:51     ` [NDCTL PATCH v3 " Dave Jiang
2024-04-17  6:46       ` Yao Xingtao
2024-04-17 18:14         ` Verma, Vishal L
2024-04-22  7:26           ` Re: Xingtao Yao (Fujitsu)
2024-04-25  5:30           ` [NDCTL PATCH v3 2/2] cxl: Add check for regions before disabling memdev Zhijian Li (Fujitsu)
2024-04-25 16:52             ` Alison Schofield
2024-04-26  1:57               ` 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=766e7de9-8f08-73f2-fc7f-253930f95625@fujitsu.com \
    --to=caoqq@fujitsu.com \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).