Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
NVolcz committed Dec 13, 2024
1 parent ef757d2 commit 922ee41
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*]
end_of_line = lf
charset = utf-8
indent_style = space
insert_final_newline = true
quote_type = double
tab_width = 2
5 changes: 5 additions & 0 deletions bin/ud
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ fi
if command -v cargo &> /dev/null; then
cargo install-update -a
fi

if command -v rclone &> /dev/null; then
rclone selfupdate
fi

2 changes: 1 addition & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function linkDotFiles() {
linkDotFiles "$dotfiles_dir/config" "$HOME"

# I could put the files in "bin" under "config/local/bin" but that would
# mix configuration files with scripts so I think it is wise
# mix configuration files with scripts so I think it is wise
if [[ ! -d "$HOME/.local/bin" ]]; then
mkdir -p "$HOME/.local/bin"
fi
Expand Down
14 changes: 9 additions & 5 deletions config/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,21 @@ alias curlh='curl -s -D - -o /dev/null'

alias rm='trash'

alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
alias urldecode='python -c "import sys, urllib.parse; print(urllib.parse.unquote(sys.argv[1]))"'

# TODO: add option to encode all characters
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
# TODO: Handle piped input
alias urlencode='python -c "import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1], safe=\"\"))"'

#Utility required by all below functions.
#https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-bash-variable#comment21953456_3232433
alias trim="sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*\$//g'"

alias groot='cd $(git root)'

# From: https://ubuntuforums.org/showthread.php?t=2488028&p=14147810#post14147810
alias lsblk='lsblk -e 7 -o name,type,size,FSAVAIL,FSUSE%,fstype,mountpoint'

highlight() {
grep -E --color "$1|$"
}
Expand Down Expand Up @@ -264,9 +268,9 @@ export LANG='en_GB.UTF-8'

# Borrowed from: https://anarc.at/blog/2020-03-02-moving-dconf-entries-to-git/
export DCONF_PROFILE=$HOME/.config/dconf/profile

export KIND_EXPERIMENTAL_PROVIDER=podman
eval "$(mise activate bash)"

export CDPATH=".:~:~/git:~/git/controla"

eval "$(mise activate bash)"

complete -C /usr/bin/terraform terraform
4 changes: 3 additions & 1 deletion config/config/Code/User/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"workbench.colorTheme": "Default Dark+",
"window.titleBarStyle": "custom",
"editor.minimap.enabled": false,
"testExplorer.useNativeTesting": true,
Expand All @@ -12,5 +13,6 @@
"cSpell.enabled": false,
"workbench.iconTheme": "material-icon-theme",
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 120
"editor.wordWrapColumn": 120,
"dev.containers.dockerPath": "podman"
}
8 changes: 8 additions & 0 deletions installs/auto-cpufreq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

# From: https://github.com/AdnanHodzic/auto-cpufreq/releases.atom

cd $HOME/git
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq && sudo ./auto-cpufreq-installer -y
36 changes: 36 additions & 0 deletions power-management.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

The most common tools
- [Powertop](https://wiki.archlinux.org/title/powertop) - Tool to identify ways to optimize power consumption. Does not have a daemon or anything like it.
The best setup seems to be auto-cpufreq + thermald. PowerTop can be used to troubleshoot and finetune settings but don't think it is necessary. Many tools interfere with each other so it is in my experience best to keep it simple.

- [Powertop](https://wiki.archlinux.org/title/powertop)
- tlp
- Laptop Mode Tools
- [auto-cpufreq](https://github.com/AdnanHodzic/auto-cpufreq) - Tries to let the kernel do the heavy lifting. This is my goto choice, but it falls short in certain areas such as ALPM. Recommends to run thermald alongside.
Expand Down Expand Up @@ -29,6 +32,11 @@ According to [ArchWiki](https://wiki.archlinux.org/title/Solid_state_drive) ALPM


## Sleep, hibernate and other scary stuff
- auto-cpufreq
- thermald
- [cpufreq](https://github.com/konkor/cpufreq) (it is actually used by auto-cpufreq)

A good wiki of tools can be found here: https://wiki.archlinux.org/title/CPU_frequency_scaling

`cat /sys/power/mem_sleep`

Expand Down Expand Up @@ -64,9 +72,37 @@ https://www.phoronix.com/review/amd-linux511-perfgov/2

I think I found [the reason](https://www.reddit.com/r/linux/comments/ihdozd/linux_kernel_58_defaults_to_passive_mode_for/) but I am not sure if it is valid:
https://www.phoronix.com/news/P-State-Passive-Def-For-No-HWP
# PowerTop vs. TLP

https://linrunner.de/tlp/faq/powertop.html

[Regarding VM writeback](https://askubuntu.com/a/1228723), PowerTop takes a more naive approach that works well for laptops - my case.


# TODO
- [Investigate hiberation](https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate)
- Investigate Intel Rapid Start Technology
- Investigate possibility to use suspend-then-hibernate

# XPS 9320

- https://wiki.archlinux.org/title/Dell_XPS_13_Plus_(9320)
- This bug is preventing sleep? https://bugzilla.kernel.org/show_bug.cgi?id=213047
- https://github.com/intel/S0ixSelftestTool
- Using `./s0ix-self-test.sh -s` confirms the processor is able to achieve s0ix.
- Interesting thread: https://www.dell.com/community/en/conversations/xps/xps-13-plus-ubuntu-2204-does-not-support-deep-sleep/647f9fa5f4ccf8a8de483a80
- According to [this thread](https://www.dell.com/community/en/conversations/xps/proscons-ahci-vs-raid-on-xps13-9300-nvme/647f89cef4ccf8a8de97b145) I should use AHCI instead of VMD/Raid (related to [this bug report](https://bugzilla.kernel.org/show_bug.cgi?id=211879)).


# Intel p_state driver vs. acpi

Kernel Documentation:
https://www.kernel.org/doc/Documentation/cpu-freq/intel-pstate.txt
https://www.kernel.org/doc/Documentation/cpu-freq/user-guide.txt
https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
https://www.kernel.org/doc/html/v6.2/admin-guide/pm/intel_pstate.html
https://www.kernel.org/doc/html/v6.2/admin-guide/pm/intel_pstate.html#intel-pstate-vs-acpi-cpufreq

Performance tests:
https://www.phoronix.com/review/intel_pstate_linux315/3
https://www.phoronix.com/review/linux50-pstate-cpufreq

0 comments on commit 922ee41

Please sign in to comment.