Author Topic: 3.4.75+ kernel for CB2 and CT  (Read 138592 times)

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
3.4.75+ kernel for CB2 and CT
« on: January 08, 2014, 11:01:13 pm »
I've uploaded a build of the 3.4.75 kernel that runs on both the Cubieboard2 and Cubietruck.  It's merged from the linux-sunxi/sunxi-3.4 branch of about December 23rd, and includes the Broadcom driver from Benn's 3.4.67 kernel (sunxi-3.4-ct-v101): http://dl.cubieforums.com/patwood/A20-kernel-3.4.75.tar.gz.  Edit: the kernel no longer contains the "-ct" in its name.

The git repository is here: https://github.com/patrickhwood/linux-sunxi/tree/pat-3.4.75.  Edit: the repo branch no longer contains the "-ct" in its name.

Edit: I've uploaded new kernels for the A10 and A20: http://dl.cubieforums.com/patwood/A10-kernel-3.4.79.tar.gz and  http://dl.cubieforums.com/patwood/A20-kernel-3.4.79.tar.gz.  They were built from this repo: https://github.com/patrickhwood/linux-sunxi/tree/pat-3.4.79.  See the posting later on in this thread for more information.

What's working:

Gbit ethernet and wifi on CT (put bcmdhd in /etc/modules to auto load the driver)
100Mbit ethernet on CB2
CedarX
Mali
USB OTG (and g_ether)
GPIO, LED, all the other usual stuff

Note: sunxi-gmac and sunxi-emac are built in and don't need to be loaded on boot from /etc/modules.  Also, all the modules from my earlier kernels are still there, but most have not been tested on the CT.

What's not working:

