Blogilo is awesome.. :)

Posted on by .
My search for a Linux desktop based blogging client ends here..
 
Blogilo is the answer….:)
 
 
On ubuntu install it is very very easy. Just do
# apt-get install blogilo
 
Once done open the tool and configure your site for blogging from Settings->Configure Blogilo->Blogs->Add
The autoconfigure worked like magic….
 
 
 
 
 
 
 
If your behind your corporate firewall and still want to use Blogilo make sure you edit the file  ~/.kde/share/config/kioslaverc and append the following to the file

[Proxy Settings][$i]
ProxyType=1
httpProxy=http://username:password@proxyserver:port/
httpsProxy=http://username:password@proxyserver:port/
ftpProxy=http://username:password@proxyserver:port/

The moment I gave the above info in the file , it started working like magic ;) Here you go my first blog through Blogilo :) :) :)

Processor Core count in Linux

Posted on by .

core

LINUX CPU/CORE COUNT – HOWTO

Enough is enough. I have forgotten like thousand times how to do this. It is time to blog and etch on www.

Okay, now everybody knows how to find number processors(cores) in Linux. Just try the below command

# cat /proc/cpuinfo

I got a different way where glibc will help. This is very useful escepeically when you want to auto feed this
info to “make -j ” or any such type of commands from within a makefile. You don’t want to die grepping the /proc/cpuinfo
file and find that.

A very easy way out is

# getconf _NPROCESSORS_CONF

The above command will return 2 in my machine where I have a 1 processor with 2 cores.

Basically “getconf” gets you system configuration variables.

Where does it get them from…. Lets do a quick trace on it.

#strace -e trace=open getconf _NPROCESSORS_CONF
open(“/etc/ld.so.cache”, O_RDONLY|O_CLOEXEC) = 3
open(“/lib/x86_64-linux-gnu/libc.so.6“, O_RDONLY|O_CLOEXEC) = 3
open(“/usr/lib/locale/locale-archive”, O_RDONLY|O_CLOEXEC) = 3

Here is the deal. Glibc is feeding the information.

Alrighte.. Lets see what library calls are involved in this…

# ltrace getconf _NPROCESSORS_CONF

sysconf(83, 0x7ffff38e6923, 1, 0, 65535) = 2

Ok.. ltrace says that it is coming from “sysconf”

#man 3 sysconf
says that it is getting system configuration at runtime. This is declared in the header “unistd.h”

Wow!! Now lets rip open glibc and see what they are doing inside….
Since I dont have source let me get it from
#git clone git://sourceware.org/git/glibc.git

Ok.. A quick “cscope” into the code reveals our function…

it is in sysdeps/unix/sysv/linux/getsysstats.c (+240) ( ver glibc-2.15 )
( below code snippet lifted from that file )

239 int
240 __get_nprocs_conf ()
241 {
242 /* XXX Here will come a test for the new system call. */
243
244 /* Try to use the sysfs filesystem. It has actual information about
245 online processors. */
246 DIR *dir = __opendir (“/sys/devices/system/cpu”);
247 if (dir != NULL)
248 {
249 int count = 0;
250 struct dirent64 *d;
251
252 while ((d = __readdir64 (dir)) != NULL)
253 /* NB: the sysfs has d_type support. */
254 if (d->d_type == DT_DIR && strncmp (d->d_name, “cpu”, 3) == 0)
255 {
256 char *endp;
257 unsigned long int nr = strtoul (d->d_name + 3, &endp, 10);
258 if (nr != ULONG_MAX && endp != d->d_name + 3 && *endp == ‘\0′)
259 ++count;
260 }
261
262 __closedir (dir);
263
264 return count;
265 }
266
267 int result = 1;
268
269 #ifdef GET_NPROCS_CONF_PARSER
270 /* If we haven’t found an appropriate entry return 1. */
271 FILE *fp = fopen (“/proc/cpuinfo”, “rce”);
272 if (fp != NULL)
273 {
274 char buffer[8192];
275
276 /* No threads use this stream. */
277 __fsetlocking (fp, FSETLOCKING_BYCALLER);
278 GET_NPROCS_CONF_PARSER (fp, buffer, result);
279 fclose (fp);
280 }
281 #else
282 result = __get_nprocs ();
283 #endif
284
285 return result;
286 }

