Friday, October 23, 2009

kernel debugging on virtual machine

Let Host to debug its virtual machine

1. configure virtual machine to add a com port. refer here

set up a COM port for a named pipe (in VPC settings COM1 you can select named pipe and give it a name like \\.\pipe\ThePipe)

2. configure virtual operation system (vista) to enable debug and sets its output port. refer here

bcdedit /debug on

dcdedit /dbgsettings serial debugport:1 baudrate:115200

3. config host machine to connect to virtual machine

configure WinDbg to kernel debug (specify the same \\.\pipe\ThePipe in File\Kernel Debug, COM tab, Port text box).

4. Replace OS with checked ndis.sys

To disable WRP on windows vista. Install TakeOwnership.zip refer

here

5. You can start debug now.

Use !ndiskd.dbglevel, !ndiskd.dbgsystems

Technorati 标签: ,,,

Saturday, October 10, 2009

dbgview for vista

Under vista, dbgview default does not show debug messages printed out from KdPrint(). In this case, you need add a registry

1. add a registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter

2. add a DWORD DEFAULT=0xF

For more information, please see msdn here.

Test unsigned driver for windows server 2008 R2 x64

Windows server 2008 R2 x64 version require every kernel driver digitally assigned. To remove this constraint, we need install Driver Signature Enforcement Overrider. The first step is to disable UAC.

Sunday, September 27, 2009

Energy efficient data center

"We all need fatter pipes, but there are other ways of moving forward if the speeds come at the cost of too much power consumption, physical complexity and cost of ownership," said Bikash Koley of Google in a talk to a group of more than 100 developers hosted by the Ethernet Alliance. See here for the news report. Very interesting to hear.

Another report from Donn Lee says he needs 64 terabits switch.

Thursday, September 24, 2009

System Center for Virtual Machine Management

Quick Start from Nothing to SCVMM  contains quick guide video to get started with SCVMM 2008 R2.

MDSN guide for SCVMM scripting

sample script for configure vm network adapter. This script connects the virtual network adapter to a virtual network, changes the MAC address from static to dynamic, and enables virtual LAN (VLAN) identification for the network adapter.

Friday, April 10, 2009

install netfpga on ubuntu

Here is the instruction from netfpga to install netfpga on ubuntu.

1. Install prerequites

sudo apt-get install build-essential (for compiling driver)
sudo apt-get install linux-headers-`uname -r` (for compiling driver)
sudo apt-get install ncurses-dev (for selftest)
sudo apt-get install libnet1-dev (for the reference router/selftest)
sudo apt-get install libxml-simple-perl (Used in ./nf21_run_test.pl to verify *simulator* output)
sudo apt-get install libio-interface-perl (Used to manually build a newer version of Net::PCap)
sudo apt-get install liblist-moreutils-perl (Used to manually build a newer version of Net::RawIP)
sudo apt-get install liberror-perl (for the reference router)
sudo apt-get install sun-java6-jre (for the reference router GUI)
sudo apt-get install sun-java6-jdk
sudo apt-get install jpackage-utils
sudo apt-get install libpcap0.8 (for SCONE)
sudo apt-get install libpcap0.8-dev (for SCONE)



2. Create symbol links

sudo ln /usr/bin/lspci /sbin/lspci
sudo ln /usr/bin/setpci /sbin/setpci


3. Modify the source code

projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/router_buffer_sizing/regress/test_time_stamp/send_pkt: `usleep 10000`;
projects/router_buffer_sizing/regress/test_store_event/send_pkt: `usleep 10000`;

replace "usleep 10;" with "sleep 0.000010;"


4. Prepare env

source /root/netfpga/NF2/bashrc_addon


5. make; make install;

6. modify grub

title Ubuntu 8.04.1, kernel 2.6.24-19-server (netfpga)
uppermem 524288
root (hd0,1)
kernel /boot/vmlinuz-2.6.24-19-server root=UUID=5c9521ed-d36d-417a-a755-36e3bb5d1887 ro quiet splash vmalloc=256M
initrd /boot/initrd.img-2.6.24-19-server
quiet


