On Wed, Sep 03, 2025 at 09:30:17AM +0300, Mike Rapoport wrote:
> +int kho_preserve_vmalloc(void *ptr, phys_addr_t *preservation)
> +{
> +     struct kho_vmalloc_chunk *chunk, *first_chunk;
> +     struct vm_struct *vm = find_vm_area(ptr);
> +     int err;
> +
> +     if (!vm)
> +             return -EINVAL;
> +
> +     /* we don't support HUGE_VMAP yet */
> +     if (get_vm_area_page_order(vm))
> +             return -EOPNOTSUPP;

This is a compatability problem.. Should have some way to indicate
that future kernels have an incompatible serialization so restore can
fail..

> +     chunk = new_vmalloc_chunk(NULL);
> +     if (!chunk)
> +             return -ENOMEM;
> +     first_chunk = chunk;
> +     first_chunk->hdr.total_pages = vm->nr_pages;
> +
> +     for (int i = 0; i < vm->nr_pages; i++) {
> +             phys_addr_t phys = page_to_phys(vm->pages[i]);
> +
> +             err = kho_preserve_phys(phys, PAGE_SIZE);

Don't call kho_preserve_phy if you already have a page! We should be
getting rid of kho_preserve_phys() :(

Jason

Reply via email to