All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzju@redhat.com>
To: linux-trace-devel@vger.kernel.org
Cc: tz.stoyanov@gmail.com, rostedt@goodmis.org,
	Nicolas Saenz Julienne <nsaenzju@redhat.com>
Subject: [PATCH] trace-cmd: Fix trace_tsc2nsec_is_supported() on !x86
Date: Tue, 16 Nov 2021 20:21:52 +0100	[thread overview]
Message-ID: <20211116192152.1360993-1-nsaenzju@redhat.com> (raw)

'trace-cmd list -C' outputs 'tsc2nsec' on my arm64 machine. TSC is an
x86 specific counter, so it shouldn't be supported. Fix this by making
sure TSC exists as a trace clock in trace_tsc2nsec_is_supported().

Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
---
 tracecmd/trace-record.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 1767a6c..78e9566 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -6122,6 +6122,9 @@ static int get_tsc_nsec(int *shift, int *mult)
 
 bool trace_tsc2nsec_is_supported(void)
 {
+	if (!clock_is_supported(NULL, TSC_CLOCK))
+		return false;
+
 	return get_tsc_nsec(NULL, NULL) == 0;
 }
 
-- 
2.33.1


             reply	other threads:[~2021-11-16 19:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 19:21 Nicolas Saenz Julienne [this message]
2021-11-16 19:50 ` [PATCH] trace-cmd: Fix trace_tsc2nsec_is_supported() on !x86 Steven Rostedt

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=20211116192152.1360993-1-nsaenzju@redhat.com \
    --to=nsaenzju@redhat.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tz.stoyanov@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.