All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] cxl: Add cxl_num_decoders_committed() usage to cxl_test
@ 2023-11-06 17:26 Dave Jiang
  2023-11-06 18:33 ` fan
  2023-11-08 22:00 ` Alison Schofield
  0 siblings, 2 replies; 4+ messages in thread
From: Dave Jiang @ 2023-11-06 17:26 UTC (permalink / raw
  To: linux-cxl
  Cc: Alison Schofield, dan.j.williams, Jonathan.Cameron, dave,
	alison.schofield, vishal.l.verma, ira.weiny

Commit 458ba8189cb4 ("cxl: Add cxl_decoders_committed() helper") missed the
conversion for cxl_test. Add usage of cxl_num_decoders_committed() to
replace the open coding.

Suggested-by: Alison Schofield <alison.schofield@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>

---
v3:
- Move export of symbol to cxl_test (Dan)
v2:
- Add missing changes, stg refresh foobar
---
 tools/testing/cxl/Kbuild             |    1 +
 tools/testing/cxl/cxl_core_exports.c |    7 +++++++
 tools/testing/cxl/test/cxl.c         |    5 +++--
 3 files changed, 11 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/cxl/cxl_core_exports.c

diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild
index 90f3c9802ffb..95dc58b94178 100644
--- a/tools/testing/cxl/Kbuild
+++ b/tools/testing/cxl/Kbuild
@@ -62,5 +62,6 @@ cxl_core-$(CONFIG_TRACING) += $(CXL_CORE_SRC)/trace.o
 cxl_core-$(CONFIG_CXL_REGION) += $(CXL_CORE_SRC)/region.o
 cxl_core-y += config_check.o
 cxl_core-y += cxl_core_test.o
+cxl_core-y += cxl_core_exports.o
 
 obj-m += test/
diff --git a/tools/testing/cxl/cxl_core_exports.c b/tools/testing/cxl/cxl_core_exports.c
new file mode 100644
index 000000000000..077e6883921d
--- /dev/null
+++ b/tools/testing/cxl/cxl_core_exports.c
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright(c) 2022 Intel Corporation. All rights reserved. */
+
+#include "cxl.h"
+
+/* Exporting of cxl_core symbols that are only used by cxl_test */
+EXPORT_SYMBOL_NS_GPL(cxl_num_decoders_committed, CXL);
diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index b88546299902..f4e517a0c774 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -669,10 +669,11 @@ static int mock_decoder_commit(struct cxl_decoder *cxld)
 		return 0;
 
 	dev_dbg(&port->dev, "%s commit\n", dev_name(&cxld->dev));
-	if (port->commit_end + 1 != id) {
+	if (cxl_num_decoders_committed(port) != id) {
 		dev_dbg(&port->dev,
 			"%s: out of order commit, expected decoder%d.%d\n",
-			dev_name(&cxld->dev), port->id, port->commit_end + 1);
+			dev_name(&cxld->dev), port->id,
+			cxl_num_decoders_committed(port));
 		return -EBUSY;
 	}
 



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] cxl: Add cxl_num_decoders_committed() usage to cxl_test
  2023-11-06 17:26 [PATCH v3] cxl: Add cxl_num_decoders_committed() usage to cxl_test Dave Jiang
@ 2023-11-06 18:33 ` fan
  2023-11-08 22:00 ` Alison Schofield
  1 sibling, 0 replies; 4+ messages in thread
