From 922ee4198ec868840a77ca7779cbdb4b5dbb6cf2 Mon Sep 17 00:00:00 2001 From: NVolcz Date: Sun, 1 Dec 2024 09:19:04 +0100 Subject: [PATCH] WIP --- .editorconfig | 7 ++++++ bin/ud | 5 ++++ bootstrap.sh | 2 +- config/bashrc | 14 +++++++---- config/config/Code/User/settings.json | 4 ++- installs/auto-cpufreq.sh | 8 ++++++ power-management.txt | 36 +++++++++++++++++++++++++++ 7 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 .editorconfig create mode 100644 installs/auto-cpufreq.sh diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e2bd976 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +[*] +end_of_line = lf +charset = utf-8 +indent_style = space +insert_final_newline = true +quote_type = double +tab_width = 2 diff --git a/bin/ud b/bin/ud index 9f86815..103b9f8 100755 --- a/bin/ud +++ b/bin/ud @@ -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 + diff --git a/bootstrap.sh b/bootstrap.sh index cce8b72..75f7dd8 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -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 diff --git a/config/bashrc b/config/bashrc index 577112b..8b34306 100755 --- a/config/bashrc +++ b/config/bashrc @@ -176,10 +176,11 @@ 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 @@ -187,6 +188,9 @@ 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|$" } @@ -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 diff --git a/config/config/Code/User/settings.json b/config/config/Code/User/settings.json index d6a6bda..3cdd5b2 100644 --- a/config/config/Code/User/settings.json +++ b/config/config/Code/User/settings.json @@ -1,4 +1,5 @@ { + "workbench.colorTheme": "Default Dark+", "window.titleBarStyle": "custom", "editor.minimap.enabled": false, "testExplorer.useNativeTesting": true, @@ -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" } diff --git a/installs/auto-cpufreq.sh b/installs/auto-cpufreq.sh new file mode 100644 index 0000000..4d88dfc --- /dev/null +++ b/installs/auto-cpufreq.sh @@ -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 diff --git a/power-management.txt b/power-management.txt index 034cc9f..182e16c 100644 --- a/power-management.txt +++ b/power-management.txt @@ -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. @@ -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` @@ -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 \ No newline at end of file