* [PATCHv5 0/4] tracing/rwmmio/arm64: Add support to trace register reads/writes @ 2021-12-06 8:28 Sai Prakash Ranjan 2021-12-06 8:28 ` [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors Sai Prakash Ranjan ` (3 more replies) 0 siblings, 4 replies; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 8:28 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier Cc: gregkh, linux-kernel, linux-arm-kernel, linux-arm-msm, quic_psodagud, Sai Prakash Ranjan Generic MMIO read/write i.e., __raw_{read,write}{b,l,w,q} accessors are typically used to read/write from/to memory mapped registers and can cause hangs or some undefined behaviour in following cases, * If the access to the register space is unclocked, for example: if there is an access to multimedia(MM) block registers without MM clocks. * If the register space is protected and not set to be accessible from non-secure world, for example: only EL3 (EL: Exception level) access is allowed and any EL2/EL1 access is forbidden. * If xPU(memory/register protection units) is controlling access to certain memory/register space for specific clients. and more... Such cases usually results in instant reboot/SErrors/NOC or interconnect hangs and tracing these register accesses can be very helpful to debug such issues during initial development stages and also in later stages. So use ftrace trace events to log such MMIO register accesses which provides rich feature set such as early enablement of trace events, filtering capability, dumping ftrace logs on console and many more. Sample output: rwmmio_read: gic_peek_irq+0xd0/0xd8 readl addr=0xffff800010040104 rwmmio_write: gic_poke_irq+0xe4/0xf0 writel addr=0xffff800010040184 rwmmio_read: gic_do_wait_for_rwp+0x54/0x90 readl addr=0xffff800010040000 rwmmio_write: gic_set_affinity+0x1bc/0x1e8 writeq addr=0xffff800010046130 This series is a follow-up for the series [1] and a recent series [2] making use of both. [1] https://lore.kernel.org/lkml/cover.1536430404.git.saiprakash.ranjan@codeaurora.org/ [2] https://lore.kernel.org/lkml/1604631386-178312-1-git-send-email-psodagud@codeaurora.org/ Note in previous version, Arnd suggested to benchmark and compare size with callback based implementation, please see [3] for more details on that with brief comparison below. **Inline version with CONFIG_FTRACE=y and CONFIG_TRACE_MMIO_ACCESS=y** $ size vmlinux text data bss dec hex filename 23884219 14284468 532568 38701255 24e88c7 vmlinux **Callback version with CONFIG_FTRACE=y and CONFIG_TRACE_MMIO_ACCESS=y** $ size vmlinux text data bss dec hex filename 24108179 14279596 532568 38920343 251e097 vmlinux $ ./scripts/bloat-o-meter inline-vmlinux callback-vmlinux add/remove: 8/3 grow/shrink: 4889/89 up/down: 242244/-11564 (230680) Total: Before=25812612, After=26043292, chg +0.89% [3] https://lore.kernel.org/lkml/466449a1-36da-aaa9-7e4f-477f36b52c9e@quicinc.com/ Changes in v5: * Move arm64 to use asm-generic provided high level MMIO accessors (Arnd). * Add inline logging for MMIO relaxed and non-relaxed accessors. * Move nVHE KVM comment to makefile (Marc). * Fix overflow warning due to switch to inline accessors instead of macro. * Modify trace event field to include caller and parent details for more detailed logs. Changes in v4: * Drop dynamic debug based filter support since that will be developed later with the help from Steven (Ftrace maintainer). * Drop value passed to writel as it is causing hangs when tracing is enabled. * Code cleanup for trace event as suggested by Steven for earlier version. * Fixed some build errors reported by 0-day bot. Changes in v3: * Create a generic mmio header for instrumented version (Earlier suggested in [1] by Will Deacon and recently [2] by Greg to have a generic version first). * Add dynamic debug support to filter out traces which can be very useful for targeted debugging specific to subsystems or drivers. * Few modifications to the rwmmio trace event fields to include the mmio width and print addresses in hex. * Rewrote commit msg to explain some more about usecases. Prasad Sodagudi (1): tracing: Add register read/write tracing support Sai Prakash Ranjan (3): arm64: io: Use asm-generic high level MMIO accessors irqchip/tegra: Fix overflow implicit truncation warnings asm-generic/io: Add logging support for MMIO accessors arch/arm64/include/asm/io.h | 33 ++------------- arch/arm64/kvm/hyp/nvhe/Makefile | 7 +++- drivers/irqchip/irq-tegra.c | 10 ++--- include/asm-generic/io.h | 49 +++++++++++++++++++++++ include/trace/events/rwmmio.h | 69 ++++++++++++++++++++++++++++++++ kernel/trace/Kconfig | 7 ++++ kernel/trace/Makefile | 1 + kernel/trace/trace_readwrite.c | 29 ++++++++++++++ 8 files changed, 170 insertions(+), 35 deletions(-) create mode 100644 include/trace/events/rwmmio.h create mode 100644 kernel/trace/trace_readwrite.c -- 2.33.1 ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors 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 ` Sai Prakash Ranjan 2021-12-06 8:50 ` Arnd Bergmann ` (2 more replies) 2021-12-06 8:28 ` [PATCHv5 2/4] irqchip/tegra: Fix overflow implicit truncation warnings Sai Prakash Ranjan ` (2 subsequent siblings) 3 siblings, 3 replies; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 8:28 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier Cc: gregkh, linux-kernel, linux-arm-kernel, linux-arm-msm, quic_psodagud, Sai Prakash Ranjan Remove custom arm64 MMIO accessors read{b,w,l,q} and their relaxed versions in support to use asm-generic ones. Also define arm64 barrier macros to override the asm-generic defined barriers. Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com> --- arch/arm64/include/asm/io.h | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 7fd836bea7eb..33de60fdf6f1 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -112,35 +112,10 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) #define __iowmb() dma_wmb() #define __iomb() dma_mb() -/* - * Relaxed I/O memory access primitives. These follow the Device memory - * ordering rules but do not guarantee any ordering relative to Normal memory - * accesses. - */ -#define readb_relaxed(c) ({ u8 __r = __raw_readb(c); __r; }) -#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16)__raw_readw(c)); __r; }) -#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32)__raw_readl(c)); __r; }) -#define readq_relaxed(c) ({ u64 __r = le64_to_cpu((__force __le64)__raw_readq(c)); __r; }) - -#define writeb_relaxed(v,c) ((void)__raw_writeb((v),(c))) -#define writew_relaxed(v,c) ((void)__raw_writew((__force u16)cpu_to_le16(v),(c))) -#define writel_relaxed(v,c) ((void)__raw_writel((__force u32)cpu_to_le32(v),(c))) -#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64)cpu_to_le64(v),(c))) - -/* - * I/O memory access primitives. Reads are ordered relative to any - * following Normal memory access. Writes are ordered relative to any prior - * Normal memory access. - */ -#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(__v); __v; }) -#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(__v); __v; }) -#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(__v); __v; }) -#define readq(c) ({ u64 __v = readq_relaxed(c); __iormb(__v); __v; }) - -#define writeb(v,c) ({ __iowmb(); writeb_relaxed((v),(c)); }) -#define writew(v,c) ({ __iowmb(); writew_relaxed((v),(c)); }) -#define writel(v,c) ({ __iowmb(); writel_relaxed((v),(c)); }) -#define writeq(v,c) ({ __iowmb(); writeq_relaxed((v),(c)); }) +#define __io_ar(v) __io_par(v) +#define __io_bw() __iowmb() +#define __io_br(v) +#define __io_aw(v) /* * I/O port access primitives. -- 2.33.1 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors 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 15:36 ` kernel test robot 2021-12-07 13:04 ` kernel test robot 2 siblings, 1 reply; 25+ messages in thread From: Arnd Bergmann @ 2021-12-06 8:50 UTC (permalink / raw) To: Sai Prakash Ranjan Cc: Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud On Mon, Dec 6, 2021 at 9:28 AM Sai Prakash Ranjan <quic_saipraka@quicinc.com> wrote: > > Remove custom arm64 MMIO accessors read{b,w,l,q} and their relaxed > versions in support to use asm-generic ones. Also define arm64 > barrier macros to override the asm-generic defined barriers. > > Suggested-by: Arnd Bergmann <arnd@arndb.de> > Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com> This looks correct, but I would change one detail: > +#define __io_ar(v) __io_par(v) > +#define __io_bw() __iowmb() > +#define __io_br(v) > +#define __io_aw(v) The default __io_par() is defined in terms of __io_ar(), so it would be more logical to remove the custom __io_par() and just define __io_ar() here. I think it would be even better to flip these around and make the low-level definitions __io_ar() and __io_bw(), and then defining the arm64 specific macros based on those: /* arm64-specific, don't use in portable drivers */ #define __iormb(v) __io_ar(v) #define __iowmb() __io_bw() #define __iomb() dma_mb() Arnd ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors 2021-12-06 8:50 ` Arnd Bergmann @ 2021-12-06 11:12 ` Sai Prakash Ranjan 2021-12-06 11:30 ` Arnd Bergmann 0 siblings, 1 reply; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 11:12 UTC (permalink / raw) To: Arnd Bergmann Cc: Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud On 12/6/2021 2:20 PM, Arnd Bergmann wrote: > On Mon, Dec 6, 2021 at 9:28 AM Sai Prakash Ranjan > <quic_saipraka@quicinc.com> wrote: >> Remove custom arm64 MMIO accessors read{b,w,l,q} and their relaxed >> versions in support to use asm-generic ones. Also define arm64 >> barrier macros to override the asm-generic defined barriers. >> >> Suggested-by: Arnd Bergmann <arnd@arndb.de> >> Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com> > This looks correct, but I would change one detail: > >> +#define __io_ar(v) __io_par(v) >> +#define __io_bw() __iowmb() >> +#define __io_br(v) >> +#define __io_aw(v) > The default __io_par() is defined in terms of __io_ar(), so it would > be more logical > to remove the custom __io_par() and just define __io_ar() here. Makes sense, will do this. > I think it would be even better to flip these around and make the low-level > definitions __io_ar() and __io_bw(), and then defining the arm64 specific > macros based on those: > > /* arm64-specific, don't use in portable drivers */ > #define __iormb(v) __io_ar(v) > #define __iowmb() __io_bw() > #define __iomb() dma_mb() > > So __iormb on arm64 has some dummy control dependency stuff as well based on ("arm64: io: Ensure calls to delay routines are ordered against prior readX()") and then we would need to change __iormb definition to __io_ar which doesn't seem like __iormb definition to be exact right? Thanks, Sai ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors 2021-12-06 11:12 ` Sai Prakash Ranjan @ 2021-12-06 11:30 ` Arnd Bergmann 2021-12-06 13:52 ` Sai Prakash Ranjan 0 siblings, 1 reply; 25+ messages in thread From: Arnd Bergmann @ 2021-12-06 11:30 UTC (permalink / raw) To: Sai Prakash Ranjan Cc: Arnd Bergmann, Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud On Mon, Dec 6, 2021 at 12:12 PM Sai Prakash Ranjan <quic_saipraka@quicinc.com> wrote: > On 12/6/2021 2:20 PM, Arnd Bergmann wrote: > > I think it would be even better to flip these around and make the low-level > > definitions __io_ar() and __io_bw(), and then defining the arm64 specific > > macros based on those: > > > > /* arm64-specific, don't use in portable drivers */ > > #define __iormb(v) __io_ar(v) > > #define __iowmb() __io_bw() > > #define __iomb() dma_mb() > > > > > > So __iormb on arm64 has some dummy control dependency stuff as well based on > ("arm64: io: Ensure calls to delay routines are ordered against prior > readX()") and then we would need to change __iormb definition to __io_ar which > doesn't seem like __iormb definition to be exact right? I'm not sure what you are asking here. As far as I can tell, __io_ar() and __iormb() have the same calling conventions and the same barrier requirements, so they should be interchangeable, we just need to decide which one is the primary definition. Arnd ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors 2021-12-06 11:30 ` Arnd Bergmann @ 2021-12-06 13:52 ` Sai Prakash Ranjan 2021-12-06 15:15 ` Arnd Bergmann 0 siblings, 1 reply; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 13:52 UTC (permalink / raw) To: Arnd Bergmann Cc: Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud On 12/6/2021 5:00 PM, Arnd Bergmann wrote: > On Mon, Dec 6, 2021 at 12:12 PM Sai Prakash Ranjan > <quic_saipraka@quicinc.com> wrote: >> On 12/6/2021 2:20 PM, Arnd Bergmann wrote: >>> I think it would be even better to flip these around and make the low-level >>> definitions __io_ar() and __io_bw(), and then defining the arm64 specific >>> macros based on those: >>> >>> /* arm64-specific, don't use in portable drivers */ >>> #define __iormb(v) __io_ar(v) >>> #define __iowmb() __io_bw() >>> #define __iomb() dma_mb() >>> >>> >> So __iormb on arm64 has some dummy control dependency stuff as well based on >> ("arm64: io: Ensure calls to delay routines are ordered against prior >> readX()") and then we would need to change __iormb definition to __io_ar which >> doesn't seem like __iormb definition to be exact right? > I'm not sure what you are asking here. As far as I can tell, __io_ar() > and __iormb() have the same calling conventions and the same barrier > requirements, so they should be interchangeable, we just need to decide > which one is the primary definition. > > Arnd Sorry, what I meant was the literal name of these macros, i.e., __iormb() has more explicit naming as IO read memory barrier and __io_ar() is IO after read? So doesn't it make more sense that __iormb() should be the primary definition which is already the case and ar/bw should be based on them. Thanks, Sai ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors 2021-12-06 13:52 ` Sai Prakash Ranjan @ 2021-12-06 15:15 ` Arnd Bergmann 2021-12-06 15:57 ` Sai Prakash Ranjan 0 siblings, 1 reply; 25+ messages in thread From: Arnd Bergmann @ 2021-12-06 15:15 UTC (permalink / raw) To: Sai Prakash Ranjan Cc: Arnd Bergmann, Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud On Mon, Dec 6, 2021 at 2:52 PM Sai Prakash Ranjan <quic_saipraka@quicinc.com> wrote: > > Sorry, what I meant was the literal name of these macros, i.e., > __iormb() has more explicit naming as > IO read memory barrier and __io_ar() is IO after read? So doesn't it > make more sense that __iormb() > should be the primary definition which is already the case and ar/bw > should be based on them. My reasoning was that we should ideally only have one set, and that __io_ar()/__io_bw() are the ones used in architecture-independent code, so I'd rather use those and deprecate the arm64 specific ones, eventually moving all the arm64 specific code to use those directly where needed. Arnd ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors 2021-12-06 15:15 ` Arnd Bergmann @ 2021-12-06 15:57 ` Sai Prakash Ranjan 0 siblings, 0 replies; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 15:57 UTC (permalink / raw) To: Arnd Bergmann Cc: Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud On 12/6/2021 8:45 PM, Arnd Bergmann wrote: > On Mon, Dec 6, 2021 at 2:52 PM Sai Prakash Ranjan > <quic_saipraka@quicinc.com> wrote: >> Sorry, what I meant was the literal name of these macros, i.e., >> __iormb() has more explicit naming as >> IO read memory barrier and __io_ar() is IO after read? So doesn't it >> make more sense that __iormb() >> should be the primary definition which is already the case and ar/bw >> should be based on them. > My reasoning was that we should ideally only have one set, and that > __io_ar()/__io_bw() are the ones used in architecture-independent code, > so I'd rather use those and deprecate the arm64 specific ones, eventually > moving all the arm64 specific code to use those directly where needed. > > Arnd Ah ok, good enough. I will do this in the next version. Thanks, Sai ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors 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 15:36 ` kernel test robot 2021-12-07 13:04 ` kernel test robot 2 siblings, 0 replies; 25+ messages in thread From: kernel test robot @ 2021-12-06 15:36 UTC (permalink / raw) To: Sai Prakash Ranjan, Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier Cc: kbuild-all, gregkh, linux-kernel, linux-arm-kernel, linux-arm-msm, quic_psodagud Hi Sai, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on arm64/for-next/core] [also build test WARNING on rostedt-trace/for-next arnd-asm-generic/master arm-perf/for-next/perf v5.16-rc4 next-20211206] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Sai-Prakash-Ranjan/tracing-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20211206-163212 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core config: arm64-randconfig-r014-20211206 (https://download.01.org/0day-ci/archive/20211206/202112062304.8qIQUQyF-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 11.2.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/0775ecf0f452d6b76b161d009dab52c90270755a git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sai-Prakash-Ranjan/tracing-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20211206-163212 git checkout 0775ecf0f452d6b76b161d009dab52c90270755a # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): In file included from drivers/gpu/drm/meson/meson_viu.c:16: drivers/gpu/drm/meson/meson_viu.c: In function 'meson_viu_init': >> drivers/gpu/drm/meson/meson_registers.h:1826:55: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744071814774785' to '2400190465' [-Woverflow] 1826 | #define VIU_OSD_BLEND_REORDER(dest, src) ((src) << (dest * 4)) | ^ drivers/gpu/drm/meson/meson_viu.c:472:32: note: in expansion of macro 'VIU_OSD_BLEND_REORDER' 472 | writel_relaxed(VIU_OSD_BLEND_REORDER(0, 1) | | ^~~~~~~~~~~~~~~~~~~~~ vim +1826 drivers/gpu/drm/meson/meson_registers.h b93a66faeea9ddf Neil Armstrong 2019-03-25 1824 b93a66faeea9ddf Neil Armstrong 2019-03-25 1825 #define VIU_OSD_BLEND_CTRL 0x39b0 147ae1cbaa18429 Julien Masson 2019-06-24 @1826 #define VIU_OSD_BLEND_REORDER(dest, src) ((src) << (dest * 4)) 147ae1cbaa18429 Julien Masson 2019-06-24 1827 #define VIU_OSD_BLEND_DIN_EN(bits) ((bits & 0xf) << 20) 147ae1cbaa18429 Julien Masson 2019-06-24 1828 #define VIU_OSD_BLEND1_DIN3_BYPASS_TO_DOUT1 BIT(24) 147ae1cbaa18429 Julien Masson 2019-06-24 1829 #define VIU_OSD_BLEND1_DOUT_BYPASS_TO_BLEND2 BIT(25) 147ae1cbaa18429 Julien Masson 2019-06-24 1830 #define VIU_OSD_BLEND_DIN0_BYPASS_TO_DOUT0 BIT(26) 147ae1cbaa18429 Julien Masson 2019-06-24 1831 #define VIU_OSD_BLEND_BLEN2_PREMULT_EN(input) ((input & 0x3) << 27) 147ae1cbaa18429 Julien Masson 2019-06-24 1832 #define VIU_OSD_BLEND_HOLD_LINES(lines) ((lines & 0x7) << 29) b93a66faeea9ddf Neil Armstrong 2019-03-25 1833 #define VIU_OSD_BLEND_CTRL1 0x39c0 b93a66faeea9ddf Neil Armstrong 2019-03-25 1834 #define VIU_OSD_BLEND_DIN0_SCOPE_H 0x39b1 b93a66faeea9ddf Neil Armstrong 2019-03-25 1835 #define VIU_OSD_BLEND_DIN0_SCOPE_V 0x39b2 b93a66faeea9ddf Neil Armstrong 2019-03-25 1836 #define VIU_OSD_BLEND_DIN1_SCOPE_H 0x39b3 b93a66faeea9ddf Neil Armstrong 2019-03-25 1837 #define VIU_OSD_BLEND_DIN1_SCOPE_V 0x39b4 b93a66faeea9ddf Neil Armstrong 2019-03-25 1838 #define VIU_OSD_BLEND_DIN2_SCOPE_H 0x39b5 b93a66faeea9ddf Neil Armstrong 2019-03-25 1839 #define VIU_OSD_BLEND_DIN2_SCOPE_V 0x39b6 b93a66faeea9ddf Neil Armstrong 2019-03-25 1840 #define VIU_OSD_BLEND_DIN3_SCOPE_H 0x39b7 b93a66faeea9ddf Neil Armstrong 2019-03-25 1841 #define VIU_OSD_BLEND_DIN3_SCOPE_V 0x39b8 b93a66faeea9ddf Neil Armstrong 2019-03-25 1842 #define VIU_OSD_BLEND_DUMMY_DATA0 0x39b9 b93a66faeea9ddf Neil Armstrong 2019-03-25 1843 #define VIU_OSD_BLEND_DUMMY_ALPHA 0x39ba b93a66faeea9ddf Neil Armstrong 2019-03-25 1844 #define VIU_OSD_BLEND_BLEND0_SIZE 0x39bb b93a66faeea9ddf Neil Armstrong 2019-03-25 1845 #define VIU_OSD_BLEND_BLEND1_SIZE 0x39bc b93a66faeea9ddf Neil Armstrong 2019-03-25 1846 #define VIU_OSD_BLEND_RO_CURRENT_XY 0x39bf b93a66faeea9ddf Neil Armstrong 2019-03-25 1847 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 1/4] arm64: io: Use asm-generic high level MMIO accessors 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 15:36 ` kernel test robot @ 2021-12-07 13:04 ` kernel test robot 2 siblings, 0 replies; 25+ messages in thread From: kernel test robot @ 2021-12-07 13:04 UTC (permalink / raw) To: Sai Prakash Ranjan, Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier Cc: llvm, kbuild-all, gregkh, linux-kernel, linux-arm-kernel, linux-arm-msm, quic_psodagud Hi Sai, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on arm64/for-next/core] [also build test WARNING on rostedt-trace/for-next arnd-asm-generic/master arm-perf/for-next/perf v5.16-rc4 next-20211207] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Sai-Prakash-Ranjan/tracing-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20211206-163212 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core config: arm64-randconfig-r022-20211207 (https://download.01.org/0day-ci/archive/20211207/202112072058.SZ9tPvIm-lkp@intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/0day-ci/linux/commit/0775ecf0f452d6b76b161d009dab52c90270755a git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sai-Prakash-Ranjan/tracing-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20211206-163212 git checkout 0775ecf0f452d6b76b161d009dab52c90270755a # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/meson/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/gpu/drm/meson/meson_viu.c:480:45: warning: implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 18446744071814774785 to 2400190465 [-Wconstant-conversion] VIU_OSD_BLEND_BLEN2_PREMULT_EN(1) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ 1 warning generated. vim +480 drivers/gpu/drm/meson/meson_viu.c 1b85270ff156d56 Neil Armstrong 2019-10-21 413 bbbe775ec5b5dac Neil Armstrong 2016-11-10 414 void meson_viu_init(struct meson_drm *priv) bbbe775ec5b5dac Neil Armstrong 2016-11-10 415 { bbbe775ec5b5dac Neil Armstrong 2016-11-10 416 uint32_t reg; bbbe775ec5b5dac Neil Armstrong 2016-11-10 417 bbbe775ec5b5dac Neil Armstrong 2016-11-10 418 /* Disable OSDs */ 147ae1cbaa18429 Julien Masson 2019-06-24 419 writel_bits_relaxed(VIU_OSD1_OSD_BLK_ENABLE | VIU_OSD1_OSD_ENABLE, 0, bbbe775ec5b5dac Neil Armstrong 2016-11-10 420 priv->io_base + _REG(VIU_OSD1_CTRL_STAT)); 147ae1cbaa18429 Julien Masson 2019-06-24 421 writel_bits_relaxed(VIU_OSD1_OSD_BLK_ENABLE | VIU_OSD1_OSD_ENABLE, 0, bbbe775ec5b5dac Neil Armstrong 2016-11-10 422 priv->io_base + _REG(VIU_OSD2_CTRL_STAT)); bbbe775ec5b5dac Neil Armstrong 2016-11-10 423 bbbe775ec5b5dac Neil Armstrong 2016-11-10 424 /* On GXL/GXM, Use the 10bit HDR conversion matrix */ 528a25d040bc212 Julien Masson 2019-08-22 425 if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXM) || 528a25d040bc212 Julien Masson 2019-08-22 426 meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL)) bbbe775ec5b5dac Neil Armstrong 2016-11-10 427 meson_viu_load_matrix(priv); bf33677a3c394bb Christian Hewitt 2021-08-06 428 else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { 728883948b0d3c0 Neil Armstrong 2019-03-25 429 meson_viu_set_g12a_osd1_matrix(priv, RGB709_to_YUV709l_coeff, 728883948b0d3c0 Neil Armstrong 2019-03-25 430 true); bf33677a3c394bb Christian Hewitt 2021-08-06 431 /* fix green/pink color distortion from vendor u-boot */ bf33677a3c394bb Christian Hewitt 2021-08-06 432 writel_bits_relaxed(OSD1_HDR2_CTRL_REG_ONLY_MAT | bf33677a3c394bb Christian Hewitt 2021-08-06 433 OSD1_HDR2_CTRL_VDIN0_HDR2_TOP_EN, 0, bf33677a3c394bb Christian Hewitt 2021-08-06 434 priv->io_base + _REG(OSD1_HDR2_CTRL)); bf33677a3c394bb Christian Hewitt 2021-08-06 435 } bbbe775ec5b5dac Neil Armstrong 2016-11-10 436 bbbe775ec5b5dac Neil Armstrong 2016-11-10 437 /* Initialize OSD1 fifo control register */ 147ae1cbaa18429 Julien Masson 2019-06-24 438 reg = VIU_OSD_DDR_PRIORITY_URGENT | 24e0d4058eff7cd Neil Armstrong 2019-10-21 439 VIU_OSD_HOLD_FIFO_LINES(31) | 147ae1cbaa18429 Julien Masson 2019-06-24 440 VIU_OSD_FIFO_DEPTH_VAL(32) | /* fifo_depth_val: 32*8=256 */ 147ae1cbaa18429 Julien Masson 2019-06-24 441 VIU_OSD_WORDS_PER_BURST(4) | /* 4 words in 1 burst */ 147ae1cbaa18429 Julien Masson 2019-06-24 442 VIU_OSD_FIFO_LIMITS(2); /* fifo_lim: 2*16=32 */ 147ae1cbaa18429 Julien Masson 2019-06-24 443 528a25d040bc212 Julien Masson 2019-08-22 444 if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) 17f64701ea6f541 Martin Blumenstingl 2020-06-20 445 reg |= VIU_OSD_BURST_LENGTH_32; 728883948b0d3c0 Neil Armstrong 2019-03-25 446 else 17f64701ea6f541 Martin Blumenstingl 2020-06-20 447 reg |= VIU_OSD_BURST_LENGTH_64; 147ae1cbaa18429 Julien Masson 2019-06-24 448 bbbe775ec5b5dac Neil Armstrong 2016-11-10 449 writel_relaxed(reg, priv->io_base + _REG(VIU_OSD1_FIFO_CTRL_STAT)); bbbe775ec5b5dac Neil Armstrong 2016-11-10 450 writel_relaxed(reg, priv->io_base + _REG(VIU_OSD2_FIFO_CTRL_STAT)); bbbe775ec5b5dac Neil Armstrong 2016-11-10 451 bbbe775ec5b5dac Neil Armstrong 2016-11-10 452 /* Set OSD alpha replace value */ bbbe775ec5b5dac Neil Armstrong 2016-11-10 453 writel_bits_relaxed(0xff << OSD_REPLACE_SHIFT, bbbe775ec5b5dac Neil Armstrong 2016-11-10 454 0xff << OSD_REPLACE_SHIFT, bbbe775ec5b5dac Neil Armstrong 2016-11-10 455 priv->io_base + _REG(VIU_OSD1_CTRL_STAT2)); bbbe775ec5b5dac Neil Armstrong 2016-11-10 456 writel_bits_relaxed(0xff << OSD_REPLACE_SHIFT, bbbe775ec5b5dac Neil Armstrong 2016-11-10 457 0xff << OSD_REPLACE_SHIFT, bbbe775ec5b5dac Neil Armstrong 2016-11-10 458 priv->io_base + _REG(VIU_OSD2_CTRL_STAT2)); bbbe775ec5b5dac Neil Armstrong 2016-11-10 459 f9a2348196d1ab9 Neil Armstrong 2018-11-06 460 /* Disable VD1 AFBC */ 147ae1cbaa18429 Julien Masson 2019-06-24 461 /* di_mif0_en=0 mif0_to_vpp_en=0 di_mad_en=0 and afbc vd1 set=0*/ 147ae1cbaa18429 Julien Masson 2019-06-24 462 writel_bits_relaxed(VIU_CTRL0_VD1_AFBC_MASK, 0, f9a2348196d1ab9 Neil Armstrong 2018-11-06 463 priv->io_base + _REG(VIU_MISC_CTRL0)); f9a2348196d1ab9 Neil Armstrong 2018-11-06 464 writel_relaxed(0, priv->io_base + _REG(AFBC_ENABLE)); f9a2348196d1ab9 Neil Armstrong 2018-11-06 465 f9a2348196d1ab9 Neil Armstrong 2018-11-06 466 writel_relaxed(0x00FF00C0, f9a2348196d1ab9 Neil Armstrong 2018-11-06 467 priv->io_base + _REG(VD1_IF0_LUMA_FIFO_SIZE)); f9a2348196d1ab9 Neil Armstrong 2018-11-06 468 writel_relaxed(0x00FF00C0, f9a2348196d1ab9 Neil Armstrong 2018-11-06 469 priv->io_base + _REG(VD2_IF0_LUMA_FIFO_SIZE)); f9a2348196d1ab9 Neil Armstrong 2018-11-06 470 528a25d040bc212 Julien Masson 2019-08-22 471 if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { 147ae1cbaa18429 Julien Masson 2019-06-24 472 writel_relaxed(VIU_OSD_BLEND_REORDER(0, 1) | 147ae1cbaa18429 Julien Masson 2019-06-24 473 VIU_OSD_BLEND_REORDER(1, 0) | 147ae1cbaa18429 Julien Masson 2019-06-24 474 VIU_OSD_BLEND_REORDER(2, 0) | 147ae1cbaa18429 Julien Masson 2019-06-24 475 VIU_OSD_BLEND_REORDER(3, 0) | 147ae1cbaa18429 Julien Masson 2019-06-24 476 VIU_OSD_BLEND_DIN_EN(1) | 147ae1cbaa18429 Julien Masson 2019-06-24 477 VIU_OSD_BLEND1_DIN3_BYPASS_TO_DOUT1 | 147ae1cbaa18429 Julien Masson 2019-06-24 478 VIU_OSD_BLEND1_DOUT_BYPASS_TO_BLEND2 | 147ae1cbaa18429 Julien Masson 2019-06-24 479 VIU_OSD_BLEND_DIN0_BYPASS_TO_DOUT0 | 147ae1cbaa18429 Julien Masson 2019-06-24 @480 VIU_OSD_BLEND_BLEN2_PREMULT_EN(1) | --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCHv5 2/4] irqchip/tegra: Fix overflow implicit truncation warnings 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:28 ` 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:28 ` [PATCHv5 4/4] asm-generic/io: Add logging support for MMIO accessors Sai Prakash Ranjan 3 siblings, 1 reply; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 8:28 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier Cc: gregkh, linux-kernel, linux-arm-kernel, linux-arm-msm, quic_psodagud, Sai Prakash Ranjan Fix -Woverflow warnings for tegra irqchip driver which is a result of moving arm64 custom MMIO accessor macros to asm-generic function implementations giving a bonus type-checking now and uncovering these overflow warnings. drivers/irqchip/irq-tegra.c: In function ‘tegra_ictlr_suspend’: drivers/irqchip/irq-tegra.c:151:18: warning: large integer implicitly truncated to unsigned type [-Woverflow] writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR); ^ Cc: Marc Zyngier <maz@kernel.org> Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com> --- drivers/irqchip/irq-tegra.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-tegra.c b/drivers/irqchip/irq-tegra.c index e1f771c72fc4..9e4e5b39c701 100644 --- a/drivers/irqchip/irq-tegra.c +++ b/drivers/irqchip/irq-tegra.c @@ -148,10 +148,10 @@ static int tegra_ictlr_suspend(void) lic->cop_iep[i] = readl_relaxed(ictlr + ICTLR_COP_IEP_CLASS); /* Disable COP interrupts */ - writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR); + writel_relaxed(~0u, ictlr + ICTLR_COP_IER_CLR); /* Disable CPU interrupts */ - writel_relaxed(~0ul, ictlr + ICTLR_CPU_IER_CLR); + writel_relaxed(~0u, ictlr + ICTLR_CPU_IER_CLR); /* Enable the wakeup sources of ictlr */ writel_relaxed(lic->ictlr_wake_mask[i], ictlr + ICTLR_CPU_IER_SET); @@ -172,12 +172,12 @@ static void tegra_ictlr_resume(void) writel_relaxed(lic->cpu_iep[i], ictlr + ICTLR_CPU_IEP_CLASS); - writel_relaxed(~0ul, ictlr + ICTLR_CPU_IER_CLR); + writel_relaxed(~0u, ictlr + ICTLR_CPU_IER_CLR); writel_relaxed(lic->cpu_ier[i], ictlr + ICTLR_CPU_IER_SET); writel_relaxed(lic->cop_iep[i], ictlr + ICTLR_COP_IEP_CLASS); - writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR); + writel_relaxed(~0u, ictlr + ICTLR_COP_IER_CLR); writel_relaxed(lic->cop_ier[i], ictlr + ICTLR_COP_IER_SET); } @@ -312,7 +312,7 @@ static int __init tegra_ictlr_init(struct device_node *node, lic->base[i] = base; /* Disable all interrupts */ - writel_relaxed(~0UL, base + ICTLR_CPU_IER_CLR); + writel_relaxed(~0U, base + ICTLR_CPU_IER_CLR); /* All interrupts target IRQ */ writel_relaxed(0, base + ICTLR_CPU_IEP_CLASS); -- 2.33.1 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCHv5 2/4] irqchip/tegra: Fix overflow implicit truncation warnings 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 0 siblings, 0 replies; 25+ messages in thread From: Arnd Bergmann @ 2021-12-06 8:51 UTC (permalink / raw) To: Sai Prakash Ranjan Cc: Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud On Mon, Dec 6, 2021 at 9:28 AM Sai Prakash Ranjan <quic_saipraka@quicinc.com> wrote: > > Fix -Woverflow warnings for tegra irqchip driver which is a result > of moving arm64 custom MMIO accessor macros to asm-generic function > implementations giving a bonus type-checking now and uncovering these > overflow warnings. > > drivers/irqchip/irq-tegra.c: In function ‘tegra_ictlr_suspend’: > drivers/irqchip/irq-tegra.c:151:18: warning: large integer implicitly truncated to unsigned type [-Woverflow] > writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR); > ^ > > Cc: Marc Zyngier <maz@kernel.org> > Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCHv5 3/4] tracing: Add register read/write tracing support 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:28 ` [PATCHv5 2/4] irqchip/tegra: Fix overflow implicit truncation warnings Sai Prakash Ranjan @ 2021-12-06 8:28 ` Sai Prakash Ranjan 2021-12-06 8:59 ` Arnd Bergmann ` (2 more replies) 2021-12-06 8:28 ` [PATCHv5 4/4] asm-generic/io: Add logging support for MMIO accessors Sai Prakash Ranjan 3 siblings, 3 replies; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 8:28 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier Cc: gregkh, linux-kernel, linux-arm-kernel, linux-arm-msm, quic_psodagud, Prasad Sodagudi, Sai Prakash Ranjan From: Prasad Sodagudi <psodagud@codeaurora.org> Generic MMIO read/write i.e., __raw_{read,write}{b,l,w,q} accessors are typically used to read/write from/to memory mapped registers and can cause hangs or some undefined behaviour in following few cases, * If the access to the register space is unclocked, for example: if there is an access to multimedia(MM) block registers without MM clocks. * If the register space is protected and not set to be accessible from non-secure world, for example: only EL3 (EL: Exception level) access is allowed and any EL2/EL1 access is forbidden. * If xPU(memory/register protection units) is controlling access to certain memory/register space for specific clients. and more... Such cases usually results in instant reboot/SErrors/NOC or interconnect hangs and tracing these register accesses can be very helpful to debug such issues during initial development stages and also in later stages. So use ftrace trace events to log such MMIO register accesses which provides rich feature set such as early enablement of trace events, filtering capability, dumping ftrace logs on console and many more. Sample output: rwmmio_read: qcom_geni_serial_poll_bit+0xe4/0x108 width=32 addr=0xfffffbfffdbff610 rwmmio_write: qcom_geni_serial_wr_char+0x78/0x80 width=32 val=0x2020205b addr=0xfffffbfffdbff700 rwmmio_write: __qcom_geni_serial_console_write+0x130/0x198 width=32 val=0x40000000 addr=0xfffffbfffdbff618 rwmmio_read: qcom_geni_serial_poll_bit+0xe4/0x108 width=32 addr=0xfffffbfffdbff610 Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org> [saiprakash: Rewrote commit msg and trace event field edits] Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com> --- include/trace/events/rwmmio.h | 69 ++++++++++++++++++++++++++++++++++ kernel/trace/Kconfig | 7 ++++ kernel/trace/Makefile | 1 + kernel/trace/trace_readwrite.c | 29 ++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 include/trace/events/rwmmio.h create mode 100644 kernel/trace/trace_readwrite.c diff --git a/include/trace/events/rwmmio.h b/include/trace/events/rwmmio.h new file mode 100644 index 000000000000..a73bbaa1edd6 --- /dev/null +++ b/include/trace/events/rwmmio.h @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM rwmmio + +#if !defined(_TRACE_RWMMIO_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_RWMMIO_H + +#include <linux/tracepoint.h> + +TRACE_EVENT(rwmmio_write, + + TP_PROTO(unsigned long caller, unsigned long parent, u64 val, + u8 width, volatile void __iomem *addr), + + TP_ARGS(caller, parent, val, width, addr), + + TP_STRUCT__entry( + __field(u64, caller) + __field(u64, parent) + __field(u64, val) + __field(u64, addr) + __field(u8, width) + ), + + TP_fast_assign( + __entry->caller = caller; + __entry->parent = parent; + __entry->val = val; + __entry->addr = (unsigned long)(void *)addr; + __entry->width = width; + ), + + TP_printk("%pS <- %pS width=%d val=%#llx addr=%#llx", + (void *)(unsigned long)__entry->caller, (void *)(unsigned long)__entry->parent, + __entry->width, __entry->val, __entry->addr) +); + +TRACE_EVENT(rwmmio_read, + + TP_PROTO(unsigned long caller, unsigned long parent, u8 width, + const volatile void __iomem *addr), + + TP_ARGS(caller, parent, width, addr), + + TP_STRUCT__entry( + __field(u64, caller) + __field(u64, parent) + __field(u64, addr) + __field(u8, width) + ), + + TP_fast_assign( + __entry->caller = caller; + __entry->parent = parent; + __entry->addr = (unsigned long)(void *)addr; + __entry->width = width; + ), + + TP_printk("%pS <- %pS width=%d addr=%#llx", + (void *)(unsigned long)__entry->caller, (void *)(unsigned long)__entry->parent, + __entry->width, __entry->addr) +); + +#endif /* _TRACE_RWMMIO_H */ + +#include <trace/define_trace.h> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 420ff4bc67fd..9f55bcc51de1 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -95,6 +95,13 @@ config RING_BUFFER_ALLOW_SWAP Allow the use of ring_buffer_swap_cpu. Adds a very slight overhead to tracing when enabled. +config TRACE_MMIO_ACCESS + bool "Register read/write tracing" + depends on TRACING + help + Create tracepoints for MMIO read/write operations. These trace events + can be used for logging all MMIO read/write operations. + config PREEMPTIRQ_TRACEPOINTS bool depends on TRACE_PREEMPT_TOGGLE || TRACE_IRQFLAGS diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile index bedc5caceec7..a3d16e1a5abd 100644 --- a/kernel/trace/Makefile +++ b/kernel/trace/Makefile @@ -99,5 +99,6 @@ obj-$(CONFIG_BOOTTIME_TRACING) += trace_boot.o obj-$(CONFIG_FTRACE_RECORD_RECURSION) += trace_recursion_record.o obj-$(CONFIG_TRACEPOINT_BENCHMARK) += trace_benchmark.o +obj-$(CONFIG_TRACE_MMIO_ACCESS) += trace_readwrite.o libftrace-y := ftrace.o diff --git a/kernel/trace/trace_readwrite.c b/kernel/trace/trace_readwrite.c new file mode 100644 index 000000000000..5ecf84dc6c13 --- /dev/null +++ b/kernel/trace/trace_readwrite.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Register read and write tracepoints + * + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#include <linux/ftrace.h> +#include <linux/module.h> +#include <asm-generic/io.h> + +#define CREATE_TRACE_POINTS +#include <trace/events/rwmmio.h> + +#ifdef CONFIG_TRACE_MMIO_ACCESS +void log_write_mmio(u64 val, u8 width, volatile void __iomem *addr) +{ + trace_rwmmio_write(CALLER_ADDR0, CALLER_ADDR1, val, width, addr); +} +EXPORT_SYMBOL_GPL(log_write_mmio); +EXPORT_TRACEPOINT_SYMBOL_GPL(rwmmio_write); + +void log_read_mmio(u8 width, const volatile void __iomem *addr) +{ + trace_rwmmio_read(CALLER_ADDR0, CALLER_ADDR1, width, addr); +} +EXPORT_SYMBOL_GPL(log_read_mmio); +EXPORT_TRACEPOINT_SYMBOL_GPL(rwmmio_read); +#endif /* CONFIG_TRACE_MMIO_ACCESS */ -- 2.33.1 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCHv5 3/4] tracing: Add register read/write tracing support 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:13 ` Sai Prakash Ranjan 2021-12-06 11:52 ` kernel test robot 2021-12-06 16:39 ` kernel test robot 2 siblings, 2 replies; 25+ messages in thread From: Arnd Bergmann @ 2021-12-06 8:59 UTC (permalink / raw) To: Sai Prakash Ranjan Cc: Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud, Prasad Sodagudi On Mon, Dec 6, 2021 at 9:28 AM Sai Prakash Ranjan <quic_saipraka@quicinc.com> wrote: > diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig > index 420ff4bc67fd..9f55bcc51de1 100644 > --- a/kernel/trace/Kconfig > +++ b/kernel/trace/Kconfig > @@ -95,6 +95,13 @@ config RING_BUFFER_ALLOW_SWAP > Allow the use of ring_buffer_swap_cpu. > Adds a very slight overhead to tracing when enabled. > > +config TRACE_MMIO_ACCESS > + bool "Register read/write tracing" > + depends on TRACING > + help > + Create tracepoints for MMIO read/write operations. These trace events > + can be used for logging all MMIO read/write operations. I think this needs a 'depends on ARCH_HAVE_TRACE_MMIO_ACCESS' or similar. > +void log_read_mmio(u8 width, const volatile void __iomem *addr) > +{ > + trace_rwmmio_read(CALLER_ADDR0, CALLER_ADDR1, width, addr); > +} Here, it may be better to pass the caller address as an argument, I think CALLER_ADDR1 is not always reliable, though it's possible that it is in the configurations when this file gets enabled. Arnd ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 3/4] tracing: Add register read/write tracing support 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:13 ` Sai Prakash Ranjan 1 sibling, 1 reply; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 10:11 UTC (permalink / raw) To: Arnd Bergmann Cc: Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud, Prasad Sodagudi On 12/6/2021 2:29 PM, Arnd Bergmann wrote: > On Mon, Dec 6, 2021 at 9:28 AM Sai Prakash Ranjan > <quic_saipraka@quicinc.com> wrote: >> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig >> index 420ff4bc67fd..9f55bcc51de1 100644 >> --- a/kernel/trace/Kconfig >> +++ b/kernel/trace/Kconfig >> @@ -95,6 +95,13 @@ config RING_BUFFER_ALLOW_SWAP >> Allow the use of ring_buffer_swap_cpu. >> Adds a very slight overhead to tracing when enabled. >> >> +config TRACE_MMIO_ACCESS >> + bool "Register read/write tracing" >> + depends on TRACING >> + help >> + Create tracepoints for MMIO read/write operations. These trace events >> + can be used for logging all MMIO read/write operations. > I think this needs a 'depends on ARCH_HAVE_TRACE_MMIO_ACCESS' > or similar. Sure, will add it. >> +void log_read_mmio(u8 width, const volatile void __iomem *addr) >> +{ >> + trace_rwmmio_read(CALLER_ADDR0, CALLER_ADDR1, width, addr); >> +} > Here, it may be better to pass the caller address as an argument, I think > CALLER_ADDR1 is not always reliable, though it's possible that it is > in the configurations when this file gets enabled. > > Do you mean that we use __builtin_return_address(0,1) directly here or that I pass __func__ as the argument to log_read/write_mmio or is there some other way to pass the caller address? Thanks, Sai ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 3/4] tracing: Add register read/write tracing support 2021-12-06 10:11 ` Sai Prakash Ranjan @ 2021-12-06 10:46 ` Arnd Bergmann 2021-12-06 10:52 ` Sai Prakash Ranjan 0 siblings, 1 reply; 25+ messages in thread From: Arnd Bergmann @ 2021-12-06 10:46 UTC (permalink / raw) To: Sai Prakash Ranjan Cc: Arnd Bergmann, Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud, Prasad Sodagudi On Mon, Dec 6, 2021 at 11:11 AM Sai Prakash Ranjan <quic_saipraka@quicinc.com> wrote: > On 12/6/2021 2:29 PM, Arnd Bergmann wrote: > > On Mon, Dec 6, 2021 at 9:28 AM Sai Prakash Ranjan > >> +void log_read_mmio(u8 width, const volatile void __iomem *addr) > >> +{ > >> + trace_rwmmio_read(CALLER_ADDR0, CALLER_ADDR1, width, addr); > >> +} > > Here, it may be better to pass the caller address as an argument, I think > > CALLER_ADDR1 is not always reliable, though it's possible that it is > > in the configurations when this file gets enabled. > > > > > > Do you mean that we use __builtin_return_address(0,1) directly here or > that I pass __func__ as the argument to log_read/write_mmio or is there > some other way to pass the caller address? I meant passing CALLER_ADDR0 from readl() down to log_read_mmio(). Arnd ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 3/4] tracing: Add register read/write tracing support 2021-12-06 10:46 ` Arnd Bergmann @ 2021-12-06 10:52 ` Sai Prakash Ranjan 0 siblings, 0 replies; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 10:52 UTC (permalink / raw) To: Arnd Bergmann Cc: Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud, Prasad Sodagudi On 12/6/2021 4:16 PM, Arnd Bergmann wrote: > On Mon, Dec 6, 2021 at 11:11 AM Sai Prakash Ranjan > <quic_saipraka@quicinc.com> wrote: >> On 12/6/2021 2:29 PM, Arnd Bergmann wrote: >>> On Mon, Dec 6, 2021 at 9:28 AM Sai Prakash Ranjan >>>> +void log_read_mmio(u8 width, const volatile void __iomem *addr) >>>> +{ >>>> + trace_rwmmio_read(CALLER_ADDR0, CALLER_ADDR1, width, addr); >>>> +} >>> Here, it may be better to pass the caller address as an argument, I think >>> CALLER_ADDR1 is not always reliable, though it's possible that it is >>> in the configurations when this file gets enabled. >>> >>> >> Do you mean that we use __builtin_return_address(0,1) directly here or >> that I pass __func__ as the argument to log_read/write_mmio or is there >> some other way to pass the caller address? > I meant passing CALLER_ADDR0 from readl() down to > log_read_mmio(). > > Arnd Ah ok, will do that and remove CALLER_ADDR1. Thanks, Sai ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 3/4] tracing: Add register read/write tracing support 2021-12-06 8:59 ` Arnd Bergmann 2021-12-06 10:11 ` Sai Prakash Ranjan @ 2021-12-06 10:13 ` Sai Prakash Ranjan 1 sibling, 0 replies; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 10:13 UTC (permalink / raw) To: Arnd Bergmann Cc: Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud, Prasad Sodagudi On 12/6/2021 2:29 PM, Arnd Bergmann wrote: > On Mon, Dec 6, 2021 at 9:28 AM Sai Prakash Ranjan > <quic_saipraka@quicinc.com> wrote: >> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig >> index 420ff4bc67fd..9f55bcc51de1 100644 >> --- a/kernel/trace/Kconfig >> +++ b/kernel/trace/Kconfig >> @@ -95,6 +95,13 @@ config RING_BUFFER_ALLOW_SWAP >> Allow the use of ring_buffer_swap_cpu. >> Adds a very slight overhead to tracing when enabled. >> >> +config TRACE_MMIO_ACCESS >> + bool "Register read/write tracing" >> + depends on TRACING >> + help >> + Create tracepoints for MMIO read/write operations. These trace events >> + can be used for logging all MMIO read/write operations. > I think this needs a 'depends on ARCH_HAVE_TRACE_MMIO_ACCESS' > or similar. Sure, will add it. >> +void log_read_mmio(u8 width, const volatile void __iomem *addr) >> +{ >> + trace_rwmmio_read(CALLER_ADDR0, CALLER_ADDR1, width, addr); >> +} > Here, it may be better to pass the caller address as an argument, I think > CALLER_ADDR1 is not always reliable, though it's possible that it is > in the configurations when this file gets enabled. > > Do you mean that we use __builtin_return_address(0,1) directly here or that I pass __func__ as the argument to log_read/write_mmio or is there some other way to pass the caller address? Thanks, Sai ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 3/4] tracing: Add register read/write tracing support 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 11:52 ` kernel test robot 2021-12-06 16:39 ` kernel test robot 2 siblings, 0 replies; 25+ messages in thread From: kernel test robot @ 2021-12-06 11:52 UTC (permalink / raw) To: Sai Prakash Ranjan, Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier Cc: kbuild-all, gregkh, linux-kernel, linux-arm-kernel, linux-arm-msm, quic_psodagud Hi Sai, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on arm64/for-next/core] [also build test WARNING on rostedt-trace/for-next arnd-asm-generic/master v5.16-rc4 next-20211206] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Sai-Prakash-Ranjan/tracing-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20211206-163212 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20211206/202112061907.RvKTwMEo-lkp@intel.com/config) compiler: sh4-linux-gcc (GCC) 11.2.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/1b255eef866824f8925cc46d6b127d641f1c8982 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sai-Prakash-Ranjan/tracing-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20211206-163212 git checkout 1b255eef866824f8925cc46d6b127d641f1c8982 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash kernel/trace/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:31:21: note: previous declaration of 'ioread16be' with type 'unsigned int(const void *)' 31 | extern unsigned int ioread16be(const void __iomem *); | ^~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:785:20: error: conflicting types for 'ioread32be'; have 'u32(const volatile void *)' {aka 'unsigned int(const volatile void *)'} 785 | #define ioread32be ioread32be | ^~~~~~~~~~ include/asm-generic/io.h:786:19: note: in expansion of macro 'ioread32be' 786 | static inline u32 ioread32be(const volatile void __iomem *addr) | ^~~~~~~~~~ In file included from arch/sh/include/asm/io.h:22, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:33:21: note: previous declaration of 'ioread32be' with type 'unsigned int(const void *)' 33 | extern unsigned int ioread32be(const void __iomem *); | ^~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:803:21: error: conflicting types for 'iowrite16be'; have 'void(u16, volatile void *)' {aka 'void(short unsigned int, volatile void *)'} 803 | #define iowrite16be iowrite16be | ^~~~~~~~~~~ include/asm-generic/io.h:804:20: note: in expansion of macro 'iowrite16be' 804 | static inline void iowrite16be(u16 value, void volatile __iomem *addr) | ^~~~~~~~~~~ In file included from arch/sh/include/asm/io.h:22, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:52:13: note: previous declaration of 'iowrite16be' with type 'void(u16, void *)' {aka 'void(short unsigned int, void *)'} 52 | extern void iowrite16be(u16, void __iomem *); | ^~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:811:21: error: conflicting types for 'iowrite32be'; have 'void(u32, volatile void *)' {aka 'void(unsigned int, volatile void *)'} 811 | #define iowrite32be iowrite32be | ^~~~~~~~~~~ include/asm-generic/io.h:812:20: note: in expansion of macro 'iowrite32be' 812 | static inline void iowrite32be(u32 value, volatile void __iomem *addr) | ^~~~~~~~~~~ In file included from arch/sh/include/asm/io.h:22, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:54:13: note: previous declaration of 'iowrite32be' with type 'void(u32, void *)' {aka 'void(unsigned int, void *)'} 54 | extern void iowrite32be(u32, void __iomem *); | ^~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:829:21: error: conflicting types for 'ioread8_rep'; have 'void(const volatile void *, void *, unsigned int)' 829 | #define ioread8_rep ioread8_rep | ^~~~~~~~~~~ include/asm-generic/io.h:830:20: note: in expansion of macro 'ioread8_rep' 830 | static inline void ioread8_rep(const volatile void __iomem *addr, void *buffer, | ^~~~~~~~~~~ In file included from arch/sh/include/asm/io.h:22, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:82:13: note: previous declaration of 'ioread8_rep' with type 'void(const void *, void *, long unsigned int)' 82 | extern void ioread8_rep(const void __iomem *port, void *buf, unsigned long count); | ^~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/io.h: In function 'ioread8_rep': >> include/asm-generic/io.h:833:16: warning: passing argument 1 of '__raw_readsb' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 833 | readsb(addr, buffer, count); | ^~~~ arch/sh/include/asm/io.h:59:46: note: in definition of macro 'readsb' 59 | #define readsb(p,d,l) __raw_readsb(p,d,l) | ^ arch/sh/include/asm/io.h:103:60: note: expected 'volatile void *' but argument is of type 'const volatile void *' 103 | static inline void pfx##reads##bwlq(volatile void __iomem *mem, \ | ~~~~~~~~~~~~~~~~~~~~~~~^~~ arch/sh/include/asm/io.h:114:1: note: in expansion of macro '__BUILD_MEMORY_STRING' 114 | __BUILD_MEMORY_STRING(__raw_, b, u8) | ^~~~~~~~~~~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h: At top level: include/asm-generic/io.h:838:22: error: conflicting types for 'ioread16_rep'; have 'void(const volatile void *, void *, unsigned int)' 838 | #define ioread16_rep ioread16_rep | ^~~~~~~~~~~~ include/asm-generic/io.h:839:20: note: in expansion of macro 'ioread16_rep' 839 | static inline void ioread16_rep(const volatile void __iomem *addr, | ^~~~~~~~~~~~ In file included from arch/sh/include/asm/io.h:22, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:83:13: note: previous declaration of 'ioread16_rep' with type 'void(const void *, void *, long unsigned int)' 83 | extern void ioread16_rep(const void __iomem *port, void *buf, unsigned long count); | ^~~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/io.h: In function 'ioread16_rep': >> include/asm-generic/io.h:842:16: warning: passing argument 1 of '__raw_readsw' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 842 | readsw(addr, buffer, count); | ^~~~ arch/sh/include/asm/io.h:60:46: note: in definition of macro 'readsw' 60 | #define readsw(p,d,l) __raw_readsw(p,d,l) | ^ arch/sh/include/asm/io.h:103:60: note: expected 'volatile void *' but argument is of type 'const volatile void *' 103 | static inline void pfx##reads##bwlq(volatile void __iomem *mem, \ | ~~~~~~~~~~~~~~~~~~~~~~~^~~ arch/sh/include/asm/io.h:115:1: note: in expansion of macro '__BUILD_MEMORY_STRING' 115 | __BUILD_MEMORY_STRING(__raw_, w, u16) | ^~~~~~~~~~~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h: At top level: include/asm-generic/io.h:847:22: error: conflicting types for 'ioread32_rep'; have 'void(const volatile void *, void *, unsigned int)' 847 | #define ioread32_rep ioread32_rep | ^~~~~~~~~~~~ include/asm-generic/io.h:848:20: note: in expansion of macro 'ioread32_rep' 848 | static inline void ioread32_rep(const volatile void __iomem *addr, | ^~~~~~~~~~~~ In file included from arch/sh/include/asm/io.h:22, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:84:13: note: previous declaration of 'ioread32_rep' with type 'void(const void *, void *, long unsigned int)' 84 | extern void ioread32_rep(const void __iomem *port, void *buf, unsigned long count); | ^~~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/io.h: In function 'ioread32_rep': >> include/asm-generic/io.h:851:16: warning: passing argument 1 of '__raw_readsl' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers] 851 | readsl(addr, buffer, count); | ^~~~ arch/sh/include/asm/io.h:61:46: note: in definition of macro 'readsl' 61 | #define readsl(p,d,l) __raw_readsl(p,d,l) | ^ arch/sh/include/asm/io.h:118:39: note: expected 'const void *' but argument is of type 'const volatile void *' 118 | void __raw_readsl(const void __iomem *addr, void *data, int longlen); | ~~~~~~~~~~~~~~~~~~~~^~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h: At top level: include/asm-generic/io.h:867:22: error: conflicting types for 'iowrite8_rep'; have 'void(volatile void *, const void *, unsigned int)' 867 | #define iowrite8_rep iowrite8_rep | ^~~~~~~~~~~~ include/asm-generic/io.h:868:20: note: in expansion of macro 'iowrite8_rep' 868 | static inline void iowrite8_rep(volatile void __iomem *addr, | ^~~~~~~~~~~~ In file included from arch/sh/include/asm/io.h:22, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:86:13: note: previous declaration of 'iowrite8_rep' with type 'void(void *, const void *, long unsigned int)' 86 | extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); | ^~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:877:23: error: conflicting types for 'iowrite16_rep'; have 'void(volatile void *, const void *, unsigned int)' 877 | #define iowrite16_rep iowrite16_rep | ^~~~~~~~~~~~~ include/asm-generic/io.h:878:20: note: in expansion of macro 'iowrite16_rep' 878 | static inline void iowrite16_rep(volatile void __iomem *addr, | ^~~~~~~~~~~~~ In file included from arch/sh/include/asm/io.h:22, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:87:13: note: previous declaration of 'iowrite16_rep' with type 'void(void *, const void *, long unsigned int)' 87 | extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); | ^~~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:887:23: error: conflicting types for 'iowrite32_rep'; have 'void(volatile void *, const void *, unsigned int)' 887 | #define iowrite32_rep iowrite32_rep | ^~~~~~~~~~~~~ include/asm-generic/io.h:888:20: note: in expansion of macro 'iowrite32_rep' 888 | static inline void iowrite32_rep(volatile void __iomem *addr, | ^~~~~~~~~~~~~ In file included from arch/sh/include/asm/io.h:22, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:88:13: note: previous declaration of 'iowrite32_rep' with type 'void(void *, const void *, long unsigned int)' 88 | extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); | ^~~~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/io.h: In function 'iowrite32_rep': >> include/asm-generic/io.h:892:17: warning: passing argument 1 of '__raw_writesl' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers] 892 | writesl(addr, buffer, count); | ^~~~ arch/sh/include/asm/io.h:65:47: note: in definition of macro 'writesl' 65 | #define writesl(p,d,l) __raw_writesl(p,d,l) | ^ arch/sh/include/asm/io.h:117:34: note: expected 'void *' but argument is of type 'volatile void *' 117 | void __raw_writesl(void __iomem *addr, const void *data, int longlen); | ~~~~~~~~~~~~~~^~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h: At top level: include/asm-generic/io.h:1077:19: error: conflicting types for 'memset_io'; have 'void(volatile void *, int, size_t)' {aka 'void(volatile void *, int, unsigned int)'} 1077 | #define memset_io memset_io | ^~~~~~~~~ include/asm-generic/io.h:1086:20: note: in expansion of macro 'memset_io' 1086 | static inline void memset_io(volatile void __iomem *addr, int value, | ^~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/sh/include/asm/io.h:230:6: note: previous declaration of 'memset_io' with type 'void(volatile void *, int, long unsigned int)' 230 | void memset_io(volatile void __iomem *, int, unsigned long); | ^~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:1094:23: error: conflicting types for 'memcpy_fromio'; have 'void(void *, const volatile void *, size_t)' {aka 'void(void *, const volatile void *, unsigned int)'} 1094 | #define memcpy_fromio memcpy_fromio | ^~~~~~~~~~~~~ include/asm-generic/io.h:1103:20: note: in expansion of macro 'memcpy_fromio' 1103 | static inline void memcpy_fromio(void *buffer, | ^~~~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/sh/include/asm/io.h:228:6: note: previous declaration of 'memcpy_fromio' with type 'void(void *, const volatile void *, long unsigned int)' 228 | void memcpy_fromio(void *, const volatile void __iomem *, unsigned long); | ^~~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:1112:21: error: conflicting types for 'memcpy_toio'; have 'void(volatile void *, const void *, size_t)' {aka 'void(volatile void *, const void *, unsigned int)'} 1112 | #define memcpy_toio memcpy_toio | ^~~~~~~~~~~ include/asm-generic/io.h:1121:20: note: in expansion of macro 'memcpy_toio' 1121 | static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer, | ^~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/sh/include/asm/io.h:229:6: note: previous declaration of 'memcpy_toio' with type 'void(volatile void *, const void *, long unsigned int)' 229 | void memcpy_toio(volatile void __iomem *, const void *, unsigned long); | ^~~~~~~~~~~ kernel/trace/trace_readwrite.c:16:6: warning: no previous prototype for 'log_write_mmio' [-Wmissing-prototypes] 16 | void log_write_mmio(u64 val, u8 width, volatile void __iomem *addr) | ^~~~~~~~~~~~~~ kernel/trace/trace_readwrite.c:23:6: warning: no previous prototype for 'log_read_mmio' [-Wmissing-prototypes] 23 | void log_read_mmio(u8 width, const volatile void __iomem *addr) | ^~~~~~~~~~~~~ vim +833 include/asm-generic/io.h 9e44fb1816dba8 Horia Geantă 2016-05-19 827 9ab3a7a0d2b417 Thierry Reding 2014-07-04 828 #ifndef ioread8_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 829 #define ioread8_rep ioread8_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 830 static inline void ioread8_rep(const volatile void __iomem *addr, void *buffer, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 831 unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 832 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @833 readsb(addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 834 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 835 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 836 9ab3a7a0d2b417 Thierry Reding 2014-07-04 837 #ifndef ioread16_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 838 #define ioread16_rep ioread16_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 839 static inline void ioread16_rep(const volatile void __iomem *addr, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 840 void *buffer, unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 841 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @842 readsw(addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 843 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 844 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 845 9ab3a7a0d2b417 Thierry Reding 2014-07-04 846 #ifndef ioread32_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 847 #define ioread32_rep ioread32_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 848 static inline void ioread32_rep(const volatile void __iomem *addr, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 849 void *buffer, unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 850 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @851 readsl(addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 852 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 853 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 854 9e44fb1816dba8 Horia Geantă 2016-05-19 855 #ifdef CONFIG_64BIT 9e44fb1816dba8 Horia Geantă 2016-05-19 856 #ifndef ioread64_rep 9e44fb1816dba8 Horia Geantă 2016-05-19 857 #define ioread64_rep ioread64_rep 9e44fb1816dba8 Horia Geantă 2016-05-19 858 static inline void ioread64_rep(const volatile void __iomem *addr, 9e44fb1816dba8 Horia Geantă 2016-05-19 859 void *buffer, unsigned int count) 9e44fb1816dba8 Horia Geantă 2016-05-19 860 { 9e44fb1816dba8 Horia Geantă 2016-05-19 861 readsq(addr, buffer, count); 9e44fb1816dba8 Horia Geantă 2016-05-19 862 } 9e44fb1816dba8 Horia Geantă 2016-05-19 863 #endif 9e44fb1816dba8 Horia Geantă 2016-05-19 864 #endif /* CONFIG_64BIT */ 9e44fb1816dba8 Horia Geantă 2016-05-19 865 9ab3a7a0d2b417 Thierry Reding 2014-07-04 866 #ifndef iowrite8_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 867 #define iowrite8_rep iowrite8_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 868 static inline void iowrite8_rep(volatile void __iomem *addr, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 869 const void *buffer, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 870 unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 871 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 872 writesb(addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 873 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 874 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 875 9ab3a7a0d2b417 Thierry Reding 2014-07-04 876 #ifndef iowrite16_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 877 #define iowrite16_rep iowrite16_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 878 static inline void iowrite16_rep(volatile void __iomem *addr, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 879 const void *buffer, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 880 unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 881 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 882 writesw(addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 883 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 884 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 885 9ab3a7a0d2b417 Thierry Reding 2014-07-04 886 #ifndef iowrite32_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 887 #define iowrite32_rep iowrite32_rep 9ab3a7a0d2b417 Thierry Reding 2014-07-04 888 static inline void iowrite32_rep(volatile void __iomem *addr, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 889 const void *buffer, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 890 unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 891 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @892 writesl(addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 893 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 894 #endif 9e44fb1816dba8 Horia Geantă 2016-05-19 895 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 3/4] tracing: Add register read/write tracing support 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 11:52 ` kernel test robot @ 2021-12-06 16:39 ` kernel test robot 2 siblings, 0 replies; 25+ messages in thread From: kernel test robot @ 2021-12-06 16:39 UTC (permalink / raw) To: Sai Prakash Ranjan, Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier Cc: kbuild-all, gregkh, linux-kernel, linux-arm-kernel, linux-arm-msm, quic_psodagud Hi Sai, Thank you for the patch! Yet something to improve: [auto build test ERROR on arm64/for-next/core] [also build test ERROR on rostedt-trace/for-next arnd-asm-generic/master v5.16-rc4 next-20211206] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Sai-Prakash-Ranjan/tracing-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20211206-163212 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core config: parisc-allyesconfig (https://download.01.org/0day-ci/archive/20211207/202112070036.AVohI56z-lkp@intel.com/config) compiler: hppa-linux-gcc (GCC) 11.2.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/1b255eef866824f8925cc46d6b127d641f1c8982 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sai-Prakash-Ranjan/tracing-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20211206-163212 git checkout 1b255eef866824f8925cc46d6b127d641f1c8982 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=parisc SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from kernel/trace/trace_readwrite.c:10: >> include/asm-generic/io.h:74:21: error: redefinition of '__raw_readb' 74 | #define __raw_readb __raw_readb | ^~~~~~~~~~~ include/asm-generic/io.h:75:18: note: in expansion of macro '__raw_readb' 75 | static inline u8 __raw_readb(const volatile void __iomem *addr) | ^~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:136:29: note: previous definition of '__raw_readb' with type 'unsigned char(const volatile void *)' 136 | static inline unsigned char __raw_readb(const volatile void __iomem *addr) | ^~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: >> include/asm-generic/io.h:82:21: error: redefinition of '__raw_readw' 82 | #define __raw_readw __raw_readw | ^~~~~~~~~~~ include/asm-generic/io.h:83:19: note: in expansion of macro '__raw_readw' 83 | static inline u16 __raw_readw(const volatile void __iomem *addr) | ^~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:140:30: note: previous definition of '__raw_readw' with type 'short unsigned int(const volatile void *)' 140 | static inline unsigned short __raw_readw(const volatile void __iomem *addr) | ^~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: >> include/asm-generic/io.h:90:21: error: redefinition of '__raw_readl' 90 | #define __raw_readl __raw_readl | ^~~~~~~~~~~ include/asm-generic/io.h:91:19: note: in expansion of macro '__raw_readl' 91 | static inline u32 __raw_readl(const volatile void __iomem *addr) | ^~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:144:28: note: previous definition of '__raw_readl' with type 'unsigned int(const volatile void *)' 144 | static inline unsigned int __raw_readl(const volatile void __iomem *addr) | ^~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: >> include/asm-generic/io.h:108:22: error: redefinition of '__raw_writeb' 108 | #define __raw_writeb __raw_writeb | ^~~~~~~~~~~~ include/asm-generic/io.h:109:20: note: in expansion of macro '__raw_writeb' 109 | static inline void __raw_writeb(u8 value, volatile void __iomem *addr) | ^~~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:153:20: note: previous definition of '__raw_writeb' with type 'void(unsigned char, volatile void *)' 153 | static inline void __raw_writeb(unsigned char b, volatile void __iomem *addr) | ^~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: >> include/asm-generic/io.h:116:22: error: redefinition of '__raw_writew' 116 | #define __raw_writew __raw_writew | ^~~~~~~~~~~~ include/asm-generic/io.h:117:20: note: in expansion of macro '__raw_writew' 117 | static inline void __raw_writew(u16 value, volatile void __iomem *addr) | ^~~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:157:20: note: previous definition of '__raw_writew' with type 'void(short unsigned int, volatile void *)' 157 | static inline void __raw_writew(unsigned short b, volatile void __iomem *addr) | ^~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: >> include/asm-generic/io.h:124:22: error: redefinition of '__raw_writel' 124 | #define __raw_writel __raw_writel | ^~~~~~~~~~~~ include/asm-generic/io.h:125:20: note: in expansion of macro '__raw_writel' 125 | static inline void __raw_writel(u32 value, volatile void __iomem *addr) | ^~~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:161:20: note: previous definition of '__raw_writel' with type 'void(unsigned int, volatile void *)' 161 | static inline void __raw_writel(unsigned int b, volatile void __iomem *addr) | ^~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:606:14: error: conflicting types for 'insb'; have 'void(long unsigned int, void *, unsigned int)' 606 | #define insb insb | ^~~~ include/asm-generic/io.h:607:20: note: in expansion of macro 'insb' 607 | static inline void insb(unsigned long addr, void *buffer, unsigned int count) | ^~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:284:13: note: previous declaration of 'insb' with type 'void(long unsigned int, void *, long unsigned int)' 284 | extern void insb (unsigned long port, void *dst, unsigned long count); | ^~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:614:14: error: conflicting types for 'insw'; have 'void(long unsigned int, void *, unsigned int)' 614 | #define insw insw | ^~~~ include/asm-generic/io.h:615:20: note: in expansion of macro 'insw' 615 | static inline void insw(unsigned long addr, void *buffer, unsigned int count) | ^~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:285:13: note: previous declaration of 'insw' with type 'void(long unsigned int, void *, long unsigned int)' 285 | extern void insw (unsigned long port, void *dst, unsigned long count); | ^~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:622:14: error: conflicting types for 'insl'; have 'void(long unsigned int, void *, unsigned int)' 622 | #define insl insl | ^~~~ include/asm-generic/io.h:623:20: note: in expansion of macro 'insl' 623 | static inline void insl(unsigned long addr, void *buffer, unsigned int count) | ^~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:286:13: note: previous declaration of 'insl' with type 'void(long unsigned int, void *, long unsigned int)' 286 | extern void insl (unsigned long port, void *dst, unsigned long count); | ^~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:630:15: error: conflicting types for 'outsb'; have 'void(long unsigned int, const void *, unsigned int)' 630 | #define outsb outsb | ^~~~~ include/asm-generic/io.h:631:20: note: in expansion of macro 'outsb' 631 | static inline void outsb(unsigned long addr, const void *buffer, | ^~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:287:13: note: previous declaration of 'outsb' with type 'void(long unsigned int, const void *, long unsigned int)' 287 | extern void outsb (unsigned long port, const void *src, unsigned long count); | ^~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:639:15: error: conflicting types for 'outsw'; have 'void(long unsigned int, const void *, unsigned int)' 639 | #define outsw outsw | ^~~~~ include/asm-generic/io.h:640:20: note: in expansion of macro 'outsw' 640 | static inline void outsw(unsigned long addr, const void *buffer, | ^~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, -- from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:82:13: note: previous declaration of 'ioread8_rep' with type 'void(const void *, void *, long unsigned int)' 82 | extern void ioread8_rep(const void __iomem *port, void *buf, unsigned long count); | ^~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:838:22: error: conflicting types for 'ioread16_rep'; have 'void(const volatile void *, void *, unsigned int)' 838 | #define ioread16_rep ioread16_rep | ^~~~~~~~~~~~ include/asm-generic/io.h:839:20: note: in expansion of macro 'ioread16_rep' 839 | static inline void ioread16_rep(const volatile void __iomem *addr, | ^~~~~~~~~~~~ In file included from arch/parisc/include/asm/io.h:311, from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:83:13: note: previous declaration of 'ioread16_rep' with type 'void(const void *, void *, long unsigned int)' 83 | extern void ioread16_rep(const void __iomem *port, void *buf, unsigned long count); | ^~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:847:22: error: conflicting types for 'ioread32_rep'; have 'void(const volatile void *, void *, unsigned int)' 847 | #define ioread32_rep ioread32_rep | ^~~~~~~~~~~~ include/asm-generic/io.h:848:20: note: in expansion of macro 'ioread32_rep' 848 | static inline void ioread32_rep(const volatile void __iomem *addr, | ^~~~~~~~~~~~ In file included from arch/parisc/include/asm/io.h:311, from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:84:13: note: previous declaration of 'ioread32_rep' with type 'void(const void *, void *, long unsigned int)' 84 | extern void ioread32_rep(const void __iomem *port, void *buf, unsigned long count); | ^~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:867:22: error: conflicting types for 'iowrite8_rep'; have 'void(volatile void *, const void *, unsigned int)' 867 | #define iowrite8_rep iowrite8_rep | ^~~~~~~~~~~~ include/asm-generic/io.h:868:20: note: in expansion of macro 'iowrite8_rep' 868 | static inline void iowrite8_rep(volatile void __iomem *addr, | ^~~~~~~~~~~~ In file included from arch/parisc/include/asm/io.h:311, from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:86:13: note: previous declaration of 'iowrite8_rep' with type 'void(void *, const void *, long unsigned int)' 86 | extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); | ^~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:877:23: error: conflicting types for 'iowrite16_rep'; have 'void(volatile void *, const void *, unsigned int)' 877 | #define iowrite16_rep iowrite16_rep | ^~~~~~~~~~~~~ include/asm-generic/io.h:878:20: note: in expansion of macro 'iowrite16_rep' 878 | static inline void iowrite16_rep(volatile void __iomem *addr, | ^~~~~~~~~~~~~ In file included from arch/parisc/include/asm/io.h:311, from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:87:13: note: previous declaration of 'iowrite16_rep' with type 'void(void *, const void *, long unsigned int)' 87 | extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); | ^~~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:887:23: error: conflicting types for 'iowrite32_rep'; have 'void(volatile void *, const void *, unsigned int)' 887 | #define iowrite32_rep iowrite32_rep | ^~~~~~~~~~~~~ include/asm-generic/io.h:888:20: note: in expansion of macro 'iowrite32_rep' 888 | static inline void iowrite32_rep(volatile void __iomem *addr, | ^~~~~~~~~~~~~ In file included from arch/parisc/include/asm/io.h:311, from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:88:13: note: previous declaration of 'iowrite32_rep' with type 'void(void *, const void *, long unsigned int)' 88 | extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); | ^~~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: >> include/asm-generic/io.h:1020:20: error: static declaration of 'ioport_map' follows non-static declaration 1020 | #define ioport_map ioport_map | ^~~~~~~~~~ include/asm-generic/io.h:1021:29: note: in expansion of macro 'ioport_map' 1021 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) | ^~~~~~~~~~ In file included from arch/parisc/include/asm/io.h:311, from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:92:22: note: previous declaration of 'ioport_map' with type 'void *(long unsigned int, unsigned int)' 92 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); | ^~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: >> include/asm-generic/io.h:1030:22: error: static declaration of 'ioport_unmap' follows non-static declaration 1030 | #define ioport_unmap ioport_unmap | ^~~~~~~~~~~~ include/asm-generic/io.h:1031:20: note: in expansion of macro 'ioport_unmap' 1031 | static inline void ioport_unmap(void __iomem *p) | ^~~~~~~~~~~~ In file included from arch/parisc/include/asm/io.h:311, from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: include/asm-generic/iomap.h:93:13: note: previous declaration of 'ioport_unmap' with type 'void(void *)' 93 | extern void ioport_unmap(void __iomem *); | ^~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:1077:19: error: conflicting types for 'memset_io'; have 'void(volatile void *, int, size_t)' {aka 'void(volatile void *, int, unsigned int)'} 1077 | #define memset_io memset_io | ^~~~~~~~~ include/asm-generic/io.h:1086:20: note: in expansion of macro 'memset_io' 1086 | static inline void memset_io(volatile void __iomem *addr, int value, | ^~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:222:6: note: previous declaration of 'memset_io' with type 'void(volatile void *, unsigned char, int)' 222 | void memset_io(volatile void __iomem *addr, unsigned char val, int count); | ^~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:1094:23: error: conflicting types for 'memcpy_fromio'; have 'void(void *, const volatile void *, size_t)' {aka 'void(void *, const volatile void *, unsigned int)'} 1094 | #define memcpy_fromio memcpy_fromio | ^~~~~~~~~~~~~ include/asm-generic/io.h:1103:20: note: in expansion of macro 'memcpy_fromio' 1103 | static inline void memcpy_fromio(void *buffer, | ^~~~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:223:6: note: previous declaration of 'memcpy_fromio' with type 'void(void *, const volatile void *, int)' 223 | void memcpy_fromio(void *dst, const volatile void __iomem *src, int count); | ^~~~~~~~~~~~~ In file included from kernel/trace/trace_readwrite.c:10: include/asm-generic/io.h:1112:21: error: conflicting types for 'memcpy_toio'; have 'void(volatile void *, const void *, size_t)' {aka 'void(volatile void *, const void *, unsigned int)'} 1112 | #define memcpy_toio memcpy_toio | ^~~~~~~~~~~ include/asm-generic/io.h:1121:20: note: in expansion of macro 'memcpy_toio' 1121 | static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer, | ^~~~~~~~~~~ In file included from include/linux/io.h:13, from include/linux/irq.h:20, from arch/parisc/include/asm/hardirq.h:13, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/trace_recursion.h:5, from include/linux/ftrace.h:10, from kernel/trace/trace_readwrite.c:8: arch/parisc/include/asm/io.h:224:6: note: previous declaration of 'memcpy_toio' with type 'void(volatile void *, const void *, int)' 224 | void memcpy_toio(volatile void __iomem *dst, const void *src, int count); | ^~~~~~~~~~~ kernel/trace/trace_readwrite.c:16:6: warning: no previous prototype for 'log_write_mmio' [-Wmissing-prototypes] 16 | void log_write_mmio(u64 val, u8 width, volatile void __iomem *addr) | ^~~~~~~~~~~~~~ kernel/trace/trace_readwrite.c:23:6: warning: no previous prototype for 'log_read_mmio' [-Wmissing-prototypes] 23 | void log_read_mmio(u8 width, const volatile void __iomem *addr) | ^~~~~~~~~~~~~ vim +/__raw_readb +74 include/asm-generic/io.h 64e2c6738b4d49 Sinan Kaya 2018-04-05 63 64e2c6738b4d49 Sinan Kaya 2018-04-05 64 3f7e212df82ca0 Arnd Bergmann 2009-05-13 65 /* 9216efafc52ff9 Thierry Reding 2014-10-01 66 * __raw_{read,write}{b,w,l,q}() access memory in native endianness. 9216efafc52ff9 Thierry Reding 2014-10-01 67 * 9216efafc52ff9 Thierry Reding 2014-10-01 68 * On some architectures memory mapped IO needs to be accessed differently. 9216efafc52ff9 Thierry Reding 2014-10-01 69 * On the simple architectures, we just read/write the memory location 9216efafc52ff9 Thierry Reding 2014-10-01 70 * directly. 3f7e212df82ca0 Arnd Bergmann 2009-05-13 71 */ 9216efafc52ff9 Thierry Reding 2014-10-01 72 35dbc0e020c658 Mike Frysinger 2010-10-18 73 #ifndef __raw_readb 9216efafc52ff9 Thierry Reding 2014-10-01 @74 #define __raw_readb __raw_readb 3f7e212df82ca0 Arnd Bergmann 2009-05-13 75 static inline u8 __raw_readb(const volatile void __iomem *addr) 3f7e212df82ca0 Arnd Bergmann 2009-05-13 76 { 3f7e212df82ca0 Arnd Bergmann 2009-05-13 77 return *(const volatile u8 __force *)addr; 3f7e212df82ca0 Arnd Bergmann 2009-05-13 78 } 35dbc0e020c658 Mike Frysinger 2010-10-18 79 #endif 3f7e212df82ca0 Arnd Bergmann 2009-05-13 80 35dbc0e020c658 Mike Frysinger 2010-10-18 81 #ifndef __raw_readw 9216efafc52ff9 Thierry Reding 2014-10-01 @82 #define __raw_readw __raw_readw 3f7e212df82ca0 Arnd Bergmann 2009-05-13 83 static inline u16 __raw_readw(const volatile void __iomem *addr) 3f7e212df82ca0 Arnd Bergmann 2009-05-13 84 { 3f7e212df82ca0 Arnd Bergmann 2009-05-13 85 return *(const volatile u16 __force *)addr; 3f7e212df82ca0 Arnd Bergmann 2009-05-13 86 } 35dbc0e020c658 Mike Frysinger 2010-10-18 87 #endif 3f7e212df82ca0 Arnd Bergmann 2009-05-13 88 35dbc0e020c658 Mike Frysinger 2010-10-18 89 #ifndef __raw_readl 9216efafc52ff9 Thierry Reding 2014-10-01 @90 #define __raw_readl __raw_readl 3f7e212df82ca0 Arnd Bergmann 2009-05-13 91 static inline u32 __raw_readl(const volatile void __iomem *addr) 3f7e212df82ca0 Arnd Bergmann 2009-05-13 92 { 3f7e212df82ca0 Arnd Bergmann 2009-05-13 93 return *(const volatile u32 __force *)addr; 3f7e212df82ca0 Arnd Bergmann 2009-05-13 94 } 35dbc0e020c658 Mike Frysinger 2010-10-18 95 #endif 3f7e212df82ca0 Arnd Bergmann 2009-05-13 96 9216efafc52ff9 Thierry Reding 2014-10-01 97 #ifdef CONFIG_64BIT 9216efafc52ff9 Thierry Reding 2014-10-01 98 #ifndef __raw_readq 9216efafc52ff9 Thierry Reding 2014-10-01 99 #define __raw_readq __raw_readq 9216efafc52ff9 Thierry Reding 2014-10-01 100 static inline u64 __raw_readq(const volatile void __iomem *addr) 7292e7e01cc98f Heiko Carstens 2013-01-07 101 { 9216efafc52ff9 Thierry Reding 2014-10-01 102 return *(const volatile u64 __force *)addr; 7292e7e01cc98f Heiko Carstens 2013-01-07 103 } 9216efafc52ff9 Thierry Reding 2014-10-01 104 #endif 9216efafc52ff9 Thierry Reding 2014-10-01 105 #endif /* CONFIG_64BIT */ 3f7e212df82ca0 Arnd Bergmann 2009-05-13 106 35dbc0e020c658 Mike Frysinger 2010-10-18 107 #ifndef __raw_writeb 9216efafc52ff9 Thierry Reding 2014-10-01 @108 #define __raw_writeb __raw_writeb 9216efafc52ff9 Thierry Reding 2014-10-01 109 static inline void __raw_writeb(u8 value, volatile void __iomem *addr) 3f7e212df82ca0 Arnd Bergmann 2009-05-13 110 { 9216efafc52ff9 Thierry Reding 2014-10-01 111 *(volatile u8 __force *)addr = value; 3f7e212df82ca0 Arnd Bergmann 2009-05-13 112 } 35dbc0e020c658 Mike Frysinger 2010-10-18 113 #endif 3f7e212df82ca0 Arnd Bergmann 2009-05-13 114 35dbc0e020c658 Mike Frysinger 2010-10-18 115 #ifndef __raw_writew 9216efafc52ff9 Thierry Reding 2014-10-01 @116 #define __raw_writew __raw_writew 9216efafc52ff9 Thierry Reding 2014-10-01 117 static inline void __raw_writew(u16 value, volatile void __iomem *addr) 3f7e212df82ca0 Arnd Bergmann 2009-05-13 118 { 9216efafc52ff9 Thierry Reding 2014-10-01 119 *(volatile u16 __force *)addr = value; 3f7e212df82ca0 Arnd Bergmann 2009-05-13 120 } 35dbc0e020c658 Mike Frysinger 2010-10-18 121 #endif 3f7e212df82ca0 Arnd Bergmann 2009-05-13 122 35dbc0e020c658 Mike Frysinger 2010-10-18 123 #ifndef __raw_writel 9216efafc52ff9 Thierry Reding 2014-10-01 @124 #define __raw_writel __raw_writel 9216efafc52ff9 Thierry Reding 2014-10-01 125 static inline void __raw_writel(u32 value, volatile void __iomem *addr) 3f7e212df82ca0 Arnd Bergmann 2009-05-13 126 { 9216efafc52ff9 Thierry Reding 2014-10-01 127 *(volatile u32 __force *)addr = value; 3f7e212df82ca0 Arnd Bergmann 2009-05-13 128 } 35dbc0e020c658 Mike Frysinger 2010-10-18 129 #endif 3f7e212df82ca0 Arnd Bergmann 2009-05-13 130 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCHv5 4/4] asm-generic/io: Add logging support for MMIO accessors 2021-12-06 8:28 [PATCHv5 0/4] tracing/rwmmio/arm64: Add support to trace register reads/writes Sai Prakash Ranjan ` (2 preceding siblings ...) 2021-12-06 8:28 ` [PATCHv5 3/4] tracing: Add register read/write tracing support Sai Prakash Ranjan @ 2021-12-06 8:28 ` Sai Prakash Ranjan 2021-12-06 9:09 ` Arnd Bergmann 3 siblings, 1 reply; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 8:28 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier Cc: gregkh, linux-kernel, linux-arm-kernel, linux-arm-msm, quic_psodagud, Sai Prakash Ranjan Add logging support for MMIO high level accessors such as read{b,w,l,q} and their relaxed versions to aid in debugging unexpected crashes/hangs caused by the corresponding MMIO operation. Also add a generic flag (__DISABLE_TRACE_MMIO__) which is used to disable MMIO tracing in nVHE KVM and if required can be used to disable MMIO tracing for specific drivers. Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com> --- arch/arm64/kvm/hyp/nvhe/Makefile | 7 ++++- include/asm-generic/io.h | 49 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile index c3c11974fa3b..2765ec38a269 100644 --- a/arch/arm64/kvm/hyp/nvhe/Makefile +++ b/arch/arm64/kvm/hyp/nvhe/Makefile @@ -4,7 +4,12 @@ # asflags-y := -D__KVM_NVHE_HYPERVISOR__ -D__DISABLE_EXPORTS -ccflags-y := -D__KVM_NVHE_HYPERVISOR__ -D__DISABLE_EXPORTS + +# Tracepoint and MMIO logging symbols should not be visible at nVHE KVM as +# there is no way to execute them and any such MMIO access from nVHE KVM +# will explode instantly (Words of Marc Zyngier). So introduce a generic flag +# __DISABLE_TRACE_MMIO__ to disable MMIO tracing for nVHE KVM. +ccflags-y := -D__KVM_NVHE_HYPERVISOR__ -D__DISABLE_EXPORTS -D__DISABLE_TRACE_MMIO__ hostprogs := gen-hyprel HOST_EXTRACFLAGS += -I$(objtree)/include diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 7ce93aaf69f8..dd5a803c8479 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -61,6 +61,23 @@ #define __io_par(v) __io_ar(v) #endif +#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); @@ -162,6 +181,8 @@ static inline u16 readw(const volatile void __iomem *addr) { u16 val; + if (rwmmio_tracepoint_active(rwmmio_read)) + log_read_mmio(16, addr); __io_br(); val = __le16_to_cpu((__le16 __force)__raw_readw(addr)); __io_ar(val); @@ -175,6 +196,8 @@ static inline u32 readl(const volatile void __iomem *addr) { u32 val; + if (rwmmio_tracepoint_active(rwmmio_read)) + log_read_mmio(32, addr); __io_br(); val = __le32_to_cpu((__le32 __force)__raw_readl(addr)); __io_ar(val); @@ -189,6 +212,8 @@ static inline u64 readq(const volatile void __iomem *addr) { u64 val; + if (rwmmio_tracepoint_active(rwmmio_read)) + log_read_mmio(64, addr); __io_br(); val = __le64_to_cpu(__raw_readq(addr)); __io_ar(val); @@ -201,6 +226,8 @@ static inline u64 readq(const volatile void __iomem *addr) #define writeb writeb static inline void writeb(u8 value, volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_write)) + log_write_mmio(value, 8, addr); __io_bw(); __raw_writeb(value, addr); __io_aw(); @@ -211,6 +238,8 @@ static inline void writeb(u8 value, volatile void __iomem *addr) #define writew writew static inline void writew(u16 value, volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_write)) + log_write_mmio(value, 16, addr); __io_bw(); __raw_writew((u16 __force)cpu_to_le16(value), addr); __io_aw(); @@ -221,6 +250,8 @@ static inline void writew(u16 value, volatile void __iomem *addr) #define writel writel static inline void writel(u32 value, volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_write)) + log_write_mmio(value, 32, addr); __io_bw(); __raw_writel((u32 __force)__cpu_to_le32(value), addr); __io_aw(); @@ -232,6 +263,8 @@ static inline void writel(u32 value, volatile void __iomem *addr) #define writeq writeq static inline void writeq(u64 value, volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_write)) + log_write_mmio(value, 64, addr); __io_bw(); __raw_writeq(__cpu_to_le64(value), addr); __io_aw(); @@ -248,6 +281,8 @@ static inline void writeq(u64 value, volatile void __iomem *addr) #define readb_relaxed readb_relaxed static inline u8 readb_relaxed(const volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_read)) + log_read_mmio(8, addr); return __raw_readb(addr); } #endif @@ -256,6 +291,8 @@ static inline u8 readb_relaxed(const volatile void __iomem *addr) #define readw_relaxed readw_relaxed static inline u16 readw_relaxed(const volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_read)) + log_read_mmio(16, addr); return __le16_to_cpu(__raw_readw(addr)); } #endif @@ -264,6 +301,8 @@ static inline u16 readw_relaxed(const volatile void __iomem *addr) #define readl_relaxed readl_relaxed static inline u32 readl_relaxed(const volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_read)) + log_read_mmio(32, addr); return __le32_to_cpu(__raw_readl(addr)); } #endif @@ -272,6 +311,8 @@ static inline u32 readl_relaxed(const volatile void __iomem *addr) #define readq_relaxed readq_relaxed static inline u64 readq_relaxed(const volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_read)) + log_read_mmio(64, addr); return __le64_to_cpu(__raw_readq(addr)); } #endif @@ -280,6 +321,8 @@ static inline u64 readq_relaxed(const volatile void __iomem *addr) #define writeb_relaxed writeb_relaxed static inline void writeb_relaxed(u8 value, volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_write)) + log_write_mmio(value, 8, addr); __raw_writeb(value, addr); } #endif @@ -288,6 +331,8 @@ static inline void writeb_relaxed(u8 value, volatile void __iomem *addr) #define writew_relaxed writew_relaxed static inline void writew_relaxed(u16 value, volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_write)) + log_write_mmio(value, 16, addr); __raw_writew(cpu_to_le16(value), addr); } #endif @@ -296,6 +341,8 @@ static inline void writew_relaxed(u16 value, volatile void __iomem *addr) #define writel_relaxed writel_relaxed static inline void writel_relaxed(u32 value, volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_write)) + log_write_mmio(value, 32, addr); __raw_writel(__cpu_to_le32(value), addr); } #endif @@ -304,6 +351,8 @@ static inline void writel_relaxed(u32 value, volatile void __iomem *addr) #define writeq_relaxed writeq_relaxed static inline void writeq_relaxed(u64 value, volatile void __iomem *addr) { + if (rwmmio_tracepoint_active(rwmmio_write)) + log_write_mmio(value, 64, addr); __raw_writeq(__cpu_to_le64(value), addr); } #endif -- 2.33.1 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCHv5 4/4] asm-generic/io: Add logging support for MMIO accessors 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 0 siblings, 1 reply; 25+ messages in thread From: Arnd Bergmann @ 2021-12-06 9:09 UTC (permalink / raw) To: Sai Prakash Ranjan Cc: Will Deacon, Catalin Marinas, Arnd Bergmann, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud 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. 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. Arnd ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 4/4] asm-generic/io: Add logging support for MMIO accessors 2021-12-06 9:09 ` Arnd Bergmann @ 2021-12-06 9:52 ` Sai Prakash Ranjan 2021-12-06 10:01 ` Arnd Bergmann 0 siblings, 1 reply; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 9:52 UTC (permalink / raw) To: Arnd Bergmann Cc: Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud 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 ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 4/4] asm-generic/io: Add logging support for MMIO accessors 2021-12-06 9:52 ` Sai Prakash Ranjan @ 2021-12-06 10:01 ` Arnd Bergmann 2021-12-06 10:20 ` Sai Prakash Ranjan 0 siblings, 1 reply; 25+ messages in thread From: Arnd Bergmann @ 2021-12-06 10:01 UTC (permalink / raw) To: Sai Prakash Ranjan Cc: Arnd Bergmann, Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud On Mon, Dec 6, 2021 at 10:52 AM Sai Prakash Ranjan <quic_saipraka@quicinc.com> wrote: > > 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. Are there any downsides to tracing both before and after, besides another growth in binary size? Aside from the 'value', that would also allow measuring the time it takes to complete a readl(), which may be valuable for other users as these can be significant. Not sure how to best do that that, we could return a timestamp from the 'before' tracepoint and pass it into the 'after' tracepoint in order to log the difference, or just rely on calculating the differences in user space based on the log. For the 'write' style accessors, the timing data would be less interesting, at least for posted PCI transactions, but it may be helpful to do the same for symmetry reasons. Arnd ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCHv5 4/4] asm-generic/io: Add logging support for MMIO accessors 2021-12-06 10:01 ` Arnd Bergmann @ 2021-12-06 10:20 ` Sai Prakash Ranjan 0 siblings, 0 replies; 25+ messages in thread From: Sai Prakash Ranjan @ 2021-12-06 10:20 UTC (permalink / raw) To: Arnd Bergmann Cc: Will Deacon, Catalin Marinas, Steven Rostedt, Marc Zyngier, gregkh, Linux Kernel Mailing List, Linux ARM, linux-arm-msm, quic_psodagud On 12/6/2021 3:31 PM, Arnd Bergmann wrote: > On Mon, Dec 6, 2021 at 10:52 AM Sai Prakash Ranjan > <quic_saipraka@quicinc.com> wrote: >> 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. > Are there any downsides to tracing both before and after, besides another growth > in binary size? Aside from the 'value', that would also allow > measuring the time it > takes to complete a readl(), which may be valuable for other users as these > can be significant. Ah yes, that would be useful. No downsides as far as I know other than the size but that should be fine given this depends on ftrace. > > Not sure how to best do that that, we could return a timestamp from the 'before' > tracepoint and pass it into the 'after' tracepoint in order to log the > difference, or just > rely on calculating the differences in user space based on the log. For trace events, timing information is already logged by ftrace infrastructure. Most of the users do use these for timing information based on post processing these logs looking at these timestamps, so we should be good using that as well. > For the 'write' style accessors, the timing data would be less interesting, at > least for posted PCI transactions, but it may be helpful to do the same for > symmetry reasons. Ok, I will add these post read/write logging in the next version. Thanks, Sai ^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2021-12-07 13:05 UTC | newest] Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 2021-12-06 10:01 ` Arnd Bergmann 2021-12-06 10:20 ` Sai Prakash Ranjan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).