Stratum-1 NTP server, part 3

After about 24 hours it has settled down nicely.

# ntpq -c peers
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
oPPS(0)          .PPS.            0 l    4   16  377    0.000    0.010   0.002
*ptbtime1.ptb.de .PTB.            1 u   55   64  177   51.291    1.112   1.450
+uno.alvm.me     103.7.151.4      2 u    8   64  377   19.008    3.451   0.819
-time-a.as43289. 162.23.41.56     2 u   49   64  177   73.242   14.530   4.915
-95-65-94-223.st 193.226.65.36    2 u    5   64  377   73.743    7.543   0.509
-hemel-hempstead 193.67.79.202    2 u   12   64  377   19.829    3.720   0.551
-time.rdg.uk.as4 85.25.105.105    2 u   11   64  377   19.924    0.677   0.491
+time.dan.me.uk  140.203.204.77   2 u   40   64  177   62.218    3.616   0.372
-dns2-ha.uk.syra 83.170.75.28     4 u   11   64  377   19.365    4.274   0.652
# ntpq -c rv
associd=0 status=011d leap_none, sync_pps, 1 event, kern,
version="ntpd 4.2.6p5@1.2349-o Sat Jul  4 15:08:48 UTC 2015 (1)",
processor="armv7l", system="Linux/3.18.11-v7+", leap=00, stratum=1,
precision=-20, rootdelay=0.000, rootdisp=0.394, refid=PPS,
reftime=d943cdae.7978b6bf  Sun, Jul  5 2015 16:37:18.474,
clock=d943cdb8.e8908274  Sun, Jul  5 2015 16:37:28.908, peer=2027, tc=4,
mintc=3, offset=0.010, frequency=-3.056, sys_jitter=0.002,
clk_jitter=0.000, clk_wander=0.002

3 Comments

Filed under Uncategorized

Stratum-1 NTP server, part 2

20150704_151027

It took me about an hour to work out that I had the board plugged in the wrong way around, and that’s why nothing worked. My excuse is we’re in the middle of a heatwave at the moment ….

Anyway, the picture above is how you’re supposed to do it.

The R-Pi is running standard Raspbian, and the rest of the software setup can be found on this page update: this is the right link.

The board almost immediately finds a timepulse.

After running for a little while:

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
xPPS(0)          .PPS.            0 l   13   16  377    0.000   -7.334   0.159
xipv6test.te.net 195.138.80.34    3 u   51   64  377   72.959   -1.776   0.711

(and yes I know it says Stratum 0 …)

The output is saying that the GPS source (PPS) has an offset of 7.3ms from the internal clock. The stratum 3 internet source is 1.8ms from the internal clock (but note the internal clock is likely wrong). The delay (round trip?) to the local clock is 0, and the delay from the internet source is 73ms.

They are both currently marked as “x” meaning “falsetickers”. I think ntpd needs a bit longer to decide to use the GPS source.

# ntpq -c rv
associd=0 status=0018 leap_none, sync_unspec, 1 event, no_sys_peer,
version="ntpd 4.2.6p5@1.2349-o Sat Jul  4 15:08:48 UTC 2015 (1)",
processor="armv7l", system="Linux/3.18.11-v7+", leap=00, stratum=1,
precision=-20, rootdelay=0.000, rootdisp=86.994, refid=PPS,
reftime=d942771e.6dc41fc9  Sat, Jul  4 2015 16:15:42.428,
clock=d9427c3a.d8cd27b8  Sat, Jul  4 2015 16:37:30.846, peer=0, tc=4,
mintc=3, offset=0.003, frequency=0.000, sys_jitter=0.116,
clk_jitter=3.476, clk_wander=0.000

Update: After reading this Red Hat article and this ntp.org document, I realized my mistake was having only two clocksources, which is the worst configuration for ntpd. Adding a bunch more sources makes it better:

# ntpq -c peers
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
oPPS(0)          .PPS.            0 l   16   16  377    0.000   -0.094   0.008
*server.104media 193.67.79.202    2 u   30   64  377   29.748    3.890   0.610
-ns2.vnet.sk     95.47.106.34     3 u   29   64  377   50.536    0.622   0.268
+nero.grnet.gr   .GPS.            1 u   27   64  377   71.089    4.371   0.619
-frankfurt1.firs 85.214.240.94    3 u   26   64  377   35.655    5.620   0.541
-time.rdg.uk.as4 84.2.44.19       3 u   40   64  377   19.761    3.070   0.197
-ntp1.ic.net.uk  158.43.128.33    2 u   43   64  377   18.153    3.659   0.176
-ns0.luns.net.uk 158.43.192.66    2 u   48   64  377   25.761    3.648   0.219
+ntppub.le.ac.uk 158.43.192.66    2 u   47   64  377   21.566    3.783   0.520