From: fan @ 2023-11-06 18:33 UTC (permalink / raw
  To: Dave Jiang
  Cc: linux-cxl, Alison Schofield, dan.j.williams, Jonathan.Cameron,
	dave, vishal.l.verma, ira.weiny

On Mon, Nov 06, 2023 at 10:26:45AM -0700, Dave Jiang wrote:
> Commit 458ba8189cb4 ("cxl: Add cxl_decoders_committed() helper") missed the
> conversion for cxl_test. Add usage of cxl_num_decoders_committed() to
> replace the open coding.
> 
> Suggested-by: Alison Schofield <alison.schofield@intel.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

Reviewed-by: Fan Ni <fan.ni@samsung.com>

> 
> ---
> v3:
> - Move export of symbol to cxl_test (Dan)
> v2:
> - Add missing changes, stg refresh foobar
> ---
>  tools/testing/cxl/Kbuild             |    1 +
>  tools/testing/cxl/cxl_core_exports.c |    7 +++++++
>  tools/testing/cxl/test/cxl.c         |    5 +++--
>  3 files changed, 11 insertions(+), 2 deletions(-)
>  create mode 100644 tools/testing/cxl/cxl_core_exports.c
> 
> diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild
> index 90f3c9802ffb..95dc58b94178 100644
> --- a/tools/testing/cxl/Kbuild
> +++ b/tools/testing/cxl/Kbuild
> @@ -62,5 +62,6 @@ cxl_core-$(CONFIG_TRACING) += $(CXL_CORE_SRC)/trace.o
>  cxl_core-$(CONFIG_CXL_REGION) += $(CXL_CORE_SRC)/region.o
>  cxl_core-y += config_check.o
>  cxl_core-y += cxl_core_test.o
> +cxl_core-y += cxl_core_exports.o
>  
>  obj-m += test/
> diff --git a/tools/testing/cxl/cxl_core_exports.c b/tools/testing/cxl/cxl_core_exports.c
> new file mode 100644
> index 000000000000..077e6883921d
> --- /dev/null
> +++ b/tools/testing/cxl/cxl_core_exports.c
> @@ -0,0 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright(c) 2022 Intel Corporation. All rights reserved. */
> +
> +#include "cxl.h"
> +
> +/* Exporting of cxl_core symbols that are only used by cxl_test */
> +EXPORT_SYMBOL_NS_GPL(cxl_num_decoders_committed, CXL);
> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index b88546299902..f4e517a0c774 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
> @@ -669,10 +669,11 @@ static int mock_decoder_commit(struct cxl_decoder *cxld)
>  		return 0;
>  
>  	dev_dbg(&port->dev, "%s commit\n", dev_name(&cxld->dev));
> -	if (port->commit_end + 1 != id) {
> +	if (cxl_num_decoders_committed(port) != id) {
>  		dev_dbg(&port->dev,
>  			"%s: out of order commit, expected decoder%d.%d\n",
> -			dev_name(&cxld->dev), port->id, port->commit_end + 1);
> +			dev_name(&cxld->dev), port->id,
> +			cxl_num_decoders_committed(port));
>  		return -EBUSY;
>  	}
>  
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] cxl: Add cxl_num_decoders_committed() usage to cxl_test
  2023-11-06 17:26 [PATCH v3] cxl: Add cxl_num_decoders_committed() usage to cxl_test Dave Jiang
  2023-11-06 18:33 ` fan
@ 2023-11-08 22:00 ` Alison Schofield
  2023-12-05  0:43   ` Dan Williams
  1 sibling, 1 reply; 4+ messages in thread
From: Alison Schofield @ 2023-11-08 22:00 UTC (permalink / raw
  To: Dave Jiang
  Cc: linux-cxl, dan.j.williams, Jonathan.Cameron, dave, vishal.l.verma,
	ira.weiny

On Mon, Nov 06, 2023 at 10:26:45AM -0700, Dave Jiang wrote:
> Commit 458ba8189cb4 ("cxl: Add cxl_decoders_committed() helper") missed the
> conversion for cxl_test. Add usage of cxl_num_decoders_committed() to
> replace the open coding.
> 
> Suggested-by: Alison Schofield <alison.schofield@intel.com>

Search for more usages of commit_end in cxl.c that may use new helper. 


> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> 
> ---
> v3:
> - Move export of symbol to cxl_test (Dan)
> v2:
> - Add missing changes, stg refresh foobar
> ---
>  tools/testing/cxl/Kbuild             |    1 +
>  tools/testing/cxl/cxl_core_exports.c |    7 +++++++
>  tools/testing/cxl/test/cxl.c         |    5 +++--
>  3 files changed, 11 insertions(+), 2 deletions(-)
>  create mode 100644 tools/testing/cxl/cxl_core_exports.c
> 
> diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild
> index 90f3c9802ffb..95dc58b94178 100644
> --- a/tools/testing/cxl/Kbuild
> +++ b/tools/testing/cxl/Kbuild
> @@ -62,5 +62,6 @@ cxl_core-$(CONFIG_TRACING) += $(CXL_CORE_SRC)/trace.o
>  cxl_core-$(CONFIG_CXL_REGION) += $(CXL_CORE_SRC)/region.o
>  cxl_core-y += config_check.o
>  cxl_core-y += cxl_core_test.o
> +cxl_core-y += cxl_core_exports.o
>  
>  obj-m += test/
> diff --git a/tools/testing/cxl/cxl_core_exports.c b/tools/testing/cxl/cxl_core_exports.c
> new file mode 100644
> index 000000000000..077e6883921d
> --- /dev/null
> +++ b/tools/testing/cxl/cxl_core_exports.c
> @@ -0,0 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright(c) 2022 Intel Corporation. All rights reserved. */
> +
> +#include "cxl.h"
> +
> +/* Exporting of cxl_core symbols that are only used by cxl_test */
> +EXPORT_SYMBOL_NS_GPL(cxl_num_decoders_committed, CXL);
> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index b88546299902..f4e517a0c774 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
> @@ -669,10 +669,11 @@ static int mock_decoder_commit(struct cxl_decoder *cxld)
>  		return 0;
>  
>  	dev_dbg(&port->dev, "%s commit\n", dev_name(&cxld->dev));
> -	if (port->commit_end + 1 != id) {
> +	if (cxl_num_decoders_committed(port) != id) {
>  		dev_dbg(&port->dev,
>  			"%s: out of order commit, expected decoder%d.%d\n",
> -			dev_name(&cxld->dev), port->id, port->commit_end + 1);
> +			dev_name(&cxld->dev), port->id,
> +			cxl_num_decoders_committed(port));
>  		return -EBUSY;
>  	}
>  
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] cxl: Add cxl_num_decoders_committed() usage to cxl_test
  2023-11-08 22:00 ` Alison Schofield
