Re: [PATCH 1/2] perf kvm: Support refcnt in structure kvm_info

From: Leo Yan
Date: Tue Mar 21 2023 - 10:23:01 EST


On Tue, Mar 21, 2023 at 10:00:56AM -0300, Arnaldo Carvalho de Melo wrote:

[...]

> > +static inline void __kvm_info__zput(struct kvm_info **ki)
> > +{
> > + kvm_info__put(*ki);
> > + *ki = NULL;
> > +}
> > +
> > +#define kvm_info__zput(ki) __kvm_info__zput(&ki)
> > +
> > +static inline struct kvm_info *kvm_info__new(void)
> > +{
> > + struct kvm_info *ki;
> > +
> > + ki = zalloc(sizeof(*ki));
> > + if (ki)
> > + refcount_set(&ki->refcnt, 1);
> > +
> > + return ki;
> > +}
> > +
> > #endif /* HAVE_KVM_STAT_SUPPORT */
> >
> > extern int kvm_add_default_arch_event(int *argc, const char **argv);
>
> I had to add this:
>
> Provide a nop version of kvm_info__zput() to be used when
> HAVE_KVM_STAT_SUPPORT isn't defined as it is used unconditionally in
> hists__findnew_entry() and hist_entry__delete().

Thanks a lot, Arnaldo.

Just want to check, before I sent out this series I have run building
test with the command `make -C tools/perf build-test` and I didn't see
the building failure. Do I need to run other testing?

Thanks,
Leo