Re: OpenBSD UEFI on QEMU emulator

2020-10-23 Thread Brad Smith

On 10/22/2020 11:22 PM, Jonathan Gray wrote:

On Thu, Oct 22, 2020 at 10:37:31PM -0400, Brad Smith wrote:

On 10/22/2020 9:59 PM, Kevin Shell wrote:

Hello misc@.

I want to try out OpenBSD UEFI.
How to install OpenBSD with UEFI boot on qemu?

The installer does prompt you during disk setup.

The install68.iso has no UEFI support.

This is not true.

It does not include a fat fs el torito image with efiboot only
cdbr for mbr.


Ya, my bad. I interpreted what he meant there differently. I thought he was
implying there was no EFI support at all post-install. On any X86 hardware
where I don't run Windows I typically keep CSM enabled. As I find I am more
likely to have to boot something that still requires MBR like from a USB key
to do firmware updates, though I have seen some EFI compatible update
images for some things. But I have heard of systems without CSM, since it is
optional. I see how this would be an issue with EFI only environments.



Re: sysupgrade --download ?

2020-10-23 Thread Harald Dunkel

Hi Theo,

sorry, I missed that. I have associated "-n" with dry-run mode.


Thanx for the hint
Harri



Re: sysupgrade --download ?

2020-10-23 Thread Theo de Raadt
Harald Dunkel  wrote:

> I stumbled over a bad mirror for sysupgrade.
> 
> Would it be possibe to add an option "-d" to sysupgrade, to just
> download and verify the required files?

  sysupgrade -n

> A subsequent call without
> "-d" should verify the signatures in the download directory again
> and proceed.

  sysupgrade


It already exists.



sysupgrade --download ?

2020-10-23 Thread Harald Dunkel

Hi folks,

I stumbled over a bad mirror for sysupgrade.

Would it be possibe to add an option "-d" to sysupgrade, to just
download and verify the required files? A subsequent call without
"-d" should verify the signatures in the download directory again
and proceed.

I would like to make sure download works at usual business hours,
and to do the "real upgrade" with minimal effort at night time
when nobody gets disturbed by restarting the gateway.

Just a suggestion, of course. Keep on your good work.

Harri



Re: OpenBSD UEFI on QEMU emulator

2020-10-23 Thread Kevin Shell
On Fri, Oct 23, 2020 at 10:03:08PM -0400, Brad Smith wrote:
> On 10/22/2020 11:22 PM, Jonathan Gray wrote:
> > On Thu, Oct 22, 2020 at 10:37:31PM -0400, Brad Smith wrote:
> > > On 10/22/2020 9:59 PM, Kevin Shell wrote:
> > > > Hello misc@.
> > > >
> > > > I want to try out OpenBSD UEFI.
> > > > How to install OpenBSD with UEFI boot on qemu?
> > > The installer does prompt you during disk setup.
> > > > The install68.iso has no UEFI support.
> > > This is not true.
> > It does not include a fat fs el torito image with efiboot only
> > cdbr for mbr.
>
> Ya, my bad. I interpreted what he meant there differently. I thought he was
> implying there was no EFI support at all post-install. On any X86 hardware
> where I don't run Windows I typically keep CSM enabled. As I find I am more
> likely to have to boot something that still requires MBR like from a USB key
> to do firmware updates, though I have seen some EFI compatible update
> images for some things. But I have heard of systems without CSM, since it is
> optional. I see how this would be an issue with EFI only environments.
>

The OpenBSD .iso image file is not
hybrid image(both BIOS/UEFI iso9660 and USB boot drive support),
Linux, FreeBSD, NetBSD all produce hybrid iso images,
I want to know why OpenBSD not do the same. :-)

--
kevin



Re: OpenBSD UEFI on QEMU emulator

2020-10-23 Thread Kevin Shell
Why I keep received 2 copies email again?
Please don't To or Cc me. :-)

On Fri, Oct 23, 2020 at 07:58:27AM -0600, jpegb...@dismail.de wrote:
> I would also like to point out that kevin doesn't have a virtual disk
> to install openbsd to, just the openbsd iso. You can create one with
> qemu-create I think, and then you should add that file to the drive
> parameter aswell.

I know.

I just try out to see if OpenBSD can boot UEFI mode under qemu,
so no need to create an image.