However for some reason it only works when I restart the NTP server a minute after boot. It may be that the kernel PPS device isn’t ready when the NTP server starts first time. In any case, I added this to /etc/rc.local:

( sleep 60 ; service ntp restart ) &

1 Comment

Filed under Uncategorized

Stratum-1 NTP server, part 1

I’m following the instructions here and here to try and make a Stratum-1 NTP server using GPS and a Raspberry Pi 2. If this works, I should have a very accurate NTP server for a very reasonable amount of money.

20150704_134742

I ordered the Raspberry Pi 2 from Amazon, and the other parts from HAB Supplies in the UK. The total cost (prices include tax) was:

Raspberry Pi 2 £29.99
GPS expansion board £35.99
Antenna and cable £41.99
Postage £5.52
Total £113.49

Edit: I already had a spare 32GB SD card and power supply. If you don’t have those already, you’d need to buy them too.

Leave a comment

Filed under Uncategorized

AMD previewing Seattle at the Red Hat Summit

The announcement is here, and according to that announcement the development boards will be available in “second half” 2015.

Leave a comment

Filed under Uncategorized

New in nbdkit 1.1.10: OCaml plugins

You can now write OCaml plugins for nbdkit – the liberally licensed NBD server. You will, however, need OCaml ≥ 4.02.2+rc1 because of this fix.

Leave a comment

Filed under Uncategorized

KVM Forum 2015

Assuming HMG can get my passport back to me in time, I am speaking at the KVM Forum 2015 in Seattle USA (full schedule of talks here).

I’m going to be talking about virt-v2v and new features of qemu/KVM that made it possible for virt-v2v to be faster and more reliable than ever.

Leave a comment

Filed under Uncategorized

Booting RISC-V Linux with qemu

There are various open source ISAs and chip designs. I’ve previously run OpenRISC 1200 on an FPGA. Another effort is the RISC-V (“RISC Five”) project, which is developing an open, patent-free 64 bit ISA. It has a sister project lowRISC which aims to produce a synthesizable RISC-V FPGA design “in 6 months”, and tape out by the end of this year (I’m a little skeptical of the timeframes).

RISC-V has added support to a fork of qemu:

$ git remote add riscv https://github.com/riscv/riscv-qemu
$ git fetch riscv
$ git checkout -b riscv-master --track riscv/master
$ ./configure --target-list="riscv-softmmu"
$ make
$ ./riscv-softmmu/qemu-system-riscv -cpu \?
RISCV 'riscv-generic'
$ ./riscv-softmmu/qemu-system-riscv -machine \?
Supported machines are:
board                RISCV Board (default)
none                 empty machine

To save yourself a world of pain, download a RISC-V Linux kernel binary and root image from here.

$ file ~/vmlinux
/home/rjones/vmlinux: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), statically linked, BuildID[sha1]=d0a6d680362018e0f3b9208a7ea7f79b2b403f7c, not stripped

Then you can boot the image in the usual way:

$ ./riscv-softmmu/qemu-system-riscv \
    -display none \
    -kernel ~/vmlinux \
    -hda ~/root.bin \
    -serial stdio

The root filesystem is very sparse:

# uname -a
Linux ucbvax 3.14.15-g4073e84-dirty #4 Sun Jan 11 07:17:06 PST 2015 riscv GNU/Linux
# ls /bin
ash       chgrp     dd        ln        mv        rmdir     touch
base64    chmod     df        ls        nice      sleep     true
busybox   chown     echo      mkdir     printenv  stat      uname
cat       cp        false     mknod     pwd       stty      usleep
catv      date      fsync     mount     rm        sync
# ls /sbin
init
# ls /usr/bin
[          dirname    groups     mkfifo     sha1sum    tac        uniq
[[         dos2unix   head       nohup      sha256sum  tail       unix2dos
basename   du         hostid     od         sha3sum    tee        uudecode
cal        env        id         printf     sha512sum  test       uuencode
cksum      expand     install    readlink   sort       tr         wc
comm       expr       logname    realpath   split      tty        whoami
cut        fold       md5sum     seq        sum        unexpand   yes

Obligatory comic strip

Leave a comment

Filed under Uncategorized