boundarydevices / imx_usb_loader

USB & UART loader for i.MX5/6/7/8 series
GNU Lesser General Public License v2.1
260 stars 157 forks source link

imx_usb cause kworker to consume 100% of a core. #29

Closed johnstile closed 8 years ago

johnstile commented 8 years ago

Each time I run imx_usb kworker consumes 100% CPU of one core and never frees, though imx_usb exits. I can consume all cores by rerunning imx_usb

Am I doing something wrong?

At commit 349286e25c3fd9b2d31b31e962340123bbc62d44

My mx6_usb_work.conf mx6_qsb hid,1024,0x10000000,1G,0x00907000,0x31000 u-boot-mfg.imx:dcd bench-test-fpga.bit:load 0x11000000 uImage-mfg:load 0x12000000 initramfs.cpio.gz.uboot:load 0x12C00000 uImage-mfg.dtb:load 0x18000000 u-boot-mfg.imx:clear_dcd,load,plug,jump header

Invocation: make clean make ./imx_usb -c ./

Distribution: Gentoo emerge --info

Portage 2.2.26 (python 2.7.10-final-0, default/linux/amd64/13.0/desktop/kde, gcc-4.9.3, glibc-2.21-r1, 4.1.12-gentoo x86_64)

System uname: Linux-4.1.12-gentoo-x86_64-Intel-R-_Core-TM-_i5-2540MCPU@_2.60GHz-with-gentoo-2.2 KiB Mem: 12156952 total, 1009348 free KiB Swap: 53809876 total, 53809876 free Timestamp of repository gentoo: Tue, 09 Feb 2016 17:45:01 +0000 sh bash 4.3_p42-r1 ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1 app-shells/bash: 4.3_p42-r1::gentoo dev-java/java-config: 2.2.0::gentoo dev-lang/perl: 5.20.2::gentoo dev-lang/python: 2.7.10-r1::gentoo, 3.4.3-r1::gentoo dev-util/cmake: 3.3.1-r1::gentoo dev-util/pkgconfig: 0.28-r2::gentoo sys-apps/baselayout: 2.2::gentoo sys-apps/openrc: 0.19.1::gentoo sys-apps/sandbox: 2.10-r1::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69::gentoo sys-devel/automake: 1.10.3-r1::gentoo, 1.11.6-r1::gentoo, 1.12.6::gentoo, 1.13.4::gentoo, 1.14.1-r1::gentoo, 1.15::gentoo sys-devel/binutils: 2.25.1-r1::gentoo sys-devel/gcc: 4.8.5::gentoo, 4.9.3::gentoo sys-devel/gcc-config: 1.7.3::gentoo sys-devel/libtool: 2.4.6::gentoo sys-devel/make: 4.1-r1::gentoo sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers) sys-libs/glibc: 2.21-r1::gentoo Repositories:

gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.namerica.gentoo.org/gentoo-portage priority: -1000

local_overlay location: /usr/local/portage masters: gentoo priority: 0

java location: /var/lib/layman/java masters: gentoo priority: 50

ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=core2 -mtune=generic -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-march=core2 -mtune=generic -O2 -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--dynamic-deps=n" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" USE="X a52 aac aalib accessibility acl acpi addc alsa amd64 apache2 arts asf autoipd avahi avi bash-completion berkdb bitmap-fonts bluetooth bookmarks branding bzip2 cairo cdda cdr cjkcodecs cleartype cli commons-codec consolekit corefonts cracklib crypt cups cxx dbus declarative divx4linux dri dsk dts dv dvd dvdnav dvdr dvdread emboss encode evolution exif exscalibar faacc faad fam ffmpeg fftw firefox flac fontconfig foomaticdb fortran frame fuse gd gdbm gif gimpprint glamor gphoto2 gpm gs gtk gtk2 gudev iconv iconvcodec icu ipod ipv6 jasper jpeg kde kde-meta kdexdeltas kerberos kipi krb5 lcms ldap libdv libnotify libtheora mad madwifi midi mmx mmxext mng modules mp3 mp4 mpeg mppe-mppc multilib mysql ncurses nls nptl nptlonly ogg opengl openmp openrc oss pam pango pcre pda pdf phonon plasma png policykit ppds profile python qt3support qt4 quicktime rar readline real samba sdl seccomp semantic-desktop session spell sql sse sse2 ssl startup-notification subtitles svg tcpd tga theora tiff truetype truetypelive type1 udev udisks unicode upower usb v4l v4l2 vaapi vdpau vorbis win32codecs wxwidgets x264 xattr xcb xcomposite xext ximian-connector xinerama xml xml2 xmms xscreensaver xv xvid zlib zvbi" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias perl vdpau proxy_ajp" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python3_4 python2_7" RUBY_TARGETS="ruby20 ruby21" SANE_BACKENDS="genesys" USERLAND="GNU" VIDEO_CARDS="nvidia intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" USE_PYTHON="2.7 3.4" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

