qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] migration: Add canary to VMSTATE_END_OF_LIST


From: Peter Xu
Subject: Re: [PATCH] migration: Add canary to VMSTATE_END_OF_LIST
Date: Thu, 13 Jan 2022 20:09:37 +0800

On Thu, Jan 13, 2022 at 11:00:20AM +0000, Peter Maydell wrote:
> On Thu, 13 Jan 2022 at 01:21, Peter Xu <peterx@redhat.com> wrote:
> >
> > On Wed, Jan 12, 2022 at 10:56:07AM +0000, Peter Maydell wrote:
> > > We could have vmstate_register_with_alias_id() iterate through
> > > and assert presence of the right terminator (probably only if
> > > qtest enabled, or some other suitable condition). Then the
> > > existing tests that do the basic "check we can instantiate every
> > > device and initialize every board model" would run that code
> > > and catch most missing terminator cases, I think.
> >
> > Agreed.  How about assert it even without qtest?  We do tons of assertion 
> > for
> > programming errors anyway in QEMU.
> 
> I don't inherently object, but in this case to do the assertion
> we'd need to do a scan over the fields arrays which we wouldn't
> otherwise need to, so the cost of the assert is not simply
> the compare-and-branch but also the loop over the array. If
> that's not significant in terms of start-up time costs we can
> just go ahead and do it (which would be nicer for debugging
> and making it really obvious to people writing new devices)
> but my remark above was a gesture towards "maybe we need to
> not do it for normal startup"..

Hmm.. Then how about put it into a "#ifdef CONFIG_DEBUG"?

We may need some extra lines in configure, though:

if test "$debug" = "yes"; then
  echo "CONFIG_DEBUG=y" >> $config_host_mak
fi

PS: I'm a bit surprised we don't have CONFIG_DEBUG already..

Thanks,

-- 
Peter Xu




reply via email to

[Prev in Thread] Current Thread [Next in Thread]