Re: r1.21 of sys/net/hfsc.c cripples networking speed

2015-04-24 Thread David Gwynne

 On 24 Apr 2015, at 3:39 pm, Theo de Raadt dera...@cvs.openbsd.org wrote:
 
 After updating one of my machines to a more recent snapshot I noticed that
 networking speed was reduced and that the machine was 'less' responsive.
 
 Be aware there is a fairly expensive debugging diff in the snapshots
 (it is not actually commited).

yeah. have you tried the speed of a current kernel you've built yourself?

dlg



[patch] acpithinkpad(4) unknown event 0x6000

2015-04-24 Thread Mikhail
Hello, when I switch numlock on thinkpad e530 I see aforesaid message on
console log.

Can someone review inlined patch?

Index: sys/dev/acpi/acpithinkpad.c
===
RCS file: /cvs/src/sys/dev/acpi/acpithinkpad.c,v
retrieving revision 1.43
diff -u -p -r1.43 acpithinkpad.c
--- sys/dev/acpi/acpithinkpad.c 6 Feb 2015 08:16:49 -   1.43
+++ sys/dev/acpi/acpithinkpad.c 24 Apr 2015 10:57:25 -
@@ -90,6 +90,7 @@
 #defineTHINKPAD_BRIGHTNESS_CHANGED 0x5010
 #defineTHINKPAD_TABLET_PEN_INSERTED0x500b
 #defineTHINKPAD_TABLET_PEN_REMOVED 0x500c
+#defineTHINKPAD_SWITCH_NUMLOCK 0x6000
 #defineTHINKPAD_THERMAL_TABLE_CHANGED  0x6030
 #defineTHINKPAD_POWER_CHANGED  0x6040
 #defineTHINKPAD_BACKLIGHT_CHANGED  0x6050
