Re: [PATCH v3] tty/serial: create debugfs interface for UART register tracing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>> Implement a UART register tracing facility using the debugfs.  This can be
>>>> used as a "serial port sniffer" to monitor UART traffic and line settings
>>>> with timestamps at microsecond granularity.  This can be useful for general
>>>> serial port debugging or to debug the UART driver itself.
>>>
>>>>  drivers/tty/serial/8250/8250_debug.c | 530 +++++++++++++++++++++++++++
>>>
>>> My gosh. Why trace points and trace events can't be used for that?
>>
>> I don't understand your post.  Are you saying there is already a way to
>> trace UART register reads/writes without this patch? Can you elaborate?
> 
> Besides what Greg an I were telling you (another type of infrastructure),
> as a matter of fact you may trace any IO on some architectures (at least x86),
> it's called mmiotracer (I have used it like 5 years ago or so to trace UART).
> 
> Below is the excerpt from my old shell script
> 
> rebind() {
> 	local drvdir="/sys/bus/$1/drivers/$2"
> 	local devdir="/sys/bus/$1/devices/$3"
> 	[ -d "$drvdir" -a -d "$devdir" ] || return
> 	echo "$3" > "$drvdir/unbind"
> 	echo "$3" > "$drvdir/bind"
> }
> 
> mmiotrace() {
> 	echo mmiotrace > /sys/kernel/tracing/current_tracer
> 	echo 1 > /sys/kernel/tracing/tracing_on
> 
> 	rebind platform 'dw-apb-uart'   '80860F0A:00'   # BYT ttyS1 (ACPI)
> 	rebind platform 'dw-apb-uart'   '8086228A:00'   # BSW ttyS1 (ACPI)
> 	rebind pci      '8250_mid'      '0000:00:04.2'  # Edison ttyS1
> 	rebind pci      'intel-lpss'    '0000:00:18.1'  # BXT LH ttyS1
> 	rebind pci      'intel-lpss'    '0000:00:1e.0'  # SKL ttyS1
> 	rebind pci      '8250_lpss'     '0000:00:1e.3'  # BSW ttyS1 (PCI)
> }

Correct me if I'm wrong but I don't think mmiotrace will work for me.  My
environment comprises an Intel Celeron M connected to an 852GM north bridge,
an ICH4 south bridge, and a SCH3114 Super I/O controller.  My UART device
is ttyS1 and it uses port I/O not memory-mapped I/O.

# find /sys/devices -name '*ttyS*'
/sys/devices/platform/serial8250/tty/ttyS2
/sys/devices/platform/serial8250/tty/ttyS3
/sys/devices/pnp0/00:03/tty/ttyS0
/sys/devices/pnp0/00:04/tty/ttyS1

# ls -l /sys/bus/pnp/drivers/serial
total 0
lrwxrwxrwx    1 root     root             0 Sep 11 14:19 00:03 -> ../../../../devices/pnp0/00:03
lrwxrwxrwx    1 root     root             0 Sep 11 14:19 00:04 -> ../../../../devices/pnp0/00:04
--w-------    1 root     root          4096 Sep 11 14:19 bind
--w-------    1 root     root          4096 Sep 11 14:19 uevent
--w-------    1 root     root          4096 Sep 11 14:19 unbind

# mount -t tracefs tracefs /sys/kernel/tracing
# echo mmiotrace > /sys/kernel/tracing/current_tracer
# echo 00:04 > /sys/bus/pnp/drivers/serial/unbind
# echo 00:04 > /sys/bus/pnp/drivers/serial/bind
# dmesg | tail -5
[   36.438305] random: crng init done
[   97.736362] mmiotrace: enabled.
[  113.964953] serial 00:04: disabled
[  117.469704] serial 00:04: activated
[  117.469986] 00:04: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A

(perform UART transaction)

# cat /sys/kernel/tracing/trace
# tracer: mmiotrace
#
# entries-in-buffer/entries-written: 0/0   #P:1
#
#                                _-----=> irqs-off/BH-disabled
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| / _-=> migrate-disable
#                              |||| /     delay
#           TASK-PID     CPU#  |||||  TIMESTAMP  FUNCTION
#              | |         |   |||||     |         |



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux