Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testptp sends timestamps 2 times faster than predicted #53

Open
LiaoU3 opened this issue May 9, 2024 · 0 comments
Open

testptp sends timestamps 2 times faster than predicted #53

LiaoU3 opened this issue May 9, 2024 · 0 comments

Comments

@LiaoU3
Copy link

LiaoU3 commented May 9, 2024

Summary

The TGPIO testing tool testptp is built from tools/testing/selftests/ptp/testptp.c in branch 6.1/linux.
When sending timestamps with this tool built from the latest commit, it always send two times faster than the setting we did. NeverthelessI tried with the previous tag lts-v6.1.28-linux-230601T020337Z and it functioned well.

I suspect there is something wrong with the commits after 2023-06-01.

testptp built from the latest commit

u@u-Alder-Lake-Client-Platform:~/linux-intel-lts$ sudo ./tools/testing/selftests/ptp/testptp -d /dev/ptp1 -i 1 -L 1,1 -e 100 -o 10 -E
set pin function okay
external time stamp request okay
Event count: 2240
Event time time: 1512,000000052
Approx System time: 1498,127435181
Approx Translated Device time: 1309,655061421
Event count: 2241
Event time time: 1512,500000052
Approx System time: 1498,628027798
Approx Translated Device time: 1309,655061421
Event count: 2242
Event time time: 1513,000000052
Approx System time: 1499,127392644
Approx Translated Device time: 1309,655061421
Event count: 2243
Event time time: 1513,500000052
Approx System time: 1499,627848838
Approx Translated Device time: 1309,655061421
Event count: 2244
Event time time: 1514,000000052
Approx System time: 1500,127361857
Approx Translated Device time: 1309,655061421
Event count: 2245
Event time time: 1514,500000052
Approx System time: 1500,627841250
Approx Translated Device time: 1309,655061421
Event count: 2246
Event time time: 1515,000000052
Approx System time: 1501,127149896
Approx Translated Device time: 1309,655061421
Event count: 2247
Event time time: 1515,500000052
Approx System time: 1501,627649472
Approx Translated Device time: 1309,655061421
Event count: 2248
Event time time: 1516,000000052
Approx System time: 1502,127682698
Approx Translated Device time: 1309,655061421
Event count: 2249
Event time time: 1516,500000052
Approx System time: 1502,627060401
Approx Translated Device time: 1309,655061421
Event count: 2250
Event time time: 1517,000000052
Approx System time: 1503,127616692
Approx Translated Device time: 1309,655061421
Event count: 2251
Event time time: 1517,500000052
Approx System time: 1503,627290277
Approx Translated Device time: 1309,655061421
Event count: 2252
Event time time: 1518,000000052
Approx System time: 1504,127571425
Approx Translated Device time: 1309,655061421
Event count: 2253
Event time time: 1518,500000052
Approx System time: 1504,627211910
Approx Translated Device time: 1309,655061421
Event count: 2254
Event time time: 1519,000000052
Approx System time: 1505,127917676
Approx Translated Device time: 1309,655061421
Event count: 2255
Event time time: 1519,500000052
Approx System time: 1505,627533358
Approx Translated Device time: 1309,655061421
Event count: 2256
Event time time: 1520,000000052
Approx System time: 1506,127180974
Approx Translated Device time: 1309,655061421
Event count: 2257
Event time time: 1520,500000052
Approx System time: 1506,627500712
Approx Translated Device time: 1309,655061421
Event count: 2258
Event time time: 1521,000000052
Approx System time: 1507,127862884
Approx Translated Device time: 1309,655061421
Event count: 2259
Event time time: 1521,500000052
Approx System time: 1507,627123016
Approx Translated Device time: 1309,655061421
Event count: 2260
Event time time: 1522,000000052
Approx System time: 1508,127569882
Approx Translated Device time: 1309,655061421

testptp built from the tag lts-v6.1.28-linux-230601T020337Z

u@u-Alder-Lake-Client-Platform:~/linux-intel-lts-567d7c87ead22824f109a7914c7dcc667131e6f4$ sudo ./tools/testing/selftests/ptp/testptp -d /dev/ptp1 -i 1 -L 1,1 -e 100 -o 10 -E
set pin function okay
external time stamp request okay
Event count: 2627
Event time time: 1709,000000052
Approx System time: 1695,127975226
Approx Translated Device time: 1015,484370145
Event count: 2628
Event time time: 1710,000000052
Approx System time: 1696,127259545
Approx Translated Device time: 1015,484370145
Event count: 2629
Event time time: 1711,000000052
Approx System time: 1697,127229841
Approx Translated Device time: 1015,484370145
Event count: 2630
Event time time: 1712,000000052
Approx System time: 1698,127927988
Approx Translated Device time: 1015,484370145
Event count: 2631
Event time time: 1713,000000052
Approx System time: 1699,127154819
Approx Translated Device time: 1015,484370145
Event count: 2632
Event time time: 1714,000000052
Approx System time: 1700,127153471
Approx Translated Device time: 1015,484370145
Event count: 2633
Event time time: 1715,000000052
Approx System time: 1701,127469452
Approx Translated Device time: 1015,484370145
Event count: 2634
Event time time: 1716,000000052
Approx System time: 1702,127811835
Approx Translated Device time: 1015,484370145
Event count: 2635
Event time time: 1717,000000052
Approx System time: 1703,127058947
Approx Translated Device time: 1015,484370145
Event count: 2636
Event time time: 1718,000000052
Approx System time: 1704,127384770
Approx Translated Device time: 1015,484370145

