Mark nvproxy.objsLive as not savable.

We do not restore GPU state on restore. Any nvproxy state is also not restored.
So nvproxy.objsLive should not be saved.
After this change, we release all live objects on  checkpoint.

Updates #9363, #9649, #9767

PiperOrigin-RevId: 590661915
This commit is contained in:
Ayush Ranjan
2023-12-13 11:28:17 -08:00
committed by gVisor bot
parent 07e86e27b0
commit b373c8e112
2 changed files with 16 additions and 3 deletions
+3 -3
View File
@@ -70,9 +70,9 @@ func Register(vfsObj *vfs.VirtualFilesystem, versionStr string, uvmDevMajor uint
// +stateify savable
type nvproxy struct {
objsMu objsMutex `state:"nosave"`
objsLive map[nvgpu.Handle]*object
abi *driverABI `state:"nosave"`
objsMu objsMutex `state:"nosave"`
objsLive map[nvgpu.Handle]*object `state:"nosave"`
abi *driverABI `state:"nosave"`
version DriverVersion
}
@@ -16,8 +16,20 @@ package nvproxy
import (
"fmt"
"gvisor.dev/gvisor/pkg/abi/nvgpu"
"gvisor.dev/gvisor/pkg/context"
)
func (n *nvproxy) beforeSave() {
n.objsMu.Lock()
defer n.objsMu.Unlock()
for _, o := range n.objsLive {
o.Release(context.Background())
}
n.objsLive = nil
}
func (n *nvproxy) afterLoad() {
Init()
abiCons, ok := abis[n.version]
@@ -25,4 +37,5 @@ func (n *nvproxy) afterLoad() {
panic(fmt.Sprintf("driver version %q not found in abis map", n.version))
}
n.abi = abiCons.cons()
n.objsLive = make(map[nvgpu.Handle]*object)
}