All of lore.kernel.org
 help / color / mirror / Atom feed
From: "misono.tomohiro@fujitsu.com" <misono.tomohiro@fujitsu.com>
To: 'Mark Brown' <broonie@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Cc: "linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>
Subject: RE: [PATCH v2 4/4] selftests: arm64: Verify that all possible vector lengths are handled
Date: Fri, 17 Sep 2021 12:26:26 +0000	[thread overview]
Message-ID: <TYCPR01MB6993276DACEF056EA5634F7FE5DD9@TYCPR01MB6993.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20210917120855.13858-5-broonie@kernel.org>

Reviewed-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>

Thanks,
Misono

> Subject: [PATCH v2 4/4] selftests: arm64: Verify that all possible vector lengths
> are handled
> 
> As part of the enumeration interface for setting vector lengths it is valid
> to set vector lengths not supported in the system, these will be rounded to
> a supported vector length and returned from the prctl(). Add a test which
> exercises this for every valid vector length and makes sure that the return
> value is as expected and that this is reflected in the actual system state.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  tools/testing/selftests/arm64/fp/vec-syscfg.c | 71
> +++++++++++++++++++
>  1 file changed, 71 insertions(+)
> 
> diff --git a/tools/testing/selftests/arm64/fp/vec-syscfg.c
> b/tools/testing/selftests/arm64/fp/vec-syscfg.c
> index 9d6ac843e651..de11cd2f5d79 100644
> --- a/tools/testing/selftests/arm64/fp/vec-syscfg.c
> +++ b/tools/testing/selftests/arm64/fp/vec-syscfg.c
> @@ -540,6 +540,76 @@ static void prctl_set_onexec(struct vec_data *data)
>  	file_write_integer(data->default_vl_file, data->default_vl);
>  }
> 
> +/* For each VQ verify that setting via prctl() does the right thing */
> +static void prctl_set_all_vqs(struct vec_data *data)
> +{
> +	int ret, vq, vl, new_vl;
> +	int errors = 0;
> +
> +	for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) {
> +		vl = sve_vl_from_vq(vq);
> +
> +		/* Attempt to set the VL */
> +		ret = prctl(data->prctl_set, vl);
> +		if (ret < 0) {
> +			errors++;
> +			ksft_print_msg("%s prctl set failed for %d: %d
> (%s)\n",
> +				       data->name, vl,
> +				       errno, strerror(errno));
> +			continue;
> +		}
> +
> +		new_vl = ret & PR_SVE_VL_LEN_MASK;
> +
> +		/* Check that we actually have the reported new VL */
> +		if (data->rdvl() != new_vl) {
> +			ksft_print_msg("Set %s VL %d but RDVL
> reports %d\n",
> +				       data->name, new_vl, data->rdvl());
> +			errors++;
> +		}
> +
> +		/* Was that the VL we asked for? */
> +		if (new_vl == vl)
> +			continue;
> +
> +		/* Should round up to the minimum VL if below it */
> +		if (vl < data->min_vl) {
> +			if (new_vl != data->min_vl) {
> +				ksft_print_msg("%s VL %d returned %d not
> minimum %d\n",
> +					       data->name, vl, new_vl,
> +					       data->min_vl);
> +				errors++;
> +			}
> +
> +			continue;
> +		}
> +
> +		/* Should round down to maximum VL if above it */
> +		if (vl > data->max_vl) {
> +			if (new_vl != data->max_vl) {
> +				ksft_print_msg("%s VL %d returned %d not
> maximum %d\n",
> +					       data->name, vl, new_vl,
> +					       data->max_vl);
> +				errors++;
> +			}
> +
> +			continue;
> +		}
> +
> +		/* Otherwise we should've rounded down */
> +		if (!(new_vl < vl)) {
> +			ksft_print_msg("%s VL %d returned %d, did not round
> down\n",
> +				       data->name, vl, new_vl);
> +			errors++;
> +
> +			continue;
> +		}
> +	}
> +
> +	ksft_test_result(errors == 0, "%s prctl() set all VLs, %d errors\n",
> +			 data->name, errors);
> +}
> +
>  typedef void (*test_type)(struct vec_data *);
> 
>  static const test_type tests[] = {
> @@ -557,6 +627,7 @@ static const test_type tests[] = {
>  	prctl_set_no_child,
>  	prctl_set_for_child,
>  	prctl_set_onexec,
> +	prctl_set_all_vqs,
>  };
> 
>  int main(void)
> --
> 2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID
From: "misono.tomohiro@fujitsu.com" <misono.tomohiro@fujitsu.com>
To: 'Mark Brown' <broonie@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>
Subject: RE: [PATCH v2 4/4] selftests: arm64: Verify that all possible vector lengths are handled
Date: Fri, 17 Sep 2021 12:26:26 +0000	[thread overview]
Message-ID: <TYCPR01MB6993276DACEF056EA5634F7FE5DD9@TYCPR01MB6993.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20210917120855.13858-5-broonie@kernel.org>

Reviewed-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>

Thanks,
Misono

> Subject: [PATCH v2 4/4] selftests: arm64: Verify that all possible vector lengths
> are handled
> 
> As part of the enumeration interface for setting vector lengths it is valid
> to set vector lengths not supported in the system, these will be rounded to
> a supported vector length and returned from the prctl(). Add a test which
> exercises this for every valid vector length and makes sure that the return
> value is as expected and that this is reflected in the actual system state.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  tools/testing/selftests/arm64/fp/vec-syscfg.c | 71
> +++++++++++++++++++
>  1 file changed, 71 insertions(+)
> 
> diff --git a/tools/testing/selftests/arm64/fp/vec-syscfg.c
> b/tools/testing/selftests/arm64/fp/vec-syscfg.c
> index 9d6ac843e651..de11cd2f5d79 100644
> --- a/tools/testing/selftests/arm64/fp/vec-syscfg.c
> +++ b/tools/testing/selftests/arm64/fp/vec-syscfg.c
> @@ -540,6 +540,76 @@ static void prctl_set_onexec(struct vec_data *data)
>  	file_write_integer(data->default_vl_file, data->default_vl);
>  }
> 
> +/* For each VQ verify that setting via prctl() does the right thing */
> +static void prctl_set_all_vqs(struct vec_data *data)
> +{
> +	int ret, vq, vl, new_vl;
> +	int errors = 0;
> +
> +	for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) {
> +		vl = sve_vl_from_vq(vq);
> +
> +		/* Attempt to set the VL */
> +		ret = prctl(data->prctl_set, vl);
> +		if (ret < 0) {
> +			errors++;
> +			ksft_print_msg("%s prctl set failed for %d: %d
> (%s)\n",
> +				       data->name, vl,
> +				       errno, strerror(errno));
> +			continue;
> +		}
> +
> +		new_vl = ret & PR_SVE_VL_LEN_MASK;
> +
> +		/* Check that we actually have the reported new VL */
> +		if (data->rdvl() != new_vl) {
> +			ksft_print_msg("Set %s VL %d but RDVL
> reports %d\n",
> +				       data->name, new_vl, data->rdvl());
> +			errors++;
> +		}
> +
> +		/* Was that the VL we asked for? */
> +		if (new_vl == vl)
> +			continue;
> +
> +		/* Should round up to the minimum VL if below it */
> +		if (vl < data->min_vl) {
> +			if (new_vl != data->min_vl) {
> +				ksft_print_msg("%s VL %d returned %d not
> minimum %d\n",
> +					       data->name, vl, new_vl,
> +					       data->min_vl);
> +				errors++;
> +			}
> +
> +			continue;
> +		}
> +
> +		/* Should round down to maximum VL if above it */
> +		if (vl > data->max_vl) {
> +			if (new_vl != data->max_vl) {
> +				ksft_print_msg("%s VL %d returned %d not
> maximum %d\n",
> +					       data->name, vl, new_vl,
> +					       data->max_vl);
> +				errors++;
> +			}
> +
> +			continue;
> +		}
> +
> +		/* Otherwise we should've rounded down */
> +		if (!(new_vl < vl)) {
> +			ksft_print_msg("%s VL %d returned %d, did not round
> down\n",
> +				       data->name, vl, new_vl);
> +			errors++;
> +
> +			continue;
> +		}
> +	}
> +
> +	ksft_test_result(errors == 0, "%s prctl() set all VLs, %d errors\n",
> +			 data->name, errors);
> +}
> +
>  typedef void (*test_type)(struct vec_data *);
> 
>  static const test_type tests[] = {
> @@ -557,6 +627,7 @@ static const test_type tests[] = {
>  	prctl_set_no_child,
>  	prctl_set_for_child,
>  	prctl_set_onexec,
> +	prctl_set_all_vqs,
>  };
> 
>  int main(void)
> --
> 2.20.1


  reply	other threads:[~2021-09-17 12:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 12:08 [PATCH v2 0/4] selftests: arm64: vec-syscfg updates Mark Brown
2021-09-17 12:08 ` Mark Brown
2021-09-17 12:08 ` [PATCH v2 1/4] selftests: arm64: Fix printf() format mismatch in vec-syscfg Mark Brown
2021-09-17 12:08   ` Mark Brown
2021-09-17 12:08 ` [PATCH v2 2/4] selftests: arm64: Remove bogus error check on writing to files Mark Brown
2021-09-17 12:08   ` Mark Brown
2021-09-17 12:08 ` [PATCH v2 3/4] selftests: arm64: Fix and enable test for setting current VL in vec-syscfg Mark Brown
2021-09-17 12:08   ` Mark Brown
2021-09-17 12:08 ` [PATCH v2 4/4] selftests: arm64: Verify that all possible vector lengths are handled Mark Brown
2021-09-17 12:08   ` Mark Brown
2021-09-17 12:26   ` misono.tomohiro [this message]
2021-09-17 12:26     ` misono.tomohiro
2021-09-29 14:31 ` [PATCH v2 0/4] selftests: arm64: vec-syscfg updates Will Deacon
2021-09-29 14:31   ` Will Deacon
2021-09-29 14:43   ` Mark Brown
2021-09-29 14:43     ` Mark Brown
2021-09-29 15:35     ` Will Deacon
2021-09-29 15:35       ` Will Deacon
2021-09-29 15:38       ` Mark Brown
2021-09-29 15:38         ` Mark Brown
2021-09-29 16:26       ` Shuah Khan
2021-09-29 16:26         ` Shuah Khan
2021-09-29 16:37         ` Mark Brown
2021-09-29 16:37           ` Mark Brown
2021-09-29 18:23           ` Shuah Khan
2021-09-29 18:23             ` Shuah Khan

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=TYCPR01MB6993276DACEF056EA5634F7FE5DD9@TYCPR01MB6993.jpnprd01.prod.outlook.com \
    --to=misono.tomohiro@fujitsu.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=will@kernel.org \
    --subject='RE: [PATCH v2 4/4] selftests: arm64: Verify that all possible vector lengths are handled' \
    /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

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.