Solved AMD G 4GB RAM slow - can I fix?

FreeBSD 10.1 runs Firefox 34.0.5 slow on X / Fluxbox on my Xi3 "Z3ro Pro" with it's 1.65GHz dual–core AMD G–series processor, Radeon HD 6320 GPU with 80 programmable cores, 4GB of DDR3 RAM and 32GB – 512GB mSATA SSD.

Can someone please tell me if this is expected or do I need to tweak? Install kernel modules? Remove kernel modules? Set some parameters?

I think I was on FreeBSD 9.1 on my very old machine and it was fine but FreeBSD 10.1 saw a big jump in version for Firefox and now on this new machine sometimes clicks aren't recognised, mouse gets stuck, and a fair bit of waiting involved while Firefox gets it together to process the click and render a new tab or whatever. Same when running Chrome. It's not Firefox per se.

Code:
# uname -a
FreeBSD engine.local 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC

I know this is a low power cool and quiet processor. I wasn't expecting blazing fast but I figured dual core, 1.6 GHz, 4 GB RAM with Radeon GPU suitable for multi-display signage wouldn't have a problem with one X desktop?

I am also running a wireless network and bluetooth for my keyboard using USB sticks. I wondered if it's possible these are taking CPU or RAM and slowing things down a bit?

Some of dmesg:
Code:
CPU: AMD G-T56N Processor (1646.53-MHz K8-class CPU)
  Origin = "AuthenticAMD"  Id = 0x500f20  Family = 0x14  Model = 0x2  Stepping = 0
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802209<SSE3,MON,SSSE3,CX16,POPCNT>
  AMD Features=0x2e500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM>
  AMD Features2=0x35ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,IBS,SKINIT,WDT>
  TSC: P-state invariant, performance statistics
real memory  = 4294967296 (4096 MB)
avail memory = 3685003264 (3514 MB)
Event timer "LAPIC" quality 400
ACPI APIC Table: <Xi3 Z3RO-PRO>
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
 
That processor is rated only 802 on the Passmark, but it should be okay for a lightweight X desktop. An unresponsive mouse would more likely be a driver problem. Are all the installed X applications up to date? Does pkg check -Ba report any problems? Please show your xorg.conf (if there is one) and post /var/log/Xorg.0.log on some accessible site like www.pastebin.com.
 
What driver is used for Xorg? If it's the vesa(4) driver that might explain the slowness too. That driver uses quite a lot of CPU and you're in short supply as it is.

While testing, try to open a terminal window and run top(1). If Firefox stalls have a look at the output to see where it's busy.
 
Thanks wblock and SirDice.

The mouse has delayed response at times. So I drag, but the pointer stays for a second or two and then jumps to catch up. I think this may be worse during long running big scp operations, hence I suspect the wireless network management may be sucking CPU? The mouse also fails to register a click sometimes. I need to click again.

But I don't think it's just the mouse. Firefox 'new tab' operations take longer than I'm used to on other platforms. Page rendering may take longer, I'm not sure. I just feel like I moving through syrup and have to carefully click and wait step by step.

