lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z8uCBJDbAHI_u3LC@aschofie-mobl2.lan>
Date: Fri, 7 Mar 2025 15:32:20 -0800
From: Alison Schofield <alison.schofield@...el.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: shiju.jose@...wei.com, linux-cxl@...r.kernel.org,
	dan.j.williams@...el.com, dave@...olabs.net, 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 8/8] cxl/memfeature: Add CXL memory device memory sparing
 control feature

On Fri, Mar 07, 2025 at 09:11:37AM +0800, Jonathan Cameron wrote:
> On Thu, 27 Feb 2025 22:38:15 +0000
> <shiju.jose@...wei.com> wrote:
> 
> > From: Shiju Jose <shiju.jose@...wei.com>
> > 
snip

> Similar comment to earlier on maybe using single line comments
> in more places rather than multiline.  Perhaps worth doing
> that if you are respinning for other reasons.

Following on Jonathan's feedback, a couple of things-

- Within the CXL subsystem (maybe it's kernel wide) there is a
style or custom, that comments that only need to occupy a single
line only use a single line. This set should follow that. When code
is styled uniformally it is easier to read.

- This next thing I recognize because I have a bad habit of doing
it myself. Narrating! Some of these (should be single line) comments
are needlessly narrating the code. A comment is useful if it explains
something not obvious, but when we have descriptive function names and
variables, less commentary is needed.

see below...

> 
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> 
> > +static int cxl_mem_do_sparing_op(struct device *dev,
> > +				 struct cxl_mem_sparing_context *cxl_sparing_ctx,
> > +				 struct cxl_memdev_sparing_params *rd_params)
> > +{
> > +	struct cxl_memdev *cxlmd = cxl_sparing_ctx->cxlmd;
> > +	struct cxl_memdev_sparing_in_payload sparing_pi;
> > +	struct cxl_event_dram *rec = NULL;
> > +	u16 validity_flags = 0;
> > +
> > +	if (!rd_params->cap_safe_when_in_use) {
> > +		/*
> > +		 * Memory to repair must be offline
> > +		 */
> > +		if (cxl_are_decoders_committed(cxlmd))
> > +			return -EBUSY;
> > +		/*
> > +		 * offline, so good for repair
> > +		 */
> More places as below where a single line comment would be fine
> and make a reader scroll a bit less.

This got cut off, but I think the code can tell the story without
narration. (per my other patch feedback maybe you will rename this
something like is_memdev_memory_offline())?

snip

> > +	/*
> > +	 * Read CXL device's sparing capabilities.
> a below.
> > +	 */
> > +	ret = cxl_mem_sparing_get_attrs(cxl_sparing_ctx, &rd_params);

Great name, no clarifying comment needed.

I'm not looking through them all. I'll leave that to you. But I
appreciate you looking and updating to single line and removing
the comment entirely where needless. It helps keep the code base
uniform in style which makes reading it easier.

Thanks Shiju :)


> > +	if (ret)
> > +		return ret;
> > +
> > +	/*
> > +	 * Set default value for persist_mode.
> > +	 */
> 
> If respining some of these comments don't need to be multiline.
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