Steps to reproduce

  1. Prepare 2 mahcines that support TGPIO and make sure it is enabled in the BIOS.
  2. Connect those 2 TGPIO pin together.
  3. Build testptp on each machine
    1. git clone --depth=1 -b 6.1/linux https://github.com/intel/linux-intel-lts.git
    2. cd linux-intel-lts
    3. make headers_install ARCH=x86_64;make -C tools/testing/selftests TARGETS=ptp # To build testpt
  4. Send timestamps on one machine
    • sudo ./tools/testing/selftests/ptp/testptp -d /dev/ptp1 -i 0 -L 0,2 -p 1000000000 # You may have to replace /dev/ptp1 and -i 0 -L 0 according to your machine
  5. Receive timestamps on another machine
    • sudo ./tools/testing/selftests/ptp/testptp -d /dev/ptp1 -i 1 -L 1,1 -e 100 -o 10 -E # You may have to replace /dev/ptp1 and -i 0 -L 0 according to your machine
sys-oak pushed a commit that referenced this issue Aug 13, 2024
[ Upstream commit 4a95449 ]

The per cpu variable cpu_number1 is passed to xlnx_event_handler as
argument "dev_id", but it is not used in this function. So drop the
initialization of this variable and rename it to dummy_cpu_number.
This patch is to fix the following call trace when the kernel option
CONFIG_DEBUG_ATOMIC_SLEEP is enabled:

BUG: sleeping function called from invalid context at include/linux/sched/mm.h:274
    in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0
    preempt_count: 1, expected: 0
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.0 #53
    Hardware name: Xilinx Versal vmk180 Eval board rev1.1 (QSPI) (DT)
    Call trace:
     dump_backtrace+0xd0/0xe0
     show_stack+0x18/0x40
     dump_stack_lvl+0x7c/0xa0
     dump_stack+0x18/0x34
     __might_resched+0x10c/0x140
     __might_sleep+0x4c/0xa0
     __kmem_cache_alloc_node+0xf4/0x168
     kmalloc_trace+0x28/0x38
     __request_percpu_irq+0x74/0x138
     xlnx_event_manager_probe+0xf8/0x298
     platform_probe+0x68/0xd8

Fixes: daed80e ("soc: xilinx: Fix for call trace due to the usage of smp_processor_id()")
Signed-off-by: Jay Buddhabhatti <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Michal Simek <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
sys-oak pushed a commit that referenced this issue Aug 29, 2024
[ Upstream commit 4a95449 ]

The per cpu variable cpu_number1 is passed to xlnx_event_handler as
argument "dev_id", but it is not used in this function. So drop the
initialization of this variable and rename it to dummy_cpu_number.
This patch is to fix the following call trace when the kernel option
CONFIG_DEBUG_ATOMIC_SLEEP is enabled:

BUG: sleeping function called from invalid context at include/linux/sched/mm.h:274
    in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0
    preempt_count: 1, expected: 0
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.0 #53
    Hardware name: Xilinx Versal vmk180 Eval board rev1.1 (QSPI) (DT)
    Call trace:
     dump_backtrace+0xd0/0xe0
     show_stack+0x18/0x40
     dump_stack_lvl+0x7c/0xa0
     dump_stack+0x18/0x34
     __might_resched+0x10c/0x140
     __might_sleep+0x4c/0xa0
     __kmem_cache_alloc_node+0xf4/0x168
     kmalloc_trace+0x28/0x38
     __request_percpu_irq+0x74/0x138
     xlnx_event_manager_probe+0xf8/0x298
     platform_probe+0x68/0xd8

Fixes: daed80e ("soc: xilinx: Fix for call trace due to the usage of smp_processor_id()")
Signed-off-by: Jay Buddhabhatti <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Michal Simek <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
sys-oak pushed a commit that referenced this issue Oct 29, 2024
commit bee1aed upstream.

If we use GPIO reset from I2C port expander, we must use *_cansleep()
variant of GPIO functions.
This was not done in ar0521_power_on()/ar0521_power_off() functions.
Let's fix that.

------------[ cut here ]------------
WARNING: CPU: 0 PID: 11 at drivers/gpio/gpiolib.c:3496 gpiod_set_value+0x74/0x7c
Modules linked in:
CPU: 0 PID: 11 Comm: kworker/u16:0 Not tainted 6.10.0 #53
Hardware name: Diasom DS-RK3568-SOM-EVB (DT)
Workqueue: events_unbound deferred_probe_work_func
pstate: 80400009 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : gpiod_set_value+0x74/0x7c
lr : ar0521_power_on+0xcc/0x290
sp : ffffff8001d7ab70
x29: ffffff8001d7ab70 x28: ffffff80027dcc90 x27: ffffff8003c82000
x26: ffffff8003ca9250 x25: ffffffc080a39c60 x24: ffffff8003ca9088
x23: ffffff8002402720 x22: ffffff8003ca9080 x21: ffffff8003ca9088
x20: 0000000000000000 x19: ffffff8001eb2a00 x18: ffffff80efeeac80
x17: 756d2d6332692f30 x16: 0000000000000000 x15: 0000000000000000
x14: ffffff8001d91d40 x13: 0000000000000016 x12: ffffffc080e98930
x11: ffffff8001eb2880 x10: 0000000000000890 x9 : ffffff8001d7a9f0
x8 : ffffff8001d92570 x7 : ffffff80efeeac80 x6 : 000000003fc6e780
x5 : ffffff8001d91c80 x4 : 0000000000000002 x3 : 0000000000000000
x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000001
Call trace:
 gpiod_set_value+0x74/0x7c
 ar0521_power_on+0xcc/0x290
...

Signed-off-by: Alexander Shiyan <[email protected]>
Fixes: 852b50a ("media: On Semi AR0521 sensor driver")
Cc: [email protected]
Acked-by: Krzysztof Hałasa <[email protected]>
Signed-off-by: Sakari Ailus <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant