Messages in this thread | | | Date | Tue, 21 Feb 2023 18:13:55 +0530 | From | Srivatsa Vaddagiri <> | Subject | Re: [PATCH v10 12/26] gunyah: vm_mgr: Add/remove user memory regions |
| |
* Srinivas Kandagatla <srinivas.kandagatla@linaro.org> [2023-02-21 12:28:53]:
> > +void gh_vm_mem_reclaim(struct gh_vm *ghvm, struct gh_vm_mem *mapping) > > + __must_hold(&ghvm->mm_lock) > > +{ > > + int i, ret = 0; > > + > > + if (mapping->parcel.mem_handle != GH_MEM_HANDLE_INVAL) { > > + ret = gh_rm_mem_reclaim(ghvm->rm, &mapping->parcel); > > + if (ret) > > + pr_warn("Failed to reclaim memory parcel for label %d: %d\n", > > + mapping->parcel.label, ret); > > what the behavoir of hypervisor if we failed to reclaim the pages? > > > + } > > + > > + if (!ret) > So we will leave the user pages pinned if hypervisor call fails, but further > down we free the mapping all together.
I think we should cleanup and bail out here, rather than try continuing past the error. For ex: imagine userspace were to reclaim with VM still running. We would leave the pages pinned AFAICS (even after VM terminates later) and also not return any error to userspace indicating failure to reclaim.
| |