tkisky commented 8 years ago

On 2/10/2016 2:31 PM, John Stile wrote:

Each time I run imx_usb kworker consumes 100% CPU of one core and never frees, though imx_usb exits. I can consume all cores by rerunning imx_usb

Am I doing something wrong?

Very strange. Does a simple invocation do that as well? ./imx_usb u-boot-mfg.imx

At commit 349286e https://github.com/boundarydevices/imx_usb_loader/commit/349286e25c3fd9b2d31b31e962340123bbc62d44

My mx6_usb_work.conf mx6_qsb hid,1024,0x10000000,1G,0x00907000,0x31000 u-boot-mfg.imx:dcd bench-test-fpga.bit:load 0x11000000 uImage-mfg:load 0x12000000 initramfs.cpio.gz.uboot:load 0x12C00000 uImage-mfg.dtb:load 0x18000000 u-boot-mfg.imx:clear_dcd,load,plug,jump header

Invocation: make clean make ./imx_usb -c ./

Distribution: Gentoo emerge --info

Portage 2.2.26 (python 2.7.10-final-0, default/linux/amd64/13.0/desktop/kde, gcc-4.9.3, glibc-2.21-r1, 4.1.12-gentoo x86_64)

System uname: Linux-4.1.12-gentoo-x86_64-Intel-R-/Core-TM-_i5-2540M_CPU/@_2.60GHz-with-gentoo-2.2 KiB Mem: 12156952 total, 1009348 free KiB Swap: 53809876 total, 53809876 free Timestamp of repository gentoo: Tue, 09 Feb 2016 17:45:01 +0000 sh bash 4.3_p42-r1 ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1 app-shells/bash: 4.3_p42-r1::gentoo dev-java/java-config: 2.2.0::gentoo dev-lang/perl: 5.20.2::gentoo dev-lang/python: 2.7.10-r1::gentoo, 3.4.3-r1::gentoo dev-util/cmake: 3.3.1-r1::gentoo dev-util/pkgconfig: 0.28-r2::gentoo sys-apps/baselayout: 2.2::gentoo sys-apps/openrc: 0.19.1::gentoo sys-apps/sandbox: 2.10-r1::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69::gentoo sys-devel/automake: 1.10.3-r1::gentoo, 1.11.6-r1::gentoo, 1.12.6::gentoo, 1.13.4::gentoo, 1.14.1-r1::gentoo, 1.15::gentoo sys-devel/binutils: 2.25.1-r1::gentoo sys-devel/gcc: 4.8.5::gentoo, 4.9.3::gentoo sys-devel/gcc-config: 1.7.3::gentoo sys-devel/libtool: 2.4.6::gentoo sys-devel/make: 4.1-r1::gentoo sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers) sys-libs/glibc: 2.21-r1::gentoo Repositories:

gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.namerica.gentoo.org/gentoo-portage priority: -1000

local_overlay location: /usr/local/portage masters: gentoo priority: 0

java location: /var/lib/layman/java masters: gentoo priority: 50

ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=core2 -mtune=generic -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-march=core2 -mtune=generic -O2 -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--dynamic-deps=n" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" USE="X a52 aac aalib accessibility acl acpi addc alsa amd64 apache2 arts asf autoipd avahi avi bash-completion berkdb bitmap-fonts bluetooth bookmarks branding bzip2 cairo cdda cdr cjkcodecs cleartype cli commons-codec consolekit corefonts cracklib crypt cups cxx dbus declarative divx4linux dri dsk dts dv dvd dvdnav dvdr dvdread emboss encode evolution exif exscalibar faacc faad fam ffmpeg fftw firefox flac fontconfig foomaticdb fortran frame fuse gd gdbm gif gimpprint glamor gphoto2 gpm gs gtk gtk2 gudev iconv iconvcodec icu ipod ipv6 jasper jpeg kde kde-meta kdexdeltas kerberos kipi krb5 lcms ldap libdv libnotify libtheora mad madwifi midi mmx mmxext mng modules mp3 mp4 mpeg mppe-mppc multilib mysql ncurses nls nptl nptlonly ogg opengl openmp openrc oss pam pango pcre pda pdf phonon plasma png policykit ppds profile python qt3support qt4 quicktime rar readline real samba sdl seccomp semantic-desktop session spell sql sse sse2 ssl startup-notification subtitles svg tcpd tga theora t iff truetype truetypelive type1 udev udisks unicode upower usb v4l v4l2 vaapi vdpau vorbis win32codecs wxwidgets x264 xattr xcb xcomposite xext ximian-connector xinerama xml xml2 xmms xscreensaver xv xvid zlib zvbi" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias perl vdpau proxy_ajp" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python3_4 python2_7" RUBY_TARGETS="ruby20 ruby21" SANE_BACKENDS="genesys" USERLAND="GNU" VIDEO_CARDS="nvidia intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" USE_PYTHON="2.7 3.4" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