I've booted OpenBSD under UEFI mode,
but the font is very small,
the qemu window is very tall, I can't see the bottom lines of texts.



Re: Sound/audio onFirefox on 6.8

2020-10-23 Thread Maurice McCarthy
On 23/10/2020, Duncan Patton a Campbell  wrote:
>
> Hey Maurice.  The audio works elsewhere and this looks to be
> a Zombie Bugzilla bug come back from the dead.  Something
> about needing to directly link to sndio and skip the "cubeb" something...
>
> Dhu
>

Ah, so "works elsewhere" in your initial message refers to other
programs running under OpenBSD not other operating systems. Warned you
I was a numpty. In this case I'm completely clueless. That's normal
for me.

Good Luck



Re: OpenBSD UEFI on QEMU emulator

2020-10-23 Thread Kevin Shell
Please don't To or Cc me, I'm on the list.

On Fri, Oct 23, 2020 at 12:49:13PM +0900, YASUOKA Masahiko wrote:
> On Fri, 23 Oct 2020 09:59:24 +0800
> Kevin Shell  wrote:
> > I want to try out OpenBSD UEFI.
> > How to install OpenBSD with UEFI boot on qemu?
> > The install68.iso has no UEFI support.
> > My following command on Linux can't boot OpenBSD UEFI.
> >
> > qemu-system-x86_64 -enable-kvm \
> >-machine q35 \
> >-cpu host \
> >-smp cores=4,threads=1 \
> >-m 1G \
> >-bios /usr/share/edk2/ovmf/OVMF_CODE.fd \
> >-drive file=install68.img,format=raw
>
> Does the drive of "install68.img" appear on the boot menu on BIOS?
>

Oh finally I figure out how to boot OpenBSD from the UEFI shell.
But the qemu window gets very height and can't resize and I can't see the
bottom lines of texts, the font is *really* small.

> At least on my linux machine,
>
>   qemu-system-x86_64 -machine q35 -smp cores=4,threads=1 -m 1G
> -bios /usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
> -drive file=install68.img,format=raw
>
> doesn't boot as well.  The drive doesn't appear on the boot menu.
> But by removing "-machine q35" from the line, it booted successfully.

Maybe removing "-machine q35" makes
qemu works in BIOS compatible mode, not UEFI mode?

--
kevin



Re: Sound/audio onFirefox on 6.8

2020-10-23 Thread Duncan Patton a Campbell


Hey Maurice.  The audio works elsewhere and this looks to be 
a Zombie Bugzilla bug come back from the dead.  Something
about needing to directly link to sndio and skip the "cubeb" something...

Dhu

This is what shows up on the command line:

dhu@gate:BSD $ firefox   

