BayLibre / iio-capture

Simple capture and metrics computation tools based on iio-readdev
2 stars 1 forks source link

ERROR: "Device or resource busy" when writing on acme_probe::in_oversampling_ratio #3

Open derkling opened 6 years ago

derkling commented 6 years ago

While using an ACME CAPE for long running experiments, it happens quite frequently that we need to reboot the device because of iio-capture failing to write the in_oversampling_ratio attribute of a device.

Not sure what's the reasons for that problem, maybe it's the driver stuck or this tool sending a wrong sequence of commands.

Have you ever noticed anything similar? If not, which kind of feedback can be useful to debug the issue.

What I can share so fare is that, once the problem occurs and the iio-capture command fails on the HOST side, if I login to the ACME cape and I try a write I still get the same error, e.g.:

± % ssh root@192.168.0.1                                                                                                                                  !10052
root@drk-acme:~# cd /sys/bus/iio/devices/iio:device0
root@drk-acme:/sys/bus/iio/devices/iio:device0# cat in_oversampling_ratio 
4
root@drk-acme:/sys/bus/iio/devices/iio:device0# echo 4 > in_oversampling_ratio
-sh: echo: write error: Device or resource busy
root@drk-acme:/sys/bus/iio/devices/iio:device0# 

The device has these tasks running:

root@drk-acme:/sys/bus/iio/devices/iio:device0# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.7  13168  3908 ?        Ss   Sep21   0:27 /sbin/init
root         2  0.0  0.0      0     0 ?        S    Sep21   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Sep21   0:04 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   Sep21   0:00 [kworker/0:0H]
root         6  0.0  0.0      0     0 ?        S    Sep21   0:00 [kworker/u2:0]
root         7  0.0  0.0      0     0 ?        S    Sep21   0:09 [rcu_sched]
root         8  0.0  0.0      0     0 ?        S    Sep21   0:00 [rcu_bh]
root         9  0.0  0.0      0     0 ?        S    Sep21   0:00 [migration/0]
root        10  0.0  0.0      0     0 ?        S<   Sep21   0:00 [lru-add-drain]
root        11  0.0  0.0      0     0 ?        S    Sep21   0:00 [cpuhp/0]
root        12  0.0  0.0      0     0 ?        S    Sep21   0:00 [kdevtmpfs]
root        13  0.0  0.0      0     0 ?        S<   Sep21   0:00 [netns]
root        15  0.0  0.0      0     0 ?        S    Sep21   0:00 [oom_reaper]
root        16  0.0  0.0      0     0 ?        S<   Sep21   0:00 [writeback]
root        17  0.0  0.0      0     0 ?        S    Sep21   0:00 [kcompactd0]
root        18  0.0  0.0      0     0 ?        S<   Sep21   0:00 [crypto]
root        19  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        20  0.0  0.0      0     0 ?        S<   Sep21   0:00 [kblockd]
root        21  0.0  0.0      0     0 ?        S<   Sep21   0:00 [ata_sff]
root        22  0.0  0.0      0     0 ?        S<   Sep21   0:00 [watchdogd]
root        23  0.0  0.0      0     0 ?        S<   Sep21   0:00 [rpciod]
root        24  0.0  0.0      0     0 ?        S    Sep21   0:00 [kswapd0]
root        25  0.0  0.0      0     0 ?        S<   Sep21   0:00 [vmstat]
root        26  0.0  0.0      0     0 ?        S<   Sep21   0:00 [nfsiod]
root        37  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        38  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        39  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        40  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        41  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        42  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        43  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        44  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        45  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        46  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        47  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        48  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        49  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        50  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        51  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        52  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        53  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        54  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        55  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        56  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        57  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        58  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        59  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        60  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        63  0.0  0.0      0     0 ?        S<   Sep21   0:00 [kpsmoused]
root        64  0.0  0.0      0     0 ?        S    Sep21   0:00 [irq/33-48060000]
root        67  0.0  0.0      0     0 ?        S<   Sep21   0:00 [deferwq]
root        68  0.0  0.0      0     0 ?        S    Sep21   0:23 [irq/159-44e0b00]
root        69  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        70  0.0  0.0      0     0 ?        S    Sep21   0:01 [mmcqd/0]
root        71  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        72  0.0  0.0      0     0 ?        S    Sep21   0:00 [mmcqd/1]
root        73  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        74  0.0  0.0      0     0 ?        S    Sep21   0:00 [mmcqd/1boot0]
root        75  0.0  0.0      0     0 ?        S<   Sep21   0:00 [bioset]
root        76  0.0  0.0      0     0 ?        S    Sep21   0:00 [mmcqd/1boot1]
root        77  4.3  0.0      0     0 ?        R    Sep21 830:25 [irq/160-4802a00]
root        78  0.0  0.0      0     0 ?        S    Sep21   0:00 [irq/161-4819c00]
root        79  0.0  0.0      0     0 ?        S<   Sep21   0:00 [kworker/0:1H]
root        80  0.0  0.0      0     0 ?        S<   Sep21   0:00 [ext4-rsv-conver]
root        81  0.0  0.0      0     0 ?        S<   Sep21   0:00 [ipv6_addrconf]
root        92  0.0  0.7   5668  3808 ?        Ss   Sep21   0:22 /lib/systemd/systemd-journald
root        97  0.0  0.0      0     0 ?        S    Sep21   0:00 [kauditd]
root       100  0.0  0.0      0     0 ?        S    Sep21   0:00 [kworker/u2:2]
root       117  0.0  0.5  10828  2644 ?        Ss   Sep21   0:07 /lib/systemd/systemd-udevd
root       154  0.0  0.3   2720  1568 ?        Ss   Sep21   0:00 /sbin/klogd -n
avahi      155  0.0  0.5   4896  2796 ?        Ss   Sep21   1:06 avahi-daemon: running [drk-acme.local]
message+   157  0.0  0.5   4424  2740 ?        Ss   Sep21   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
avahi      158  0.0  0.3   4896  1612 ?        S    Sep21   0:00 avahi-daemon: chroot helper
systemd+   160  0.0  0.5   3360  2508 ?        Ss   Sep21   0:04 /lib/systemd/systemd-networkd
root       161  0.0  0.2   2192  1460 ttyO0    Ss+  Sep21   0:00 /sbin/agetty -8 -L ttyO0 115200 xterm
root       162  0.0  0.3   2784  1548 ?        Ss   Sep21   0:01 /sbin/syslogd -n -C
root       163  0.0  0.3   2192  1512 tty1     Ss+  Sep21   0:00 /sbin/agetty --noclear tty1 linux
root       175  0.0  2.5  15704 12692 ?        Ss   Sep21   6:08 python3 /usr/bin/pyacmed
systemd+   177  0.0  0.4   3704  2396 ?        Ss   Sep21   0:04 /lib/systemd/systemd-resolved
root       193  0.0  0.4   2764  1988 ?        Ss   Sep21   0:00 /bin/sh /usr/bin/acme-usbgadget-udhcpd
root       200  0.0  0.3   2720  1744 ?        S    Sep21   0:00 udhcpd -f /etc/udhcpd.conf
root       205  0.0  0.3   2192  1584 ttyGS1   Ss+  Sep21   0:00 /sbin/agetty -8 -L ttyGS1 115200 xterm
root       206  0.0  0.3   2192  1584 ttyGS0   Ss+  Sep21   0:00 /sbin/agetty -8 -L ttyGS0 115200 xterm
root      3260  0.3  0.0      0     0 ?        S    Oct03   5:33 [kworker/0:1]
root      5195 12.4  0.0      0     0 ?        D    Oct03 138:58 [ina226:0-8800us]
root      5199 12.4  0.0      0     0 ?        D    Oct03 138:58 [ina226:1-8800us]
root      6692  0.0  0.7   4912  3624 ?        Ss   13:06   0:00 sshd: root@pts/0
root      6694  0.0  0.6   3628  2988 pts/0    Ss   13:06   0:00 -sh
root      6707  5.0  0.2   2720  1424 pts/0    D+   13:20   7:21 grep  in_active in_allow_async_readout in_current3_raw in_current3_scale in_oversampling_ratio in_power2_raw in_power2_scale in_sampling_frequency in_shunt_resistor in_voltage0_integration_time in_voltage0_raw in_voltage0_scale in_voltage1_integration_time in_voltage1_raw in_voltage1_scale
root      6821  0.0  0.0      0     0 ?        S    15:31   0:00 [kworker/0:0]
root      6855  0.0  0.0      0     0 ?        S    15:44   0:00 [kworker/0:2]
root      6858  0.2  0.7   4912  3504 ?        Ss   15:46   0:00 sshd: root@pts/1
root      6860  0.5  0.6   3728  3020 pts/1    Ss   15:46   0:00 -sh
root      6875  0.0  0.3   3028  1656 pts/1    R+   15:47   0:00 ps aux
root@drk-acme:/sys/bus/iio/devices/iio:device0# 

As you can notice there is a "dead" grep (pid: 6707) for all the attributes of a device... which I don't where it comes from and I suppose it's part of the device-side of iio-capture.

Is there any other information I can provide to track down this issue?

superna9999 commented 6 years ago

Hi,

Yes we had such behaviour but we still need to investigate further.

Thanks for the details

derkling commented 6 years ago

No updates on this issue?

brgl commented 6 years ago

@derkling I'm trying to reproduce your issue, but I haven't been successful so far. What is your setup exactly? How many probes are connected and what parameters do you pass over to iio-capture? How long does it need to run usually before it causes the issue?