7. After reboot, testing

sudo cpci_reprogram.pl --all
sudo nf2_download ~/NF2/bitfiles/reference_nic.bit
sudo ~/NF2/bin/nf21_regress_test.pl

Tuesday, March 03, 2009

add IE8 search provider

There is no interface for you to build search providers for IE8. You need this one IE Search Provider Builder Tool

Friday, February 20, 2009

Quick guide to analyze performance on windows platform

There are two methods to analyze performance of windows system.
  1. Use Visual Studio Team System‘s Performance Explorer to debug windows application.
  2. Use kernrate to analyze windows kernel.
To use VSTS's performance explorer, you need to install VSTS. You can use two ways to analyze an application, either sampling or instrumentation. Sampling has less overhead than the instrumentation. Basically, there are 5 steps.
  1. Run vsperfcmd to start analyzing process.
  2. Run your application
  3. Stop your application
  4. Run vsperfcmd to stop analyzing process.
  5. Use VSTS performance explorer to view the generated report.
MSDN has comprehensive guide on how to do these in details.To be honest, I prefer use command line for the first 4 steps. Beside, to view the functions' name in the report, you should properly configure the symbol path.

kernrate.exe is for windows 2000/XP/2003 to analyze kernel performance. It is included windows WDK toolkit. Running kernrate is simple, just type
kernate -j SYMBOL_PATH -z module
where -j is the symbol path of kernel modules, -z are the module you'd like to zoom in.

To download kernel symbol, you need to use symchk which is included in windows debugging tools. For example, following command download all symbols under c:\windows\system32\

symchk /r c:\windows\system32 /s  SRV*c:\symbols\*http://msdl.microsoft.com/download/symbols

Tuesday, February 10, 2009

overlapped I/O on windows

I recently studied winsock programming and discovered that overlapped I/O can be easily used to avoid buffer copy between user and system level. This is something I am not aware of on linux platform.

Windows Sockets 2.0: Write Scalable Winsock Apps Using Completion Ports

Tuesday, December 16, 2008

install xen on ubuntu

enviroment: ubuntu 8.04 server

1. install required packages

a. apt-get install ubuntu-xen-server
b. apt-get install vnc4server


2. configure win01.cfg

kernel='/usr/lib/xen/boot/hvmloader'
builder='hvm'
memory='1024'
device_model='/usr/lib/xen/bin/qemu-dm'

# since xen3.2, file:/ is obseleted.
disk=['phy:/dev/loop0,ioemu:hda,w',
'phy:/dev/loop1,ioemu:hdc:cdrom,r']

name='win01'

vif=['type=ioemu,bridge=eth0']

# boot from cdrom
boot='d'
vnc=1
vnclisten='0.0.0.0'
vncviewer=1
sdl=0

# usb mouse
usb=1
usbdevice='tablet'


3. create disk

dd if=/dev/zero of=/home/xen/disk.img bs=1M count=8192
losetup /dev/loop0 /home/xen/disk.img
losetup /dev/loop1 /home/xen/w2k3.iso

4. xm create win01.cfg

Thursday, November 27, 2008

data center for differnet applications

There are three different data centers:
1. for web services such as kaixin001.com, douban.com, ...
2. for data mining platform
3. for MMORPG (网游)

For 1st type:

Application logic is relatively simple
Transcation is not necessary
latency V.S. Throughput
Each application uses Ad-hoc way to provide
- blob stroage - photo, image, music
- table storage - user profile, tags,
- computing - sns graph compute, user behavior mining, global summary (tag cloud, hot topics)

flexible & uniform platform
amazon web service, google app engine, windows azure

For 2nd type: we are actually building...

For 3rd type, MMORPG (网游)
- expensive and low efficiency solution (HPC)
- big business impact
- virtual world game (secondlife, hipihi)

Monday, October 13, 2008

gnuplot and dvipdfm

dvipdfm doesn't correctly handle an eps figure whose lower-left corner is not at (0,0). To solve this problem, you need change -dEPSCrop to -sPAPERSIZE=jisb0 /dvipdfm/config/config

