From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Kan Liang <kan.liang@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Andi Kleen <ak@linux.intel.com>,
Dmitry Monakhov <dmtrmonakhov@yandex-team.ru>
Subject: Re: [PATCH v2 3/3] perf tool: simplify checking active smt
Date: Wed, 29 Apr 2020 15:16:09 -0300 [thread overview]
Message-ID: <20200429181609.GG30487@kernel.org> (raw)
In-Reply-To: <158817741394.748034.9273604089138009552.stgit@buzz>
Em Wed, Apr 29, 2020 at 07:23:41PM +0300, Konstantin Khlebnikov escreveu:
> SMT now could be disabled via "/sys/devices/system/cpu/smt/control".
> Status shown in "/sys/devices/system/cpu/smt/active" simply as "0" / "1".
>
> If this knob isn't here then fallback to checking topology as before.
I've manually applied this one, thanks, please check my perf/core branch
later before resending 2/3, thanks.
- Arnaldo
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> ---
> tools/perf/util/smt.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/perf/util/smt.c b/tools/perf/util/smt.c
> index dc37b5abd1c3..c398528d1006 100644
> --- a/tools/perf/util/smt.c
> +++ b/tools/perf/util/smt.c
> @@ -19,6 +19,9 @@ int smt_on(void)
> if (cached)
> return cached_result;
>
> + if (sysfs__read_int("devices/system/cpu/smt/active", &active) > 0)
> + goto done;
> +
> ncpu = sysconf(_SC_NPROCESSORS_CONF);
> for (cpu = 0; cpu < ncpu; cpu++) {
> char fn[256];
> @@ -37,6 +40,7 @@ int smt_on(void)
> active = str && (strchr(str, ',') != NULL || strchr(str, '-') != NULL);
> free(str);
>
> +done:
> if (!cached) {
> cached_result = active;
> cached = true;
>
--
- Arnaldo
next prev parent reply other threads:[~2020-04-29 18:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 16:19 [PATCH v2 1/3] perf tool: fix reading new topology attribute "core_cpus" Konstantin Khlebnikov
2020-04-29 16:22 ` [PATCH v2 2/3] perf tool: fix detecting smt at machines with more than 32 cpus Konstantin Khlebnikov
2020-04-29 18:13 ` Arnaldo Carvalho de Melo
2020-04-29 18:38 ` Konstantin Khlebnikov
2020-04-30 13:37 ` Arnaldo Carvalho de Melo
2020-04-29 16:23 ` [PATCH v2 3/3] perf tool: simplify checking active smt Konstantin Khlebnikov
2020-04-29 18:16 ` Arnaldo Carvalho de Melo [this message]
2020-05-08 13:05 ` [tip: perf/core] perf tools: Simplify checking if SMT is active tip-bot2 for Konstantin Khlebnikov
2020-04-29 18:11 ` [PATCH v2 1/3] perf tool: fix reading new topology attribute "core_cpus" Arnaldo Carvalho de Melo
2020-05-08 13:05 ` [tip: perf/core] perf tools: Fix " tip-bot2 for Konstantin Khlebnikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200429181609.GG30487@kernel.org \
--to=arnaldo.melo@gmail.com \
--cc=ak@linux.intel.com \
--cc=dmtrmonakhov@yandex-team.ru \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=khlebnikov@yandex-team.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox