Friday, December 1, 2023

Intel PQOS tool

This can be used to measure cache misses and cache bandwidth.


Steps to install and run

1. Checkout code from  https://github.com/intel/intel-cmt-cat/tree/master

2. cd  to ./intel-cmt-cat/

3. Run pqos

./pqos/pqos -T

./pqos/pqos -r


Typical output shows 

 CORE         IPC      MISSES     LLC[KB]   MBL[MB/s]   MBR[MB/s]


CORE - Processor core

IPC - IPC count

MISSES - LLC Misses

LLC[KB] - LLC Bandwidth in KB

MBL[MB/s] - Bandwidth between LLC and DDR

MBR[MB/s] - Bandwidth between LLC in different core and DDR







Tuesday, November 21, 2023

Perf Tool

 Perf tool permission issue in new Linux Kernel

Solution: Update permission

    sudo sysctl kernel.perf_event_paranoid=-1



Ubuntu Issues Related to Installation and Update

 

How to update from Ubuntu 22.04 to 23.04


sudo apt update
sudo apt upgrade -y
sudo apt install update-manager-core -y
sudo vim /etc/update-manager/release-upgrades
Change Lts to normal
cp /etc/apt/sources.list ~/sources.list.bak
sudo sed -i s/jammy/lunar/g /etc/apt/sources.list
sudo apt update
sudo apt upgrade -y
sudo apt autoremove
sudo apt dist-upgrade -y
Choose kernel
sudo reboot
cat /etc/os-release


Ubuntu Kernel Build
-----------------------------


Download source https://www.kernel.org/
tar xvf linux-6.0.7.tar.xz
#install required tools
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison

cd linux-6.0.7

#copy existing config
cp -v /boot/config-$(uname -r) .config
#set power flag for dpdk in .config file
CONFIG_INTEL_UNCORE_FREQ_CONTROL=y
#change config through GUI
make menuconfig
#build kernel with make command
make

------
If you are compiling the kernel on Ubuntu, you may receive the following error that interrupts the building process:

No rule to make target 'debian/canonical-certs.pem
Disable the conflicting security certificates by executing the two commands below:

scripts/config --disable SYSTEM_TRUSTED_KEYS

scripts/config --disable SYSTEM_REVOCATION_KEYS
-----------

# Install the required modules with this command:

sudo make modules_install
In case of permission denied error: chmod 777 -R debian/scripts


#install kernel

sudo make install

Step 6: Update the Bootloader (Optional)
The GRUB bootloader is the first program that runs when the system powers on.
The make install command performs this process automatically, but you can also do it manually.
1. Update the initramfs to the installed kernel version:

sudo update-initramfs -c -k 6.2.0-34
2. Update the GRUB bootloader with this command:

sudo update-grub
Step 7: Reboot and Verify Kernel Version
When you complete the steps above, reboot the machine.
When the system boots up, verify the kernel version using the uname command:

uname -mrs


Grub 

See the details of installed kernels

dpkg --list | grep linux-image

                    or 

vim /boot/grub/grub.cfg

Change default OS:

/etc/default/grub 







Errors
=========

debian/canonical-certs.pem
-----------------------------------

