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


Sunday, April 22, 2018

NSI C-Media USB Sound Card installation

NSI USB 7.1 sound card comes with C Media Chip set

Windows

Run the setup in administrator mode. Open the application and select mode

Linux


1. Set USB sound card as as default

sudo gedit /etc/modprobe.d/alsa-base.conf
At the end of file, change the index from -2 to 0
# Keep snd-usb-audio from beeing loaded as first soundcard
options snd-usb-audio index=0

Note : Command to list devices

~$ aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: Device [USB Sound Device], device 0: USB Audio [USB Audio]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: MID [HDA Intel MID], device 0: 92HD81B1C5 Analog [92HD81B1C5 Analog]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: MID [HDA Intel MID], device 3: HDMI 0 [HDMI 0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

2. Install ALSA and ALSA mixer if it's not present


Edit/create .asoundrc in your home directory

gedit ~/.asoundrc

Add the following

pcm.sndcard{
type hw
card 0
device 1
channels 6
}

3. Restart
4. Go sound settings and select your audio card. This was needed even if USB was configured by default.
  This settings was lost even when I remove aux cable from sound card.
5. Testing



For 5.1:

speaker-test -Dplug:surround51 -c6 -l1 -twav

For 7.1:

speaker-test -Dplug:surround71 -c8 -l1 -twav

If it's not working, you might try following alsa's own guide:

http://alsa.opensrc.org/SurroundSound

And also this:

http://www.halfgaar.net/surround-sound-in-linux

Note however that many codecs require custom routing (ttables), the folk at #alsa on irc.freenode.org may be able to help in that case.

Sunday, December 27, 2015

What is Right with Free Basics (internet.org) ?


I'm not working for Facebook or not intended to make any profit from Free basics.

This note is only to point out the False arguments and Misconceptions of the people who are speaking and campaigning against Free Basics. If I'm wrong anywhere please point out, I'm ready to correct. You are welcome to give more points to this note too.

Myths and Facts


 1. Myth: If you sign up for free basics you cannot take a normal data plan.

Most of the people who speaks against Free basics are trying to tell that, once you start using Free Basics you are forced to pay higher cost for other sites no matter what.

Fact :  Free Basics cannot ban you from taking a normal data plan. You can use a data plan along with Free basics.

2. Myth : Users will never realize that they are losing money if they use free basics. 

Fact: Most of the users who are waiting for Free Basics are cost sensitive. They usually have a pre-paid connection, check balance regularly and blast customer care executive if balance is deducted unfairly. So definitely they are going to opt out from Free basics if overall mobile usage charge is high. Postpaid users obviously gets details of cost of data usage. So, Free basics cannot fool you forever


3. Myth : Only facebook makes benefit from Free Basics

Fact : Facebook is making profit from advertising. Adverting is required by all private and public sector companies. So other companies are benefited as well as their  employees.



4. Myth : Only Facebook is interested in your personal information and preferences.

Fact : There are many more : Google search and other search engines, Gmail and other free email service providers, browsers, advertising agencies

5. Myth : People won't use facebook and associate services unless it's free

Fact :   Number of facebook & whatsapp users in India is increasing day by day even though internet is not free for most of new users. People with lower income are also not hesitating much to join facebook and whatsapp. Most of the mobile data volume are used for facebook, whatsapp and youtube

6. Myth : You are not supposed to give only some services/things free.

Fact:  India government passed National Food security act in 2013. As per this poor people get 3 Kg Rice, 2 Kg Wheat and 1 Kg coarse grain. It costs minimum 125,000 crore rupees per year, which is taken from the tax we have paid.
Do you want government to stop it or do you want government to give all groceries for free? Why the people who shout against Free basics are not concerned about their own money(paid as tax) first?
Let the poor people use whatever facebook is giving free, others can use paid plans. Facebook are not taking money from the tax we have paid. 

7. Myth : Agencies like CIA and FBI can collect your personal information only if you are using free internet.

Fact :  Agencies can collect your personal information and preferences irrespective of what internet connection you are using, whether it's free or super expensive. Large number of companies and agencies already have your information.

8. Myth : Personalized advertising is bad

Fact : Personalized advertising saves time and money of the vendor as well as the customer many times. For the people who does not know about personalized advertising : E.g. Suppose you want to buy a shoes and you searched about different types of shoes in google. Google understands you need to buy shoes and start showing advertisement of shoe companies and dealers besides your search results. Which could help you at least some times.
Imagine google is showing advertisement of cars while you are interested in shoes. It will not be helpful for you as well as the vendor.

9. Myth : Free  basics will make Facebook a monopoly forever

Fact: Facebook cannot reach everybody all the time, advertising need different medias. People are ready opt for a paid service when it is more attractive than a free service. E.g. Private hospitals vs government hospitals.

10. Myth : Free  basics users are not going to access other sites

Fact: Internet is like drugs, once you use samples of internet people would get attracted to use full internet. Most of the free basics users will soon migrate to full internet.

Some Disadvantages of Free Internet


1. More people get addicted to internet and facebook.
2. Income of other social networking sites would decrease. They are forced to innovate.
3. Other Advertising platforms get affected until. They tool will need innovation.