Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org,
	Isabella Basso <isabbasso@riseup.net>,
	intel-xe@lists.freedesktop.org
Subject: Re: [igt-dev] [Intel-gfx] [PATCH i-g-t v2 09/17] lib/ktap: Drop is_running flag
Date: Mon, 11 Sep 2023 11:03:39 +0200	[thread overview]
Message-ID: <20230911110339.267f2a2a@maurocar-mobl2> (raw)
In-Reply-To: <20230908123233.137134-28-janusz.krzysztofik@linux.intel.com>

On Fri,  8 Sep 2023 14:32:43 +0200
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> wrote:

> Since we now call pthread_cancel() when we want to stop KTAP parser before
> it completes, and we take care of returning failure in that case as a
> result of KTAP parsing, we no longer need to check a flag that indicates
> whether we should continue parsing or return a failure.  Drop that flag.
> 
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>

LGTM.

Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>


> ---
>  lib/igt_ktap.c | 32 --------------------------------
>  1 file changed, 32 deletions(-)
> 
> diff --git a/lib/igt_ktap.c b/lib/igt_ktap.c
> index 1e75b2ec23..fe77b62680 100644
> --- a/lib/igt_ktap.c
> +++ b/lib/igt_ktap.c
> @@ -18,7 +18,6 @@
>  struct ktap_parser_args {
>  	int fd;
>  	bool is_builtin;
> -	volatile bool is_running;
>  	int ret;
>  } ktap_args;
>  
> @@ -61,11 +60,6 @@ static int log_to_end(enum igt_log_level level, int fd,
>  		igt_log(IGT_LOG_DOMAIN, level, "%s", record);
>  
>  		while (read(fd, record, BUF_LEN) < 0) {
> -			if (!READ_ONCE(ktap_args.is_running)) {
> -				igt_warn("ktap parser stopped\n");
> -				return -2;
> -			}
> -
>  			if (errno == EINTR)
>  				return -2;
>  
> @@ -183,11 +177,6 @@ static int find_next_tap_subtest(int fd, char *record, char *test_name, bool is_
>  
>  	if (is_builtin) {
>  		while (read(fd, record, BUF_LEN) < 0) {
> -			if (!READ_ONCE(ktap_args.is_running)) {
> -				igt_warn("ktap parser stopped\n");
> -				return -2;
> -			}
> -
>  			if (errno == EINTR)
>  				return -2;
>  
> @@ -227,11 +216,6 @@ static int find_next_tap_subtest(int fd, char *record, char *test_name, bool is_
>  			cutoff[0] = '\0';
>  
>  		while (read(fd, record, BUF_LEN) < 0) {
> -			if (!READ_ONCE(ktap_args.is_running)) {
> -				igt_warn("ktap parser stopped\n");
> -				return -2;
> -			}
> -
>  			if (errno == EINTR)
>  				return -2;
>  
> @@ -382,11 +366,6 @@ static int parse_tap_level(int fd, char *base_test_name, int test_count, bool *f
>  
>  	for (int i = 0; i < test_count; i++) {
>  		while (read(fd, record, BUF_LEN) < 0) {
> -			if (!READ_ONCE(ktap_args.is_running)) {
> -				igt_warn("ktap parser stopped\n");
> -				return -1;
> -			}
> -
>  			if (errno == EINTR)
>  				return -1;
>  
> @@ -523,19 +502,11 @@ void *igt_ktap_parser(void *unused)
>  	failed_tests = false;
>  	found_tests = false;
>  
> -	if (!READ_ONCE(ktap_args.is_running))
> -		goto igt_ktap_parser_end;
> -
>  igt_ktap_parser_start:
>  	test_name[0] = '\0';
>  	test_name[BUF_LEN] = '\0';
>  
>  	while (read(fd, record, BUF_LEN) < 0) {
> -		if (!READ_ONCE(ktap_args.is_running)) {
> -			igt_warn("ktap parser stopped\n");
> -			goto igt_ktap_parser_end;
> -		}
> -
>  		if (errno == EAGAIN)
>  			/* No records available */
>  			continue;
> @@ -595,7 +566,6 @@ struct ktap_test_results *ktap_parser_start(int fd, bool is_builtin)
>  
>  	ktap_args.fd = fd;
>  	ktap_args.is_builtin = is_builtin;
> -	ktap_args.is_running = true;
>  	ktap_args.ret = IGT_EXIT_FAILURE;
>  	pthread_create(&ktap_parser_thread, NULL, igt_ktap_parser, NULL);
>  
> @@ -604,13 +574,11 @@ struct ktap_test_results *ktap_parser_start(int fd, bool is_builtin)
>  
>  void ktap_parser_cancel(void)
>  {
> -	ktap_args.is_running = false;
>  	pthread_cancel(ktap_parser_thread);
>  }
>  
>  int ktap_parser_stop(void)
>  {
> -	ktap_args.is_running = false;
>  	pthread_join(ktap_parser_thread, NULL);
>  	return ktap_args.ret;
>  }

  reply	other threads:[~2023-09-11  9:03 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08 12:32 [igt-dev] [PATCH i-g-t v2 00/17] Fix IGT Kunit implementation issues Janusz Krzysztofik
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 01/17] lib/kunit: Drop unused file stream Janusz Krzysztofik
2023-09-15 10:36   ` Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 02/17] lib/kunit: Stop loading kunit module explicitly Janusz Krzysztofik
2023-09-15 10:36   ` Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 03/17] lib/kunit: Fix struct kmod_module kunit_kmod not freed Janusz Krzysztofik
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 04/17] lib/kunit: Optimize calls to igt_success/skip/fail() Janusz Krzysztofik
2023-09-11  8:49   ` [igt-dev] [Intel-gfx] " Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 05/17] lib/kunit: Fix illegal igt_fail() calls inside subtest body Janusz Krzysztofik
2023-09-11  8:52   ` [igt-dev] [Intel-gfx] " Mauro Carvalho Chehab
2023-09-11  9:28     ` Janusz Krzysztofik
2023-09-11 11:57       ` Mauro Carvalho Chehab
2023-09-13 13:03         ` Janusz Krzysztofik
2023-09-15  9:58     ` Mauro Carvalho Chehab
2023-09-15 10:08       ` Janusz Krzysztofik
2023-09-15 12:13         ` Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 06/17] lib/ktap: Make sure we fail on premature cancel Janusz Krzysztofik
2023-09-11  8:55   ` [igt-dev] [Intel-gfx] " Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 07/17] lib/ktap: Don't ignore interrupt signals Janusz Krzysztofik
2023-09-11  9:01   ` [igt-dev] [Intel-gfx] " Mauro Carvalho Chehab
2023-09-13 14:04     ` Janusz Krzysztofik
2023-09-15 12:25       ` Mauro Carvalho Chehab
2023-09-15 13:06         ` Janusz Krzysztofik
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 08/17] lib/kunit: Cancel KTP parser on module load failure Janusz Krzysztofik
2023-09-11  9:02   ` [igt-dev] [Intel-gfx] " Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 09/17] lib/ktap: Drop is_running flag Janusz Krzysztofik
2023-09-11  9:03   ` Mauro Carvalho Chehab [this message]
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 10/17] lib/ktap: Read /dev/kmsg in blocking mode Janusz Krzysztofik
2023-09-15 10:42   ` [igt-dev] [Intel-gfx] " Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 11/17] lib/kunit: Fail / skip on kernel taint Janusz Krzysztofik
2023-09-15 10:43   ` [igt-dev] [Intel-gfx] " Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 12/17] lib/ktap: Use IGT linked lists for storing KTAP results Janusz Krzysztofik
2023-09-15 10:44   ` [igt-dev] [Intel-gfx] " Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 13/17] lib/ktap: Reimplement KTAP parser Janusz Krzysztofik
2023-09-15 11:45   ` Mauro Carvalho Chehab
2023-09-15 12:28   ` [igt-dev] [Intel-gfx] " Mauro Carvalho Chehab
2023-09-15 13:09     ` Janusz Krzysztofik
2023-09-15 13:35       ` [Intel-xe] " Janusz Krzysztofik
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 14/17] lib/kunit: Load test modules in background Janusz Krzysztofik
2023-09-15 12:11   ` Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 15/17] lib/kunit: Parse KTAP report from the main process thread Janusz Krzysztofik
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 16/17] lib/kunit: Strip "_test" or "_kunit" suffix from subtest names Janusz Krzysztofik
2023-09-15 11:42   ` Mauro Carvalho Chehab
2023-09-08 12:32 ` [igt-dev] [PATCH i-g-t v2 17/17] lib/kunit: Omit suite name prefix if the same as subtest name Janusz Krzysztofik
2023-09-08 14:08 ` [igt-dev] ✗ GitLab.Pipeline: warning for Fix IGT Kunit implementation issues (rev2) Patchwork
2023-09-08 14:46 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2023-09-08 15:51 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
2023-09-11 12:26 ` [igt-dev] ✓ Fi.CI.BAT: " Patchwork
2023-09-11 14:57 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

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=20230911110339.267f2a2a@maurocar-mobl2 \
    --to=mauro.chehab@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=isabbasso@riseup.net \
    --cc=janusz.krzysztofik@linux.intel.com \
    /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