# high cpu - i915kms



## Rob-L (Sep 23, 2019)

Hi

New FreeBSD user here. I've managed to install free bsd fine - I've also installed Xorg and a desktop environment.  The issue lies with my graphics.

I'm running a haswell system (macbook pro 15" retina late 2012 A1398). I've tried both drm-kmod and drm-legacy-kmod.

Results of loading the legacy module (through rc.conf) are a blank screen - so no good

Results of the other module are that it loads fine and I can run X no problem.  Good stuff.

The problem is that even without an X session - i.e. just a console, my cpu is up around 70%. If I comment out the 
	
	



```
kld_list="/boot/modules/i915kms.ko"
```
 line in my rc.conf then I don't have my graphics active and the cpu drops to normal (confirming it's the i915 module).

Are there some special options to set to stop this behavior?  Any help debugging this issue would be appreciated.

Some output below (please let me know what else might be required)
`pciconf -lv`








						hostb0@pci0:0:0:0:      class=0x060000 card=0x012e106b chip=0x0d048086 rev=0x08 - Pastebin.com
					

Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.




					pastebin.com
				




`dmesg | grep drm`








						drmn0: <drmn> on vgapci0vgapci0: child drmn0 requested pci_enable_iovgapci0: - Pastebin.com
					

Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.




					pastebin.com
				




Hopefully someone might be able to help

Kind Regards

Rob


----------



## roper (Sep 24, 2019)

I experienced an issue after upgrading from 11.2 to 11.3. where there was high cpu usage. There were errors in var/log/messages which read: 





> [drm:fw_domain_wait_ack] render: timed out waiting for forcewake ack request.


 Applying the latest drm-kmod package upgrade resolved that issue for me.


----------



## Rob-L (Sep 24, 2019)

Hi Roper,

Thanks for the suggestion, unfortunately the output I posted for `dmesg | grep drm` is the same as if I do a `cat /var/log/messages | grep drm` i.e. I don't see the same message you had.  I have now installed the drm-kmod package from ports.  In terms of packages, you can see what I had installed and what the ports version installed here:

`grep installed /var/log/messages`


> FBSDmbp pkg[1399]: drm-kmod-g20190710 deinstalled
> BSDmbp pkg[1401]: drm-fbsd12.0-kmod-4.16.g20190814 deinstalled
> FBSDmbp pkg[1401]: gpu-firmware-kmod-g20190620 deinstalled
> FBSDmbp pkg-static[20428]: gpu-firmware-kmod-g20190825 installed
> ...



apart from the firmware version - nothing much changed.  And I'm still experiencing ~70% cpu usage for "kernel" process (which disappears if I boot without the i915kms module loaded):
`ps auxf` (first few lines)


> USER        PID  %CPU %MEM   VSZ  RSS TT  STAT STARTED      TIME COMMAND
> root         11 745.2  0.0     0  128  -  RNL  08:26   702:16.02 [idle]
> root          0  68.8  0.1     0 5664  -  DLs  08:26    63:23.39 [kernel]
> root         12   1.2  0.0     0  320  -  WL   08:26     1:10.22 [intr]
> root          1   0.0  0.0  9916 1064  -  ILs  08:26     0:00.03 /sbin/init --



Maybe haswell intel graphics just doesn't work with BSD like it does with Linux :-(

Are there any more suggestions? - they'd be gratefully received

Kind regards

Rob


----------



## Rob-L (Sep 24, 2019)

In my searching I heard mention of something called interrupts that can be looked at with `vmstat -i` - I'm not sure if this is useful information but here is the output almost immediately after bootup with the module loaded:


> root@FBSDmbp:~ # vmstat -i
> interrupt                          total       rate
> irq9: acpi0                       782364      19659
> irq16: vgapci0                        80          2
> ...



and then without:


> interrupt                          total       rate
> irq9: acpi0                          494          3
> cpu0:timer                          5236         33
> cpu1:timer                          1795         11
> ...