@ 2023-12-05  0:43   ` Dan Williams
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Williams @ 2023-12-05  0:43 UTC (permalink / raw
  To: Alison Schofield, Dave Jiang
  Cc: linux-cxl, dan.j.williams, Jonathan.Cameron, dave, vishal.l.verma,
	ira.weiny

Alison Schofield wrote:
> On Mon, Nov 06, 2023 at 10:26:45AM -0700, Dave Jiang wrote:
> > Commit 458ba8189cb4 ("cxl: Add cxl_decoders_committed() helper") missed the
> > conversion for cxl_test. Add usage of cxl_num_decoders_committed() to
> > replace the open coding.
> > 
> > Suggested-by: Alison Schofield <alison.schofield@intel.com>
> 
> Search for more usages of commit_end in cxl.c that may use new helper. 

Did you have one in mind? Of these:

tools/testing/cxl/test/cxl.c:672:	if (port->commit_end + 1 != id) {
tools/testing/cxl/test/cxl.c:675:			dev_name(&cxld->dev), port->id, port->commit_end + 1);
tools/testing/cxl/test/cxl.c:679:	port->commit_end++;
tools/testing/cxl/test/cxl.c:694:	if (port->commit_end != id) {
tools/testing/cxl/test/cxl.c:697:			dev_name(&cxld->dev), port->id, port->commit_end);
tools/testing/cxl/test/cxl.c:701:	port->commit_end--;
tools/testing/cxl/test/cxl.c:793:	port->commit_end = cxld->id;
tools/testing/cxl/test/cxl.c:825:		iter->commit_end = 0;

Only tools/testing/cxl/test/cxl.c:694 looks interesting, but given
cxl_decoder_reset() does not use cxl_num_decoders_committed(), neither
should mock_decoder_reset().

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-05  0:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-06 17:26 [PATCH v3] cxl: Add cxl_num_decoders_committed() usage to cxl_test Dave Jiang
2023-11-06 18:33 ` fan
2023-11-08 22:00 ` Alison Schofield
2023-12-05  0:43   ` Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.