From: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Will Deacon <will@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Marc Zyngier <maz@kernel.org>,
gregkh <gregkh@linuxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
<quic_psodagud@quicinc.com>
Subject: Re: [PATCHv5 4/4] asm-generic/io: Add logging support for MMIO accessors
Date: Mon, 6 Dec 2021 15:22:51 +0530 [thread overview]
Message-ID: <0cd0bc8c-e3db-b3fb-5be4-c619d1d5d633@quicinc.com> (raw)
In-Reply-To: <CAK8P3a1k-1_m7r-u0uO1nW1m43bt_hR9u+UeW=SqK40+Ltb+iA@mail.gmail.com>
On 12/6/2021 2:39 PM, Arnd Bergmann wrote:
> On Mon, Dec 6, 2021 at 9:28 AM Sai Prakash Ranjan
> <quic_saipraka@quicinc.com> wrote:
>> +#if IS_ENABLED(CONFIG_TRACE_MMIO_ACCESS) && !(defined(__DISABLE_TRACE_MMIO__))
>> +#include <linux/tracepoint-defs.h>
>> +
>> +DECLARE_TRACEPOINT(rwmmio_write);
>> +DECLARE_TRACEPOINT(rwmmio_read);
>> +
>> +#define rwmmio_tracepoint_active(t) tracepoint_enabled(t)
>> +void log_write_mmio(u64 val, u8 width, volatile void __iomem *addr);
>> +void log_read_mmio(u8 width, const volatile void __iomem *addr);
>> +
>> +#else
>> +
>> +#define rwmmio_tracepoint_active(t) false
>> +static inline void log_write_mmio(u64 val, u8 width, volatile void __iomem *addr) {}
>> +static inline void log_read_mmio(u8 width, const volatile void __iomem *addr) {}
>> +
>> +#endif /* CONFIG_TRACE_MMIO_ACCESS */
>>
>> /*
>> * __raw_{read,write}{b,w,l,q}() access memory in native endianness.
>> @@ -149,6 +166,8 @@ static inline u8 readb(const volatile void __iomem *addr)
>> {
>> u8 val;
>>
>> + if (rwmmio_tracepoint_active(rwmmio_read))
>> + log_read_mmio(8, addr);
>> __io_br();
>> val = __raw_readb(addr);
>> __io_ar(val);
> For readability, it may be nicer to fold the two lines you add for each
> helper into one, such as
>
> void __log_write_mmio(u64 val, u8 width, volatile void __iomem *addr);
> #define log_write_mmio(val, widtg, addr) do { \
> if (tracepoint_enabled(rwmmio_read)) \
> __log_write_mmio((val), (width), (addr)); \
> } while (0)
>
> I wonder if it may even be better to not check for tracepoint_active() in the
> inline function at all but always enter the external function when built-in.
> This means we do run into the branch, but it also reduces the i-cache footprint.
Right, we don't need the tracepoint active check as we declare the
tracepoint only when the config is
enabled so I can just call log_{read,write}_mmio directly.
> For general functionality, I think it would be better to trace the returned
> value from the read, but I don't know if that defeats the purpose you
> are interested in, since it requires the tracing to come after the __raw_read.
>
>
Yes just the trace after read/write won't serve our usecase where we
expect crashes/hangs on accessing
these registers but internally we did have a log_post_read_mmio() as
well, if it is useful then I can add it.
Thanks,
Sai
next prev parent reply other threads:[~2021-12-06 9:53 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 8:28 [PATCHv5 0/4] tracing/rwmmio/arm64: Add support to trace register reads/writes Sai Prakash Ranjan
2021-12-06 8:28 ` [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors Sai Prakash Ranjan
2021-12-06 8:50 ` Arnd Bergmann
2021-12-06 11:12 ` Sai Prakash Ranjan
2021-12-06 11:30 ` Arnd Bergmann
2021-12-06 13:52 ` Sai Prakash Ranjan
2021-12-06 15:15 ` Arnd Bergmann
2021-12-06 15:57 ` Sai Prakash Ranjan
2021-12-06 15:36 ` kernel test robot
2021-12-07 13:04 ` kernel test robot
2021-12-06 8:28 ` [PATCHv5 2/4] irqchip/tegra: Fix overflow implicit truncation warnings Sai Prakash Ranjan
2021-12-06 8:51 ` Arnd Bergmann
2021-12-06 8:28 ` [PATCHv5 3/4] tracing: Add register read/write tracing support Sai Prakash Ranjan
2021-12-06 8:59 ` Arnd Bergmann
2021-12-06 10:11 ` Sai Prakash Ranjan
2021-12-06 10:46 ` Arnd Bergmann
2021-12-06 10:52 ` Sai Prakash Ranjan
2021-12-06 10:13 ` Sai Prakash Ranjan
2021-12-06 11:52 ` kernel test robot
2021-12-06 16:39 ` kernel test robot
2021-12-06 8:28 ` [PATCHv5 4/4] asm-generic/io: Add logging support for MMIO accessors Sai Prakash Ranjan
2021-12-06 9:09 ` Arnd Bergmann
2021-12-06 9:52 ` Sai Prakash Ranjan [this message]
2021-12-06 10:01 ` Arnd Bergmann
2021-12-06 10:20 ` Sai Prakash Ranjan
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=0cd0bc8c-e3db-b3fb-5be4-c619d1d5d633@quicinc.com \
--to=quic_saipraka@quicinc.com \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=quic_psodagud@quicinc.com \
--cc=rostedt@goodmis.org \
--cc=will@kernel.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