2019

2017和2018年都没有些总结,翻下资料,补上个时间线
![](_v_images/20200102154628801_400.png =800x)

用mermaid做个更详细的:

gantt
    title 2016-2018 Review
    dateFormat  YYYY-MM
    section 2016
    summary            :done,    t1, 2016-03, 1d
    IOT/CDV            :done,    t2, 2016-01, 2016-04
    Robotics/SLAM      :done,    t3, 2016-04, 2016-10
    DL/Neon            :done,    t4, 2016-10, 20d
    section 2017
    VR/OSVR            :done,    t5, 2016-11, 2017-04
    VR/TM2             :done,    t6, 2017-04, 2017-05
    Summary            :done,    t7, 2017-04, 1d
    5g/mpv/ffmpeg      :done,    t9, 2017-05, 2018-02
    section 2018
    DL/Face regcognition    :done,    t10,2018-01, 2018-05
    virtualization/graphics :done,    t11,2018-05, 2020-01

16/17/18三年业务转型,有自己的尝试,有工作任务安排,把看起来很炫的技术方向都尽量了解了一下。都是好方向,做好都很难。
![](_v_images/IMG_2138.jpg =800x)
2018年初下定决心,要做回底层,专心看代码调bug。运气很好,在虚拟化组里遇到很好的同事,接到有挑战的项目,技术有进步,成果也不错。

2019工作内容都已开源的,所以可以写出来:

  1. Enable AcrnGT for WaaG
  2. Enable local display/HW cursor with AcrnGT for WaaG
  3. Enable pre-OS stage local display for AcrnGT
  4. hyper-dmabuf quality improvement

身边高手如云,收获不少,比如今年又更新了几个好工具:

  1. tmux替换screen。 多panel用于同时观察多OS输出,并远程键入命令,非常有效率。
  2. 用vnote写文档。最喜欢的是内置puml/mermaid,还有超级好用的图片拷贝功能。

从家里窗口能看见公司,工作生活比较平衡,家庭和睦。希望这样的好日子能一直这么下去。

2020首要的一件事,就是要锻炼身体,每天打卡;办了张健身卡,半年没去过了,不应该啊
其次是做个好榜样,小朋友读书的时候,不玩手机
再次,抬头看路,SRIOV是大趋势,之后该怎么办?

技术上:

  • 通用
  1. 花时间研究debug技术。 ftace/perf/systemtap
  2. 整理技术笔记,找个地方放一下
  3. 读spec/paper
  • 虚拟化
  1. debug windows, 争取在GOP里能处理Windows驱动卸载后的状态
  2. 重读display代码,想想display虚拟化怎么做能好用点
  3. 虽然不想,但估计还是得debug Windows,调稳定性问题。
  4. 独立显卡/集成显卡memory等问题
  5. 研读hyperviosr代码。 kvm/acrn
  • 其他
  1. 读书,学习;并把学习过程的心得,尤其是方法记录下来,教给小朋友
  2. 搭建知识库软件平台,方便搜集整理放东西

weston笔记-2019-01

过了很久很久之后,又要研究下weston了。先提个问题给自己:
怎么配置显示输出为clone模式?
怎么配置只显示输出到指定的output上?

思路应该是用output section里的 same-as

cat .config/weston.ini

[output]
name=DP-2
mode=preferred
[output]
name=DP-1
mode=off
same-as=DP-2

启动weston和glmark2:

1. weston –tty=1 -i 0
2. WAYLAND_DISPLAY=wayland-0 glmark2-es2-wayland

asus router firmware

https://koolshare.cn/thread-139965-1-1.html
https://firmware.koolshare.cn/Koolshare_ASUS_Official_Mod/RT-AC86U_3.0.0.4.384.45717/
https://pdf-lib.org/Home/Details/7984
https://github.com/hq450/fancyss/blob/master/fancyss_hnd/Changelog.txt

outlook中以html格式回复邮件

默认都是html或rtf格式,但一旦有人以txt格式回复了一下,整个格式就乱了,非常的难读。(除非大家都是txt格式写出来的,讲究排版,我只在linux下的mutt里这么干)

outlook似乎没有配置项,可以选择修改回复的格式,所以google一把,找到了方法:记录如下:
1.创建两个宏,一个reply,一个replay all。
2.创建两个button,分别绑上新创建的宏。

宏1:
Sub ReplyinHTMLFormat()
Dim olSel As Selection
Dim oMail As MailItem
Dim oReply As MailItem

Set olSel = Application.ActiveExplorer.Selection
Set oMail = olSel.Item(1)

If oMail.BodyFormat = olFormatPlain Or olFormatRichText Or olFormatUnspecified Then
oMail.BodyFormat = olFormatHTML
oMail.Save
End If

