tracing: Fix missing file i/o start ops. [chromium/src : main]

2 views
Skip to first unread message

David Bienvenu (Gerrit)

unread,
Jun 22, 2026, 9:43:26 AM (12 days ago) Jun 22
to Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray

David Bienvenu added 1 comment

Patchset-level comments
File-level comment, Patchset 5 (Latest):
David Bienvenu . resolved

PTAL

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6bc4b16a18d4339e08c547299217f0e738069a7a
Gerrit-Change-Number: 7963491
Gerrit-PatchSet: 5
Gerrit-Owner: David Bienvenu <davidb...@chromium.org>
Gerrit-Reviewer: David Bienvenu <davidb...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Comment-Date: Mon, 22 Jun 2026 13:42:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

David Bienvenu (Gerrit)

unread,
Jun 25, 2026, 10:50:01 PM (8 days ago) Jun 25
to Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray

David Bienvenu added 1 comment

Patchset-level comments
File-level comment, Patchset 7 (Latest):
David Bienvenu . resolved

gentle ping

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6bc4b16a18d4339e08c547299217f0e738069a7a
Gerrit-Change-Number: 7963491
Gerrit-PatchSet: 7
Gerrit-Owner: David Bienvenu <davidb...@chromium.org>
Gerrit-Reviewer: David Bienvenu <davidb...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Jun 2026 02:49:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Etienne Pierre-Doray (Gerrit)

unread,
Jun 26, 2026, 1:03:57 PM (7 days ago) Jun 26
to David Bienvenu, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from David Bienvenu

Etienne Pierre-Doray added 1 comment

Patchset-level comments
Etienne Pierre-Doray . resolved

Nice finding!

Tracking file i/o events from all processes to handle case where non
Chrome file i/o event completion happens to run on one of Chrome's
threads.

My main question: All IO events have ttid field (except for FileIo_OpEnd); Should we use ttid (instead of header.ThreadId) to decide if we should emit the event (this is perhaps more indicative of who the event belongs to)?
This would imply we need need to either track unfinished events (by irp) until we see the FileIo_OpEnd, or we unconditionally emit all FileIo_OpEnd.

Open in Gerrit

Related details

Attention is currently required from:
  • David Bienvenu
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6bc4b16a18d4339e08c547299217f0e738069a7a
Gerrit-Change-Number: 7963491
Gerrit-PatchSet: 7
Gerrit-Owner: David Bienvenu <davidb...@chromium.org>
Gerrit-Reviewer: David Bienvenu <davidb...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Attention: David Bienvenu <davidb...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Jun 2026 17:03:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

David Bienvenu (Gerrit)

unread,
Jun 26, 2026, 2:47:26 PM (7 days ago) Jun 26
to Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray

David Bienvenu added 1 comment

Patchset-level comments
Etienne Pierre-Doray . resolved

Nice finding!

Tracking file i/o events from all processes to handle case where non
Chrome file i/o event completion happens to run on one of Chrome's
threads.

My main question: All IO events have ttid field (except for FileIo_OpEnd); Should we use ttid (instead of header.ThreadId) to decide if we should emit the event (this is perhaps more indicative of who the event belongs to)?
This would imply we need need to either track unfinished events (by irp) until we see the FileIo_OpEnd, or we unconditionally emit all FileIo_OpEnd.

David Bienvenu

I think when I looked at this before, they were generally the same. But, it's only the FileIo_OpEnd events that appear to get run unrelated threads, and they don't have a ttid field. I can programatically check that they're the same to be sure, but I don't think it would affect this CL.

That's essentially what we're doing - tracking unfinished events by irp until we either see an op end event for that irp, or a start event with an existing unfinished irp event.

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6bc4b16a18d4339e08c547299217f0e738069a7a
Gerrit-Change-Number: 7963491
Gerrit-PatchSet: 7
Gerrit-Owner: David Bienvenu <davidb...@chromium.org>
Gerrit-Reviewer: David Bienvenu <davidb...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Jun 2026 18:46:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

David Bienvenu (Gerrit)

unread,
Jun 27, 2026, 6:29:04 PM (6 days ago) Jun 27
to Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray

David Bienvenu added 1 comment

Patchset-level comments
Etienne Pierre-Doray . resolved

Nice finding!

Tracking file i/o events from all processes to handle case where non
Chrome file i/o event completion happens to run on one of Chrome's
threads.

