2011年4月27日星期三

HOWTO disable failsafe mode in Openwrt

https://forum.openwrt.org/viewtopic.php?id=28227

$ edit package/base-files/files/lib/preinit/30_failsafe_wait


and make ...



intersection and union: find the difference between two directories

SZLUG April monthly meeting

There are three main topics during the meeting.

Rockins's topic is a very good starting-point, even including the study case, TP-LINK's hiring ads.


Bring up Vxworks on a MIPS core, by Rockins Chen

  • why vxworks: see pro and con below
    1. pro: simplicity, high quality code, document everything
    2. con: proprietary, less existed package, inactive community
  • basic:
    1. multi-tasking
    2. inter-task
    3. communication
    4. mm(first-fit)
    5. IO system, UNIX-like file/dir/device, POSIX AIO …
    6. fs: dosFs, rawFs, tapeFs, cdromFs, TSFs, TrueFFS for flash devices
    7. network: TCP/IP, 802.1x, IPSec, NAT/NAPT, OSPF, Firewall, PPP …
  • A glance of VxWorks
    1. libdrv.a, libnet.a, libarch.a, libos.a, libwind.a
    2. all = libxxx.a + BSP = libxxx.a + bootcode + basic device driver
  • bootcode: arch dependent code
    1. Cache, TLB, GRs in CPU, CP0's regs, PLL, DDR
    2. watchdog, Exception/Interrupt, RTC, GPIO
  • case 1: slow loop on SPI flash
  • case 2: busy stuck of interrupt
    1. MIPS CPU has 4 general purpose timer
  • case 3: load delay shot on MIPS R3000
  • case 4: stochastically stuch when jumping to vxworks
  • case 5: stochastically soft reboot failure due to PLL switch
    1. resolution x3
  • importance of bsp:
    1. availablity
    2. reliability
    3. stability
    4. performance
  • things bsp engineer need to know (!!!)
    1. arch: Instuctions, Pipeline, cache, exception/interrupt
    2. Mem: SDRAM, DDR, NOR/NAND
    3. Bus: UART, JTAG, SPI
    4. Misc: PLL, Timer, GPIO, watchdog, DMA
    5. OS & toolchain
    6. Debug: ICE, debugger
  • Time for questions:
    1. cache coherency
    2. SoC problem
    3. how and how hard to be a bsp engineer

SZLUG and the cloud computing platform, by Haibo Zhang

6281 and QNAP system image, by sniperpr

  • Market positioning of 6281
  • Collaborative development with a Shanghai guy
  • Introduction of QNAP image


2011年4月12日星期二

IOWAIT - 测试IO性能的标尺

有个客户给我发邮件,告知我,他们曾对自己的板子和现在正在测试的 Marvell 6281 主板 进行对比测试。发现磁盘I/O操作时候的CPU空闲时间有出入。询问是否是6281的IO效率太低 了。

mpstat 数据如下:

Marvell 6281
CPU %usr %nice %sys %iowait %irq %soft %idle
all 0.00 0.00 5.98 93.69 0.00 0.33 0.00
all 0.00 0.00 3.65 96.01 0.00 0.33 0.00
all 0.66 0.00 7.97 89.37 0.00 1.99 0.00
M5000
CPU %usr %nice %sys %iowait %irq %soft %idle
all 17.67 0.00 22.33 0.00 0.00 0.00 60.00
all 11.33 0.00 22.00 0.00 0.00 0.00 66.67
all 7.33 0.00 16.33 0.00 0.00 0.00 76.33

客户认为M5000的 iowait 为0,那么CPU等待IO完成的时间是没有的,因此他的磁盘性能很 好,CPU不去干预;而6281的iowait%太高,CPU都在等,磁盘效率低下。

误区:CPU在 iowait 的时候傻等

这里最要命的就是 iowait 概念。参考 mpstat 手册

CPU 的时间片在 mpstat 眼中划分为很多种类,在UP(unique processor)系统中

%usr + %nice + %sys + %iwoait + %irq + %soft + %steal + %guest + %idle = 100%

  • %usr, CPU 运行用户程序的时间比
  • %nice, CPU 运行修改过进程优先级的用户程序时间比
  • %sys, CPU 运行内核程序的时间比
  • %iowait, 显示CPU在拥有磁盘I/O请求时候的_空闲_时间比
  • %idle,现实CPU没有磁盘I/O请求时候的_空闲_时间比

而其中的 %usr + %nice + %sys 是真正CPU在忙的时间,而其他都属于空闲期。 由上可知, 6281 在磁盘测试的时候使用了 0+0+5.98 = 5.98% 的CPU时间来处理I/O请求, 而 M5000 则使用了 17.63+0+22.33 = 40%,很明显 M5000 的磁盘IO更加占用CPU时间。

iowait 指标

%iowait 同样也属于空闲期,但是细分成了属于等待磁盘I/O完成的空闲时间,CPU不会傻等 。一旦CPU有其他请求,他会立刻响应。

高的 iowait 代表 CPU早早完成了IO请求的处理而等待磁盘IO的完成。一旦 iowait 逼近 100%,则代表CPU够闲的同时磁盘IO性能过低,总结为磁盘IO成了系统瓶颈。

而M5000 花费了 40% 的CPU 时间来处理请求,这个时候IO传输已经完成,他根本没有等待 时间。这显得 CPU 性能相对磁盘IO反而心力不足,在密集型IO请求的系统中 CPU 会显得 很吃力。

调校 IO 性能

IO性能的调校有超多的方法

  1. 硬件形成磁盘阵列 raidx
  2. hdparm 微调磁盘性能
  3. 选用合适的 IO scheduler (/sys/block/sda/queue/scheduler)

同样也可以配合以下工具来试试

  1. mpstat,适用于 SMP 系统下的监控工具,包含在 sysstat
  2. iostat,可以察看IO都写请求的次数等详细数据,包含在sysstat
  3. sar, 可以查看网络 IO 性能数据
  4. oprofile,可定制的系统微调工具,工作方式类似与 systemtap
  5. fio
  6. nmon
  7. iozone