public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] cpuset_hotplug_test.sh: Fix a race condition
Date: Thu, 16 Jul 2020 11:57:38 +0200	[thread overview]
Message-ID: <20200716095738.GA9395@dell5510> (raw)
In-Reply-To: <20200716093316.re67arcm3tbxtwas@e107158-lin.cambridge.arm.com>

Hi Qais,

> > BTW this has already been reviewed and tested by Huacai Chen [1].
> > LGTM, although I'd prefer to detect with with polling, isn't it possible? [1].

> FWIW I did try to avoid the sleep [1].
Yes, I know, but that was in kernel code (great you tried to fix the problem in
the kernel). Here I mean avoid blind sleep in the test. Reporting problem and
taking "sleep 1" fix would be most probably just enough. Below are suggestions to
consider before taking your posted fix as is.

> Were you thinking of something like that (pseudo code)?

> 	for i in $(seq 3)
> 	do
> 		sleep 1
> 		verify()
> 		if [ sucess ]; then
> 			break;
> 		fi
> 	done

> Or you had something more sophisticated in mind?
No, certainly not more sophisticated :). You can also use TST_RETRY_FUNC helper
instead of creating loop manually. It sleeps in 1 sec.

NOTE: TST_RETRY_FUNC is a wrapper for TST_RETRY_FN_EXP_BACKOFF, using it you can
define sleep time. Unfortunately current code does not allow to loop over less
than 1s, maybe it'd be worth for some cases, where the event is really fast.

@Metan, @Li: would it be worth to change TST_RETRY_FUNC (in both C and shell) to
use ms instead of s?

Also, we have tst_sleep helper, which supports also ms and us (but using
TST_RETRY_FUNC is IMHO better).

I'd have to look more deeply into the test to figure out the verifier.

Kind regards,
Petr

  reply	other threads:[~2020-07-16  9:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 15:25 [LTP] [PATCH] cpuset_hotplug_test.sh: Fix a race condition Qais Yousef
2020-07-16  6:07 ` Petr Vorel
2020-07-16  9:33   ` Qais Yousef
2020-07-16  9:57     ` Petr Vorel [this message]
2020-07-16 10:12       ` Qais Yousef
2020-07-16 12:08         ` Petr Vorel
2020-07-16 13:49           ` Qais Yousef
2020-07-16 14:21             ` Petr Vorel
2020-07-16 15:30               ` Qais Yousef
2020-07-16 20:56                 ` Petr Vorel
2020-07-17 11:25                   ` Qais Yousef
2020-07-17 11:28                     ` Petr Vorel

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=20200716095738.GA9395@dell5510 \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /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