My main question: All IO events have ttid field (except for FileIo_OpEnd); Should we use ttid (instead of header.ThreadId) to decide if we should emit the event (this is perhaps more indicative of who the event belongs to)?
This would imply we need need to either track unfinished events (by irp) until we see the FileIo_OpEnd, or we unconditionally emit all FileIo_OpEnd.

David Bienvenu

I think when I looked at this before, they were generally the same. But, it's only the FileIo_OpEnd events that appear to get run unrelated threads, and they don't have a ttid field. I can programatically check that they're the same to be sure, but I don't think it would affect this CL.

That's essentially what we're doing - tracking unfinished events by irp until we either see an op end event for that irp, or a start event with an existing unfinished irp event.

David Bienvenu

I instrumented DecodeFileIoReadWriteEvent and ttid was always the same as headerThreadId, so I don't think that's an issue.

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6bc4b16a18d4339e08c547299217f0e738069a7a
Gerrit-Change-Number: 7963491
Gerrit-PatchSet: 7
Gerrit-Owner: David Bienvenu <davidb...@chromium.org>
Gerrit-Reviewer: David Bienvenu <davidb...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Comment-Date: Sat, 27 Jun 2026 22:28:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: David Bienvenu <davidb...@chromium.org>
Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Etienne Pierre-Doray (Gerrit)

unread,
Jun 29, 2026, 3:03:03 PM (4 days ago) Jun 29
to David Bienvenu, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from David Bienvenu

Etienne Pierre-Doray added 2 comments

Patchset-level comments
Etienne Pierre-Doray . unresolved

Nice finding!

Tracking file i/o events from all processes to handle case where non
Chrome file i/o event completion happens to run on one of Chrome's
threads.

My main question: All IO events have ttid field (except for FileIo_OpEnd); Should we use ttid (instead of header.ThreadId) to decide if we should emit the event (this is perhaps more indicative of who the event belongs to)?
This would imply we need need to either track unfinished events (by irp) until we see the FileIo_OpEnd, or we unconditionally emit all FileIo_OpEnd.

David Bienvenu

I think when I looked at this before, they were generally the same. But, it's only the FileIo_OpEnd events that appear to get run unrelated threads, and they don't have a ttid field. I can programatically check that they're the same to be sure, but I don't think it would affect this CL.

That's essentially what we're doing - tracking unfinished events by irp until we either see an op end event for that irp, or a start event with an existing unfinished irp event.

David Bienvenu

I instrumented DecodeFileIoReadWriteEvent and ttid was always the same as headerThreadId, so I don't think that's an issue.

Etienne Pierre-Doray

okk thanks for checking!

That's essentially what we're doing - tracking unfinished events by irp until we either see an op end event for that irp, or a start event with an existing unfinished irp event.

active_irps_from_non_chrome_threads_ sounds like we're doing the opposite (track events on non-chrome), but my understanding of the problem is that we want to track events started on chrome thread so that we can emit the end (regardless of which thread it shows up on)?
Or if the issue really is that we get "OpEnd / EndOperation" without the start, can we ignore those in trace_processor (where we already track the begin/end pairs)

File components/tracing/common/etw_consumer_win.cc
Line 336, Patchset 7 (Latest): const uint64_t irp_ptr =
ExtractIrpPtrFromEvent(opcode, pointer_size, packet_data);
Etienne Pierre-Doray . unresolved

I suspect the logic could be simplified if folded within DecodeFileIo*Event (at the cost of some repetition), and make a decision about should_record only then (based on my understanding).


e.g. for DecodeFileIoCreateEvent:
```
const bool should_record =
inclusion_policy_.ShouldRecordFileIoEvents(header.ThreadId);
if (!should_record) {
return;
}
...
const uint64_t irp_ptr = CopyPointerHash(iterator, pointer_size);
active_irps_.insert(irp_ptr);

// Read the contents of `packet_data` and generate a `FileIoCreate` event.
base::BufferIterator<const uint8_t> iterator{packet_data};
auto* event = MakeNextEvent(header, buffer_context);
event->set_thread_id(header.ThreadId);
auto* file_io_create = event->set_file_io_create();
file_io_create->set_irp_ptr(irp_ptr);
```