Ok.. I think we know what it is doing now.. It is opening the directory /sys/devices/system/cpu
using readdir. Get the name of each entry with d_name and strcmp it with cpu.
How many it finds, that many it shows..

Just did an ls on my /sys/devices/system/cpu to compare the output

# ls /sys/devices/system/cpu
cpu0 cpu1 cpufreq cpuidle kernel_max offline online possible power present probe release uevent

Voila.. It matches.. It also fallbacks on the /proc/cpuinfo just in case it can’t get to /sys.

Cool.. Looks like we got this sorted.:)

Openstack whitepapers/Talks in LINUX SYMPOSIUM 2012

Posted on by .

—————————————————————————————-

    Two of my submissions on openstack are selected for Linux Symposium this year ( 2012 )


Here is mine and Srinivas Gowda‘s profile in Linux symposium:
Profile – Linux Symposium

    1) Enhance openstack scheduler algorithm using IPMI BMC information. Surya Prabhakar / Srinivas Gowda
    2) Understanding Openstack Metering and Billing – Surya Prabhakar

—————————-

Dell Tech Centre Blogs…

Posted on by .

—————————————————————————————————————————-
Here is link to one of my Blog on SR-IOV.

http://en.community.dell.com/techcenter/b/techcenter/archive/2010/11/17/rhel-6-up-and-running-with-sr-iov-on-dell-poweredge-servers.aspx

Linux Kernel compile in Ubuntu

Posted on by .

Linux Kernel Compile in UBUNTU

Ubuntu’s kernel compilation is a little bit different to Fedora’s compilation. Depending on the version of Ubuntu the packages to be installedmay differ.
The current version used for this documentation is Interpid.
Few steps involved in kernel compilation are..
1) Checking packages & installing them..First install all these list of packages with sudo apt-get install command
a.fakeroot
b.build-essential
c.makedumpfile
Once the above packages are installed check for dependencies with the following command…
sudo apt-get build-dep linux
build-dep : checks for satisfying the dependencies
2) Downloading Kernel source
As I am not downloading the kernel archive from Ubuntu repositories ( not using apt-get ) . I am downloading it from kernel.org
You can get the latest version of the kernel from the stable tree. You can also download bleeding edge kernel for kernel developers repository through GIT ( global information tree ).
Current stable version of the kernel from official tree is here…
Once the download is done , untar the sources and enter the kernel directory.
3) Getting the configuration file
Normally you can get the kernel configuration file of the current running kernel from the /boot directory.. It is typically named like /boot/config-2.6.27-9-generic.
Copy that to the kernel directory and rename the file as .config
Once the .config is copied , issue a make menuconfig ( without make menuconfig kernel compilation cannot be initialized )
4) Setting concurrency levels if your on an SMP machine
If you know that you are have more than one CPU on your machine you can exploit the make commands capability to
compile the source code on both the cpu’s. Typically when you do a make you do with make -j on your machine in the ordinary kernel compilation
process. In ubuntu you can pass the same option in the following manner..
export CONCURRENCY_LEVEL=4 ( I have used 4, you can use number which is equal to your cpu’s on the build machine )
5) Building the kernel itself
make-kpkg clean ( cleans the kernel source directory before we start the actual compilation )
The actual kernel compilation process starts by issuing the following command. It creates bzImage ( which is the actual monolithic image of the kernel ),
modules ( which are various loadable kernel binary bits like drivers etc ), initial ram disk image ( a.k.a initrd ) .
fakeroot make-kpkg –initrd –append-to-version=-custom kernel_image kernel_headers
you can change the custom name to anything different. Once the above command is issued it takes some time depending on your processing power.
6)Installing the kernel
Once the compi.lation is done without errors, if you come out of the current kernel directory , you can notice to “.deb” files available to you.
Their names could be something like..
linux-headers-2.6.27.6_2.6.27.6-10.00.Custom_amd64.deb
linux-image-2.6.27.6_2.6.27.6-10.00.Custom_amd64.deb
The names can be similar but not exactly same.
Once the 2 files are available install them with the following command
#dpkg -i ( same with the other file name too )
7) Rebooting in to the new kernel
Once installed you can check the /boot/grub/menu.lst file to check the updated version detail of your kernel. If you
want you can change it to default version to reboot from. Once done reboot the machine to the newly compiled kernel.