Bluetooth on CT (maybe it is, but I can't get brcm_patchram_plus to cooperate). Edit: fixed, but doesn't always load the firmware consistently.
8192cu driver refuses to load on the CT (works fine on CB2).

What's next:

1. updating the Broadcom driver to the latest version.
2. updating the branch to the latest stage/sunxi-3.4 version. Edit: merged 3.4.79 kernel uploaded.
3. put together a single cubiuntu distro for CB2 and CT. Edit: new dual-boot Cubiuntu distro uploaded.
« Last Edit: February 12, 2014, 11:08:13 pm by patwood »

Offline slovenia

  • Hero Member
  • *****
  • Posts: 510
  • Karma: +47/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #1 on: January 09, 2014, 02:23:19 am »
Note: sunxi-gmac and sunxi-emac are built in and don't need to be loaded on boot from /etc/modules.  Also, all the modules from my earlier kernels are still there, but most have not been tested on the CT.

What's not working:

Bluetooth on CT (maybe it is, but I can't get brcm_patchram_plus to cooperate).
8192cu driver refuses to load on the CT (works fine on CB2).

What's next:

1. updating the Broadcom driver to the latest version.
2. updating the branch to the latest stage/sunxi-3.4 version.
3. put together a single cubiuntu distro for CB2 and CT.

I tested compiled and self compiled but in both cases there is a load 1+ and CPU is staying at full speed. The other things was trying to run Wifi in AP mode but still no luck. Same error as in 3.4.61+

There must be something conflicting in kernel.config ... with default settings (and minor changes) there is no high load.
 
Tnx!
« Last Edit: January 09, 2014, 02:33:26 am by slovenia »
Debian and Ubuntu images with kernel 3.4.110, 4.3.3, 4.4
http://www.armbian.com

Offline cubieplayer

  • Full Member
  • ***
  • Posts: 177
  • Karma: +22/-1
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #2 on: January 09, 2014, 04:17:37 am »
I've uploaded a build of the 3.4.75 kernel that runs on both the Cubieboard2 and Cubietruck.  It's merged from the linux-sunxi/sunxi-3.4 branch of about December 23rd, and includes the Broadcom driver from Benn's 3.4.67 kernel (sunxi-3.4-ct-v101): http://dl.cubieforums.com/patwood/A20-kernel-3.4.75-ct.tar.gz

The git repository is here: https://github.com/patrickhwood/linux-sunxi/tree/pat-3.4.75-ct

What's working:

Gbit ethernet and wifi on CT (put bcmdhd in /etc/modules to auto load the driver)
100Mbit ethernet on CB2
CedarX
Mali
USB OTG (and g_ether)
GPIO, LED, all the other usual stuff

Note: sunxi-gmac and sunxi-emac are built in and don't need to be loaded on boot from /etc/modules.  Also, all the modules from my earlier kernels are still there, but most have not been tested on the CT.

What's not working:

Bluetooth on CT (maybe it is, but I can't get brcm_patchram_plus to cooperate).
8192cu driver refuses to load on the CT (works fine on CB2).

What's next:

1. updating the Broadcom driver to the latest version.
2. updating the branch to the latest stage/sunxi-3.4 version.
3. put together a single cubiuntu distro for CB2 and CT.

Good work.
Cubian:http://cubian.org/ Cubian  Helpdesk:https://github.com/cubieplayer/Cubian/issues

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #3 on: January 09, 2014, 10:14:28 am »
Read this topic: http://www.cubieforums.com/index.php/topic,1084.0.html

The loadavg > 1 is due to polling  (once per second) of the USB otg port and can be disabled in the fex file.  Note that this does not mean the CPU is running 100%. It just means there's a kernel thread sleeping on the run queue.  You need to look at /proc/stat for run/idle info.

Edit: Just to be clear, the loadavg > 1 caused by the OTG driver is *not* consuming CPU:

Code: [Select]
root@linaro-ubuntu-desktop:/proc# cat /proc/uptime
3664.22 7063.42
root@linaro-ubuntu-desktop:/proc# cat /proc/loadavg
1.00 1.02 1.00 1/211 1861
root@linaro-ubuntu-desktop:/proc# grep cpu stat
cpu  8502 0 2885 701317 3123 0 11779 0 0 0
cpu0 4811 0 1615 341729 2472 0 11759 0 0 0
cpu1 3691 0 1270 359588 651 0 20 0 0 0

According to the /proc/stat, the CPU was in use about 1.6% of the time over approximately one hour (8502+2885)/701317.

« Last Edit: January 09, 2014, 12:12:52 pm by patwood »

dandreoletti

  • Guest
Re: 3.4.75+ kernel for CB2 and CT
« Reply #4 on: January 09, 2014, 11:08:43 am »
I've uploaded a build of the 3.4.75 kernel that runs on both the Cubieboard2 and Cubietruck.  It's merged from the linux-sunxi/sunxi-3.4 branch of about December 23rd, and includes the Broadcom driver from Benn's 3.4.67 kernel (sunxi-3.4-ct-v101): http://dl.cubieforums.com/patwood/A20-kernel-3.4.75-ct.tar.gz

The git repository is here: https://github.com/patrickhwood/linux-sunxi/tree/pat-3.4.75-ct

What's working:

Gbit ethernet and wifi on CT (put bcmdhd in /etc/modules to auto load the driver)
100Mbit ethernet on CB2
CedarX
Mali
USB OTG (and g_ether)
GPIO, LED, all the other usual stuff

Note: sunxi-gmac and sunxi-emac are built in and don't need to be loaded on boot from /etc/modules.  Also, all the modules from my earlier kernels are still there, but most have not been tested on the CT.

What's not working:

Bluetooth on CT (maybe it is, but I can't get brcm_patchram_plus to cooperate).
8192cu driver refuses to load on the CT (works fine on CB2).

What's next:

1. updating the Broadcom driver to the latest version.
2. updating the branch to the latest stage/sunxi-3.4 version.
3. put together a single cubiuntu distro for CB2 and CT.

Can you post .config file used to compile the kernel/modules please ?

Happy New Year btw :)

Offline slovenia

  • Hero Member
  • *****
  • Posts: 510
  • Karma: +47/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #5 on: January 09, 2014, 11:18:40 am »
I know about that USB otg issue. I though I already disable it by default. Sorry to bringing up the false alarm  :P

After disabling it the load drop but CPU stayed at 1GHz due to performance governor I guess. Which governor is right is probably hard to say - depend of what you do with the board. What about to include /I will for myself "ondemand"? It goes up and down with CPU freq if there is/there is no activity.

I was checking with cpufreq-info.
Debian and Ubuntu images with kernel 3.4.110, 4.3.3, 4.4
http://www.armbian.com

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #6 on: January 09, 2014, 12:06:35 pm »
I know about that USB otg issue. I though I already disable it by default. Sorry to bringing up the false alarm  :P

After disabling it the load drop but CPU stayed at 1GHz due to performance governor I guess. Which governor is right is probably hard to say - depend of what you do with the board. What about to include /I will for myself "ondemand"? It goes up and down with CPU freq if there is/there is no activity.

I was checking with cpufreq-info.

I removed ondemand and made performance the default governor for a couple of reasons:

1. To reduce boot times, the default governor should be performance.  This will ensure that the cpu runs at max speed during boot.  I've measured 10-20% faster boot times with the performance governor (depending on whether you spend a lot of time idle waiting for the network to come up).

2. The cpufreq utils package (or at least the one I installed from the ubuntu archives: cpufrequtils_008-1_armhf.deb) includes a startup file called cpufrequtils that sets ondemand as the default governor on entering run level 2.  If you don't like ondemand and its default settings, this really stinks (see the next item).

3.The default settings for ondemand really suck -- for me, mplayer sound was out of sync with the video until I changed the min freq; bluetooth audio would underrun; various network problems were blamed on low CPU speeds and/or slow response to CPU utilzation (not that this was actually proven one way or the other IMO).  ondemand should never be the default governor on a cubieboard without tuning it to set things like io_is_busy, min_freq, etc., which a lot of users/distros don't do.  This just leads to people whining about poor performance.

4. This thread shows minimal power savings on an A20 *at idle* with ondemand vs. fixed freq at 60mhz vs 912mhz: https://groups.google.com/forum/?fromgroups=#!topic/linux-sunxi/SVZDqag7J_g
Of course, power consumption goes up more if both cores are 100% at 912mhz, but all the governors will move the cpu frequency up eventually on full consumption.  This thread also proposes removing it from the defconfig and I agree.
5. Turns out interactive is a much better governor than ondemand, and was designed to deal with the latency problems ondemand has.  It apparently comes from the android project: https://lkml.org/lkml/2012/2/7/483 I'd suggest using that one instead of ondemand if you feel the cpu frequency should go down on idle (but note that based on the power consumption tests on the sunxi mailing list, the cpu won't use very much less power or be much cooler at idle regardless of the CPU speed or the governor).

Feel free to do whatever you want, but I'm not going to be building kernels with ondemand any more.

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #7 on: January 09, 2014, 12:08:36 pm »
Can you post .config file used to compile the kernel/modules please ?

Happy New Year btw :)

It's in the kernel archive as boot/config.3.4.75-sun7i+; this is the case for every kernel I upload, in case you don't want to bother booting it just to grab /proc/config.gz.

Offline slovenia

  • Hero Member
  • *****
  • Posts: 510
  • Karma: +47/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #8 on: January 09, 2014, 12:57:59 pm »
I know about that USB otg issue. I though I already disable it by default. Sorry to bringing up the false alarm  :P

After disabling it the load drop but CPU stayed at 1GHz due to performance governor I guess. Which governor is right is probably hard to say - depend of what you do with the board. What about to include /I will for myself "ondemand"? It goes up and down with CPU freq if there is/there is no activity.

I was checking with cpufreq-info.

I removed ondemand and made performance the default governor for a couple of reasons:

1. To reduce boot times, the default governor should be performance.  This will ensure that the cpu runs at max speed during boot.  I've measured 10-20% faster boot times with the performance governor (depending on whether you spend a lot of time idle waiting for the network to come up).

2. The cpufreq utils package (or at least the one I installed from the ubuntu archives: cpufrequtils_008-1_armhf.deb) includes a startup file called cpufrequtils that sets ondemand as the default governor on entering run level 2.  If you don't like ondemand and its default settings, this really stinks (see the next item).

3.The default settings for ondemand really suck -- for me, mplayer sound was out of sync with the video until I changed the min freq; bluetooth audio would underrun; various network problems were blamed on low CPU speeds and/or slow response to CPU utilzation (not that this was actually proven one way or the other IMO).  ondemand should never be the default governor on a cubieboard without tuning it to set things like io_is_busy, min_freq, etc., which a lot of users/distros don't do.  This just leads to people whining about poor performance.

4. This thread shows minimal power savings on an A20 *at idle* with ondemand vs. fixed freq at 60mhz vs 912mhz: https://groups.google.com/forum/?fromgroups=#!topic/linux-sunxi/SVZDqag7J_g
Of course, power consumption goes up more if both cores are 100% at 912mhz, but all the governors will move the cpu frequency up eventually on full consumption.  This thread also proposes removing it from the defconfig and I agree.
5. Turns out interactive is a much better governor than ondemand, and was designed to deal with the latency problems ondemand has.  It apparently comes from the android project: https://lkml.org/lkml/2012/2/7/483 I'd suggest using that one instead of ondemand if you feel the cpu frequency should go down on idle (but note that based on the power consumption tests on the sunxi mailing list, the cpu won't use very much less power or be much cooler at idle regardless of the CPU speed or the governor).

Feel free to do whatever you want, but I'm not going to be building kernels with ondemand any more.

I didn't knew that this governor is that poor and inefficient. I am convinced not to use ondemand never ever on this board :) I will try if interactive between 500-1000 makes a good choice.

Thank you for explanation.
Debian and Ubuntu images with kernel 3.4.110, 4.3.3, 4.4
http://www.armbian.com

Offline neo9

  • Newbie
  • *
  • Posts: 29
  • Karma: +3/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #9 on: January 09, 2014, 01:48:56 pm »
This kernel is working great on my CT with Debian as root-fs on ssd. Direct drop-in. Thanks for your work!

Rearding bluetooth not working on CT:
I believe we need the module hci_uart compiled and loaded to get the bt-firmware written to the chip.

On this 3.4.75 kernel i see:
Code: [Select]
~ zgrep HCIUART /proc/config.gz
# CONFIG_BT_HCIUART is not set

The only time i got brcm_patchram_plus to work properly was with a kernel that had that option enabled.
Just a thought though.
Cubietruck / Patwood 3.4.75-sun7i+ #55 / Debian Jessie

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #10 on: January 09, 2014, 02:01:30 pm »
This kernel is working great on my CT with Debian as root-fs on ssd. Direct drop-in. Thanks for your work!

Rearding bluetooth not working on CT:
I believe we need the module hci_uart compiled and loaded to get the bt-firmware written to the chip.

On this 3.4.75 kernel i see:
Code: [Select]
~ zgrep HCIUART /proc/config.gz
# CONFIG_BT_HCIUART is not set

The only time i got brcm_patchram_plus to work properly was with a kernel that had that option enabled.
Just a thought though.

Thanks for catching that!  I'll give it a try tonight.

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #11 on: January 09, 2014, 02:18:56 pm »
I didn't knew that this governor is that poor and inefficient. I am convinced not to use ondemand never ever on this board :) I will try if interactive between 500-1000 makes a good choice.

Thank you for explanation.

I don't know about saying "never"; there may be some situation where ondemand makes sense, I just haven't come up with one.

Although it's not proven (yet), Hans de Goede from Redhat believes that 408mhz is a good minimum (and the power usage at full CPU utilization backs this up).  In his commit message for 47d3b18876571835f0fce7b7b8125110713e30fc (where he's attempting to improve ondemand) he mentions a couple of interesting things:

Quote
    ... 408 MHz, which is the last
    speed at which the cpu runs at its lowest voltage of 1.0 volt.

and

Quote
    I would like to advocate people to try out 408 Mhz instead,
    which not only makes the interactive feel of the device a lot better, it
    likely also *saves* power since it will cause the cpu to reach an idle
    state quicker, which will allow it to power down entire blocks, thus stopping
    the constant (non speed dependent) leakage current of those blocks sooner,
    while using aprox. the same amount of power to do the work (it uses more
    power due to the higher clock, but does the work proportionally faster,
    resulting in aprox. the same power use). This is the so called race to idle
    trick.

I'm not sure about the second part, but he's spent a lot more time looking at this stuff than I have.

Offline slovenia

  • Hero Member
  • *****
  • Posts: 510
  • Karma: +47/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #12 on: January 09, 2014, 03:03:35 pm »
I don't know about saying "never"; there may be some situation where ondemand makes sense, I just haven't come up with one.

Sure. I figured out for my phone that ondemand is a good solution with a minimum freq set to the middle and it mostly stays there (rest of course in deep sleep), because it's enough for basic routine operations.

My case with CT is running a server where is also nice that it reacts promptly which I understand is not the case with ondemand governor. Power consumption is anyway low enough to ignore it.

Although it's not proven (yet), Hans de Goede from Redhat believes that 408mhz is a good minimum (and the power usage at full CPU utilization backs this up).  In his commit message for 47d3b18876571835f0fce7b7b8125110713e30fc (where he's attempting to improve ondemand) he mentions a couple of interesting things:

    ... 408 MHz, which is the last
    speed at which the cpu runs at its lowest voltage of 1.0 volt.

