colonelpanic
Posts: 2
Joined: Tue Apr 24, 2018 8:39 pm

High CPU usage when booting from USB

Tue Apr 24, 2018 9:42 pm

Ever since I set my pi up to boot from a USB flash drive, the system has been pegging the cpu at right around 0.25 24/7.

To troubleshoot I performed:

Code: Select all

echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event
cat /sys/kernel/debug/tracing/trace_pipe > out.txt
and see a stream of entries for:

Code: Select all

kworker/1:2-65    [001] d...   296.694258: workqueue_queue_work: work struct=b9ff9878 function=set_brightness_delayed workqueue=b9c06300 req_cpu=4 cpu=1
Additionally, running:

Code: Select all

 watch -n1 -d cat /proc/interrupts
shows lots of constant interrupts for the line:

Code: Select all

62:     186502          0          0          0  ARMCTRL-level  64 Edge      dwc_otg, dwc_otg_pcd, dwc_otg_hcd:usb1
The kworker in the first column of the workqueue output is the same as the worker taxing the CPU, but I do not know how to troubleshoot further as I have found no other information on what the other fields mean. What brightness is being set? How can I stop this?

Additional info:
I am running a fully patched (including firmware) Raspbian Lite 9.4 system.
I do not have a GUI installed.
I am using this as a Pi-Hole and OpenVPN host.
This issue does not happen when booting the same system from the SD card.

wh7qq
Posts: 922
Joined: Thu Oct 09, 2014 2:50 am

Re: High CPU usage when booting from USB

Wed Apr 25, 2018 1:34 am

Using htop on my B+ pi-hole, it is running at less than 5% pretty constantly. It is headless but otherwise a stock Raspbian (full) distro. That would seem to point at the openVPN hosting application or something it runs.
Sent by WH7QQ from an RPi3/Raspbian/pixel desktop.

colonelpanic
Posts: 2
Joined: Tue Apr 24, 2018 8:39 pm

Re: High CPU usage when booting from USB

Wed Apr 25, 2018 12:10 pm

The issue is resolved when I boot from the SD card instead. The filesystem on the USB is unchanged, but simply booting from SD instead of USB solves the problem. Something about booting from USB is triggering a lot of interrupt requests.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 19311
Joined: Sat Jul 30, 2011 7:41 pm

Re: High CPU usage when booting from USB

Wed Apr 25, 2018 1:26 pm

colonelpanic wrote:
Wed Apr 25, 2018 12:10 pm
The issue is resolved when I boot from the SD card instead. The filesystem on the USB is unchanged, but simply booting from SD instead of USB solves the problem. Something about booting from USB is triggering a lot of interrupt requests.
When you boot from SD card do you still have the USB drive attached?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

fanoush
Posts: 315
Joined: Mon Feb 27, 2012 2:37 pm

Re: High CPU usage when booting from USB

Wed Apr 25, 2018 6:20 pm

Not sure if it is the same thing but when booting from usb and having system being idle I saw kworker 2:0 and 2:2 eating about 8-10% CPU always one or the other, not both at once. Also I noticed green led blinking periodically. What stopped it was inserting microsd card! Then it stopped and both kworkers went down to 0% and green led blinking stopped. Below it can be seen both have quite high time consumed in total after 15 minutes system uptime.

Code: Select all

 1035 root       20   0     0     0     0 I  0.0  0.0  0:00.07 ├─ kworker/0:1
 1034 root       20   0     0     0     0 I  0.0  0.0  0:16.85 ├─ kworker/2:0
  739 root       10 -10     0     0     0 S  0.0  0.0  0:00.00 ├─ krfcommd
 ...
   65 root      -51   0     0     0     0 S  0.0  0.0  0:00.17 ├─ irq/92-mmc1
   64 root       20   0     0     0     0 I  0.0  0.0  0:41.24 ├─ kworker/2:2
   63 root       10 -10     0     0     0 S  0.0  0.0  0:00.00 ├─ SMIO
  
EDIT:
after inserting microsd it got mounted under /media/pi/boot,root automatically so after ejecting/unmounting via taskbar applet I tried to remove the card again and once the card was physically removed the green led blinking started again and one of kworker/2:x started eating cpu again. And this time it was kworker 2:1

Code: Select all

2427 root       20   0     0     0     0 I  0.0  0.0  0:00.08 ├─ kworker/0:2
 2426 root       20   0     0     0     0 R 11.2  0.0  0:02.91 ├─ kworker/2:1
 2412 root       20   0     0     0     0 I  0.0  0.0  0:00.17 ├─ kworker/0:1
 
So it looks like it checks for card insertion periodically? or something tries to touch /dev/mmcblk0pX devices?

jerrm
Posts: 13
Joined: Wed May 02, 2018 7:35 pm

Re: High CPU usage when booting from USB

Thu May 03, 2018 2:28 am

I am seeing the same behavior.

Minimal Stretch-Lite install from latest image, no GUI, nothing extra installed.

USB Boot without SD card and a kworker thread stays at 8-10%.

USB Boot with blank SD card installed - no kworker utilization.

jerrm
Posts: 13
Joined: Wed May 02, 2018 7:35 pm

Re: High CPU usage when booting from USB

Mon May 14, 2018 7:32 pm

Has anyone else seen this CPU utilization behavior?

It seems surprising more haven't complained, but the utilization may be hidden in some "top" programs (htop at least) unless they are set to view kernel threads.

The Heisenberg principle sometimes applies to CPU monitoring, but the kworker utilization seems consistent and repeatable. The kworker thread does not give up it's CPU usage even when the system is maxed out under sysbench, memtester, or other similar.

Doesn't seem like we should need to buy an SD card just to get full performance if USB booting.

odoy
Posts: 1
Joined: Wed May 16, 2018 1:51 pm

Re: High CPU usage when booting from USB

Wed May 16, 2018 2:05 pm

same here. thx for the hint with the empty sd card.

Return to “Troubleshooting”

Who is online

Users browsing this forum: bob_binz, epoch1970, gkaiseril, leptonfarm, WebMaximus and 10 guests