Re: New hw.perfpolicy behavior

2021-11-03 Thread Jurjen Oskam
On Tue, Nov 02, 2021 at 12:26:15PM -0600, Theo de Raadt wrote:

> acpicpu0 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS
> 
> Which means when the idle loop calls the "mwait" instruction, the cpu
> will 'instantly' slow down, until an interrupt happens.  And thus, save
> power.  That is how modern cpus work.

I've been running "apmd -A" on all the incarnations of my home server since
as long as I can remember (15+ years). If I understand the above correctly,
manipulating hw.setperf is in general not the best way to save power on modern
CPUs, which would mean running "apmd -A" is not useful anymore on such systems.

Is my understanding correct?

-- 
Jurjen Oskam



Re: veb(4) exceeds 1514 byte frame size while bridge(4) doesn't?

2021-03-27 Thread Jurjen Oskam
On Tue, Mar 23, 2021 at 08:24:56PM +1000, David Gwynne wrote:

> it looks like ure(4) hardware doesn't strip the fcs before pushing it to
> the host over usb, but the ure(4) driver doesn't strip it.
> 
> this usually isn't a huge deal because layers like ip just ignore
> the extra bytes. bridge(4) was ok with this because it actually
> parses ip packets and removes the extra bytes. veb(4) does a lot less
> (by design) so it just lets the fcs on the end of ure packets go out to
> other nics.
> 
> from what i can tell, ure should remove the fcs. that's what this diff
> does. can you try it?

This fixed the problem without introducing any noticeable other effects,
thanks!

> cheers,
> dlg
> 
> Index: if_ure.c
> ===
> RCS file: /cvs/src/sys/dev/usb/if_ure.c,v
> retrieving revision 1.21
> diff -u -p -r1.21 if_ure.c
> --- if_ure.c  14 Oct 2020 23:47:55 -  1.21
> +++ if_ure.c  23 Mar 2021 10:18:54 -
> @@ -1896,10 +1896,17 @@ ure_rxeof(struct usbd_xfer *xfer, void *
>   ifp->if_ierrors++;
>   goto done;
>   }
> + if (pktlen < ETHER_MIN_LEN) {
> + DPRINTF(("ethernet frame is too short\n"));
> + ifp->if_ierrors++;
> + goto done;
> + }
>  
>   total_len -= roundup(pktlen, URE_RX_BUF_ALIGN);
>   buf += sizeof(rxhdr);
>  
> + /* trim fcs */
> + pktlen -= ETHER_CRC_LEN;
>   m = m_devget(buf, pktlen, ETHER_ALIGN);
>   if (m == NULL) {
>   DPRINTF(("unable to allocate mbuf for next packet\n"));
> 

-- 
Jurjen Oskam



veb(4) exceeds 1514 byte frame size while bridge(4) doesn't?

2021-03-21 Thread Jurjen Oskam
dev 0 function 0 "Realtek RTS525A Card Reader" rev 0x01: msi
sdmmc0 at rtsx0: 4-bit, dma
pcib0 at pci0 dev 31 function 0 "Intel 300 Series LPC" rev 0x30
azalia0 at pci0 dev 31 function 3 "Intel 300 Series HD Audio" rev 0x30: msi
azalia0: codecs: Realtek ALC3204, Intel/0x280b, using Realtek ALC3204
audio0 at azalia0
ichiic0 at pci0 dev 31 function 4 "Intel 300 Series SMBus" rev 0x30: apic 2 int 
16
iic3 at ichiic0
iic3: addr 0x29 0f=33 10=ab 11=35 12=92 13=71 14=b1 15=35 16=26 17=24 18=21 
19=a0 1a=70 1b=84 1c=e0 1d=a0 1e=a0 20=07 22=40 2f=20 30=95 32=0e 33=16 8f=33 
90=ab 91=35 92=92 93=71 94=b1 95=35 96=26 97=24 98=21 99=a0 9a=70 9b=84 9c=e0 
9d=a0 9e=a0 a0=07 a2=40 af=20 b0=95 b2=0e b3=16 words 00= 01= 02= 
03= 04= 05= 06= 07=
spdmem0 at iic3 addr 0x50: 8GB DDR4 SDRAM PC4-21300 SO-DIMM
spdmem1 at iic3 addr 0x52: 8GB DDR4 SDRAM PC4-21300 SO-DIMM
"Intel 300 Series SPI" rev 0x30 at pci0 dev 31 function 5 not configured
em0 at pci0 dev 31 function 6 "Intel I219-LM" rev 0x30: msiem0: The EEPROM 
Checksum Is Not Valid
em0: Unable to initialize the hardware
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pms0 at pckbc0 (aux slot)
wsmouse3 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
vmm0 at mainbus0: VMX/EPT
efifb at mainbus0 not configured
uhub1 at uhub0 port 2 configuration 1 interface 0 "GenesysLogic USB2.1 Hub" rev 
2.10/6.54 addr 2
axe0 at uhub0 port 4 configuration 1 interface 0 "ASIX Electronics AX88772" rev 
2.00/0.01 addr 3
axe0: AX88772, address 00:19:fd:4d:f6:b1
ukphy0 at axe0 phy 16: Generic IEEE 802.3u media interface, rev. 1: OUI 
0x000ec6, model 0x0001
uvideo0 at uhub0 port 6 configuration 1 interface 0 "CN00XMGG8LG0003OD4H7A02 
Integrated_Webcam_HD" rev 2.01/86.16 addr 4
video0 at uvideo0
uvideo1 at uhub0 port 6 configuration 1 interface 2 "CN00XMGG8LG0003OD4H7A02 
Integrated_Webcam_HD" rev 2.01/86.16 addr 4
video1 at uvideo1
ugen0 at uhub0 port 8 "Broadcom Corp 58200" rev 2.00/1.01 addr 5
ugen1 at uhub0 port 10 "Intel product 0x0aaa" rev 2.00/0.02 addr 6
uhub2 at uhub0 port 14 configuration 1 interface 0 "GenesysLogic USB3.1 Hub" 
rev 3.10/6.54 addr 7
ure0 at uhub2 port 4 configuration 1 interface 0 "Realtek USB 10/100/1000 LAN" 
rev 3.00/31.00 addr 8
ure0: RTL8153B (0x6010), address 00:e0:4c:68:28:ed
rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
umass0 at uhub0 port 15 configuration 1 interface 0 "Kingston DT Workspace" rev 
3.00/0.09 addr 9
umass0: using SCSI over Bulk-Only
scsibus1 at umass0: 2 targets, initiator 0
sd0 at scsibus1 targ 1 lun 0:  
serial.0951168f01340135
sd0: 30533MB, 512 bytes/sector, 62533292 sectors
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd0a (ed418629a16fee19.a) swap on sd0b dump on sd0b
inteldrm0: 1920x1080, 32bpp
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0
wsdisplay0: screen 1-5 added (std, vt100 emulation)
iwm0: hw rev 0x310, fw ver 34.3125811985.0, address 14:f6:d8:df:0a:b1

-- 
Jurjen Oskam



nvme.c: trivial patch fixing a typo in a warning message

2017-05-01 Thread Jurjen Oskam
Hi,

Just to see what would happen, I added a virtual NVMe controller to an
OpenBSD 6.1 VM on VMware ESXi 6.5. It seemed to work OK, but on VM shutdown
a warning appeared. I wasn't able to find out more, so the best I have is a
patch correcting a typo in the warning...


Index: src/sys/dev/ic/nvme.c
===
RCS file: /cvs/src/sys/dev/ic/nvme.c,v
retrieving revision 1.54
diff -u -p -u -r1.54 nvme.c
--- src/sys/dev/ic/nvme.c 8 Apr 2017 02:57:25 - 1.54
+++ src/sys/dev/ic/nvme.c 30 Apr 2017 13:12:37 -
@@ -452,7 +452,7 @@ nvme_shutdown(struct nvme_softc *sc)
  delay(1000);
  }

