Removing the kernel timezone: config(8): drop timezone support
Drop config(8) support for getting/setting the kernel timezone. ok? Index: cmd.c === RCS file: /cvs/src/usr.sbin/config/cmd.c,v retrieving revision 1.20 diff -u -p -r1.20 cmd.c --- cmd.c 23 Nov 2013 17:38:15 - 1.20 +++ cmd.c 8 Aug 2019 02:39:33 - @@ -26,7 +26,6 @@ #include #include -#include #include #include @@ -57,7 +56,6 @@ cmd_table_t cmd_table[] = { {"show", Xshow, "[attr [val]]", "Show attribute"}, {"exit", Xexit, "", "Exit, without saving changes"}, {"quit", Xquit, "", "Quit, saving current changes"}, - {"timezone", Xtimezone, "[mins [dst]]", "Show/change timezone"}, {"bufcachepercent", Xbufcachepct, "[number]", "Show/change BUFCACHEPERCENT"}, {"nkmempg", Xnkmempg, "[number]", "Show/change NKMEMPAGES"}, @@ -245,37 +243,6 @@ Xexit(cmd_t *cmd) { /* Nothing to do here */ return (CMD_EXIT); -} - -int -Xtimezone(cmd_t *cmd) -{ - struct timezone *tz; - int num; - char*c; - - ukc_mod_kernel = 1; - tz = (struct timezone *)adjust((caddr_t)(nl[TZ_TZ].n_value)); - - if (strlen(cmd->args) == 0) { - printf("timezone = %d, dst = %d\n", - tz->tz_minuteswest, tz->tz_dsttime); - } else { - if (number(cmd->args, &num) == 0) { - tz->tz_minuteswest = num; - c = cmd->args; - while ((*c != '\0') && !isspace((unsigned char)*c)) - c++; - while (isspace((unsigned char)*c)) - c++; - if (strlen(c) != 0 && number(c, &num) == 0) - tz->tz_dsttime = num; - printf("timezone = %d, dst = %d\n", - tz->tz_minuteswest, tz->tz_dsttime); - } else - printf("Unknown argument\n"); - } - return (CMD_CONT); } void Index: ukcutil.c === RCS file: /cvs/src/usr.sbin/config/ukcutil.c,v retrieving revision 1.24 diff -u -p -r1.24 ukcutil.c --- ukcutil.c 14 May 2019 13:44:25 - 1.24 +++ ukcutil.c 8 Aug 2019 02:39:33 - @@ -25,7 +25,6 @@ */ #include -#include #include #include @@ -1398,7 +1397,6 @@ process_history(int len, char *buf) char *c; int devno, newno; short unit, state; - struct timezone *tz; if (len == 0) { printf("History is empty\n"); @@ -1468,21 +1466,6 @@ process_history(int len, char *buf) while (*c != '\n') c++; c++; - break; - case 't': - c++; - c++; - tz = (struct timezone *)adjust((caddr_t)nl[TZ_TZ]. - n_value); - tz->tz_minuteswest = atoi(c); - while (*c != ' ') - c++; - c++; - tz->tz_dsttime = atoi(c); - while (*c != '\n') - c++; - c++; - ukc_mod_kernel = 1; break; case 'q': while (*c != '\0') Index: ukc.h === RCS file: /cvs/src/usr.sbin/config/ukc.h,v retrieving revision 1.14 diff -u -p -r1.14 ukc.h --- ukc.h 27 Sep 2017 15:14:52 - 1.14 +++ ukc.h 8 Aug 2019 02:39:33 - @@ -41,14 +41,13 @@ #define I_TEXTRALOC11 #defineI_HISTLEN 12 #defineCA_HISTORY 13 -#define TZ_TZ 14 -#define P_PDEVNAMES15 -#define I_PDEVSIZE 16 -#define S_PDEVINIT 17 -#define I_NMBCLUSTERS 18 -#define I_BUFCACHEPCT 19 -#define I_NKMEMPG 20 -#define NLENTRIES 21 +#define P_PDEVNAMES14 +#define I_PDEVSIZE 15 +#define S_PDEVINIT 16 +#define I_NMBCLUSTERS 17 +#define I_BUFCACHEPCT 18 +#define I_NKMEMPG 19 +#define NLENTRIES 20 #ifdef UKC_MAIN struct nlist nl[] = { @@ -66,7 +65,6 @@ struct nlist nl[] = { { "_textraloc" }, { "_userconf_histlen" }, { "_userconf_history" }, - { "_tz" }, { "_pdevnames" }, { "_pdevnames_size" }, { "_pdevinit" }, @@ -90,7 +88,6 @@ struct nlist knl[] = { { "_textraloc" }, { "_userconf_histlen" }, { "_userconf_history" }, - { "_tz" }, { "_pdevnames" }, { "_pdevnames_size" }, { "_pdevinit" }, Index: config.8 === RCS file: /cvs/src/usr.sbin/config/config.8,v
amd64 Qemu Machine type and vmx(4) driver stability on QEMU Q35 machine vs QEMU i440fx machines
Hello I repeated the tests with the vmx(4) driver with the two Qemu machine types i440fx and Q35 the vmx(4) driver when attached to the i440fx machine performed much more reliably compared with the vmx(4) driver on Q35 gave timeout errors on the console and didnt function well enough to perform tests I have included the dmesg and pci dumps for the two vmx(4) virtual machines configurations below Hypervisor ,"Proxmox 6.0 running QEMU 4.0 Linux nve3 5.0.15-1-pve #1 SMP PVE 5.0.15-1 (Wed, 03 Jul 2019 10:51:57 +0200) x86_64 GNU/Linux",,, VM setup,2 each running with 2 cores on 1 Socket VM with 2GB ram assigned with host CPU passed through in KVM Machine type is i440fx,,, OpenBSD amd64 Current as of 20190802 Centos 7x86_64 Minimal 1810 Release Tests are Iperf3 with default settings Unidirectional TCP vmx,vmxnet nics connected to a linux bridge on the host ,,, --begin csv of vmxnet testing Firewall Status ,PF Enabled,PF Enabled,PF Enabled,N/A,PF Disabled ,PF Disabled ,PF Disabled , Test,OpenBSD->Centos,Centos->Openbsd,OpenBSD-OpenBSD,Centos-Centos,OpenBSD->Centos,Centos->Openbsd,OpenBSD-OpenBSD, 1,906,531,409,3530,633,510,404, 2,517,542,400,3480,623,528,417, 3,639,528,420,3470,637,540,399, 4,583,533,436,3710,620,541,415, 5,629,528,416,3590,528,541,421, 6,669,520,414,3490,661,543,434, 7,522,535,411,3540,647,533,429, 8,1160,522,372,3610,651,537,408, 9,683,544,342,3630,551,536,444, 10,649,530,423,3680,635,542,412, AVG,695.7,531.3,404.3,3573,618.6,535.1,418.3, STD DEV,195.8815118,7.674633542,27.57232912,84.46564061,43.80309477,9.960477454,14.00039682, -,-,-,-,-,-,-,-, -end--CSV--- begin-i440FX-VMXNET-dmesg-pcidump dmesg OpenBSD 6.5-current (GENERIC.MP) #2: Fri Aug 2 22:33:13 IST 2019 fireman@obsdcur20190730.ogmaconnect:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 4278038528 (4079MB) avail mem = 4138213376 (3946MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xf5920 (10 entries) bios0: vendor SeaBIOS version "rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org" date 04/01/2014 bios0: QEMU Standard PC (i440FX + PIIX, 1996) acpi0 at bios0: ACPI 1.0 acpi0: sleep states S3 S4 S5 acpi0: tables DSDT FACP APIC SSDT HPET acpi0: wakeup devices acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz, 465.49 MHz, 06-3e-04 cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,HTT,SSE3,PCLMUL,SSSE3,CX16,PCID,SSE4.1,SSE4.2,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,RDTSCP,LONG,LAHF,PERF,FSGSBASE,TSC_ADJUST,SMEP,ERMS,UMIP,MD_CLEAR,IBRS,IBPB,STIBP,SSBD,ARAT,XSAVEOPT,MELTDOWN cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 16-way L2 cache cpu0: ITLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped cpu0: DTLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges cpu0: apic clock running at 999MHz cpu1 at mainbus0: apid 1 (application processor) cpu1: Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz, 251.25 MHz, 06-3e-04 cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,HTT,SSE3,PCLMUL,SSSE3,CX16,PCID,SSE4.1,SSE4.2,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,RDTSCP,LONG,LAHF,PERF,FSGSBASE,TSC_ADJUST,SMEP,ERMS,UMIP,MD_CLEAR,IBRS,IBPB,STIBP,SSBD,ARAT,XSAVEOPT,MELTDOWN cpu1: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 16-way L2 cache cpu1: ITLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped cpu1: DTLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped cpu1: smt 0, core 1, package 0 ioapic0 at mainbus0: apid 0 pa 0xfec0, version 11, 24 pins acpihpet0 at acpi0: 1 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpicpu0 at acpi0: C1(@1 halt!) acpicpu1 at acpi0: C1(@1 halt!) "ACPI0006" at acpi0 not configured acpipci0 at acpi0 PCI0: _OSC failed acpicmos0 at acpi0 "PNP0A06" at acpi0 not configured "PNP0A06" at acpi0 not configured "PNP0A06" at acpi0 not configured "QEMU0002" at acpi0 not configured "ACPI0010" at acpi0 not configured "QEMUVGID" at acpi0 not configured cpu0: using VERW MDS workaround pvbus0 at mainbus0: KVM pvclock0 at pvbus0 pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02 pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00 pciide0 at pci0 dev 1 function 1 "Intel 82371SB IDE" rev 0x00: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility pciide0: channel 0 disabled (no drives) atapiscsi0 at pciide0 channel 1 drive 0 scsibus1 at atapiscsi0: 2 targets cd0 at scsibus1 targ 0 lun 0: ATAPI 5
Re: Removing the kernel timezone: date(1): drop -d dst and -t minutes_west
Ted Unangst wrote: > Scott Cheloha wrote: > > It doesn't mean anything. I guess I'm still gunshy about removing > > options and breaking things after the lock(1) thing. > > If the default behavior changes, and the option is now meaningless, but still > results in the *same* behavior, keep the option. The user still obtains the > desired result. > > If the code that makes the option work has been deleted, and the behavior will > change, delete the option. The user is not obtaining the desired result. scott, you've been schooled.
Re: Removing the kernel timezone: date(1): drop -d dst and -t minutes_west
Scott Cheloha wrote: > - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1) > + while ((ch = getopt(argc, argv, "af:jr:uz:")) != -1) > switch(ch) { > case 'a': > slidetime = 1; > break; > - case 'd': /* daylight saving time */ > - tz.tz_dsttime = atoi(optarg) ? 1 : 0; > - break; > case 'f': /* parse with strptime */ > pformat = optarg; > break; as for the diff, this one looks good.
Re: Removing the kernel timezone: date(1): drop -d dst and -t minutes_west
Scott Cheloha wrote: > It doesn't mean anything. I guess I'm still gunshy about removing > options and breaking things after the lock(1) thing. If the default behavior changes, and the option is now meaningless, but still results in the *same* behavior, keep the option. The user still obtains the desired result. If the code that makes the option work has been deleted, and the behavior will change, delete the option. The user is not obtaining the desired result.
amd64 Qemu Machine type and re(4) driver stability on QEMU Q35 machine vs QEMU i440fx machines
Hello I was continuing some network performance tests and I tried out the Realtek RTL8139 (100Mb/s) card to compare how it behaved when running a re(4) Q35 Qemu vm running OpenBSD amd64 as opposed to re(4) card attached to a a i440fx Qemu Vm basically a re(4) card did not function when attached to a Q35 vm with repeated messages such as re0: watchdog timeout and the card did not function. on the i440fx machine OpenBSD vm functioned and performed in line with a standard 100Mb/s card expectations performance results are shown below Hypervisor ,"Proxmox 6.0 running QEMU 4.0 Linux nve3 5.0.15-1-pve #1 SMP PVE 5.0.15-1 (Wed, 03 Jul 2019 10:51:57 +0200) x86_64 GNU/Linux",,, VM setup,2 each running with 2 cores on 1 Socket VM with 2GB ram assigned with host CPU passed through in KVM Machine type is i440fx,,, OpenBSD amd64 Current as of 20190802 Centos 7x86_64 Minimal 1810 Release Tests are Iperf3 with default settings Unidirectional TCP realtek,Realtek RTL8139 nics connected to a linux bridge on the host ,,, BEGIN-CSV Results- Firewall Status ,PF Enabled,PF Enabled,PF Enabled,N/A,PF Disabled ,PF Disabled ,PF Disabled , Test,OpenBSD->Centos,Centos->Openbsd,OpenBSD-OpenBSD,Centos-Centos,OpenBSD->Centos,Centos->Openbsd,OpenBSD-OpenBSD, 1,227,112,309,248,248,116,298, 2,264,119,308,214,283,121,286, 3,274,119,291,175,318,121,305, 4,252,116,308,188,258,120,294, 5,276,115,314,225,287,118,295, 6,270,116,298,200,284,120,307, 7,212,116,291,240,269,119,285, 8,221,115,285,173,288,117,294, 9,295,113,293,177,275,117,341, 10,311,117,307,179,250,117,318, AVG,260.2,115.8,300.4,201.9,276,118.6,302.3, STD DEV,32.26900818,2.250925735,9.957688264,28.19948778,21.01851036,1.837873167,16.82623613, -,-,-,-,-,-,-,-, ---END CSV Results--- there were no results for the Q35 as the re(4) card would not even ping (arp incomplete) and repeated watchdog timeout messages dmesg & pcidump of re(4) on an i440fx box dmesg OpenBSD 6.5-current (GENERIC.MP) #2: Fri Aug 2 22:33:13 IST 2019 fireman@obsdcur20190730.ogmaconnect:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 4278038528 (4079MB) avail mem = 4138225664 (3946MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xf5920 (10 entries) bios0: vendor SeaBIOS version "rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org" date 04/01/2014 bios0: QEMU Standard PC (i440FX + PIIX, 1996) acpi0 at bios0: ACPI 1.0 acpi0: sleep states S3 S4 S5 acpi0: tables DSDT FACP APIC SSDT HPET acpi0: wakeup devices acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz, 462.92 MHz, 06-3e-04 cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,HTT,SSE3,PCLMUL,SSSE3,CX16,PCID,SSE4.1,SSE4.2,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,RDTSCP,LONG,LAHF,PERF,FSGSBASE,TSC_ADJUST,SMEP,ERMS,UMIP,MD_CLEAR,IBRS,IBPB,STIBP,SSBD,ARAT,XSAVEOPT,MELTDOWN cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 16-way L2 cache cpu0: ITLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped cpu0: DTLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges cpu0: apic clock running at 1000MHz cpu1 at mainbus0: apid 1 (application processor) cpu1: Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz, 250.82 MHz, 06-3e-04 cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,HTT,SSE3,PCLMUL,SSSE3,CX16,PCID,SSE4.1,SSE4.2,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,RDTSCP,LONG,LAHF,PERF,FSGSBASE,TSC_ADJUST,SMEP,ERMS,UMIP,MD_CLEAR,IBRS,IBPB,STIBP,SSBD,ARAT,XSAVEOPT,MELTDOWN cpu1: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 16-way L2 cache cpu1: ITLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped cpu1: DTLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped cpu1: smt 0, core 1, package 0 ioapic0 at mainbus0: apid 0 pa 0xfec0, version 11, 24 pins acpihpet0 at acpi0: 1 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpicpu0 at acpi0: C1(@1 halt!) acpicpu1 at acpi0: C1(@1 halt!) "ACPI0006" at acpi0 not configured acpipci0 at acpi0 PCI0: _OSC failed acpicmos0 at acpi0 "PNP0A06" at acpi0 not configured "PNP0A06" at acpi0 not configured "PNP0A06" at acpi0 not configured "QEMU0002" at acpi0 not configured "ACPI0010" at acpi0 not configured "QEMUVGID" at acpi0 not configured cpu0: using VERW MDS workaround pvbus0 at mainbus0: KVM pvclock0 at pvbus0 pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02 pc
Re: Removing the kernel timezone: date(1): drop -d dst and -t minutes_west
On Wed, Aug 07, 2019 at 06:08:45PM -0600, Theo de Raadt wrote: > Scott Cheloha wrote: > > > On Wed, Aug 07, 2019 at 05:52:54PM -0600, Theo de Raadt wrote: > > > Scott Cheloha wrote: > > > > > > > - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1) > > > > + while ((ch = getopt(argc, argv, "af:jr:uz:")) != -1) > > > > > > You remove d and t, so: > > > > > > > + case 'd': /* compat: daylight saving time > > > > */ > > > > break; > > > > > > Can't be reached. > > > > > > > + case 't': /* compat: minutes west of GMT > > > > */ > > > > break; > > > > > > Can't be reached. > > > > > > Whoops, corrected. > > > > Index: date.c > > === > > RCS file: /cvs/src/bin/date/date.c,v > > retrieving revision 1.55 > > diff -u -p -r1.55 date.c > > --- date.c 28 Jun 2019 13:34:58 - 1.55 > > +++ date.c 8 Aug 2019 00:06:09 - > > @@ -58,22 +58,19 @@ static void __dead usage(void); > > int > > main(int argc, char *argv[]) > > { > > - struct timezone tz; > > const char *errstr; > > struct tm *tp; > > int ch, rflag; > > char *format, buf[1024], *outzone = NULL; > > const char *pformat = NULL; > > > > - tz.tz_dsttime = tz.tz_minuteswest = 0; > > rflag = 0; > > - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1) > > + while ((ch = getopt(argc, argv, "ad:f:jr:t:uz:")) != -1) > > switch(ch) { > > case 'a': > > slidetime = 1; > > break; > > - case 'd': /* daylight saving time */ > > - tz.tz_dsttime = atoi(optarg) ? 1 : 0; > > + case 'd': /* compat: daylight saving time */ > > break; > > case 'f': /* parse with strptime */ > > pformat = optarg; > > @@ -91,10 +88,7 @@ main(int argc, char *argv[]) > > if (setenv("TZ", "UTC", 1) == -1) > > err(1, "cannot unsetenv TZ"); > > break; > > - case 't': /* minutes west of GMT */ > > - tz.tz_minuteswest = strtonum(optarg, 0, 24*60-1, > > &errstr); > > - if (errstr) > > - errx(1, "-t %s: %s", optarg, errstr); > > + case 't': /* compat: minutes west of GMT */ > > break; > > > I don't understand what you are trying to do. > > What does "compat" mean, when it ignores the option. Is it not better > to de-support the option, so that people know it doesn't behave same > anymore?? It doesn't mean anything. I guess I'm still gunshy about removing options and breaking things after the lock(1) thing. Index: date.c === RCS file: /cvs/src/bin/date/date.c,v retrieving revision 1.55 diff -u -p -r1.55 date.c --- date.c 28 Jun 2019 13:34:58 - 1.55 +++ date.c 8 Aug 2019 00:17:03 - @@ -58,23 +58,18 @@ static void __dead usage(void); int main(int argc, char *argv[]) { - struct timezone tz; const char *errstr; struct tm *tp; int ch, rflag; char *format, buf[1024], *outzone = NULL; const char *pformat = NULL; - tz.tz_dsttime = tz.tz_minuteswest = 0; rflag = 0; - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1) + while ((ch = getopt(argc, argv, "af:jr:uz:")) != -1) switch(ch) { case 'a': slidetime = 1; break; - case 'd': /* daylight saving time */ - tz.tz_dsttime = atoi(optarg) ? 1 : 0; - break; case 'f': /* parse with strptime */ pformat = optarg; break; @@ -91,11 +86,6 @@ main(int argc, char *argv[]) if (setenv("TZ", "UTC", 1) == -1) err(1, "cannot unsetenv TZ"); break; - case 't': /* minutes west of GMT */ - tz.tz_minuteswest = strtonum(optarg, 0, 24*60-1, &errstr); - if (errstr) - errx(1, "-t %s: %s", optarg, errstr); - break; case 'z': outzone = optarg; break; @@ -105,14 +95,6 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - /* -* If -d or -t, set the timezone or daylight saving time; this -* doesn't belong here, the kernel should not know about either. -*/ - if ((tz.tz_minuteswest || tz.tz_dsttime) && - settimeofday(NULL, &tz)) -
Re: Removing the kernel timezone: date(1): drop -d dst and -t minutes_west
Scott Cheloha wrote: > On Wed, Aug 07, 2019 at 05:52:54PM -0600, Theo de Raadt wrote: > > Scott Cheloha wrote: > > > > > - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1) > > > + while ((ch = getopt(argc, argv, "af:jr:uz:")) != -1) > > > > You remove d and t, so: > > > > > + case 'd': /* compat: daylight saving time */ > > > break; > > > > Can't be reached. > > > > > + case 't': /* compat: minutes west of GMT */ > > > break; > > > > Can't be reached. > > > Whoops, corrected. > > Index: date.c > === > RCS file: /cvs/src/bin/date/date.c,v > retrieving revision 1.55 > diff -u -p -r1.55 date.c > --- date.c28 Jun 2019 13:34:58 - 1.55 > +++ date.c8 Aug 2019 00:06:09 - > @@ -58,22 +58,19 @@ static void __dead usage(void); > int > main(int argc, char *argv[]) > { > - struct timezone tz; > const char *errstr; > struct tm *tp; > int ch, rflag; > char *format, buf[1024], *outzone = NULL; > const char *pformat = NULL; > > - tz.tz_dsttime = tz.tz_minuteswest = 0; > rflag = 0; > - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1) > + while ((ch = getopt(argc, argv, "ad:f:jr:t:uz:")) != -1) > switch(ch) { > case 'a': > slidetime = 1; > break; > - case 'd': /* daylight saving time */ > - tz.tz_dsttime = atoi(optarg) ? 1 : 0; > + case 'd': /* compat: daylight saving time */ > break; > case 'f': /* parse with strptime */ > pformat = optarg; > @@ -91,10 +88,7 @@ main(int argc, char *argv[]) > if (setenv("TZ", "UTC", 1) == -1) > err(1, "cannot unsetenv TZ"); > break; > - case 't': /* minutes west of GMT */ > - tz.tz_minuteswest = strtonum(optarg, 0, 24*60-1, > &errstr); > - if (errstr) > - errx(1, "-t %s: %s", optarg, errstr); > + case 't': /* compat: minutes west of GMT */ > break; I don't understand what you are trying to do. What does "compat" mean, when it ignores the option. Is it not better to de-support the option, so that people know it doesn't behave same anymore??
Re: Removing the kernel timezone: date(1): drop -d dst and -t minutes_west
On Wed, Aug 07, 2019 at 05:52:54PM -0600, Theo de Raadt wrote: > Scott Cheloha wrote: > > > - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1) > > + while ((ch = getopt(argc, argv, "af:jr:uz:")) != -1) > > You remove d and t, so: > > > + case 'd': /* compat: daylight saving time */ > > break; > > Can't be reached. > > > + case 't': /* compat: minutes west of GMT */ > > break; > > Can't be reached. Whoops, corrected. Index: date.c === RCS file: /cvs/src/bin/date/date.c,v retrieving revision 1.55 diff -u -p -r1.55 date.c --- date.c 28 Jun 2019 13:34:58 - 1.55 +++ date.c 8 Aug 2019 00:06:09 - @@ -58,22 +58,19 @@ static void __dead usage(void); int main(int argc, char *argv[]) { - struct timezone tz; const char *errstr; struct tm *tp; int ch, rflag; char *format, buf[1024], *outzone = NULL; const char *pformat = NULL; - tz.tz_dsttime = tz.tz_minuteswest = 0; rflag = 0; - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1) + while ((ch = getopt(argc, argv, "ad:f:jr:t:uz:")) != -1) switch(ch) { case 'a': slidetime = 1; break; - case 'd': /* daylight saving time */ - tz.tz_dsttime = atoi(optarg) ? 1 : 0; + case 'd': /* compat: daylight saving time */ break; case 'f': /* parse with strptime */ pformat = optarg; @@ -91,10 +88,7 @@ main(int argc, char *argv[]) if (setenv("TZ", "UTC", 1) == -1) err(1, "cannot unsetenv TZ"); break; - case 't': /* minutes west of GMT */ - tz.tz_minuteswest = strtonum(optarg, 0, 24*60-1, &errstr); - if (errstr) - errx(1, "-t %s: %s", optarg, errstr); + case 't': /* compat: minutes west of GMT */ break; case 'z': outzone = optarg; @@ -105,14 +99,6 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - /* -* If -d or -t, set the timezone or daylight saving time; this -* doesn't belong here, the kernel should not know about either. -*/ - if ((tz.tz_minuteswest || tz.tz_dsttime) && - settimeofday(NULL, &tz)) - err(1, "settimeofday"); - if (!rflag && time(&tval) == -1) err(1, "time"); @@ -279,9 +265,8 @@ badformat(void) static void __dead usage(void) { - (void)fprintf(stderr, - "usage: %s [-aju] [-d dst] [-f pformat] [-r seconds] " - "[-t minutes_west]\n" + fprintf(stderr, + "usage: %s [-aju] [-f pformat] [-r seconds]\n" "\t[-z output_zone] [+format] [[cc]yy]mm]dd]HH]MM[.SS]]\n", __progname); exit(1); Index: date.1 === RCS file: /cvs/src/bin/date/date.1,v retrieving revision 1.70 diff -u -p -r1.70 date.1 --- date.1 22 Jan 2019 06:53:30 - 1.70 +++ date.1 8 Aug 2019 00:06:09 - @@ -42,10 +42,8 @@ .Sh SYNOPSIS .Nm date .Op Fl aju -.Op Fl d Ar dst .Op Fl f Ar pformat .Op Fl r Ar seconds -.Op Fl t Ar minutes_west .Op Fl z Ar output_zone .Op Cm + Ns Ar format .Sm off @@ -78,15 +76,6 @@ Use the .Xr adjtime 2 call to gradually skew the local time to the desired time rather than just hopping. -.It Fl d Ar dst -Set the system's value for Daylight Saving Time. -If -.Ar dst -is non-zero, future calls -to -.Xr gettimeofday 2 -will return a non-zero value for -.Fa tz_dsttime . .It Fl f Ar pformat Parse the specified time using .Xr strptime 3 @@ -99,13 +88,6 @@ the clock. Print out (in specified format) the date and time represented by .Ar seconds from the Epoch. -.It Fl t Ar minutes_west -Set the system's value for minutes west of GMT. -.Ar minutes_west -specifies the number of minutes returned in -.Fa tz_minuteswest -by future calls to -.Xr gettimeofday 2 . .It Fl u Display or set the date in UTC (Coordinated Universal) time. .It Fl z Ar output_zone @@ -233,7 +215,7 @@ utility is compliant with the specification. .Pp The flags -.Op Fl adfjrtz , +.Op Fl afjrz , as well as the conversion specifiers .Ql \&%F , .Ql \&%G ,
Re: Removing the kernel timezone: date(1): drop -d dst and -t minutes_west
Scott Cheloha wrote: > - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1) > + while ((ch = getopt(argc, argv, "af:jr:uz:")) != -1) You remove d and t, so: > + case 'd': /* compat: daylight saving time */ > break; Can't be reached. > + case 't': /* compat: minutes west of GMT */ > break; Can't be reached.
amd64 Qemu Machine type and em(4) driver stability on QEMU Q35 machine vs QEMU i440fx machines
I have been continuing to do some (rudimentary) driver tests for performance If one wants to use PCI-E device passthrough they have to use Qemu machine type Q35 pc-q35-4.0 Standard PC (Q35 + ICH9, 2009) while most Qemu installations would use the following machine type pc-i440fx-4.0Standard PC (i440FX + PIIX, 1996) I noticed during testing using iperf3 (with defaults, that there were watchdog events for em0 on the Q35 machine and that the performance was less than half that of on the i440f fx machine --i440fx-Machine-tests--- Hypervisor "Proxmox 6.0 running QEMU 4.0 Linux nve3 5.0.15-1-pve #1 SMP PVE 5.0.15-1 (Wed, 03 Jul 2019 10:51:57 +0200) x86_64 GNU/Linux" VM setup,2 each running with 2 cores on 1 Socket VM with 2GB ram assigned with host CPU passed through in KVM Machine type is i440fx OpenBSD amd64 Current as of 20190802 Centos 7x86_64 Minimal 1810 Release Tests are Iperf3 with default settings Unidirectional TCP em1000,em1000 nics connected to a linux bridge on the host -csv of results below Firewall Status ,PF Enabled,PF Enabled,PF Enabled,N/A,PF Disabled ,PF Disabled ,PF Disabled , Test,OpenBSD->Centos,Centos->Openbsd,OpenBSD-OpenBSD,Centos-Centos,OpenBSD->Centos,Centos->Openbsd,OpenBSD-OpenBSD, 1,1480,1310,102,1570,2020,1370,388, 2,1450,1300,320,1490,1990,1340,357, 3,1540,1250,373,1590,2040,1410,339, 4,1490,1320,320,1620,1960,1430,244, 5,1480,1280,328,1520,2010,1420,319, 6,1500,1250,361,1530,1990,1300,307, 7,1510,1260,468,1540,2010,1350,386, 8,1490,1300,389,1560,1970,1270,395, 9,1500,1330,390,1560,1880,1350,406, 10,1520,1360,445,1530,2010,1370,396, AVG,1496,1296,349.6,1551,1988,1361,353.7, STD DEV,24.58545189,36.27058802,100.2809387,37.25288952,44.67164151,51.0881591,51.7430618, -,-,-,-,-,-,-,-, --end csv- Q35 machine Stats with em0 it would look like there is some sort of incompatibility between the PCI-e attached em0 and a PCI attached em0 -csv of results below Hypervisor ,"Proxmox 6.0 running QEMU 4.0 Linux nve3 5.0.15-1-pve #1 SMP PVE 5.0.15-1 (Wed, 03 Jul 2019 10:51:57 +0200) x86_64 GNU/Linux" VM setup,2 each running with 2 cores on 1 Socket VM with 2GB ram assigned with host CPU passed through in KVM Machine type is Q35 OpenBSD amd64 Current as of 20190802 Centos 7x86_64 Minimal 1810 Release Tests are Iperf3 with default settings Unidirectional TCP em1000,em1000 nics connected to a linux bridge on the host Firewall Status ,PF Enabled,PF Enabled,PF Enabled,N/A,PF Disabled ,PF Disabled ,PF Disabled, Test,OpenBSD->Centos,Centos->Openbsd,OpenBSD-OpenBSD,Centos-Centos,OpenBSD->Centos,Centos->Openbsd,OpenBSD-OpenBSD, 1,731,614,366,1551,764,584,378,, 2,680,609,378,1510,748,621,404,, 3,454,594,385,1571,762,591,391,, 4,649,587,381,1520,761,596,394,, 5,750,594,391,1570,764,608,,, 6,780,607,389,1600,662,601,,, 7,731,551,393,1550,781,602,,, 8,780,582,389,1580,778,615,,, 9,789,592,370,1490,758,592,,, 10,680,613,372,1570,778,597,,, AVG,702.4,594.3,381.4,1551.2,755.6,600.7,391.75,, STD DEV,99.4442334,18.85647546,9.559172442,34.52470935,34.45512379,11.33382352,10.71991915 -,-,-,-,-,-,-,- ,,,multiple watchdog errorsmultiple watchdog errors,, ,multiple watchdog errors,multiple watchdog errormultiple watchdog errors --end csv- watchdog errors were more likely seen on the OpenBSD box that was receiving packets in the bandwidth test watchdog errors that appeared on the console were varied em0: watchdog: head 430 tail 423 TDH 430 TDT 430 em0: watchdog: head 334 tail 299 TDH 334 TDT 334 em0: watchdog: head 413 tail 408 TDH 413 TDT 413 I think this issue might affect other network drivers that are attached via PCI-e to a Q35 Qemu machine Dmesg and PCI Dumps for each machine configuration included below i440fx dmesg and PCI Dump -- dmesg OpenBSD 6.5-current (GENERIC.MP) #2: Fri Aug 2 22:33:13 IST 2019 fireman@obsdcur20190730.ogmaconnect:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 4278038528 (4079MB) avail mem = 4138229760 (3946MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xf5920 (10 entries) bios0: vendor SeaBIOS version "rel-1.12.1-0-ga5cab58e9a3
Removing the kernel timezone: date(1): drop -d dst and -t minutes_west
This is the first in a series of patches that will remove timezone support from the kernel. Here, remove date(1) support for modifying the kernel's timezone. The flags are kept in the code so that scripts don't break immediately. ok? Index: date.c === RCS file: /cvs/src/bin/date/date.c,v retrieving revision 1.55 diff -u -p -r1.55 date.c --- date.c 28 Jun 2019 13:34:58 - 1.55 +++ date.c 7 Aug 2019 23:21:01 - @@ -58,22 +58,19 @@ static void __dead usage(void); int main(int argc, char *argv[]) { - struct timezone tz; const char *errstr; struct tm *tp; int ch, rflag; char *format, buf[1024], *outzone = NULL; const char *pformat = NULL; - tz.tz_dsttime = tz.tz_minuteswest = 0; rflag = 0; - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1) + while ((ch = getopt(argc, argv, "af:jr:uz:")) != -1) switch(ch) { case 'a': slidetime = 1; break; - case 'd': /* daylight saving time */ - tz.tz_dsttime = atoi(optarg) ? 1 : 0; + case 'd': /* compat: daylight saving time */ break; case 'f': /* parse with strptime */ pformat = optarg; @@ -91,10 +88,7 @@ main(int argc, char *argv[]) if (setenv("TZ", "UTC", 1) == -1) err(1, "cannot unsetenv TZ"); break; - case 't': /* minutes west of GMT */ - tz.tz_minuteswest = strtonum(optarg, 0, 24*60-1, &errstr); - if (errstr) - errx(1, "-t %s: %s", optarg, errstr); + case 't': /* compat: minutes west of GMT */ break; case 'z': outzone = optarg; @@ -105,14 +99,6 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - /* -* If -d or -t, set the timezone or daylight saving time; this -* doesn't belong here, the kernel should not know about either. -*/ - if ((tz.tz_minuteswest || tz.tz_dsttime) && - settimeofday(NULL, &tz)) - err(1, "settimeofday"); - if (!rflag && time(&tval) == -1) err(1, "time"); @@ -279,9 +265,8 @@ badformat(void) static void __dead usage(void) { - (void)fprintf(stderr, - "usage: %s [-aju] [-d dst] [-f pformat] [-r seconds] " - "[-t minutes_west]\n" + fprintf(stderr, + "usage: %s [-aju] [-f pformat] [-r seconds]\n" "\t[-z output_zone] [+format] [[cc]yy]mm]dd]HH]MM[.SS]]\n", __progname); exit(1); Index: date.1 === RCS file: /cvs/src/bin/date/date.1,v retrieving revision 1.70 diff -u -p -r1.70 date.1 --- date.1 22 Jan 2019 06:53:30 - 1.70 +++ date.1 7 Aug 2019 23:21:01 - @@ -42,10 +42,8 @@ .Sh SYNOPSIS .Nm date .Op Fl aju -.Op Fl d Ar dst .Op Fl f Ar pformat .Op Fl r Ar seconds -.Op Fl t Ar minutes_west .Op Fl z Ar output_zone .Op Cm + Ns Ar format .Sm off @@ -78,15 +76,6 @@ Use the .Xr adjtime 2 call to gradually skew the local time to the desired time rather than just hopping. -.It Fl d Ar dst -Set the system's value for Daylight Saving Time. -If -.Ar dst -is non-zero, future calls -to -.Xr gettimeofday 2 -will return a non-zero value for -.Fa tz_dsttime . .It Fl f Ar pformat Parse the specified time using .Xr strptime 3 @@ -99,13 +88,6 @@ the clock. Print out (in specified format) the date and time represented by .Ar seconds from the Epoch. -.It Fl t Ar minutes_west -Set the system's value for minutes west of GMT. -.Ar minutes_west -specifies the number of minutes returned in -.Fa tz_minuteswest -by future calls to -.Xr gettimeofday 2 . .It Fl u Display or set the date in UTC (Coordinated Universal) time. .It Fl z Ar output_zone @@ -233,7 +215,7 @@ utility is compliant with the specification. .Pp The flags -.Op Fl adfjrtz , +.Op Fl afjrz , as well as the conversion specifiers .Ql \&%F , .Ql \&%G ,
Re: TSC synchronization on MP machines
On 6.8.2019. 22:29, Paul Irofti wrote: > Hi, > > Here is a fourth diff addressing all the issues so far, that have been > mainly pointed out by kettenis@, thanks! > > Changes: > - stop resetting the observed drift as it does not affect tsc > re-initialization on resume, thus removing all changes from > acpi_machdep.c > - fix comment and put a temporary pretty printf of resume > - rename cpu_cc_skew to ci_tsc_skew > - remove unfinished code using MSR_TSC for synchronization (to > be added later on together with the missing IA32_TSC_ADJUST > wrmsr commands) > > All other technical issues were discussed and settled in private and > require no change to the former diff. > > > For testing you can also use the regress test after booting with tsc as > default clock and waiting for an hour or so to let the clocks go wild: > > # cd /usr/src/regress/sys/kern/clock_gettime > # make regress > > There is another test program flying around the mailing lists I guess, > but I could not locate it now so if someone is kind enough to reply with > the code, that would be lovely! > > Paul Hi, I applied this diff on Dell R6415 with AMD EPYC 7551P with 32/64 cores, run regress and test program that tb@ pointed out .. and everything seem right .. r6415# sysctl kern.timecounter.hardware kern.timecounter.hardware=tsc r6415# dmesg | grep tsc_timecounter_init tsc_timecounter_init: TSC skew=0 observed drift=0 tsc_timecounter_init: TSC skew=-260 observed drift=0 tsc_timecounter_init: TSC skew=-240 observed drift=0 tsc_timecounter_init: TSC skew=-470 observed drift=0 tsc_timecounter_init: TSC skew=120 observed drift=0 tsc_timecounter_init: TSC skew=-480 observed drift=0 tsc_timecounter_init: TSC skew=-520 observed drift=0 tsc_timecounter_init: TSC skew=-440 observed drift=0 tsc_timecounter_init: TSC skew=-10 observed drift=0 tsc_timecounter_init: TSC skew=-460 observed drift=0 tsc_timecounter_init: TSC skew=-490 observed drift=0 tsc_timecounter_init: TSC skew=-440 observed drift=0 tsc_timecounter_init: TSC skew=110 observed drift=0 tsc_timecounter_init: TSC skew=-470 observed drift=0 tsc_timecounter_init: TSC skew=-490 observed drift=0 tsc_timecounter_init: TSC skew=-440 observed drift=0 tsc_timecounter_init: TSC skew=-30 observed drift=0 tsc_timecounter_init: TSC skew=-470 observed drift=0 tsc_timecounter_init: TSC skew=-490 observed drift=0 tsc_timecounter_init: TSC skew=-430 observed drift=0 tsc_timecounter_init: TSC skew=110 observed drift=0 tsc_timecounter_init: TSC skew=-480 observed drift=0 tsc_timecounter_init: TSC skew=-470 observed drift=0 tsc_timecounter_init: TSC skew=-450 observed drift=0 tsc_timecounter_init: TSC skew=20 observed drift=0 tsc_timecounter_init: TSC skew=-470 observed drift=0 tsc_timecounter_init: TSC skew=-470 observed drift=0 tsc_timecounter_init: TSC skew=-450 observed drift=0 tsc_timecounter_init: TSC skew=110 observed drift=0 tsc_timecounter_init: TSC skew=-460 observed drift=0 tsc_timecounter_init: TSC skew=-480 observed drift=0 tsc_timecounter_init: TSC skew=-440 observed drift=0 tsc_timecounter_init: TSC skew=-10 observed drift=0 tsc_timecounter_init: TSC skew=-460 observed drift=0 tsc_timecounter_init: TSC skew=-490 observed drift=0 tsc_timecounter_init: TSC skew=-450 observed drift=0 tsc_timecounter_init: TSC skew=130 observed drift=0 tsc_timecounter_init: TSC skew=-460 observed drift=0 tsc_timecounter_init: TSC skew=-480 observed drift=0 tsc_timecounter_init: TSC skew=-430 observed drift=0 tsc_timecounter_init: TSC skew=70 observed drift=0 tsc_timecounter_init: TSC skew=-480 observed drift=0 tsc_timecounter_init: TSC skew=-510 observed drift=0 tsc_timecounter_init: TSC skew=-430 observed drift=0 tsc_timecounter_init: TSC skew=140 observed drift=0 tsc_timecounter_init: TSC skew=-460 observed drift=0 tsc_timecounter_init: TSC skew=-490 observed drift=0 tsc_timecounter_init: TSC skew=-430 observed drift=0 tsc_timecounter_init: TSC skew=20 observed drift=0 tsc_timecounter_init: TSC skew=-490 observed drift=0 tsc_timecounter_init: TSC skew=-500 observed drift=0 tsc_timecounter_init: TSC skew=-430 observed drift=0 tsc_timecounter_init: TSC skew=-380 observed drift=0 tsc_timecounter_init: TSC skew=-460 observed drift=0 tsc_timecounter_init: TSC skew=-490 observed drift=0 tsc_timecounter_init: TSC skew=-470 observed drift=0 tsc_timecounter_init: TSC skew=0 observed drift=0 tsc_timecounter_init: TSC skew=-460 observed drift=0 tsc_timecounter_init: TSC skew=-480 observed drift=0 tsc_timecounter_init: TSC skew=-440 observed drift=0 tsc_timecounter_init: TSC skew=130 observed drift=0 tsc_timecounter_init: TSC skew=-450 observed drift=0 tsc_timecounter_init: TSC skew=-510 observed drift=0 tsc_timecounter_init: TSC skew=-480 observed drift=0 r6415# dmesg | grep tsc_timecounter_init | wc -l 64 OpenBSD 6.5-current (GENERIC.MP) #4: Wed Aug 7 13:45:08 CEST 2019 hrv...@r6415.lala:/sys/arch/amd64/compile/GENERIC.MP real mem = 27452
Re: TSC synchronization on MP machines
> Date: Tue, 6 Aug 2019 23:29:30 +0300 > From: Paul Irofti > > Hi, > > Here is a fourth diff addressing all the issues so far, that have been > mainly pointed out by kettenis@, thanks! > > Changes: > - stop resetting the observed drift as it does not affect tsc > re-initialization on resume, thus removing all changes from > acpi_machdep.c > - fix comment and put a temporary pretty printf of resume > - rename cpu_cc_skew to ci_tsc_skew > - remove unfinished code using MSR_TSC for synchronization (to > be added later on together with the missing IA32_TSC_ADJUST > wrmsr commands) > > All other technical issues were discussed and settled in private and > require no change to the former diff. > > > For testing you can also use the regress test after booting with tsc as > default clock and waiting for an hour or so to let the clocks go wild: > > # cd /usr/src/regress/sys/kern/clock_gettime > # make regress > > There is another test program flying around the mailing lists I guess, > but I could not locate it now so if someone is kind enough to reply with > the code, that would be lovely! > > Paul Hi Paul, Still some small questions/issues now that the MSR thing has been cleared up. With those issues fixed, this is ok kettenis@ > Index: arch/amd64/amd64/cpu.c > === > RCS file: /cvs/src/sys/arch/amd64/amd64/cpu.c,v > retrieving revision 1.137 > diff -u -p -u -p -r1.137 cpu.c > --- arch/amd64/amd64/cpu.c28 May 2019 18:17:01 - 1.137 > +++ arch/amd64/amd64/cpu.c6 Aug 2019 20:19:27 - > @@ -754,6 +754,10 @@ cpu_init(struct cpu_info *ci) > cr4 = rcr4(); > lcr4(cr4 & ~CR4_PGE); > lcr4(cr4); > + > + /* Synchronize TSC */ > + if (cold && !CPU_IS_PRIMARY(ci)) > + tsc_sync_ap(ci); > #endif > } > > @@ -808,6 +812,7 @@ void > cpu_start_secondary(struct cpu_info *ci) > { > int i; > + u_long s; > > ci->ci_flags |= CPUF_AP; > > @@ -828,6 +833,18 @@ cpu_start_secondary(struct cpu_info *ci) > printf("dropping into debugger; continue from here to resume > boot\n"); > db_enter(); > #endif > + } else { > + /* > + * Synchronize time stamp counters. Invalidate cache and > + * synchronize twice (in tsc_sync_bp) to minimize possible > + * cache effects. Disable interrupts to try and rule out any > + * external interference. > + */ > + s = intr_disable(); > + wbinvd(); > + tsc_sync_bp(ci); > + intr_restore(s); > + printf("TSC skew=%lld\n", (long long)ci->ci_tsc_skew); > } > > if ((ci->ci_flags & CPUF_IDENTIFIED) == 0) { > @@ -852,6 +869,8 @@ void > cpu_boot_secondary(struct cpu_info *ci) > { > int i; > + int64_t drift; > + u_long s; > > atomic_setbits_int(&ci->ci_flags, CPUF_GO); > > @@ -864,6 +883,17 @@ cpu_boot_secondary(struct cpu_info *ci) > printf("dropping into debugger; continue from here to resume > boot\n"); > db_enter(); > #endif > + } else if (cold) { > + /* Synchronize TSC again, check for drift. */ > + drift = ci->ci_tsc_skew; > + s = intr_disable(); > + wbinvd(); > + tsc_sync_bp(ci); > + intr_restore(s); > + drift -= ci->ci_tsc_skew; > + printf("TSC skew=%lld drift=%lld\n", > + (long long)ci->ci_tsc_skew, (long long)drift); > + tsc_sync_drift(drift); > } > } > > @@ -888,7 +918,14 @@ cpu_hatch(void *v) > panic("%s: already running!?", ci->ci_dev->dv_xname); > #endif > > + /* > + * Synchronize the TSC for the first time. Note that interrupts are > + * off at this point. > + */ > + wbinvd(); > ci->ci_flags |= CPUF_PRESENT; > + ci->ci_tsc_skew = 0;/* reset on resume */ > + tsc_sync_ap(ci); > > lapic_enable(); > lapic_startclock(); > Index: arch/amd64/amd64/tsc.c > === > RCS file: /cvs/src/sys/arch/amd64/amd64/tsc.c,v > retrieving revision 1.11 > diff -u -p -u -p -r1.11 tsc.c > --- arch/amd64/amd64/tsc.c6 Jun 2019 19:43:35 - 1.11 > +++ arch/amd64/amd64/tsc.c6 Aug 2019 20:19:27 - > @@ -1,8 +1,10 @@ > /* $OpenBSD: tsc.c,v 1.11 2019/06/06 19:43:35 kettenis Exp $ */ > /* > + * Copyright (c) 2008 The NetBSD Foundation, Inc. > * Copyright (c) 2016,2017 Reyk Floeter > * Copyright (c) 2017 Adam Steen > * Copyright (c) 2017 Mike Belopuhov > + * Copyright (c) 2019 Paul Irofti > * > * Permission to use, copy, modify, and distribute this software for any > * purpose with or without fee is hereby granted, provided that the above > @@ -20,6 +22,7 @@ > #include > #include >
Re: TSC synchronization on MP machines
On Tue, Aug 06, 2019 at 11:29:30PM +0300, Paul Irofti wrote: > Hi, > > Here is a fourth diff addressing all the issues so far, that have been > mainly pointed out by kettenis@, thanks! > > Changes: > - stop resetting the observed drift as it does not affect tsc > re-initialization on resume, thus removing all changes from > acpi_machdep.c > - fix comment and put a temporary pretty printf of resume > - rename cpu_cc_skew to ci_tsc_skew > - remove unfinished code using MSR_TSC for synchronization (to > be added later on together with the missing IA32_TSC_ADJUST > wrmsr commands) > > All other technical issues were discussed and settled in private and > require no change to the former diff. > > > For testing you can also use the regress test after booting with tsc as > default clock and waiting for an hour or so to let the clocks go wild: > > # cd /usr/src/regress/sys/kern/clock_gettime > # make regress > > There is another test program flying around the mailing lists I guess, > but I could not locate it now so if someone is kind enough to reply with > the code, that would be lovely! > Works fine on my AMD Phenom(tm) II X6 1055T system. I remember some TSC issues with this box but running the test code posted by tb@ never triggered even during a make build. -- :wq Claudio
Re: apmd C getopt flag unused?
On Wed, Aug 07, 2019 at 12:40:03PM +0200, Claudio Jeker wrote: > On Wed, Aug 07, 2019 at 12:33:58PM +0200, Solene Rapenne wrote: > > I found case 'C' in getopt in amd which is not documented and seems to > > be an alias for -A. > > > > Ok for removing? > > Please don't, I think many people still use the old apmd -C (at least I do > have it on a few systems). Also you should remove it from the getopt > string. OK For history, commit message removing -C flag and making it fallback on -A https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/apmd/apmd.c?rev=1.71&content-type=text/x-cvsweb-markup
Re: apmd C getopt flag unused?
On Wed, Aug 07, 2019 at 12:33:58PM +0200, Solene Rapenne wrote: > I found case 'C' in getopt in amd which is not documented and seems to > be an alias for -A. > > Ok for removing? Please don't, I think many people still use the old apmd -C (at least I do have it on a few systems). Also you should remove it from the getopt string. > Index: apmd.c > === > RCS file: /data/cvs/src/usr.sbin/apmd/apmd.c,v > retrieving revision 1.84 > diff -u -p -r1.84 apmd.c > --- apmd.c4 Dec 2018 18:00:57 - 1.84 > +++ apmd.c7 Aug 2019 10:30:49 - > @@ -417,7 +417,6 @@ main(int argc, char *argv[]) > statonly = 1; > break; > case 'A': > - case 'C': > if (doperf != PERF_NONE) > usage(); > doperf = PERF_AUTO; > -- :wq Claudio
Re: apmd C getopt flag unused?
On Wed, Aug 07, 2019 at 12:33:58PM +0200, Solene Rapenne wrote: > I found case 'C' in getopt in amd which is not documented and seems to > be an alias for -A. > > Ok for removing? > > Index: apmd.c > === > RCS file: /data/cvs/src/usr.sbin/apmd/apmd.c,v > retrieving revision 1.84 > diff -u -p -r1.84 apmd.c > --- apmd.c4 Dec 2018 18:00:57 - 1.84 > +++ apmd.c7 Aug 2019 10:30:49 - > @@ -417,7 +417,6 @@ main(int argc, char *argv[]) > statonly = 1; > break; > case 'A': > - case 'C': > if (doperf != PERF_NONE) > usage(); > doperf = PERF_AUTO; > I sent my mail to quick. C is "PERF_COOL" profile but it doesn't seem used anymore because case 'A' and 'C' have PERF_AUTO but there is still a few lines about PERF_COOL. If someone confirms me it's obsolete, I'll do a proper diff for cleaning this.
apmd C getopt flag unused?
I found case 'C' in getopt in amd which is not documented and seems to be an alias for -A. Ok for removing? Index: apmd.c === RCS file: /data/cvs/src/usr.sbin/apmd/apmd.c,v retrieving revision 1.84 diff -u -p -r1.84 apmd.c --- apmd.c 4 Dec 2018 18:00:57 - 1.84 +++ apmd.c 7 Aug 2019 10:30:49 - @@ -417,7 +417,6 @@ main(int argc, char *argv[]) statonly = 1; break; case 'A': - case 'C': if (doperf != PERF_NONE) usage(); doperf = PERF_AUTO;
unveil(2) missing codepath on dhcpd(8)
Hi, One missing piece when I added pledge(2) to dhcpd(8) was in the code path when it's invoked with either -A/-C/-L, which at the time I left alone due to some forbidden ioctls by pledge(2). Now we have unveil(2) and this path can be further restricted by using it instead of chroot(2) since this "sandbox" (not sure why people call sandbox to about everything these days) can be escaped with *at(2) calls. Since no filesystem access is needed here then we can disable its access by calling unveil("/", "") unveil(NULL, NULL). Comments? OK? Index: pfutils.c === RCS file: /cvs/src/usr.sbin/dhcpd/pfutils.c,v retrieving revision 1.20 diff -u -p -u -r1.20 pfutils.c --- pfutils.c 28 Jun 2019 13:32:47 - 1.20 +++ pfutils.c 6 Aug 2019 13:28:11 - @@ -54,14 +54,16 @@ pftable_handler() if ((fd = open(_PATH_DEV_PF, O_RDWR|O_NOFOLLOW, 0660)) == -1) fatal("can't open pf device"); - if (chroot(_PATH_VAREMPTY) == -1) - fatal("chroot %s", _PATH_VAREMPTY); - if (chdir("/") == -1) - fatal("chdir(\"/\")"); + if (setgroups(1, &pw->pw_gid) || setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) fatal("can't drop privileges"); + + if (unveil("/", "") == -1) + fatal("unveil"); + if (unveil(NULL, NULL) == -1) + fatal("unveil"); setproctitle("pf table handler"); l = sizeof(struct pf_cmd);