make[3]: *** No rule to make target 'debian/canonical-certs.pem', needed by 'certs/x509_certificate_list'.  Stop.
make[2]: *** [scripts/Makefile.build:480: certs] Error 2
make[1]: *** [/home/ashok/tools/kernel/linux-6.5.7/Makefile:2034: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2

Solution:

sudo mkdir -p /usr/local/src/debian
sudo apt install linux-source
sudo cp -v /usr/src/linux-source-*/debian/canonical-*.pem /usr/local/src/debian/
sudo apt purge linux-source*


-----------------------------------------------
ashok:~/sw/kernel/6_5_7/linux-6.5.7$ sudo make install
  INSTALL /boot
run-parts: executing /etc/kernel/postinst.d/dkms 6.5.7 /boot/vmlinuz-6.5.7
 * dkms: running auto installation service for kernel 6.5.7
Sign command: /usr/bin/kmodsign
Signing key: /var/lib/shim-signed/mok/MOK.priv
Public certificate (MOK): /var/lib/shim-signed/mok/MOK.der

Building module:
Cleaning build area...
'make' KDIR=/lib/modules/6.5.7/build...(bad exit status: 2)
ERROR (dkms apport): kernel package linux-headers-6.5.7 is not supported
Error! Bad return status for module build on kernel: 6.5.7 (x86_64)
Consult /var/lib/dkms/intel-oobmsm-dummy/0.1.0-503/build/make.log for more information.
dkms autoinstall on 6.5.7/x86_64 failed for intel-oobmsm-dummy(10)
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
 * dkms: autoinstall for kernel 6.5.7                                                                                                                                           [fail]
run-parts: /etc/kernel/postinst.d/dkms exited with return code 11
make[1]: *** [arch/x86/Makefile:292: install] Error 1
make: *** [Makefile:234: __sub-make] Error 2



Solution:

Download dkms source, update max linux version in meta and build
On a Fedora 36 machine, with the 2.1.6 sources installed to /usr/src/zfs-2.1.6/ through dnf download --source zfs and rpm -ivh zfs-2.1.6-1.fc36.src.rpm, the build succeeded on their recent Linux 6 kernel with patching META to 6 and installing the DKMS module manually:
$ sed -i 's/Linux-Maximum: 5.19/Linux-Maximum: 6.00/g'/usr/src/zfs-2.1.6/META
$ dkms install zfs/2.1.6
$ modprobe zfs
$ zfs version
zfs-2.1.6-1
zfs-kmod-2.1.6-1
$ uname -r
6.0.5-200.fc36.x86_64


Building module:
Cleaning build area...
'make' KDIR=/lib/modules/6.2.16/build...(bad exit status: 2)
ERROR (dkms apport): kernel package linux-headers-6.2.16 is not supported
Error! Bad return status for module build on kernel: 6.2.16 (x86_64)

Ubunt: change default OS/Kernel


cat /etc/default/grub

         Not able to install stuff

ashok@adl:~/tools/mlc/Linux$ cpufreq-set -c 0 -u 2.5GHz -d 2.5GHz

Command 'cpufreq-set' not found, but can be installed with:

sudo apt install cpufrequtils

ashok@adl:~/tools/mlc/Linux$

ashok@adl:~/tools/mlc/Linux$

ashok@adl:~/tools/mlc/Linux$ sudo apt install cpufrequtils

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

You might want to run 'apt --fix-broken install' to correct these.

The following packages have unmet dependencies:

cpufrequtils : Depends: libcpufreq0 (>= 006) but it is not going to be installed

linux-tools-6.5.0-13 : Depends: linux-tools-common but it is not going to be installed

E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

ashok@adl:~/tools/mlc/Linux$

ashok@adl:~/tools/mlc/Linux$

ashok@adl:~/tools/mlc/Linux$ sudo apt --fix-broken install

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

Correcting dependencies... Done

The following additional packages will be installed:

  linux-tools-common

The following NEW packages will be installed:

  linux-tools-common

0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.

2 not fully installed or removed.

Need to get 0 B/450 kB of archives.

After this operation, 549 kB of additional disk space will be used.

Do you want to continue? [Y/n]

(Reading database ... 188135 files and directories currently installed.)

Preparing to unpack .../linux-tools-common_6.5.0-13.13_all.deb ...

Unpacking linux-tools-common (6.5.0-13.13) ...

dpkg: error processing archive /var/cache/apt/archives/linux-tools-common_6.5.0-13.13_all.deb (--unpack):

trying to overwrite '/usr/bin/cpupower', which is also in package linux-laptop-tools-common 6.5.0-1006.9

dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)

Errors were encountered while processing:

/var/cache/apt/archives/linux-tools-common_6.5.0-13.13_all.deb

E: Sub-process /usr/bin/dpkg returned an error code (1)



Solution: 

sudo dpkg -i --force-overwrite /var/cache/apt/archives/linux-tools-common_6.5.0-13.13_all.deb

sudo apt install -f



Remote GUI from Windows
--------------------------------------

https://phoenixnap.com/kb/ubuntu-remote-desktop-from-windows