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: <20250107035708.1134954-4-ming.li@zohomail.com>
Date: Tue,  7 Jan 2025 11:57:03 +0800
From: Li Ming <ming.li@...omail.com>
To: dave@...olabs.net,
	jonathan.cameron@...wei.com,
	dave.jiang@...el.com,
	alison.schofield@...el.com,
	vishal.l.verma@...el.com,
	ira.weiny@...el.com,
	dan.j.williams@...el.com
Cc: linux-cxl@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Li Ming <ming.li@...omail.com>
Subject: [RFC PATCH 3/8] cxl/region: Check if dev is a decoder in check_commit_order()

Currently, endpoint port probing helps to enumerate decoders on its
ancestor ports. it will impact the sequence of port's device child list.

Before that, port's decoders are added to port's device child list
firstly, then all ports under the port will be added to the port's
device child list.
But now, all ports under the port will be added to the port's device
child list firstly, then the port's decoders will be added.

So when using device_for_each_child_reverse_from() to check decoders
commit order, needs to check if the child device is decoder, if not,
that means the first decoder was walked. Returning a positive in such
case to stop iterator.

Signed-off-by: Li Ming <ming.li@...omail.com>
---
 drivers/cxl/core/region.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index b98b1ccffd1c..946fca0fe0fe 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -780,8 +780,12 @@ static size_t show_targetN(struct cxl_region *cxlr, char *buf, int pos)
 
 static int check_commit_order(struct device *dev, const void *data)
 {
-	struct cxl_decoder *cxld = to_cxl_decoder(dev);
+	struct cxl_decoder *cxld;
 
+	if (!is_switch_decoder(dev))
+		return 1;
+
+	cxld = to_cxl_decoder(dev);
 	/*
 	 * if port->commit_end is not the only free decoder, then out of
 	 * order shutdown has occurred, block further allocations until
@@ -815,7 +819,7 @@ static int match_free_decoder(struct device *dev, void *data)
 
 	rc = device_for_each_child_reverse_from(dev->parent, dev, NULL,
 						check_commit_order);
-	if (rc) {
+	if (rc < 0) {
 		dev_dbg(dev->parent,
 			"unable to allocate %s due to out of order shutdown\n",
 			dev_name(dev));
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