[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z8tOrqOnkv-ZUsEy@aschofie-mobl2.lan>
Date: Fri, 7 Mar 2025 11:53:18 -0800
From: Alison Schofield <alison.schofield@...el.com>
To: shiju.jose@...wei.com
Cc: linux-cxl@...r.kernel.org, dan.j.williams@...el.com, dave@...olabs.net,
jonathan.cameron@...wei.com, dave.jiang@...el.com,
vishal.l.verma@...el.com, ira.weiny@...el.com, david@...hat.com,
Vilas.Sridharan@....com, linux-edac@...r.kernel.org,
linux-acpi@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, bp@...en8.de, tony.luck@...el.com,
rafael@...nel.org, lenb@...nel.org, mchehab@...nel.org,
leo.duran@....com, Yazen.Ghannam@....com, rientjes@...gle.com,
jiaqiyan@...gle.com, Jon.Grimm@....com, dave.hansen@...ux.intel.com,
naoya.horiguchi@....com, james.morse@....com, jthoughton@...gle.com,
somasundaram.a@....com, erdemaktas@...gle.com, pgonda@...gle.com,
duenwen@...gle.com, gthelen@...gle.com,
wschwartz@...erecomputing.com, dferguson@...erecomputing.com,
wbs@...amperecomputing.com, nifan.cxl@...il.com,
tanxiaofei@...wei.com, prime.zeng@...ilicon.com,
roberto.sassu@...wei.com, kangkang.shen@...urewei.com,
wanghuiqiang@...wei.com, linuxarm@...wei.com
Subject: Re: [PATCH 2/8] cxl/memfeature: Add CXL memory device patrol scrub
control feature
On Thu, Feb 27, 2025 at 10:38:09PM +0000, shiju.jose@...wei.com wrote:
> From: Shiju Jose <shiju.jose@...wei.com>
snip
>
> +static int cxl_ps_get_attrs(struct cxl_patrol_scrub_context *cxl_ps_ctx,
> + struct cxl_memdev_ps_params *params)
> +{
> + struct cxl_mailbox *cxl_mbox;
> + struct cxl_memdev *cxlmd;
> + u16 min_scrub_cycle = 0;
> + int i, ret;
> +
> + if (cxl_ps_ctx->cxlr) {
> + struct cxl_region *cxlr = cxl_ps_ctx->cxlr;
> + struct cxl_region_params *p = &cxlr->params;
> +
> + ret = cxl_hold_region_and_dpa();
> + if (ret)
> + return ret;
> + for (i = p->interleave_ways - 1; i >= 0; i--) {
> + struct cxl_endpoint_decoder *cxled = p->targets[i];
> +
Hi Shiju,
Although not functionally wrong, the above for loop caught my eye.
p->nr_targets is a better loop initializer when walking p->targets[]
(at this point nr_targets better equal interleave ways but lets use
the count intended for the array being walked)
Is there a reason to walk in reverse? This seems clearer:
for (i = 0; i < p->nr_targets; i++)
The same for loop header repeats below in:
cxl_ps_set_attrs()
cxl_region_scrub_init()
If you change for one, change for all.
snip
> +static int cxl_memdev_scrub_init(struct cxl_memdev *cxlmd,
> + struct edac_dev_feature *ras_feature, u8 scrub_inst)
> +{
> + struct cxl_patrol_scrub_context *cxl_ps_ctx;
> + struct cxl_feat_entry *feat_entry;
> +
> + feat_entry = cxl_get_feature_entry(cxlmd->cxlds, &CXL_FEAT_PATROL_SCRUB_UUID);
> + if (IS_ERR(feat_entry))
> + return -EOPNOTSUPP;
> +
Along w patch 1 comment, perhaps just check for (!feat_entry) here
and in a couple of other places below.
snip
>
Powered by blists - more mailing lists