Re: Error from reorder_kernel

2022-11-20 Thread Aaron Miller

I agree. I think I'll get a larger disk.

Thanks for the help!

--Aaron

On 11/20/22 01:14, Stuart Henderson wrote:
I doubt there's enough free space on /usr for reorder_kernel to work. 
But the disk overall is small and there's probably not a lot that you 
can clear out. If you were to reinstall, not create /usr/src, and add 
that space to /usr instead, that would buy you a bit of time, but 
ideally you'd want a larger disk.






Re: Error from reorder_kernel

2022-11-19 Thread Aaron Miller

On 11/19/22 16:31, Stuart Henderson wrote:


On 2022-11-19, Aaron Miller  wrote:

Hi misc,

I ran into an issue with reorder_kernel on 7.2. It directed me to its
log file, /usr/share/relink/kernel/GENERIC/relink.log, which contains this:

    (SHA256) /bsd: OK
    LD="ld" sh makegap.sh 0x gapdummy.o
    ld -T ld.script -X --warn-common -nopie -o newbsd ${SYSTEM_HEAD}
vers.o ${OBJS}
    text    data    bss    dec    hex
    0    0    0    0    0
    mv newbsd newbsd.gdb
    ctfstrip -S -o newbsd newbsd.gdb
    strip: there are no sections to be copied!
    rm -f bsd.gdb
    mv -f newbsd bsd
    mv: newbsd: No such file or directory
    *** Error 1 in /usr/share/relink/kernel/GENERIC (Makefile:1940 'newbsd')

I think the relevant error is the "strip: there are no sections to be
copied".

Also I saw a blue text error from the kernel (typing it rather than
copy-pasting):

     uvn_flush: obj=0xfd801ee12890, offset=0x576.  error during
pageout.

    uvn_flush: WARNING: changes to page may be lost!

What does this mean? And how do I fix it?

Most likely your filesystem is full.

Thanks! Which filesystem should I free space on?

$ df -h
Filesystem Size    Used   Avail Capacity  Mounted on
/dev/sd1a  733M    323M    373M    46%    /
/dev/sd1k  6.2G    4.9G    1.0G    83%    /home
/dev/sd1d  1.1G    436K    1.1G 0%    /tmp
/dev/sd1f  1.5G    1.4G   73.3M    95%    /usr
/dev/sd1g  402M    339M   42.2M    89%    /usr/X11R6
/dev/sd1h  3.2G    2.1G    1.0G    67%    /usr/local
/dev/sd1j  1.8G   1000M    710M    58%    /usr/obj
/dev/sd1i  1.2G    2.0K    1.2G 0%    /usr/src
/dev/sd1e  1.7G    825M    865M    49%    /var



Error from reorder_kernel

2022-11-19 Thread Aaron Miller

Hi misc,

I ran into an issue with reorder_kernel on 7.2. It directed me to its 
log file, /usr/share/relink/kernel/GENERIC/relink.log, which contains this:


  (SHA256) /bsd: OK
  LD="ld" sh makegap.sh 0x gapdummy.o
  ld -T ld.script -X --warn-common -nopie -o newbsd ${SYSTEM_HEAD} 
vers.o ${OBJS}

  text    data    bss    dec    hex
  0    0    0    0    0
  mv newbsd newbsd.gdb
  ctfstrip -S -o newbsd newbsd.gdb
  strip: there are no sections to be copied!
  rm -f bsd.gdb
  mv -f newbsd bsd
  mv: newbsd: No such file or directory
  *** Error 1 in /usr/share/relink/kernel/GENERIC (Makefile:1940 'newbsd')

I think the relevant error is the "strip: there are no sections to be 
copied".


Also I saw a blue text error from the kernel (typing it rather than 
copy-pasting):


   uvn_flush: obj=0xfd801ee12890, offset=0x576.  error during 
pageout.


  uvn_flush: WARNING: changes to page may be lost!

What does this mean? And how do I fix it?

Thanks,

Aaron



Re: sometimes graphics is slow, with high Xorg CPU usage

2021-03-17 Thread Aaron Miller
On Wed, 2021-03-10 at 09:19 -0800, Aaron Miller wrote:
> On Wed, 2021-03-10 at 07:54 +, Stuart Henderson wrote:
> > On 2021-03-09, Aaron Miller  wrote:
> > > For some time now, my -CURRENT system will occasionally get
> > > into a
> > > state where graphics is slow to refresh and the Xorg uses
> > > ~50%
> > > of
> > > CPU. I notice this in Firefox or GVim when repeatedly
> > > pressing
> > > PgDn on a long site/file, and in Evolution (emails are slow
> > > to
> > > load, and text input is laggy when composing a message).
> > > 
> > > OpenBSD 6.9-beta (GENERIC.MP) #366: Sun Feb 28 07:15:39 MST
> > > 2021
> > 
> > Update your snapshot and see how it goes.
> 
> It seems to be fixed now.
> 
> I followed these steps in order:
> 
> 1) test ===> not fixed
> 2) set "machdep.allowaperture=1" in /etc/sysctl.conf and reboot
> 3) test ===> not fixed
> 4) upgrade snapshot and reboot
> 5) realize I'm behind on openbsd.org/faq/current.html so I run
> this: cd /dev && ./MAKEDEV dri
> 6) reboot
> 7) test ===> fixed
> 
> Thanks for the help!
> 
> --Aaron

Unfortunately, the problem is back after a reboot. Is there any
debugging information that would help track this down?

I did find this in the stdout from firefox:

Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest:
libpci missing (t=1.57872) [GFX1-]: glxtest: libpci missing

--Aaron



Re: sometimes graphics is slow, with high Xorg CPU usage