— Reply to this email directly or view it on GitHub https://github.com/boundarydevices/imx_usb_loader/issues/29.

johnstile commented 8 years ago

I tried to upgrade my kernel, but it did not fix anything.

There is no problem with repeated simple invocation: ./imx_usb u-boot-mfg.imx

13 seconds after the end of executing: ./imx_usb -c ./ I see the following in dmesg on the workstation: [ 2790.883956] usb 2-1.2.4: USB disconnect, device number 9 [ 2791.608559] usb 2-1.2.4: new high-speed USB device number 10 using ehci-pci [ 2791.717481] usb 2-1.2.4: New USB device found, idVendor=066f, idProduct=37ff [ 2791.717484] usb 2-1.2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 2791.717486] usb 2-1.2.4: Product: Mass Storage Gadget [ 2791.717488] usb 2-1.2.4: Manufacturer: Linux 3.10.53-1.1.1_ga+g1ee4384 with 2184000.usb [ 2791.725699] usb-storage 2-1.2.4:1.0: USB Mass Storage device detected [ 2791.725828] scsi host8: usb-storage 2-1.2.4:1.0 [ 2792.725131] scsi 8:0:0:0: Direct-Access Linux File-CD Gadget 0310 PQ: 0 ANSI: 2 [ 2792.725397] sd 8:0:0:0: Attached scsi generic sg2 type 0 [ 2792.726240] sd 8:0:0:0: [sdb] Sector size 0 reported, assuming 512. [ 2852.709123] INFO: rcu_sched self-detected stall on CPU { 1} (t=15000 jiffies g=155465 c=155464 q=5335) [ 2852.709128] Task dump for CPU 1: [ 2852.709129] kworker/u16:4 R running task 0 80 2 0x00000008 [ 2852.709136] Workqueue: events_unbound async_run_entry_fn [ 2852.709137] ffffffff8203b440 ffff88033e243d68 ffffffff8107e46f 0000000000000001 [ 2852.709139] ffffffff8203b440 ffff88033e243d88 ffffffff8108194d ffff88033e243dc8 [ 2852.709140] 0000000000000002 ffff88033e243db8 ffffffff810ae9f1 ffff88033e256f40 [ 2852.709142] Call Trace: [ 2852.709143] [] sched_show_task+0xaf/0x120 [ 2852.709156] [] dump_cpu_task+0x3d/0x50 [ 2852.709159] [] rcu_dump_cpu_stacks+0x91/0xd0 [ 2852.709160] [] rcu_check_callbacks+0x493/0x780 [ 2852.709163] [] ? update_wall_time+0x26f/0x6b0 [ 2852.709165] [] ? acct_account_cputime+0x1c/0x20 [ 2852.709167] [] update_process_times+0x39/0x60 [ 2852.709169] [] tick_sched_handle.isra.16+0x36/0x50 [ 2852.709170] [] tick_sched_timer+0x44/0x80 [ 2852.709172] [] __run_hrtimer+0x6e/0x1c0 [ 2852.709173] [] ? tick_sched_handle.isra.16+0x50/0x50 [ 2852.709175] [] hrtimer_interrupt+0xf3/0x210 [ 2852.709177] [] local_apic_timer_interrupt+0x3c/0x70 [ 2852.709180] [] smp_apic_timer_interrupt+0x41/0x60 [ 2852.709182] [] apic_timer_interrupt+0x6b/0x70 [ 2852.709183] [] ? string_get_size+0xc0/0x1a0 [ 2852.709187] [] ? string_get_size+0x123/0x1a0 [ 2852.709190] [] sd_revalidate_disk+0x2f8/0x1bf0 [ 2852.709192] [] ? check_preempt_curr+0x5a/0xa0 [ 2852.709194] [] sd_probe_async+0xd5/0x1e0 [ 2852.709195] [] async_run_entry_fn+0x3b/0x100 [ 2852.709197] [] process_one_work+0x14c/0x400 [ 2852.709199] [] worker_thread+0x4b/0x470 [ 2852.709201] [] ? rescuer_thread+0x2e0/0x2e0 [ 2852.709202] [] kthread+0xc9/0xe0 [ 2852.709204] [] ? kthread_create_on_node+0x180/0x180 [ 2852.709206] [] ret_from_fork+0x42/0x70 [ 2852.709207] [] ? kthread_create_on_node+0x180/0x180 Repeats..

I do not see a /dev/sdb created, but one is mentioned in dmesg output. I do not understand what this means, but it does not look like a bug with imx_usb_loader.

johnstile commented 8 years ago

I figured out the problem. imx_usb correctly uploaded and booted the system over Serial Download Protocol. As the Linux kernel initialized the OTG port for Update Transport Protocol, but my Linux workstation workstation used the USB attached SCSI module (uas.ko) and /dev/sd* was not created and kworker went crazy. Another Linux workstation did not have this problem, as it used the sd driver. So a kernel configuration solved it.