Linux CXL
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Dave Jiang <dave.jiang@intel.com>, <linux-cxl@vger.kernel.org>,
	<nvdimm@lists.linux.dev>
Cc: <alison.schofield@intel.com>
Subject: Re: [NDCTL PATCH v5 3/3] cxl/test: Add test for cxl features device
Date: Tue, 22 Apr 2025 20:40:27 -0700	[thread overview]
Message-ID: <6808612be8ffa_71fe29469@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20250411184831.2367464-4-dave.jiang@intel.com>

Dave Jiang wrote:
> Add a unit test to verify the features ioctl commands. Test support added
> for locating a features device, retrieve and verify the supported features
> commands, retrieve specific feature command data, retrieve test feature
> data, and write and verify test feature data.
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> v5:
> - Make command prep common. (Alison)
> - Rename fwctl.c to cxl-features-control.c.  (Alison)
> - Update test code to retrieve cxl_fwctl object.
> - Create helper for aligned allocation and zeroing. (Alison)
> - Correct check of open() return value. (Alison)
> ---
>  test/cxl-features-control.c | 439 ++++++++++++++++++++++++++++++++++++
>  test/cxl-features.sh        |  31 +++
>  test/cxl-topology.sh        |   4 +
>  test/meson.build            |  45 ++++
>  4 files changed, 519 insertions(+)
>  create mode 100644 test/cxl-features-control.c
>  create mode 100755 test/cxl-features.sh
> 
> diff --git a/test/cxl-features-control.c b/test/cxl-features-control.c

Not that this filename matters, but if someone was looking for FWCTL
examples with CXL filename does not shout "look here for
fwctl examples".

[..]
> diff --git a/test/cxl-features.sh b/test/cxl-features.sh
> new file mode 100755
> index 000000000000..e648242a4a01
> --- /dev/null
> +++ b/test/cxl-features.sh
> @@ -0,0 +1,31 @@
> +#!/bin/bash -Ex
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (C) 2025 Intel Corporation. All rights reserved.
> +
> +rc=77
> +# 237 is -ENODEV
> +ERR_NODEV=237
> +
> +. $(dirname $0)/common
> +FEATURES="$TEST_PATH"/cxl-features-control
> +
> +trap 'err $LINENO' ERR
> +
> +modprobe cxl_test
> +
> +test -x "$FEATURES" || do_skip "no CXL Features Contrl"
> +# disable trap
> +trap - $(compgen -A signal)
> +"$FEATURES"
> +rc=$?
> +
> +echo "error: $rc"
> +if [ "$rc" -eq "$ERR_NODEV" ]; then
> +	do_skip "no CXL FWCTL char dev"
> +elif [ "$rc" -ne 0 ]; then
> +	echo "fail: $LINENO" && exit 1
> +fi
> +
> +trap 'err $LINENO' ERR
> +
> +_cxl_cleanup
> diff --git a/test/cxl-topology.sh b/test/cxl-topology.sh
> index e8b9f56543b5..90b9c98273db 100644
> --- a/test/cxl-topology.sh
> +++ b/test/cxl-topology.sh
> @@ -172,11 +172,15 @@ done
>  # validate host bridge tear down for the first 2 bridges
>  for b in ${bridge[0]} ${bridge[1]}
>  do
> +	echo "XXX SHELL disable port $b to validate teardown" > /dev/kmsg
> +
>  	$CXL disable-port $b -f
>  	json=$($CXL list -M -i -p $b)
>  	count=$(jq "map(select(.state == \"disabled\")) | length" <<< $json)
>  	((count == 4)) || err "$LINENO"
>  
> +	echo "XXX SHELL enable port $b to validate teardown" > /dev/kmsg
> +

Are these unrelated changes? I do not see what new cxl-topology.sh print
statements has to do with this new fwctl test?

>  	$CXL enable-port $b -m
>  	json=$($CXL list -M -p $b)
>  	count=$(jq "length" <<< $json)
> diff --git a/test/meson.build b/test/meson.build
> index d871e28e17ce..89e73c2575f6 100644
> --- a/test/meson.build
> +++ b/test/meson.build
> @@ -17,6 +17,13 @@ ndctl_deps = libndctl_deps + [
>    versiondep,
>  ]
>  
> +libcxl_deps = [
> +  cxl_dep,
> +  ndctl_dep,
> +  uuid,
> +  kmod,
> +]
> +
>  libndctl = executable('libndctl', testcore + [ 'libndctl.c'],
>    dependencies : libndctl_deps,
>    include_directories : root_inc,
> @@ -130,6 +137,33 @@ revoke_devmem = executable('revoke_devmem', testcore + [
>    include_directories : root_inc,
>  )
>  
> +fs = import('fs')
> +
> +feature_hdrs = [
> +  '/usr/include/cxl/features.h',
> +  '/usr/include/fwctl/cxl.h',
> +  '/usr/include/fwctl/fwctl.h',
> +]
> +
> +feat_hdrs_exist = true
> +foreach file : feature_hdrs
> +  if not fs.exists(file)
> +    feat_hdrs_exist = false
> +    break
> +  endif
> +endforeach
> +
> +if feat_hdrs_exist
> +    features = executable('cxl-features-control', [
> +        'cxl-features-control.c',
> +    ],
> +    include_directories : root_inc,
> +    dependencies : libcxl_deps,
> +    )
> +else
> +    features = []
> +endif

This does not look like typical meson conditional functionality. I would
expect is to match what happens for conditional "keyutils"
functionality.  A new "if get_option('fwctl').enabled()" option that
gates other dependencies.

You can add Acked-by for the series after addressing above comments.

  reply	other threads:[~2025-04-23  3:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 18:47 [NDCTL PATCH v5 0/3] ndctl: Add support and test for CXL Features support Dave Jiang
2025-04-11 18:47 ` [NDCTL PATCH v5 1/3] cxl: Add cxl_bus_get_by_provider() Dave Jiang
2025-04-11 18:47 ` [NDCTL PATCH v5 2/3] cxl: Enumerate major/minor of FWCTL char device Dave Jiang
2025-04-11 20:53   ` Alison Schofield
2025-04-11 21:06     ` Dave Jiang
2025-04-23  3:31   ` Dan Williams
2025-04-11 18:47 ` [NDCTL PATCH v5 3/3] cxl/test: Add test for cxl features device Dave Jiang
2025-04-23  3:40   ` Dan Williams [this message]
2025-04-23  5:37     ` Dan Williams
2025-04-15 20:19 ` [NDCTL PATCH v5 0/3] ndctl: Add support and test for CXL Features support Alison Schofield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6808612be8ffa_71fe29469@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox