Bug 114261

Summary: ath9k-hwrng sometimes using a constant amount of CPU power after resume
Product: Networking Reporter: Gunter Königsmann (gunter)
Component: WirelessAssignee: networking_wireless (networking_wireless)
Status: NEW ---    
Severity: normal CC: ath9k-devel, gunter, linville, miaoqing, tuupic
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.5.0-040500rc7 Subsystem:
Regression: No Bisected commit-id:
Attachments: the output of lspci -v -v
patch

Description Gunter Königsmann 2016-03-10 07:33:08 UTC
Created attachment 208621 [details]
the output of lspci -v -v

On my computer (ubuntu/low latency mainline kernel) after suspending the computter several times sometimes the process ath9k-hwrng starts using 100% of one cpu core. I assume it to be a kernel process and I hope that ath9k is a wireless thing. I know how to compile a kernel and how to apply patches => if you tell me what to debug I will try to do it.

my /proc/version file reads: 
Linux version 4.5.0-040500rc7-lowlatency (kernel@gloin) (gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2) ) #201603061830 SMP PREEMPT Sun Mar 6 23:36:03 UTC 2016


Kind regards,

 Gunter.
Comment 1 miaoqing 2016-03-11 01:47:21 UTC
Always 100% or just for a while ? 

Thanks,
Miaoqing
Comment 2 Gunter Königsmann 2016-03-11 06:32:36 UTC
Seems like it is constant. But I have to apologize: Did misread the output. It definitively is <100%: Am using a Core I7 Ultra Low Voltage (2 Cpus + Hyperthreading) and top tells me it is constant 12,5% that stays constant until ly the accumulator is empty; Am not completely sure if the trigger really is suspending the system, too: Did only realize that this processs is using CPU power because sometimes on my way to work the computer is running out of battery faster than usual - and until now I never encountered the issue when the computer was connected to its power supply at home (and therefore had no need go into suspend mode when I change busses/trains).
Comment 3 Gunter Königsmann 2016-03-13 14:39:44 UTC
This time nearly everything I was convinced to know about this bug when reporting it has proven wrong afterwards: This time the process started using 12,5% CPU even if didn't suspend my computer. What I did was:
 - connecting to my mobile phone using bluetooth
 - started thunderbird
 - started a terminal with top
 - started firefox
Will keep top open in order to investigate further.
Comment 4 miaoqing 2016-03-14 05:12:06 UTC
Created attachment 209021 [details]
patch
Comment 5 miaoqing 2016-03-14 05:13:16 UTC
Try the attached patch,

If no valid ADC randomness output, ath9k rng will continuously reading ADC, which will cause high CPU load. So increase the delay to wait for ADC ready.
Comment 6 Gunter Königsmann 2016-03-15 06:26:00 UTC
This time my last few tries to compile the new kernel for Ubuntu did fail. But I haven't given up and will report my results as soon as I succeed.
Comment 7 Gunter Königsmann 2016-03-15 11:23:04 UTC
Did revert from git to 4.5 hoping that this version will compile.

drivers/net/wireless/ath/ath9k/rng.c: In function ‘ath9k_rng_delay_get’:
drivers/net/wireless/ath/ath9k/rng.c:61:3: error: ‘delay’ undeclared (first use in this function)
   delay = 10;
   ^

Added the following declaration to the function:

  u32 delay;

Let's see if it compiles now.
Comment 8 Gunter Königsmann 2016-03-18 07:13:58 UTC
Good news everyone:
It took more time than I expected until I managed to apply the patch and
to compile and install the kernel. I wanted to apologize for that, again.
But since then I have no more encountered the problem that ath9k-hwrng
uses a considerable amout of CPU power. Normally I encountered the
problem daily until then and normally less than 10 minutes into my
typical work => I am convinced that the patch has solved the problem and
thank you a lot for solving the issue this quick. Is there anything I
need to do before the patch can enter the official kernel?

Kind regards,

 Gunter.
Comment 9 miaoqing 2016-03-18 07:38:59 UTC
Thanks Gunter, I will upstream the patch.