[Child 41261, MediaDecoderStateMachine #1] WARNING: 4fb447d1100 Can't get cubeb 
context!: file 
/build/tmp/pobj/firefox-81.0.2/firefox-81.0.2/dom/media/AudioStream.cpp, line 
298
[Child 41261, MediaDecoderStateMachine #1] WARNING: Decoder=4fb2109ec00 
[OnMediaSinkAudioError]: file 
/build/tmp/pobj/firefox-81.0.2/firefox-81.0.2/dom/media/MediaDecoderStateMachine.cpp,
 line 3891
[Child 41261, MediaDecoderStateMachine #1] WARNING: Decoder=4fb6170e000 Decode 
error: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) - 
RefPtr 
mozilla::MediaSourceTrackDemuxer::DoGetSamples(int32_t): manager is detached.: 
file 
/build/tmp/pobj/firefox-81.0.2/firefox-81.0.2/dom/media/MediaDecoderStateMachine.cpp,
 line 3470
[Child 41261, MediaDecoderStateMachine #1] WARNING: Decoder=4fb6170e000 Decode 
error: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) - 
RefPtr 
mozilla::MediaSourceTrackDemuxer::DoGetSamples(int32_t): manager is detached.: 
file 
/build/tmp/pobj/firefox-81.0.2/firefox-81.0.2/dom/media/MediaDecoderStateMachine.cpp,
 line 3470
[Child 41261, MediaDecoderStateMachine #1] WARNING: Decoder=4fb6170e000 Decode 
error: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) - 
RefPtr 
mozilla::MediaSourceTrackDemuxer::DoGetSamples(int32_t): manager is detached.: 
file 
/build/tmp/pobj/firefox-81.0.2/firefox-81.0.2/dom/media/MediaDecoderStateMachine.cpp,
 line 3470
[Child 41261, MediaDecoderStateMachine #1] WARNING: Decoder=4fb6170e000 Decode 
error: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) - 
RefPtr 
mozilla::MediaSourceTrackDemuxer::DoGetSamples(int32_t): manager is detached.: 
file 
/build/tmp/pobj/firefox-81.0.2/firefox-81.0.2/dom/media/MediaDecoderStateMachine.cpp,
 line 3470
[Child 41261, MediaDecoderStateMachine #1] WARNING: Decoder=4fb6170e000 Decode 
error: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) - 
RefPtr 
mozilla::MediaSourceTrackDemuxer::DoGetSamples(int32_t): manager is detached.: 
file 
/build/tmp/pobj/firefox-81.0.2/firefox-81.0.2/dom/media/MediaDecoderStateMachine.cpp,
 line 3470


On Fri, 23 Oct 2020 20:44:54 +0100
Maurice McCarthy  wrote:

> Warning: Numpty speaking
> 
> Well this seems to give you access to audio hardware
> 
> azalia1 at pci0 dev 20 function 2 "ATI SBx00 HD Audio" rev 0x40: apic 4 int 16
> azalia1: codecs: Realtek/0x0892
> audio0 at azalia1
> 
> So I can only point you at this
> https://www.openbsd.org/faq/faq13.html#audioprob
> 
> Good Luck
> 
> 


-- 
Je suis Canadien. Ce n'est pas Francais ou Anglaise.  
 C'est une esp`ece de sauvage: ne obliviscaris, vix ea nostra voco;-) 



Re: Sound/audio onFirefox on 6.8

2020-10-23 Thread Maurice McCarthy
Warning: Numpty speaking

Well this seems to give you access to audio hardware

azalia1 at pci0 dev 20 function 2 "ATI SBx00 HD Audio" rev 0x40: apic 4 int 16
azalia1: codecs: Realtek/0x0892
audio0 at azalia1

So I can only point you at this
https://www.openbsd.org/faq/faq13.html#audioprob

Good Luck



Sound/audio onFirefox on 6.8

2020-10-23 Thread Duncan Patton a Campbell


doesn't work.  Works fine elsewhere.  Granted this is also
a ten year old board.

following is dmesg.  Any ideas are apreciated.  

Thanks,

Dhu

OpenBSD 6.8 (GENERIC.MP) #98: Sun Oct  4 18:13:26 MDT 2020
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 16894197760 (16111MB)
avail mem = 16367153152 (15608MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.5 @ 0x9f000 (66 entries)
bios0: vendor American Megatrends Inc. version "2301" date 08/09/2012
bios0: ASUSTeK Computer INC. M4A88TD-V EVO/USB3
acpi0 at bios0: ACPI 3.0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP APIC MCFG OEMB SRAT HPET
acpi0: wakeup devices PCE2(S4) PCE3(S4) PCE4(S4) PCE5(S4) PCE6(S4) PCE7(S4) 
PCE9(S4) PCEA(S4) PCEB(S4) PCEC(S4) SBAZ(S4) P0PC(S4) GEC_(S4) UHC1(S4) 
UHC2(S4) USB3(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD Phenom(tm) II X4 840 Processor, 3214.71 MHz, 10-05-03
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,MWAIT,CX16,POPCNT,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,3DNOW2,3DNOW,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,ITSC
cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 
16-way L2 cache
cpu0: ITLB 32 4KB entries fully associative, 16 4MB entries fully associative
cpu0: DTLB 48 4KB entries fully associative, 48 4MB entries fully associative
cpu0: AMD erratum 721 detected and fixed
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 200MHz
cpu0: mwait min=64, max=64, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: AMD Phenom(tm) II X4 840 Processor, 3214.30 MHz, 10-05-03
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,MWAIT,CX16,POPCNT,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,3DNOW2,3DNOW,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,ITSC
cpu1: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 
16-way L2 cache
cpu1: ITLB 32 4KB entries fully associative, 16 4MB entries fully associative
cpu1: DTLB 48 4KB entries fully associative, 48 4MB entries fully associative
cpu1: AMD erratum 721 detected and fixed
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: AMD Phenom(tm) II X4 840 Processor, 3214.30 MHz, 10-05-03
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,MWAIT,CX16,POPCNT,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,3DNOW2,3DNOW,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,ITSC
cpu2: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 
16-way L2 cache
cpu2: ITLB 32 4KB entries fully associative, 16 4MB entries fully associative
cpu2: DTLB 48 4KB entries fully associative, 48 4MB entries fully associative
cpu2: AMD erratum 721 detected and fixed
cpu2: smt 0, core 2, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: AMD Phenom(tm) II X4 840 Processor, 3214.31 MHz, 10-05-03
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,MWAIT,CX16,POPCNT,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,3DNOW2,3DNOW,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,ITSC
cpu3: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 
16-way L2 cache
cpu3: ITLB 32 4KB entries fully associative, 16 4MB entries fully associative
cpu3: DTLB 48 4KB entries fully associative, 48 4MB entries fully associative
cpu3: AMD erratum 721 detected and fixed
cpu3: smt 0, core 3, package 0
ioapic0 at mainbus0: apid 4 pa 0xfec0, version 21, 24 pins
acpimcfg0 at acpi0
acpimcfg0: addr 0xe000, bus 0-255
acpihpet0 at acpi0: 14318180 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (P0P1)
acpiprt2 at acpi0: bus -1 (PCE2)
acpiprt3 at acpi0: bus -1 (PCE3)
acpiprt4 at acpi0: bus -1 (PCE4)
acpiprt5 at acpi0: bus 2 (PCE9)
acpiprt6 at acpi0: bus 3 (PCEA)
acpiprt7 at acpi0: bus 4 (P0PC)
acpiprt8 at acpi0: bus 6 (PE21)
acpiec0 at acpi0
acpipci0 at acpi0 PCI0: 0x 0x0011 0x0001
acpicmos0 at acpi0
aibs0 at acpi0 RTMP RVLT RFAN GGRP GITM SITM
acpibtn0 at acpi0: PWRB
"PNP0C14" at acpi0 not configured
acpicpu0 at acpi0: C1(@1 halt!)
acpicpu1 at acpi0: C1(@1 halt!)
acpicpu2 at acpi0: C1(@1 halt!)
acpicpu3 at acpi0: C1(@1 halt!)
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "AMD RS880 Host" rev 0x00
ppb0 at pci0 dev 1 function 0 vendor "Asustek", unknown product 0x9602 rev 0x00
pci1 at ppb0 bus 1
radeondrm0 at pci1 dev 5 function 0 "ATI Radeon HD 4250" rev 0x00
drm0 at radeondrm0
radeondrm0: apic 4 int 18
azalia0 at pci1 dev 5 function 1 "ATI Radeon HD 4200 HD Audio" rev

Re: OpenBSD UEFI on QEMU emulator

2020-10-23 Thread jpegbild
I would also like to point out that kevin doesn't have a virtual disk
to install openbsd to, just the openbsd iso. You can create one with 
qemu-create I think, and then you should add that file to the drive
parameter aswell.

YASUOKA Masahiko  wrote:

> On Fri, 23 Oct 2020 09:59:24 +0800
> Kevin Shell  wrote:
> > I want to try out OpenBSD UEFI.
> > How to install OpenBSD with UEFI boot on qemu?
> > The install68.iso has no UEFI support.
> > My following command on Linux can't boot OpenBSD UEFI.
> > 
> > qemu-system-x86_64 -enable-kvm \
> >-machine q35 \
> >-cpu host \
> >-smp cores=4,threads=1 \
> >-m 1G \
> >-bios /usr/share/edk2/ovmf/OVMF_CODE.fd \
> >-drive file=install68.img,format=raw
> 
> Does the drive of "install68.img" appear on the boot menu on BIOS?
> 
> At least on my linux machine,
> 
>   qemu-system-x86_64 -machine q35 -smp cores=4,threads=1 -m 1G
> -bios /usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
> -drive file=install68.img,format=raw
> 
> doesn't boot as well.  The drive doesn't appear on the boot menu.
> But by removing "-machine q35" from the line, it booted successfully.



sasyncd question

2020-10-23 Thread Marko Cupać
Hi,

Is there a way to sync only SAs created on CARP interfaces, without
syncing those created on physical, non-CARP interfaces? Something like
no-sync option in pf.conf for pfsync?

I'm asking because I have a pair of firewalls where majority of IPsec
peers connect directly to non-CARP interfaces (GRE tunnels connected
with transport mode IPsec + OSPF), and just a few of them connect to
CARP interface (passive tunnel mode IPsec because of dynamic IP address
on peers). sasyncd now syncs everything, so CARP peers get SAS for
physical interfaces of other CARP member, which is undesirable, and I
guess also prolongs time to re-negotiate SAs.

Any other way how OpenBSD admins handle this situation?

Thank you in advance,

-- 
Before enlightenment - chop wood, draw water.
After  enlightenment - chop wood, draw water.

Marko Cupać
https://www.mimar.rs/



Re: Inphi CS4223 for 4x 10GbE SFP+

2020-10-23 Thread Harald Dunkel

Hi folks,

below you can find the summary of "openssl speed" on the network
appliance. Speed is not amazing, but AFAIU "openssl speed" is
single-threaded. The CPU has 8 cores (no hyperthreading).

Assuming IPsec encryption/decryption is running in kernel space, I
wonder if the OpenBSD kernel can make use of the 8 cores for running
several IPsec connections in parallel? Does it use AES?


Regards
Harri
Intel(R) Atom(TM) CPU C3758 @ 2.20GHz, 2195.40 MHz, 06-5f-01
8 cores

LibreSSL 3.2.2
built on: date not available
options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) idea(int) 
blowfish(idx) 
compiler: information not available
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes256 bytes   1024 bytes   8192 bytes
md2  0.00 0.00 0.00 0.00 0.00 
md4  13724.16k45836.82k   115244.57k   185000.74k   224988.79k
md5  12057.24k44613.25k   136613.93k   278648.09k   399437.57k
hmac(md5)12879.60k47239.51k   141646.50k   283716.38k   400684.06k
sha1 14261.27k48934.66k   126469.61k   210988.57k   261128.85k
rmd1607478.71k19132.30k36135.97k46448.78k50673.37k
rc4 221676.80k   361020.98k   420244.07k   435180.27k   439858.69k
des cbc  24940.07k25926.00k26213.89k26296.73k26323.26k
des ede3  9125.12k 9257.70k 9296.80k 9306.83k 9310.58k
idea cbc 19172.98k19989.11k20185.22k20235.06k20251.39k
seed cbc 0.00 0.00 0.00 0.00 0.00 
rc2 cbc   6654.11k 6724.98k 6744.20k 6749.21k 6752.28k
rc5-32/12 cbc0.00 0.00 0.00 0.00 0.00 
blowfish cbc 28152.30k29404.87k29758.43k29873.58k29907.60k
cast cbc 32971.96k34915.95k35399.95k35561.38k35606.62k
aes-128 cbc  42748.35k47506.54k49266.14k   123527.74k   124700.75k
aes-192 cbc  36277.25k39905.49k41139.80k   103818.63k   105167.86k
aes-256 cbc  31742.60k34425.15k35314.65k90007.22k90667.21k
camellia-128 cbc45902.96k76808.12k92168.33k97341.92k
98943.57k
camellia-192 cbc40179.04k62497.28k72516.04k75711.36k
76659.16k
camellia-256 cbc40040.61k62499.19k72515.95k75711.36k
76678.21k
sha256   17433.04k41804.06k73496.15k90807.03k97541.95k
sha512   14251.64k57007.97k93895.44k   133096.53k   152066.38k
whirlpool13191.30k28503.96k47912.31k57710.39k61385.57k
aes-128 ige  42754.84k44870.36k45810.90k45989.51k46038.50k
aes-192 ige  36277.18k38005.20k38754.83k38883.08k38926.97k
aes-256 ige  31741.82k33237.39k33254.74k33254.83k33255.17k
ghash   325142.67k   836113.05k  1256164.95k  1443524.30k  1517196.50k
aes-128 gcm  42352.61k   149903.52k   379077.66k   617644.48k   751160.13k
aes-256 gcm  40132.77k   141596.79k   342723.27k   538803.63k   641956.15k
chacha20 poly130512735.36k48161.34k91694.86k   119161.28k   
130459.64k
  signverifysign/s verify/s
rsa  512 bits 0.000215s 0.23s   4643.0  44006.6
rsa 1024 bits 0.000546s 0.53s   1830.9  18834.8
rsa 2048 bits 0.003018s 0.000164s331.4   6113.8
rsa 4096 bits 0.028494s 0.000586s 35.1   1705.6
  signverifysign/s verify/s
dsa  512 bits 0.000324s 0.000219s   3083.5   4561.2
dsa 1024 bits 0.000518s 0.000409s   1929.2   2447.1
dsa 2048 bits 0.001207s 0.001104s828.6905.7
  signverifysign/s verify/s
 160 bit ecdsa (secp160r1)   0.0015s   0.0011s671.4870.5
 192 bit ecdsa (nistp192)   0.0018s   0.0014s562.5724.7
 224 bit ecdsa (nistp224)   0.0023s   0.0018s433.5569.6
 256 bit ecdsa (nistp256)   0.0026s   0.0020s379.7503.0
 384 bit ecdsa (nistp384)   0.0051s   0.0035s196.5284.0
 521 bit ecdsa (nistp521)   0.0102s   0.0066s 97.8151.6
 163 bit ecdsa (nistk163)   0.0085s   0.0058s118.3171.9
 233 bit ecdsa (nistk233)   0.0208s   0.0142s 48.0 70.4
 283 bit ecdsa (nistk283)   0.0355s   0.0237s 28.1 42.2
 409 bit ecdsa (nistk409)   0.0970s   0.0646s 10.3 15.5
 571 bit ecdsa (nistk571)   0.2271s   0.1517s  4.4  6.6
 163 bit ecdsa (nistb163)   0.0084s   0.0056s118.6177.1
 233 bit ecdsa (nistb233)   0.0208s   0.0140s 48.2 71.3
 283 bit ecdsa (nistb283)   0.0355s   0.0242s 28.1 41.3
 409 bit ecdsa (nistb409)   0.0972s   0.0646s 10.3 15.5
 571 bit ecdsa (nistb571)   0.2267s   0.1518s  4.4  6.6
  op  op/s
 160 bit ecdh (secp160r1)   0.0013s774.4
 192 bit ecdh (nistp192)   0.0015s648.7
 224 bit ecdh (nistp224)   0.0020s492.4
 256 bit ecdh (ni

kqueue/kevent: EVFILT_TIMER inacurracy

2020-10-23 Thread mpfr
Given the following code (timertest.c):

#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 

int
main(int argc, char *argv[])
{
long longtimeout, elapsed;
int  kqfd;
struct timespec  ts0, ts;
struct keventkev;

if (argc < 2)
errx(1, "missing number of seconds");

timeout = atoll(argv[1]) * 1000;
if (errno || timeout <= 0)
err(1, "invalid number of seconds");

if ((kqfd = kqueue()) == -1)
err(1, "kqueue");

EV_SET(&kev, , EVFILT_TIMER, EV_ADD, 0, timeout, NULL);

if (clock_gettime(CLOCK_REALTIME, &ts0) == -1)
err(1, "clock_gettime");

if (kevent(kqfd, &kev, 1, NULL, 0, NULL) == -1)
err(1, "kevent");
printf("timer [%lld msec] started ... ", timeout);
fflush(stdout);

memset(&kev, 0, sizeof(kev));

if (kevent(kqfd, NULL, 0, &kev, 1, NULL) == -1)
err(1, "kevent");

if (kev.flags & EV_ERROR)
errx(1, "event error (%llu)", kev.data);

if (clock_gettime(CLOCK_REALTIME, &ts) == -1)
err(1, "clock_gettime");
timespecsub(&ts, &ts0, &ts);
elapsed = ts.tv_sec * 1000 + ts.tv_nsec / 100L;

printf("done\ntime elapsed: %lld msec\n>>> drift: %lld msec\n",
elapsed, elapsed - timeout);

return (0);
}


# cc timertest.c -o timertest

On an older machine, there is a noticeable clock drift:

# ./timertest 600
timer [60 msec] started ... done
time elapsed: 624008 msec
>>> drift: 24008 msec

On an idle VM, the drift is below noise...

# ./timertest 600
timer [60 msec] started ... done
time elapsed: 68 msec
>>> drift: 8 msec

... the same VM under 50% CPU load:

# ./timertest 600
timer [60 msec] started ... done
time elapsed: 609704 msec
>>> drift: 9704 msec

Is it the way I'm using kevent/EVFILT_TIMER?

Any help is being appreciated.