- dynamic dns:
- Dynamic DNS on your own domain: the important bit for me was the mention of using the "ddclient" client package for the client side. Now to search for something for the server side.
- Route-based VPN on Linux with WireGuard: I think I referenced this somewhere already, but I will do it again. And quoting from the article: "As an alternative to IPsec, WireGuard is an extremely simple (less than 5,000 lines of code) yet fast and modern VPN that utilizes state-of-the-art and opinionated cryptography (Curve25519, ChaCha20, Poly1305) and whose protocol, based on Noise, has been formally verified. It is currently available as an out-of-tree module for Linux but is likely to be merged when the protocol is not subject to change anymore. Compared to IPsec, its major weakness is its lack of interoperability."
- DKIM (DomainKeys Identified Mail) Modernization : notes on using Domain Keys in a Debian Stretch setting
- Reservoir sampling with few random bits: an excellent article describing the mechanism of randomly sampling from a stream: hold and choose, hold and choose, ...
- Using the switch on Turris Omnia with Debian: I have seen the Turris Omnia mentioned elsewhere, and this is an interesting reference on one mechansim of invoking hardware forwarding in the built in switch.
Wednesday, March 28. 2018
Random Bits
Linux CPU Frequency Adjustments
I have a Sager NP8157 laptop which came initially with Windows installed. I swapped out Windows and installed Linux. In this configuration, the fans seem to be running harder than I think they might with Windows. I havn't really tested that theory. But, anyway, the fans seem to be loud. This is an experiment to see if fan utilization can be reduced through a reduction in CPU use.
2018/08/01 - found out about the package laptop-mode-tools package. It has a good number of tools and accessories for power mode management and monitoring. powertop is another package which bears close examination for power management monitoring.
My version (Debian Stretch Backports Kernel is installed):
# uname -a Linux np8157 4.14.0-0.bpo.3-amd64 #1 SMP Debian 4.14.13-1~bpo9+1 (2018-01-14) x86_64 GNU/Linux
A way to find out how many processors are available:
# cat /proc/cpuinfo | grep processor | wc -l 8
Some Debian based CPU specific packages:
cpufreqd/stable 2.4.2-2+b1 amd64 fully configurable daemon for dynamic frequency and voltage scaling cpufrequtils/stable 008-1+b1 amd64 utilities to deal with the cpufreq Linux kernel feature cpuid/stable 20161201-1 amd64 tool to dump x86 CPUID information about the CPU(s) cpulimit/stable 2.4-1 amd64 tool for limiting the CPU usage of a process cpuset/stable 1.5.6-5 all Allows manipluation of cpusets and provides higher level fun cpustat/stable 0.02.01-1 amd64 periodic cpu utilization statistics cputool/stable 0.0.8-2+b1 amd64 Utility which manages CPU usage and system load
A simplified version of what would be found with 'cat /proc/cpuinfo':. Note here thatI have one physical processor socket with four cores, with each core having two threads, which falls under the Intel definition of hyper-=threading, with a result of 8 CPUs.
# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 2 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 158 Model name: Intel(R) Core(TM) i7-7820HK CPU @ 2.90GHz Stepping: 9 CPU MHz: 1109.773 CPU max MHz: 3900.0000 CPU min MHz: 800.0000 BogoMIPS: 5808.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 8192K NUMA node0 CPU(s): 0-7 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
To see which are on-line and which are off-line:
To watch CPU utilization:root@np8157:~# cat /sys/devices//system/cpu/online 0-7 root@np8157:~# cat /sys/devices//system/cpu/offline
# watch grep \"cpu MHz\" /proc/cpuinfo Every 2.0s: grep "cpu MHz" /proc/cpuinfo np8157: Tue Mar 27 23:03:25 2018 cpu MHz : 1100.008 cpu MHz : 1100.077 cpu MHz : 1100.022 cpu MHz : 1100.093 cpu MHz : 1100.027 cpu MHz : 1100.053 cpu MHz : 1100.138 cpu MHz : 1100.013
A summary of the how the cpu is controlled. In this case, the govenor is the 'intel_pstate' controller using what I think is the 'powersave' governor.
# cpupower frequency-info analyzing CPU 0: driver: intel_pstate CPUs which run at the same hardware frequency: 0 CPUs which need to have their frequency coordinated by software: 0 maximum transition latency: Cannot determine or is not supported. hardware limits: 800 MHz - 3.90 GHz available cpufreq governors: performance powersave current policy: frequency should be within 800 MHz and 3.90 GHz. The governor "powersave" may decide which speed to use within this range. current CPU frequency: Unable to call hardware current CPU frequency: 1.10 GHz (asserted by call to kernel) boost state support: Supported: yes Active: yes
To turn off half of my cpu's (CPU 0 must always be enabled):
# for i in /sys/devices/system/cpu/cpu{1,3,5,7}/online ; do echo 0 > $i ; done # cat /sys/devices//system/cpu/online 0,2,4,6 # cat /sys/devices//system/cpu/offline 1,3,5,7
And turn them back on again:
# for i in /sys/devices/system/cpu/cpu{1,2,3,4,5,6,7}/online ; do echo 1 > $i ; done # cat /sys/devices//system/cpu/online 0-7
I didn't let things run very long, but my CPU temperatures didn't vary that much. Probably because everything is on the same die.
To apply the limitation on boot-up, modify 'etc/default/grub' with the something similar to the following, where n is in the interval 0 to the number of cpus present, and then run 'update-grub':
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash maxcpus=n"
- Bibliography
- How to disable CPU core(s) in a multicore machine?: provided the bash loop to perform multiple changes, as well as the GRUB line change
- :
- How to make use of Dynamic Frequency Scaling: scaling parameters for very old CPUs and kernels.
- CPU frequency and voltage scaling statistics in the Linux(TM) kernel: L i n u x c p u f r e q - s t a t s d r i v e r - information for users -
- CPU frequency and voltage scaling code in the Linux(TM) kernel: Clock scaling allows you to change the clock speed of the CPUs on the fly. This is a nice method to save battery power, because the lower the clock speed, the less power the CPU consumes.
- CPU Performance Scaling: from the kernel 4.14 admin guide
- intel_pstate CPU Performance Scaling Driver: Also from the same guide, for the governor which is used in recent Skylake CPUs. There is the possibility of setting "Energy vs Performance Hints", which is good for more investigation.
- Debian How To CpuFrequencyScaling: The important note here is that "cpufreq is being replaced by cpupower". Other web sites refer to cpufreq, which is now deprecated.
- CPU frequency scaling: The ArchLinux wiki on scaling. This article talks about the cpupower command along with its options. This is where I also saw the watch command.
- Programmatically disable CPU core: makes a reference to https://github.com/torvalds/linux/blob/master/drivers/cpufreq/intel_pstate.c code and how it operates.
- :