On Tue, Dec 10, 2019 at 03:27:06PM +0800, Wang Huaqiang wrote:
This patch introduced a bug and broke the 'resctrl' feature.
It introduced a 'divide by zero' error if you defined any 'resctrl'
allocation group through <cputune/cachetune/cache>.
Reason is 'caps->resctrl' is fully initialized through two steps,
'virResctrlInfoNew'
invokes 'virResctrlGetInfo' completes the first step, later,
'virResctrlInfoGetCache'
accomplishes the filling of
'caps->resctrl->levels->types->control.granularity'.
Urgh, that is really horribly misleading API. An object getter
method should not be making changes to the object.
virResctrlInfoGetCache needs splitting into two methods - one
setter which updates the control granularity, and then make
this getter into something with no side-effects.
The simplest way to fix the bug is drawback this patch, but still
have the
undesirable overhead.
I've posted the simple revert for now, since refactoring the code is
a bigger job.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|