see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=428014

Wednesday, September 24, 2008

sync time between a cluster of window servers

==================
最简单的方法域服务器进行时间同步
net time /domain:fareast /set /y

查看本地时钟偏差
w32tm /stripchart /computer:time.windows.com /samples:5

==================
1. setup a windows server as ntp server (配置 Windows 时间服务以使用内部硬件时钟)

a. under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\
b. set AnnounceFlags to 0x5
c. run ntpserver
under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer\
set Enabled to 1
d. net stop w32time && net start w32time

2. sync clients to server's clock.

a. net time /setsntp:server_IP
b. Internet time -> update now.

reference:
http://support.microsoft.com/kb/314054

Wednesday, August 27, 2008

enable hibernate in vista for desktop

1. powercfg -h on
2. disable hybrid sleep in control panel.

reference: Turn off a computer: FAQ

Friday, July 18, 2008

Enable Mouse Wheel for vmware linux guest

在Debian下首先需要安装xserver-xorg-input-vmmouse,
然后再修改/etc/X11/xorg.conf

Section "InputDevice"
Identifier "Configured Mouse"
Driver "vmmouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
EndSection

Thursday, July 17, 2008

Right click for Command Prompt (in Vista)

Add the following entries to your registry - you'll be able to right click and open any folder at the command line.

[HKEY_CLASSES_ROOT\Folder\shell\command]
@="Command & Prompt"

[HKEY_CLASSES_ROOT\Folder\shell\command\command]
@="cmd.exe /K cd %L"

Friday, May 30, 2008

安装Canon打印机(cups)

1. 安装cups系统
cupsys cupsys-bsd cupsys-client foomatic-bin samba smbclient gs-esp a2ps

Canon2900打印机使用capt驱动,需要进行特殊安装。
2. 下载最新的驱动
http://software.canon-europe.com/software/0028622.asp CAPTDRV160.tar.gz
3. 解压, 安装deb包
cndrvcups-common_1.60-1_i386.deb
cndrvcups-capt_1.60-1_i386.deb
4a. 进入cups web管理界面,添加打印机,注意选择对应的PPD文件。

4b. 命令行方式
I. Connect to samba
/usr/bin/smbclient -L NGN_PRINTER -U share
II. /usr/sbin/lpadmin -p ngnprinter -v smb://user:passwd@NGNPRINTER/CanonLBP1120 -P /root/CNCUPSLBP1120CAPTJ.PPD
/usr/bin/enable ngnprinter
/usr/sbin/accept ngnprinter
/usr/sbin/lpadmin -d ngnprinter

Wednesday, May 28, 2008

debian sarge to etch distribution upgrade

1. back up old system
dpkg --get-selections “*”

2. add new sources to /etc/apt/sources.list

3. Upgrading packages

# apt-get update
# apt-get install aptitude
# aptitude -f --with-recommends dist-upgrade

当遇到kernel的时候,选择删除。但是一定要选择安装新Kernel,否则系统无法启动。

参考:Upgrade Sarge to Etch

Tuesday, May 06, 2008

互联网带宽瓶颈和收费问题

据电信专家舒华英透露,目前宽带上95%的收入只占了5%的带宽,5%的收入来自于95%的带宽。类似BT下载等都无法为运营商带来收入,却使用了很高的带宽。而短信彩铃、语音通话等占带宽很低,收入却高。结果导致运营商不愿意扩容。


信产部官员表示要防宽带塞车但不封杀P2P

Thursday, April 24, 2008

cygwin on windows xp

由于以后要逐渐开始使用windows操作环境,现在开始熟悉cygwin下面的操作:

安装
1. 从http://cygwin.com 下载setup.exe运行
2. 选择Direct Connection
3. 选择安装的Packages
4. 安装

配置
1. 使用cygwin中的rxvt
2. 创建快捷方式

C:\cygwin\bin\rxvt.exe -e C:\cygwin\bin\bash.exe --login --rcfile %HOME%/.bashrc