All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: Use readl_poll_timeout_atomic() in atomic state
@ 2022-04-18  9:05 Kevin Hao
  2022-04-18 19:54 ` kernel test robot
  2022-04-19  1:11 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Hao @ 2022-04-18  9:05 UTC (permalink / raw)
  To: netdev
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Dejin Zheng

The init_systime() may be invoked in atomic state. We have observed the
following call trace when running "phc_ctl /dev/ptp0 set" on a Intel
Agilex board.
  BUG: sleeping function called from invalid context at drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c:74
  in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 381, name: phc_ctl
  preempt_count: 1, expected: 0
  RCU nest depth: 0, expected: 0
  Preemption disabled at:
  [<ffff80000892ef78>] stmmac_set_time+0x34/0x8c
  CPU: 2 PID: 381 Comm: phc_ctl Not tainted 5.18.0-rc2-next-20220414-yocto-standard+ #567
  Hardware name: SoCFPGA Agilex SoCDK (DT)
  Call trace:
   dump_backtrace.part.0+0xc4/0xd0
   show_stack+0x24/0x40
   dump_stack_lvl+0x7c/0xa0
   dump_stack+0x18/0x34
   __might_resched+0x154/0x1c0
   __might_sleep+0x58/0x90
   init_systime+0x78/0x120
   stmmac_set_time+0x64/0x8c
   ptp_clock_settime+0x60/0x9c
   pc_clock_settime+0x6c/0xc0
   __arm64_sys_clock_settime+0x88/0xf0
   invoke_syscall+0x5c/0x130
   el0_svc_common.constprop.0+0x4c/0x100
   do_el0_svc+0x7c/0xa0
   el0_svc+0x58/0xcc
   el0t_64_sync_handler+0xa4/0x130
   el0t_64_sync+0x18c/0x190

So we should use readl_poll_timeout_atomic() here instead of
readl_poll_timeout().

Fixes: ff8ed737860e ("net: stmmac: use readl_poll_timeout() function in init_systime()")
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
index 22fea0f67245..58448e9b6625 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
@@ -71,7 +71,7 @@ static int init_systime(void __iomem *ioaddr, u32 sec, u32 nsec)
 	writel(value, ioaddr + PTP_TCR);
 
 	/* wait for present system time initialize to complete */
-	return readl_poll_timeout(ioaddr + PTP_TCR, value,
+	return readl_poll_timeout_atomic(ioaddr + PTP_TCR, value,
 				 !(value & PTP_TCR_TSINIT),
 				 10000, 100000);
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: stmmac: Use readl_poll_timeout_atomic() in atomic state
  2022-04-18  9:05 [PATCH] net: stmmac: Use readl_poll_timeout_atomic() in atomic state Kevin Hao
@ 2022-04-18 19:54 ` kernel test robot
  2022-04-19  1:11 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-04-18 19:54 UTC (permalink / raw)
  To: Kevin Hao, netdev
  Cc: llvm, kbuild-all, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Dejin Zheng

Hi Kevin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net/master]
[also build test ERROR on net-next/master horms-ipvs/master linus/master v5.18-rc3 next-20220414]
[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/intel-lab-lkp/linux/commits/Kevin-Hao/net-stmmac-Use-readl_poll_timeout_atomic-in-atomic-state/20220418-170945
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 49aefd131739df552f83c566d0665744c30b1d70
config: arm-spear13xx_defconfig (https://download.01.org/0day-ci/archive/20220419/202204190334.b0rutoIE-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 429cbac0390654f90bba18a41799464adf31a5ec)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/2a443e2b58e8910075a2d972e0e52b1d070654af
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Kevin-Hao/net-stmmac-Use-readl_poll_timeout_atomic-in-atomic-state/20220418-170945
        git checkout 2a443e2b58e8910075a2d972e0e52b1d070654af
        # 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=arm 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 >>):

>> ld.lld: error: undefined symbol: __bad_udelay
   >>> referenced by stmmac_hwtstamp.c
   >>>               net/ethernet/stmicro/stmmac/stmmac_hwtstamp.o:(init_systime) in archive drivers/built-in.a

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: stmmac: Use readl_poll_timeout_atomic() in atomic state
  2022-04-18  9:05 [PATCH] net: stmmac: Use readl_poll_timeout_atomic() in atomic state Kevin Hao
  2022-04-18 19:54 ` kernel test robot
@ 2022-04-19  1:11 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-04-19  1:11 UTC (permalink / raw)
  To: Kevin Hao, netdev
  Cc: kbuild-all, Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Dejin Zheng

Hi Kevin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net/master]
[also build test ERROR on net-next/master horms-ipvs/master linus/master v5.18-rc3 next-20220414]
[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/intel-lab-lkp/linux/commits/Kevin-Hao/net-stmmac-Use-readl_poll_timeout_atomic-in-atomic-state/20220418-170945
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 49aefd131739df552f83c566d0665744c30b1d70
config: arm-defconfig (https://download.01.org/0day-ci/archive/20220419/202204190929.z3hyoNTU-lkp@intel.com/config)
compiler: arm-linux-gnueabi-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/intel-lab-lkp/linux/commit/2a443e2b58e8910075a2d972e0e52b1d070654af
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Kevin-Hao/net-stmmac-Use-readl_poll_timeout_atomic-in-atomic-state/20220418-170945
        git checkout 2a443e2b58e8910075a2d972e0e52b1d070654af
        # 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=arm 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 >>):

   arm-linux-gnueabi-ld: drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.o: in function `init_systime':
>> stmmac_hwtstamp.c:(.text+0x3cc): undefined reference to `__bad_udelay'

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-19  1:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18  9:05 [PATCH] net: stmmac: Use readl_poll_timeout_atomic() in atomic state Kevin Hao
2022-04-18 19:54 ` kernel test robot
2022-04-19  1:11 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.