From: Craig Ringer <craig@2ndquadrant.com>
To: fche at redhat dot com <sourceware-bugzilla@sourceware.org>
Cc: systemtap@sourceware.org
Subject: Re: [Bug translator/26296] New: delay script-global locking until required
Date: Fri, 24 Jul 2020 13:22:29 +0800 [thread overview]
Message-ID: <CAMsr+YEPgJTDJvze2BHz20zFS19=nhV2GYL9oK70eFKUqB=r6w@mail.gmail.com> (raw)
In-Reply-To: <bug-26296-6586@http.sourceware.org/bugzilla/>
>
> IOW: defer locking to the first moment when any global is actually
> read/written, tracking locked-ness in a new context local. This would
> involve
> only a small change to the translator, involving only context-free logic.
> That
> could later be optimized to remove repeated checks/etc. over multiple
> global vars in
> a control-flow / context aware way.
>
>
Even an explicit construct that scopes locking would be handy. Borrow from
Java's "synchronized" perhaps.
The fact that whole probes get locked is a serious limitation for one of my
systemtap use cases, where I inject delays and faults into the target
application. The probe flow is supposed to be something like:
global targets_map;
probe process("foo").mark("some_probe_point") {
if (pid() in targets_map) {
kdelay(100000);
}
}
where kdelay is a simple embedded C wrapper around the kernel function of
the same name. But due to the locking on the global "targets_map", every
hit on "some_probe_point" will block on the lock held by the sleeping
probe. So probes can't inject sleeps or delays to try to trigger race
conditions.
So yes, the ability to take a lock over a narrower scope than the whole
probe would be very desirable.
I've wondered about the feasibility of doing this in embedded C, but
haven't had a chance to explore it properly yet.
This reminds me - is it ever safe to sleep in a systemtap probe, e.g. to
call ksleep() rather than busy-loop?
--
Craig Ringer http://www.2ndQuadrant.com/
2ndQuadrant - PostgreSQL Solutions for the Enterprise
next prev parent reply other threads:[~2020-07-24 5:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 15:40 fche at redhat dot com
2020-07-24 5:22 ` Craig Ringer [this message]
2020-07-24 14:12 ` Arkady
2020-07-24 5:22 ` [Bug translator/26296] " craig at 2ndquadrant dot com
2020-07-24 14:12 ` arkady.miasnikov at gmail dot com
2020-08-04 19:59 ` fche at redhat dot com
2020-08-10 6:32 ` Craig Ringer
2020-08-10 6:33 ` craig at 2ndquadrant dot com
2020-08-18 19:06 ` fche at redhat dot com
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='CAMsr+YEPgJTDJvze2BHz20zFS19=nhV2GYL9oK70eFKUqB=r6w@mail.gmail.com' \
--to=craig@2ndquadrant.com \
--cc=sourceware-bugzilla@sourceware.org \
--cc=systemtap@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).