azalia(4) debug

2018-03-20 Thread Michael W. Bombardieri
Hello,

In azalia_set_params_sub() the cmode variable is only used by
DPRINTF() so we can avoid declaring it when debugging is not
enabled.

- Michael


Index: azalia.c
===
RCS file: /cvs/src/sys/dev/pci/azalia.c,v
retrieving revision 1.240
diff -u -p -u -r1.240 azalia.c
--- azalia.c10 Jan 2018 09:00:40 -  1.240
+++ azalia.c21 Mar 2018 04:51:01 -
@@ -3905,14 +3905,11 @@ azalia_match_format(codec_t *codec, int 
 int
 azalia_set_params_sub(codec_t *codec, int mode, audio_params_t *par)
 {
-   char *cmode;
int i, j;
uint ochan, oenc, opre;
-
-   if (mode == AUMODE_PLAY)
-   cmode = "play";
-   else
-   cmode = "record";
+#ifdef AZALIA_DEBUG
+   char *cmode = (mode == AUMODE_PLAY) ? "play" : "record";
+#endif
 
ochan = par->channels;
oenc = par->encoding;



[patch] sys/tmpfs: fix a comment on conditional to unlock dvp

2018-03-20 Thread Tomohiro Kusumi
It's unlocking parent directory vnode because LOCKPARENT is *not* requested.
Also fix a typo for "explicitly".

Index: sys/tmpfs/tmpfs_vnops.c
===
RCS file: /cvs/src/sys/tmpfs/tmpfs_vnops.c,v
retrieving revision 1.27
diff -u -p -r1.27 tmpfs_vnops.c
--- sys/tmpfs/tmpfs_vnops.c 19 Jun 2016 11:54:33 - 1.27
+++ sys/tmpfs/tmpfs_vnops.c 20 Mar 2018 19:07:48 -
@@ -289,7 +289,7 @@ done:
 out:
  /*
  * If (1) we succeded, (2) found a distinct vnode to return and (3) were
- * either explicitely told to keep the parent locked or are in the
+ * either explicitly told not to keep the parent locked or are in the
  * middle of a lookup, unlock the parent vnode.
  */
  if ((error == 0 || error == EJUSTRETURN) && /* (1) */



Re: proctreelk

2018-03-20 Thread Martin Pieuchot
On 26/02/18(Mon) 17:52, Martin Pieuchot wrote:
> On 20/10/17(Fri) 11:50, Martin Pieuchot wrote:
> > On 14/10/17(Sat) 22:07, Philip Guenther wrote:
> > > 
> > > The diff below adds proctreelk, an rwlock protecting the links of the 
> > > process tree and related bits, as well as uidinfolk, an rwlock protecting 
> > > the uidinfo hash table.
> > > 
> > > Parts of this are based on FreeBSD's proctree_lock, particularly the 
> > > reorganization of enterpgrp() into enternewpgrp() and enterthispgrp() and 
> > > the splitting out of killjobc() from exit1().
> > > 
> > > This diff should address the previously reported crashes seen when using 
> > > ktrace(2) while creating/exiting processes.
> > > 
> > > This has been stable for quite a while under my usage; please test and 
> > > report any issues.
> > 
> > First of all, I'm very happy to see this diff.  Thanks Philip.
> > 
> > I have been running this diff on my amd64 NFS client/server build
> > machine since you posted it.  So far no issue, so it is stable for
> > this usage as well.
> > 
> > I'd however appreciate if you could commit the killjobc() and
> > enter*grp() refactoring first.  Because in case of revert this
> > would be less pain.
> 
> I've done that.
> 
> > That's also for this reason that I introduced a macro for the
> > NET_LOCK().  So I could enable/disable it without having to revert
> > N files.  No idea if this could be useful there two.
> > 
> > I like the way you annotate the protected elements in the structure.
> > I'll try to do the same for bpf.
> > 
> > I'm also suggesting you commit the `uidinfolk' bits first.  This seems
> > quite safe.  In this exact part, what about introducing a uid_release(),
> > a wrapper around rw_exit_write(), to be called after uid_find()?
> > This way you can keep the lock local.
> 
> And that too, here's an updated/rebased diff.

Here's an updated diff where I fixed multiple issues reported by visa@.
This is mostly for discussion / backup.  Changes include:

 - Release the `proctreelk' in sys_getsid()'s error path.

 - Document that process_zap() releases the `proctreelk'.

 - Do not hold the `proctreelk' around ttywait() in killjobc()

 - All access to fields marked with [t] in sys/proc.h should now be
   protected or documented with XXXPT.

 - As a result setlogin(2) and getlogin_r(2) are now marked NOLOCK.

The bigger problem is currently csignal() and pgsignal().  Both can be
called from interrupt context.  That means that `pg_members' might have
to be protected differently.

Thoughts?

diff --git sys/kern/exec_elf.c sys/kern/exec_elf.c
index 0a2fc0a9c8a..e371acf1b33 100644
--- sys/kern/exec_elf.c
+++ sys/kern/exec_elf.c
@@ -1168,12 +1168,14 @@ coredump_notes_elf(struct proc *p, void *iocookie, 
size_t *sizep)
cpi.cpi_sigcatch = pr->ps_sigacts->ps_sigcatch;
 
cpi.cpi_pid = pr->ps_pid;
+   rw_enter_read();
cpi.cpi_ppid = pr->ps_pptr->ps_pid;
cpi.cpi_pgrp = pr->ps_pgid;
if (pr->ps_session->s_leader)
cpi.cpi_sid = pr->ps_session->s_leader->ps_pid;
else
cpi.cpi_sid = 0;
+   rw_exit_read();
 
cpi.cpi_ruid = p->p_ucred->cr_ruid;
cpi.cpi_euid = p->p_ucred->cr_uid;
diff --git sys/kern/kern_acct.c sys/kern/kern_acct.c
index 9951a2a2789..78c6fa6a8ac 100644
--- sys/kern/kern_acct.c
+++ sys/kern/kern_acct.c
@@ -206,11 +206,13 @@ acct_process(struct proc *p)
acct.ac_gid = pr->ps_ucred->cr_rgid;
 
/* (7) The terminal from which the process was started */
+   rw_enter_read();
if ((pr->ps_flags & PS_CONTROLT) &&
pr->ps_pgrp->pg_session->s_ttyp)
acct.ac_tty = pr->ps_pgrp->pg_session->s_ttyp->t_dev;
else
acct.ac_tty = NODEV;
+   rw_exit_read();
 
/* (8) The boolean flags that tell how the process terminated, etc. */
acct.ac_flag = pr->ps_acflag;
diff --git sys/kern/kern_exec.c sys/kern/kern_exec.c
index 7aa601f43a3..acb91590e36 100644
--- sys/kern/kern_exec.c
+++ sys/kern/kern_exec.c
@@ -509,9 +509,11 @@ sys_execve(struct proc *p, void *v, register_t *retval)
 
atomic_setbits_int(>ps_flags, PS_EXEC);
if (pr->ps_flags & PS_PPWAIT) {
+   rw_enter_read();
atomic_clearbits_int(>ps_flags, PS_PPWAIT);
atomic_clearbits_int(>ps_pptr->ps_flags, PS_ISPWAIT);
wakeup(pr->ps_pptr);
+   rw_exit_read();
}
 
/*
diff --git sys/kern/kern_exit.c sys/kern/kern_exit.c
index dfd4e38078f..6e90b86c641 100644
--- sys/kern/kern_exit.c
+++ sys/kern/kern_exit.c
@@ -146,6 +146,7 @@ exit1(struct proc *p, int rv, int flags)
 * is set; we wake up the parent early to avoid deadlock.
 */
if (pr->ps_flags & PS_PPWAIT) {
+   /* XXXPT `proctreelk` ? */

umsm(4) supports for SIMCom SIM7600E

2018-03-20 Thread Kevin Lo
Hi,

Attached is a diff for umsm(4) which enables support for the SIMCom SIM7600E.

$ dmesg | grep umsm
umsm0 at uhub0 port 4 configuration 1 interface 0 "SimTech, Incorporated 
SimTech, Incorporated" rev 2.00/3.18 addr 4
ucom0 at umsm0
umsm1 at uhub0 port 4 configuration 1 interface 1 "SimTech, Incorporated 
SimTech, Incorporated" rev 2.00/3.18 addr 4
ucom1 at umsm1
umsm2 at uhub0 port 4 configuration 1 interface 2 "SimTech, Incorporated 
SimTech, Incorporated" rev 2.00/3.18 addr 4
ucom2 at umsm2
umsm3 at uhub0 port 4 configuration 1 interface 3 "SimTech, Incorporated 
SimTech, Incorporated" rev 2.00/3.18 addr 4
ucom3 at umsm3
umsm4 at uhub0 port 4 configuration 1 interface 4 "SimTech, Incorporated 
SimTech, Incorporated" rev 2.00/3.18 addr 4
ucom4 at umsm4
umsm5 at uhub0 port 4 configuration 1 interface 5 "SimTech, Incorporated 
SimTech, Incorporated" rev 2.00/3.18 addr 4
ucom5 at umsm5

$ ifconfig ppp0
ppp0: flags=8051 mtu 1500
index 5 priority 0 llprio 3
groups: ppp egress
inet 10.110.246.100 --> 10.0.0.1 netmask 0xff00

Index: share/man/man4/umsm.4
===
RCS file: /cvs/src/share/man/man4/umsm.4,v
retrieving revision 1.93
diff -u -p -u -p -r1.93 umsm.4
--- share/man/man4/umsm.4   11 Jan 2018 09:26:36 -  1.93
+++ share/man/man4/umsm.4   20 Mar 2018 06:26:17 -
@@ -108,6 +108,7 @@ driver:
 .It Li "Sierra Wireless AirCard 881" Ta "CardBus"
 .It Li "Sierra Wireless AirCard 881U" Ta "USB"
 .It Li "Sierra Wireless Inc. USB 305" Ta "USB"
+.It Li "Simcom SIM7600E" Ta "PCI Express Mini Card"
 .It Li "Softbank C01SW (Sierra OEM)" Ta "USB"
 .It Li "Toshiba 3G HSDPA MiniCard" Ta "PCI Express Mini Card"
 .It Li "Vodafone Mobile Connect 3G" Ta "CardBus"
Index: sys/dev/usb/umsm.c
===
RCS file: /cvs/src/sys/dev/usb/umsm.c,v
retrieving revision 1.110
diff -u -p -u -p -r1.110 umsm.c
--- sys/dev/usb/umsm.c  11 Jan 2018 09:26:36 -  1.110
+++ sys/dev/usb/umsm.c  20 Mar 2018 06:26:19 -
@@ -254,6 +254,8 @@ static const struct umsm_type umsm_devs[
{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD_770S}, 0},
{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC7455}, 0},
 
+   {{ USB_VENDOR_SIMCOM, USB_PRODUCT_SIMCOM_SIM7600E}, 0},
+
{{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS }, DEV_UMASS3},
{{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS_2 }, DEV_UMASS3},
{{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMSM }, 0},
Index: sys/dev/usb/usbdevs
===
RCS file: /cvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.682
diff -u -p -u -p -r1.682 usbdevs
--- sys/dev/usb/usbdevs 9 Mar 2018 08:32:35 -   1.682
+++ sys/dev/usb/usbdevs 20 Mar 2018 06:26:20 -
@@ -606,6 +606,7 @@ vendor PEGATRON 0x1d4d  Pegatron
 vendor OPENMOKO2   0x1d50  OpenMoko
 vendor SELUXIT 0x1d6f  Seluxit
 vendor METAGEEK0x1dd5  MetaGeek
+vendor SIMCOM  0x1e0e  SIMCom Wireless Solutions Co., Ltd.
 vendor FESTO   0x1e29  Festo
 vendor MODACOM 0x1eb8  Modacom
 vendor AIRTIES 0x1eda  AirTies
@@ -3955,6 +3956,9 @@ product SILABS USBCOUNT50 0xf004  USBcoun
 /* Silicon Portals Inc. */
 product SILICONPORTALS YAPPH_NF0x0200  YAP Phone (no firmware)
 product SILICONPORTALS YAPPHONE0x0201  YAP Phone
+
+/* Simcom products */
+product SIMCOM SIM7600E0x9001  SIM7600E modem
 
 /* Sirius Technologies products */
 product SIRIUS ROADSTER0x0001  NetComm Roadster II 56