lib/rwmmio/arm64: Add support to trace register reads/writes
Subsystems (12)
v7 cover lib/rwmmio/arm64: Add support to trace register reads/writes
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_write: __qcom_geni_serial_console_write+0x160/0x1e0 width=32 val=0xa0d5d addr=0xfffffbfffdbff700rwmmio_post_write: __qcom_geni_serial_console_write+0x160/0x1e0 width=32 val=0xa0d5d addr=0xfffffbfffdbff700rwmmio_read: qcom_geni_serial_poll_bit+0x94/0x138 width=32 addr=0xfffffbfffdbff610rwmmio_post_read: qcom_geni_serial_poll_bit+0x94/0x138 width=32 val=0x0 addr=0xfffffbfffdbff610
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/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/
Note in previous v4 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/[email protected]/
Changes in v7:
* Use lib/ instead of kernel/trace/ based on review comment by Steven Rostedt.
Changes in v6:
* Implemented suggestions by Arnd Bergmann:
- Use arch independent IO barriers in arm64/asm
- Add ARCH_HAVE_TRACE_MMIO_ACCESS
- Add post read and post write logging support
- Remove tracepoint_active check
* Fix build error reported by kernel test robot.
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):
lib: Add register read/write tracing support
Sai Prakash Ranjan (4):
arm64: io: Use asm-generic high level MMIO accessors irqchip/tegra: Fix overflow implicit truncation warnings drm/meson: Fix overflow implicit truncation warnings asm-generic/io: Add logging support for MMIO accessors
arch/Kconfig | 3 + arch/arm64/Kconfig | 1 + arch/arm64/include/asm/io.h | 41 +++-------- arch/arm64/kvm/hyp/nvhe/Makefile | 7 +- drivers/gpu/drm/meson/meson_viu.c | 22 +++--- drivers/irqchip/irq-tegra.c | 10 +-- include/asm-generic/io.h | 81 +++++++++++++++++++-- include/trace/events/rwmmio.h | 112 ++++++++++++++++++++++++++++++ lib/Kconfig | 7 ++ lib/Makefile | 2 + lib/trace_readwrite.c | 47 +++++++++++++ 11 files changed, 279 insertions(+), 54 deletions(-) create mode 100644 include/trace/events/rwmmio.h create mode 100644 lib/trace_readwrite.c
Signature · 1 line
2.33.1
PATCH v7 1/5 arm64: io: Use asm-generic high level MMIO accessors
Remove custom arm64 MMIO accessors read{b,w,l,q} and their relaxed versions in support to use asm-generic defined accessors. Also define one set of IO barriers (ar/bw version) used by asm-generic code to override the arm64 specific variants.
--- arch/arm64/include/asm/io.h | 41 ++++++++----------------------------- 1 file changed, 8 insertions(+), 33 deletions(-)
arch/arm64/include/asm/io.h +8 -33
@@ -91,7 +91,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) }/* IO barriers */ -#define __iormb (v) \ +#define __io_ar (v) \ ({ \ unsigned long tmp; \ \
@@ -108,39 +108,14 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) : "memory"); \ }) -#define __io_par (v) __iormb(v) -#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 __io_bw () dma_wmb() +#define __io_br (v) +#define __io_aw (v) -#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)); }) +/* arm64-specific, don't use in portable drivers */ +#define __iormb (v) __io_ar(v) +#define __iowmb () __io_bw() +#define __iomb () dma_mb()/* * I/O port access primitives.
Signature · 1 line
2.33.1
PATCH v7 2/5 irqchip/tegra: Fix overflow implicit truncation warnings
In reply to Sai Prakash RanjanFix -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);
^--- drivers/irqchip/irq-tegra.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/irqchip/irq-tegra.c +5 -5
@@ -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 );
Signature · 1 line
2.33.1
PATCH v7 3/5 drm/meson: Fix overflow implicit truncation warnings
In reply to Sai Prakash RanjanFix -Woverflow warnings for drm/meson 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/gpu/drm/meson/meson_viu.c: In function ‘meson_viu_init’:drivers/gpu/drm/meson/meson_registers.h:1826:48: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
#define VIU_OSD_BLEND_REORDER(dest, src) ((src) << (dest * 4))
^
drivers/gpu/drm/meson/meson_viu.c:472:18: note: in expansion of macro ‘VIU_OSD_BLEND_REORDER’
writel_relaxed(VIU_OSD_BLEND_REORDER(0, 1) |
^~~~~~~~~~~~~~~~~~~~~--- drivers/gpu/drm/meson/meson_viu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/meson/meson_viu.c +11 -11
@@ -469,17 +469,17 @@ void meson_viu_init(struct meson_drm *priv) priv->io_base + _REG(VD2_IF0_LUMA_FIFO_SIZE));if (meson_vpu_is_compatible (priv,VPU_COMPATIBLE_G12A )) { -writel_relaxed (VIU_OSD_BLEND_REORDER (0 ,1 ) | -VIU_OSD_BLEND_REORDER (1 ,0 ) | -VIU_OSD_BLEND_REORDER (2 ,0 ) | -VIU_OSD_BLEND_REORDER (3 ,0 ) | -VIU_OSD_BLEND_DIN_EN (1 ) | -VIU_OSD_BLEND1_DIN3_BYPASS_TO_DOUT1 | -VIU_OSD_BLEND1_DOUT_BYPASS_TO_BLEND2 | -VIU_OSD_BLEND_DIN0_BYPASS_TO_DOUT0 | -VIU_OSD_BLEND_BLEN2_PREMULT_EN (1 ) | -VIU_OSD_BLEND_HOLD_LINES (4 ), - priv->io_base +_REG (VIU_OSD_BLEND_CTRL )); +u32 val = (u32 )VIU_OSD_BLEND_REORDER (0 ,1 ) | + (u32 )VIU_OSD_BLEND_REORDER (1 ,0 ) | + (u32 )VIU_OSD_BLEND_REORDER (2 ,0 ) | + (u32 )VIU_OSD_BLEND_REORDER (3 ,0 ) | + (u32 )VIU_OSD_BLEND_DIN_EN (1 ) | + (u32 )VIU_OSD_BLEND1_DIN3_BYPASS_TO_DOUT1 | + (u32 )VIU_OSD_BLEND1_DOUT_BYPASS_TO_BLEND2 | + (u32 )VIU_OSD_BLEND_DIN0_BYPASS_TO_DOUT0 | + (u32 )VIU_OSD_BLEND_BLEN2_PREMULT_EN (1 ) | + (u32 )VIU_OSD_BLEND_HOLD_LINES (4 ); +writel_relaxed (val, priv->io_base +_REG (VIU_OSD_BLEND_CTRL ));writel_relaxed (OSD_BLEND_PATH_SEL_ENABLE , priv->io_base +_REG (OSD1_BLEND_SRC_CTRL ));
Signature · 1 line
2.33.1
PATCH v7 4/5 lib: Add register read/write tracing support
In reply to Sai Prakash RanjanFrom: Prasad Sodagudi <[email protected]>
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_write: __qcom_geni_serial_console_write+0x160/0x1e0 width=32 val=0xa0d5d addr=0xfffffbfffdbff700rwmmio_post_write: __qcom_geni_serial_console_write+0x160/0x1e0 width=32 val=0xa0d5d addr=0xfffffbfffdbff700rwmmio_read: qcom_geni_serial_poll_bit+0x94/0x138 width=32 addr=0xfffffbfffdbff610rwmmio_post_read: qcom_geni_serial_poll_bit+0x94/0x138 width=32 val=0x0 addr=0xfffffbfffdbff610
--- arch/Kconfig | 3 + arch/arm64/Kconfig | 1 + include/trace/events/rwmmio.h | 112 ++++++++++++++++++++++++++++++++++ lib/Kconfig | 7 +++ lib/Makefile | 2 + lib/trace_readwrite.c | 47 ++++++++++++++ 6 files changed, 172 insertions(+) create mode 100644 include/trace/events/rwmmio.h create mode 100644 lib/trace_readwrite.c
arch/Kconfig +3 -0
@@ -1322,6 +1322,9 @@ config ARCH_HAS_ELFCORE_COMPAT config ARCH_HAS_PARANOID_L1D_FLUSH bool +config ARCH_HAVE_TRACE_MMIO_ACCESS + bool + config DYNAMIC_SIGFRAME bool
arch/arm64/Kconfig +1 -0
@@ -46,6 +46,7 @@ config ARM64 select ARCH_HAS_ZONE_DMA_SET if EXPERT select ARCH_HAVE_ELF_PROT select ARCH_HAVE_NMI_SAFE_CMPXCHG + select ARCH_HAVE_TRACE_MMIO_ACCESS select ARCH_INLINE_READ_LOCK if !PREEMPTION select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
include/trace/events/rwmmio.h new file +112 -0
112 lines not on this page · raw message
lib/Kconfig +7 -0
@@ -119,6 +119,13 @@ config INDIRECT_IOMEM_FALLBACK mmio accesses when the IO memory address is not a registered emulated region. +config TRACE_MMIO_ACCESS + bool "Register read/write tracing" + depends on TRACING && ARCH_HAVE_TRACE_MMIO_ACCESS + help + Create tracepoints for MMIO read/write operations. These trace events + can be used for logging all MMIO read/write operations. + source "lib/crypto/Kconfig" config CRC_CCITT
lib/Makefile +2 -0
@@ -152,6 +152,8 @@ lib-y += logic_pio.o lib-$(CONFIG_INDIRECT_IOMEM) += logic_iomem.o +obj-$(CONFIG_TRACE_MMIO_ACCESS) += trace_readwrite.o + obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o obj-$(CONFIG_BTREE) += btree.o
lib/trace_readwrite.c new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
2.33.1
PATCH v7 5/5 asm-generic/io: Add logging support for MMIO accessors
In reply to Sai Prakash RanjanAdd 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.
---
Used _THIS_IP_ instead of CALLER_ADDR0 in MMIO accessors as using CALLER_ADDR0 was resulting in parent caller information which was not accurate such as below,
rwmmio_read: raw_notifier_call_chain+0x50/0x70 width=32 addr=0xffff800010040000
Use of _THIS_IP_ also helps in keeping ftrace.h away from asm-generic/io.h which would have resulted in tons of header inclusion issues.
--- arch/arm64/kvm/hyp/nvhe/Makefile | 7 ++- include/asm-generic/io.h | 81 ++++++++++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 5 deletions(-)
arch/arm64/kvm/hyp/nvhe/Makefile +6 -1
@@ -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
include/asm-generic/io.h +77 -4
211 lines not on this page · raw message
Signature · 1 line
2.33.1
kernel test robot
build botRe: [PATCHv7 5/5] asm-generic/io: Add logging support for MMIO accessors
Thank you for the patch! Yet something to improve:
Hi Sai,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on next-20220115]
[cannot apply to arm64/for-next/core arnd-asm-generic/master arm-perf/for-next/perf linus/master v5.16 v5.16-rc8 v5.16-rc7 v5.16] [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/lib-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20220115-211708 base: bd8d9cef2a7932e688ca267ea1adf5ea6557c777 config: nios2-defconfig (https://download.01.org/0day-ci/archive/20220116/202201160019.hrsMYj6V-lkp(a)intel.com/config) compiler: nios2-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/0757812bba83a756f73ce1a84c86ded3e276cd0f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sai-Prakash-Ranjan/lib-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20220115-211708 git checkout 0757812bba83a756f73ce1a84c86ded3e276cd0f
# 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=nios2 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
In file included from arch/nios2/include/asm/io.h:41,
from include/linux/io.h:13,
from arch/nios2/include/asm/pgtable.h:18,
from include/linux/pgtable.h:6,
from arch/nios2/kernel/nios2_ksyms.c:11:
include/asm-generic/io.h: In function 'readb':
>> include/asm-generic/io.h:181:32: error: '_THIS_IP_' undeclared (first use in this function)
181 | log_read_mmio(8, addr, _THIS_IP_);
| ^~~~~~~~~
include/asm-generic/io.h:181:32: note: each undeclared identifier is reported only once for each function it appears in
include/asm-generic/io.h: In function 'readw':
include/asm-generic/io.h:196:33: error: '_THIS_IP_' undeclared (first use in this function)
196 | log_read_mmio(16, addr, _THIS_IP_);
| ^~~~~~~~~
include/asm-generic/io.h: In function 'readl':
include/asm-generic/io.h:211:33: error: '_THIS_IP_' undeclared (first use in this function)
211 | log_read_mmio(32, addr, _THIS_IP_);
| ^~~~~~~~~
include/asm-generic/io.h: In function 'writeb':
include/asm-generic/io.h:241:40: error: '_THIS_IP_' undeclared (first use in this function)
241 | log_write_mmio(value, 8, addr, _THIS_IP_);
| ^~~~~~~~~
include/asm-generic/io.h: In function 'writew':
include/asm-generic/io.h:253:41: error: '_THIS_IP_' undeclared (first use in this function)
253 | log_write_mmio(value, 16, addr, _THIS_IP_);
| ^~~~~~~~~
include/asm-generic/io.h: In function 'writel':
include/asm-generic/io.h:265:41: error: '_THIS_IP_' undeclared (first use in this function)
265 | log_write_mmio(value, 32, addr, _THIS_IP_);
| ^~~~~~~~~vim +/_THIS_IP_ +181 include/asm-generic/io.h
169
170 /*
171 * {read,write}{b,w,l,q}() access little endian memory and return result in
172 * native endianness.
173 */
174
175 #ifndef readb
176 #define readb readb
177 static inline u8 readb(const volatile void __iomem *addr)
178 {
179 u8 val;
180
> 181 log_read_mmio(8, addr, _THIS_IP_);
182 __io_br();
183 val = __raw_readb(addr);
184 __io_ar(val);
185 log_post_read_mmio(val, 8, addr, _THIS_IP_);
186 return val;
187 }
188 #endif
189
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCHv7 5/5] asm-generic/io: Add logging support for MMIO accessors
Quoted 52 lines · kernel test robot
Hi Sai,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on next-20220115]
[cannot apply to arm64/for-next/core arnd-asm-generic/master arm-perf/for-next/perf linus/master v5.16 v5.16-rc8 v5.16-rc7 v5.16] [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/lib-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20220115-211708 base: bd8d9cef2a7932e688ca267ea1adf5ea6557c777 config: nios2-defconfig (https://download.01.org/0day-ci/archive/20220116/202201160019.hrsMYj6V-lkp(a)intel.com/config) compiler: nios2-linux-gcc (GCC) 11.2.0reproduce (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/0757812bba83a756f73ce1a84c86ded3e276cd0f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sai-Prakash-Ranjan/lib-rwmmio-arm64-Add-support-to-trace-register-reads-writes/20220115-211708 git checkout0757812bba83a756f73ce1a84c86ded3e276cd0f
# save the config file to linux build tree
mkdirbuild_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nios2 SHELL=/bin/bashIf you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>):
In file included from
arch/nios2/include/asm/io.h:41,
frominclude/linux/io.h:13, fromarch/nios2/include/asm/pgtable.h:18, frominclude/linux/pgtable.h:6, fromarch/nios2/kernel/nios2_ksyms.c:11:
include/asm-generic/io.h: In function 'readb':Quoted 1 line
Quoted 1 line
include/asm-generic/io.h:181:32: error: '_THIS_IP_' undeclared (first use in this function)181 |
log_read_mmio(8, addr, _THIS_IP_);
| ^~~~~~~~~
include/asm-generic/io.h:181:32: note: each undeclared identifier is reported only once for each function it appears ininclude/asm-generic/io.h: In function 'readw':
include/asm-generic/io.h:196:33: error: '_THIS_IP_' undeclared (first use in this function)
196 |log_read_mmio(16, addr, _THIS_IP_);
| ^~~~~~~~~
include/asm-generic/io.h: In function 'readl':
include/asm-generic/io.h:211:33: error: '_THIS_IP_' undeclared (first use in this function)
211 |log_read_mmio(32, addr, _THIS_IP_);
| ^~~~~~~~~
include/asm-generic/io.h: In function 'writeb':
include/asm-generic/io.h:241:40: error: '_THIS_IP_' undeclared (first use in this function)
241 |log_write_mmio(value, 8, addr, _THIS_IP_);
| ^~~~~~~~~
Quoted 8 lines
include/asm-generic/io.h: In function 'writew':
include/asm-generic/io.h:253:41: error: '_THIS_IP_' undeclared (first use in this function)
253 |log_write_mmio(value, 16, addr, _THIS_IP_);
| ^~~~~~~~~
include/asm-generic/io.h: In function 'writel':
include/asm-generic/io.h:265:41: error: '_THIS_IP_' undeclared (first use in this function)
265 |log_write_mmio(value, 32, addr, _THIS_IP_);
| ^~~~~~~~~
Hmm I need to include <linux/instruction_pointer.h> for this, although arm64 build doesn't
throw this warning. Now posted v8 with this fix -
https://lore.kernel.org/lkml/cover.1642309054.git.quic_saipraka(a)quicinc.com/
Quoted 28 lines
vim +/_THIS_IP_ +181
include/asm-generic/io.h169 170 /* 171 * {read,write}{b,w,l,q}() access little endian memory and return result in 172 * native endianness. 173 */ 174 175 #ifndef readb 176 #define readb readb 177 static inline u8 readb(const volatile void __iomem *addr) 178 { 179 u8 val; 180Quoted 1 line
181
log_read_mmio(8, addr, _THIS_IP_);182 __io_br(); 183 val = __raw_readb(addr); 184 __io_ar(val); 185 log_post_read_mmio(val, 8, addr, _THIS_IP_); 186 return val; 187 } 188 #endif 189---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org