All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tarun Sahu" <tarunsahu@google.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 3/9] kvm: kvm_luo: Allow kvm preservation with LUO
Date: Mon, 22 Jun 2026 19:06:07 +0000	[thread overview]
Message-ID: <20260622190608.50D301F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260622184851.2309827-4-tarunsahu@google.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The macro `KHOSER_COPY_TYPEUNSAFE` is undefined in the kernel tree, causing a build failure.
- [Low] `KHOSER_LOAD_PTR` is incorrectly invoked with a `u64` argument instead of a union, causing a build failure.
--

commit c233e1cbb1e57dbd4789fe720442add1dfd010f1
Author: Tarun Sahu <tarunsahu@google.com>

kvm: kvm_luo: Allow kvm preservation with LUO

This commit introduces KVM VM preservation support for the Live Update
Orchestrator (LUO). It registers a file handler to serialize and deserialize
VM state across live updates, primarily focusing on preserving the VM type.

> diff --git a/virt/kvm/kvm_luo.c b/virt/kvm/kvm_luo.c
> new file mode 100644
> index 0000000000000..6728877f16daf
> --- /dev/null
> +++ b/virt/kvm/kvm_luo.c
> @@ -0,0 +1,195 @@

[ ... ]

> +static int kvm_luo_preserve(struct liveupdate_file_op_args *args)
> +{
> +	DECLARE_KHOSER_PTR(sd, struct kvm_luo_ser *);
> +	struct kvm *kvm = args->file->private_data;
> +	struct kvm_luo_ser *ser;

[ ... ]

> +	KHOSER_STORE_PTR(sd, ser);
> +	KHOSER_COPY_TYPEUNSAFE(args->serialized_data, sd);

[Severity: Low]
Is this macro defined somewhere else in the tree?  It looks like
KHOSER_COPY_TYPEUNSAFE is missing from <linux/kho/abi/kexec_handover.h>
and other headers, which causes a build failure here.

> +
> +	return 0;
> +}
> +
> +static atomic_t restored_vm_id = ATOMIC_INIT(0);
> +
> +static int kvm_luo_retrieve(struct liveupdate_file_op_args *args)
> +{
> +	char fdname[ITOA_MAX_LEN + 1];
> +	struct kvm_luo_ser *ser;
> +	struct file *file;
> +	struct kvm *kvm;
> +	int err = 0;
> +
> +	ser = KHOSER_LOAD_PTR(args->serialized_data);

[Severity: Low]
Does this code compile? KHOSER_LOAD_PTR() expects its argument to be a union
declared with DECLARE_KHOSER_PTR(), which provides the expected .ptr and
.phys fields.

Since args->serialized_data is a plain u64, this causes a compilation error
because it tries to access struct/union members on a primitive type.

> +	if (!ser)
> +		return -EINVAL;
> +
> +	snprintf(fdname, sizeof(fdname), "%d",
> +		 atomic_inc_return(&restored_vm_id));
> +
> +	file = kvm_create_vm_file(ser->type, fdname);

[ ... ]

> +static void kvm_luo_unpreserve(struct liveupdate_file_op_args *args)
> +{
> +	struct kvm_luo_ser *ser;
> +
> +	/*
> +	 * in case preservation failed, args->serialized_data will
> +	 * be NULL and kvm_luo_preserve takes care of cleaning up.
> +	 * If preserve succeeds, this condition fails and unpreserve
> +	 * function takes care of cleaning up.
> +	 */
> +	ser = KHOSER_LOAD_PTR(args->serialized_data);

[Severity: Low]
Similar to the issue in kvm_luo_retrieve(), args->serialized_data is a plain
u64 rather than the union KHOSER_LOAD_PTR() expects. Will this cause a build
failure?

> +	if (WARN_ON_ONCE(!ser))
> +		return;
> +
> +	kho_unpreserve_free(ser);
> +}
> +
> +static void kvm_luo_finish(struct liveupdate_file_op_args *args)
> +{
> +	struct kvm_luo_ser *ser;
> +
> +	/*
> +	 * If retrieve_status is true or set to error, nothing to do here.
> +	 * Already cleaned up in kvm_luo_retrieve().
> +	 */
> +	if (args->retrieve_status)
> +		return;
> +
> +	ser = KHOSER_LOAD_PTR(args->serialized_data);

[Severity: Low]
Is there a type mismatch here as well? args->serialized_data is being passed
to KHOSER_LOAD_PTR() as a plain u64.

> +	if (!ser)
> +		return;
> +
> +	kho_restore_free(ser);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260622184851.2309827-1-tarunsahu@google.com?part=3

  reply	other threads:[~2026-06-22 19:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 18:48 [PATCH v3 0/9] liveupdate: kvm: guest_memfd preservation Tarun Sahu
2026-06-22 18:48 ` [PATCH v3 1/9] liveupdate: Add LIVEUPDATE_GUEST_MEMFD config option Tarun Sahu
2026-06-22 18:48 ` [PATCH v3 2/9] kvm: Prepare core VM structs and helpers for LUO support Tarun Sahu
2026-06-22 19:01   ` sashiko-bot
2026-06-22 18:48 ` [PATCH v3 3/9] kvm: kvm_luo: Allow kvm preservation with LUO Tarun Sahu
2026-06-22 19:06   ` sashiko-bot [this message]
2026-06-22 18:48 ` [PATCH v3 4/9] kvm: guest_memfd: Move internal definitions and helper to new header Tarun Sahu
2026-06-22 18:48 ` [PATCH v3 5/9] kvm: guest_memfd: Add support for freezing and unfreezing mappings Tarun Sahu
2026-06-22 19:01   ` sashiko-bot
2026-06-22 18:48 ` [PATCH v3 6/9] kvm: guest_memfd_luo: add support for guest_memfd preservation Tarun Sahu
2026-06-22 19:08   ` sashiko-bot
2026-06-22 18:48 ` [PATCH v3 7/9] docs: add documentation for guest_memfd preservation via LUO Tarun Sahu
2026-06-22 18:54   ` sashiko-bot
2026-06-22 19:04     ` tarunsahu
2026-06-22 18:48 ` [PATCH v3 8/9] selftests: kvm: Split ____vm_create() to expose init helpers Tarun Sahu
2026-06-22 18:48 ` [PATCH v3 9/9] selftests: kvm: Add guest_memfd_preservation_test Tarun Sahu
2026-06-22 19:13   ` sashiko-bot
2026-06-22 18:55 ` [PATCH v3 0/9] liveupdate: kvm: guest_memfd preservation tarunsahu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260622190608.50D301F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tarunsahu@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.