From: John Kacur <jkacur@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-rt-users@vger.kernel.org,
Clark Williams <williams@redhat.com>,
Daniel Wagner <wagi@monom.org>
Subject: Re: [PATCH 4/5] signaltest: Fix break value argument
Date: Tue, 10 Nov 2020 15:08:17 -0500 (EST) [thread overview]
Message-ID: <87658dba-5f65-e77-72dc-6b4974cfdf1b@redhat.com> (raw)
In-Reply-To: <20201110180036.859080-5-bigeasy@linutronix.de>
On Tue, 10 Nov 2020, Sebastian Andrzej Siewior wrote:
> The break value '-b' is not working properly:
> - Every thread may hit the break value. This is expected for thread
> number > 0 because thread number 0 sleeps every 16 iterations to give
> the system time to breath. This delay may wrongly trigger as the break
> value.
>
> - If a thread hits the break value then it returns signaling "shutdown".
> The main thread will then SIGTERM to each of the remaining threads.
> This is a nop because this signal is blocked.
> Send SIGUSR1 instead which is waited for.
>
> While doing all of this, report the actual `max' value.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> src/signaltest/signaltest.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index 84eb8827faa5e..dacaa63673c48 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -58,6 +58,7 @@ struct thread_stat {
> pthread_t tothread;
> int threadstarted;
> int tid;
> + int interrupted;
> };
>
> static int shutdown;
> @@ -123,13 +124,16 @@ void *signalthread(void *param)
>
> diff = calcdiff(after, before);
> before = now;
> +
> if (diff < stat->min)
> stat->min = diff;
> if (diff > stat->max)
> stat->max = diff;
> stat->avg += (double) diff;
>
> - if (!stopped && tracelimit && (diff > tracelimit)) {
> + if (!stopped && tracelimit && !par->id && (diff > tracelimit)) {
> + stat->act = diff;
> + stat->interrupted = 1;
> stopped++;
> shutdown++;
> }
> @@ -376,11 +380,12 @@ int main(int argc, char **argv)
> quiet = 2;
> for (i = 0; i < num_threads; i++) {
> if (stat[i].threadstarted > 0)
> - pthread_kill(stat[i].thread, SIGTERM);
> + pthread_kill(stat[i].thread, SIGUSR1);
> + if (stat[i].interrupted)
> + printf("Thread %d exceeded trace limit.\n", i);
> if (stat[i].threadstarted) {
> pthread_join(stat[i].thread, NULL);
> - if (quiet && (i == 0))
> - print_stat(&par[i], i, 0);
> + print_stat(&par[i], i, 0);
> }
> if (stat[i].values)
> free(stat[i].values);
> --
> 2.29.2
>
>
Signed-off-by: John Kacur <jkacur@redhat.com>
next prev parent reply other threads:[~2020-11-10 20:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-10 18:00 [PATCH 0/5] rt-tests: Mostly signaltest clean up Sebastian Andrzej Siewior
2020-11-10 18:00 ` [PATCH 1/5] cyclictest: Only report the first incident Sebastian Andrzej Siewior
2020-11-10 20:06 ` John Kacur
2020-11-10 18:00 ` [PATCH 2/5] signaltest: Remove drunk code Sebastian Andrzej Siewior
2020-11-10 20:07 ` John Kacur
2020-11-10 18:00 ` [PATCH 3/5] signaltest: Don't expect trace interface at /proc Sebastian Andrzej Siewior
2020-11-10 20:07 ` John Kacur
2020-11-10 18:00 ` [PATCH 4/5] signaltest: Fix break value argument Sebastian Andrzej Siewior
2020-11-10 20:08 ` John Kacur [this message]
2020-11-10 18:00 ` [PATCH 5/5] signaltest: Add tracing bits Sebastian Andrzej Siewior
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=87658dba-5f65-e77-72dc-6b4974cfdf1b@redhat.com \
--to=jkacur@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=linux-rt-users@vger.kernel.org \
--cc=wagi@monom.org \
--cc=williams@redhat.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