Skip to content

Rework action pipe transport and serve the kernel UI over a private pipe - #708

Open
markgalvan-intel wants to merge 1 commit into
mainfrom
pipe-update
Open

markgalvan-intel wants to merge 1 commit into
mainfrom
pipe-update

Conversation

@markgalvan-intel

Copy link
Copy Markdown
Collaborator

Each action session now runs over a single duplex pipe instead of separate in and out pipes. Requests, responses and pushed events share that pipe and are demultiplexed by packet type and command token, with response timeouts and bounded handling of late responses. Clients and servers have an explicit lifecycle (Running, Stopping, Stopped): dispatches are admitted through a gate, shutdown waits for in-flight work and joins its runner rather than detaching it, and every session ends with a recorded reason before it is disposed. Server send policies (request-response, single peer, addressed, paired) are declared in the type; the server enforces a session cap and a handshake deadline, ends any connection that acts before OpenSession, and logs the system-reported client pid. Every pipe write has one deadline covering the wait for the write lock and the write itself: a write that stalls part way ends the session as PeerStalled, while one that times out before sending anything fails only that request. The kernel no longer publishes a connectable pipe for its UI; for each UI launch it creates a single-instance pipe pair, connects both ends itself, and passes the client end to PresentMonUI by handle inheritance, and the UI browser process owns that connection and relays page calls and kernel events to the renderer. The service log pipe and its command line options are removed, --p2c-act-name is replaced by --p2c-act-handle, and the packet header version is now 2, so builds from before this change cannot connect to it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Cross-process inheritance and shutdown require Windows validation and human review, with a transport timeout correction still outstanding.

1 open issue
What changed in this PR

Reworks action transport across the service, middleware, kernel, and UI around single duplex connections and explicit session lifetimes.

Changes:

  • Adds packet routing, bounded deadlines, admission controls, and coordinated shutdown.
  • Moves the kernel connection into the UI browser process using inherited private pipe handles.
  • Removes service log-pipe options and adds transport regression coverage.
