2024年3月

  1. 基于stack虚拟机
  2. 内存包括4部分:the Scheme objects, the Scheme global variables, the RVM’s stack, and the instruction stream executed by the RVM.
  3. 使用rib来表示object, [ x,x,x ],整数用低位为1的word(host c): an object reference is implemented with a machine word with the lower bit encoding the type: 1 when the object is an integer (the other bits represent the integer value), and 0 when the object is a rib (all the bits are the aligned address of the rib in memory).
  4. 虚拟机只需要两个指针:stack, which refers to the rib at the top-of-stack (TOS), and pc, which refers to the rib containing the RVM instruction being executed. (同时亦作为gc root)
  5. 使用 Cheney-style stop-and-copy GC 算法
  6. 类型:[ field0, field1, type ] 0 pair, 1 procedure, 2 symbol/global variable, 3 string, 4 vector, 5 special

这几天发现我的grafana面板有点不对劲,经常刷新一下之后某些字段出现nodata,但是我确定之前是可以用的,而且也没升级版本。
跟踪了一下json,发现是确实没有数据出来,time和value都是0,但是隔时间久一点刷新数据又都有,只有很快的点击刷新按钮,数据才会没有。
于是我检查了一下表达式,发现这个表达式是irate,但是irate的基础数据是有的,思考半晌后,我想是不是时间不同步,导致没有新的时间窗口的数据?因为exporter是在另外一台机器上。看了一下时间,结果发现确实差了大概10秒钟,ntpdate一下后grafana恢复了正常,但是这两台机器是在同一台esxi上,只是其中一台开启了ntp,另外一台只是在启动的时候ntpdate,并且母鸡也是开了ntp的。
那么时间为什么会差10秒钟呢,esxi的RTC时间是不准确的吗?看了一下文档TIMECOUNTERS(4),HPET(4),发现其实系统有好几个时钟源:

kern.timecounter.tsc_shift: 1
kern.timecounter.smp_tsc_adjust: 0
kern.timecounter.smp_tsc: 1
kern.timecounter.invariant_tsc: 1
kern.timecounter.fast_gettime: 1
kern.timecounter.tick: 1
kern.timecounter.choice: TSC(1000) ACPI-fast(900) i8254(0) HPET(950) dummy(-1000000)
kern.timecounter.hardware: TSC
kern.timecounter.alloweddeviation: 5
kern.timecounter.timehands_count: 2
kern.timecounter.stepwarnings: 0
kern.timecounter.tc.TSC.quality: 1000
kern.timecounter.tc.TSC.frequency: 2112000000
kern.timecounter.tc.TSC.counter: 2163619832
kern.timecounter.tc.TSC.mask: 4294967295
kern.timecounter.tc.ACPI-fast.quality: 900
kern.timecounter.tc.ACPI-fast.frequency: 3579545
kern.timecounter.tc.ACPI-fast.counter: 15875638
kern.timecounter.tc.ACPI-fast.mask: 16777215
kern.timecounter.tc.i8254.quality: 0
kern.timecounter.tc.i8254.frequency: 1193182
kern.timecounter.tc.i8254.counter: 50337
kern.timecounter.tc.i8254.mask: 65535
kern.timecounter.tc.HPET.quality: 950
kern.timecounter.tc.HPET.frequency: 14318180
kern.timecounter.tc.HPET.counter: 3934900351
kern.timecounter.tc.HPET.mask: 4294967295

我记得很久以前freebsd implemention那本书里写因为rtc的精度太低,所以系统的时间都用其他的counter来计算,启动之后就不管rtc时间了,反正这个都是可以调整的,esxi确实也有timer的bug:https://kb.vmware.com/s/article/85150