My packages appear to be up to date. Even from fresh 10.1, when it first came out, there were some updates required which caught me out until I realised. Then there was some argy-bargy with particular libraries which required a delete and re-install to fix. It all looks 100% now (I don't use Opera). I'm happy to re-install the latest FreeBSD if that may help. I'm wondering if cutting down the GENERIC kernel will save cycles?

I played with xorg.conf for a while until the auto option started working which was better than what I had, so I went with it. There's nothing in /etc/X11 now. I was trying to load "glx" module and was using Option "device" "/dev/sysmouse" with my mouse input device. My screen device section was using Driver "radeon" but I'm not sure it was working.

My /var/log/Xorg.0.log features text including "ati", "radeon" and "vesa" but I don't know the significance or how to read it. http://pastebin.com/qibDHBpb

Code:
# pkg check -Ba
Checking all packages:  63%
(opera-12.16_5) /usr/local/lib/opera/gstreamer/plugins/libgstoperamatroska.so - required shared library libxml2.so.5 not found
(opera-12.16_5) /usr/local/lib/opera/gstreamer/plugins/libgstoperavp8.so - required shared library libxml2.so.5 not found
(opera-12.16_5) /usr/local/lib/opera/liboperagtk2.so - required shared library libfreetype.so.9 not found
(opera-12.16_5) /usr/local/lib/opera/liboperakde4.so - required shared library libkdeui.so.7 not found
(opera-12.16_5) /usr/local/lib/opera/liboperakde4.so - required shared library libkio.so.7 not found
(opera-12.16_5) /usr/local/lib/opera/liboperakde4.so - required shared library libkdecore.so.7 not found
(opera-12.16_5) /usr/local/lib/opera/opera - required shared library libfreetype.so.9 not found
Checking all packages: 100%

I'm going to be watching with top but I'm wondering how to find out what's required to force the right drivers and modules for Xorg and the kernel to suit my hardware?

I'm also thinking whether I should give up on my rather nice bluetooth keyboard and move to USB wired, if indeed bluetooth takes clock cycles. I can't change the wireless network USB stick because FreeBSD doesn't support my built in ethernet hardware right now. I'd consider buying another machine if it's not too bulky. My Z3ro mounts on the back of the monitor and is quiet and cool so doesn't disturb others. My previous machine would wake people up when I booted late at night :).
 
X is using the right drivers (radeon for video, and the standard sysmouse for the mouse). Detecting the hardware is usually not a problem, and wireless networking, including Bluetooth, should not be any serious drain on the CPU. Are you using a lightweight window manager? Is display compositing enabled?
 
Please try to switch off powerd for a test ( sudo /etc/rc.d/powerd onestop). I have hardware which behaves very strange when all cores enter the C3 sleep state, because they can not wake up in time to do some interrupt processing. You would need to set the lowest _cx value for one core to maybe C1, or whatever has a low enough latency. So if that step helps you, try setting these values explicitly.
 
True, powerd(8) can make a machine slow to react to interactive use. With these flags, it is not a problem on my systems:
Code:
powerd_flags="-a hadp -n hadp -p50"
 
wblock@, the problem I have there is not with frequency scaling but with the sleep states. Some cores have a long latency when shifting from the deeper C-states up, and that is were interrupts can be lost. At least it looks like that. Manually setting one core to a different lower bound by using sysctl dev.cpu.0.cx_lowest=C1 (f.e.) usually does the trick.
 
Last edited by a moderator:
Thanks Crivens, I did some research on powerd. I'm not sure I want it as I have a low power CPU anyway. I'm not actually running powerd. I think I must have declined it on install.
Code:
# ps aux | grep power
root  1213  0.0  0.1  18820  2244  1  S+  12:15AM  0:00.00 grep -i --color power
#

I didn't like the look of ACPI, either, for my purposes: http://www.pc-freak.net/blog/how-to-disable-acpi-power-saving-support-in-freebsd-disable-acpi-on-bsd-kernel-boot-time/. But it doesn't appear to be running either:
Code:
# kldstat
Id Refs Address  Size  Name
 1  67 0xffffffff80200000 1755658  kernel
 2  1 0xffffffff81956000 254d8  if_run.ko
 3  1 0xffffffff8197c000 51a8  ubtbcmfw.ko
 4  1 0xffffffff81a11000 538a  fdescfs.ko
 5  1 0xffffffff81a17000 4e82  ng_ubt.ko
 6  5 0xffffffff81a1c000 b998  netgraph.ko
 7  1 0xffffffff81a28000 9397  ng_hci.ko
 8  3 0xffffffff81a32000 1076  ng_bluetooth.ko
 9  1 0xffffffff81a34000 357f  ums.ko