2021-03-10 Thread Aaron Miller
On Wed, 2021-03-10 at 07:54 +, Stuart Henderson wrote:
> On 2021-03-09, Aaron Miller  wrote:
> > For some time now, my -CURRENT system will occasionally get
> > into a
> > state where graphics is slow to refresh and the Xorg uses ~50%
> > of
> > CPU. I notice this in Firefox or GVim when repeatedly pressing
> > PgDn on a long site/file, and in Evolution (emails are slow to
> > load, and text input is laggy when composing a message).
> > 
> > OpenBSD 6.9-beta (GENERIC.MP) #366: Sun Feb 28 07:15:39 MST
> > 2021
> 
> Update your snapshot and see how it goes.

It seems to be fixed now.

I followed these steps in order:

1) test ===> not fixed
2) set "machdep.allowaperture=1" in /etc/sysctl.conf and reboot
3) test ===> not fixed
4) upgrade snapshot and reboot
5) realize I'm behind on openbsd.org/faq/current.html so I run
this: cd /dev && ./MAKEDEV dri
6) reboot
7) test ===> fixed

Thanks for the help!

--Aaron



sometimes graphics is slow, with high Xorg CPU usage

2021-03-09 Thread Aaron Miller
Hi all,

For some time now, my -CURRENT system will occasionally get into a
state where graphics is slow to refresh and the Xorg uses ~50% of
CPU. I notice this in Firefox or GVim when repeatedly pressing
PgDn on a long site/file, and in Evolution (emails are slow to
load, and text input is laggy when composing a message).

Rebooting often fixes it temporarily. I suspect that it happens
after suspending, but I'm not entirely sure of that.

Any idea what is going on, or how I can fix it?

Below is the dmesg and Xorg logs.

Thanks,
Aaron Miller