whatever irq9: acpi0 is, the "rates" do seem higher when the i915kms module is loaded.  I have no idea whether the above is useful or a distraction.  And if it is useful whether anything can be done about it?


----------



## roper (Sep 24, 2019)

If I'm reading this right then you should use drm-legacy-kmod



Inteli[357]-4xxx processorsHaswellWorks11.0Use drm-legacy-kmod | See Update i915 GPU driver to Linux 3.8 for historical background.


I would `pkg remove drm-kmod xorg-server` and `pkg autoremove` to clear out the installed firmware and drivers. Reinstall `pkg install drm-legacy-kmod xorg-server` and also create a /usr/local/etc/X11/xorg.conf.d/driver-intel.conf with just enough in it to switch between the modesetting and intel driver in order to see if the issue was present with both.


```
Identifier  "Card0"
        Driver      "intel"      #either "intel" or modesetting"
        BusID       "PCI:0:2:0"
```

I'm also using the kernel module in rc.conf and assume you will be too but maybe not with the drm-legacy-kmod. I think the pkg message will inform of which i915kms.ko.

I have in my /boot/loader.conf

```
hw.vga.acpi_ignore_no_vga="1"
kern.vty="vt"
```

The hw.vga.acpi_ignore_no_vga="1" helped with a screen blanking issue during bootup on a celeron box I don't know if it will be relevant to your case.

This may be relevant irq9 interrupt storm.


----------



## Rob-L (Sep 24, 2019)

Hi - 

Thanks for the tips:
-  the legacy module  gives me a blank screen on my laptop display. (with or without the `hw.vga.acpi_ignore_no_vga="1"`)  It does stop the cpu from running at 70%
- with the legacy module - if I connect a monitor to the laptop during boot I do actually get a display when the module gets loaded.
- this got me thinking about trying startx - it did, but xfce gets confused and tries to extend the screen - all I see is the xfce mouse on the monitor - I assume my cursor is somewhere on the laptop display that's blank.  I stuck in another Xorg conf file with a monitor output section - to try and force the monitor as the primary display and give me something I could control.  This worked. I could then xrandr - Xorg thinks the laptop display is connected and working - but there is nothing being displayed - it's blank, but has power to it. I thought maybe it was just dimmed to zero so used xrandr to try and set the brightness - this does nothing - so discounting that.

Maybe this could be construed as  progress:
- drm-kmod gives me X and console display on my laptop monitor, but at the expense of constant 70% cpu
- drm-legacy-kmod gives me an unusable laptop display but CPU is normal and allows me to use X and console on external monitor.

I wonder if the legacy module just can't cope with a 2880x1800 pixel display and so displays nothing, where as, the current module is ok but has a bug in it meaning it's just incompatible with the hardware - so I'm stuck somewhere in-between.  I think the legacy module is based off linux 3.18 and current is 4.16 - I've had linux with 4.09 run fine (debian stretch) - debian buster runs ok (currently installed on another partition) (4.19) - as does arch with 5.something - I've never gone as far back as 3.18 so wouldn't be able to confirm this theory.

Anyway - any more insights and help always appreciated before I give up


----------



## blackhaz (Nov 5, 2019)

Not sure if it is related but after upgrading from 11.2 to 12.1 (built drm-kmod from ports) my CPU usage is near 100% just by moving windows around the screen. CPU cooler is running high all the time.


SOLUTION: Just figured a solution. It turns out that I have had an old /usr/local/etc/X11/xorg.conf.d/xorg.conf which used xf86-video-intel driver. Apparently, this configuration was running fine on 11.2 but I guess caused some kind of a "race condition" with drm-kmod under 12.1. I have removed xorg.conf from the system. Next, I did pkg remove xf86-video-intel, so only drm-kmod will handle the graphics. So far so good: CPU usage is normal, all Chromium rendering artefacts are gone, acceleration seems to work.


----------

