Entries Tagged as ''

dmidecode – Get More Info from BIOS

Sometimes you want to know some hardware information, such as L1/L2 cache size, Memory and CPU. There is a tool to allow us to read those information. Since the output will be many lines, you can either put them to a temp file, or use grep to get information you want.

#dmidecode > tempfile

#dmidecode | grep key words

Linux Kernel 2.6.24 – (2)

Let’s continue to view what’s new on Linux Kernel 2.6.24.

1. SPI/SDIO support in the MMC layer

MultiMedia Card (MMC) subsystem maintainer Pierre Ossman described what he plans to push upstream, “this release will probably be one of the biggest ones for the MMC layer so far. The major pieces are SDIO and SPI support, but there are several small nuggets as well.” Regarding the new Secure Digital Input Output (SDIO) stack he noted, “gone are the days of having to rely on proprietary stacks for SDIO support in Linux.

2. USB authorization

As part of the efforts to make the USB layer ready for wireless USB, Linux 2.6.24 is getting support for USB device authorization, which allows you to control if a USB device (wireless or not) can be used or not in a system.

3. Per-device dirty memory thresholds

When a process writes data to the disk, the data is stored temporally in ‘dirty’ memory until the kernel decides to write the data to the disk (‘cleaning’ the memory used to store the data). A process can ‘dirty’ the memory faster than the data is written to the disk, so the kernel throttles processes when there’s too much dirty memory around. The problem with this mechanism is that the dirty memory thresholds are global, the mechanism doesn’t care if there are several storage devices in the system, much less if some of them are faster than others. There are a lot of scenarios where this design harms performance. For example, if there’s a very slow storage device in the system (ex: a USB 1.0 disk, or a NFS mount over dialup), the thresholds are hit very quickly – not allowing other processes that may be working in much faster local disk to progress. Stacked block devices (ex: LVM/DM) are much worse and even deadlock-prone (check the LWN article).

4. PID and network namespaces

Linux 2.6.24 adds PID namespaces and basic support for network namespaces. They’re used through the CLONE_NEWPID and CLONE_NEWNET clone() flags.

5. Large Receive Offload (LRO) support for TCP traffic

LRO combines received tcp packets to a single larger tcp packet and passes them then to the network stack in order to increase performance (throughput). After many out-of-the-tree iterations, mainline Linux is getting support for this feature

6. Task Control Groups

There have been various proposals in the Linux arena for resource management/accounting and other task grouping subsystems in the kernel (Resgroups, User Beancounters, NSProxy cgroups, and others). Task Control Groups is the framework that is getting merged in 2.6.24 to fulfill the functionality that lead to the creation of such proposals.

7. Linux Kernel Markers

The Linux Kernel Markers implement static probing points for the Linux kernel. Dynamic probing system like kprobes/dtrace can put probes pretty much anywhere. However, the scripts that dynamic probing points use can become quickly outdated, because a small change in the kernel may trigger a rewrite of the script, which needs to be maintained and updated separately, and will not work for all kernel versions.

8. Read-only bind mounts

Read-only bind mounts (mount –bind) allows a read-only view into a read-write filesystem. In the process of doing that, it also provides infrastructure for keeping track of the number of writers to any given mount. This has a number of uses. It allows chroots to have parts of filesystems writable. It will be useful for containers in the future because users may have root inside a container, but should not be allowed to write to somefilesystems.

9. x86-32/64 arch reunification

When support for the x86-64 AMD architecture was developed, it was decided to develop it as a “fork” of the traditional x86 architecture for comodity reasons. Many patches needed to patch a file in the i386 architecure directory, and another similar patch for the duplicated file in the x86_64 directory. It has been decided to unify both architectures in the same directory again.

Note: All quoted description is from kernelnewbie.org.

What’s New on Linux Kernel 2.6.24 – (1)

Linux Kernel released a stable version 2.6.24. According to one of Linux Editor, Marius Nestor, The release is the hottest Linux kernel ever! Why? Several improvements are as following:

1. Improved CFS

Briefly, CFS allows you to safeguard your files in encrypted form in a normal directory. By using a key (or password, if you will), you temporarily decrypt your files to clear-text form for the window of time in which you need to work with them.

2. Add Tickless feature for x86-64?PPC?UML?ARM?MIPS architecture.

“The tickless kernel feature (CONFIG_NO_HZ) enables ‘on-demand’ timer interrupts: if there is no timer to be expired for say 1.5 seconds when the system goes idle, then the system will stay totally idle for 1.5 seconds. This should bring cooler CPUs and power savings: on our (x86) testboxes we have measured the effective IRQ rate to go from HZ to 1-2 timer interrupts per second.