> dmesg <==
OpenBSD 6.9-beta (GENERIC.MP) #366: Sun Feb 28 07:15:39 MST 2021
   
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.
MP
real mem = 16827916288 (16048MB)
avail mem = 16302538752 (15547MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xccbfd000 (65 entries)
bios0: vendor LENOVO version "N14ET37W (1.15 )" date 09/06/2016
bios0: LENOVO 20BSCTO1WW
acpi0 at bios0: ACPI 5.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SLIC ASF! HPET ECDT APIC MCFG SSDT SSDT
SSDT SSDT SSDT SSDT SSDT SSDT SSDT SSDT PCCT SSDT TCPA SSDT UEFI
MSDM BATB FPDT UEFI DMAR
acpi0: wakeup devices LID_(S4) SLPB(S3) IGBE(S4) EXP2(S4) XHCI(S3)
EHC1(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz, 798.29 MHz, 06-3d-
04
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,
PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D
TES64,MWAIT,DS-
CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE
4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAG
E1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI
1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,RDSEED,ADX,SMAP,PT,SRBDS_CTR
L,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz, 798.16 MHz, 06-3d-
04
cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,
PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D
TES64,MWAIT,DS-
CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE
4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAG
E1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI
1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,RDSEED,ADX,SMAP,PT,SRBDS_CTR
L,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 1, core 0, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz, 798.16 MHz, 06-3d-
04
cpu2:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,
PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D
TES64,MWAIT,DS-
CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE
4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAG
E1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI
1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,RDSEED,ADX,SMAP,PT,SRBDS_CTR
L,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 0, core 1, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz, 798.16 MHz, 06-3d-
04
cpu3:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,
PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D
TES64,MWAIT,DS-
CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE
4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAG
E1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI
1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,RDSEED,ADX,SMAP,PT,SRBDS_CTR
L,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 40 pins
acpimcfg0 at acpi0
acpimcfg0: addr 0xf800, bus 0-63
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PEG_)
acpiprt2 at acpi0: bus 3 (EXP1)
acpiprt3 at acpi0: bus 4 (EXP2)
acpiprt4 at acpi0: bus -1 (EXP3)
acpiprt5 at acpi0: bus -1 (EXP6)
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpipci0 at acpi0 PCI0: 0x 0x0011 0x0001
acpicmos0 at acpi0
acpibat0 at acpi0: BAT0 model "45N1707" serial  3244 type LiP oem
"LGC"
acpiac0 at acpi0: AC unit offline
acpithinkpad0 at acpi0: version 1.0
tpm0 at acpi0 TPM_ addr 0xfed4/0x5000, device 0x104a r

Re: Go language and pledge exec promises

2021-01-25 Thread Aaron Miller
On Thu, 2021-01-21 at 17:02 +0100, Omar Polo wrote:
> 
> Kevin Chadwick  writes:
> 
> > On 1/21/21 2:58 PM, Kevin Chadwick wrote:
> > > > >    840 beep CALL  pledge(0xcf4000,0xcae384)
> > > > >    840 beep STRU  promise="stdio rpath wpath cpath
> > > > > dpath tmppath inet mcast fattr chown flock unix d\
> > > > > ns getpw sendfd recvfd tape tty proc exec
> > > > > prot_exec settime ps vminfo id pf route wroute audio v\
> > > > > ideo bpf unveil error"
> > > > >    840 beep STRU  execpromise=""
> > > > >    840 beep RET   pledge 0
> > > > > 
> > > > Whatever you are trying to do is ridiculous.
> > > Absolutely. In fact the program itself is pointless to
> > > pledge, playing a beep to
> > > the speaker. However, I had pledge disabled in my binaries
> > > due to the syscall 74
> > > Go bug that was fixed. This is just testing with the most
> > > permissable settings.
> > > Perhaps that in itself could cause an issue.
> > 
> > Is execpromise="" equivalent to passing null in c as a nil
> > string in Go is
> > initialised to "" (function sig = string)
> > 
> > Perhaps I should ktrace the whacky full promise passsed as
> > execpromise too?
> 
> Sorry if I chime in, but execpromise="" is a whole different
> story from
> execpromise=NULL.
> 
> > A promises value of "" restricts the process to the _exit(2)
> > system
> > call.
> 
> "" is a pointer to a string whose first character is NUL (\0),
> NULL is
> the null pointer.
> 
> I don't know how to convince the go type system to discern
> between nil
> and "", maybe you need something like sql.NullString
> 
> HTH
> 
> Omar Polo
> 

In Go, if you have a function that takes an argument of type
`string`, then it can't accept nil. In cases where "no string at
all" needs to be distinguished from "empty string", then I would
use `*string` as an argument type.

This makes me think this pledge function needs to take a `*string`
instead of just `string`.

--Aaron



Re: Very slow clock in Debian vmm guest

2020-08-29 Thread Aaron Miller
Hi Jordan,

Thanks for the link -- I have not tested it yet but I believe it
will solve my issue. I did search the misc list but I did not see
anything in the past year that seemed relevant to my particular
time issue.

--Aaron

On Sat, 2020-08-29 at 01:17 -0700, Jordan Geoghegan wrote:
> If you check the mailing list archives, you will see that this
> issue has 
> been discussed extensively.
> 
> Dave Voutila has written a linux vmm kernel driver to work
> around some 
> of the issues:
> 
> https://github.com/voutilad/virtio_vmmci
> 
> Regards,
> 
> Jordan
> 
> On 2020-08-28 20:48, Aaron Miller wrote:
> > I have a debian testing guest running in vmm(4) on my -current
> > system, and the internal clock is very slow. For example
> > running
> > `sleep 3` takes about 10 seconds of real time to run. This is
> > too
> > much for ntpd to correct, unfortunately.
> > 
> > Anyone know what the problem is and how I might go about
> > fixing
> > it? Thanks!
> > 
> > --Aaron
> > [dmesg snipped]



Very slow clock in Debian vmm guest

2020-08-28 Thread Aaron Miller
I have a debian testing guest running in vmm(4) on my -current
system, and the internal clock is very slow. For example running
`sleep 3` takes about 10 seconds of real time to run. This is too
much for ntpd to correct, unfortunately.

Anyone know what the problem is and how I might go about fixing
it? Thanks!

--Aaron

OpenBSD 6.7-current (GENERIC.MP) #36: Sat Aug 22 11:27:03 MDT 2020
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENE
RIC.MP
real mem = 16827916288 (16048MB)
avail mem = 16302870528 (15547MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xccbfd000 (65 entries)
bios0: vendor LENOVO version "N14ET37W (1.15 )" date 09/06/2016
bios0: LENOVO 20BSCTO1WW
acpi0 at bios0: ACPI 5.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SLIC ASF! HPET ECDT APIC MCFG SSDT SSDT
SSDT SSDT SSDT SSDT SSDT SSDT SSDT SSDT PCCT SSDT TCPA SSDT UEFI
MSDM BATB FPDT UEFI DMAR
acpi0: wakeup devices LID_(S4) SLPB(S3) IGBE(S4) EXP2(S4) XHCI(S3)
EHC1(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz, 798.30 MHz, 06-3d-
04
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,
PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D
TES64,MWAIT,DS-
CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE
4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAG
E1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI
1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,RDSEED,ADX,SMAP,PT,MD_CLEAR,
IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz, 798.16 MHz, 06-3d-
04
cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,
PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D
TES64,MWAIT,DS-
CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE
4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAG
E1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI
1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,RDSEED,ADX,SMAP,PT,MD_CLEAR,
IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 1, core 0, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz, 798.17 MHz, 06-3d-
04
cpu2:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,
PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D
TES64,MWAIT,DS-
CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE
4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAG
E1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI
1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,RDSEED,ADX,SMAP,PT,MD_CLEAR,
IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 0, core 1, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz, 798.16 MHz, 06-3d-
04
cpu3:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,
PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D
TES64,MWAIT,DS-
CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE
4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAG
E1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI
1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,RDSEED,ADX,SMAP,PT,MD_CLEAR,
IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 40 pins
acpimcfg0 at acpi0
acpimcfg0: addr 0xf800, bus 0-63
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PEG_)
acpiprt2 at acpi0: bus 3 (EXP1)
acpiprt3 at acpi0: bus 4 (EXP2)
acpiprt4 at acpi0: bus -1 (EXP3)
acpiprt5 at acpi0: bus -1 (EXP6)
acpicpu0 at acpi0: C3(200@233 mwait.1@0x40), C2(200@148 
mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C3(200@233 mwait.1@0x40), C2(200@148 
mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu2 at acpi0: C3(200@233 mwait.1@0x40), C2(200@148 
mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu3 at acpi0: C3(200@233 mwait.1@0x40), C2(200@148 
mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpipwrres0 at acpi0: PUBS, resource for XHCI, EHC1
acpipwrres1 at acpi0: NVP3, resource for PEG_
acpipwrres2 at acpi0: NVP2, resource for PEG_
acpitz0 at acpi0: critical temperature is 128 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpipci0 at acpi0 PCI0: 0x 0x00

Re: multiple simultaneous X sessions?

2020-08-28 Thread Aaron Miller
On Mon, 2020-08-24 at 12:38 -0300, Gleydson Soares wrote:
> Hi Luke,
> 
> On Mon, Aug 24, 2020 at 09:24:35AM -0600, Luke A. Call wrote:
> > What would it take for me to run more than one simultanous X
> > session, each 
> > as a different user? -- I tried once a few years ago,
> > searching, reading
> > man pages, and chasing error messages, and failed at the time.
> > Is it known whether it is reasonably possible with the current
> > code?
> > 
> > (This is so I can take advantage of the privilege separation
> > provided by the OS, while doing different activities and
> > programs
> > programs with different informal trust levels, as separate
> > users, but without the cpu overhead of using "ssh -[X|Y]
> > ...".  This was
> > my normal practice in my Debian days, switching among them
> > with
> > Ctrl-Alt-FN.)
> >  
> > Either way, thanks much for any info.
> > 
> > Luke Call
> 
> Maybe you are looking for a nested X11 via Xephyr.
> 
> See this script as example [1]
> 
> [1] https://github.com/gleydsonsoares/xdroprun
> 

That link is broken for me. It shows 404. Maybe the project was
taken down or made private?

--Aaron



Re: Python 3.8 os.listdir EINVAL on large directories

2020-07-26 Thread Aaron Miller
Hi Alceu,

Note that there are additional messages about this in tech@.

--Aaron


On July 26, 2020 8:53:00 AM PDT, Alceu Rodrigues de Freitas Junior 
 wrote:
>I'm guessing that the usage of getdents was intentional: I've used this
>system call in the same situation (thousands of entries in a directory,
>inside a NFS exported directory) to avoid calling stat() in each entry
>returned by getdents.
>
>It is indead a "low level" system call, and usually readdir is the
>preferred method, but might be too slow for your usage case (in my case
>it was, it took hours to read the directory while with getdents took
>minutes).
>
>It doesn't seems a problem with OpenBSD, but with Python code. Looks
>like some additional logic will be required to address the differences
>betweens the UNIX-like OSs and their implementation of getdents.
>
>On the other hand, by the error message the Python code is passing a
>wrong argument, maybe it is a bug instead of a portability issue?
>
>Em 25/07/2020 20:50, Aaron Miller escreveu:
>> Hi all,
>> 
>> I am getting a stacktrace from the borg command in the borgbackup
>> package while checking a backup (see bottom of email for full
>> output, since it's verbose). The relevant part is this:
>> 
>> filenames = os.listdir(os.path.join(data_path, dir))
>>   OSError: [Errno 22] Invalid argument:
>> '/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12'
>> 
>> This is same error is reproducible with a test Python 3.8 program:
>> 
>>  #!/usr/bin/env python
>> 
>>  import os
>>  os.listdir('/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12/')
>> 
>> Running ktrace & kdump reveals the error is from calling
>> getdents(2):
>> 
>>  76903 python3.8
>> CALL  open(0x1ec7f06de3b0,0x3)
>>  76903 python3.8
>> NAMI  "/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12/"
>>  76903 python3.8 RET   open 3
>>  [...]
>>  76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
>>  76903 python3.8 RET   getdents 16384/0x4000
>>  [...]
>>  76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
>>  76903 python3.8 RET   getdents 16384/0x4000
>>  [...]
>>  76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
>>  76903 python3.8 RET   getdents 16384/0x4000
>>  [...]
>>  76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
>>  76903 python3.8 RET   getdents -1 errno 22 Invalid argument
>> 
>> Looking at the man page for getdents(2), I found it interesting
>> that it says this call "is not a portable interface and should not
>> be used directly by applications" and it recommends using
>> readdir(3) instead.
>> 
>> To give you a rough idea of the number of files and filename sizes
>> in this directory:
>> 
>>   $ ls /mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12/ | wc
>>   15341534   10738
>> 
>> Where does the problem lie -- the upstream Python code, the
>> OpenBSD-specific patches in its port definition, or somewhere
>> else? And in case it matters, this is a -current amd64 system,
>> with "sysupgrade -s" executed on 7/15.
>> 
>> Thank you,
>> Aaron Miller
>> 
>> --
>> Exception ignored in: > 0x1e17e13fd310>
>> Traceback (most recent call last):
>>   File "/usr/local/lib/python3.8/site-
>> packages/borg/repository.py", line 180, in __del__
>> assert False, "cleanup happened in Repository.__del__"
>> AssertionError: cleanup happened in Repository.__del__
>> Local Exception
>> Traceback (most recent call last):
>>   File "/usr/local/lib/python3.8/site-packages/borg/archiver.py",
>> line 4565, in main
>> exit_code = archiver.run(args)
>>   File "/usr/local/lib/python3.8/site-packages/borg/archiver.py",
>> line 4497, in run
>> return set_ec(func(args))
>>   File "/usr/local/lib/python3.8/site-packages/borg/archiver.py",
>> line 161, in wrapper
>> with repository:
>>   File "/usr/local/lib/python3.8/site-
>> packages/borg/repository.py", line 190, in __enter__
>> self.open(self.path, bool(self.exclusive),
>> lock_wait=self.lock_wait, lock=self.do_lock)
>>   File "/usr/local/lib/python3.8/site-
>> packages/borg/repository.py", line 450, in open
>> segment = self.io.get_latest_segment()
>>   File "/usr/local/lib/python3.8/site-
>> packages/borg/repository.py", line 1253, in get_latest_segment
>> for segment, filename in self.segment_iterator(reverse=True):
>>   File "/usr/local/lib/python3.8/site-
>> packages/borg/repository.py", line 1241, in segment_iterator
>> filenames = os.listdir(os.path.join(data_path, dir))
>> OSError: [Errno 22] Invalid argument:
>> '/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12'
>> 
>> Platform: OpenBSD millipede.iforgotmy.name 6.7 GENERIC.MP#348
>> amd64
>> Borg: 1.1.13  Python: CPython 3.8.3 msgpack: 0.5.6
>> PID: 31745  CWD: /mnt/thinkpad_void_obsd_borg
>> sys.argv: ['/usr/local/bin/borg', 'check', 'thinkpad.borg']
>> SSH_ORIGINAL_COMMAND: None
>> 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


Python 3.8 os.listdir EINVAL on large directories

2020-07-25 Thread Aaron Miller
Hi all,

I am getting a stacktrace from the borg command in the borgbackup
package while checking a backup (see bottom of email for full
output, since it's verbose). The relevant part is this:

filenames = os.listdir(os.path.join(data_path, dir))
  OSError: [Errno 22] Invalid argument:
'/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12'

This is same error is reproducible with a test Python 3.8 program:

 #!/usr/bin/env python

 import os
 os.listdir('/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12/')

Running ktrace & kdump reveals the error is from calling
getdents(2):

 76903 python3.8
CALL  open(0x1ec7f06de3b0,0x3)
 76903 python3.8
NAMI  "/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12/"
 76903 python3.8 RET   open 3
 [...]
 76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
 76903 python3.8 RET   getdents 16384/0x4000
 [...]
 76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
 76903 python3.8 RET   getdents 16384/0x4000
 [...]
 76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
 76903 python3.8 RET   getdents 16384/0x4000
 [...]
 76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
 76903 python3.8 RET   getdents -1 errno 22 Invalid argument

Looking at the man page for getdents(2), I found it interesting
that it says this call "is not a portable interface and should not
be used directly by applications" and it recommends using
readdir(3) instead.

To give you a rough idea of the number of files and filename sizes
in this directory:

  $ ls /mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12/ | wc
  15341534   10738

Where does the problem lie -- the upstream Python code, the
OpenBSD-specific patches in its port definition, or somewhere
else? And in case it matters, this is a -current amd64 system,
with "sysupgrade -s" executed on 7/15.

Thank you,
Aaron Miller

--
Exception ignored in: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-
packages/borg/repository.py", line 180, in __del__
assert False, "cleanup happened in Repository.__del__"
AssertionError: cleanup happened in Repository.__del__
Local Exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/borg/archiver.py",
line 4565, in main
exit_code = archiver.run(args)
  File "/usr/local/lib/python3.8/site-packages/borg/archiver.py",
line 4497, in run
return set_ec(func(args))
  File "/usr/local/lib/python3.8/site-packages/borg/archiver.py",
line 161, in wrapper
with repository:
  File "/usr/local/lib/python3.8/site-
packages/borg/repository.py", line 190, in __enter__
self.open(self.path, bool(self.exclusive),
lock_wait=self.lock_wait, lock=self.do_lock)
  File "/usr/local/lib/python3.8/site-
packages/borg/repository.py", line 450, in open
segment = self.io.get_latest_segment()
  File "/usr/local/lib/python3.8/site-
packages/borg/repository.py", line 1253, in get_latest_segment
for segment, filename in self.segment_iterator(reverse=True):
  File "/usr/local/lib/python3.8/site-
packages/borg/repository.py", line 1241, in segment_iterator
filenames = os.listdir(os.path.join(data_path, dir))
OSError: [Errno 22] Invalid argument:
'/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12'

Platform: OpenBSD millipede.iforgotmy.name 6.7 GENERIC.MP#348
amd64
Borg: 1.1.13  Python: CPython 3.8.3 msgpack: 0.5.6
PID: 31745  CWD: /mnt/thinkpad_void_obsd_borg
sys.argv: ['/usr/local/bin/borg', 'check', 'thinkpad.borg']
SSH_ORIGINAL_COMMAND: None



Re: VMM Debian guest serial setup help needed

2020-07-18 Thread Aaron Miller
On Sat, 2020-07-18 at 10:46 +0200, Benjamin Baier wrote:
> On Fri, 17 Jul 2020 23:50:06 -0700
> Aaron Miller <
> aa...@iforgotmy.name
> > wrote:
> 
> > On Fri, 2020-06-12 at 17:46 -0400, George wrote:
> > > On 2020-06-12 11:17 a.m., George wrote:
> > > > [...]
> > 
> > Hey George,
> > 
> > I don't know if you resolved this, but I was able to get
> > further
> > than this loosely following Benjamin's instructions. I skipped
> > the part about the virtio-modules which doesn't seem to be
> > necessary now (and the link is 404 now anyway).
> > 
> > I was able to go through the menu (starting with Install, and
> > skipping the modprobe commands) but DHCP didn't work, and I'm
> > not sure what's broken.
> > 
> > To answer your question, you need to press Esc _after_
> > selecting Install. Maybe that's why you saw the "boot>"
> > prompt.
> > 
> > It worked for me and I just ran lsmod since I didn't have any
> > modules to insert:
> > 
> > ~ # lsmod
> > Module  Size  Used by
> > virtio_blk 20480  0
> > virtio_net 32768  0
> > virtio_pci 24576  0
> > virtio_ring24576  3
> > virtio_blk,virtio_net,virtio_pci
> > virtio 16384  3
> > virtio_blk,virtio_net,virtio_pci
> > 
> > I hope this helps, and please let me know if you or anyone
> > else
> > has an idea of why DHCP isn't working in the guest VM.
> 
> With the virtio modules now included in the installer you can
> skip my
> tutorial. You only need to change bootparameters in GRUB to pass
> vga=off console=ttyS0,115200n8 to the linux kernel.

OK good to know, thanks. I was unaware that the boot parameters
could be specified there rather than by editing TXT.CFG in the
boot image.

> As for DHCP, it depends on your config: is pf blocking DHCP
> traffic?

No.

> is the bridge/switch interface set up correctly?

Perhaps not. I tried a variety of things with bridge0, like
attempting to add my host's egress interface (iwm0) to it,
resulting in a "Device busy" error. I also tried creating a vether
device and attaching that, as described in the Virtualization FAQ.

Using tcpdump on tap0, I was able to see bootp and arp packets
coming from the guest. I did not see any replies from the host
though. Running tcpdump on bridge0 did not show any packets no
matter what I tried.

> is sysctl net.inet.ip.{m,}forwarding set to 1?

Yes.

> do you use vmctl -L (local interface)?
> 

I tried -L but vmctl didn't seem to like that in combination with
a VM specified in vm.conf. I also tried replacing 'interface {
switch "uplink" }' with 'local interface' but that didn't seem to
make a difference.

Thanks for the help so far!
--Aaron



Re: VMM Debian guest serial setup help needed

2020-07-18 Thread Aaron Miller
On Fri, 2020-06-12 at 17:46 -0400, George wrote:
> On 2020-06-12 11:17 a.m., George wrote:
> > On 2020-06-10 4:15 p.m., Benjamin Baier wrote:
> > > On Wed, 10 Jun 2020 14:36:46 -0400
> > > George <
> > > g.lis...@nodeunit.com
> > > > wrote:
> > > 
> > > > Hi guys,
> > > > 
> > > > I apologize if this maybe out of topic even though it is
> > > > truly related
> > > > to VMM than Debian.
> > > > 
> > > > I am trying to setup a VMM Debian based guest but I'm not
> > > > able to 
> > > > get it
> > > > to work. I found some description on the web about which
> > > > settings to
> > > > edit in grub.cfg to enable the serial console and created
> > > > a VM with 
> > > > 10.3
> > > > in qcow2 disk format in KVM. Now I am trying to start the
> > > > same on
> > > > OpenBSD 6.7 but keep getting the connected message and
> > > > then just
> > > > "Rebooting " after I hit some keyboard keys seems like
> > > > baud rate issue
> > > > but not sure.
> > > 
> > > Don't need the KVM/qemu step.
> > 
> > Didn't know that was possible, much better thanks :)
> > > > After messing with it for a while now I am getting a new
> > > > error:
> > > > 
> > > > vmctl: could not open disk image(s)
> > > 
> > > Better start over.
> > 
> > And so I did ...
> > > > even thought the disk is there and readable to the user I
> > > > have setup in
> > > > vm.conf in fact I have another VM with the same
> > > > configuration and disk
> > > > with the same permissions and in the same location that
> > > > works (it is
> > > > OpenBSD based).
> > > > 
> > > > I would greatly appreciate it if someone has gone this
> > > > path and can
> > > > share some config info with me.
> > > 
> > > Here is how I got debian 9 (stretch) installed.
> > > http://www.netzbasis.de/openbsd/vmd-debian/index.html
> > > 
> > > I think the virtio-modules are now included in the debian 10
> > > (buster)
> > > installer, but not tested.
I believe I can confirm this. See below.

> > > 
> > 
> > I am trying your preped boot.img so far going through install
> > options 
> > most of which lead to:
> > 
> > Loading linux... ok
> > Loading initrd.gz...ok
> > Probing EDD (edd=off to disable)... ok
> > Undefined video mode number: 314
> > Press  to see video modes available,  to
> > continue, or 
> > wait 30 sec
> > Mode: Resolution:  Type:
> > 0 F00   80x25  CGA/MDA/HGC
> > Enter a video mode or "scan" to scan for additional modes:
> > 
> > trying Install which I thought would be best (2-nd one after
> > Graphical 
> > Install) hangs with:
> > 
> > [0.00] ACPI BIOS Error (bug): A valid RSDP was not
> > found 
> > (20160831/tbxfroot-244)
> > [0.806052] Initramfs unpacking failed: write error
> > [0.814403] [Firmware Bug]: cpu 0, invalid IBS interrupt
> > offset 0 
> > (MSRC001103A=0x)
> > [1.852264] mce: Unable to init device /dev/mcelog (rc: -5)
> > 
> > Thanks for your help and the page!
> 
> 
> I tried a few more times still no luck. What is the key
> combination I 
> need to use to get into a shell to load the modules. Hitting Esc
> puts me 
> into boot> program which does not understand module handling
> etc.. and 
> the menu does not let me to run a shell. I am missing something
> ...?
> 
> Thanks!
> 

Hey George,

I don't know if you resolved this, but I was able to get further
than this loosely following Benjamin's instructions. I skipped the part about 
the virtio-modules which doesn't seem to be necessary now (and the link is 404 
now anyway).

I was able to go through the menu (starting with Install, and skipping the 
modprobe commands) but DHCP didn't work, and I'm not sure what's broken.

To answer your question, you need to press Esc _after_ selecting Install. Maybe 
that's why you saw the "boot>" prompt.

It worked for me and I just ran lsmod since I didn't have any modules to insert:

~ # lsmod
Module  Size  Used by
virtio_blk 20480  0
virtio_net 32768  0
virtio_pci 24576  0
virtio_ring24576  3 virtio_blk,virtio_net,virtio_pci
virtio 16384  3 virtio_blk,virtio_net,virtio_pci

I hope this helps, and please let me know if you or anyone else
has an idea of why DHCP isn't working in the guest VM.

Thanks,
Aaron Miller



Re: sndio: troubleshooting no input

2020-05-31 Thread Aaron Miller
No, it was set to 0. I set it to 1 and that fixed the issue.
Thanks!
Also, Maurice mentioned "sndioctl -d" so here is the output:
073:input[0].level=0..255 (120)074:input[1].level=0..255
(120)105:input[0].mute=0..1 (0)106:input[1].mute=0..1
(0)009:output[0].level=0..255 (126)010:output[1].level=0..255
(126)041:output[0].mute=0..1 (0)042:output[1].mute=0..1
(0)001:mpv0.level=0..127 (127)000:test0.level=0..127 (127)
--Aaron
On Sun, 2020-05-31 at 18:29 +0200, Jan Stary wrote:
> Do you have sysctl kern.audio.record=1 ?
> Jan
> On May 30 18:17:02, aa...@iforgotmy.name wrote:
> > Hello,
> > I have an amd64 laptop with OpenBSD 6.7 and I am only
> > gettingzero-valued samples when recording. Is there any
> > checklist I cango through to ensure nothing is muted and that
> > I am reading fromthe correct input device?
> > I have tried both aucat and a C program I wrote (attached).
> > Thanks,Aaron Miller
> > #include #include #include
> > #include 
> > #define BUF_SAMPLES 4800#define OUTFILE "recorded.pcm"#define
> > ITERATIONS 500
> > // ffmpeg -y -f s16le -ar 48000 -ac 1 -i recorded.pcm
> > recorded.mp3 && mpv recorded.mp3
> > void print_par(struct sio_par *par);
> > int main(int argc, char* argv[]) {short *sample_buf =
> > NULL;struct sio_hdl *h;int fail = 0;int started =
> > 0;size_t total_bytes_read = 0;int i;size_t
> > bytes_read;FILE *out = NULL;h = sio_open(SIO_DEVANY,
> > SIO_REC, 0);if (h == NULL) {fprintf(stderr, "%s:
> > we're fucked man\n", argv[0]);fail = 1; goto
> > done;}
> > struct sio_par par;sio_initpar(&par);
> > par.bits = 8*sizeof(short);//par.bps =
> > sizeof(short);par.sig = 1;par.le = 1;par.rchan =
> > 1;par.pchan = 2; // unusedpar.rate =
> > 48000;par.xrun = SIO_IGNORE;
> > //print_par(&par);printf("running
> > sio_setpar...\n");if (sio_setpar(h, &par) == 0)
> > {fprintf(stderr, "%s: sio_setpar failed\n",
> > argv[0]);fail = 1; goto
> > done;};//print_par(&par);
> > printf("running sio_getpar...\n");if (sio_getpar(h,
> > &par) == 0) {fprintf(stderr, "%s: sio_getpar
> > failed\n", argv[0]);fail = 1; goto
> > done;};print_par(&par);
> > if (BUF_SAMPLES % par.round != 0) {fprintf(stderr,
> > "%s: samples in buf (%d) not mult of round (%d)\n", argv[0],
> > BUF_SAMPLES, par.round);fail = 1; goto done;}
> > if ((sample_buf = malloc(BUF_SAMPLES * sizeof(short))) ==
> > NULL) {fprintf(stderr, "%s: oh we are sooo fucked.
> > GAME OVER MAN\n", argv[0]);fail = 1; goto done;}
> > if ((out = fopen(OUTFILE, "wb")) == NULL)
> > {fprintf(stderr, "%s: failed to open %s for
> > writing\n", argv[0], OUTFILE);fail = 1; goto
> > done;}
> > if (sio_start(h) == 0) {fprintf(stderr, "%s:
> > failed to sio_start\n", argv[0]);fail = 1; goto
> > done;}started = 1;int retries =
> > 0;printf("START\n");for (i = 0; i < ITERATIONS; i++)
> > {if ((bytes_read = sio_read(h, sample_buf, BUF_SAMPLES
> > * sizeof(short))) == 0) {fprintf(stderr, "%s:
> > failed to sio_read\n", argv[0]);fail = 1; goto
> > done;}total_bytes_read += bytes_read;
> > size_t bytes_written;size_t bw;char*
> > buf_ptr = (char *) sample_buf;for (bytes_written = 0;
> > bytes_written < bytes_read; bytes_written += bw)
> > {size_t bytes_left = bytes_read -
> > bytes_written;bw = fwrite(buf_ptr, 1, bytes_left,
> > out);if (bw < bytes_left && errno != EAGAIN)
> > {fprintf(stderr, "%s: failed to write to
> > file\n",
> > argv[0]);perror(argv[0]);fail
> > = 1; goto done;}buf_ptr +=
> > bw;}}printf("TOTAL BYTES READ: %d\n",
> > total_bytes_read);
> > // cleanupdone:if (started)
> > {sio_stop(h);}if (out != NULL)
> > {fclose(out);}if (sample_buf != NULL)
> > {free(sample_buf);}if (h != NULL)
> > {sio_close(h);}return fail;}
> > void print_par(struct sio_par *par) {char *xrun;switch
> > (par->xrun) {default:xrun = " > val>";   

sndio: troubleshooting no input

2020-05-31 Thread Aaron Miller
Hello,

I have an amd64 laptop with OpenBSD 6.7 and I am only getting
zero-valued samples when recording. Is there any checklist I can
go through to ensure nothing is muted and that I am reading from
the correct input device?

I have tried both aucat and a C program I wrote (attached).

Thanks,
Aaron Miller
#include 
#include 
#include 
#include 

#define BUF_SAMPLES 4800
#define OUTFILE "recorded.pcm"
#define ITERATIONS 500

// ffmpeg -y -f s16le -ar 48000 -ac 1 -i recorded.pcm recorded.mp3 && mpv recorded.mp3

void print_par(struct sio_par *par);

int main(int argc, char* argv[]) {
short *sample_buf = NULL;
struct sio_hdl *h;
int fail = 0;
int started = 0;
size_t total_bytes_read = 0;
int i;
size_t bytes_read;
FILE *out = NULL;
h = sio_open(SIO_DEVANY, SIO_REC, 0);
if (h == NULL) {
fprintf(stderr, "%s: we're fucked man\n", argv[0]);
fail = 1; goto done;
}

struct sio_par par;
sio_initpar(&par);

par.bits = 8*sizeof(short);
//par.bps = sizeof(short);
par.sig = 1;
par.le = 1;
par.rchan = 1;
par.pchan = 2; // unused
par.rate = 48000;
par.xrun = SIO_IGNORE;

//print_par(&par);
printf("running sio_setpar...\n");
if (sio_setpar(h, &par) == 0) {
fprintf(stderr, "%s: sio_setpar failed\n", argv[0]);
fail = 1; goto done;
};
//print_par(&par);

printf("running sio_getpar...\n");
if (sio_getpar(h, &par) == 0) {
fprintf(stderr, "%s: sio_getpar failed\n", argv[0]);
fail = 1; goto done;
};
print_par(&par);

if (BUF_SAMPLES % par.round != 0) {
fprintf(stderr, "%s: samples in buf (%d) not mult of round (%d)\n", argv[0], BUF_SAMPLES, par.round);
fail = 1; goto done;
}

if ((sample_buf = malloc(BUF_SAMPLES * sizeof(short))) == NULL) {
fprintf(stderr, "%s: oh we are sooo fucked. GAME OVER MAN\n", argv[0]);
fail = 1; goto done;
}

if ((out = fopen(OUTFILE, "wb")) == NULL) {
fprintf(stderr, "%s: failed to open %s for writing\n", argv[0], OUTFILE);
fail = 1; goto done;
}

if (sio_start(h) == 0) {
fprintf(stderr, "%s: failed to sio_start\n", argv[0]);
fail = 1; goto done;
}
started = 1;
int retries = 0;
printf("START\n");
for (i = 0; i < ITERATIONS; i++) {
if ((bytes_read = sio_read(h, sample_buf, BUF_SAMPLES * sizeof(short))) == 0) {
fprintf(stderr, "%s: failed to sio_read\n", argv[0]);
fail = 1; goto done;
}
total_bytes_read += bytes_read;

size_t bytes_written;
size_t bw;
char* buf_ptr = (char *) sample_buf;
for (bytes_written = 0; bytes_written < bytes_read; bytes_written += bw) {
size_t bytes_left = bytes_read - bytes_written;
bw = fwrite(buf_ptr, 1, bytes_left, out);
if (bw < bytes_left && errno != EAGAIN) {
fprintf(stderr, "%s: failed to write to file\n", argv[0]);
perror(argv[0]);
fail = 1; goto done;
}
buf_ptr += bw;
}
}
printf("TOTAL BYTES READ: %d\n", total_bytes_read);

// cleanup
done:
if (started) {
sio_stop(h);
}
if (out != NULL) {
fclose(out);
}
if (sample_buf != NULL) {
free(sample_buf);
}
if (h != NULL) {
sio_close(h);
}
return fail;
}

void print_par(struct sio_par *par) {
char *xrun;
switch (par->xrun) {
default:
xrun = "";
break;
case 0:
xrun = "SIO_IGNORE";
break;
case 1:
xrun = "SIO_SYNC";
break;
case 2:
xrun = "SIO_ERROR";
break;
}
printf("&sio_par{\n"
"  bits: %d,\n"
"  bps: %d,\n"
"  sig: %d,\n"
"  le: %d,\n"
"  msb: %d,\n"
"  rchan: %d,\n"
"  pchan: %d,\n"
"  rate: %d,\n"
"  appbufsz: %d,\n"
"  bufsz: %d,\n"
"  round: %d,\n"
"  xrun: %s (%d),\n"
"}\n",
par->bits,  /* bits per sample */
par->bps,   /* bytes per sample */
par->sig,   /* 1 = signed, 0 = unsigned int */
par->le,/* 1 = LE, 0 = BE byte order */
par->msb,   /* 1 = MSB, 0 = LSB aligned */
par->rchan, /* number channels for recording */
par->pchan, /* number channels for playback */
par->rate,  /* frames per second */
par->appbufsz,  /* minimum buffer size without xruns */
par->bufsz, /* end-to-end buffer size (read-only) */
par->round, /* optimal buffer size divisor */
 xrun,  /* what to do on overrun/underrun */
par->xrun
);
}


Re: Adaptive main page for openbsd website.

2019-12-22 Thread Aaron Miller
It looks good to me. I tried it in Firefox on my laptop and on
Android and it seems fine. I also tried it in lynx and found it
was navigable.

--Aaron

On Sun, 2019-12-22 at 19:25 +0300, v...@vtsoft.dev wrote:
> Hello everyone,
> 
> The main page of openbsd.org is currently not responsive. It
> looks bad 
> when I access it from
> my mobile phone. I offer my version of the home page. My CSS
> file is 4 
> times smaller than it
> is now and adapts to the screen size of the device. Please,
> check it: 
> https://vttv.xyz
> . Also,
> you can directly download archive with sources: 
> https://vttv.xyz./openbsd.tar.gz
> .
> 



Re: Missing relayd.conf(5) example

2018-04-21 Thread Aaron Miller
On Sat, 2018-04-21 at 14:55 +0200, Hiltjo Posthuma wrote:
> I don't mean to hijack the thread, but have you been able to forward
> the
> HTTP request and modifying the path? I've researched the code, but I
> don't
> think it's possible at the moment.

I did not attempt this.

> Locally I have a patch which changes the matching logic to the httpd
> Lua
> pattern matching. This has some side-effects and complicates the code
> though,
> so is probably not suitable for upstream.
> 
> One of the reasons I don't use relayd (yet) is because I'd like to
> reverse
> proxy HTTP traffic but strip the path, for example:
> 
>   somedomain.org/someservice to 127.0.0.1:8080/ (stripping
> "someservice").
> 
> Do you perhaps have a solution or idea to do this?

If it is not possible with relayd, I recommend adding application
middleware to strip it out.

--
Aaron



Missing relayd.conf(5) example

2018-04-20 Thread Aaron Miller
Hi all,

I was able to setup relayd(8) with URL-based redirection to either a
local application server or to httpd(8), both listening on lo0; relayd
also terminates TLS. However, the man pages were not very helpful and I
ended up resorting to stackoverflow and trial and error.

I recommend an example like this be added to relayd.conf(5) man page:

  table { 127.0.0.1 }
  table  { 127.0.0.1 }

  http protocol "https" {
match header set "X-Forwarded-For" \
  value "$REMOTE_ADDR" 
match header set "X-Forwarded-By" \
  value "$SERVER_ADDR:$SERVER_PORT" 
match header set "Keep-Alive" value "$TIMEOUT" 

pass request quick path "/api/*" forward to 
pass request quick forward to 
block
  }

  relay "main" {
protocol "https"
listen on 0.0.0.0 port 443 tls
forward to  port 3000
forward to  port 4443
  }

I think that would be helpful for others who want to do what I did...
any thoughts?

--Aaron



Re: lidsuspend does not work anymore on 5.8 snapshot, garbles screen, zzz suspend works fine (longer)

2015-11-24 Thread Aaron Miller
On Mon, Aug 31, 2015 at 08:59:15PM -0400, Michael McConville wrote:
> Michael McConville wrote:
> > I'm having a similar issue on today's AMD64 snapshot on a ThinkPad
> > X210.
> > 
> > When I opened it the screen stayed black and there were no signs of
> > life other than the battery indicator. Pressing keys did nothing. I
> > had to power cycle.
> > 
> > The only relevant syslog entry was:
> > 
> > > Jul 29 13:29:22 thinkpad apmd: system suspending
> 
> For what it's worth, I've had this happen once or twice in the past
> couple days. I'm running new snapshots.
> 

I also noticed the black screen, but with the 11/15 snapshot. I tried
tapping caps lock, which toggled the caps lock LED in the normal manner.
I watched for the hard disk LED but did not see activity after watching
for a few minutes. I had to power cycle as well.

--Aaron