File Description
Tests/​ensure-aux.ps1 Explicitly imports PowerShell utilities.
PresentMonService.args.json Removes obsolete logging option.
IntelPresentMon/​UnitTests/​UnitTests.vcxproj.filters Lists hotkey tests.
IntelPresentMon/​UnitTests/​UnitTests.vcxproj Includes hotkey tests.
IntelPresentMon/​UnitTests/​HotkeyTests.cpp Tests binding cleanup and replacement.
IntelPresentMon/​UnitTests/​CMakeLists.txt Builds hotkey tests.
IntelPresentMon/​PresentMonService/​testing/​TestControl.h Adds transport status access.
IntelPresentMon/​PresentMonService/​testing/​TestControl.cpp Reports session and acceptor counts.
IntelPresentMon/​PresentMonService/​PresentMonService.args.json Removes obsolete logging option.
IntelPresentMon/​PresentMonService/​PMMainThread.cpp Drains transport before stopping traces.
IntelPresentMon/​PresentMonService/​LogSetup.cpp Removes service log-pipe publishing.
IntelPresentMon/​PresentMonService/​GlobalIdentifiers.h Removes log-pipe identifier.
IntelPresentMon/​PresentMonService/​CliOptions.h Removes log-pipe options.
IntelPresentMon/​PresentMonService/​acts/​OpenSession.h Updates session logging.
IntelPresentMon/​PresentMonService/​ActionServer.h Exposes shutdown and transport status.
IntelPresentMon/​PresentMonService/​ActionServer.cpp Implements server lifecycle wrappers.
IntelPresentMon/​PresentMonService/​ActionExecutionContext.h Adds teardown-aware disposal contract.
IntelPresentMon/​PresentMonService/​ActionExecutionContext.cpp Makes cleanup conditional on session state.
IntelPresentMon/​PresentMonMiddleware/​SharedServicePipeVerification.h Includes connector dependency explicitly.
IntelPresentMon/​PresentMonMiddleware/​MiddlewareExecutionContext.h Simplifies session context.
IntelPresentMon/​PresentMonMiddleware/​ActionClient.h Uses updated connector accessor.
IntelPresentMon/​PresentMonAPI2Tests/​UiLaunchTests.cpp Checks private UI pipe usage.
IntelPresentMon/​PresentMonAPI2Tests/​TransportWriteDeadlineTests.cpp Tests request and write deadlines.
IntelPresentMon/​PresentMonAPI2Tests/​TransportTestKit.cpp Registers transport test actions.
IntelPresentMon/​PresentMonAPI2Tests/​TransportSessionTests.cpp Tests admission and session policies.
IntelPresentMon/​PresentMonAPI2Tests/​TransportPairedTests.cpp Tests paired sessions and inheritance.
IntelPresentMon/​PresentMonAPI2Tests/​TransportDemuxTests.cpp Tests routing and command tokens.
IntelPresentMon/​PresentMonAPI2Tests/​TestProcess.h Exposes test control-pipe name.
IntelPresentMon/​PresentMonAPI2Tests/​TestCommands.h Adds transport health fields.
IntelPresentMon/​PresentMonAPI2Tests/​RawPipeClient.h Adds raw transport test client.
IntelPresentMon/​PresentMonAPI2Tests/​PresentMonAPI2Tests.vcxproj.filters Lists new transport tests.
IntelPresentMon/​PresentMonAPI2Tests/​PresentMonAPI2Tests.vcxproj Includes new transport tests.
IntelPresentMon/​PresentMonAPI2Tests/​PipePairTests.cpp Tests pipe pairs and timed locks.
IntelPresentMon/​PresentMonAPI2Tests/​MultiClientTests.cpp Adds service transport abuse tests.
IntelPresentMon/​PresentMonAPI2Tests/​CMakeLists.txt Builds transport regression tests.
IntelPresentMon/​PresentMonAPI2Tests/​ActionRunnerTests.cpp Tests deferred dispatch admission.
IntelPresentMon/​KernelProcess/​winmain.cpp Creates inherited UI pipes and coordinates teardown.
IntelPresentMon/​KernelProcess/​KernelProcess.args.json Removes service log-pipe option.
IntelPresentMon/​KernelProcess/​kact/​KernelExecutionContext.h Clears hotkeys when sessions end.
IntelPresentMon/​Interprocess/​source/​act/​Transfer.h Routes responses and applies deadlines.
IntelPresentMon/​Interprocess/​source/​act/​SymmetricActionClient.h Adds gated dispatch and explicit lifecycle.
IntelPresentMon/​Interprocess/​source/​act/​SessionLimits.h Defines admission and handshake limits.
IntelPresentMon/​Interprocess/​source/​act/​SessionEndReason.h Defines session disposition and cleanup policy.
IntelPresentMon/​Interprocess/​source/​act/​ServerSendPolicy.h Declares server send policies.
IntelPresentMon/​Interprocess/​source/​act/​ResponseRouter.h Defines pending-response routing contracts.
IntelPresentMon/​Interprocess/​source/​act/​Packet.h Introduces protocol version 2 and bounds.
IntelPresentMon/​Interprocess/​source/​act/​Lifecycle.h Tracks shutdown phases and completion.
IntelPresentMon/​Interprocess/​source/​act/​CommandTokenAllocator.h Allocates available routing tokens.
IntelPresentMon/​Interprocess/​source/​act/​AsyncAction.h Applies response write deadlines.
IntelPresentMon/​Interprocess/​source/​act/​AdmissionGate.h Coordinates dispatch admission with shutdown.
IntelPresentMon/​Interprocess/​source/​act/​ActionServerShutdown.h Orders server and trace teardown.
IntelPresentMon/​Interprocess/​source/​act/​ActionRunner.h Shares dispatch and runner shutdown helpers.
IntelPresentMon/​Interprocess/​source/​act/​ActionContext.h Defines transport context requirements.
IntelPresentMon/​Core/​source/​win/​HotkeyListener.h Declares stop and binding cleanup APIs.
IntelPresentMon/​Core/​source/​win/​HotkeyListener.cpp Implements listener shutdown and cleanup.
IntelPresentMon/​Core/​source/​infra/​LogSetup.cpp Updates pipe availability call.
IntelPresentMon/​Core/​source/​cli/​CliOptions.h Removes service log-pipe options.
IntelPresentMon/​CommonUtilities/​pipe/​SecurityMode.h Removes obsolete security modes.
IntelPresentMon/​CommonUtilities/​pipe/​Pipe.h Adds framing limits and timed writes.
IntelPresentMon/​CommonUtilities/​pipe/​Pipe.cpp Implements private pairs and cancellation.
IntelPresentMon/​CommonUtilities/​pipe/​ManualAsyncEvent.h Adds persistent signaling and timeouts.
IntelPresentMon/​CommonUtilities/​pipe/​CoroMutex.h Declares timed, cancellable locking.
IntelPresentMon/​CommonUtilities/​pipe/​CoroMutex.cpp Implements waiter ownership and cancellation.
IntelPresentMon/​AppCef/​source/​winmain.cpp Owns kernel connection in browser process.
IntelPresentMon/​AppCef/​source/​util/​SignalManager.h Declares relayed signal handling.
IntelPresentMon/​AppCef/​source/​util/​SignalManager.cpp Dispatches browser-forwarded signals.
IntelPresentMon/​AppCef/​source/​util/​LogSetup.cpp Updates pipe availability call.
IntelPresentMon/​AppCef/​source/​util/​KernelWrapper.h Stores renderer-side kernel versions.
IntelPresentMon/​AppCef/​source/​util/​KernelRelay.h Defines browser-renderer relay contracts.
IntelPresentMon/​AppCef/​source/​util/​KernelRelay.cpp Forwards calls, replies, and signals.
IntelPresentMon/​AppCef/​source/​util/​KernelLink.h Declares browser-owned kernel connection.
IntelPresentMon/​AppCef/​source/​util/​KernelLink.cpp Adopts inherited handle and opens session.
IntelPresentMon/​AppCef/​source/​util/​KernelActionRegistration.cpp Registers both relay endpoints.
IntelPresentMon/​AppCef/​source/​util/​IpcInvocationManager.h Converts renderer invocations into relay calls.
IntelPresentMon/​AppCef/​source/​util/​IpcInvocationManager.cpp Tracks calls and resolves replies.
IntelPresentMon/​AppCef/​source/​util/​CliOptions.h Replaces pipe name with inherited handle.
IntelPresentMon/​AppCef/​source/​util/​cact/​TargetLostAction.h Relays target-loss events.
IntelPresentMon/​AppCef/​source/​util/​cact/​StalePidAction.h Relays stale-process events.
IntelPresentMon/​AppCef/​source/​util/​cact/​PresentmonInitFailedAction.h Relays initialization failures.
IntelPresentMon/​AppCef/​source/​util/​cact/​OverlayDiedAction.h Relays overlay-exit events.
IntelPresentMon/​AppCef/​source/​util/​cact/​HotkeyFiredAction.h Relays hotkey events.
IntelPresentMon/​AppCef/​source/​util/​cact/​CefExecutionContext.h Uses browser-side signal relay.
IntelPresentMon/​AppCef/​source/​util/​async/​GetAppInfo.h Reads relayed kernel version metadata.
IntelPresentMon/​AppCef/​source/​util/​ActionClientServer.h Accepts a connected pipe handle.
IntelPresentMon/​AppCef/​source/​util/​ActionClientServer.cpp Initializes client from inherited connection.
IntelPresentMon/​AppCef/​source/​NanoCefProcessHandler.cpp Handles renderer replies and signals.
IntelPresentMon/​AppCef/​source/​NanoCefBrowserClient.h Declares kernel relay attachment.
IntelPresentMon/​AppCef/​source/​NanoCefBrowserClient.cpp Routes messages through kernel relay.
IntelPresentMon/​AppCef/​source/​DataBindAccessor.cpp Removes unused transport includes.
IntelPresentMon/​AppCef/​CMakeLists.txt Builds kernel link and relay.
IntelPresentMon/​AppCef/​CefNano.vcxproj Includes kernel link and relay files.
cmake/​PresentMonCTest.cmake Classifies private-pipe UI test.

