From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Daniel Colascione <dancol@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-api <linux-api@vger.kernel.org>,
Tim Murray <timmurray@google.com>,
Primiano Tucci <primiano@google.com>,
Joel Fernandes <joelaf@google.com>,
Jonathan Corbet <corbet@lwn.net>,
Mike Rapoport <rppt@linux.vnet.ibm.com>,
Vlastimil Babka <vbabka@suse.cz>, Roman Gushchin <guro@fb.com>,
Prashant Dhamdhere <pdhamdhe@redhat.com>,
"Dennis Zhou (Facebook)" <dennisszhou@gmail.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
linux@dominikbrodowski.net, Josh Poimboeuf <jpoimboe@redhat.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH v2] Add /proc/pid_gen
Date: Thu, 22 Nov 2018 10:27:20 -0500 (EST) [thread overview]
Message-ID: <1320611605.10033.1542900440206.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <CAKOZueuV=X4eqc+-8Jh3Z-2iQO+4fp2otEOs03yQoaa88C9zUA@mail.gmail.com>
----- On Nov 21, 2018, at 7:30 PM, Daniel Colascione dancol@google.com wrote:
[...]
>> > >
>> > > The problem here is the possibility of confusion, even if it's rare.
>> > > Does the naive approach of just walking /proc and ignoring the
>> > > possibility of PID reuse races work most of the time? Sure. But "most
>> > > of the time" isn't good enough. It's not that there are tons of sob
>> > > stories: it's that without completely robust reporting, we can't rule
>> > > out of the possibility that weirdness we observe in a given trace is
>> > > actually just an artifact from a kinda-sort-working best-effort trace
>> > > collection system instead of a real anomaly in behavior. Tracing,
>> > > essentially, gives us deltas for system state, and without an accurate
>> > > baseline, collected via some kind of scan on trace startup, it's
>> > > impossible to use these deltas to robustly reconstruct total system
>> > > state at a given time. And this matters, because errors in
>> > > reconstruction (e.g., assigning a thread to the wrong process because
>> > > the IDs happen to be reused) can affect processing of the whole trace.
>> > > If it's 3am and I'm analyzing the lone trace from a dogfooder
>> > > demonstrating a particularly nasty problem, I don't want to find out
>> > > that the trace I'm analyzing ended up being useless because the
>> > > kernel's trace system is merely best effort. It's very cheap to be
>> > > 100% reliable here, so let's be reliable and rule out sources of
>> > > error.
>> >
[...]
I've just been CC'd on this thread for some reason, so I'll add my 2 cents.
WHIW, I think using /proc to add stateful information to a time-based
trace is the wrong way to do things. Here, the fact that you need to
add a generation counter struct pid_namespace and expose it via /proc
just highlights its limitations when it comes to dealing with state
that changes over time. Your current issue is with PID re-use, but
you will eventually face the same issue for re-use of all other resources
you are trying to model. For instance, a file descriptor may be associated
to a path as some point in time, but that is not true anymore after a
sequence of close/open which re-uses that file descriptor. Does that
mean we will eventually end up needing per-file-descriptor generation
counters as well ?
LTTng solves this by dumping the system state as events within the
trace [1], which associates time-stamps with the state being dumped.
It is recorded while the rest of the system is being traced, so tools
can reconstruct full system state by combining this statedump with the
rest of the events recording state transitions.
So while I agree that it's important to have a way to reconstruct
system state that is aware of PID re-use, I think trying to extend
/proc for this is the wrong approach. It adds extra fields to struct
pid_namespace that seem to be only useful for tracing, whereas using
the time-stamp at which the thread/process was first seen in the trace
(either fork or statedump) as secondary key should suffice to uniquely
identify a thread/process. I would recommend extending tracing
facilities to dump the data you need rather than /proc.
Thanks,
Mathieu
[1] http://git.lttng.org/?p=lttng-modules.git;a=blob;f=lttng-statedump-impl.c;h=dc037508c055b7f61b8c758d581bd0178e26552a;hb=HEAD
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2018-11-22 15:27 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 20:14 [PATCH] Add /proc/pid_generation Daniel Colascione
2018-11-21 20:31 ` Matthew Wilcox
2018-11-21 20:38 ` Daniel Colascione
2018-11-22 2:06 ` Matthew Wilcox
2018-11-25 22:55 ` Pavel Machek
2018-11-21 20:54 ` [PATCH v2] Add /proc/pid_gen Daniel Colascione
2018-11-21 22:12 ` Andrew Morton
2018-11-21 22:40 ` Daniel Colascione
2018-11-21 22:48 ` Jann Horn
2018-11-21 22:52 ` Daniel Colascione
2018-11-21 22:50 ` Andrew Morton
2018-11-21 23:21 ` Daniel Colascione
2018-11-21 23:35 ` Andy Lutomirski
2018-11-22 0:21 ` Daniel Colascione
2018-11-22 13:58 ` Cyrill Gorcunov
2018-11-22 0:22 ` Andrew Morton
2018-11-22 0:28 ` Daniel Colascione
2018-11-22 0:30 ` Daniel Colascione
2018-11-22 15:27 ` Mathieu Desnoyers [this message]
2018-11-22 0:57 ` Andrew Morton
2018-11-22 1:08 ` Daniel Colascione
2018-11-22 1:29 ` Andrew Morton
2018-11-22 2:35 ` Tim Murray
2018-11-22 5:30 ` Daniel Colascione
2018-11-22 11:19 ` [PATCH] Add /proc/pid_generation Kevin Easton
2018-11-23 11:14 ` David Laight
2018-11-25 23:00 ` Pavel Machek
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=1320611605.10033.1542900440206.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=corbet@lwn.net \
--cc=dancol@google.com \
--cc=dennisszhou@gmail.com \
--cc=ebiederm@xmission.com \
--cc=guro@fb.com \
--cc=joelaf@google.com \
--cc=jpoimboe@redhat.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=pdhamdhe@redhat.com \
--cc=primiano@google.com \
--cc=rostedt@goodmis.org \
--cc=rppt@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=timmurray@google.com \
--cc=vbabka@suse.cz \
/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 NNTP newsgroup(s).