mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-16 22:43:24 +09:00
[MG_Test] (Disaggregated): P5e id - the band case, and the exemption scope stops exempting an unbarriered apply
- New DirectGLESSlotTable.ACompositeHandleDoesNotGrowTheOrdinaryTable (with its G2/G14 skip twin) pins the band: a composite handle grows m_band by four entries and the ORDINARY table by none, the lookup finds it, an ordinary slot beside it disturbs neither space, ForEachLive reports the composite at the slot THE CLIENT MINTED rather than at its band index, and §4.3's recycle answer holds inside the band. It asserts on the two spaces' CAPACITIES, not on liveness: the table holds one live entry either way, so LiveCount could not see the growth this case exists to catch. - RemoteGuards.AnAllocatorProbeInsideAnExemptionScopeOnTheApplyThreadIsAllowed is DELETED. It asserted that a named scope exempts unconditionally, which is the rule CONTRACT-P5E §4.4 retires. Its replacement, ...FromTheApplyThreadIsFatalEvenAtTheOldDebtSites, opens the same scope with the applier's CurrentRecordBarriered forced false and expects HandleOf to abort. The hook is the production field ApplyOne stamps, not a test-only branch beside it; the texture and the table are built on the CLIENT thread, because a TextureObject2D's constructor mints and building it on the apply thread would abort at the mint with the same diagnostic - a case passing for the wrong reason. - The green half of the deleted case needs no replacement: every Espryt integration-split entry runs the frontend-keyed scope's surviving sites on the apply thread behind barriered records, so a guard that stopped exempting would take the whole lane down. - Unit 2203 -> 2204 (the new name only adds); integration-split unchanged at 111.
This commit is contained in:
@@ -1858,9 +1858,18 @@ MGL_BUFFER_GUARD_TEST(BufferHasDefinedContentFromTheApplyThreadIsFatalByName, 70
|
||||
// exempting the apply thread, which is exactly the leak the thread_local used to prevent;
|
||||
// (b) drop the increment altogether and (a) goes red - the exemption stops exempting and
|
||||
// the debt's own sites (DirectGLES' HandleOf probes) abort the server;
|
||||
// (c) drop the guard's `MGPipeReverseAnnouncementScope::ActiveOnApplyThread()` /
|
||||
// (c) drop the guard's `MagmaP7AllocatorDebtScope::ActiveOnApplyThread()` /
|
||||
// `FrontendKeyedRegistryScope::ActiveOnApplyThread()` rows and (b) - the control - stops
|
||||
// being the only aborting arm.
|
||||
//
|
||||
// P5e (id), CONTRACT-P5E §4.4 REPLACED (b). The case that used to sit there -
|
||||
// `AnAllocatorProbeInsideAnExemptionScopeOnTheApplyThreadIsAllowed` - asserted that a scope
|
||||
// exempts UNCONDITIONALLY, which is exactly the rule §4.4 retires: an exemption is a debt the
|
||||
// CLIENT'S WAIT pays for, so it holds only while the record being applied is barriered. Its
|
||||
// replacement below drives the same scope with the barriered flag forced false and expects the
|
||||
// abort. The green half of the old case did not need a test of its own: every Espryt
|
||||
// `integration-split` entry runs the frontend-keyed scope's surviving sites on the apply thread
|
||||
// behind barriered records, so a guard that stopped exempting would take the whole lane down.
|
||||
TEST(RemoteGuards, AnAllocatorProbeFromTheApplyThreadOutsideEveryScopeIsFatalByName) {
|
||||
const auto child = RunInChild([] {
|
||||
StartControlSession();
|
||||
@@ -1875,21 +1884,47 @@ TEST(RemoteGuards, AnAllocatorProbeFromTheApplyThreadOutsideEveryScopeIsFatalByN
|
||||
ExpectNamedAbort(child, "Fatal{RoleViolation, \"MGPipeSlots\"}");
|
||||
}
|
||||
|
||||
TEST(RemoteGuards, AnAllocatorProbeInsideAnExemptionScopeOnTheApplyThreadIsAllowed) {
|
||||
// P5e (id) RED-ONCE, CONTRACT-P5E §4.4. The exemption scope is OPEN and the probe is the one
|
||||
// the debt is named for - `HandleOf`, the frontend-keyed registry's own entry - and it still
|
||||
// aborts, because the record being applied is unbarriered: the client is running ahead and the
|
||||
// allocator's free list and lifetimeId -> slot map are moving under the read.
|
||||
//
|
||||
// THE HOOK IS THE APPLIER FIELD ITSELF and that is deliberate: `CurrentRecordBarriered` is what
|
||||
// PipeApplier::ApplyOne stamps from MGPipeBarriered() on every record, so forcing it here drives
|
||||
// the production path rather than a test-only branch beside it. Until ra lands the wait rule
|
||||
// MGPipeBarriered answers true for every record, so this is the ONLY way to reach the arm - and
|
||||
// the arm has to exist before ra, because ra is what makes it reachable in production.
|
||||
//
|
||||
// The red: put §4.4's `if (MGPipeApplierCurrentRecordIsBarriered())` back to an unconditional
|
||||
// exemption in MGPipeRefuseAllocatorFromApplyThread and this case stops aborting - red by
|
||||
// expectation, which is the shape a guard case fails in.
|
||||
// EVERYTHING BUT THE PROBE RUNS ON THE CLIENT THREAD, which is the buffer/texture guard cases'
|
||||
// shape one block down and is load-bearing here rather than tidy: a TextureObject2D's
|
||||
// constructor MINTS a resource handle, and building it on the apply thread would abort at the
|
||||
// mint with the same diagnostic - a case that passes for a reason other than the one it names.
|
||||
TEST(RemoteGuards, AnAllocatorProbeInsideAnExemptionScopeFromTheApplyThreadIsFatalEvenAtTheOldDebtSites) {
|
||||
struct Probe {
|
||||
TestTextureTable* table;
|
||||
MG_State::GLState::TextureObject2D* texture;
|
||||
};
|
||||
const auto child = RunInChild([] {
|
||||
StartControlSession();
|
||||
MG_State::GLState::TextureObject2D texture(46);
|
||||
TestTextureTable table;
|
||||
Probe probe{&table, &texture};
|
||||
Srv::ServerLoopInstance().RunOnApplyThread(
|
||||
+[](void*) -> MobileGLResult {
|
||||
+[](void* self) -> MobileGLResult {
|
||||
auto& probe = *static_cast<Probe*>(self);
|
||||
// The record being applied is one the client did NOT park behind.
|
||||
MG_Pipe::MGPipeApplier().CurrentRecordBarriered = false;
|
||||
const MG_Pipe::MGPipeFrontendKeyedRegistryScope frontendKeyedRegistry;
|
||||
MG_Pipe::MGPipeRefuseAllocatorFromApplyThread("FindByLifetimeId");
|
||||
const MG_Pipe::MGPipeReverseAnnouncementScope reverseAnnouncement;
|
||||
MG_Pipe::MGPipeRefuseAllocatorFromApplyThread("Acquire");
|
||||
probe.table->HandleOf(probe.texture);
|
||||
return MOBILEGL_OK;
|
||||
},
|
||||
nullptr);
|
||||
&probe);
|
||||
ClientSessionInstance().Stop();
|
||||
});
|
||||
ExpectChildSuccess(child);
|
||||
ExpectNamedAbort(child, "Fatal{RoleViolation, \"MGPipeSlots\"}");
|
||||
}
|
||||
|
||||
// THE ONE THAT PINS THE SINGLE-WRITER ARGUMENT. The scope is open on the GL thread for the
|
||||
|
||||
Reference in New Issue
Block a user