From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4557BC7619A for ; Tue, 21 Mar 2023 17:48:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230022AbjCURsY (ORCPT ); Tue, 21 Mar 2023 13:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230035AbjCURsQ (ORCPT ); Tue, 21 Mar 2023 13:48:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E4E893FB; Tue, 21 Mar 2023 10:48:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A481E61D70; Tue, 21 Mar 2023 17:48:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E17C2C433EF; Tue, 21 Mar 2023 17:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679420888; bh=XdBv7dMWKQWKxGOS239zoahEirm3umu1JUUI+nQGGoQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T6Cfh60uLTCqTDgwE6WCuaEtBG/0Idu8xTtckfw1rqfo3G+/vj/NkUIH+f2QbP0ld LLJ4Oq/kXzTVcAzi5osGVtIkJET7Pe54+KZZFObAcN1MDkMgMAU0Vgml5XMeUHuvjk CRj9FdJv5YFPGoCmhnPlemFgdmOt9jjo9GK81fMyeMldV/tQKkcW2QHb9qblF/itow kkjjI7gP7RSn367adaoU/6oOl47C0WPlPCiKt3732PwcEiB0iJ/cst85w5hTv7KiNk 5fzwZ3Kx3gO0hSUityQeAmZpUBSjs553w531+dK56Rn8KTDQxcHbl8DI4Ma2oskT7p tOrZVs8YceDfQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 505584052D; Tue, 21 Mar 2023 14:48:05 -0300 (-03) Date: Tue, 21 Mar 2023 14:48:05 -0300 From: Arnaldo Carvalho de Melo To: Leo Yan Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] perf kvm: Support refcnt in structure kvm_info Message-ID: References: <20230320061619.29520-1-leo.yan@linaro.org> <20230320061619.29520-2-leo.yan@linaro.org> <20230321142235.GD221467@leoy-yangtze.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230321142235.GD221467@leoy-yangtze.lan> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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@toolbox perf-tools-next]$ git show 9300acc6fed8e957c8d60f6f8e4451b508feea2c commit 9300acc6fed8e957c8d60f6f8e4451b508feea2c Author: Arnaldo Carvalho de Melo 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 Cc: Alexander Shishkin Cc: Alexei Starovoitov Cc: Alexey Budankov Cc: Andi Kleen Cc: Andrii Nakryiko Cc: Daniel Borkmann Cc: Florian Fainelli Cc: Greg Kroah-Hartman Cc: Ian Rogers Cc: Igor Lubashev Cc: Jin Yao Cc: Jiri Olsa Cc: Jiwei Sun Cc: John Garry Cc: Kan Liang Cc: Leo Yan Cc: Mark Rutland Cc: Martin KaFai Lau Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Yonghong Song Cc: yuzhoujian Signed-off-by: Arnaldo Carvalho de Melo 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@toolbox 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