[Linuxptp-devel] Issues with mutex locking and ptp_find_pin
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Andrew S. <and...@gm...> - 2016-01-14 21:57:42
|
Hi there I just modified the Linux TI CPTS driver to support external hardware time stamping. In my driver's .enable function callback on the *ptp_clock_info* struct I made use of the *ptp_find_pin* to map a (function,channel) to a (pin). Using the testptp.c app I am able to successfully switch to func=1 (EXTTS) mode and time stamping works. However, when I try and switch back to func=0 (NONE) the testptp application hangs, and I get a kernel panic (slow mutex). To repeat: root@arm:~# testptp -l name HW1_TS_PUSH index 0 func 0 chan 0 name HW2_TS_PUSH index 1 func 0 chan 1 name HW3_TS_PUSH index 2 func 0 chan 2 name HW4_TS_PUSH index 3 func 0 chan 3 root@arm:~# testptp -i 3 -L 3,1 set pin function okay root@arm:~# testptp -i 3 -e 1 external time stamp request okay event index 3 at 946685182.188502679 root@arm:~# root@arm:~# testptp -i 3 -L 3,0 ... (testptp application hangs) I believe that the underlying reason for this is that *ptp_find_pin* function attempts to perform a mutex lock on &ptp->pincfg_mux, which is already locked by the calling function (see the mutex lock <https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/ptp/ptp_chardev.c?id=refs/tags/v4.4#n244> in the *ptp_ioctl* function in /drivers/ptp/ptp_chardev.c). Perhaps it isn't a good practice to call *ptp_find_pin *from within the enable function callback in driver code, as done in /drivers/net/ethernet/intel/igb/igb_ptp.c. Andrew Symington |