Linux CXL
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@fujitsu.com>
To: Dave Jiang <dave.jiang@intel.com>, vishal.l.verma@intel.com
Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev,
	"lizhijian@fujitsu.com" <lizhijian@fujitsu.com>,
	caoqq@fujitsu.com
Subject: Re: [NDCTL PATCH v2] cxl/region: Add -f option for disable-region
Date: Mon, 30 Oct 2023 12:33:40 +0800	[thread overview]
Message-ID: <c460ae5c-1685-9e41-5531-8b8016645f70@fujitsu.com> (raw)
In-Reply-To: <7a01a5aa-678d-42ff-a877-8aaa8feb3fbd@intel.com>

On 2023/10/14 6:38, Dave Jiang wrote:
> 
> On 10/9/23 03:52, Xiao Yang wrote:
>> On 2023/9/21 6:57, Dave Jiang wrote:
>>> +        if (daxctl_memory_online_no_movable(mem)) {
>>> +            log_err(&rl, "%s: memory unmovable for %s\n",
>>> +                    devname,
>>> +                    daxctl_dev_get_devname(dev));
>>> +            return -EPERM;
>>> +        }
>> Hi Dave,
>>
>> It seems wrong to check if memory is unmovable by the return number of daxctl_memory_online_no_movable(mem) here. IIRC, the return number of daxctl_memory_online_no_movable(mem)/daxctl_memory_op(MEM_GET_ZONE) indicates how many memory blocks have the same memory zone. So I think you should check mem->zone and MEM_ZONE_NORMAL as daxctl_memory_is_movable() did.
> Do you mean:
> rc = daxctl_memory_online_no_movable(mem);
> if (rc < 0)
> 	return rc;
> if (rc > 0) {
> 	log_err(&rl, "%s memory unmovable for %s\n' ...);
> 	return -EPERM;
> }
> 
Hi Dave,

Sorry for the late reply.

Is it necessary to try to online the memory region to the 
MEM_ZONE_NORMAL by daxctl_memory_online_no_movable(mem)? If you just 
want to check if the onlined memory region is in the MEM_ZONE_NORMAL, 
the following code seems better:
     mem->zone = 0;
     rc = daxctl_memory_op(mem, MEM_GET_ZONE);
     if (rc < 0)
         return rc;
     if (mem->zone == MEM_ZONE_NORMAL) {
         log_err(&rl, "%s memory unmovable for %s\n' ...);
	return -EPERM;
     }

Best Regards,
Xiao Yang

  reply	other threads:[~2023-10-30  4:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 22:57 [NDCTL PATCH v2] cxl/region: Add -f option for disable-region Dave Jiang
2023-09-21  2:58 ` Zhijian Li (Fujitsu)
2023-09-21 23:19   ` Dave Jiang
2023-09-22  1:26     ` Zhijian Li (Fujitsu)
2023-10-09 10:52 ` Xiao Yang
2023-10-13 22:38   ` Dave Jiang
2023-10-30  4:33     ` Xiao Yang [this message]
2023-10-30 16:24       ` Dave Jiang
2023-10-30 18:31         ` Dan Williams
2023-10-30 21:30           ` Dave Jiang

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=c460ae5c-1685-9e41-5531-8b8016645f70@fujitsu.com \
    --to=yangx.jy@fujitsu.com \
    --cc=caoqq@fujitsu.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --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