“This feature is implemented by driving ‘low res timer wheel’ processing via special per-CPU high-res timers, which timers are reprogrammed to the next-low-res-timer-expires interval. This tickless-kernel design is SMP-safe in a natural way and has been developed on SMP systems from the beginning.”

3. Patch for Anti-fragmentation

The anti-fragmentation strategy has memory overhead. This patch allows
the strategy to be disabled for small memory systems or if it is known the
workload is suffering because of the strategy. It also acts to show where
the anti-frag strategy interacts with the standard buddy allocator.

4. New wireless drivers and configuration interface

(To Be Continued…)

Solaris 10 Multi-core Processor Monitor Tools

Multi-core Processor performance is the key for SUN Solaris 10. For example, SUN T1 (Niagara 1) has 8 cores and each core can run 4 threads in parallel. I would like to introduce several tools to monitor performance of multi-core processors.

1. psrinfo

dogwood{hda2}1: psrinfo -v
Status of virtual processor 0 as of: 01/23/2008 09:07:34
on-line since 12/28/2007 08:22:51.
The sparcv9 processor operates at 1503 MHz,
and has a sparcv9 floating point processor.
Status of virtual processor 1 as of: 01/23/2008 09:07:34
on-line since 12/28/2007 08:22:49.
The sparcv9 processor operates at 1503 MHz,
and has a sparcv9 floating point processor.

psrinfo can get every core of processor status. The following is part of man page of psrinfo.

DESCRIPTION
psrinfo displays information about processors. Each physical
processor may support multiple virtual processors. Each vir-
tual processor is an entity with its own interrupt ID, capa-
ble of executing independent threads.

Without the processor_id operand, psrinfo displays one line
for each configured processor, displaying whether it is on-
line, non-interruptible (designated by no-intr), spare,
off-line, faulted or powered off, and when that status last
changed. Use the processor_id operand to display information
about a specific processor. See OPERANDS.

2. mpstat

dogwood{hda2}5: mpstat 5 2
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 8 1 15 28 15 337 9 62 8 0 6470 3 3 0 95
1 9 1 22 360 252 387 8 62 9 0 7147 3 3 0 94
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 1 0 13 19 10 532 2 143 14 0 1934 3 2 0 95
1 0 0 4 361 257 539 0 144 14 0 2051 3 2 0 95

mpstat will get each core statistics. Please care about several things:

  • idl: the value shouldn’t be less than 30, otherwise, you have to troubleshooting.
  • sys: the value shouldn’t be greater than 15, otherwise, you should figure out the problem.
  • xcal: the number of inter-processor cross-calls.
  • csw: the number of context switch.
  • syscl: the number of system call.

3. kstat

kstat -m cpu

kstat can get kernel module statistics of CPU. The following is part of man page of kstat.

DESCRIPTION
The kstat utility examines the available kernel statistics,
or kstats, on the system and reports those statistics which
match the criteria specified on the command line. Each
matching statistic is printed with its module, instance, and
name fields, as well as its actual value.

Kernel statistics may be published by various kernel subsys-
tems, such as drivers or loadable modules; each kstat has a
module field that denotes its publisher. Since each module
may have countable entities (such as multiple disks associ-
ated with the sd(7D) driver) for which it wishes to report
statistics, the kstat also has an instance field to index
the statistics for each entity; kstat instances are numbered
starting from zero. Finally, the kstat is given a name
unique within its module.

Each kstat may be a special kstat type, an array of name-
value pairs, or raw data. In the name-value case, each
reported value is given a label, which we refer to as the
statistic. Known raw and special kstats are given statistic
labels for each of their values by kstat; thus, all pub-
lished values can be referenced as
module:instance:name:statistic.

When invoked without any module operands or options, kstat
will match all defined statistics on the system. Example
invocations are provided below. All times are displayed as
fractional seconds since system boot.

Remote Desktop from Linux to Windows

I mentioned before about how to remote login your desktop. Here I would like to add more stuff. It was widely used from Linux platform to login Windows platform. If you don’t have VNC server running on your Windows, you can use rdesktop.

Ubuntu 7.10 has already had rdesktop. For Fedora 8, you can “yum -y install rdesktop“. You can connect to your Windows desktop by typing:

rdesktop -f -u username domain_name/IP address

You also can get more options by “man rdesktop“.

TCP Checksum

The good way to know how TCP checksum works, is to dig into TCP/IP protocol source code. In brief, TCP checksum is a 16-bits segments in TCP header. At very beginning, checksum is reset to 0. Then, TCP pseudo header, TCP header and TCP data are broken into 16-bits chucks. All these 16 bit words are added together using 1’s complement arithmetic. The result will be loaded to TCP checksum field. After TCP segment is transmitted to the destination, it will be recalculated including TCP pseudo header, TCP header and TCP data. If checksum is oxffff, then, all the data have been transmitted successfully.