Set oReply = oMail.Reply
oReply.Display

Set olSel = Nothing
Set oMail = Nothing
Set oReply = Nothing
End Sub

宏2:
Sub ReplyAllinHTMLFormat()
Dim olSel As Selection
Dim oMail As MailItem
Dim oReply As MailItem

Set olSel = Application.ActiveExplorer.Selection
Set oMail = olSel.Item(1)

If oMail.BodyFormat = olFormatPlain Or olFormatRichText Or olFormatUnspecified Then
oMail.BodyFormat = olFormatHTML
oMail.Save
End If

Set oReply = oMail.ReplyAll
oReply.Display

Set olSel = Nothing
Set oMail = Nothing
Set oReply = Nothing
End Sub

2 Methods to Always Reply in HTML Format in Outlook

Windows文件名大小写区分

今天试图在办公电脑上把文件名大小写区分的属性激活,结果失败。
查了下,我的还是build 16299。等it升级到17093吧。

setCaseSensitiveInfo is an invalid parameter.
—- FILE Commands Supported —-

等来了升级

C:\windows\system32>ver

Microsoft Windows [Version 10.0.17763.1039]

C:\windows\system32>fsutil.exe file setCaseSensitiveInfo c:\code
Case sensitive attribute on directory c:\code is enabled.

  • https://www.tenforums.com/tutorials/111293-enable-disable-case-sensitive-attribute-folders-windows-10-a.html

kgdboc小记

使用gdb来单步跟踪kernel,基本都是buildin,所以忽略模块。

host上编译kernel,配置如下:

CONFIG_HAVE_ARCH_KGDB=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
CONFIG_EARLY_PRINTK_USB=y
CONFIG_X86_VERBOSE_BOOTUP=y
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
CONFIG_EARLY_PRINTK_EFI=y
CONFIG_EARLY_PRINTK_USB_XDBC=y

拷贝kernel和模块到target机器后,配置target启动参数.

target启动参数

console=ttyS0,115200n8 kgdboc=ttyS0,115200n8 kgdbwait

host上配置gdb

$ cat ~/.gdbinit

define kgdb
     show serial baud
     set serial baud 115200
     target remote /dev/ttyS0
     set detach-on-fork on
end

启动target机器后,在host上运行gdb并键入kgdb;设置断点后c;