I came to (around) half speed by intuition and I am happy to get close to some measurements / facts or some other experts believes. I don't have proper equipment and/or will to do the study.

Quote
    I would like to advocate people to try out 408 Mhz instead,
    which not only makes the interactive feel of the device a lot better, it
    likely also *saves* power since it will cause the cpu to reach an idle
    state quicker, which will allow it to power down entire blocks, thus stopping
    the constant (non speed dependent) leakage current of those blocks sooner,
    while using aprox. the same amount of power to do the work (it uses more
    power due to the higher clock, but does the work proportionally faster,
    resulting in aprox. the same power use). This is the so called race to idle
    trick.

I'm not sure about the second part, but he's spent a lot more time looking at this stuff than I have.

Finding "the ultimate number" is interesting. But ... ::)
Debian and Ubuntu images with kernel 3.4.110, 4.3.3, 4.4
http://www.armbian.com

Offline patwood

  • Linux geek
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1660
  • Karma: +129/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #13 on: January 09, 2014, 03:29:52 pm »
I came to (around) half speed by intuition and I am happy to get close to some measurements / facts or some other experts believes. I don't have proper equipment and/or will to do the study.

Finding "the ultimate number" is interesting. But ... ::)

But who has the time, eh?

Offline uwe

  • Newbie
  • *
  • Posts: 25
  • Karma: +6/-0
    • View Profile
Re: 3.4.75+ kernel for CB2 and CT
« Reply #14 on: January 09, 2014, 05:38:29 pm »
Thank you patwood!

Is use now your 3.4.75 kernel with btrfs on my cubietruck nas. The system is stable. I cross compiled it in my virtual environment and transferred it to sd-card.
Code: [Select]
root@cubietruck:~# uname -a
Linux cubietruck 3.4.75 #1 SMP PREEMPT Thu Jan 9 22:46:43 CET 2014 armv7l armv7l armv7l GNU/Linux

Best regards
Uwe