Review effort: Balanced

Comment thread IntelPresentMon/Interprocess/source/act/AsyncAction.h

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unresolved transport issues and the cross-process shutdown rewrite require fixes and human review backed by Windows integration results.

2 open issues
1 resolved since last review

Review effort: Balanced

Comment thread IntelPresentMon/Interprocess/source/act/AsyncAction.h
Comment thread IntelPresentMon/PresentMonAPI2Tests/TransportSessionTests.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Windows handle inheritance and concurrent transport teardown require native integration validation and final human review.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unresolved UI lifecycle issues and cross-process handle changes require corrections, Windows runtime validation, and final human review.

2 open issues

Review effort: Balanced

Comment thread IntelPresentMon/KernelProcess/winmain.cpp Outdated
Comment thread IntelPresentMon/AppCef/source/NanoCefProcessHandler.cpp
Each action session now runs over a single duplex pipe instead of separate in and out pipes. Requests, responses and pushed events share that pipe and are demultiplexed by packet type and command token, with response timeouts and bounded handling of late responses. Clients and servers have an explicit lifecycle (Running, Stopping, Stopped): dispatches are admitted through a gate, shutdown waits for in-flight work and joins its runner rather than detaching it, and every session ends with a recorded reason before it is disposed. Server send policies (request-response, single peer, addressed, paired) are declared in the type; the server enforces a session cap and a handshake deadline, ends any connection that acts before OpenSession, and logs the system-reported client pid. Every pipe write has one deadline covering the wait for the write lock and the write itself: a write that stalls part way ends the session as PeerStalled, while one that times out before sending anything fails only that request. The kernel no longer publishes a connectable pipe for its UI; for each UI launch it creates a single-instance pipe pair, connects both ends itself, and passes the client end to PresentMonUI by handle inheritance, and the UI browser process owns that connection and relays page calls and kernel events to the renderer. The service log pipe and its command line options are removed, --p2c-act-name is replaced by --p2c-act-handle, and the packet header version is now 2, so builds from before this change cannot connect to it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The protocol replacement, cross-process handle inheritance, and asynchronous shutdown redesign require final human review supported by native Windows integration test results.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants