Closed
Bug 888534
Opened 13 years ago
Closed 4 years ago
IOInterposer enhancements
Categories
(Core :: Gecko Profiler, enhancement, P3)
Core
Gecko Profiler
Tracking
()
RESOLVED
FIXED
People
(Reporter: bugzilla, Assigned: bugzilla)
Details
(Whiteboard: [leave open])
Attachments
(3 files, 2 obsolete files)
|
15.81 KB,
patch
|
bugzilla
:
review+
|
Details | Diff | Splinter Review |
|
5.88 KB,
patch
|
glandium
:
review-
|
Details | Diff | Splinter Review |
|
2.18 KB,
patch
|
jonasfj
:
review+
|
Details | Diff | Splinter Review |
Add support for off-main-thread I/O.
Also add support for file create/open and close operations.
| Assignee | ||
Comment 1•12 years ago
|
||
This patch adds new IOInterposer operations and modifies the SQLite and NSPR interposing accordingly.
Interposing PR_Open is a special case for which I will be attaching a second patch.
Attachment #808872 -
Flags: review?(jopsen)
| Assignee | ||
Comment 2•12 years ago
|
||
WIP for part 2. On Try, JP goes orange on OSX. Investigating.
Comment 3•12 years ago
|
||
Comment on attachment 808872 [details] [diff] [review]
Part 1: Add new operations for create, stat, close
Review of attachment 808872 [details] [diff] [review]:
-----------------------------------------------------------------
So I imagined `IOInterposeObserver::Observer` as a small set of generic operation types. But with fsync already
there I see that it makes sense to just make a flag for each type of operation we interpose.
Even if we at some point interpose readdir, rename, remove/unlink and friends, we're probably not going to run out of flags.
Anyways, this looks good to go, so I'll r+. I do have two small things for consideration... But we could also address those
in another patch, or simply not do anything about them at all. Once we have poison IO interposer and filename support we'll
have to discuss whether more metadata is desired in the profiler (assuming that bug on adding metadata is fixed)...
(So remarks below, is more to open a discussion, don't let them stop you from landing this).
::: tools/profiler/IOInterposer.h
@@ +30,2 @@
> OpWriteFSync = (OpWrite | OpFSync),
> + OpAll = (OpCreateOrOpen | OpRead | OpWrite | OpFSync | OpStat | OpClose)
Maybe we should add a `OpAllInput` for all input operations, and `OpAllOutput` for all output operations (similar to how OpAll works).
That way a consumer like late-write checks would be able to get all output operations, without a need to update it when new functions are interposed.
(This would replace OpWriteFSync which isn't very generic).
Anyways, just a thought... I could also do it when I rework the late-write checks patch.
::: tools/profiler/ProfilerIOInterposeObserver.cpp
@@ +12,5 @@
> + const char* str = nullptr;
> +
> + switch (aObservation.ObservedOperation()) {
> + case IOInterposeObserver::OpCreateOrOpen:
> + str = "create/open";
Maybe we should put this in a static function in IOInterposer.(h|cpp).
Ie. have IOInterposerObserver::OperationToString(Operation aOp), as
a static method that gives us a human readable string from an Operation.
(This could be useful elsewhere, and be easier to update when we interpose other operations).
Though an even better solution would be to provide a sensible string
for the IOInterposeObserver::Observation::Reference() property.
This should be done when we report the operation, where we currently just report "NSPRIOInterposing", "sqlite-mainthread" or "sqlite-otherthread".
Anyways, I think this is fine for now. We'll want to look into this again, when PoisonIOInterposer lands...
Attachment #808872 -
Flags: review?(jopsen) → review+
| Assignee | ||
Comment 4•12 years ago
|
||
Rebased part 1, carrying forward r+
Attachment #808872 -
Attachment is obsolete: true
Attachment #812783 -
Flags: review+
| Assignee | ||
Comment 5•12 years ago
|
||
Try build:
https://tbpl.mozilla.org/?tree=Try&rev=7bd8b11d45d4
https://hg.mozilla.org/integration/mozilla-inbound/rev/22da748201eb
Whiteboard: [leave open]
| Assignee | ||
Comment 7•12 years ago
|
||
This patch intercepts PR_Open by defining our own version of PR_Open in xul.dll that then loads the real symbol from NSPR. There is a special code path for MacOS that ensures that we provide an absolute path to the dynamic library unless DYLD_LIBRARY_PATH is defined. This is needed to prevent Mn and JP test failures.
Attachment #808874 -
Attachment is obsolete: true
Attachment #8340045 -
Flags: review?(mh+mozilla)
Comment 8•12 years ago
|
||
Comment on attachment 8340045 [details] [diff] [review]
Part 2: Add support for PR_Open to NSPRInterposer
Review of attachment 8340045 [details] [diff] [review]:
-----------------------------------------------------------------
::: tools/profiler/NSPRInterposer.cpp
@@ +302,5 @@
> +
> +} // anonymous namespace
> +
> +// This works because this symbol is provided to the linker before NSPR.
> +// (This is non-standard but works on all first-tier linkers)
I very much doubt this is true:
- nspr internally calls PR_Open.
- nss calls PR_Open and is linked against nspr, not libxul
- except for linux, symbol binding at dynamic linking time is made on the tuple (lib, symbol), not symbol alone, so anything linked against (nspr, PR_Open) is going to use PR_Open from nspr, not this one.
- even on linux, nspr and nss are linked before libxul (libxul depending on them), which means they are both going to use nspr's PR_Open. Furthermore, binary components (like libbrowsercomps.so), linked against nspr, and libxul, are likely to use nspr's PR_Open.
I think the best thing to do here is to make an ABI compatible change to NSPR that allows to interpose PR_Open like the other PR_* I/O-related functions.
Attachment #8340045 -
Flags: review?(mh+mozilla) → review-
| Assignee | ||
Comment 9•12 years ago
|
||
I missed adding the new operations to IOInterposer::Unregister when I wrote part 1. This patch rectifies that situation. :-)
Attachment #8361512 -
Flags: review?(jopsen)
Comment 10•12 years ago
|
||
Comment on attachment 8361512 [details] [diff] [review]
Part 1.5: Add new operations to IOInterposer::Unregister
Review of attachment 8361512 [details] [diff] [review]:
-----------------------------------------------------------------
Simply perfect, r+
I have no further comments :)
Attachment #8361512 -
Flags: review?(jopsen) → review+
| Assignee | ||
Comment 11•12 years ago
|
||
Comment 12•12 years ago
|
||
Comment 13•9 years ago
|
||
Aaron, I'm currently going through all bugs in the Gecko Profiler component and determining which ones we can close.
It looks like all that's left in this bug is the part 2 patch. Do you still have plans for this patch? I suspect it's just for instrumenting off-main-thread IO caused by loading libraries?
Flags: needinfo?(aklotz)
Should check if this is still needed...
Type: defect → enhancement
Flags: needinfo?(gsquelart)
Priority: -- → P3
| Assignee | ||
Comment 15•6 years ago
|
||
This is not currently on my radar, but feel free to pick it up if necessary. Part 2 is a bit thorny because we'd have to make some significant changes how PR_Open works in NSPR.
Flags: needinfo?(aklotz)
Still on my NI radar, but low priority.
| Assignee | ||
Updated•4 years ago
|
Assignee: bugzilla → nobody
Status: ASSIGNED → NEW
I believe we're intercepting most IOs now, and showing them as markers when one of the "FileIO..." profiler features is enabled.
NtClose is still missing, see bug 1762830.
So I'll mark this old bug here "fixed".
Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(gsquelart)
Resolution: --- → FIXED
Updated•4 years ago
|
Assignee: nobody → bugzilla
You need to log in
before you can comment on or make changes to this bug.
Description
•