this post was submitted on 16 Mar 2025
45 points (97.9% liked)

Linux

52024 readers
979 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Hello,

I'm adjusting pp_table settings to get most out of my GPU (RX 6800 XT) and it works but every time I restart PC the changes revert back to default. Any idea how I could make them persist?

For me pp_table is located in /sys/class/drm/card1/device/pp_table

I have to use chmod to be able to make changes:

sudo chmod o+w /sys/class/drm/card1/device/pp_table

Then I'm able to write in changes with upp:

upp -p /sys/class/drm/card1/device/pp_table set --write smc_pptable/SocketPowerLimitAc/0=312 smc_pptable/SocketPowerLimitDc/0=293 smc_pptable/TdcLimit/0=300 smc_pptable/FreqTableSocclk/1=1350 smc_pptable/FreqTableFclk/1=2000 smc_pptable/FclkBoostFreq=2000

And just in case you're wondering if the effort even makes sene, yes it does:

Max OC with LACT with max default limits (left) vs max OC with edited pp_table (right) in the picture.

you are viewing a single comment's thread
view the rest of the comments
[–] pastaq@lemmy.world 3 points 2 days ago* (last edited 2 days ago)

Udev is the best way to add persistent values for pretty much everything in the sysfs. That being said, it can be a bit obtuse when first learning about it. Here are some tips

udevadm test /sys/path/to/device will tell you if your rule is running and what the state is at each step. You'll want to look at this before you start so you can see when your rule should run

udevadm info /sys/path/to/device will tell you what the PROPERTIES of a device are. These are usually set by hwdb files to inform userspace programs about the details of a device.

udevadm info /sys/path/to/device --attribute-walk will tell you about the ATTRIBUTES of a device and all it's parent devices. These correspond to the character file endpoints you are setting currently. You'll want to use these to write your match rules and set the values.

udevadm monitor can be used to watch for udev events to let you know if you should match on add, change, and/or remove.

Udev rules work as a cascading match system and they run in numerical and directory order. E.g. /usr/lib/udev/rules/60-keyboard.rules will run before /etc/udev/rules.d/62-keyboard.rules but after /etc/udev/rules.d/60-keyboard.rules

For user defined rules you will want to put them in /etc/udev/rules.d/ and keep in mind any state that needs to be set before or after your rule.

Matching happens with == or !=, setting attributes is done with =, +=, -=, or :=. := is really cool because you can use that to block changes from downstream rules. E.g. MODE:="666" will make the matched attribute r/w from unprivileged users, even if a later rule tries to set 400.

Udev rules will run in order in a file, but each rule must be a single line. Each attribute will also be set in order of the rule if setting multiple attributes in a rule. Multiple rules can be useful if you need to set attributes on multiple levels of a device, or in sibling directories.

For a complete breakdown of everything, see the udev manual: https://man.archlinux.org/man/udev.7

I also have a guide on one of my (currently out of tree) drivers that has some examples. https://github.com/ShadowBlip/ayn-platform?tab=readme-ov-file#changing-startup-defaults

Let me know if you have questions.