Thread 72 hit Breakpoint 5, skl_compute_wm (state=0xffff88835e32f000) at drivers/gpu/drm/i915/intel_pm.c:5533
5533    {
(gdb) bt
#0  skl_compute_wm (state=0xffff88835e32f000) at drivers/gpu/drm/i915/intel_pm.c:5533
#1  0xffffffff816c928c in calc_watermark_data (state=<optimized out>) at drivers/gpu/drm/i915/intel_display.c:12352
#2  intel_atomic_check (dev=<optimized out>, state=0xffff88835e32f000) at drivers/gpu/drm/i915/intel_display.c:12433
#3  0xffffffff8160bbc5 in drm_atomic_check_only (state=0xffff88835e32f000) at drivers/gpu/drm/drm_atomic.c:1982
#4  0xffffffff8160be38 in drm_atomic_commit (state=0xffff88835e32f000) at drivers/gpu/drm/drm_atomic.c:2024
#5  0xffffffff815f2348 in restore_fbdev_mode_atomic (fb_helper=0xffff88835f43ca00, active=<optimized out>) at drivers/gpu/drm/drm_fb_helper.c:451
#6  0xffffffff815f2596 in restore_fbdev_mode (fb_helper=0xffff88835f43ca00) at drivers/gpu/drm/drm_fb_helper.c:517
#7  0xffffffff815f399e in drm_fb_helper_restore_fbdev_mode_unlocked (fb_helper=0xffff88835f43ca00) at drivers/gpu/drm/drm_fb_helper.c:545
#8  0xffffffff815f3a1d in drm_fb_helper_set_par (info=<optimized out>) at drivers/gpu/drm/drm_fb_helper.c:1767
#9  0xffffffff816e8eca in intel_fbdev_set_par (info=<optimized out>) at drivers/gpu/drm/i915/intel_fbdev.c:64
#10 0xffffffff814fa82f in fbcon_init (vc=0xffff88835fd41c00, init=<optimized out>) at drivers/video/fbdev/core/fbcon.c:1151
#11 0xffffffff8159017c in visual_init (vc=0xffff88835fd41c00, num=<optimized out>, init=0) at drivers/tty/vt/vt.c:1051
#12 0xffffffff815917d8 in do_bind_con_driver (csw=<optimized out>, first=<optimized out>, last=<optimized out>, deflt=<optimized out>) at drivers/tty/vt/vt.c:3500
#13 0xffffffff81591c9d in do_take_over_console (csw=0xffff88835e32f000, first=254, last=1596604608, deflt=<optimized out>) at drivers/tty/vt/vt.c:4061
#14 0xffffffff814f8c6c in do_fbcon_takeover (show_logo=<optimized out>) at drivers/video/fbdev/core/fbcon.c:556
#15 0xffffffff814fd74c in fbcon_fb_registered (info=<optimized out>) at drivers/video/fbdev/core/fbcon.c:3228
#16 fbcon_event_notify (self=<optimized out>, action=<optimized out>, data=<optimized out>) at drivers/video/fbdev/core/fbcon.c:3358
#17 0xffffffff810c846e in notifier_call_chain (nl=<optimized out>, val=<optimized out>, v=<optimized out>, nr_to_call=-1, nr_calls=0x0 <irq_stack_union>) at kernel/notifier.c:93
#18 0xffffffff810c8bb3 in __blocking_notifier_call_chain (nr_calls=<optimized out>, nr_to_call=<optimized out>, v=<optimized out>, val=<optimized out>, nh=<optimized out>)
    at kernel/notifier.c:317
#19 blocking_notifier_call_chain (nh=0xffffffff82aca4e0 <fb_notifier_list>, val=5, v=0xffff88835dc5bd30) at kernel/notifier.c:328
#20 0xffffffff814efc8b in fb_notifier_call_chain (val=<optimized out>, v=<optimized out>) at drivers/video/fbdev/core/fb_notify.c:45
#21 0xffffffff814f1677 in do_register_framebuffer (fb_info=<optimized out>) at drivers/video/fbdev/core/fbmem.c:1705
#22 register_framebuffer (fb_info=0xffff88835e385c00) at drivers/video/fbdev/core/fbmem.c:1828
#23 0xffffffff815f35e5 in __drm_fb_helper_initial_config_and_unlock (fb_helper=0xffff88835f43ca00, bpp_sel=<optimized out>) at drivers/gpu/drm/drm_fb_helper.c:2690
#24 0xffffffff815f3855 in drm_fb_helper_initial_config (fb_helper=0xffff88835f43ca00, bpp_sel=32) at drivers/gpu/drm/drm_fb_helper.c:2757
#25 0xffffffff816e9fc8 in intel_fbdev_initial_config (data=0xffff88835f43ca00, cookie=<optimized out>) at drivers/gpu/drm/i915/intel_fbdev.c:714
#26 0xffffffff810ca6fe in async_run_entry_fn (work=0xffff88835e32f000) at kernel/async.c:127
#27 0xffffffff810c069f in process_one_work (worker=0xffff88835e32f000, work=0xffff88835e39f820) at kernel/workqueue.c:2153
#28 0xffffffff810c091f in worker_thread (__worker=0xffff88835e2faa80) at kernel/workqueue.c:2296
#29 0xffffffff810c774c in kthread (_create=0xffff88835e17b540) at kernel/kthread.c:246
#30 0xffffffff81e001da in ret_from_fork () at arch/x86/entry/entry_64.S:413
#31 0x0000000000000000 in ?? ()

参考:
1. https://www.cnblogs.com/Ph-one/p/6432717.html

intel-gpu-tool用法小记

下载https://anongit.freedesktop.org/git/xorg/app/intel-gpu-tools.git后编译,在intel-gpu-tools/tools/下生成的可执行文件中,有这么两个:
intel_reg,intel_watermark

把intel-gpu-tools/tools/registers/下的文件拷贝到特定目录后,运行结果如下:

$ sudo intel_reg dump

buf is /usr/local/share/igt-gpu-tools/registers/5912
buf is /usr/local/share/igt-gpu-tools/registers/kabylake
GEN8_MASTER_IRQ (0x00044200): 0x80000000
GEN8_GT_ISR0 (0x00044300): 0x00000000
GEN8_GT_IMR0 (0x00044304): 0xfefefefe
GEN8_GT_IIR0 (0x00044308): 0x00000000
GEN8_GT_IER0 (0x0004430c): 0x01010101

$ sudo intel_watermark

 WM_LINETIME_A 0x00000000        WM_LINETIME_B 0x00000000        WM_LINETIME_C 0x00000000

     CUR_CTL_A 0x00000000            CUR_CTL_B 0x00000000            CUR_CTL_C 0x00000000
 PLANE_CTL_1_A 0x00000000        PLANE_CTL_1_B 0x00000000        PLANE_CTL_1_C 0x00000000
 PLANE_CTL_2_A 0x00000000        PLANE_CTL_2_B 0x00000000        PLANE_CTL_2_C 0x00000000
 PLANE_CTL_3_A 0x00000000        PLANE_CTL_3_B 0x00000000        PLANE_CTL_3_C 0x00000000

    CUR_WM_A_0 0x00000000           CUR_WM_B_0 0x00000000           CUR_WM_C_0 0x00000000
    CUR_WM_A_1 0x00000000           CUR_WM_B_1 0x00000000           CUR_WM_C_1 0x00000000

kvmgt launch script

From Intel KVMGT 2018 Q3 released ISO:

#KVM
#create VGPU:
uuid="a297db4a-f4c2-11e6-90f6-d3b88d6c9525"
vfionode="/sys/bus/pci/devices/0000:00:02.0/mdev_supported_types/`sudo ls /sys/bus/pci/devices/0000:00:02.0/mdev_supported_types |grep _4`"

if [ ! -e /sys/bus/pci/devices/0000:00:02.0/a297db4a-f4c2-11e6-90f6-d3b88d6c9525 ] ; then
        sudo su -c "echo $uuid > \"$vfionode/create\""
fi

# run Linux
# sudo /usr/bin/qemu-system-x86_64  -m 2048 -smp 2 -M pc -name gvt-g-g -hda /root/guest.qcow2  -bios /usr/bin/bios.bin  -enable-kvm -vga none -display gtk,gl=on -k en-us -machine kernel_irqchip=on -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -cpu host  -device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:00:02.0/a297db4a-f4c2-11e6-90f6-d3b88d6c9525,rombar=0

# run windows
sudo /usr/bin/qemu-system-x86_64  -m 2048 -smp 2 -M pc -name kvmgt-win10 /Work/WaaG/win10-rs4_gpt.img  -bios /usr/bin/bios.bin -enable-kvm -display gtk,gl=on -k en-us -machine kernel_irqchip=on -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -cpu host  -device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:00:02.0/a297db4a-f4c2-11e6-90f6-d3b88d6c9525,rombar=0 -bios OVMF.fd -serial tcp::5802,server,nowait -serial stdio -device e1000,netdev=net0 -netdev user,id=net0,hostfwd=tcp::8888-:5900,hostfwd=tcp::3389-:3389,hostfwd=udp::3389-:3389

Linux Kernel的编译笔记

再一次,编译kernel,这次又遇到新问题: 必要的config以及最小化。 目标是支持docker,KVM, usb串口等。

方法:

  1. 默认的选项 localmodconfig, 快速获得需要的module。
  2. 用scripts/kmod/merge_config.sh 来添加增量
  3. 用 https://github.com/moby/moby/blob/master/contrib/check-config.sh 来获得docker配置项
  4. make && make modules_install && make install
  5. /etc/default/grub 和 update-grub

问题和解决:

  1. 利用localmod会漏掉一些模块,所以需要3来检查缺失项:用2来做merge。
  2. 缺少aufs,因为kenrel没有带,需要patch http://aufs.sourceforge.net/;zfs我没有用到,所以忽略。

– Storage Drivers:
– “aufs”:
CONFIG_AUFS_FS: missing
– “btrfs”:
– CONFIG_BTRFS_FS: enabled
– CONFIG_BTRFS_FS_POSIX_ACL: enabled
– “devicemapper”:
– CONFIG_BLK_DEV_DM: enabled
– CONFIG_DM_THIN_PROVISIONING: enabled
– “overlay”:
– CONFIG_OVERLAY_FS: enabled
– “zfs”:
– /dev/zfs: missing
– zfs command: missing
– zpool command: missing

其余边角料:

  1. journalctl -xe 来查docker启动日志

 

设置postgresql中cube模块的最大尺寸

起因是facenet中生成的embedding的尺寸是128维的向量,对应的cube的尺寸最大只支持100. 所以需要调大一下尺寸。

简单的改一下头文件中的大小即可,如下

diff –git a/contrib/cube/cubedata.h b/contrib/cube/cubedata.h
index dbe7d4f..fb73b28 100644
— a/contrib/cube/cubedata.h
+++ b/contrib/cube/cubedata.h
@@ -4,7 +4,7 @@
* This limit is pretty arbitrary, but don’t make it so large that you
* risk overflow in sizing calculations.
*/
-#define CUBE_MAX_DIM (100)
+#define CUBE_MAX_DIM (130)

typedef struct NDBOX

但是用debian的打包方法,总是出错。折腾一天,最终发现是因为做回归测试的时候,输入结果格式不对。

cd  postgresql/contrib/cube
sed -i ‘s/#define CUBE_MAX_DIM (100)/#define CUBE_MAX_DIM (130)/’ cubedata.h
sed -i ‘s/100 dime/130 dime/’ expected/cube*.out

不将就的完整patch如链接:https://github.com/xyliu/postgres/commit/ace1a602ebe19fc7f435e7e2ab700c1e291323ae