Welcome to Pandora's Box(Why)

Keep It Simple, Stupid!

Fork me on GitHub

成长就是蜕变

| Comments

好几个月没来这块自留地了,觉得甚是不妥,心里也不那么踏实。最近,脑海里常浮现两个字,那就是“成长”;成长在每一个人看来也许含义都大不相同,我理解的成长“就是蜕变”。

我想说什么呢?蜕变是一个过程,最直观的比喻便是“破茧成蝶”,经历了磨砺和长时间的积累,才终有之后绚丽的身姿;蜕变也是一种选择,最近老在想,通过观察,也察觉到,这个世界和社会真的是缤纷多彩(乱七八槽),每一个独立的个体都面临着各种各样的选择,把选择简化一下,用几对词来描述,可以有好几个方面的分析,积极 V.S. 消极,向上 V.S. 退后,大局 V.S. 个人,克服 V.S. 退缩,责任 V.S. 散漫,蜕变 V.S. 自缚!

Getting Started With ElasticSearch and Plugin Development

| Comments

Coming across to ElasticSearch when preparing for the programming chanllege held by WorksApplications in Tokyo Event, and falling love with her after then. Well, with no much new techonoligies involved, ElasticSearch is definitely a beautiful piece of software and a successful product. Claimed that with the core search engine powered by Lucene, providing RESTful interface and born as a distributed and scheme-free search oriented product, ElasticSearch has boosted the huge business of Github with billions of lines and Stackoverflow with billions of Q&A.

After digging some 101 tutorials around, I found it easy to set up ES(abbreviated for ElasticSearch and will use afterwards) and begin to play in 10 minutes. However, to understand what is going on underhood and what is the most tricy and interesting part, also to those who try to develop plugins to enpower ES, I will share something which would be useful for newbies. There are already tons of tutorials online, to same your time, please see elasticsearch-getting-started hosted on my github for a good cheat sheet.

KGTP中增加对GDB命令“set Trace-buffer-size”的支持 - Week 4

| Comments

CSDN开源夏令营 – 第四周工作总结

本周主要是在回顾“set trace-buffer-size”完成通信的基础上,对于指定参数size的处理,比如指定-1或者unlimited的时候,在KGTP端该如何做解析,以及该如何处理此时的buffer size。同时,根据“开题报告”的进度,中期检查的任务已经完成。对Trace Buffer的实现,做了初步的调研。

1. GDB和KGTP通信实现的回顾

利用GDBRSP,即GDB Remote Serial Protocol,GDB远程串行通信协议。简单来说,用于GDB远程调试发包,但是也支持File I/O和Console,而KGTP正是利用了GDBRSP对于File I/O的支持,完成GDB和KGTP的通信,在接受到GDB发送的Packet后,KGTP进行解析。而通信的介质则是通过debugfs或者其他kernel space和user space进行数据交换的接口进行的。 具体实现,可以参考上一篇博文[1]。

KGTP中增加对GDB命令“set Trace-buffer-size”的支持 - Week 3

| Comments

CSDN开源夏令营 – 第三周工作总结

这一周主要实现了“set trace-buffer-size”实现的数据通信部分,即完成了GDB和KGTP的数据交互部分,下面简单分析一下实现。在说代码实现之前,还是简单地回顾一下,如何摸清KGTP的脉络。

1. 如何跟踪KGTP

我的平台是Fedora,步骤如下:

make D=1
sudo insmod gtp.ko
sudo gdb /usr/lib/debug/lib/modules/3.14.8-200.fc20.x86_64/vmlinux -ex 'target remote /sys/kernel/debug/gtp'

KGTP中增加对GDB命令“set Trace-buffer-size”的支持 - Week 2

| Comments

CSDN开源夏令营 – 第二周工作总结

这一周在上一周对整体框架的认识和理解之上,开始全面地阅读KGTP的源代码,理解了梗概,很多细节需要再仔细研读,主要参考是其代码仓库:[1]。

1. KGTP的核心代码文件

毫无疑问,KGTP最精髓的代码都在gtp.c文件中,约13500行代码,这其中包括了与GDB的通信,具体Query Packets的处理,Trace Points的注册和删除,事件的触发,硬件断点的设置和处理,等几乎所有的KGTP核心事务。在短短1万多行代码中,体现了几乎所有Linux Kernel开发过程中会用到的features,SMP的支持,Linux的list实现,锁和同步,工作队列,tasklet,硬件和软件中断,等等。