gpu: nvgpu: Correctly plumb -EAGAIN from vidmem allocations

Userspace can and should retry vidmem allocations if there are pending
clears still to be executed by the GPU. But this requires the -EAGAIN
to properly propagate back to userspace.

Bug 200378648

Change-Id: Ib930711270439843e043d65c2e87b60612a76239
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1669099
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2018-03-05 19:03:32 -08:00
committed by mobile promotions
parent 4320877eb4
commit da9b549cd1
2 changed files with 11 additions and 7 deletions

View File

@@ -173,6 +173,8 @@ int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes)
if (!gk20a_get(g))
return -ENODEV;
vidmem_dbg(g, "Allocating vidmem buf: %zu bytes", bytes);
priv = nvgpu_kzalloc(g, sizeof(*priv));
if (!priv) {
err = -ENOMEM;
@@ -180,8 +182,8 @@ int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes)
}
buf = nvgpu_vidmem_user_alloc(g, bytes);
if (!buf) {
err = -ENOMEM;
if (IS_ERR(buf)) {
err = PTR_ERR(buf);
goto fail;
}