10  1 0xffffffff81a38000 2b58  uhid.ko
11  1 0xffffffff81a3b000 c32c  ng_l2cap.ko
12  1 0xffffffff81a48000 1a653  ng_btsocket.ko
13  1 0xffffffff81a63000 3821  ng_socket.ko
14  1 0xffffffff81a67000 73e9  vkbd.ko
15  1 0xffffffff81a6f000 9f2  green_saver.ko
16  1 0xffffffff81a70000 11a57a  radeonkms.ko
17  1 0xffffffff81b8b000 47f80  drm2.ko
18  4 0xffffffff81bd3000 1ff2  iicbus.ko
19  1 0xffffffff81bd5000 1a46  iic.ko
20  1 0xffffffff81bd7000 1e48  iicbb.ko
21  1 0xffffffff81bd9000 18f0  radeonkmsfw_PALM_pfp.ko
22  1 0xffffffff81bdb000 1ce8  radeonkmsfw_PALM_me.ko
23  1 0xffffffff81bdd000 1369  radeonkmsfw_SUMO_rlc.ko

I'm going to research the greensaver.ko module in case I can ditch that.

I'm using fluxbox as I thought that was a light desktop.I don't run any desktop clutter. I don't think I run a compositor. My terminals fake transparency by using the root image.

I guess I'll keep watching top for information although it's usually firefox at the top. I think I have learned that I'm not doing anything very wrong and there's nothing I can really tune to help. This might just be life with the AMD G CPU.
 
There is a big difference in performance between adaptive and the hiadaptive mode using powerd(8). Especially on such low power CPUs the difference is noticeable.

To use the "turbo mode" mode on some Intel and AMD CPUs you need to put (correct me if I am wrong) into the /etc/rc.conf
Code:
performance_cpu_freq="HIGH"
A Xeon(R) CPU E5-1650 v3 @ 3.50GHz (and 3.8 GHz Turbo) would now show 3501 as freq_lvl while using the turbo mode (so much turbo :DDD)
Code:
# sysctl -a | grep dev.cpu.0.freq

dev.cpu.0.freq: 3501

dev.cpu.0.freq_levels: 3501/140000 3500/140000 3300/128622 3200/123092 3000/112333 2800/103265 2700/98219 2500/88424 2300/79010 2200/74449 2000/66775 1900/62477 1700/54156 1500/46194 1400/43432 1200/35970
 
Wow thanks user23 and wblock@!
I was getting dev.cpu.0.freq: 825 so I followed http://www.ateamsystems.com/tech-blog/increase-freebsd-performance-with-powerd/ and enabled powerd by adding these lines to /etc/rc.conf:
Code:
powerd_enable="YES"
powerd_flags="-a hiadaptive"
Now I get dev.cpu.0.freq: 1650! I'm expecting that to make a difference.
Code:
$ sysctl -a | grep cpu.*freq
device   cpufreq
debug.cpufreq.lowest: 0
debug.cpufreq.verbose: 0
dev.cpu.0.freq: 1650
dev.cpu.0.freq_levels: 1650/5906 1443/5167 1320/3487 1155/3051 990/2615 825/1396 721/1221 618/1047 515/872 412/698 309/523 206/349 103/174
dev.cpufreq.%parent:
dev.cpufreq.0.%desc:
dev.cpufreq.0.%driver: cpufreq
dev.cpufreq.0.%location:
dev.cpufreq.0.%pnpinfo:
dev.cpufreq.0.%parent: cpu0
 
I also found the text Initializing built-in extension COMPOSITE in my /var/log/Xorg.0.log.

Does this mean compositing is enabled? If so, can I switch it off somehow?

Code:
[  160.000] Initializing built-in extension Generic Event Extension
[  160.000] Initializing built-in extension SHAPE
[  160.000] Initializing built-in extension MIT-SHM
[  160.000] Initializing built-in extension XInputExtension
[  160.000] Initializing built-in extension XTEST
[  160.000] Initializing built-in extension BIG-REQUESTS
[  160.000] Initializing built-in extension SYNC
[  160.000] Initializing built-in extension XKEYBOARD
[  160.000] Initializing built-in extension XC-MISC
[  160.000] Initializing built-in extension XINERAMA
[  160.000] Initializing built-in extension XFIXES
[  160.000] Initializing built-in extension RENDER
[  160.000] Initializing built-in extension RANDR
[  160.000] Initializing built-in extension COMPOSITE
[  160.001] Initializing built-in extension DAMAGE
[  160.001] Initializing built-in extension MIT-SCREEN-SAVER
[  160.001] Initializing built-in extension DOUBLE-BUFFER
[  160.001] Initializing built-in extension RECORD
[  160.001] Initializing built-in extension DPMS
[  160.001] Initializing built-in extension X-Resource
[  160.001] Initializing built-in extension XVideo
[  160.001] Initializing built-in extension XVideo-MotionCompensation
[  160.001] Initializing built-in extension XFree86-VidModeExtension
[  160.001] Initializing built-in extension XFree86-DGA
[  160.001] Initializing built-in extension XFree86-DRI
[  160.001] Initializing built-in extension DRI2
 
