Re: unwind(8): use SO_REUSEADDR

2020-08-30 Thread Stuart Henderson
On 2020/08/29 20:06, Florian Obser wrote:
> I can't think of a downside, OK.
> (Not sure of a use case either though.)

It makes it easier to test unwind diffs on a machine that normally
runs another nameserver :)

OK.



Re: [PATCH 1/2] Add DMA remapping support for Intel VT-d and AMD Vi

2020-08-30 Thread George Koehler
On Tue, 11 Aug 2020 15:11:13 -0500
Your_Name  wrote:

> From 6990aec14f90638e1c433a71a30e4720da45ec86 Mon Sep 17 00:00:00 2001
> From: Jordan 
> Date: Tue, 11 Aug 2020 14:51:17 -0500
> Subject: [PATCH 1/2] Add DMA remapping support for Intel VT-d and AMD Vi
> 
> I have been working on adding support for PCI Passthrough to VMM.  This
> initial patch adds support for the IOMMU for Intel and AMD processors.
> It hooks the initial PCI probe and replaces the bus_dma_xxx functions
> for remapping page I/O.  I have tested this on my Intel and Ryzen
> boxes but would like some more eyes and testing on this.

My AMD Ryzen 5 3400G has so much trouble with your pci passthrough
diffs that I need to reboot to a snap kernel without your diffs.

One of the symptoms is an acpidmar "IOMMU Error" that appears at boot
when I'm starting the network:

starting network
=== IOMMU Error[]: io page fault
...
re0: 192.168.0.104 lease...

This time, I had unplugged my axe0, so my only network interfaces are
the motherboard's re0 and the usual lo0, enc0, pflog0.  I'm running
dhclient on re0.  Even with the error, dhclient succeeds and the re0
interface works normally.  The error doesn't always appear: it seems
more likely to appear if I power on (not reboot) after the computer
has been powered off for more than a short amount of time.

I also get some "ivhd command timeout"s while the system is running.
These timeouts can appear on ttyC0 after the network starts and before
xenodm starts, or in xconsole after xenodm starts.

There are problems with my boot drive (sd1 at scsibus1 at ahci0).  I
tried to cvs up my /usr/src, got a warning that some CVS/Root wasn't
an absolute path.  Moments later, the kernel froze (maybe trying to
enter ddb) and I forced a reboot into a snap kernel without acpidmar.
Then cvs up worked and the CVS/Root warning didn't appear.

All the previous symptoms happen without "vmctl start"ing any guests.
vmd is running with only a disabled template vm in vm.conf.

This dmesg includes the IOMMU Error and some timeouts.
amdgpu is disabled.

OpenBSD 6.7-current (GENERIC.MP) #1: Tue Aug 25 14:57:27 EDT 2020
r...@pehcehwahn.my.domain:/sys/arch/amd64/compile/GENERIC.MP
real mem = 14961672192 (14268MB)
avail mem = 14491107328 (13819MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xe6cf0 (59 entries)
bios0: vendor American Megatrends Inc. version "M.30" date 09/18/2019
bios0: Micro-Star International Co., Ltd MS-7B86
acpi0 at bios0: ACPI 6.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT FIDT SSDT SSDT SSDT MCFG HPET UEFI IVRS CRAT 
CDIT BGRT SSDT SSDT SSDT SSDT WSMT
acpi0: wakeup devices GPP0(S4) GPP2(S4) GPP3(S4) GPP4(S4) GPP5(S4) GPP6(S4) 
GP17(S4) XHC0(S4) XHC1(S4) GP18(S4) GPP1(S4) PT21(S3) PTXH(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 Ryzen 5 3400G with Radeon Vega Graphics, 3700.62 MHz, 17-18-01
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,PCLMUL,MWAIT,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,SKINIT,TCE,TOPEXT,CPCTR,DBKP,PCTRL3,MWAITX,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu0: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB 64b/line 
8-way L2 cache, 4MB 64b/line 16-way L3 cache
cpu0: ITLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu0: DTLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 25MHz
cpu0: mwait min=64, max=64, C-substates=1.1, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: AMD Ryzen 5 3400G with Radeon Vega Graphics, 3699.95 MHz, 17-18-01
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,PCLMUL,MWAIT,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,SKINIT,TCE,TOPEXT,CPCTR,DBKP,PCTRL3,MWAITX,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu1: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB 64b/line 
8-way L2 cache, 4MB 64b/line 16-way L3 cache
cpu1: ITLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu1: DTLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 4 (application processor)
cpu2: AMD Ryzen 5 3400G with Radeon Vega Graphics, 3699.95 MHz, 17-18-01
cpu2: 

Re: ntpd: go into unsynced mode

2020-08-30 Thread Otto Moerbeek
On Sat, Aug 22, 2020 at 03:51:48PM +0200, Otto Moerbeek wrote:

> Hi,
> 
> At the moment ntpd never goes into unsynced mode if network
> connectivity is lost. The code to do that is only triggered when a
> pakcet is received, which does not happen. 
> 
> This diff fixes that by going into unsynced mode if no time data was
> processed for a while. 
> 
> An earlier version of this diff was tested by naddy@. Compared to that
> version, the needed period of inactivity is now three times as large
> and I set scale to 1, so recovery goes faster.
> 
> Please test and review,

anyone wants to ok?

-Otto


> 
> Index: ntp.c
> ===
> RCS file: /cvs/src/usr.sbin/ntpd/ntp.c,v
> retrieving revision 1.165
> diff -u -p -r1.165 ntp.c
> --- ntp.c 22 Jun 2020 06:11:34 -  1.165
> +++ ntp.c 22 Aug 2020 13:48:34 -
> @@ -89,6 +89,7 @@ ntp_main(struct ntpd_conf *nconf, struct
>   struct stat  stb;
>   struct ctl_conn *cc;
>   time_t   nextaction, last_sensor_scan = 0, now;
> + time_t   last_action = 0, interval;
>   void*newp;
>  
>   if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, PF_UNSPEC,
> @@ -402,6 +403,7 @@ ntp_main(struct ntpd_conf *nconf, struct
>   for (; nfds > 0 && j < idx_clients; j++) {
>   if (pfd[j].revents & (POLLIN|POLLERR)) {
>   nfds--;
> + last_action = now;
>   if (client_dispatch(idx2peer[j - idx_peers],
>   conf->settime, conf->automatic) == -1) {
>   log_warn("pipe write error (settime)");
> @@ -417,8 +419,24 @@ ntp_main(struct ntpd_conf *nconf, struct
>   for (s = TAILQ_FIRST(>ntp_sensors); s != NULL;
>   s = next_s) {
>   next_s = TAILQ_NEXT(s, entry);
> - if (s->next <= getmonotime())
> + if (s->next <= now) {
> + last_action = now;
>   sensor_query(s);
> + }
> + }
> +
> + /*
> +  * Compute maximum of scale_interval(INTERVAL_QUERY_NORMAL),
> +  * if we did not process a time message for three times that
> +  * interval, stop advertising we're synced.
> +  */
> + interval = INTERVAL_QUERY_NORMAL * conf->scale;
> + interval += MAXIMUM(5, interval / 10) - 1;
> + if (conf->status.synced && last_action + 3 * interval < now) {
> + log_info("clock is now unsynced");
> + conf->status.synced = 0;
> + conf->scale = 1;
> + priv_dns(IMSG_UNSYNCED, NULL, 0);
>   }
>   }
>  
>