@@ -393,6 +394,7 @@ thinkpad_hotkey(struct aml_node *node, i
case THINKPAD_SWITCH_WIRELESS:
case THINKPAD_TABLET_PEN_INSERTED:
case THINKPAD_TABLET_PEN_REMOVED:
+   case THINKPAD_SWITCH_NUMLOCK:
case THINKPAD_TABLET_SCREEN_NORMAL:
case THINKPAD_TABLET_SCREEN_ROTATED:
case THINKPAD_TABLET_SCREEN_CHANGED:



Re: r1.21 of sys/net/hfsc.c cripples networking speed

2015-04-24 Thread Björn Ketelaars
On Fri 24/04/2015 16:25, David Gwynne wrote:
 
  On 24 Apr 2015, at 3:39 pm, Theo de Raadt dera...@cvs.openbsd.org wrote:
  
  After updating one of my machines to a more recent snapshot I noticed that
  networking speed was reduced and that the machine was 'less' responsive.
  
  Be aware there is a fairly expensive debugging diff in the snapshots
  (it is not actually commited).
 
 yeah. have you tried the speed of a current kernel you've built yourself?
 
 dlg

Just tested a current kernel without a hitch. Guess my observation is the result
from the fairly expensive debugging diff. Sorry for the noise...

For future references: is it possible to see if a kernel from snapshots contains
'non committed' code?

-- 
Björn Ketelaars
GPG key: 0x4F0E5F21



Fwd: sudo not honouring $PATH, $MAIL umask

2015-04-24 Thread Craig Skinner
FYI:

- Forwarded message from Craig Skinner skin...@britvault.co.uk -

Date: Sat, 31 Jan 2015 11:02:39 + (GMT)
From: Craig Skinner skin...@britvault.co.uk
To: b...@openbsd.org
Subject: sudo not honouring $PATH, $MAIL  umask

Synopsis:  sudo not honouring $PATH, $MAIL  umask
Category:  user
Environment:
System  : OpenBSD 5.6
Details : OpenBSD 5.6 (GENERIC) #274: Fri Aug  8 00:05:13 MDT 2014
 
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC

Architecture: OpenBSD.i386
Machine : i386
Description:
sudo -H -i -u username
does not honour username's login(.conf) settings of $PATH, $MAIL  umask

login(1):

 login enters information into the environment (see environ(7)) specifying
 the user's home directory (HOME), command interpreter (SHELL), search
 path (PATH), terminal type (TERM), and user name (both LOGNAME and USER).

ENVIRONMENT
 login sets the following environment variables:

 HOME
 MAIL

sudo(8):

  Command Environment
 ..  On BSD systems, if the use_loginclass option is
 enabled, the environment is initialized based on the path and setenv
 settings in /etc/login.conf.  The new environment contains the TERM,
 PATH, HOME, MAIL, SHELL, LOGNAME, USER, USERNAME and SUDO_* variables in
 addition to variables from the invoking process permitted by the
 env_check and env_keep options.  This is effectively a whitelist for
 environment variables.




How-To-Repeat:
Environment setup:


$ userinfo craig | egrep '^shell|^class'
class   staff
shell   /bin/ksh

$ userinfo david | egrep '^shell|^class'
class
shell   /bin/ksh


$ stat /etc/profile /etc/ksh.kshrc
stat: /etc/profile: No such file or directory
stat: /etc/ksh.kshrc: No such file or directory

$ stat ~craig/.profile ~craig/.kshrc
stat: /home/craig/.profile: No such file or directory
stat: /home/craig/.kshrc: No such file or directory

$ sudo stat ~david/.profile ~david/.kshrc
stat: /home/david/.profile: No such file or directory
stat: /home/david/.kshrc: No such file or directory


$ getcap -s path -f /etc/login.conf staff
/usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/sbin ~/bin
$ getcap -s umask -f /etc/login.conf staff
077

$ getcap -s path -f /etc/login.conf default
/usr/bin /bin /usr/local/bin ~/bin
$ getcap -s umask -f /etc/login.conf default
022


$ egrep 'env_|Defaults' /etc/sudoers | grep -v ^#
Defaults env_keep +=FTPMODE PKG_CACHE PKG_PATH SM_PATH SSH_AUTH_SOCK EDITOR 
VISUAL
Defaults:%wsrc env_keep +=DESTDIR DISTDIR FETCH_CMD FLAVOR GROUP MAKE MAKECONF
Defaults:%wsrc env_keep +=MULTI_PACKAGES NOMAN OKAY_FILES OWNER PKG_DBDIR
Defaults:%wsrc env_keep +=PKG_DESTDIR PKG_TMPDIR PORTSDIR RELEASEDIR 
SHARED_ONLY
Defaults:%wsrc env_keep +=SUBPACKAGE WRKOBJDIR SUDO_PORT_V1
Defaults env_keep +=ftp_proxy http_proxy
Defaults always_set_home, ignore_dot, use_loginclass



$ printenv LOGNAME; printenv PATH; printenv MAIL; umask
craig
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/home/craig/bin
/var/mail/craig
077


Here, $PATH, $MAIL  umask are unchanged:

$ /usr/bin/sudo -H -i -u david
$ printenv LOGNAME; printenv PATH; printenv MAIL; umask
david
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/home/craig/bin
/var/mail/craig
077


Compare the difference when logging in as that user:

$ exit
$ login david
Password:
$ printenv LOGNAME; printenv PATH; printenv MAIL; umask
david
/usr/bin:/bin:/usr/local/bin:/home/david/bin
022



SSH login gains correct $MAIL, along with $PATH  umask:

$ ssh localhost david
Password:
$ printenv LOGNAME; printenv PATH; printenv MAIL; umask
david
/usr/bin:/bin:/usr/local/bin:/home/david/bin
/var/mail/david
022



Note that login looses $MAIL again:

$ login david
Password:
$ printenv LOGNAME; printenv PATH; printenv MAIL; umask
david
/usr/bin:/bin:/usr/local/bin:/home/david/bin
022





Fix:
The sudo users mailing list said the 3 issues I identified
are known bugs, which have been fixed in newer sudo versions:
http://thread.gmane.org/gmane.comp.tools.sudo.user/4367

$ sudo -V
Sudo version 1.7.2p8

http://www.sudo.ws/sudo/stable.html
The current stable release of sudo is 1.8.11p2


Sudo bug 387 refers to MAIL being fixed in 1.7.4:
http://www.sudo.ws/bugs/show_bug.cgi?id=387

Sudo bug 527 (FreeBSD sudo -i doesn't use variables from /etc/login.conf)
seems to be similar: http://www.sudo.ws/bugs/show_bug.cgi?id=527
which is logged as Fixed in sudo 1.8.4

Maybe that fix also covers the login.conf path  umask issues:

http://www.sudo.ws/sudo/stable.html#1.8.4
On systems that use login.conf, sudo -i now sets environment variables
based on login.conf.


http://www.sudo.ws/sudo/stable.html#1.8.5
The initial evironment created when env_reset is in effect now includes
the contents of /etc/environment on AIX systems and the setenv and
path entries from /etc/login.conf on BSD systems.



Unused Variable in lib/libssl/src/crypto/armcap.c

2015-04-24 Thread Kurt Cancemi
In armcap.c there is a variable (e) that is no longer used since
revision 1.5 that is gaurded by __OpenBSD__

--- armcap.c2015-04-24 09:01:28.951425244 -0400
+++ armcap.c2015-04-24 09:02:06.879426067 -0400
@@ -31,9 +31,6 @@
 void
 OPENSSL_cpuid_setup(void)
 {
-#ifndef __OpenBSD__
-char *e;
-#endif
 #if __ARM_ARCH__ = 7
 struct sigactionill_oact, ill_act;
 sigset_toset;

---
Kurt Cancemi



Re: r1.21 of sys/net/hfsc.c cripples networking speed

2015-04-24 Thread Theo de Raadt
 For future references: is it possible to see if a kernel from snapshots 
 contains
 'non committed' code?

No.

It is rare.  However the process has been a great success, so it will
be done every once in a while.




Re: [patch] acpithinkpad(4) unknown event 0x6000

2015-04-24 Thread Giovanni Bechis
On 04/24/15 13:20, Mikhail wrote:
 Hello, when I switch numlock on thinkpad e530 I see aforesaid message on
 console log.
 
 Can someone review inlined patch?
 
it's ok for me and fixes the same problem, ok anyone ?
 Cheers
  Giovanni



Re: Map upd(4) sensors to reports

2015-04-24 Thread David Higgs
On Fri, Apr 24, 2015 at 8:43 PM, David Higgs hig...@gmail.com wrote:

 Associate sensors with the reports they are updated by.  Only the reports
 that have sensors will be enabled, so the enabled field becomes redundant.

 An important but subtle side-effect is that because the sensor tree is
 constructed depth-first, each report SLIST will contain sensors in
 dependency order.


This is patch 5/7, by the way.


Re: carp backup becomes no carrier

2015-04-24 Thread Johan Huldtgren

hello,

a few hours after I sent the previous e-mail the backup
(April 23rd snap) took over and became the master, at
that point I could not reach the carp interfaces anymore.
Reverting roles so the host running the April 12th snap
became the master would mostly fix the problems although
occasionally things would seem to get confused and traffic
(esp to vlan666, which my laptop isn't on but has access
to) would cease. Shutting down the node running the April
23rd snap would generally clear this up, but I'm not sure
if this is a red herring and there is some caching going
on somewhere which is clouding my troubleshooting efforts.

Regardless, I stood up an i386 vm, downloaded -current but
grabbed ip_carp.c r1.249, and built a new kernel. Copied it
over to the firewall which had the April 23rd snap and now
everything is working as it was before. Traffic is flowing
as expected regardless of which host is master and which is
backup. It's only been a few hours, but so far so good.

thanks,

.jh


On 2015-04-24 13:15, Johan Huldtgren wrote:

hello,

I noticed some carp weirdness and sthen@ thought it might be worth
bringing to light.  Quick background, I run two carp nodes, one
(current master) is running the April 12th snapshot, the other is
running the April 23rd snapshot. The node running the April 23rd
snap when it's the backup node ifconfig reports all the carp
interfaces status' as no carrier whereas before (as far as I can
remember and on the April 12th snap at least) it would report
backup. Once the backup becomes the master status changes to
master.

I don't notice anything not working, however this behavior is perhaps
not expected.

dmesgs and ifconfig output for each host below, let me know if you
need anything further.

thanks,

.jh

April 12th snapshot host:

$ dmesg
syncing disks... done
OpenBSD 5.7-current (GENERIC) #772: Sun Apr 12 17:38:03 MDT 2015
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Geode(TM) Integrated Processor by AMD PCS (AuthenticAMD
586-class) 500 MHz
cpu0: FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CFLUSH,MMX,MMXX,3DNOW2,3DNOW
real mem  = 536363008 (511MB)
avail mem = 515301376 (491MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 20/71/05, BIOS32 rev. 0 @ 0xfac40
pcibios0 at bios0: rev 2.0 @ 0xf/0x1
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xc8000/0xa800
cpu0 at mainbus0: (uniprocessor)
mtrr: K6-family MTRR support (2 registers)
amdmsr0 at mainbus0
pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
0:20:0: io address conflict 0x6100/0x100
0:20:0: io address conflict 0x6200/0x200
pchb0 at pci0 dev 1 function 0 AMD Geode LX rev 0x31
glxsb0 at pci0 dev 1 function 2 AMD Geode LX Crypto rev 0x00: RNG AES
vr0 at pci0 dev 6 function 0 VIA VT6105M RhineIII rev 0x96: irq 11,
address 00:00:24:c9:58:4c
ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI
0x004063, model 0x0034
vr1 at pci0 dev 7 function 0 VIA VT6105M RhineIII rev 0x96: irq 5,
address 00:00:24:c9:58:4d
ukphy1 at vr1 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI
0x004063, model 0x0034
vr2 at pci0 dev 8 function 0 VIA VT6105M RhineIII rev 0x96: irq 9,
address 00:00:24:c9:58:4e
ukphy2 at vr2 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI
0x004063, model 0x0034
vr3 at pci0 dev 9 function 0 VIA VT6105M RhineIII rev 0x96: irq 12,
address 00:00:24:c9:58:4f
ukphy3 at vr3 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI
0x004063, model 0x0034
ral0 at pci0 dev 17 function 0 Ralink RT2561S rev 0x00: irq 15,
address 00:12:0e:61:7f:b0
ral0: MAC/BBP RT2561C, RF RT5225
glxpcib0 at pci0 dev 20 function 0 AMD CS5536 ISA rev 0x03: rev 3,
32-bit 3579545Hz timer, watchdog, gpio, i2c
gpio0 at glxpcib0: 32 pins
iic0 at glxpcib0
pciide0 at pci0 dev 20 function 2 AMD CS5536 IDE rev 0x01: DMA,
channel 0 wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: SanDisk SDCFX4-8192
wd0: 4-sector PIO, LBA, 7815MB, 16007040 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 ignored (disabled)
ohci0 at pci0 dev 21 function 0 AMD CS5536 USB rev 0x02: irq 7,
version 1.0, legacy support
ehci0 at pci0 dev 21 function 1 AMD CS5536 USB rev 0x02: irq 7
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 AMD EHCI root hub rev 2.00/1.00 addr 1
isa0 at glxpcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbc0: unable to establish interrupt for aux slot
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
nsclpcsio0 at isa0 port 0x2e/2: NSC PC87366 rev 10: GPIO VLM TMS
gpio1 at nsclpcsio0: 29 pins
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16

Map upd(4) sensors to reports

2015-04-24 Thread David Higgs
Associate sensors with the reports they are updated by.  Only the reports that 
have sensors will be enabled, so the enabled field becomes redundant.

An important but subtle side-effect is that because the sensor tree is 
constructed depth-first, each report SLIST will contain sensors in dependency 
order.

--david

--- a/upd.c
+++ b/upd.c
@@ -79,8 +79,8 @@ static struct upd_usage_entry upd_usage_
 #define UPD_MAX_SENSORS(nitems(upd_usage_batdep) + 
nitems(upd_usage_roots))
 
 struct upd_report {
-   size_t  size;
-   int enabled;
+   size_t  size;
+   SLIST_HEAD(, upd_sensor)sensors;
 };
 
 SLIST_HEAD(upd_sensor_head, upd_sensor);
@@ -90,6 +90,7 @@ struct upd_sensor {
int attached;
struct upd_sensor_head  children;
SLIST_ENTRY(upd_sensor) dep_next;
+   SLIST_ENTRY(upd_sensor) rep_next;
 };
 
 struct upd_softc {
@@ -183,6 +184,8 @@ upd_attach(struct device *parent, struct
 
sc-sc_reports = mallocarray(sc-sc_max_repid,
sizeof(struct upd_report), M_USBDEV, M_WAITOK | M_ZERO);
+   for (i = 0; i  sc-sc_max_repid; i++)
+   SLIST_INIT(sc-sc_reports[i].sensors);
sc-sc_sensors = mallocarray(UPD_MAX_SENSORS,
sizeof(struct upd_sensor), M_USBDEV, M_WAITOK | M_ZERO);
for (i = 0; i  UPD_MAX_SENSORS; i++)
@@ -214,6 +217,7 @@ upd_attach_sensor_tree(struct upd_softc
struct hid_item   item;
struct upd_usage_entry   *entry;
struct upd_sensor*sensor;
+   struct upd_report*report;
int   i;
 
for (i = 0; i  nentries; i++) {
@@ -243,11 +247,11 @@ upd_attach_sensor_tree(struct upd_softc
upd_attach_sensor_tree(sc, desc, size, entry-nchildren,
entry-children, sensor-children);
 
-   if (sc-sc_reports[item.report_ID].enabled)
-   continue;
-   sc-sc_reports[item.report_ID].size = hid_report_size(desc,
-   size, item.kind, item.report_ID);
-   sc-sc_reports[item.report_ID].enabled = 1;
+   report = sc-sc_reports[item.report_ID];
+   if (SLIST_EMPTY(report-sensors))
+   report-size = hid_report_size(desc,
+   size, item.kind, item.report_ID);
+   SLIST_INSERT_HEAD(report-sensors, sensor, rep_next);
}
 }
 
@@ -288,7 +292,7 @@ upd_refresh(void *arg)
 
for (repid = 0; repid  sc-sc_max_repid; repid++) {
report = sc-sc_reports[repid];
-   if (!report-enabled)
+   if (SLIST_EMPTY(report-sensors))
continue;
 
memset(buf, 0x0, sizeof(buf));




Re: Macbook Air azalia(4) quirk

2015-04-24 Thread James Turner
On Fri, Apr 24, 2015 at 08:23:01PM -0400, James Turner wrote:
 The attached diff allows sound to work on my late 2013 Macbook Air
 (6,1). oks?
 

Ok that diff had lots of typos, please ignore until I can send a new
one. Sorry for the noise.

-- 
James Turner



Async upd(4) - patch 7/7

2015-04-24 Thread David Higgs
This is the final patch in the series.

Utilize the pending flags and report callback for their intended purpose - to 
process async behavior.

Apply splusb() to ensure report callbacks can't fire before their data 
structures have been properly updated.  This only needs to happen in 
upd_refresh(); all other calls to upd_request_children() are from a report 
callback.

--david

--- a/upd.c
+++ b/upd.c
@@ -99,6 +99,7 @@ struct upd_softc {
struct uhidevsc_hdev;
int  sc_num_sensors;
u_intsc_max_repid;
+   char sc_buf[256];
 
/* sensor framework */
struct ksensordevsc_sensordev;
@@ -290,27 +291,12 @@ void
 upd_refresh(void *arg)
 {
struct upd_softc*sc = arg;
-   struct upd_report   *report;
-   uint8_t buf[256];
-   int repid, actlen, done;
+   int  s;
 
-   /* request root sensors */
+   /* request root sensors, do not let async handlers fire yet */
+   s = splusb();
upd_request_children(sc, sc-sc_root_sensors, 1);
-
-   /* repeat until all reports queried */
-   do {
-   done = 1;
-   for (repid = 0; repid  sc-sc_max_repid; repid++) {
-   report = sc-sc_reports[repid];
-   if (!report-pending)
-   continue;
-   memset(buf, 0x0, sizeof(buf));
-   actlen = uhidev_get_report(sc-sc_hdev.sc_parent,
-   UHID_FEATURE_REPORT, repid, buf, report-size);
-   upd_update_report_cb(sc, repid, buf, actlen);
-   done = 0;
-   }
-   } while (!done);
+   splx(s);
 }
 
 void
@@ -336,7 +322,14 @@ upd_request_children(struct upd_softc *s
} else if (report-pending)
/* already requested */
sensor-pending = 1;
-   else {
+   else if (uhidev_get_report_async(sc-sc_hdev.sc_parent,
+   UHID_FEATURE_REPORT, repid, sc-sc_buf,
+   report-size, sc, upd_update_report_cb)  0) {
+   DPRINTF((%s: %s request of repid %d failed\n,
+   DEVNAME(sc), sensor-ksensor.desc, repid));
+   sensor-pending = 1;
+   upd_update_report_cb(sc, repid, NULL, -1);
+   } else {
DPRINTF((%s: %s requests repid %d\n,
DEVNAME(sc), sensor-ksensor.desc, repid));
sensor-pending = 1;




upd(4) sensor lookup order - patch 3/7

2015-04-24 Thread David Higgs
Locate sensors in table order - by parsing the USB descriptor multiple times - 
instead of in the order they exist in the USB descriptor.

This will greatly ease construction of a sensor dependency tree, in the next 
diff.

--david

--- a/upd.c
+++ b/upd.c
@@ -86,7 +86,6 @@ struct upd_softc {
struct uhidevsc_hdev;
int  sc_num_sensors;
u_intsc_max_repid;
-   u_intsc_max_sensors;
 
/* sensor framework */
struct ksensordevsc_sensordev;
@@ -104,7 +103,8 @@ void upd_update_sensors(struct upd_softc
 void upd_update_sensor_value(struct upd_softc *, struct upd_sensor *,
 uint8_t *, int);
 void upd_intr(struct uhidev *, void *, uint);
-struct upd_usage_entry *upd_lookup_usage_entry(const struct hid_item *);
+int upd_lookup_usage_entry(void *, int, struct upd_usage_entry *,
+struct hid_item *);
 struct upd_sensor *upd_lookup_sensor(struct upd_softc *, int, int);
 
 struct cfdriver upd_cd = {
@@ -124,9 +124,9 @@ upd_match(struct device *parent, void *m
struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)aux;
int   size;
void *desc;
-   struct hid_data  *hdata;
struct hid_item   item;
int   ret = UMATCH_NONE;
+   int   i;
 
if (uha-reportid != UHIDEV_CLAIM_ALLREPORTID)
return (ret);
@@ -138,14 +138,12 @@ upd_match(struct device *parent, void *m
 * look for at least one sensor of our table
 */
uhidev_get_report_desc(uha-parent, desc, size);
-   for (hdata = hid_start_parse(desc, size, hid_feature);
-hid_get_item(hdata, item); ) {
-   if (upd_lookup_usage_entry(item) != NULL) {
+   for (i = 0; i  nitems(upd_usage_table); i++)
+   if (upd_lookup_usage_entry(desc, size,
+   upd_usage_table + i, item)) {
ret = UMATCH_VENDOR_PRODUCT;
break;
}
-   }
-   hid_end_parse(hdata);
 
return (ret);
 }
@@ -156,17 +154,16 @@ upd_attach(struct device *parent, struct
struct upd_softc *sc = (struct upd_softc *)self;
struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)aux;
struct hid_item   item;
-   struct hid_data  *hdata;
struct upd_usage_entry   *entry;
struct upd_sensor*sensor;
int   size;
+   int   i;
void *desc;
 
sc-sc_hdev.sc_intr = upd_intr;
sc-sc_hdev.sc_parent = uha-parent;
sc-sc_reports = NULL;
sc-sc_sensors = NULL;
-   sc-sc_max_sensors = nitems(upd_usage_table);
 
strlcpy(sc-sc_sensordev.xname, DEVNAME(sc),
sizeof(sc-sc_sensordev.xname));
@@ -177,27 +174,20 @@ upd_attach(struct device *parent, struct
 
sc-sc_reports = mallocarray(sc-sc_max_repid,
sizeof(struct upd_report), M_USBDEV, M_WAITOK | M_ZERO);
-   sc-sc_sensors = mallocarray(sc-sc_max_sensors,
+   sc-sc_sensors = mallocarray(nitems(upd_usage_table),
sizeof(struct upd_sensor), M_USBDEV, M_WAITOK | M_ZERO);
-   size = sc-sc_max_sensors * sizeof(struct upd_sensor);
sc-sc_num_sensors = 0;
-   uhidev_get_report_desc(uha-parent, desc, size);
-   for (hdata = hid_start_parse(desc, size, hid_feature);
-hid_get_item(hdata, item) 
-sc-sc_num_sensors  sc-sc_max_sensors; ) {
-   DPRINTF((upd: repid=%d\n, item.report_ID));
-   if (item.kind != hid_feature ||
-   item.report_ID  0 ||
-   item.report_ID = sc-sc_max_repid)
-   continue;
 
-   if ((entry = upd_lookup_usage_entry(item)) == NULL)
+   uhidev_get_report_desc(uha-parent, desc, size);
+   for (i = 0; i  nitems(upd_usage_table); i++) {
+   entry = upd_usage_table[i];
+   if (!upd_lookup_usage_entry(desc, size, entry, item))
continue;
 
-   /* filter repeated usages, avoid duplicated sensors */
-   sensor = upd_lookup_sensor(sc, entry-usage_pg,
-   entry-usage_id);
-   if (sensor != NULL)
+   DPRINTF((%s: found %s on repid=%d\n, DEVNAME(sc),
+   entry-usage_name, item.report_ID));
+   if (item.report_ID  0 ||
+   item.report_ID = sc-sc_max_repid)
continue;
 
sensor = sc-sc_sensors[sc-sc_num_sensors];
@@ -219,7 +209,6 @@ upd_attach(struct device *parent, struct
size, item.kind, item.report_ID);
sc-sc_reports[item.report_ID].enabled = 1;
}
-   hid_end_parse(hdata);
DPRINTF((upd: sc_num_sensors=%d\n, sc-sc_num_sensors));
 

upd(4) patchset

2015-04-24 Thread David Higgs
Huge thanks to all devs who provided initial feedback in spite of my
inconsistent development pace, especially mpi.

This was mainly a bugfix/infrastructure effort.  There's still plenty of
work to do on new features - better sensor units, new sensors, maybe some
sysctls.

Happy to accept bug reports, comments, questions, and feedback.
Meta-feedback is good too - patches too small/crappy, coding style
requests, etc.

--david


upd(4) sensor value - patch 2/7

2015-04-24 Thread David Higgs
Split out sensor value update now, since sensor updating will become more 
complex.

Also, avoid potential signed/unsigned and truncation errors.  Sensor values are 
int64_t wide, so put them to work.

--david

--- a/upd.c
+++ b/upd.c
@@ -101,6 +101,8 @@ int  upd_detach(struct device *, int);
 
 void upd_refresh(void *);
 void upd_update_sensors(struct upd_softc *, uint8_t *, unsigned int, int);
+void upd_update_sensor_value(struct upd_softc *, struct upd_sensor *,
+uint8_t *, int);
 void upd_intr(struct uhidev *, void *, uint);
 struct upd_usage_entry *upd_lookup_usage_entry(const struct hid_item *);
 struct upd_sensor *upd_lookup_sensor(struct upd_softc *, int, int);
@@ -324,8 +326,7 @@ upd_update_sensors(struct upd_softc *sc,
 int repid)
 {
struct upd_sensor   *sensor;
-   ulong   hdata, batpres;
-   ulong   adjust;
+   ulong   batpres;
int i;
 
sensor = upd_lookup_sensor(sc, HUP_BATTERY, HUB_BATTERY_PRESENT);
@@ -348,27 +349,35 @@ upd_update_sensors(struct upd_softc *sc,
}
}
 
-   switch (HID_GET_USAGE(sensor-hitem.usage)) {
-   case HUB_REL_STATEOF_CHARGE:
-   case HUB_ABS_STATEOF_CHARGE:
-   case HUB_REM_CAPACITY:
-   case HUB_FULLCHARGE_CAPACITY:
-   adjust = 1000; /* scale adjust */
-   break;
-   default:
-   adjust = 1; /* no scale adjust */
-   break;
-   }
+   upd_update_sensor_value(sc, sensor, buf, len);
+   }
+}
 
-   hdata = hid_get_data(buf, len, sensor-hitem.loc);
+void
+upd_update_sensor_value(struct upd_softc *sc, struct upd_sensor *sensor,
+uint8_t *buf, int len)
+{
+   int64_t hdata, adjust;
 
-   sensor-ksensor.value = hdata * adjust;
-   sensor-ksensor.status = SENSOR_S_OK;
-   sensor-ksensor.flags = ~SENSOR_FINVALID;
-   DPRINTF((%s: hidget data: %lu\n, DEVNAME(sc), hdata));
+   switch (HID_GET_USAGE(sensor-hitem.usage)) {
+   case HUB_REL_STATEOF_CHARGE:
+   case HUB_ABS_STATEOF_CHARGE:
+   case HUB_REM_CAPACITY:
+   case HUB_FULLCHARGE_CAPACITY:
+   adjust = 1000; /* scale adjust */
+   break;
+   default:
+   adjust = 1; /* no scale adjust */
+   break;
}
-}
 
+   hdata = hid_get_data(buf, len, sensor-hitem.loc);
+   sensor-ksensor.value = hdata * adjust;
+   sensor-ksensor.status = SENSOR_S_OK;
+   sensor-ksensor.flags = ~SENSOR_FINVALID;
+   DPRINTF((%s: %s hidget data: %lld\n, DEVNAME(sc),
+   sensor-ksensor.desc, hdata));
+}
 
 void
 upd_intr(struct uhidev *uh, void *p, uint len)




Macbook Air azalia(4) quirk

2015-04-24 Thread James Turner
The attached diff allows sound to work on my late 2013 Macbook Air
(6,1). oks?

-- 
James Turner

Index: azalia_codec.c
===
RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v
retrieving revision 1.165
diff -u -p -u -p -r1.165 azalia_codec.c
--- azalia_codec.c  10 Dec 2014 14:18:11 -  1.165
+++ azalia_codec.c  25 Apr 2015 00:06:23 -
@@ -71,6 +71,11 @@ azalia_codec_init_vtbl(codec_t *this)
AZ_QRK_GPIO_UNMUTE_3;
}
break;
+   case 0x10134208:
+   this-name = Cirrus Logic CS4208;
+   if (this-subid == 0x72708086) {/* APPLE_MBA6_1 */
+   this-qrks != AZ_QRK_GPIO_UNMUTE_0;
+   }
case 0x10ec0221:
this-name = Realtek ALC221;
this-qrks |= AZ_QRK_WID_CDIN_1C | AZ_QRK_WID_BEEP_1D;



DEVNAME for upd(4) - patch 1/7

2015-04-24 Thread David Higgs
Should be pretty straightforward.

--david

--- a/upd.c
+++ b/upd.c
@@ -39,6 +39,8 @@
 #define DPRINTF(x)
 #endif
 
+#define DEVNAME(sc)((sc)-sc_hdev.sc_dev.dv_xname)
+
 struct upd_usage_entry {
uint8_t usage_pg;
uint8_t usage_id;
@@ -164,12 +166,12 @@ upd_attach(struct device *parent, struct
sc-sc_sensors = NULL;
sc-sc_max_sensors = nitems(upd_usage_table);
 
-   strlcpy(sc-sc_sensordev.xname, sc-sc_hdev.sc_dev.dv_xname,
+   strlcpy(sc-sc_sensordev.xname, DEVNAME(sc),
sizeof(sc-sc_sensordev.xname));
 
sc-sc_max_repid = uha-parent-sc_nrepid;
DPRINTF((\nupd: devname=%s sc_max_repid=%d\n,
-   sc-sc_hdev.sc_dev.dv_xname, sc-sc_max_repid));
+   DEVNAME(sc), sc-sc_max_repid));
 
sc-sc_reports = mallocarray(sc-sc_max_repid,
sizeof(struct upd_report), M_USBDEV, M_WAITOK | M_ZERO);
@@ -363,8 +365,7 @@ upd_update_sensors(struct upd_softc *sc,
sensor-ksensor.value = hdata * adjust;
sensor-ksensor.status = SENSOR_S_OK;
sensor-ksensor.flags = ~SENSOR_FINVALID;
-   DPRINTF((%s: hidget data: %lu\n,
-   sc-sc_sensordev.xname, hdata));
+   DPRINTF((%s: hidget data: %lu\n, DEVNAME(sc), hdata));
}
 }
 



Re: Macbook Air azalia(4) quirk

2015-04-24 Thread James Turner
On Fri, Apr 24, 2015 at 08:53:44PM -0400, James Turner wrote:
 On Fri, Apr 24, 2015 at 08:23:01PM -0400, James Turner wrote:
  The attached diff allows sound to work on my late 2013 Macbook Air
  (6,1). oks?
  
 
 Ok that diff had lots of typos, please ignore until I can send a new
 one. Sorry for the noise.
 

Here is the correct typo free version.

-- 
James Turner

Index: azalia_codec.c
===
RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v
retrieving revision 1.165
diff -u -p -u -p -r1.165 azalia_codec.c
--- azalia_codec.c  10 Dec 2014 14:18:11 -  1.165
+++ azalia_codec.c  25 Apr 2015 01:17:33 -
@@ -71,6 +71,12 @@ azalia_codec_init_vtbl(codec_t *this)
AZ_QRK_GPIO_UNMUTE_3;
}
break;
+   case 0x10134208:
+   this-name = Cirrus Logic CS4208;
+   if (this-subid == 0x72708086) {/* APPLE_MBA6_1 */
+   this-qrks |= AZ_QRK_GPIO_UNMUTE_0 | 
AZ_QRK_GPIO_UNMUTE_1;
+   }
+   break;
case 0x10ec0221:
this-name = Realtek ALC221;
this-qrks |= AZ_QRK_WID_CDIN_1C | AZ_QRK_WID_BEEP_1D;



Build upd(4) sensor tree - patch 4/7

2015-04-24 Thread David Higgs
Divide sensors into two tables - normal sensors and battery dependent sensors.  
Build the sensor dependency tree - every sensor has an SLIST of dependent 
children.

Also, don’t bother looking for battery dependent sensors at device attach, it 
doesn’t seem helpful.

(Someone please correct me if static structure elements aren’t initialized to 
zero.)

--david

--- a/upd.c
+++ b/upd.c
@@ -23,6 +23,7 @@
 #include sys/kernel.h
 #include sys/malloc.h
 #include sys/device.h
+#include sys/queue.h
 #include sys/sensors.h
 
 #include dev/usb/hid.h
@@ -46,9 +47,11 @@ struct upd_usage_entry {
uint8_t usage_id;
enum sensor_typesenstype;
char*usage_name; /* sensor string */
+   int nchildren;
+   struct upd_usage_entry  *children;
 };
 
-static struct upd_usage_entry upd_usage_table[] = {
+static struct upd_usage_entry upd_usage_batdep[] = {
{ HUP_BATTERY,  HUB_REL_STATEOF_CHARGE,
SENSOR_PERCENT,  RelativeStateOfCharge },
{ HUP_BATTERY,  HUB_ABS_STATEOF_CHARGE,
@@ -61,25 +64,32 @@ static struct upd_usage_entry upd_usage_
SENSOR_INDICATOR,Charging },
{ HUP_BATTERY,  HUB_DISCHARGING,
SENSOR_INDICATOR,Discharging },
+   { HUP_BATTERY,  HUB_ATRATE_TIMETOFULL,
+   SENSOR_TIMEDELTA,AtRateTimeToFull }
+};
+static struct upd_usage_entry upd_usage_roots[] = {
{ HUP_BATTERY,  HUB_BATTERY_PRESENT,
-   SENSOR_INDICATOR,BatteryPresent },
+   SENSOR_INDICATOR,BatteryPresent,
+   nitems(upd_usage_batdep),   upd_usage_batdep },
{ HUP_POWER,HUP_SHUTDOWN_IMMINENT,
SENSOR_INDICATOR,ShutdownImminent },
{ HUP_BATTERY,  HUB_AC_PRESENT,
-   SENSOR_INDICATOR,ACPresent },
-   { HUP_BATTERY,  HUB_ATRATE_TIMETOFULL,
-   SENSOR_TIMEDELTA,AtRateTimeToFull }
+   SENSOR_INDICATOR,ACPresent }
 };
+#define UPD_MAX_SENSORS(nitems(upd_usage_batdep) + 
nitems(upd_usage_roots))
 
 struct upd_report {
size_t  size;
int enabled;
 };
 
+SLIST_HEAD(upd_sensor_head, upd_sensor);
 struct upd_sensor {
-   struct ksensor  ksensor;
-   struct hid_item hitem;
-   int attached;
+   struct ksensor  ksensor;
+   struct hid_item hitem;
+   int attached;
+   struct upd_sensor_head  children;
+   SLIST_ENTRY(upd_sensor) dep_next;
 };
 
 struct upd_softc {
@@ -92,10 +102,13 @@ struct upd_softc {
struct sensor_task  *sc_sensortask;
struct upd_report   *sc_reports;
struct upd_sensor   *sc_sensors;
+   struct upd_sensor_head   sc_root_sensors;
 };
 
 int  upd_match(struct device *, void *, void *);
 void upd_attach(struct device *, struct device *, void *);
+void upd_attach_sensor_tree(struct upd_softc *, void *, int, int,
+struct upd_usage_entry *, struct upd_sensor_head *);
 int  upd_detach(struct device *, int);
 
 void upd_refresh(void *);
@@ -134,13 +147,11 @@ upd_match(struct device *parent, void *m
DPRINTF((upd: vendor=0x%04x, product=0x%04x\n, uha-uaa-vendor,
uha-uaa-product));
 
-   /*
-* look for at least one sensor of our table
-*/
+   /* need at least one sensor from root of tree */
uhidev_get_report_desc(uha-parent, desc, size);
-   for (i = 0; i  nitems(upd_usage_table); i++)
+   for (i = 0; i  nitems(upd_usage_roots); i++)
if (upd_lookup_usage_entry(desc, size,
-   upd_usage_table + i, item)) {
+   upd_usage_roots + i, item)) {
ret = UMATCH_VENDOR_PRODUCT;
break;
}
@@ -153,9 +164,6 @@ upd_attach(struct device *parent, struct
 {
struct upd_softc *sc = (struct upd_softc *)self;
struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)aux;
-   struct hid_item   item;
-   struct upd_usage_entry   *entry;
-   struct upd_sensor*sensor;
int   size;
int   i;
void *desc;
@@ -164,6 +172,7 @@ upd_attach(struct device *parent, struct
sc-sc_hdev.sc_parent = uha-parent;
sc-sc_reports = NULL;
sc-sc_sensors = NULL;
+   SLIST_INIT(sc-sc_root_sensors);
 
strlcpy(sc-sc_sensordev.xname, DEVNAME(sc),
sizeof(sc-sc_sensordev.xname));
@@ -174,13 +183,41 @@ upd_attach(struct device *parent, struct
 
sc-sc_reports = mallocarray(sc-sc_max_repid,
sizeof(struct upd_report), M_USBDEV, M_WAITOK | M_ZERO);
-   sc-sc_sensors = mallocarray(nitems(upd_usage_table),
+   sc-sc_sensors = mallocarray(UPD_MAX_SENSORS,
sizeof(struct upd_sensor), M_USBDEV, M_WAITOK | M_ZERO);
-   

upd(4) report order - patch 6/7

2015-04-24 Thread David Higgs
This is the big change that puts all the previous work together.

When a sensor update is needed, mark its report as pending; do this in 
dependency order.  When a report fails to query/reply, mark it and its children 
as invalid.  When the BatteryPresent says there is no battery, mark its 
children as invalid too.

If BatteryPresent is on a repid that comes numerically after a child, the 
do/while loop will try again until there are no more pending reports.

If BatteryPresent is on the same repid as a child, the report-sensors list 
will have already put it in the correct order so the parent will update before 
the child.

If BatteryPresent=false invalidates children that belong to an already-pending 
report, they will not be updated, because sensor-pending will no longer be set.

--david

--- a/upd.c
+++ b/upd.c
@@ -81,6 +81,7 @@ static struct upd_usage_entry upd_usage_
 struct upd_report {
size_t  size;
SLIST_HEAD(, upd_sensor)sensors;
+   int pending;
 };
 
 SLIST_HEAD(upd_sensor_head, upd_sensor);
@@ -91,6 +92,7 @@ struct upd_sensor {
struct upd_sensor_head  children;
SLIST_ENTRY(upd_sensor) dep_next;
SLIST_ENTRY(upd_sensor) rep_next;
+   int pending;
 };
 
 struct upd_softc {
@@ -113,7 +115,9 @@ void upd_attach_sensor_tree(struct upd_s
 int  upd_detach(struct device *, int);
 
 void upd_refresh(void *);
-void upd_update_sensors(struct upd_softc *, uint8_t *, unsigned int, int);
+void upd_request_children(struct upd_softc *, struct upd_sensor_head *, int);
+void upd_update_report_cb(void *, int, void *, int);
+void upd_update_sensor(struct upd_softc *, struct upd_sensor *, uint8_t *, 
int);
 void upd_update_sensor_value(struct upd_softc *, struct upd_sensor *,
 uint8_t *, int);
 void upd_intr(struct uhidev *, void *, uint);
@@ -285,30 +289,59 @@ upd_detach(struct device *self, int flag
 void
 upd_refresh(void *arg)
 {
-   struct upd_softc*sc = (struct upd_softc *)arg;
+   struct upd_softc*sc = arg;
struct upd_report   *report;
uint8_t buf[256];
-   int repid, actlen;
+   int repid, actlen, done;
 
-   for (repid = 0; repid  sc-sc_max_repid; repid++) {
-   report = sc-sc_reports[repid];
-   if (SLIST_EMPTY(report-sensors))
-   continue;
+   /* request root sensors */
+   upd_request_children(sc, sc-sc_root_sensors, 1);
 
-   memset(buf, 0x0, sizeof(buf));
-   actlen = uhidev_get_report(sc-sc_hdev.sc_parent,
-   UHID_FEATURE_REPORT, repid, buf, report-size);
-
-   if (actlen == -1) {
-   DPRINTF((upd: failed to get report id=%02x\n, repid));
-   continue;
+   /* repeat until all reports queried */
+   do {
+   done = 1;
+   for (repid = 0; repid  sc-sc_max_repid; repid++) {
+   report = sc-sc_reports[repid];
+   if (!report-pending)
+   continue;
+   memset(buf, 0x0, sizeof(buf));
+   actlen = uhidev_get_report(sc-sc_hdev.sc_parent,
+   UHID_FEATURE_REPORT, repid, buf, report-size);
+   upd_update_report_cb(sc, repid, buf, actlen);
+   done = 0;
}
+   } while (!done);
+}
+
+void
+upd_request_children(struct upd_softc *sc, struct upd_sensor_head *queue,
+int valid)
+{
+   struct upd_sensor   *sensor;
+   struct upd_report   *report;
+   int  repid;
 
-   /* Deal with buggy firmwares. */
-   if (actlen  report-size)
-   report-size = actlen;
+   SLIST_FOREACH(sensor, queue, dep_next) {
+   repid = sensor-hitem.report_ID;
+   report = sc-sc_reports[repid];
 
-   upd_update_sensors(sc, buf, report-size, repid);
+   if (sensor-pending)
+   DPRINTF((%s: %s still pending (repid=%d)\n,
+   DEVNAME(sc), sensor-ksensor.desc, repid));
+   else if (!valid) {
+   DPRINTF((%s: marking %s invalid\n,
+   DEVNAME(sc), sensor-ksensor.desc));
+   sensor-pending = 1;
+   upd_update_sensor(sc, sensor, NULL, -1);
+   } else if (report-pending)
+   /* already requested */
+   sensor-pending = 1;
+   else {
+   DPRINTF((%s: %s requests repid %d\n,
+   DEVNAME(sc), sensor-ksensor.desc, repid));
+   sensor-pending = 1;
+   report-pending = 1;
+   }
}
 }
 

Re: crypto softraid and keydisk on same harddrive

2015-04-24 Thread Patrik Lundin
On Wed, Oct 29, 2014 at 01:24:30AM +1100, Joel Sing wrote:
 On Wed, 29 Oct 2014, Joel Sing wrote:
 
  A CRYPTO key disk is slightly special in that it has softraid metadata but
  is not technically part of the same volume (well, it is in some ways but it
  is not in others). The problem in question occurs since installboot(8)
  installs the first stage boot loader on each chunk that is a member of the
  volume - in this case it installs first stage boot loader twice (once for
  wd0a and again for wd0d). The second stage boot loader is installed in the
  softraid metadata area for the sd0 volume, however in the case of a CRYPTO
  key disk its metadata area does not end up with a copy of the boot of the
  second stage loader (unlike, say a RAID 1 chunk). If the first stage boot
  blocks are installed in the CRYPTO volume then the key disk, the boot
  loader (in the PBR of wd0) will end up pointing at a boot storage area (of
  the key disk) that does not contain the second stage boot loader. The fix
  is to probably avoid installing the boot loader on the key disk.
 
 You could try this (only compile tested) diff:
 
 Index: i386_softraid.c
 ===
 RCS file: /cvs/src/usr.sbin/installboot/i386_softraid.c,v
 retrieving revision 1.2
 diff -u -p -r1.2 i386_softraid.c
 --- i386_softraid.c   9 Jun 2014 13:13:48 -   1.2
 +++ i386_softraid.c   28 Oct 2014 14:21:27 -
 @@ -42,6 +42,7 @@ voidsr_install_bootldr(int, char *);
  void
  sr_install_bootblk(int devfd, int vol, int disk)
  {
 + struct bioc_vol bv;
   struct bioc_disk bd;
   struct disklabel dl;
   struct partition *pp;
 @@ -56,6 +57,15 @@ sr_install_bootblk(int devfd, int vol, i
   bd.bd_diskid = disk;
   if (ioctl(devfd, BIOCDISK, bd) == -1)
   err(1, BIOCDISK);
 +
 + /* Skip CRYPTO key disks. */
 + /* XXX - pass volume in rather than volume ID. */
 + memset(bv, 0, sizeof(bv));
 + bv.bv_volid = vol;
 + if (ioctl(devfd, BIOCVOL, bv) == -1)
 + err(1, BIOCVOL);
 + if (bv.bv_level == 'C'  bd.bd_size == 0)
 + return;
  
   /* Check disk status. */
   if (bd.bd_status != BIOC_SDONLINE  bd.bd_status != BIOC_SDREBUILD) {
 
 -- 
 
 Action without study is fatal. Study without action is futile.
 -- Mary Ritter Beard

Any developer feel like looking at merging this diff? It seems jsing is
busy with other work. My interest in this is that it is helpful for
OpenBSD machines used at Dreamhack (http://dreamhack.se) to quickly
decommision them when the festival is over.

The original thread can be found here:
http://marc.info/?l=openbsd-miscm=141435482820277w=2

-- 
Patrik Lundin



fix sndiod.1: 7680 vs 7860

2015-04-24 Thread David Coppa

Hi!

Code says 7860:

dcoppa@t420:/usr/src/usr.bin/sndiod$ grep 7860 *
sndiod.c:#define DEFAULT_BUFSZ  7860

While manpage says 7680:

dcoppa@t420:/usr/src/usr.bin/sndiod$ grep 7680 *
sndiod.1:The default is 7680 or twice the block size

Ciao,
David

Index: sndiod.1
===
RCS file: /cvs/src/usr.bin/sndiod/sndiod.1,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 sndiod.1
--- sndiod.113 Aug 2014 08:42:46 -  1.4
+++ sndiod.124 Apr 2015 15:33:45 -
@@ -140,7 +140,7 @@ The buffer size of the audio device in f
 A frame consists of one sample for each channel in the stream.
 This is the number of frames that will be buffered before being played
 and thus controls the playback latency.
-The default is 7680 or twice the block size
+The default is 7860 or twice the block size
 .Pq Fl z ,
 if the block size is set.
 .It Xo



Re: fix sndiod.1: 7680 vs 7860

2015-04-24 Thread Alexandre Ratchov
On Fri, Apr 24, 2015 at 10:36:24AM -0600, David Coppa wrote:
 
 Hi!
 
 Code says 7860:
 
 dcoppa@t420:/usr/src/usr.bin/sndiod$ grep 7860 *
 sndiod.c:#define DEFAULT_BUFSZ7860
 
 While manpage says 7680:
 
 dcoppa@t420:/usr/src/usr.bin/sndiod$ grep 7680 *
 sndiod.1:The default is 7680 or twice the block size
 

oops, the man page is right and the code wrong, the intended value
was 7680, feel free to fix it. Both are close to each other, so no
audible difference.

But this reminds me that it may be time to start using less
conservative defaults, maybe 1920, or even 960.



carp backup becomes no carrier

2015-04-24 Thread Johan Huldtgren

hello,

I noticed some carp weirdness and sthen@ thought it might be worth
bringing to light.  Quick background, I run two carp nodes, one
(current master) is running the April 12th snapshot, the other is
running the April 23rd snapshot. The node running the April 23rd
snap when it's the backup node ifconfig reports all the carp
interfaces status' as no carrier whereas before (as far as I can
remember and on the April 12th snap at least) it would report
backup. Once the backup becomes the master status changes to
master.

I don't notice anything not working, however this behavior is perhaps
not expected.

dmesgs and ifconfig output for each host below, let me know if you
need anything further.

thanks,

.jh

April 12th snapshot host:

$ dmesg
syncing disks... done
OpenBSD 5.7-current (GENERIC) #772: Sun Apr 12 17:38:03 MDT 2015
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Geode(TM) Integrated Processor by AMD PCS (AuthenticAMD 
586-class) 500 MHz

cpu0: FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CFLUSH,MMX,MMXX,3DNOW2,3DNOW
real mem  = 536363008 (511MB)
avail mem = 515301376 (491MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 20/71/05, BIOS32 rev. 0 @ 0xfac40
pcibios0 at bios0: rev 2.0 @ 0xf/0x1
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xc8000/0xa800
cpu0 at mainbus0: (uniprocessor)
mtrr: K6-family MTRR support (2 registers)
amdmsr0 at mainbus0
pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
0:20:0: io address conflict 0x6100/0x100
0:20:0: io address conflict 0x6200/0x200
pchb0 at pci0 dev 1 function 0 AMD Geode LX rev 0x31
glxsb0 at pci0 dev 1 function 2 AMD Geode LX Crypto rev 0x00: RNG AES
vr0 at pci0 dev 6 function 0 VIA VT6105M RhineIII rev 0x96: irq 11, 
address 00:00:24:c9:58:4c
ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 
0x004063, model 0x0034
vr1 at pci0 dev 7 function 0 VIA VT6105M RhineIII rev 0x96: irq 5, 
address 00:00:24:c9:58:4d
ukphy1 at vr1 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 
0x004063, model 0x0034
vr2 at pci0 dev 8 function 0 VIA VT6105M RhineIII rev 0x96: irq 9, 
address 00:00:24:c9:58:4e
ukphy2 at vr2 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 
0x004063, model 0x0034
vr3 at pci0 dev 9 function 0 VIA VT6105M RhineIII rev 0x96: irq 12, 
address 00:00:24:c9:58:4f
ukphy3 at vr3 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 
0x004063, model 0x0034
ral0 at pci0 dev 17 function 0 Ralink RT2561S rev 0x00: irq 15, 
address 00:12:0e:61:7f:b0

ral0: MAC/BBP RT2561C, RF RT5225
glxpcib0 at pci0 dev 20 function 0 AMD CS5536 ISA rev 0x03: rev 3, 
32-bit 3579545Hz timer, watchdog, gpio, i2c

gpio0 at glxpcib0: 32 pins
iic0 at glxpcib0
pciide0 at pci0 dev 20 function 2 AMD CS5536 IDE rev 0x01: DMA, 
channel 0 wired to compatibility, channel 1 wired to compatibility

wd0 at pciide0 channel 0 drive 0: SanDisk SDCFX4-8192
wd0: 4-sector PIO, LBA, 7815MB, 16007040 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 ignored (disabled)
ohci0 at pci0 dev 21 function 0 AMD CS5536 USB rev 0x02: irq 7, 
version 1.0, legacy support

ehci0 at pci0 dev 21 function 1 AMD CS5536 USB rev 0x02: irq 7
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 AMD EHCI root hub rev 2.00/1.00 addr 1
isa0 at glxpcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbc0: unable to establish interrupt for aux slot
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
nsclpcsio0 at isa0 port 0x2e/2: NSC PC87366 rev 10: GPIO VLM TMS
gpio1 at nsclpcsio0: 29 pins
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb1 at ohci0: USB revision 1.0
uhub1 at usb1 AMD OHCI root hub rev 1.00/1.00 addr 1
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on wd0a (ba730608caf94ae4.a) swap on wd0b dump on wd0b
carp0: state transition: BACKUP - MASTER
carp1: state transition: BACKUP - MASTER
carp2: state transition: BACKUP - MASTER
carp3: state transition: BACKUP - MASTER
carp0: state transition: MASTER - BACKUP
carp1: state transition: MASTER - BACKUP
carp2: state transition: MASTER - BACKUP
carp3: state transition: MASTER - BACKUP
carp3: state transition: BACKUP - MASTER
carp2: state transition: BACKUP - MASTER
carp1: state transition: BACKUP - MASTER
carp0: state transition: BACKUP - MASTER

$ ifconfig
lo0: flags=8049UP,LOOPBACK,RUNNING,MULTICAST mtu 32768
priority: 0
groups: lo
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x6
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff00
vr0: flags=8b43UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST 
mtu 1500