From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] Test library API changes
Date: Mon, 14 Mar 2016 17:00:37 +0100 [thread overview]
Message-ID: <20160314160036.GA2511@rei.lan> (raw)
In-Reply-To: <20160314125153.GB600@rei.lan>
Hi!
> > I'm not sure it is enough to make cleanup() call only once. It looks like
> > we still can get into situation where we call "do_cleanup();cleanup_ipc();"
> > more than once (if we hit tst_brk in multiple threads with newlib)
>
> Right this macro is purely for guarding the user supplied callback.
>
> Unfortunately the pthread_once() does not compile to a stub without
> -pthread, otherwise we could just use it on the do_cleanup() in library
> and get rid of that part in the testcase.
>
> I guess that we can emulate it with mutexes as well and guard the
> library cleanup hence the user supplied cleanup would end up thread safe
> as well without any additional work.
Thinking of thread safe callback it gets more complicated than that.
We should not execute the cleanup while other threads are still running
as well since the cleanup may remove resources these threads are using
and we may end up segfaulting.
The ideal solution would be killing/stopping rest of the threads at this
point. I guess that we can kill them looping over /proc/self/task/
directory.
I.e.:
mutex_lock()
for tid in /proc/self/task/* {
if tid != mytid
tgkill(pid, tid, 9);
}
mutex_unlock()
do_cleanup()
do_exit();
What do you think?
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2016-03-14 16:00 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 11:11 [LTP] Test library API changes Cyril Hrubis
2016-01-07 13:01 ` Jan Stancek
2016-01-07 13:27 ` Cyril Hrubis
2016-02-04 10:56 ` Cyril Hrubis
2016-02-08 18:02 ` Cyril Hrubis
2016-02-09 16:43 ` Cyril Hrubis
2016-02-09 16:57 ` Cyril Hrubis
2016-02-09 17:46 ` Cyril Hrubis
2016-02-10 10:42 ` Jan Stancek
2016-02-10 10:56 ` Cyril Hrubis
2016-02-10 11:41 ` Cyril Hrubis
2016-02-11 16:03 ` Cyril Hrubis
2016-02-12 12:33 ` Jan Stancek
2016-02-12 17:53 ` Cyril Hrubis
2016-02-16 21:19 ` Cyril Hrubis
2016-02-17 14:39 ` Jan Stancek
2016-02-17 15:54 ` Cyril Hrubis
2016-02-18 9:05 ` Jan Stancek
2016-02-18 11:07 ` Cyril Hrubis
2016-02-18 11:26 ` Jan Stancek
2016-02-18 11:53 ` Cyril Hrubis
2016-03-02 14:44 ` Cyril Hrubis
2016-03-03 13:13 ` Jan Stancek
2016-03-03 14:00 ` Cyril Hrubis
2016-03-10 16:57 ` Cyril Hrubis
2016-03-11 13:57 ` Jan Stancek
2016-03-14 12:51 ` Cyril Hrubis
2016-03-14 16:00 ` Cyril Hrubis [this message]
2016-03-15 8:58 ` Jan Stancek
2016-03-15 9:22 ` Cyril Hrubis
2016-03-17 16:06 ` Cyril Hrubis
2016-03-18 9:44 ` Jan Stancek
2016-03-31 10:01 ` Cyril Hrubis
2016-04-01 14:45 ` Jan Stancek
2016-04-04 12:04 ` Cyril Hrubis
2016-04-04 14:12 ` Jan Stancek
2016-04-05 14:16 ` Cyril Hrubis
2016-04-05 15:06 ` Jan Stancek
2016-04-06 10:37 ` Cyril Hrubis
2016-03-14 16:40 ` Cyril Hrubis
2016-02-18 9:14 ` Alexey Kodanev
2016-02-18 10:40 ` Cyril Hrubis
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=20160314160036.GA2511@rei.lan \
--to=chrubis@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