Well you have a lot of freq_levels on that CPU, way to much iI guess and more than you need.
Thanks, User23, I guess I only need one: the fastest. But I'm not sure I understand your comment since your post seems to reveal 16 freq_levels whereas mine has only 13. Although 13 of your pairs of numbers are all bigger than the biggest one of mine :)
 
powerd in adaptive mode needed time to get through all the freq levels in order to reach the highest level.
Your lowest freq_level is at 103 MHz which is 1/16 of the max freq, my lowest is 1200 MHz which is around 1/3 of the max freq :)
As mentioned on the power consumption wiki, the last low (ACPI) freq levels wont save that much energy, they are just slow.

man cpufreq
Code:
SUPPORTEDDRIVERS
The following device drivers offer absolute frequency control via the
cpufreq interface.  Usually, only one of these can be active at a time.

    acpi_perf  ACPI CPU performance states
    est        Intel Enhanced SpeedStep
    ichss      Intel SpeedStep for ICH
    powernow   AMD PowerNow! and Cool'n'Quiet for K7 and K8
    smist      Intel SMI-based SpeedStep for PIIX4

    The following device drivers offer relative frequency control and have an

    additive effect:
    acpi_throttle  ACPI CPU throttling
    p4tcc          Pentium 4 Thermal Control Circuitry

You could play with disabling ACPI freq levels by setting hint.acpi_throttle.0.disabled=1 in /boot/loader.conf
and you will see what powernow freq levels will stay. If that does not work maybe setting debug.cpufreq.lowest=825 in /etc/sysctl.conf will
prevent the deep 103 MHz sleep :)

With a stopped powerd you can set the freq level by hand dev.cpu.0.freq=1650 or lower, to measure performance, power consumption or temperature using the specified freq level.

--

And .. uh .. whats that in the chart? -> https://www.amd.com/Documents/49282_G-Series_platform_brief.pdf

Code:
T56N - GET56NGBB22GVE - 1.65GHz^17

^17
[LIST=1]
[*]17  Models enabled by AMD Turbo CORE technology, up to 10% clock speed increase is planned. For CPU boost, only one processor core of a dual-core has boost enabled.
[/LIST]

Planned and never happend? Try it out?!
 
Yes, I think this is solved for me!

I'm using
Code:
hint.acpi_throttle.0.disabled=1
in /boot/loader.conf as instructed and driver now seems to limit frequency levels to three of the top six:
Code:
sysctl -a | grep dev.cpu.0.freq
dev.cpu.0.freq: 1650
dev.cpu.0.freq_levels: 1650/5906 1320/3487 825/1396
I'm also using
Code:
powerd_enable="YES"
powerd_flags="-a hiadaptive"
in /etc/rc.conf as mentioned above.

Definitely as first mentioned by wblock@ and instructed by user23 enabling powerd was the important step which brought in more frequency levels. If this was just a matter of bringing in turbo mode then turbo seemed to make some noticeable difference. I think perhaps the CPU was getting stuck in slower modes.

I thought that might have been enough, since I believe I observed the processor going down into slow states when activity was low and then picking up pretty quickly to the top level when activity increased. With the additional hint instruction in loader.conf I'm even more confident I'm getting the best out of the CPU. I'm mostly at the top speed and not sinking lower than 825 at any time.

Thanks to everyone who assisted. FreeBSD and FreeBSD forums are cool!
 
Just sharing an quick info, on my old laptop I just set on /etc/rc.conf:

Code:
powerd_enable="YES"
powerd_flags="-a maximum -b hiadaptive"

And get the maximum processor speed without the other tunings.
 
Back
Top