- printf("%s: unable to shudown, disabling\n", DEVNAME(sc));
+ printf("%s: unable to shutdown, disabling\n", DEVNAME(sc));

 disable:
  nvme_disable(sc);



Regards,

Jurjen Oskam


Make dhclient not use lease files

2014-12-08 Thread Jurjen Oskam
();
+   if ((leaseFile = fopen(path_dhclient_db, w)) == NULL)
+   error(can't open %s: %s, path_dhclient_db, 
strerror(errno));
+   rewrite_client_leases();
+   close(fd);
+   }
 
if ((routefd = socket(PF_ROUTE, SOCK_RAW, 0)) == -1)
error(socket(PF_ROUTE, SOCK_RAW): %s, strerror(errno));
@@ -986,7 +988,8 @@ newlease:
client-state = S_BOUND;
 
/* Write out new leases file. */
-   rewrite_client_leases();
+   if (config-use_lease_file)
+   rewrite_client_leases();
 
/* Set timeout to start the renewal process. */
set_timeout(client-active-renewal, state_bound);
Index: sbin/dhclient/dhclient.conf.5
===
RCS file: /cvs/src/sbin/dhclient/dhclient.conf.5,v
retrieving revision 1.31
diff -u -p -r1.31 dhclient.conf.5
--- sbin/dhclient/dhclient.conf.5   11 Nov 2013 15:39:20 -  1.31
+++ sbin/dhclient/dhclient.conf.5   8 Dec 2014 10:07:39 -
@@ -406,6 +406,14 @@ specified name.
 Interfaces for which there is no interface declaration will use the
 parameters declared outside of any interface declaration,
 or the default settings.
+.It Ic no-lease-file ;
+The
+.Ic no-lease-file
+statement causes the DHCP client to not write a lease file on being
+assigned a lease, and to ignore an existing lease file.
+This should be used when the other end of a link requires a successful
+DHCP exchange before making the link fully functional, even when a
+valid lease from a previous DHCP exchange still exists.
 .El
 .Sh EXAMPLES
 The following configuration file is used on a laptop
Index: sbin/dhclient/dhcpd.h
===
RCS file: /cvs/src/sbin/dhclient/dhcpd.h,v
retrieving revision 1.145
diff -u -p -r1.145 dhcpd.h
--- sbin/dhclient/dhcpd.h   5 Dec 2014 15:47:05 -   1.145
+++ sbin/dhclient/dhcpd.h   8 Dec 2014 10:07:39 -
@@ -136,6 +136,7 @@ struct client_config {
int  requested_option_count;
int  required_option_count;
int  ignored_option_count;
+   u_int8_t use_lease_file;
time_t   timeout;
time_t   initial_interval;
time_t   link_timeout;
Index: sbin/dhclient/dhctoken.h
===
RCS file: /cvs/src/sbin/dhclient/dhctoken.h,v
retrieving revision 1.9
diff -u -p -r1.9 dhctoken.h
--- sbin/dhclient/dhctoken.h5 Dec 2013 22:31:35 -   1.9
+++ sbin/dhclient/dhctoken.h8 Dec 2014 10:07:39 -
@@ -78,6 +78,7 @@
 #define TOK_REJECT 292
 #define TOK_LINK_TIMEOUT   294
 #define TOK_IGNORE 295
+#define TOK_NO_LEASE_FILE  296
 
 #define is_identifier(x)   ((x) = TOK_FIRST_TOKEN   \
 (x) != TOK_STRING\








Regards,

Jurjen Oskam