public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Baolin Wang <baolin.wang@linaro.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-rtc@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH v2] rtc: Add tracepoints for RTC system
Date: Wed, 13 Dec 2017 12:04:26 +0100	[thread overview]
Message-ID: <20171213110426.GQ8318@piout.net> (raw)
In-Reply-To: <CAK8P3a06svzg8mG1Gw9n9tqsr6rNmkzLLvirWP6wZdnCm=5_CA@mail.gmail.com>

On 13/12/2017 at 09:33:23 +0100, Arnd Bergmann wrote:
> On Wed, Dec 13, 2017 at 6:47 AM, Baolin Wang <baolin.wang@linaro.org> wrote:
> >
> >>> diff --git a/include/trace/events/rtc.h b/include/trace/events/rtc.h
> >>> new file mode 100644
> >>> index 0000000..b5a4add
> >>> --- /dev/null
> >>> +++ b/include/trace/events/rtc.h
> >>> +
> >>
> >> Also, I'm a bit concerned about having a struct rtc_time here. I think
> >> its goal is mainly to have a nice representation on the time but maybe
> >
> > Yes.
> >
> >> the best would be to make printk able to pretty print the time (some
> >> patches were proposed).
> >
> > If I understood your point correctly, you did not like the format of
> > TP_printk() here, right? So how about if I remove the 'struct
> > rtc_time' and just pass one 'ktime_t' parameter? But it will be not
> > readable for user to trace the RTC time/alarm.
> >

> >>
> >> How bad would that be to change it later? I didn't follow the whole
> >> tracepoint ABI issue closely.
> 
> There is no general rule here other than "if it breaks for existing
> users, we have to fix it". Anyone who uses the tracepoints correctly
> would end up showing zero-date if we change all the fields, but
> it should not crash here.
> 
> Printing a time64_t instead of rtc_time may be better here, as it's
> cheaper to convert rtc_time to time64_t that vice versa. User space
> looking at the trace data can then do the conversion back to struct tm
> for printing in a C program or using /bin/date from a shell
> script, but I agree it's an extra step.
> 
> It's also possible that we don't care about the overhead of doing
> a time64_to_tm() or rtc_time64_to_tm() in the trace function, as long
> as that only needs to be done if the tracepoint is active. I find trace
> points a bit confusing, so I don't know if that is the case or not when
> the tracepoint is compiled into the kernel but disabled at run time.
> 

Sorry, I was not clear and I never actually used tracepoints.

My point was that the printk format is nice and can probably be kept as
is. But I would like tracepoint to take a time64_t instead of an rtc_time even
if that means having a conversion before calling the tracepoint and
converting back to display the date/time.

Also, I think we could try having only the time64_t in the ring buffer.
Maybe I'm wrong but I think tools reading that buffer can do the
conversion themselves. Maybe I don't understand correctly how
tracepoints work and this doesn't make sense, tell me.

The printk patches I was referring to are:
https://marc.info/?l=linux-rtc&m=149693060517054&w=2
But they don't provide a way to pretty print a time64_t yet (it was just
suggested by Arnd).

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-12-13 11:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16  5:59 [PATCH v2] rtc: Add tracepoints for RTC system Baolin Wang
2017-11-30  2:56 ` Baolin Wang
2017-12-12 22:16 ` Alexandre Belloni
2017-12-13  5:47   ` Baolin Wang
2017-12-13  8:33     ` Arnd Bergmann
2017-12-13 11:04       ` Alexandre Belloni [this message]
2017-12-13 12:16         ` Mark Brown
2017-12-13 12:23           ` Alexandre Belloni
2017-12-14  3:07             ` Baolin Wang
2017-12-13 16:46           ` Steven Rostedt
2017-12-13 16:45       ` 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=20171213110426.GQ8318@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=arnd@arndb.de \
    --cc=baolin.wang@linaro.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.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