The following is checksum function.

unsigned short checkSum(unsigned short *szBUF,int iSize)

{
/* Set checksum to 0 */
unsigned long ckSum=0;

/* All 16-bits chucks are added except last chuck*/
for(;iSize>1;iSize-=sizeof(unsigned short))
ckSum+=*szBUF++;

/* Added the last chuck */
if(iSize==1)
ckSum+=*(unsigned char *)szBUF;

/* The carry over 16 bits should be calculated as well,
Which is hardly mentioned in the explanation.
Some other source code use while loop to realize:
while (ckSum >> 16)
ckSum = (ckSum&0xffff) + (ckSum >> 16);
The code is more matured for IPv6. */


ckSum=(ckSum>>16)+(ckSum&0xffff);
ckSum+=(ckSum>>16);

/* Return negation of checksum */
return(unsigned short )(~ckSum);
}

Histories Should Be Remebered

Ethernet

Birth Year: 1973

Father: Robert M. Metcalfe

ethernet73.gif

C Language

Birth Year: 1973

Father: Dennis Ritchie of Bell Laboratiries

C was developed from 1969 to 1973 by Dennis Ritchie of Bell Laboratories. The American National Standard Institute (ANSI) ratified the ANSI C standard in 1989. The standard defines the C language and a set of library functions known as the C standard library. Kernighan and Ritchie describe ANSI C in their classic book, which is known affectionately as “K&R”. In Ritchie’s words, C is “quirky, flawed, and an enormous success.”

GNU Project

Birth Year: 1984

Father: Richard Stallman

richard_stallman.jpg

The GNU project is a tax-exempt charity started by Richard Stallman in 1984, with the ambitious goal of developing a complete Unix-like system whose source code is unencumbered by restrictions on how it can be modified or distributed. As of 2002, the GNU project has developed an environment with all the major components of a Unix operation system, except for the kernel, which was developed separately by the Linux project.

Linux

Birth Year: 1991

Father: Linus Torvalds

linus_torvalds.jpg

From:torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
Newsgroup: comp.os.minix
Subject: What would you like to see most in minix?
Summary: small poll for my new operating system
Message-ID: 1991Aug25, 20578.9541@klaava.Helsinki.FI
Date: 25 Aug 91 20:57:08 GMT
Organization: University of Helsinki. 

Hello everybody out there using minix- 

I'm doing a (free) operating system (just a hobby, won't be big
and professional like gnu) for 386(486) AT clones. This has
been brewing since april, and is starting to get ready. I'd like
any feedback on things people like/dislike in minix; as my OS
resembles it somewhat (same physical layout of the file-sytem
due to practical reasons)among other things. 

I've currently ported bash (1.08) an gcc (1.40), and things seem to work.
This implies that i'll get something practical within a few months, and I'd
like to know what features most people want. Any suggestions are welcome,
but I won't promise I'll implement them :-)  

Linus Torvalds torvalds@kruuna.helsinki.fi

PPTP Client for Ubuntu 7.10

PPTP is most popular VPN used by people who want to connect to workplace from home. From the network layer point of view, PPTP is layer 2 protocol, which is using L2TP. In the industry, Layer 3 protocol, IPSec, is well used. There is Linux open-source VPN package named SWAN. You can dig it if you are interesting in that.

Now, we turn back to our topic. We assume that PPTP server is setup already.

First, we need to apt-get pptp package

sudo apt-get install network-manager-pptp

Then, go to network icon to configure VPN

pptp1.jpg

Then, add a VPN network.

configure_pptp_add.png

Following the instruction, we can complete PPTP configuration.

configure_pptp_tunnel.png

Last, we can simply click network icon and choose VPN we have already setup. After authentication, we have connected to workplace network.

The Audacity of Hope

The topic forever is American Dream, but it truly drives us to every success. Although it’s the presentation in 2004, I still like to share it: “Hope — Hope in the face of difficulty. Hope in the face of uncertainty. The audacity of hope!”
Part I

Part II

Multimedia For Fedora 8

After installation of Fedora 8, we need more rpm package. So, we need Fedora 8 Repository RPM.

Then, we can get mplayer and xine, which are the most popular tools for multimedia.

For Video

yum -y install mplayer-gui xine xine-lib-extras-nonfree libquicktime libdvdcss vlc

For Audio

yum -y install lame normalize grip gstreamer-plugins-ugly