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: <8734kq6pbk.fsf@yhuang6-desk2.ccr.corp.intel.com>
Date: Mon, 21 Oct 2024 12:40:47 +0800
From: "Huang, Ying" <ying.huang@...el.com>
To: Dan Williams <dan.j.williams@...el.com>
Cc: Dave Jiang <dave.jiang@...el.com>,  linux-cxl@...r.kernel.org,
  linux-kernel@...r.kernel.org,  Davidlohr Bueso <dave@...olabs.net>,
  Gregory Price <gourry@...rry.net>,  Jonathan Cameron
 <jonathan.cameron@...wei.com>,  Alison Schofield
 <alison.schofield@...el.com>,  Vishal Verma <vishal.l.verma@...el.com>,
  Ira Weiny <ira.weiny@...el.com>,  Alejandro Lucero <alucerop@....com>,
  Ben Cheatham <benjamin.cheatham@....com>
Subject: Re: [PATCH 2/5] cxl: Rename CXL_DECODER_HOSTONLYMEM/DEVMEM

Dan Williams <dan.j.williams@...el.com> writes:

> Huang, Ying wrote:
>> Hi, Dan,
>> 
>> Dan Williams <dan.j.williams@...el.com> writes:
>> 
>> > Huang Ying wrote:
>> >> Previously, CXL type3 devices (memory expanders) use host only
>> >> coherence (HDM-H), while CXL type2 devices (accelerators) use dev
>> >> coherence (HDM-D).  So the name of the target device type of a cxl
>> >> decoder is CXL_DECODER_HOSTONLYMEM for type3 devices and
>> >> CXL_DECODER_DEVMEM for type2 devices.  However, this isn't true
>> >> anymore.  CXL type3 devices can use dev coherence + back
>> >> invalidation (HDM-DB) too.
>> >> 
>> >> To avoid confusion between the device type and coherence, the patch
>> >> renames CXL_DECODER_HOSTONLYMEM/DEVMEM to CXL_DECODER_EXPANDER/ACCEL.
>> >
>> > This does not look like an improvement to me. Type-3 devices that
>> > support back-invalidate are DEVMEM devices. The device plays a role in
>> > the coherence. 
>> >
>> > Your explanation is the reverse of this commit:
>> >
>> > 5aa39a9165cf cxl/port: Rename CXL_DECODER_{EXPANDER, ACCELERATOR} => {HOSTONLYMEM, DEVMEM}
>> >
>> > ...so I am confused what motivated this rename?
>> 
>> Sorry, I am confused about the target_type and coherence and forgot to
>> check the history.  In some places, current kernel still hints
>> target_type (CXL_DECODER_HOSTONLYMEM/DEVMEM) as expander/accelerator.
>> Should we change them to avoid confusion in the future?
>> 
>> $ grep expander -r drivers/cxl/
>> drivers/cxl/cxl.h:346: * @target_type: accelerator vs expander (type2 vs type3) selector
>> drivers/cxl/core/region.c:2450: * @type: select whether this is an expander or accelerator (type-2 or type-3)
>> drivers/cxl/core/port.c:141:		return sysfs_emit(buf, "expander\n");
>> 
>> The last one is
>> 
>> static ssize_t target_type_show(struct device *dev,
>> 				struct device_attribute *attr, char *buf)
>> {
>> 	struct cxl_decoder *cxld = to_cxl_decoder(dev);
>> 
>> 	switch (cxld->target_type) {
>> 	case CXL_DECODER_DEVMEM:
>> 		return sysfs_emit(buf, "accelerator\n");
>> 	case CXL_DECODER_HOSTONLYMEM:
>> 		return sysfs_emit(buf, "expander\n");
>> 	}
>> 	return -ENXIO;
>> }
>> static DEVICE_ATTR_RO(target_type);
>> 
>> for decoder device.  This is a testing ABI documented in,
>> 
>> Documentation/ABI/testing/sysfs-bus-cxl
>> 
>> Is it OK to change this?
>
> No, why does it need to change?

For example, if the target_type is CXL_DECODER_DEVMEM, while the device
is a memory expander with HDM-DB protocol.  The sysfs will show it as
"accelerator".  This may make users or developers confusing.  If we can
show "hostonlymem"/"devmem", that may be better.  But apparently, we
cannot change ABI.

> It is unfortunate, but ABI's are forever. The place to clarify that this
> decoder is participating in HDM-D[B] vs HDM-H protocol rather than being
> an "accelerator" or "expander" device would be in user tooling like
> cxl-cli. sysfs is just a transport, not a UI.

Although it's not perfect, this is a solution.  Another way to solve
this is to separate device coherence (HOSTONLY vs. DEV) and device type
(ACCELERATOR vs. EXPANDER).  In this way, if the "target_type" in sysfs
designates device type, it could show "expander" for memory expander
even if HDM-DB protocol is used.

Another possibility, can we just remove this sysfs file?

--
Best Regards,
Huang, Ying

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