and in DecodeFileIoOpEndEvent:
```
const uint64_t irp_ptr = CopyPointerHash(iterator, pointer_size);
if (!active_irps_.erase(irp_ptr)) {
return;
}
// Read the contents of `packet_data` and generate a `FileIoOpEnd` event.
base::BufferIterator<const uint8_t> iterator{packet_data};
auto* event = MakeNextEvent(header, buffer_context);
event->set_thread_id(header.ThreadId);
auto* file_io_op_end = event->set_file_io_op_end();
file_io_op_end->set_irp_ptr(irp_ptr);
```
Open in Gerrit

Related details

Attention is currently required from:
  • David Bienvenu
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I6bc4b16a18d4339e08c547299217f0e738069a7a
    Gerrit-Change-Number: 7963491
    Gerrit-PatchSet: 7
    Gerrit-Owner: David Bienvenu <davidb...@chromium.org>
    Gerrit-Reviewer: David Bienvenu <davidb...@chromium.org>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Attention: David Bienvenu <davidb...@chromium.org>
    Gerrit-Comment-Date: Mon, 29 Jun 2026 19:02:52 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    David Bienvenu (Gerrit)

    unread,
    Jun 30, 2026, 6:02:55 PM (3 days ago) Jun 30
    to Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Etienne Pierre-Doray

    David Bienvenu voted and added 2 comments

    Votes added by David Bienvenu

    Commit-Queue+1

    2 comments

    Patchset-level comments
    Etienne Pierre-Doray . unresolved

    Nice finding!

    Tracking file i/o events from all processes to handle case where non
    Chrome file i/o event completion happens to run on one of Chrome's
    threads.

    My main question: All IO events have ttid field (except for FileIo_OpEnd); Should we use ttid (instead of header.ThreadId) to decide if we should emit the event (this is perhaps more indicative of who the event belongs to)?
    This would imply we need need to either track unfinished events (by irp) until we see the FileIo_OpEnd, or we unconditionally emit all FileIo_OpEnd.

    David Bienvenu

    I think when I looked at this before, they were generally the same. But, it's only the FileIo_OpEnd events that appear to get run unrelated threads, and they don't have a ttid field. I can programatically check that they're the same to be sure, but I don't think it would affect this CL.

    That's essentially what we're doing - tracking unfinished events by irp until we either see an op end event for that irp, or a start event with an existing unfinished irp event.

    David Bienvenu

    I instrumented DecodeFileIoReadWriteEvent and ttid was always the same as headerThreadId, so I don't think that's an issue.

    Etienne Pierre-Doray

    okk thanks for checking!

    That's essentially what we're doing - tracking unfinished events by irp until we either see an op end event for that irp, or a start event with an existing unfinished irp event.

    active_irps_from_non_chrome_threads_ sounds like we're doing the opposite (track events on non-chrome), but my understanding of the problem is that we want to track events started on chrome thread so that we can emit the end (regardless of which thread it shows up on)?
    Or if the issue really is that we get "OpEnd / EndOperation" without the start, can we ignore those in trace_processor (where we already track the begin/end pairs)

    David Bienvenu

    No, it's the opposite - we need to track events started on non-chrome threads because the end event might be emitted on a chrome thread. Basically, after the file read/write finishes, Windows just picks some idle thread to run the end operation on, in some cases.

    File components/tracing/common/etw_consumer_win.cc
    Line 336, Patchset 7: const uint64_t irp_ptr =
    ExtractIrpPtrFromEvent(opcode, pointer_size, packet_data);
    David Bienvenu

    This CL move the irp_ptr handling from non Chrome threads into the individual file op decoders. It's slightly more efficient in that we only create one base::BufferIterator<const uint8_t> iterator. However, I found that the Flt ops for non Chrome threads can also have the end op run on Chrome threads, and there may be other kinds of ops that have the same issue, which would increase the code duplication. I might have a go at instrumenting the code to see which ops can have their end events run on Chrome threads, and their relative frequency.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Etienne Pierre-Doray
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I6bc4b16a18d4339e08c547299217f0e738069a7a
    Gerrit-Change-Number: 7963491
    Gerrit-PatchSet: 8
    Gerrit-Owner: David Bienvenu <davidb...@chromium.org>
    Gerrit-Reviewer: David Bienvenu <davidb...@chromium.org>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Comment-Date: Tue, 30 Jun 2026 22:02:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages