Re: pf.4: sync structs with net/pfvar.h
Hello, On Sun, Aug 27, 2017 at 10:11:49PM -0400, Lawrence Teo wrote: > This syncs the struct declarations in pf.4 with the latest net/pfvar.h > (r1.465 at the time of writing). > > ok? looks good to me. OK sashan
Re: [PATCH] add initial set of regress tests for vmd
On Sun, Aug 27, 2017 at 02:24:08PM -0700, Carlos Cardenas wrote: > Howdy. > > Below is patch for some initial parsing tests for vmd: > * Memory string parsing (too small, invalid size, and rounding) > * Max disk path > * Max vm name > * Max kernel path > * Max NICs > > More tests to come. > > One item missing is the proper hook into regress/usr.sbin/Makefile > as it was unknown if they should be run all the time or only for > REGRESS_FULL. Comments? > > Ok? > The diff doesn't apply. I think it got mangled. Can you send it again without line wrapping? > +--+ > Carlos > > diff --git regress/usr.sbin/vmd/Makefile regress/usr.sbin/vmd/Makefile > new file mode 100644 > index 000..d7b3794710a > --- /dev/null > +++ regress/usr.sbin/vmd/Makefile > @@ -0,0 +1,44 @@ > +# $OpenBSD: $ > + > +# TARGETS > +# vmd-pass: load vmd-pass-*.conf through vmd and check against > vmd-pass-*.ok > +# vmd-fail: load vmd-fail-*.conf through vmd and check against > vmd-fail-*.ok > + > +VMD_PASS=1 2 3 > +VMD_FAIL=1 2 3 4 5 6 7 > + > +MAKEOBJDIRPREFIX= > + > +SHELL=/bin/sh > + > +.MAIN: all > + > +.for n in ${VMD_PASS} > +VMD_PASS_TARGETS+=vmd_pass${n} > + > +vmd_pass${n}: > + ${SUDO} vmd -n -f ${.CURDIR}/vmd-pass-${n}.conf 2>&1 | \ > + diff -u ${.CURDIR}/vmd-pass-${n}.ok /dev/stdin > +.endfor > + > +vmd-pass: ${VMD_PASS_TARGETS} > +REGRESS_TARGETS+=vmd-pass > +REGRESS_ROOT_TARGETS+=vmd-pass > + > +.for n in ${VMD_FAIL} > +VMD_FAIL_TARGETS+=vmd_fail${n} > + > +vmd_fail${n}: > + ${SUDO} vmd -n -f ${.CURDIR}/vmd-fail-${n}.conf 2>&1 | \ > + diff -u ${.CURDIR}/vmd-fail-${n}.ok /dev/stdin > +.endfor > + > +vmd-fail: ${VMD_FAIL_TARGETS} > +REGRESS_TARGETS+=vmd-fail > +REGRESS_ROOT_TARGETS+=vmd-fail > + > +alltests: ${REGRESS_TARGETS} > + > +.PHONY: ${REGRESS_TARGETS} > + > +.include > diff --git regress/usr.sbin/vmd/vmd-fail-1.conf > regress/usr.sbin/vmd/vmd-fail-1.conf > new file mode 100644 > index 000..3e3006a057d > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-1.conf > @@ -0,0 +1,12 @@ > +# $OpenBSD: $ > +# Fail on kernel keyword; has been replaced by boot. > +ramdisk="/bsd.rd" > +switch "sw" { > +add vether0 > +} > +vm "x" { > +kernel $ramdisk > +memory 2G > +disable > +interface { switch "sw" } > +} > diff --git regress/usr.sbin/vmd/vmd-fail-1.ok > regress/usr.sbin/vmd/vmd-fail-1.ok > new file mode 100644 > index 000..02fcd909b1e > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-1.ok > @@ -0,0 +1 @@ > +/usr/src/regress/usr.sbin/vmd/vmd-fail-1.conf:8: syntax error > diff --git regress/usr.sbin/vmd/vmd-fail-2.conf > regress/usr.sbin/vmd/vmd-fail-2.conf > new file mode 100644 > index 000..69cf1c4e630 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-2.conf > @@ -0,0 +1,5 @@ > +# $OpenBSD: $ > +# Fail on memory (less than 1MB) > +vm "x" { > +memory 1048575 > +} > diff --git regress/usr.sbin/vmd/vmd-fail-2.ok > regress/usr.sbin/vmd/vmd-fail-2.ok > new file mode 100644 > index 000..4abf9f32b09 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-2.ok > @@ -0,0 +1,2 @@ > +size must be at least one megabyte > +/usr/src/regress/usr.sbin/vmd/vmd-fail-2.conf:4: failed to parse size: > 1048575 > diff --git regress/usr.sbin/vmd/vmd-fail-3.conf > regress/usr.sbin/vmd/vmd-fail-3.conf > new file mode 100644 > index 000..a8767829159 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-3.conf > @@ -0,0 +1,4 @@ > +# $OpenBSD: $ > +# Fail on VM name (> 32chars) > +vm "abcdefghijklmnopqrstuvwxyz0123456789" { > +} > diff --git regress/usr.sbin/vmd/vmd-fail-3.ok > regress/usr.sbin/vmd/vmd-fail-3.ok > new file mode 100644 > index 000..788b7e53657 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-3.ok > @@ -0,0 +1 @@ > +/usr/src/regress/usr.sbin/vmd/vmd-fail-3.conf:3: vm name too long > diff --git regress/usr.sbin/vmd/vmd-fail-4.conf > regress/usr.sbin/vmd/vmd-fail-4.conf > new file mode 100644 > index 000..83c59c2e61e > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-4.conf > @@ -0,0 +1,5 @@ > +# $OpenBSD: $ > +# Fail on nifs (> 4) > +vm "a" { > +nifs 5 > +} > diff --git regress/usr.sbin/vmd/vmd-fail-4.ok > regress/usr.sbin/vmd/vmd-fail-4.ok > new file mode 100644 > index 000..c533cba38d0 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-4.ok > @@ -0,0 +1 @@ > +/usr/src/regress/usr.sbin/vmd/vmd-fail-4.conf:4: syntax error > diff --git regress/usr.sbin/vmd/vmd-fail-5.conf > regress/usr.sbin/vmd/vmd-fail-5.conf > new file mode 100644 > index 000..c53cfd32968 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-5.conf > @@ -0,0 +1,6 @@ > +# $OpenBSD: $ > +# Fail on boot path (> 128) > +ramdisk="/some/absolutepath/somewhere/abcdefghijklmnopqrstuvwxyz0123456789/abcdefghijklmnopqrstuvwxyz0123456789/abcdefghijklmnopqrstuvwxyz0123456789/bsd.rd" > +vm "x" { > +kernel $ramdisk > +} > diff --git regress/usr.sbin/vmd/vmd-fail-5.ok > regress/usr.sbin/vmd/vmd-fail-5.ok > new file mode 100644 > index 00
Re: Improve the accuracy of the TSC frequency calibration - Updated Patch
On Sun, Aug 27, 2017 at 09:45:52PM -0700, Mike Larkin wrote: > On Mon, Aug 28, 2017 at 08:02:35AM +0800, Adam Steen wrote: > > On Fri, Aug 25, 2017 at 12:43:44PM +0200, Mike Belopuhov wrote: > > > On Fri, Aug 25, 2017 at 00:40 -0700, Mike Larkin wrote: > > > > On Thu, Aug 24, 2017 at 12:39:33PM +0800, Adam Steen wrote: > > > > > On Thu, Aug 24, 2017 at 2:35 AM, Mike Larkin > > > > > wrote: > > > > > > On Wed, Aug 23, 2017 at 09:29:15PM +0800, Adam Steen wrote: > > > > > >> > > > > > >> Thank you Mike on the feedback on the last patch, please see the > > > > > >> diff > > > > > >> below, update with your input and style(9) > > > > > >> > > > > > >> I have continued to use tsc as my timecounter and > > > > > >> /var/db/ntpd.driff > > > > > >> has stayed under 10. > > > > > >> > > > > > >> cat /var/db/ntpd.drift > > > > > >> 6.665 > > > > > >> > > > > > >> ntpctl -s all > > > > > >> 4/4 peers valid, constraint offset -1s, clock synced, stratum 3 > > > > > >> > > > > > >> peer > > > > > >>wt tl st next poll offset delay jitter > > > > > >> 144.48.166.166 from pool pool.ntp.org > > > > > >> 1 10 24s 32s-3.159ms87.723ms10.389ms > > > > > >> 13.55.50.68 from pool pool.ntp.org > > > > > >> 1 10 3 11s 32s-3.433ms86.053ms18.095ms > > > > > >> 14.202.204.182 from pool pool.ntp.org > > > > > >> 1 10 1 14s 32s 1.486ms86.545ms16.483ms > > > > > >> 27.124.125.250 from pool pool.ntp.org > > > > > >> * 1 10 2 12s 30s -10.275ms54.156ms70.389ms > > > > > >> > > > > > >> Cheers > > > > > >> Adam > > > > > > > > > > > > IIRC you have an x220, right? > > > > > > > > > > > > If so, could you try letting the clock run for a bit (while using > > > > > > tsc > > > > > > timecounter selection) after apm -L to drop the speed? (make sure > > > > > > apm shows that it dropped). > > > > > > > > > > > > Even though my x230 supposedly has a constant/invar TSC (according > > > > > > to > > > > > > cpuid), the TSC drops from 2.5GHz to 1.2GHz when apm -L runs, which > > > > > > causes time to run too slowly when tsc is selected there. > > > > > > > > > > > > -ml > > > > > > > > > > > > > > > > Yes, x220 > > > > > (bios: LENOVO version "8DET69WW (1.39 )" date 07/18/2013) > > > > > (cpu: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz, 2491.91 MHz) > > > > > > > > > > I took some measurements to before starting the test. > > > > > > > > > > note: the laptop has been up for a few days with apm -A set via > > > > > rc.conf.local > > > > > and sysctl kern.timecounter.hardware as tsc via sysctl.conf and mostly > > > > > idle. > > > > > > > > > > cat /var/db/ntpd.drift > > > > > 6.459 > > > > > > > > > > apm -v > > > > > Battery state: high, 100% remaining, unknown life estimate > > > > > A/C adapter state: connected > > > > > Performance adjustment mode: auto (800 MHz) > > > > > > > > > > 6 hours ago i ran apm -L, verified it was running slowly (800 MHz), > > > > > and got the following results > > > > > > > > > > The clock appears correct (comparing to other computers) > > > > > > > > > > apm -v > > > > > Battery state: high, 100% remaining, unknown life estimate > > > > > A/C adapter state: connected > > > > > Performance adjustment mode: manual (800 MHz) > > > > > > > > > > cat /var/db/ntpd.drift > > > > > 6.385 > > > > > > > > > > ntpctl -s all > > > > > 4/4 peers valid, constraint offset 0s, clock synced, stratum 4 > > > > > > > > > > peer > > > > >wt tl st next poll offset delay jitter > > > > > 203.23.237.200 from pool pool.ntp.org > > > > > 1 10 2 153s 1505s -25.546ms73.450ms 2.644ms > > > > > 203.114.73.24 from pool pool.ntp.org > > > > > 1 10 2 253s 1560s-1.042ms75.133ms 0.752ms > > > > > 192.189.54.33 from pool pool.ntp.org > > > > > * 1 10 2 204s 1558s31.644ms70.910ms 3.388ms > > > > > 54.252.165.245 from pool pool.ntp.org > > > > > 1 10 2 238s 1518s 0.146ms73.005ms 2.025ms > > > > > > > > > > I will leave the laptop in lower power mode over the weekend and see > > > > > what happens. > > > > > > > > > > > > > No need, I think you've convinced me that it works :) > > > > > > But does it actually work on x230 as well? I'm surprised to learn > > > that you've observed TSC frequency change on Ivy Bridge. I was > > > under impression that everything since at least Sandy Bridge (x220) > > > has constant and invariant TSC as advertised. > > > > > > Adam, I've readjusted and simplified your diff a bit. The biggest > > > change is that we can select the reference tc based on it's quality > > > so there's no need to have acpitimer and acpihpet specific functions > > > and variables. > > > > > > There's one big thing missing here: increasing the timecounter > > > quality so that OS can pick it. Something like this: > > > > > > https://github.com/mbelop/src/commit/99d6ef3ae95bbd8ea93c27e0425eb65e5a3359a1 > >
Re: Improve the accuracy of the TSC frequency calibration - Updated Patch
On Mon, Aug 28, 2017 at 08:02:35AM +0800, Adam Steen wrote: > On Fri, Aug 25, 2017 at 12:43:44PM +0200, Mike Belopuhov wrote: > > On Fri, Aug 25, 2017 at 00:40 -0700, Mike Larkin wrote: > > > On Thu, Aug 24, 2017 at 12:39:33PM +0800, Adam Steen wrote: > > > > On Thu, Aug 24, 2017 at 2:35 AM, Mike Larkin > > > > wrote: > > > > > On Wed, Aug 23, 2017 at 09:29:15PM +0800, Adam Steen wrote: > > > > >> > > > > >> Thank you Mike on the feedback on the last patch, please see the diff > > > > >> below, update with your input and style(9) > > > > >> > > > > >> I have continued to use tsc as my timecounter and /var/db/ntpd.driff > > > > >> has stayed under 10. > > > > >> > > > > >> cat /var/db/ntpd.drift > > > > >> 6.665 > > > > >> > > > > >> ntpctl -s all > > > > >> 4/4 peers valid, constraint offset -1s, clock synced, stratum 3 > > > > >> > > > > >> peer > > > > >>wt tl st next poll offset delay jitter > > > > >> 144.48.166.166 from pool pool.ntp.org > > > > >> 1 10 24s 32s-3.159ms87.723ms10.389ms > > > > >> 13.55.50.68 from pool pool.ntp.org > > > > >> 1 10 3 11s 32s-3.433ms86.053ms18.095ms > > > > >> 14.202.204.182 from pool pool.ntp.org > > > > >> 1 10 1 14s 32s 1.486ms86.545ms16.483ms > > > > >> 27.124.125.250 from pool pool.ntp.org > > > > >> * 1 10 2 12s 30s -10.275ms54.156ms70.389ms > > > > >> > > > > >> Cheers > > > > >> Adam > > > > > > > > > > IIRC you have an x220, right? > > > > > > > > > > If so, could you try letting the clock run for a bit (while using tsc > > > > > timecounter selection) after apm -L to drop the speed? (make sure > > > > > apm shows that it dropped). > > > > > > > > > > Even though my x230 supposedly has a constant/invar TSC (according to > > > > > cpuid), the TSC drops from 2.5GHz to 1.2GHz when apm -L runs, which > > > > > causes time to run too slowly when tsc is selected there. > > > > > > > > > > -ml > > > > > > > > > > > > > Yes, x220 > > > > (bios: LENOVO version "8DET69WW (1.39 )" date 07/18/2013) > > > > (cpu: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz, 2491.91 MHz) > > > > > > > > I took some measurements to before starting the test. > > > > > > > > note: the laptop has been up for a few days with apm -A set via > > > > rc.conf.local > > > > and sysctl kern.timecounter.hardware as tsc via sysctl.conf and mostly > > > > idle. > > > > > > > > cat /var/db/ntpd.drift > > > > 6.459 > > > > > > > > apm -v > > > > Battery state: high, 100% remaining, unknown life estimate > > > > A/C adapter state: connected > > > > Performance adjustment mode: auto (800 MHz) > > > > > > > > 6 hours ago i ran apm -L, verified it was running slowly (800 MHz), > > > > and got the following results > > > > > > > > The clock appears correct (comparing to other computers) > > > > > > > > apm -v > > > > Battery state: high, 100% remaining, unknown life estimate > > > > A/C adapter state: connected > > > > Performance adjustment mode: manual (800 MHz) > > > > > > > > cat /var/db/ntpd.drift > > > > 6.385 > > > > > > > > ntpctl -s all > > > > 4/4 peers valid, constraint offset 0s, clock synced, stratum 4 > > > > > > > > peer > > > >wt tl st next poll offset delay jitter > > > > 203.23.237.200 from pool pool.ntp.org > > > > 1 10 2 153s 1505s -25.546ms73.450ms 2.644ms > > > > 203.114.73.24 from pool pool.ntp.org > > > > 1 10 2 253s 1560s-1.042ms75.133ms 0.752ms > > > > 192.189.54.33 from pool pool.ntp.org > > > > * 1 10 2 204s 1558s31.644ms70.910ms 3.388ms > > > > 54.252.165.245 from pool pool.ntp.org > > > > 1 10 2 238s 1518s 0.146ms73.005ms 2.025ms > > > > > > > > I will leave the laptop in lower power mode over the weekend and see > > > > what happens. > > > > > > > > > > No need, I think you've convinced me that it works :) > > > > But does it actually work on x230 as well? I'm surprised to learn > > that you've observed TSC frequency change on Ivy Bridge. I was > > under impression that everything since at least Sandy Bridge (x220) > > has constant and invariant TSC as advertised. > > > > Adam, I've readjusted and simplified your diff a bit. The biggest > > change is that we can select the reference tc based on it's quality > > so there's no need to have acpitimer and acpihpet specific functions > > and variables. > > > > There's one big thing missing here: increasing the timecounter > > quality so that OS can pick it. Something like this: > > > > https://github.com/mbelop/src/commit/99d6ef3ae95bbd8ea93c27e0425eb65e5a3359a1 > > > > I'd say we should try getting this in after 6.3 unlock unless there > > are objections. Further cleanup and testing is welcome of course. > > > > Hi all > > I wanted to post the complicated patch, along with Mike's qaulity > changes for completeness sake, see the diff below. > > I have been running this since Saturday morning wit
Re: [PATCH] add initial set of regress tests for vmd
On Sun, Aug 27, 2017 at 02:24:08PM -0700, Carlos Cardenas wrote: > Howdy. > > Below is patch for some initial parsing tests for vmd: > * Memory string parsing (too small, invalid size, and rounding) > * Max disk path > * Max vm name > * Max kernel path > * Max NICs > > More tests to come. > > One item missing is the proper hook into regress/usr.sbin/Makefile > as it was unknown if they should be run all the time or only for > REGRESS_FULL. Comments? > > Ok? > Thanks, I'll give this a test. -ml > +--+ > Carlos > > diff --git regress/usr.sbin/vmd/Makefile regress/usr.sbin/vmd/Makefile > new file mode 100644 > index 000..d7b3794710a > --- /dev/null > +++ regress/usr.sbin/vmd/Makefile > @@ -0,0 +1,44 @@ > +# $OpenBSD: $ > + > +# TARGETS > +# vmd-pass: load vmd-pass-*.conf through vmd and check against > vmd-pass-*.ok > +# vmd-fail: load vmd-fail-*.conf through vmd and check against > vmd-fail-*.ok > + > +VMD_PASS=1 2 3 > +VMD_FAIL=1 2 3 4 5 6 7 > + > +MAKEOBJDIRPREFIX= > + > +SHELL=/bin/sh > + > +.MAIN: all > + > +.for n in ${VMD_PASS} > +VMD_PASS_TARGETS+=vmd_pass${n} > + > +vmd_pass${n}: > + ${SUDO} vmd -n -f ${.CURDIR}/vmd-pass-${n}.conf 2>&1 | \ > + diff -u ${.CURDIR}/vmd-pass-${n}.ok /dev/stdin > +.endfor > + > +vmd-pass: ${VMD_PASS_TARGETS} > +REGRESS_TARGETS+=vmd-pass > +REGRESS_ROOT_TARGETS+=vmd-pass > + > +.for n in ${VMD_FAIL} > +VMD_FAIL_TARGETS+=vmd_fail${n} > + > +vmd_fail${n}: > + ${SUDO} vmd -n -f ${.CURDIR}/vmd-fail-${n}.conf 2>&1 | \ > + diff -u ${.CURDIR}/vmd-fail-${n}.ok /dev/stdin > +.endfor > + > +vmd-fail: ${VMD_FAIL_TARGETS} > +REGRESS_TARGETS+=vmd-fail > +REGRESS_ROOT_TARGETS+=vmd-fail > + > +alltests: ${REGRESS_TARGETS} > + > +.PHONY: ${REGRESS_TARGETS} > + > +.include > diff --git regress/usr.sbin/vmd/vmd-fail-1.conf > regress/usr.sbin/vmd/vmd-fail-1.conf > new file mode 100644 > index 000..3e3006a057d > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-1.conf > @@ -0,0 +1,12 @@ > +# $OpenBSD: $ > +# Fail on kernel keyword; has been replaced by boot. > +ramdisk="/bsd.rd" > +switch "sw" { > +add vether0 > +} > +vm "x" { > +kernel $ramdisk > +memory 2G > +disable > +interface { switch "sw" } > +} > diff --git regress/usr.sbin/vmd/vmd-fail-1.ok > regress/usr.sbin/vmd/vmd-fail-1.ok > new file mode 100644 > index 000..02fcd909b1e > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-1.ok > @@ -0,0 +1 @@ > +/usr/src/regress/usr.sbin/vmd/vmd-fail-1.conf:8: syntax error > diff --git regress/usr.sbin/vmd/vmd-fail-2.conf > regress/usr.sbin/vmd/vmd-fail-2.conf > new file mode 100644 > index 000..69cf1c4e630 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-2.conf > @@ -0,0 +1,5 @@ > +# $OpenBSD: $ > +# Fail on memory (less than 1MB) > +vm "x" { > +memory 1048575 > +} > diff --git regress/usr.sbin/vmd/vmd-fail-2.ok > regress/usr.sbin/vmd/vmd-fail-2.ok > new file mode 100644 > index 000..4abf9f32b09 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-2.ok > @@ -0,0 +1,2 @@ > +size must be at least one megabyte > +/usr/src/regress/usr.sbin/vmd/vmd-fail-2.conf:4: failed to parse size: > 1048575 > diff --git regress/usr.sbin/vmd/vmd-fail-3.conf > regress/usr.sbin/vmd/vmd-fail-3.conf > new file mode 100644 > index 000..a8767829159 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-3.conf > @@ -0,0 +1,4 @@ > +# $OpenBSD: $ > +# Fail on VM name (> 32chars) > +vm "abcdefghijklmnopqrstuvwxyz0123456789" { > +} > diff --git regress/usr.sbin/vmd/vmd-fail-3.ok > regress/usr.sbin/vmd/vmd-fail-3.ok > new file mode 100644 > index 000..788b7e53657 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-3.ok > @@ -0,0 +1 @@ > +/usr/src/regress/usr.sbin/vmd/vmd-fail-3.conf:3: vm name too long > diff --git regress/usr.sbin/vmd/vmd-fail-4.conf > regress/usr.sbin/vmd/vmd-fail-4.conf > new file mode 100644 > index 000..83c59c2e61e > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-4.conf > @@ -0,0 +1,5 @@ > +# $OpenBSD: $ > +# Fail on nifs (> 4) > +vm "a" { > +nifs 5 > +} > diff --git regress/usr.sbin/vmd/vmd-fail-4.ok > regress/usr.sbin/vmd/vmd-fail-4.ok > new file mode 100644 > index 000..c533cba38d0 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-4.ok > @@ -0,0 +1 @@ > +/usr/src/regress/usr.sbin/vmd/vmd-fail-4.conf:4: syntax error > diff --git regress/usr.sbin/vmd/vmd-fail-5.conf > regress/usr.sbin/vmd/vmd-fail-5.conf > new file mode 100644 > index 000..c53cfd32968 > --- /dev/null > +++ regress/usr.sbin/vmd/vmd-fail-5.conf > @@ -0,0 +1,6 @@ > +# $OpenBSD: $ > +# Fail on boot path (> 128) > +ramdisk="/some/absolutepath/somewhere/abcdefghijklmnopqrstuvwxyz0123456789/abcdefghijklmnopqrstuvwxyz0123456789/abcdefghijklmnopqrstuvwxyz0123456789/bsd.rd" > +vm "x" { > +kernel $ramdisk > +} > diff --git regress/usr.sbin/vmd/vmd-fail-5.ok > regress/usr.sbin/vmd/vmd-fail-5.ok > new file mode 100644 > index 000..f17303c6838 > --- /dev/null > +++ regress/usr.
pf.4: sync structs with net/pfvar.h
This syncs the struct declarations in pf.4 with the latest net/pfvar.h (r1.465 at the time of writing). ok? Index: pf.4 === RCS file: /cvs/src/share/man/man4/pf.4,v retrieving revision 1.87 diff -u -p -r1.87 pf.4 --- pf.430 May 2017 19:38:47 - 1.87 +++ pf.428 Aug 2017 01:38:22 - @@ -94,8 +94,8 @@ struct pfioc_rule { u_int32_t action; u_int32_t ticket; u_int32_t nr; - charanchor[MAXPATHLEN]; - charanchor_call[MAXPATHLEN]; + charanchor[PATH_MAX]; + charanchor_call[PATH_MAX]; struct pf_rule rule; }; .Ed @@ -186,7 +186,7 @@ for the queue specified by .Bd -literal struct pfioc_ruleset { u_int32_tnr; - char path[MAXPATHLEN]; + char path[PATH_MAX]; char name[PF_ANCHOR_NAME_SIZE]; }; .Ed @@ -272,12 +272,13 @@ struct pf_status { time_t since; u_int32_t running; u_int32_t states; + u_int32_t states_halfopen; u_int32_t src_nodes; u_int32_t debug; u_int32_t hostid; u_int32_t reass; /* reassembly */ charifname[IFNAMSIZ]; - u_int8_tpf_chksum[MD5_DIGEST_LENGTH]; + u_int8_tpf_chksum[PF_MD5_DIGEST_LENGTH]; }; .Ed .It Dv DIOCCLRSTATUS @@ -462,7 +463,7 @@ On exit, contains the number of tables effectively created. .Bd -literal struct pfr_table { - charpfrt_anchor[MAXPATHLEN]; + charpfrt_anchor[PATH_MAX]; charpfrt_name[PF_TABLE_NAME_SIZE]; u_int32_t pfrt_flags; u_int8_tpfrt_fback; @@ -746,7 +747,7 @@ struct pfioc_trans { int esize; /* size of each element in bytes */ struct pfioc_trans_e { int type; - charanchor[MAXPATHLEN]; + charanchor[PATH_MAX]; u_int32_t ticket; } *array; };
Re: include pinebook firmware in the install media
> On Sun, Aug 27, 2017 at 09:54:07PM +0200, Peter Hessler wrote: > > (this depends on the patch to u-boot I just sent to ports@) > > > > If we should manage to boot on a Pinebook machine, we should install the > > correct firmware for it. > > > > OK? > > This does not include distrib/arm64/ramdisk/list changes to actually > include it. > > The install.md changes will also break the installer for all arm64 > platforms. > > The second case statement should be > > pine64|pinebook) real question should be: was a full snapshot built? was it tested? was it shared to check if it affects others? wonder how many no's The rule should be pretty clear: the install media are really tricky, and the best tool to avoid problems is for developers to become accustomed to doing "make release" instead of "make build".
Re: include pinebook firmware in the install media
On Sun, Aug 27, 2017 at 09:54:07PM +0200, Peter Hessler wrote: > (this depends on the patch to u-boot I just sent to ports@) > > If we should manage to boot on a Pinebook machine, we should install the > correct firmware for it. > > OK? This does not include distrib/arm64/ramdisk/list changes to actually include it. The install.md changes will also break the installer for all arm64 platforms. The second case statement should be pine64|pinebook) > > Index: distrib/arm64/ramdisk/Makefile > === > RCS file: /cvs/openbsd/src/distrib/arm64/ramdisk/Makefile,v > retrieving revision 1.3 > diff -u -p -u -p -r1.3 Makefile > --- distrib/arm64/ramdisk/Makefile22 Aug 2017 23:20:00 - 1.3 > +++ distrib/arm64/ramdisk/Makefile27 Aug 2017 19:48:36 - > @@ -19,6 +19,7 @@ MAKEFSARGS_RD= -o disklabel=${DISKTYPE}, > > DIRS=\ > pine64 \ > + pinebook \ > rpi > > .ifndef DESTDIR > Index: distrib/arm64/ramdisk/install.md > === > RCS file: /cvs/openbsd/src/distrib/arm64/ramdisk/install.md,v > retrieving revision 1.7 > diff -u -p -u -p -r1.7 install.md > --- distrib/arm64/ramdisk/install.md 22 Aug 2017 23:20:00 - 1.7 > +++ distrib/arm64/ramdisk/install.md 27 Aug 2017 19:44:28 - > @@ -40,6 +40,7 @@ md_installboot() { > > case $(sysctl -n hw.product) in > *Pine64*) _plat=pine64;; > + *Pinebook*) _plat=pinebook;; > *'Raspberry Pi'*) _plat=rpi;; > esac > > @@ -53,6 +54,7 @@ md_installboot() { > > case $_plat in > pine64) > + pinebook) > dd if=$_mdec/u-boot-sunxi-with-spl.bin of=${_disk}c \ > bs=1024 seek=8 >/dev/null 2>&1 > ;; > > > -- > The reader this message encounters not failing to understand is > cursed. >
Re: Improve the accuracy of the TSC frequency calibration - Updated Patch
On Fri, Aug 25, 2017 at 12:43:44PM +0200, Mike Belopuhov wrote: > On Fri, Aug 25, 2017 at 00:40 -0700, Mike Larkin wrote: > > On Thu, Aug 24, 2017 at 12:39:33PM +0800, Adam Steen wrote: > > > On Thu, Aug 24, 2017 at 2:35 AM, Mike Larkin wrote: > > > > On Wed, Aug 23, 2017 at 09:29:15PM +0800, Adam Steen wrote: > > > >> > > > >> Thank you Mike on the feedback on the last patch, please see the diff > > > >> below, update with your input and style(9) > > > >> > > > >> I have continued to use tsc as my timecounter and /var/db/ntpd.driff > > > >> has stayed under 10. > > > >> > > > >> cat /var/db/ntpd.drift > > > >> 6.665 > > > >> > > > >> ntpctl -s all > > > >> 4/4 peers valid, constraint offset -1s, clock synced, stratum 3 > > > >> > > > >> peer > > > >>wt tl st next poll offset delay jitter > > > >> 144.48.166.166 from pool pool.ntp.org > > > >> 1 10 24s 32s-3.159ms87.723ms10.389ms > > > >> 13.55.50.68 from pool pool.ntp.org > > > >> 1 10 3 11s 32s-3.433ms86.053ms18.095ms > > > >> 14.202.204.182 from pool pool.ntp.org > > > >> 1 10 1 14s 32s 1.486ms86.545ms16.483ms > > > >> 27.124.125.250 from pool pool.ntp.org > > > >> * 1 10 2 12s 30s -10.275ms54.156ms70.389ms > > > >> > > > >> Cheers > > > >> Adam > > > > > > > > IIRC you have an x220, right? > > > > > > > > If so, could you try letting the clock run for a bit (while using tsc > > > > timecounter selection) after apm -L to drop the speed? (make sure > > > > apm shows that it dropped). > > > > > > > > Even though my x230 supposedly has a constant/invar TSC (according to > > > > cpuid), the TSC drops from 2.5GHz to 1.2GHz when apm -L runs, which > > > > causes time to run too slowly when tsc is selected there. > > > > > > > > -ml > > > > > > > > > > Yes, x220 > > > (bios: LENOVO version "8DET69WW (1.39 )" date 07/18/2013) > > > (cpu: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz, 2491.91 MHz) > > > > > > I took some measurements to before starting the test. > > > > > > note: the laptop has been up for a few days with apm -A set via > > > rc.conf.local > > > and sysctl kern.timecounter.hardware as tsc via sysctl.conf and mostly > > > idle. > > > > > > cat /var/db/ntpd.drift > > > 6.459 > > > > > > apm -v > > > Battery state: high, 100% remaining, unknown life estimate > > > A/C adapter state: connected > > > Performance adjustment mode: auto (800 MHz) > > > > > > 6 hours ago i ran apm -L, verified it was running slowly (800 MHz), > > > and got the following results > > > > > > The clock appears correct (comparing to other computers) > > > > > > apm -v > > > Battery state: high, 100% remaining, unknown life estimate > > > A/C adapter state: connected > > > Performance adjustment mode: manual (800 MHz) > > > > > > cat /var/db/ntpd.drift > > > 6.385 > > > > > > ntpctl -s all > > > 4/4 peers valid, constraint offset 0s, clock synced, stratum 4 > > > > > > peer > > >wt tl st next poll offset delay jitter > > > 203.23.237.200 from pool pool.ntp.org > > > 1 10 2 153s 1505s -25.546ms73.450ms 2.644ms > > > 203.114.73.24 from pool pool.ntp.org > > > 1 10 2 253s 1560s-1.042ms75.133ms 0.752ms > > > 192.189.54.33 from pool pool.ntp.org > > > * 1 10 2 204s 1558s31.644ms70.910ms 3.388ms > > > 54.252.165.245 from pool pool.ntp.org > > > 1 10 2 238s 1518s 0.146ms73.005ms 2.025ms > > > > > > I will leave the laptop in lower power mode over the weekend and see > > > what happens. > > > > > > > No need, I think you've convinced me that it works :) > > But does it actually work on x230 as well? I'm surprised to learn > that you've observed TSC frequency change on Ivy Bridge. I was > under impression that everything since at least Sandy Bridge (x220) > has constant and invariant TSC as advertised. > > Adam, I've readjusted and simplified your diff a bit. The biggest > change is that we can select the reference tc based on it's quality > so there's no need to have acpitimer and acpihpet specific functions > and variables. > > There's one big thing missing here: increasing the timecounter > quality so that OS can pick it. Something like this: > > https://github.com/mbelop/src/commit/99d6ef3ae95bbd8ea93c27e0425eb65e5a3359a1 > > I'd say we should try getting this in after 6.3 unlock unless there > are objections. Further cleanup and testing is welcome of course. > Hi all I wanted to post the complicated patch, along with Mike's qaulity changes for completeness sake, see the diff below. I have been running this since Saturday morning with no problems. Cheers Adam Index: sys/arch/amd64/amd64/acpi_machdep.c === RCS file: /cvs/src/sys/arch/amd64/amd64/acpi_machdep.c,v retrieving revision 1.78 diff -u -p -u -p -r1.78 acpi_machdep.c --- sys/arch/amd64/amd64/acpi_machdep.c 27 Mar 2017
Re: [phess...@openbsd.org: add pinebook support to u-boot]
On Sun, Aug 27 2017, Peter Hessler wrote: > - Forwarded message from Peter Hessler - > taken from Icenowy Zheng's repository, > commit bd656cab0c3e0669e977641c15095f32d7b0731f > > This gives us basic support for the Pine64 Pinebook > > OK? sun50i-a64-pinebook.dtb and pinebook_defconfig are new files, not patches. I would suggest adding them as using DISTFILES or PATCHFILES, hosted outside of the ports tree. Less goo in the tree, and less chances of problems if the license of those files turns out to be a problem. I can cook a diff for this. -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
two doas parse.y tweaks
make things a little more convenient. a backslash indicates escape, which we don't need to support for keywords. so always set nonkw for those tokens. this lets "permit \permit" work. there are no keywords after the args keyword, so we can create a lexer backdoor. this lets "permit user cmd ls args cmd" to work without quoting. Index: parse.y === RCS file: /cvs/src/usr.bin/doas/parse.y,v retrieving revision 1.26 diff -u -p -r1.26 parse.y --- parse.y 2 Jan 2017 01:40:20 - 1.26 +++ parse.y 27 Aug 2017 21:23:57 - @@ -51,6 +51,7 @@ int nrules; static int maxrules; int parse_errors = 0; +int inargs = 0; static void yyerror(const char *, ...); static int yylex(void); @@ -103,6 +104,7 @@ rule: action ident target cmd { errx(1, "can't allocate rules"); } rules[nrules++] = r; + inargs = 0; } ; action:TPERMIT options { @@ -180,7 +182,7 @@ cmd:/* optional */ { args: /* empty */ { $$.cmdargs = NULL; - } | TARGS strlist { + } | TARGS { inargs = 1; } strlist { $$.cmdargs = $2.strlist; } ; @@ -259,8 +261,10 @@ repeat: continue; case '\\': escape = !escape; - if (escape) + if (escape) { + nonkw = 1; continue; + } break; case '\n': if (quotes) @@ -324,7 +328,7 @@ eow: else if (qpos == -1)/* accept, e.g., empty args: cmd foo args "" */ goto repeat; } - if (!nonkw) { + if (!inargs && !nonkw) { for (i = 0; i < sizeof(keywords) / sizeof(keywords[0]); i++) { if (strcmp(buf, keywords[i].word) == 0) return keywords[i].token;
[PATCH] add initial set of regress tests for vmd
Howdy. Below is patch for some initial parsing tests for vmd: * Memory string parsing (too small, invalid size, and rounding) * Max disk path * Max vm name * Max kernel path * Max NICs More tests to come. One item missing is the proper hook into regress/usr.sbin/Makefile as it was unknown if they should be run all the time or only for REGRESS_FULL. Comments? Ok? +--+ Carlos diff --git regress/usr.sbin/vmd/Makefile regress/usr.sbin/vmd/Makefile new file mode 100644 index 000..d7b3794710a --- /dev/null +++ regress/usr.sbin/vmd/Makefile @@ -0,0 +1,44 @@ +# $OpenBSD: $ + +# TARGETS +# vmd-pass: load vmd-pass-*.conf through vmd and check against vmd-pass-*.ok +# vmd-fail: load vmd-fail-*.conf through vmd and check against vmd-fail-*.ok + +VMD_PASS=1 2 3 +VMD_FAIL=1 2 3 4 5 6 7 + +MAKEOBJDIRPREFIX= + +SHELL=/bin/sh + +.MAIN: all + +.for n in ${VMD_PASS} +VMD_PASS_TARGETS+=vmd_pass${n} + +vmd_pass${n}: + ${SUDO} vmd -n -f ${.CURDIR}/vmd-pass-${n}.conf 2>&1 | \ + diff -u ${.CURDIR}/vmd-pass-${n}.ok /dev/stdin +.endfor + +vmd-pass: ${VMD_PASS_TARGETS} +REGRESS_TARGETS+=vmd-pass +REGRESS_ROOT_TARGETS+=vmd-pass + +.for n in ${VMD_FAIL} +VMD_FAIL_TARGETS+=vmd_fail${n} + +vmd_fail${n}: + ${SUDO} vmd -n -f ${.CURDIR}/vmd-fail-${n}.conf 2>&1 | \ + diff -u ${.CURDIR}/vmd-fail-${n}.ok /dev/stdin +.endfor + +vmd-fail: ${VMD_FAIL_TARGETS} +REGRESS_TARGETS+=vmd-fail +REGRESS_ROOT_TARGETS+=vmd-fail + +alltests: ${REGRESS_TARGETS} + +.PHONY: ${REGRESS_TARGETS} + +.include diff --git regress/usr.sbin/vmd/vmd-fail-1.conf regress/usr.sbin/vmd/vmd-fail-1.conf new file mode 100644 index 000..3e3006a057d --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-1.conf @@ -0,0 +1,12 @@ +# $OpenBSD: $ +# Fail on kernel keyword; has been replaced by boot. +ramdisk="/bsd.rd" +switch "sw" { +add vether0 +} +vm "x" { +kernel $ramdisk +memory 2G +disable +interface { switch "sw" } +} diff --git regress/usr.sbin/vmd/vmd-fail-1.ok regress/usr.sbin/vmd/vmd-fail-1.ok new file mode 100644 index 000..02fcd909b1e --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-1.ok @@ -0,0 +1 @@ +/usr/src/regress/usr.sbin/vmd/vmd-fail-1.conf:8: syntax error diff --git regress/usr.sbin/vmd/vmd-fail-2.conf regress/usr.sbin/vmd/vmd-fail-2.conf new file mode 100644 index 000..69cf1c4e630 --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-2.conf @@ -0,0 +1,5 @@ +# $OpenBSD: $ +# Fail on memory (less than 1MB) +vm "x" { +memory 1048575 +} diff --git regress/usr.sbin/vmd/vmd-fail-2.ok regress/usr.sbin/vmd/vmd-fail-2.ok new file mode 100644 index 000..4abf9f32b09 --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-2.ok @@ -0,0 +1,2 @@ +size must be at least one megabyte +/usr/src/regress/usr.sbin/vmd/vmd-fail-2.conf:4: failed to parse size: 1048575 diff --git regress/usr.sbin/vmd/vmd-fail-3.conf regress/usr.sbin/vmd/vmd-fail-3.conf new file mode 100644 index 000..a8767829159 --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-3.conf @@ -0,0 +1,4 @@ +# $OpenBSD: $ +# Fail on VM name (> 32chars) +vm "abcdefghijklmnopqrstuvwxyz0123456789" { +} diff --git regress/usr.sbin/vmd/vmd-fail-3.ok regress/usr.sbin/vmd/vmd-fail-3.ok new file mode 100644 index 000..788b7e53657 --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-3.ok @@ -0,0 +1 @@ +/usr/src/regress/usr.sbin/vmd/vmd-fail-3.conf:3: vm name too long diff --git regress/usr.sbin/vmd/vmd-fail-4.conf regress/usr.sbin/vmd/vmd-fail-4.conf new file mode 100644 index 000..83c59c2e61e --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-4.conf @@ -0,0 +1,5 @@ +# $OpenBSD: $ +# Fail on nifs (> 4) +vm "a" { +nifs 5 +} diff --git regress/usr.sbin/vmd/vmd-fail-4.ok regress/usr.sbin/vmd/vmd-fail-4.ok new file mode 100644 index 000..c533cba38d0 --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-4.ok @@ -0,0 +1 @@ +/usr/src/regress/usr.sbin/vmd/vmd-fail-4.conf:4: syntax error diff --git regress/usr.sbin/vmd/vmd-fail-5.conf regress/usr.sbin/vmd/vmd-fail-5.conf new file mode 100644 index 000..c53cfd32968 --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-5.conf @@ -0,0 +1,6 @@ +# $OpenBSD: $ +# Fail on boot path (> 128) +ramdisk="/some/absolutepath/somewhere/abcdefghijklmnopqrstuvwxyz0123456789/abcdefghijklmnopqrstuvwxyz0123456789/abcdefghijklmnopqrstuvwxyz0123456789/bsd.rd" +vm "x" { +kernel $ramdisk +} diff --git regress/usr.sbin/vmd/vmd-fail-5.ok regress/usr.sbin/vmd/vmd-fail-5.ok new file mode 100644 index 000..f17303c6838 --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-5.ok @@ -0,0 +1 @@ +/usr/src/regress/usr.sbin/vmd/vmd-fail-5.conf:5: syntax error diff --git regress/usr.sbin/vmd/vmd-fail-6.conf regress/usr.sbin/vmd/vmd-fail-6.conf new file mode 100644 index 000..5fc12df895f --- /dev/null +++ regress/usr.sbin/vmd/vmd-fail-6.conf @@ -0,0 +1,6 @@ +# $OpenBSD: $ +# Fail on disk path (> 128) +rdisk="/some/absolutepath/somewhere/abcdefghijklmnopqrstuvwxyz0123456789/abcdefghijklmnopqrstuvwxyz012345678
Re: [phess...@openbsd.org: add pinebook support to u-boot]
On 2017 Aug 27 (Sun) at 22:30:37 +0200 (+0200), Mark Kettenis wrote: :> Date: Sun, 27 Aug 2017 22:15:46 +0200 :> From: Peter Hessler :> :> This gives us basic support for the Pine64 Pinebook :> :> OK? :> :> $ sysctl hw :> hw.machine=arm64 :> hw.model=ARM Cortex-A53 r0p4 :> hw.ncpu=1 :> hw.byteorder=1234 :> hw.pagesize=4096 :> hw.disknames=sd0:d76c5b9369f79257 :> hw.diskcount=1 :> hw.product=Pinebook :> hw.physmem=2021924864 :> hw.usermem=2021912576 :> hw.ncpufound=1 :> hw.allowpowerdown=1 :> :> :> Index: Makefile :> === :> RCS file: /cvs/openbsd/ports/sysutils/u-boot/Makefile,v :> retrieving revision 1.25 :> diff -u -p -u -p -r1.25 Makefile :> --- Makefile 24 Aug 2017 08:53:02 - 1.25 :> +++ Makefile 27 Aug 2017 19:38:53 - :> @@ -7,7 +7,7 @@ FLAVOR?= arm :> :> COMMENT=U-Boot firmware :> VERSION=2017.09-rc2 :> -REVISION= 1 :> +REVISION= 2 : :Revision needs another bump. : Why? It's a separate variable from rc2, and is a ports-specific thing. :> DISTNAME= u-boot-${VERSION} :> PKGNAME=u-boot-${FLAVOR}-${VERSION:S/-//} :> FULLPKGNAME=${PKGNAME} :> @@ -56,6 +56,7 @@ SUNXI64=\ :> orangepi_prime \ :> orangepi_win \ :> pine64_plus \ :> +pinebook \ :> sopine_baseboard :> BOARDS=\ :> mvebu_espressobin-88f3720 \ : :> Index: patches/patch-configs_pinebook_defconfig :> === :> RCS file: patches/patch-configs_pinebook_defconfig :> diff -N patches/patch-configs_pinebook_defconfig :> --- /dev/null1 Jan 1970 00:00:00 - :> +++ patches/patch-configs_pinebook_defconfig 27 Aug 2017 19:17:25 - :> @@ -0,0 +1,27 @@ :> +$OpenBSD$ :> + :> +Index: configs/pinebook_defconfig :> +--- configs/pinebook_defconfig.orig :> configs/pinebook_defconfig :> +@@ -0,0 +1,21 @@ :> ++CONFIG_ARM=y :> ++CONFIG_ARCH_SUNXI=y :> ++CONFIG_MACH_SUN50I=y :> ++CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y :> ++CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y :> ++CONFIG_DRAM_CLK=552 :> ++CONFIG_DRAM_ZQ=3881949 :> ++CONFIG_DRAM_ODT_EN=y :> ++CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinebook" :> ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set :> ++CONFIG_SPL=y :> ++CONFIG_SPL_ATF_SUPPORT=y :> ++CONFIG_SPL_ATF_TEXT_BASE=0x44000 : :I don't think we need CONFIG_SPL_ATF_SUPPORT and :CONFIG_SPL_ATF_TEXT_BASE. At least the pine64 config doesn't ave :them. : While it works without those lines, I'd prefer to leave them in. This is what is intended to be committed to mainline u-boot. :> ++# CONFIG_CMD_IMLS is not set :> ++# CONFIG_CMD_FLASH is not set :> ++# CONFIG_CMD_FPGA is not set :> ++# CONFIG_SPL_DOS_PARTITION is not set :> ++# CONFIG_SPL_ISO_PARTITION is not set :> ++# CONFIG_SPL_EFI_PARTITION is not set :> ++CONFIG_SPL_SPI_SUNXI=y :> ++CONFIG_USB_EHCI_HCD=y : :Otherwise this looks good. :
Re: combined usb rng driver
On Sun, Aug 27, 2017 at 09:51:23PM +0200, Jasper Lievisse Adriaanse wrote: > Hi > > Instead of adding a new driver for each USB RNG device here's a diff to > combine the existing ualea(4) driver and support for a new device (ChaosKey > support by abieber@) into urng(4). > > The plan is to merge uonerng(4) into it as well as support for future > devices into this single driver. > > This was tested by abieber@ with a ChaosKey and Sean with an Alea II. > > OK? I'd like to have more OK's than just mine, but for sure the '#define URNG_DEBUG 1' should be removed before it goes in :D I have been running this since yesterday without issues, so OK from me! > > Cheers, > Jasper > > Index: share/man/man4/Makefile > === > RCS file: /cvs/src/share/man/man4/Makefile,v > retrieving revision 1.656 > diff -u -p -r1.656 Makefile > --- share/man/man4/Makefile 25 Aug 2017 11:17:35 - 1.656 > +++ share/man/man4/Makefile 26 Aug 2017 19:44:32 - > @@ -61,7 +61,7 @@ MAN=aac.4 ac97.4 acphy.4 \ > stp.4 sv.4 switch.4 sym.4 tcic.4 tcp.4 termios.4 tht.4 ti.4 tl.4 \ > tlphy.4 thmc.4 tpm.4 tqphy.4 trm.4 trunk.4 tsl.4 tty.4 tun.4 tap.4 \ > twe.4 \ > - txp.4 txphy.4 ualea.4 uaudio.4 uark.4 uath.4 ubcmtp.4 uberry.4 ubsa.4 \ > + txp.4 txphy.4 uaudio.4 uark.4 uath.4 ubcmtp.4 uberry.4 ubsa.4 \ > ubsec.4 \ > ucom.4 uchcom.4 ucycom.4 uslhcom.4 udav.4 udcf.4 udl.4 udp.4 udsbr.4 \ > uftdi.4 ugen.4 ugl.4 ugold.4 uguru.4 uhci.4 uhid.4 uhidev.4 uipaq.4 \ > @@ -69,7 +69,7 @@ MAN=aac.4 ac97.4 acphy.4 \ > ukphy.4 ulpt.4 umass.4 umb.4 umbg.4 umcs.4 umct.4 umidi.4 umodem.4 \ > ums.4 umsm.4 unix.4 uonerng.4 uow.4 uoaklux.4 uoakrh.4 uoakv.4 upd.4 \ > upgt.4 upl.4 uplcom.4 ural.4 ure.4 url.4 urlphy.4 \ > - urndis.4 urtw.4 urtwn.4 usb.4 uscom.4 uslcom.4 usps.4 \ > + urndis.4 urng.4 urtw.4 urtwn.4 usb.4 uscom.4 uslcom.4 usps.4 \ > uthum.4 uticom.4 utpms.4 utwitch.4 utrh.4 uts.4 utvfu.4 uvideo.4 \ > uvisor.4 uvscom.4 uwacom.4 \ > vether.4 vga.4 vgafb.4 vge.4 \ > Index: share/man/man4/ualea.4 > === > RCS file: share/man/man4/ualea.4 > diff -N share/man/man4/ualea.4 > --- share/man/man4/ualea.416 Apr 2015 08:56:53 - 1.1 > +++ /dev/null 1 Jan 1970 00:00:00 - > @@ -1,54 +0,0 @@ > -.\" $OpenBSD: ualea.4,v 1.1 2015/04/16 08:56:53 mpi Exp $ > -.\" > -.\" Copyright (c) 2007 Marc Balmer > -.\" Copyright (c) 2015 Sean Levy > -.\" > -.\" Permission to use, copy, modify, and distribute this software for any > -.\" purpose with or without fee is hereby granted, provided that the above > -.\" copyright notice and this permission notice appear in all copies. > -.\" > -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > -.\" > -.Dd $Mdocdate: April 16 2015 $ > -.Dt UALEA 4 > -.Os > -.Sh NAME > -.Nm ualea > -.Nd Araneus Alea II USB TRNG > -.Sh SYNOPSIS > -.Cd "ualea* at uhub?" > -.Sh DESCRIPTION > -The > -.Nm > -driver provides support for the Araneus Alea II, a USB true random > -number generator (TRNG). > -It delivers 100kbit/sec of hardware-generated entropy. > -.Nm > -reads raw entropy from the Alea II and uses > -.Xr add_true_randomness 9 > -to add it to the system entropy pool. > -.Pp > -The product documentation states that the USB interface used by the > -Alea II is the same as that used by its predecessor the Alea I; > -theoretically this means that the Alea I should work but this has not > -been tested. > -.Sh SEE ALSO > -.Xr intro 4 , > -.Xr usb 4 , > -.Xr add_true_randomness 9 > -.Sh HISTORY > -The > -.Nm > -driver first appeared in > -.Ox 5.7 . > -.Sh AUTHORS > -The > -.Nm > -driver was written by > -.An Sean Levy Aq Mt att...@stalphonsos.com . > Index: share/man/man4/urng.4 > === > RCS file: share/man/man4/urng.4 > diff -N share/man/man4/urng.4 > --- /dev/null 1 Jan 1970 00:00:00 - > +++ share/man/man4/urng.4 26 Aug 2017 20:34:54 - > @@ -0,0 +1,63 @@ > +.\" $OpenBSD$ > +.\" > +.\" Copyright (c) 2015 Sean Levy > +.\" Copyright (c) 2017 Jasper Lievisse Adriaanse > +.\" > +.\" Permission to use, copy, modify, and distribute this software for any > +.\" purpose with or without fee is hereby granted, provided that the above > +.\" copyright notice and this permission notice appear in all copies. > +.\" > +.\" THE SOFTWARE IS PROVIDED "AS IS" AND T
Re: [phess...@openbsd.org: add pinebook support to u-boot]
> Date: Sun, 27 Aug 2017 22:15:46 +0200 > From: Peter Hessler > > This gives us basic support for the Pine64 Pinebook > > OK? > > $ sysctl hw > hw.machine=arm64 > hw.model=ARM Cortex-A53 r0p4 > hw.ncpu=1 > hw.byteorder=1234 > hw.pagesize=4096 > hw.disknames=sd0:d76c5b9369f79257 > hw.diskcount=1 > hw.product=Pinebook > hw.physmem=2021924864 > hw.usermem=2021912576 > hw.ncpufound=1 > hw.allowpowerdown=1 > > > Index: Makefile > === > RCS file: /cvs/openbsd/ports/sysutils/u-boot/Makefile,v > retrieving revision 1.25 > diff -u -p -u -p -r1.25 Makefile > --- Makefile 24 Aug 2017 08:53:02 - 1.25 > +++ Makefile 27 Aug 2017 19:38:53 - > @@ -7,7 +7,7 @@ FLAVOR?= arm > > COMMENT= U-Boot firmware > VERSION= 2017.09-rc2 > -REVISION=1 > +REVISION=2 Revision needs another bump. > DISTNAME=u-boot-${VERSION} > PKGNAME= u-boot-${FLAVOR}-${VERSION:S/-//} > FULLPKGNAME= ${PKGNAME} > @@ -56,6 +56,7 @@ SUNXI64=\ > orangepi_prime \ > orangepi_win \ > pine64_plus \ > + pinebook \ > sopine_baseboard > BOARDS=\ > mvebu_espressobin-88f3720 \ > Index: patches/patch-configs_pinebook_defconfig > === > RCS file: patches/patch-configs_pinebook_defconfig > diff -N patches/patch-configs_pinebook_defconfig > --- /dev/null 1 Jan 1970 00:00:00 - > +++ patches/patch-configs_pinebook_defconfig 27 Aug 2017 19:17:25 - > @@ -0,0 +1,27 @@ > +$OpenBSD$ > + > +Index: configs/pinebook_defconfig > +--- configs/pinebook_defconfig.orig > configs/pinebook_defconfig > +@@ -0,0 +1,21 @@ > ++CONFIG_ARM=y > ++CONFIG_ARCH_SUNXI=y > ++CONFIG_MACH_SUN50I=y > ++CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y > ++CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y > ++CONFIG_DRAM_CLK=552 > ++CONFIG_DRAM_ZQ=3881949 > ++CONFIG_DRAM_ODT_EN=y > ++CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinebook" > ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set > ++CONFIG_SPL=y > ++CONFIG_SPL_ATF_SUPPORT=y > ++CONFIG_SPL_ATF_TEXT_BASE=0x44000 I don't think we need CONFIG_SPL_ATF_SUPPORT and CONFIG_SPL_ATF_TEXT_BASE. At least the pine64 config doesn't ave them. > ++# CONFIG_CMD_IMLS is not set > ++# CONFIG_CMD_FLASH is not set > ++# CONFIG_CMD_FPGA is not set > ++# CONFIG_SPL_DOS_PARTITION is not set > ++# CONFIG_SPL_ISO_PARTITION is not set > ++# CONFIG_SPL_EFI_PARTITION is not set > ++CONFIG_SPL_SPI_SUNXI=y > ++CONFIG_USB_EHCI_HCD=y Otherwise this looks good.
[phess...@openbsd.org: add pinebook support to u-boot]
- Forwarded message from Peter Hessler - taken from Icenowy Zheng's repository, commit bd656cab0c3e0669e977641c15095f32d7b0731f This gives us basic support for the Pine64 Pinebook OK? $ sysctl hw hw.machine=arm64 hw.model=ARM Cortex-A53 r0p4 hw.ncpu=1 hw.byteorder=1234 hw.pagesize=4096 hw.disknames=sd0:d76c5b9369f79257 hw.diskcount=1 hw.product=Pinebook hw.physmem=2021924864 hw.usermem=2021912576 hw.ncpufound=1 hw.allowpowerdown=1 Index: Makefile === RCS file: /cvs/openbsd/ports/sysutils/u-boot/Makefile,v retrieving revision 1.25 diff -u -p -u -p -r1.25 Makefile --- Makefile24 Aug 2017 08:53:02 - 1.25 +++ Makefile27 Aug 2017 19:38:53 - @@ -7,7 +7,7 @@ FLAVOR?=arm COMMENT= U-Boot firmware VERSION= 2017.09-rc2 -REVISION= 1 +REVISION= 2 DISTNAME= u-boot-${VERSION} PKGNAME= u-boot-${FLAVOR}-${VERSION:S/-//} FULLPKGNAME= ${PKGNAME} @@ -56,6 +56,7 @@ SUNXI64=\ orangepi_prime \ orangepi_win \ pine64_plus \ + pinebook \ sopine_baseboard BOARDS=\ mvebu_espressobin-88f3720 \ Index: patches/patch-arch_arm_dts_Makefile === RCS file: patches/patch-arch_arm_dts_Makefile diff -N patches/patch-arch_arm_dts_Makefile --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-arch_arm_dts_Makefile 27 Aug 2017 19:16:11 - @@ -0,0 +1,15 @@ +$OpenBSD$ + +Index: arch/arm/dts/Makefile +--- arch/arm/dts/Makefile.orig arch/arm/dts/Makefile +@@ -338,7 +338,8 @@ dtb-$(CONFIG_MACH_SUN50I) += \ + sun50i-a64-bananapi-m64.dtb \ + sun50i-a64-orangepi-win.dtb \ + sun50i-a64-pine64-plus.dtb \ +- sun50i-a64-pine64.dtb ++ sun50i-a64-pine64.dtb \ ++ sun50i-a64-pinebook.dtb + dtb-$(CONFIG_MACH_SUN9I) += \ + sun9i-a80-optimus.dtb \ + sun9i-a80-cubieboard4.dtb \ Index: patches/patch-arch_arm_dts_sun50i-a64-pinebook_dts === RCS file: patches/patch-arch_arm_dts_sun50i-a64-pinebook_dts diff -N patches/patch-arch_arm_dts_sun50i-a64-pinebook_dts --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-arch_arm_dts_sun50i-a64-pinebook_dts 27 Aug 2017 19:17:38 - @@ -0,0 +1,68 @@ +$OpenBSD$ + +Index: arch/arm/dts/sun50i-a64-pinebook.dts +--- arch/arm/dts/sun50i-a64-pinebook.dts.orig arch/arm/dts/sun50i-a64-pinebook.dts +@@ -0,0 +1,62 @@ ++/* ++ * Copyright (c) 2016 ARM Ltd. ++ * ++ * This file is dual-licensed: you can use it either under the terms ++ * of the GPL or the X11 license, at your option. Note that this dual ++ * licensing only applies to this file, and not this project as a ++ * whole. ++ * ++ * a) This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * Or, alternatively, ++ * ++ * b) Permission is hereby granted, free of charge, to any person ++ * obtaining a copy of this software and associated documentation ++ * files (the "Software"), to deal in the Software without ++ * restriction, including without limitation the rights to use, ++ * copy, modify, merge, publish, distribute, sublicense, and/or ++ * sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following ++ * conditions: ++ * ++ * The above copyright notice and this permission notice shall be ++ * included in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ++ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ++ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ * OTHER DEALINGS IN THE SOFTWARE. ++ */ ++ ++/dts-v1/; ++ ++#include "sun50i-a64-pine64.dts" ++ ++/ { ++ model = "Pinebook"; ++ compatible = "pine64,pinebook", "allwinner,sun50i-a64"; ++ ++ aliases { ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory { ++ reg = <0x4000 0x4000>; ++ }; ++}; Index: patches/patch-configs_pinebook_defc
include pinebook firmware in the install media
(this depends on the patch to u-boot I just sent to ports@) If we should manage to boot on a Pinebook machine, we should install the correct firmware for it. OK? Index: distrib/arm64/ramdisk/Makefile === RCS file: /cvs/openbsd/src/distrib/arm64/ramdisk/Makefile,v retrieving revision 1.3 diff -u -p -u -p -r1.3 Makefile --- distrib/arm64/ramdisk/Makefile 22 Aug 2017 23:20:00 - 1.3 +++ distrib/arm64/ramdisk/Makefile 27 Aug 2017 19:48:36 - @@ -19,6 +19,7 @@ MAKEFSARGS_RD=-o disklabel=${DISKTYPE}, DIRS=\ pine64 \ + pinebook \ rpi .ifndef DESTDIR Index: distrib/arm64/ramdisk/install.md === RCS file: /cvs/openbsd/src/distrib/arm64/ramdisk/install.md,v retrieving revision 1.7 diff -u -p -u -p -r1.7 install.md --- distrib/arm64/ramdisk/install.md22 Aug 2017 23:20:00 - 1.7 +++ distrib/arm64/ramdisk/install.md27 Aug 2017 19:44:28 - @@ -40,6 +40,7 @@ md_installboot() { case $(sysctl -n hw.product) in *Pine64*) _plat=pine64;; + *Pinebook*) _plat=pinebook;; *'Raspberry Pi'*) _plat=rpi;; esac @@ -53,6 +54,7 @@ md_installboot() { case $_plat in pine64) + pinebook) dd if=$_mdec/u-boot-sunxi-with-spl.bin of=${_disk}c \ bs=1024 seek=8 >/dev/null 2>&1 ;; -- The reader this message encounters not failing to understand is cursed.
combined usb rng driver
Hi Instead of adding a new driver for each USB RNG device here's a diff to combine the existing ualea(4) driver and support for a new device (ChaosKey support by abieber@) into urng(4). The plan is to merge uonerng(4) into it as well as support for future devices into this single driver. This was tested by abieber@ with a ChaosKey and Sean with an Alea II. OK? Cheers, Jasper Index: share/man/man4/Makefile === RCS file: /cvs/src/share/man/man4/Makefile,v retrieving revision 1.656 diff -u -p -r1.656 Makefile --- share/man/man4/Makefile 25 Aug 2017 11:17:35 - 1.656 +++ share/man/man4/Makefile 26 Aug 2017 19:44:32 - @@ -61,7 +61,7 @@ MAN= aac.4 ac97.4 acphy.4 \ stp.4 sv.4 switch.4 sym.4 tcic.4 tcp.4 termios.4 tht.4 ti.4 tl.4 \ tlphy.4 thmc.4 tpm.4 tqphy.4 trm.4 trunk.4 tsl.4 tty.4 tun.4 tap.4 \ twe.4 \ - txp.4 txphy.4 ualea.4 uaudio.4 uark.4 uath.4 ubcmtp.4 uberry.4 ubsa.4 \ + txp.4 txphy.4 uaudio.4 uark.4 uath.4 ubcmtp.4 uberry.4 ubsa.4 \ ubsec.4 \ ucom.4 uchcom.4 ucycom.4 uslhcom.4 udav.4 udcf.4 udl.4 udp.4 udsbr.4 \ uftdi.4 ugen.4 ugl.4 ugold.4 uguru.4 uhci.4 uhid.4 uhidev.4 uipaq.4 \ @@ -69,7 +69,7 @@ MAN= aac.4 ac97.4 acphy.4 \ ukphy.4 ulpt.4 umass.4 umb.4 umbg.4 umcs.4 umct.4 umidi.4 umodem.4 \ ums.4 umsm.4 unix.4 uonerng.4 uow.4 uoaklux.4 uoakrh.4 uoakv.4 upd.4 \ upgt.4 upl.4 uplcom.4 ural.4 ure.4 url.4 urlphy.4 \ - urndis.4 urtw.4 urtwn.4 usb.4 uscom.4 uslcom.4 usps.4 \ + urndis.4 urng.4 urtw.4 urtwn.4 usb.4 uscom.4 uslcom.4 usps.4 \ uthum.4 uticom.4 utpms.4 utwitch.4 utrh.4 uts.4 utvfu.4 uvideo.4 \ uvisor.4 uvscom.4 uwacom.4 \ vether.4 vga.4 vgafb.4 vge.4 \ Index: share/man/man4/ualea.4 === RCS file: share/man/man4/ualea.4 diff -N share/man/man4/ualea.4 --- share/man/man4/ualea.4 16 Apr 2015 08:56:53 - 1.1 +++ /dev/null 1 Jan 1970 00:00:00 - @@ -1,54 +0,0 @@ -.\"$OpenBSD: ualea.4,v 1.1 2015/04/16 08:56:53 mpi Exp $ -.\" -.\" Copyright (c) 2007 Marc Balmer -.\" Copyright (c) 2015 Sean Levy -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd $Mdocdate: April 16 2015 $ -.Dt UALEA 4 -.Os -.Sh NAME -.Nm ualea -.Nd Araneus Alea II USB TRNG -.Sh SYNOPSIS -.Cd "ualea* at uhub?" -.Sh DESCRIPTION -The -.Nm -driver provides support for the Araneus Alea II, a USB true random -number generator (TRNG). -It delivers 100kbit/sec of hardware-generated entropy. -.Nm -reads raw entropy from the Alea II and uses -.Xr add_true_randomness 9 -to add it to the system entropy pool. -.Pp -The product documentation states that the USB interface used by the -Alea II is the same as that used by its predecessor the Alea I; -theoretically this means that the Alea I should work but this has not -been tested. -.Sh SEE ALSO -.Xr intro 4 , -.Xr usb 4 , -.Xr add_true_randomness 9 -.Sh HISTORY -The -.Nm -driver first appeared in -.Ox 5.7 . -.Sh AUTHORS -The -.Nm -driver was written by -.An Sean Levy Aq Mt att...@stalphonsos.com . Index: share/man/man4/urng.4 === RCS file: share/man/man4/urng.4 diff -N share/man/man4/urng.4 --- /dev/null 1 Jan 1970 00:00:00 - +++ share/man/man4/urng.4 26 Aug 2017 20:34:54 - @@ -0,0 +1,63 @@ +.\"$OpenBSD$ +.\" +.\" Copyright (c) 2015 Sean Levy +.\" Copyright (c) 2017 Jasper Lievisse Adriaanse +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWA
Re: arm64 pagezero_cache, page zero performance improvement
> Date: Sun, 27 Aug 2017 14:42:30 -0400 > From: Dale Rahn > > Performance: use cache zeroing function to pmap_zero_page > > This improves page zeroing (a rather common occurance) by over 8x. > > The only restriction is that pagezero_cache occurs on cached pages, but the > pmap_zero_page always uses cached pages. ok kettenis@ > Index: arm64/pmap.c > === > RCS file: /cvs/src/sys/arch/arm64/arm64/pmap.c,v > retrieving revision 1.37 > diff -u -p -r1.37 pmap.c > --- arm64/pmap.c 9 Aug 2017 05:53:11 - 1.37 > +++ arm64/pmap.c 27 Aug 2017 18:25:28 - > @@ -769,8 +769,7 @@ pmap_zero_page(struct vm_page *pg) > > pmap_kenter_pa(zero_page, pa, PROT_READ|PROT_WRITE); > > - /* XXX use better zero operation? */ > - bzero((void *)zero_page, PAGE_SIZE); > + pagezero_cache(zero_page); > > pmap_kremove_pg(zero_page); > } > Index: include/pmap.h > === > RCS file: /cvs/src/sys/arch/arm64/include/pmap.h,v > retrieving revision 1.5 > diff -u -p -r1.5 pmap.h > --- include/pmap.h10 May 2017 21:58:55 - 1.5 > +++ include/pmap.h27 Aug 2017 18:25:28 - > @@ -59,6 +59,8 @@ extern paddr_t zero_page; > extern paddr_t copy_src_page; > extern paddr_t copy_dst_page; > > +void pagezero_cache(vaddr_t); > + > /* > * Pmap stuff > */ > Dale Rahn dr...@dalerahn.com > >
arm64 pagezero_cache, page zero performance improvement
Performance: use cache zeroing function to pmap_zero_page This improves page zeroing (a rather common occurance) by over 8x. The only restriction is that pagezero_cache occurs on cached pages, but the pmap_zero_page always uses cached pages. Index: arm64/pmap.c === RCS file: /cvs/src/sys/arch/arm64/arm64/pmap.c,v retrieving revision 1.37 diff -u -p -r1.37 pmap.c --- arm64/pmap.c9 Aug 2017 05:53:11 - 1.37 +++ arm64/pmap.c27 Aug 2017 18:25:28 - @@ -769,8 +769,7 @@ pmap_zero_page(struct vm_page *pg) pmap_kenter_pa(zero_page, pa, PROT_READ|PROT_WRITE); - /* XXX use better zero operation? */ - bzero((void *)zero_page, PAGE_SIZE); + pagezero_cache(zero_page); pmap_kremove_pg(zero_page); } Index: include/pmap.h === RCS file: /cvs/src/sys/arch/arm64/include/pmap.h,v retrieving revision 1.5 diff -u -p -r1.5 pmap.h --- include/pmap.h 10 May 2017 21:58:55 - 1.5 +++ include/pmap.h 27 Aug 2017 18:25:28 - @@ -59,6 +59,8 @@ extern paddr_t zero_page; extern paddr_t copy_src_page; extern paddr_t copy_dst_page; +void pagezero_cache(vaddr_t); + /* * Pmap stuff */ Dale Rahn dr...@dalerahn.com
lex: unused variable
Hello, I spotted an unused variable (r) in filter_apply_chain() function of lex(1). - Michael Index: filter.c === RCS file: /cvs/src/usr.bin/lex/filter.c,v retrieving revision 1.8 diff -u -p -u -r1.8 filter.c --- filter.c17 Aug 2017 19:27:48 - 1.8 +++ filter.c27 Aug 2017 11:09:06 - @@ -174,9 +174,7 @@ filter_apply_chain(struct filter * chain /* run as a filter, either internally or by exec */ if (chain->filter_func) { - int r; - - if ((r = chain->filter_func(chain)) == -1) + if (chain->filter_func(chain) == -1) flexfatal(_("filter_func failed")); exit(0); } else {
lex: action_m4_define
Hello, In lex(1) the function action_m4_define() would raise a fatal error if called. I couldn't see anything calling it though, and the program builds without it. - Michael Index: misc.c === RCS file: /cvs/src/usr.bin/lex/misc.c,v retrieving revision 1.19 diff -u -p -u -r1.19 misc.c --- misc.c 19 Nov 2015 23:34:56 - 1.19 +++ misc.c 27 Aug 2017 10:27:34 - @@ -116,28 +116,6 @@ action_define(defname, value) buf_append(&defs_buf, &cpy, 1); } - -/** Append "m4_define([[defname]],[[value]])m4_dnl\n" to the running buffer. - * @param defname The macro name. - * @param value The macro value, can be NULL, which is the same as the empty string. - */ -void -action_m4_define(const char *defname, const char *value) -{ - char buf[MAXLINE]; - - flexfatal("DO NOT USE THIS FUNCTION!"); - - if ((int) strlen(defname) > MAXLINE / 2) { - format_pinpoint_message(_ - ("name \"%s\" ridiculously long"), - defname); - return; - } - snprintf(buf, sizeof(buf), "m4_define([[%s]],[[%s]])m4_dnl\n", defname, value ? value : ""); - add_action(buf); -} - /* Append "new_text" to the running buffer. */ void add_action(new_text)
lex: flex_die() usage
Hello, In lex(1) the macro flex_die() never returns, so putting control statements immediately after it is misleading. The macro is wrapped in do{}while(0) so it can safely appear in 'if' statements without braces. - Michael Index: tables.c === RCS file: /cvs/src/usr.bin/lex/tables.c,v retrieving revision 1.4 diff -u -p -u -r1.4 tables.c --- tables.c17 Aug 2017 19:27:09 - 1.4 +++ tables.c27 Aug 2017 09:44:35 - @@ -221,24 +221,18 @@ int yytbl_data_fwrite (struct yytbl_writ default: flex_die (_("invalid td_flags detected")); } - if (rv < 0) { + if (rv < 0) flex_die (_("error while writing tables")); - return -1; - } bwritten += rv; } /* Sanity check */ - if (bwritten != (int) (12 + total_len * YYTDFLAGS2BYTES (td->td_flags))) { + if (bwritten != (int) (12 + total_len * YYTDFLAGS2BYTES (td->td_flags))) flex_die (_("insanity detected")); - return -1; - } /* add padding */ - if ((rv = yytbl_write_pad64 (wr)) < 0) { + if ((rv = yytbl_write_pad64 (wr)) < 0) flex_die (_("pad64 failed")); - return -1; - } bwritten += rv; /* Now go back and update the th_hsize member */ @@ -247,7 +241,6 @@ int yytbl_data_fwrite (struct yytbl_writ || yytbl_write32 (wr, wr->total_written) < 0 || fsetpos (wr->out, &pos)) { flex_die (_("get|set|fwrite32 failed")); - return -1; } else /* Don't count the int we just wrote. */ @@ -346,7 +339,6 @@ static flex_int32_t yytbl_data_geti (con return ((flex_int32_t *) (tbl->td_data))[i]; default: flex_die (_("invalid td_flags detected")); - break; } return 0; } @@ -374,7 +366,6 @@ static void yytbl_data_seti (const struc break; default: flex_die (_("invalid td_flags detected")); - break; } } @@ -433,10 +424,8 @@ void yytbl_data_compress (struct yytbl_d /* No change in this table needed. */ return; - if (newsz > (int) YYTDFLAGS2BYTES (tbl->td_flags)) { + if (newsz > (int) YYTDFLAGS2BYTES (tbl->td_flags)) flex_die (_("detected negative compression")); - return; - } total_len = yytbl_calc_total_len (tbl); newtbl.td_data = calloc (total_len, newsz);