You are not logged in.

#1 2012-10-06 02:34:23

OOFscr
Member
Registered: 2012-10-06
Posts: 21

Problems with Vgaswitcheroo and Systemd

Hi there,

I have an Acer Timeline 4820tg with Intel HD 3000 integrated graphics and a ATI Radeon HD 5470. I want my Laptop to shut down the Radeon every time the system starts, so I do not have to write "echo OFF > /sys/kernel/debug/vgaswitcheroo/switch" every time I start my Laptop. I thought this would be easy, created the file radeonoff.conf in /etc/tmpfiles.d/ and filled it with "w /sys/kernel/debug/vgaswitcheroo/switch - - - - OFF". That first try, my system just hung. I tried several times without success, booted the LiveCD and removed the file. I also tried writing a service for this to wait until gdm had started, but this didn't work since ">" does not work in .service files, and since this is ugly because tmpfiles are thought to solve issues like this one. So my question, does anyone have an idea how to solve the hanging system? I achieved taking a photo of the hung-system-kernel-messages, so maybe this helps: http://ompldr.org/iZnJpYw

Any help would be greaty appreciated wink

Greetings, Jan

Offline

#2 2012-10-15 02:10:07

astex
Member
Registered: 2012-06-25
Posts: 37

Re: Problems with Vgaswitcheroo and Systemd

Try setting up an rc-local.service file as in this wiki and enabling it at boot.  Then set up a /etc/rc.local to disable your card as you would with initscripts.  It's arbitrary, but provides a different way of doing the same thing (maybe we can narrow down the problem to a problem with systemd, rather than a problem with vgaswitcheroo or your drivers).

Offline

#3 2012-10-15 13:28:24

OOFscr
Member
Registered: 2012-10-06
Posts: 21

Re: Problems with Vgaswitcheroo and Systemd

Thanks for taking your time for an answer. Luckily, I solved the problem today by putting both i915 and radeon to the mkinitcpio.conf's modules-section, now it works like a charm. Someone in arch irc told me that it would not be necessary including both modules here.

The only remaining question is if it is the desired behavior of systemd that just because a configured write-to-file does not exist (in this case probably /sys/kernel/debug/vgaswitchersoo/switch), something seems to fail so hard that even the basic services like tty fail to start due to missing dependencies. And second, why are modules obviously not autoloaded before the files in /etc/tmpfiles.d are handled?

Greetings, Jan

Offline

#4 2012-10-16 01:47:54

astex
Member
Registered: 2012-06-25
Posts: 37

Re: Problems with Vgaswitcheroo and Systemd

radeon must be required by a service loaded after /etc/tmpfiles.d/* are run.

Maybe this?

Last edited by astex (2012-10-16 01:49:48)

Offline

#5 2012-11-01 17:57:19

caasi
Member
Registered: 2012-03-21
Posts: 44
Website

Re: Problems with Vgaswitcheroo and Systemd

OOFscr wrote:

Thanks for taking your time for an answer. Luckily, I solved the problem today by putting both i915 and radeon to the mkinitcpio.conf's modules-section, now it works like a charm. Someone in arch irc told me that it would not be necessary including both modules here.

The only remaining question is if it is the desired behavior of systemd that just because a configured write-to-file does not exist (in this case probably /sys/kernel/debug/vgaswitchersoo/switch), something seems to fail so hard that even the basic services like tty fail to start due to missing dependencies. And second, why are modules obviously not autoloaded before the files in /etc/tmpfiles.d are handled?

Greetings, Jan

Could you post your solution in detail? I have the same problem and I don't know how to fix.  Thank you.

Offline

#6 2012-11-01 18:08:34

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: Problems with Vgaswitcheroo and Systemd

I think that in order to not have things be quite so racy, you probably wnt to use udev rules (I know I suggest these damn thigns for just about everything... but they work).  That way, you can have the rule run once the necessary path in /sys becomes available.

I do not use switching gpu at all, but it would seem that the module needs to be in the intramfs because otherwise it is trying to apply the tmpfiles before both modules have been picked up by udev or possibly before vgaswitcheroo has been fully initialized.  Thus the /sys/kernel/debug/vgaswitcheroo/switch path does not yet exist. 

Use

$ udevadm info -a -p /sys/kernel/debug/vgaswitcheroo 

to get some parameters to include in your rule.  Then also include

WAIT_FOR="/sys/kernel/debug/vgaswitcheroo/switch 

in the rule.

This is how I confiure the sesitivity of my trackpoint.  I know that it is not at all the same device, but just an example of how I set up my rule (since it has to wait for the sensitivity file to be present):

KERNEL=="serio2", SUBSYSTEM=="serio", DRIVER=="psmouse", WAIT_FOR="/sys/devices/platform/i8042/serio1/serio2/sensitivity", ATTR{sensitivity}="190"

I hope this might help... I too tried to use udev rules for a number of things, but it wasn't walys gauranteed that some of the paths had been set up yet.

Offline

#7 2012-11-01 19:04:18

holomorph
Member
Registered: 2012-10-19
Posts: 6

Re: Problems with Vgaswitcheroo and Systemd

To add to WonderWoofy's suggestion (I posted this earlier today in https://bbs.archlinux.org/viewtopic.php?id=151466)

holomorph wrote:

In my system, the discrete gpu is card1, so I am able to use the udev rule

KERNEL=="card1", SUBSYSTEM=="drm", RUN+="/usr/bin/radeon"

where radeon is just a script:

#!/bin/sh
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

You should be able to find which device is your discrete card by trying

# udevadm info -a -p /sys/class/drm/cardX

Last edited by holomorph (2012-11-01 19:04:44)

Offline

Board footer

Powered by FluxBB