lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 21 Mar 2023 14:48:05 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Leo Yan <leo.yan@...aro.org>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Ian Rogers <irogers@...gle.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        James Clark <james.clark@....com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] perf kvm: Support refcnt in structure kvm_info

Em Tue, Mar 21, 2023 at 10:22:35PM +0800, Leo Yan escreveu:
> 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?

Yes, but I didn't manage yet to make them public in a way that you could
use it easily :-\

I have a set of perf build containers and in some cases
HAVE_KVM_STAT_SUPPORT isn't defined, thus I noticed the problem.

Since you're working on kvm stat, maybe you could add a way to disable
it from the make command line and then add it to tools/perf/tests/make?

Here is an example of this for something that was opt-in:

⬢[acme@...lbox perf-tools-next]$ git show 9300acc6fed8e957c8d60f6f8e4451b508feea2c
commit 9300acc6fed8e957c8d60f6f8e4451b508feea2c
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
Date:   Fri May 29 16:25:34 2020 -0300

    perf build: Add a LIBPFM4=1 build test entry

    So that when one runs:

      $ make -C tools/perf build-test

    We make sure that recent changes don't break that opt-in build.

    Cc: Adrian Hunter <adrian.hunter@...el.com>
    Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
    Cc: Alexei Starovoitov <ast@...nel.org>
    Cc: Alexey Budankov <alexey.budankov@...ux.intel.com>
    Cc: Andi Kleen <ak@...ux.intel.com>
    Cc: Andrii Nakryiko <andriin@...com>
    Cc: Daniel Borkmann <daniel@...earbox.net>
    Cc: Florian Fainelli <f.fainelli@...il.com>
    Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
    Cc: Ian Rogers <irogers@...gle.com>
    Cc: Igor Lubashev <ilubashe@...mai.com>
    Cc: Jin Yao <yao.jin@...ux.intel.com>
    Cc: Jiri Olsa <jolsa@...hat.com>
    Cc: Jiwei Sun <jiwei.sun@...driver.com>
    Cc: John Garry <john.garry@...wei.com>
    Cc: Kan Liang <kan.liang@...ux.intel.com>
    Cc: Leo Yan <leo.yan@...aro.org>
    Cc: Mark Rutland <mark.rutland@....com>
    Cc: Martin KaFai Lau <kafai@...com>
    Cc: Namhyung Kim <namhyung@...nel.org>
    Cc: Peter Zijlstra <peterz@...radead.org>
    Cc: Stephane Eranian <eranian@...gle.com>
    Cc: Thomas Gleixner <tglx@...utronix.de>
    Cc: Yonghong Song <yhs@...com>
    Cc: yuzhoujian <yuzhoujian@...ichuxing.com>
    Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>

diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 8fe6c7911f46e7ef..9b651dfe0a6b8a91 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -90,6 +90,7 @@ make_with_babeltrace:= LIBBABELTRACE=1
 make_no_sdt        := NO_SDT=1
 make_no_syscall_tbl := NO_SYSCALL_TABLE=1
 make_with_clangllvm := LIBCLANGLLVM=1
+make_with_libpfm4   := LIBPFM4=1
 make_tags           := tags
 make_cscope         := cscope
 make_help           := help
@@ -152,6 +153,7 @@ run += make_no_sdt
 run += make_no_syscall_tbl
 run += make_with_babeltrace
 run += make_with_clangllvm
+run += make_with_libpfm4
 run += make_help
 run += make_doc
 run += make_perf_o
⬢[acme@...lbox perf-tools-next]$


----------------------

Look at tools/perf/Makefile.perf and try to add a NO_KVM_STAT=1 perhaps,
and then add it to tools/perf/tests/make so that we catch problems like
the one I found and fixed in this thread.


Thanks,

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