[Bug 219220] syscalls (ioctls) on USB devices are very slow

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu May 11 11:35:19 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219220

            Bug ID: 219220
           Summary: syscalls (ioctls) on USB devices are very slow
           Product: Base System
           Version: CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: usb
          Assignee: freebsd-usb at FreeBSD.org
          Reporter: guru at unixarea.de

I installed the port devel/pcsc-litepcsc-lite:

# pkg inf pcsc-lite
pcsc-lite-1.8.20,2
Name           : pcsc-lite
Version        : 1.8.20,2
Installed on   : Thu May 11 08:28:06 2017 CEST
Origin         : devel/pcsc-lite
Architecture   : freebsd:12:x86:64
...

and enabled the start of the 'pcscd' with

pcscd_enable="YES"

in /etc/rc.conf, but this would make hang the system on startup/boot:

> 25038  1  S+     0:00,02 /bin/sh /usr/local/etc/rc.d/pcscd start
> 25043  1  S+     0:00,01 /usr/local/sbin/pcscd
> 25044  1  S+     0:00,01 /usr/local/sbin/pcscd
> 


interestingly to note: I have the exact same system (12-CURRENT r314251 and
with same ports
from my own pkg repository out of poudriere) in a VBOX machine; when I start
there the pcscd
in foreground and with --debug it says:


root at r314251-amd64:~ # /usr/local/sbin/pcscd --debug --foreground
00000000 pcscdaemon.c:346:main() pcscd set to foreground with debug send to
stdout
00000516 configfile.l:358:DBGetReaderList() Parsing conf file:
/usr/local/etc/reader.conf.d
00000043 pcscdaemon.c:655:main() pcsc-lite 1.8.20 daemon ready.
00010018 hotplug_libusb.c:440:HPEstablishUSBNotifications() Driver
ifd-ccid.bundle does not support IFD_GENERATE_HOTPLUG. Using active polling
instead.
00000124 hotplug_libusb.c:449:HPEstablishUSBNotifications() Polling forced
every 1 second(s)

and a truss on the PID shows that is is really polling once every second:

...
openat(AT_FDCWD,"/dev/ugen1.1",O_RDWR,00)        = 7 (0x7)
openat(AT_FDCWD,"/dev/ugen1.1",O_RDWR,00)        = 8 (0x8)
ioctl(8,USB_GET_PLUGTIME,0xdfdfcddc)             = 0 (0x0)
ioctl(7,USB_GET_CONFIG,0xdfdfce44)               = 0 (0x0)
close(8)                                         = 0 (0x0)
close(7)                                         = 0 (0x0)
openat(AT_FDCWD,"/dev/ugen1.1",O_RDWR,00)        = 7 (0x7)
openat(AT_FDCWD,"/dev/ugen1.1",O_RDWR,00)        = 8 (0x8)
...

On the system in question, an Acer C720 netbook, it says only:

root at c720-r314251:~ # /usr/local/sbin/pcscd --debug --foreground
00000000 pcscdaemon.c:346:main() pcscd set to foreground with debug send to
stdout
00000550 configfile.l:358:DBGetReaderList() Parsing conf file:
/usr/local/etc/reader.conf.d
00000049 pcscdaemon.c:655:main() pcsc-lite 1.8.20 daemon ready.

i.e. the line about hotplug_libusb.c:440:HPEstablishUSBNotifications()
does not show up; and a truss shows that is is doing/waiting on
something on a dev; it is very slow doing some ioctls:

openat(AT_FDCWD,"/dev/usbctl",O_RDONLY,00)       = 11 (0xb)
ioctl(11,USB_READ_DIR,0xdfdfcb38)                = 0 (0x0)
openat(AT_FDCWD,"/dev/ugen1.1",O_RDWR,00)        = 12 (0xc)
ioctl(12,USB_GET_PLUGTIME,0xdfdfcb1c)            = 0 (0x0)
ioctl(12,USB_GET_DEVICE_DESC,0xdfdfcb20)         = 0 (0x0)
ioctl(12,USB_GET_DEVICEINFO,0xdfdfccb0)          = 0 (0x0)

I will attach a ktrace/kdump output which shows that the problem is caused by
*very*
slow sys calls on the USB bus.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-usb mailing list