svn commit: r310494 - head/usr.sbin/syslogd

2016-12-23 Thread Hiroki Sato
Author: hrs
Date: Sat Dec 24 07:13:33 2016
New Revision: 310494
URL: https://svnweb.freebsd.org/changeset/base/310494

Log:
  - Remove unused code.
  - Use closefrom().

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Sat Dec 24 02:31:26 2016
(r310493)
+++ head/usr.sbin/syslogd/syslogd.c Sat Dec 24 07:13:33 2016
(r310494)
@@ -357,7 +357,7 @@ static void usage(void);
 static int validate(struct sockaddr *, const char *);
 static voidunmapped(struct sockaddr *);
 static voidwallmsg(struct filed *, struct iovec *, const int iovlen);
-static int waitdaemon(int, int, int);
+static int waitdaemon(int);
 static voidtimedout(int);
 static voidincrease_rcvbuf(int);
 
@@ -606,7 +606,7 @@ main(int argc, char *argv[])
}
 
if ((!Foreground) && (!Debug)) {
-   ppid = waitdaemon(0, 0, 30);
+   ppid = waitdaemon(30);
if (ppid < 0) {
warn("could not become daemon");
pidfile_remove(pfh);
@@ -2311,7 +2311,7 @@ markit(void)
  * Set a timer so we don't hang forever if it wedges.
  */
 static int
-waitdaemon(int nochdir, int noclose, int maxwait)
+waitdaemon(int maxwait)
 {
int fd;
int status;
@@ -2343,15 +2343,12 @@ waitdaemon(int nochdir, int noclose, int
if (setsid() == -1)
return (-1);
 
-   if (!nochdir)
-   (void)chdir("/");
-
-   if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+   (void)chdir("/");
+   if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
(void)dup2(fd, STDIN_FILENO);
(void)dup2(fd, STDOUT_FILENO);
(void)dup2(fd, STDERR_FILENO);
-   if (fd > 2)
-   (void)close (fd);
+   closefrom(STDERR_FILENO + 1);
}
return (getppid());
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310493 - head/sys/mips/ingenic

2016-12-23 Thread Alexander Kabaev
Author: kan
Date: Sat Dec 24 02:31:26 2016
New Revision: 310493
URL: https://svnweb.freebsd.org/changeset/base/310493

Log:
  Add driver for JZ4780 RTC device.
  
  Only support basic timekeeping for now.

Added:
  head/sys/mips/ingenic/jz4780_rtc.c   (contents, props changed)
Modified:
  head/sys/mips/ingenic/files.jz4780

Modified: head/sys/mips/ingenic/files.jz4780
==
--- head/sys/mips/ingenic/files.jz4780  Sat Dec 24 00:30:29 2016
(r310492)
+++ head/sys/mips/ingenic/files.jz4780  Sat Dec 24 02:31:26 2016
(r310493)
@@ -21,6 +21,7 @@ mips/ingenic/jz4780_machdep.c standard
 mips/ingenic/jz4780_nemc.c standard
 mips/ingenic/jz4780_pdma.c standard
 mips/ingenic/jz4780_pinctrl.c  standard
+mips/ingenic/jz4780_rtc.c  standard
 mips/ingenic/jz4780_timer.cstandard
 
 # Sound

Added: head/sys/mips/ingenic/jz4780_rtc.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/ingenic/jz4780_rtc.c  Sat Dec 24 02:31:26 2016
(r310493)
@@ -0,0 +1,234 @@
+/*-
+ * Copyright 2016 Alexander Kabaev 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Ingenic JZ4780 RTC driver
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include "clock_if.h"
+
+#defineJZ_RTC_TIMEOUT  5000
+
+#define JZ_RTCCR   0x00
+# define JZ_RTCCR_WRDY (1u << 7)
+#define JZ_RTSR0x04
+#define JZ_HSPR0x34
+#define JZ_WENR0x3C
+# define JZ_WENR_PAT   0xa55a
+# define JZ_WENR_WEN   (1u <<31)
+
+struct jz4780_rtc_softc {
+   device_tdev;
+   struct resource *res[2];
+};
+
+static struct resource_spec jz4780_rtc_spec[] = {
+   { SYS_RES_MEMORY, 0, RF_ACTIVE },
+   { SYS_RES_IRQ,0, RF_ACTIVE },
+   { -1, 0 }
+};
+
+#defineCSR_READ(sc, reg)   bus_read_4((sc)->res[0], (reg))
+#defineCSR_WRITE(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val))
+
+static int jz4780_rtc_probe(device_t dev);
+static int jz4780_rtc_attach(device_t dev);
+static int jz4780_rtc_detach(device_t dev);
+
+static int
+jz4780_rtc_probe(device_t dev)
+{
+
+   if (!ofw_bus_status_okay(dev))
+   return (ENXIO);
+
+   if (!ofw_bus_is_compatible(dev, "ingenic,jz4780-rtc"))
+   return (ENXIO);
+
+   device_set_desc(dev, "JZ4780 RTC");
+
+   return (BUS_PROBE_DEFAULT);
+}
+
+/* Poll control register until RTC is ready to accept register writes */
+static int
+jz4780_rtc_wait(struct jz4780_rtc_softc *sc)
+{
+   int timeout;
+
+   timeout = JZ_RTC_TIMEOUT;
+   while (timeout-- > 0) {
+   if (CSR_READ(sc, JZ_RTCCR) & JZ_RTCCR_WRDY)
+   return (0);
+   }
+   return (EIO);
+}
+
+/*
+ * Write RTC register. It appears that RTC goes into read-only mode at random,
+ * which suggests something is up with how it is powered up, so do the pattern
+ * writing dance every time just in case.
+ */
+static int
+jz4780_rtc_write(struct jz4780_rtc_softc *sc, uint32_t reg, uint32_t val)
+{
+   int ret, timeout;
+
+   ret = jz4780_rtc_wait(sc);
+   if (ret != 0)
+   return (ret);
+
+   CSR_WRITE(sc, JZ_WENR, JZ_WENR_PAT);
+
+   ret = jz4780_rtc_wait(sc);
+   if (ret)
+   return ret;
+
+   timeout = JZ_RTC_TIMEOUT;
+   while (timeout-- > 0) {
+   if (CSR_READ(sc, JZ_WENR) & JZ_WENR_WEN)
+ 

svn commit: r310492 - head/sys/dev/spibus

2016-12-23 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat Dec 24 00:30:29 2016
New Revision: 310492
URL: https://svnweb.freebsd.org/changeset/base/310492

Log:
  [spigen] Fix spigen attaching as a driver for SPI devices nodes in FDT
  
  Return BUS_PROBE_NOWILDCARD in probe method to make sure that spigen
  attaches only to the device created in identify method.
  
  Before this change spigen probe method used to return 0 which meant it
  competed with other drivers to be attached to the devices created for
  child nodes of SPI bus node in FDT.
  
  Reported by:  Daniel Braniss
  MFC after:1 week

Modified:
  head/sys/dev/spibus/spigen.c

Modified: head/sys/dev/spibus/spigen.c
==
--- head/sys/dev/spibus/spigen.cFri Dec 23 23:14:53 2016
(r310491)
+++ head/sys/dev/spibus/spigen.cSat Dec 24 00:30:29 2016
(r310492)
@@ -81,8 +81,10 @@ spigen_identify(driver_t *driver, device
 static int
 spigen_probe(device_t dev)
 {
+
device_set_desc(dev, "SPI Generic IO");
-   return (0);
+
+   return (BUS_PROBE_NOWILDCARD);
 }
 
 static int spigen_open(struct cdev *, int, int, struct thread *);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310491 - in head/sys/fs: nfs nfsclient

2016-12-23 Thread Rick Macklem
Author: rmacklem
Date: Fri Dec 23 23:14:53 2016
New Revision: 310491
URL: https://svnweb.freebsd.org/changeset/base/310491

Log:
  Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors.
  
  For most NFSv4.1 servers, a NFS4ERR_BAD_SESSION error is a rare failure
  that indicates that the server has lost session/open/lock state.
  However, recent testing by cperciva@ against the AmazonEFS server found
  several problems with client recovery from this due to it generating this
  failure frequently.
  Briefly, the problems fixed are:
  - If all session slots were in use at the time of the failure, some processes
would continue to loop waiting for a slot on the old session forever.
  - If an RPC that doesn't use open/lock state failed with NFS4ERR_BAD_SESSION,
it would fail the RPC/syscall instead of initiating recovery and then
looping to retry the RPC.
  - If a successful reply to an RPC for an old session wasn't processed
until after a new session was created for a NFS4ERR_BAD_SESSION error,
it would erroneously update the new session and corrupt it.
  - The use of the first element of the session list in the nfs mount
structure (which is always the current metadata session) was slightly
racey. With changes for the above problems it became more racey, so all
uses of this head pointer was wrapped with a NFSLOCKMNT()/NFSUNLOCKMNT().
  - Although the kernel malloc() usually allocates more bytes than requested
and, as such, this wouldn't have caused problems, the allocation of a
session structure was 1 byte smaller than it should have been.
(Null termination byte for the string not included in byte count.)
  
  There are probably still problems with a pNFS data server that fails
  with NFS4ERR_BAD_SESSION, but I have no server that does this to test
  against (the AmazonEFS server doesn't do pNFS), so I can't fix these yet.
  
  Although this patch is fairly large, it should only affect the handling
  of NFS4ERR_BAD_SESSION error replies from an NFSv4.1 server.
  Thanks go to cperciva@ for the extension testing he did to help isolate/fix
  these problems.
  
  Reported by:  cperciva
  Tested by:cperciva
  MFC after:3 months
  Differential Revision:https://reviews.freebsd.org/D8745

Modified:
  head/sys/fs/nfs/nfs.h
  head/sys/fs/nfs/nfs_commonkrpc.c
  head/sys/fs/nfs/nfs_commonport.c
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfs/nfsclstate.h
  head/sys/fs/nfsclient/nfs_clcomsubs.c
  head/sys/fs/nfsclient/nfs_clport.c
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clstate.c
  head/sys/fs/nfsclient/nfs_clvfsops.c
  head/sys/fs/nfsclient/nfsmount.h

Modified: head/sys/fs/nfs/nfs.h
==
--- head/sys/fs/nfs/nfs.h   Fri Dec 23 22:42:14 2016(r310490)
+++ head/sys/fs/nfs/nfs.h   Fri Dec 23 23:14:53 2016(r310491)
@@ -601,6 +601,7 @@ struct nfsrv_descript {
uint8_t nd_sessionid[NFSX_V4SESSIONID]; /* Session id */
uint32_tnd_slotid;  /* Slotid for this RPC */
SVCXPRT *nd_xprt;   /* Server RPC handle */
+   uint32_t*nd_sequence;   /* Sequence Op. ptr */
 };
 
 #definend_princlen nd_gssnamelen
@@ -636,6 +637,7 @@ struct nfsrv_descript {
 #defineND_HASSEQUENCE  0x0400
 #defineND_CACHETHIS0x0800
 #defineND_LASTOP   0x1000
+#defineND_LOOPBADSESS  0x2000
 
 /*
  * ND_GSS should be the "or" of all GSS type authentications.
@@ -649,6 +651,7 @@ struct nfsv4_opflag {
int modifyfs;
int lktype;
int needsseq;
+   int loopbadsess;
 };
 
 /*

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==
--- head/sys/fs/nfs/nfs_commonkrpc.cFri Dec 23 22:42:14 2016
(r310490)
+++ head/sys/fs/nfs/nfs_commonkrpc.cFri Dec 23 23:14:53 2016
(r310491)
@@ -89,6 +89,7 @@ uint32_t  nfscl_nfs4_done_probes[NFSV41_N
 NFSSTATESPINLOCK;
 NFSREQSPINLOCK;
 NFSDLOCKMUTEX;
+NFSCLSTATEMUTEX;
 extern struct nfsstatsv1 nfsstatsv1;
 extern struct nfsreqhead nfsd_reqq;
 extern int nfscl_ticks;
@@ -473,13 +474,13 @@ int
 newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
 struct nfsclient *clp, struct nfssockreq *nrp, vnode_t vp,
 struct thread *td, struct ucred *cred, u_int32_t prog, u_int32_t vers,
-u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *sep)
+u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *dssep)
 {
-   u_int32_t retseq, retval, *tl;
+   uint32_t retseq, retval, slotseq, *tl;
time_t waituntil;
int i = 0, j = 0, opcnt, set_sigset = 0, slot;
int trycnt, error = 0, usegssname = 0, secflavour = AUTH_SYS;
-   int freeslot, timeo;
+   

Re: svn commit: r308789 - head/sys/conf

2016-12-23 Thread Warner Losh
On Fri, Dec 23, 2016 at 11:36 AM, Warner Losh  wrote:
> On Fri, Dec 23, 2016 at 9:35 AM, Ed Maste  wrote:
>> On 17 November 2016 at 19:13, Gleb Smirnoff  wrote:
>>> Author: glebius
>>> Date: Fri Nov 18 00:13:30 2016
>>> New Revision: 308789
>>> URL: https://svnweb.freebsd.org/changeset/base/308789
>>>
>>> Log:
>>>   If FreeBSD source tree is a subproject of a bigger project, then .git or
>>>   .hg may reside above FreeBSD sources root.  Provide function findvcs()
>>>   that will climb up and seek for presence of a VCS directory.
>>
>> This can incorrectly find an unrelated .git directory and provide a
>> git revision unrelated to the FreeBSD source being built. For example,
>> a build from my Subversion tree now reports "FreeBSD 12.0-CURRENT #2
>> ad3f46a(master)" instead of "FreeBSD 12.0-CURRENT #5 r310482M".
>>
>> Can you explain your use case in a little more detail so that I can
>> avoid breaking it with a change here? Do you commit FreeBSD snapshots
>> into the "bigger project"?
>
> This is done at work (Netflix). We import all the FreeBSD revisions
> from github into our repo, and then merge them into the top level
> FreeBSD directory from time to time using git's subtree functionality.
> We also pull in our ports tree this way (so we have a ports directory
> at the same level as our FreeBSD directory). So we don't have a
> $TOPSRC/.git like you would if you'd just cloned directly from github.
> Our .git directory lives in $TOPSRC/.git as a result. newvers.sh
> should find the 'deepest' SCM it can, and use that instead of
> apparently using the topmost (I'm surprised that you have FreeBSD
> under a directory that has a git checkout in it, btw, but I know that
> with my dotfile management repo, that sometimes happens by mistake).
> And if this somehow produces a 'tie', the tie should go to svn.
>
> Looking at how to fix this mess... woof. There's all kinds of crazy
> here. Support for: git, git + svn, hg, p4, svn and svnlite. Sometimes
> $VCS_cmd is defined if it exists at all on the system, other times
> it's only defined if it exists on the system AND we think the tree is
> under $VCS.
>
> But the base of all this woe is that findvcs is called on a per-vcs
> basis, rather than being called early to match one of N VCS
> signatures. It would be better off searching each directory for each
> file rather than finding any file at any level.

After chatting with Ed on IRC, I've posted this review.

https://reviews.freebsd.org/D8895

which should fix the issues.

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310490 - in stable: 10/contrib/amd 10/contrib/amd/amd 10/contrib/amd/amq 10/contrib/amd/conf/checkmount 10/contrib/amd/conf/mtab 10/contrib/amd/conf/nfs_prot 10/contrib/amd/conf/transp...

2016-12-23 Thread Cy Schubert
Author: cy
Date: Fri Dec 23 22:42:14 2016
New Revision: 310490
URL: https://svnweb.freebsd.org/changeset/base/310490

Log:
  MFC r308493, r308619: Update amd from am-utils 6.1.5 to 6.2.
  
  Used extensively on my network over the past ten weeks.
  
  Reviewed by:pfg, brooks
  Suggested by:   pfg
  Obtained from:  ftp://ftp.am-utils.org/pub/am-utils/
  Relnotes:   yes
  Differential Revision:  D8405

Added:
  stable/10/contrib/amd/amd/info_sun.c
 - copied unchanged from r308493, head/contrib/amd/amd/info_sun.c
  stable/10/contrib/amd/amd/ops_ext.c
 - copied unchanged from r308493, head/contrib/amd/amd/ops_ext.c
  stable/10/contrib/amd/amd/ops_lustre.c
 - copied unchanged from r308493, head/contrib/amd/amd/ops_lustre.c
  stable/10/contrib/amd/amd/ops_nfs4.c
 - copied unchanged from r308493, head/contrib/amd/amd/ops_nfs4.c
  stable/10/contrib/amd/amd/ops_udf.c
 - copied unchanged from r308493, head/contrib/amd/amd/ops_udf.c
  stable/10/contrib/amd/amd/sun2amd.8
 - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.8
  stable/10/contrib/amd/amd/sun2amd.c
 - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.c
  stable/10/contrib/amd/amd/sun_map.c
 - copied unchanged from r308493, head/contrib/amd/amd/sun_map.c
  stable/10/contrib/amd/amd/sun_map.h
 - copied unchanged from r308493, head/contrib/amd/amd/sun_map.h
  stable/10/contrib/amd/amd/sun_map_parse.y
 - copied unchanged from r308493, head/contrib/amd/amd/sun_map_parse.y
  stable/10/contrib/amd/amd/sun_map_tok.l
 - copied unchanged from r308493, head/contrib/amd/amd/sun_map_tok.l
  stable/10/contrib/amd/amd/test1.sh
 - copied unchanged from r308493, head/contrib/amd/amd/test1.sh
  stable/10/contrib/amd/fsinfo/null_gram.c
 - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.c
  stable/10/contrib/amd/fsinfo/null_gram.h
 - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.h
  stable/10/contrib/amd/fsinfo/null_gram.y
 - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.y
  stable/10/contrib/amd/fsinfo/null_lex.c
 - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.c
  stable/10/contrib/amd/fsinfo/null_lex.l
 - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.l
  stable/10/contrib/amd/include/nfs_common.h
 - copied unchanged from r308493, head/contrib/amd/include/nfs_common.h
Modified:
  stable/10/contrib/amd/AUTHORS
  stable/10/contrib/amd/BUGS
  stable/10/contrib/amd/COPYING
  stable/10/contrib/amd/ChangeLog
  stable/10/contrib/amd/FAQ
  stable/10/contrib/amd/INSTALL
  stable/10/contrib/amd/MIRRORS.html
  stable/10/contrib/amd/MIRRORS.txt
  stable/10/contrib/amd/NEWS
  stable/10/contrib/amd/README
  stable/10/contrib/amd/README.attrcache
  stable/10/contrib/amd/README.ldap
  stable/10/contrib/amd/README.y2k
  stable/10/contrib/amd/amd/am_ops.c
  stable/10/contrib/amd/amd/amd.8
  stable/10/contrib/amd/amd/amd.c
  stable/10/contrib/amd/amd/amd.h
  stable/10/contrib/amd/amd/amfs_auto.c
  stable/10/contrib/amd/amd/amfs_direct.c
  stable/10/contrib/amd/amd/amfs_error.c
  stable/10/contrib/amd/amd/amfs_generic.c
  stable/10/contrib/amd/amd/amfs_host.c
  stable/10/contrib/amd/amd/amfs_link.c
  stable/10/contrib/amd/amd/amfs_linkx.c
  stable/10/contrib/amd/amd/amfs_nfsl.c
  stable/10/contrib/amd/amd/amfs_nfsx.c
  stable/10/contrib/amd/amd/amfs_program.c
  stable/10/contrib/amd/amd/amfs_root.c
  stable/10/contrib/amd/amd/amfs_toplvl.c
  stable/10/contrib/amd/amd/amfs_union.c
  stable/10/contrib/amd/amd/amq_subr.c
  stable/10/contrib/amd/amd/amq_svc.c
  stable/10/contrib/amd/amd/autil.c
  stable/10/contrib/amd/amd/clock.c
  stable/10/contrib/amd/amd/conf.c
  stable/10/contrib/amd/amd/conf_parse.y
  stable/10/contrib/amd/amd/conf_tok.l
  stable/10/contrib/amd/amd/get_args.c
  stable/10/contrib/amd/amd/info_exec.c
  stable/10/contrib/amd/amd/info_file.c
  stable/10/contrib/amd/amd/info_hesiod.c
  stable/10/contrib/amd/amd/info_ldap.c
  stable/10/contrib/amd/amd/info_ndbm.c
  stable/10/contrib/amd/amd/info_nis.c
  stable/10/contrib/amd/amd/info_nisplus.c
  stable/10/contrib/amd/amd/info_passwd.c
  stable/10/contrib/amd/amd/info_union.c
  stable/10/contrib/amd/amd/map.c
  stable/10/contrib/amd/amd/mapc.c
  stable/10/contrib/amd/amd/mntfs.c
  stable/10/contrib/amd/amd/nfs_prot_svc.c
  stable/10/contrib/amd/amd/nfs_start.c
  stable/10/contrib/amd/amd/nfs_subr.c
  stable/10/contrib/amd/amd/ops_TEMPLATE.c
  stable/10/contrib/amd/amd/ops_cachefs.c
  stable/10/contrib/amd/amd/ops_cdfs.c
  stable/10/contrib/amd/amd/ops_efs.c
  stable/10/contrib/amd/amd/ops_lofs.c
  stable/10/contrib/amd/amd/ops_mfs.c
  stable/10/contrib/amd/amd/ops_nfs.c
  stable/10/contrib/amd/amd/ops_nfs3.c
  stable/10/contrib/amd/amd/ops_nullfs.c
  stable/10/contrib/amd/amd/ops_pcfs.c
  stable/10/contrib/amd/amd/ops_tfs.c
  stable/10/contrib/amd/amd/ops_tmpfs.c
  stable/10/contrib/amd/amd/ops_ufs.c
  stable/10/contrib/amd/amd/ops_umapfs.c
  

svn commit: r310490 - in stable: 10/contrib/amd 10/contrib/amd/amd 10/contrib/amd/amq 10/contrib/amd/conf/checkmount 10/contrib/amd/conf/mtab 10/contrib/amd/conf/nfs_prot 10/contrib/amd/conf/transp...

2016-12-23 Thread Cy Schubert
Author: cy
Date: Fri Dec 23 22:42:14 2016
New Revision: 310490
URL: https://svnweb.freebsd.org/changeset/base/310490

Log:
  MFC r308493, r308619: Update amd from am-utils 6.1.5 to 6.2.
  
  Used extensively on my network over the past ten weeks.
  
  Reviewed by:pfg, brooks
  Suggested by:   pfg
  Obtained from:  ftp://ftp.am-utils.org/pub/am-utils/
  Relnotes:   yes
  Differential Revision:  D8405

Added:
  stable/11/contrib/amd/amd/info_sun.c
 - copied unchanged from r308493, head/contrib/amd/amd/info_sun.c
  stable/11/contrib/amd/amd/ops_ext.c
 - copied unchanged from r308493, head/contrib/amd/amd/ops_ext.c
  stable/11/contrib/amd/amd/ops_lustre.c
 - copied unchanged from r308493, head/contrib/amd/amd/ops_lustre.c
  stable/11/contrib/amd/amd/ops_nfs4.c
 - copied unchanged from r308493, head/contrib/amd/amd/ops_nfs4.c
  stable/11/contrib/amd/amd/ops_udf.c
 - copied unchanged from r308493, head/contrib/amd/amd/ops_udf.c
  stable/11/contrib/amd/amd/sun2amd.8
 - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.8
  stable/11/contrib/amd/amd/sun2amd.c
 - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.c
  stable/11/contrib/amd/amd/sun_map.c
 - copied unchanged from r308493, head/contrib/amd/amd/sun_map.c
  stable/11/contrib/amd/amd/sun_map.h
 - copied unchanged from r308493, head/contrib/amd/amd/sun_map.h
  stable/11/contrib/amd/amd/sun_map_parse.y
 - copied unchanged from r308493, head/contrib/amd/amd/sun_map_parse.y
  stable/11/contrib/amd/amd/sun_map_tok.l
 - copied unchanged from r308493, head/contrib/amd/amd/sun_map_tok.l
  stable/11/contrib/amd/amd/test1.sh
 - copied unchanged from r308493, head/contrib/amd/amd/test1.sh
  stable/11/contrib/amd/fsinfo/null_gram.c
 - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.c
  stable/11/contrib/amd/fsinfo/null_gram.h
 - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.h
  stable/11/contrib/amd/fsinfo/null_gram.y
 - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.y
  stable/11/contrib/amd/fsinfo/null_lex.c
 - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.c
  stable/11/contrib/amd/fsinfo/null_lex.l
 - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.l
  stable/11/contrib/amd/include/nfs_common.h
 - copied unchanged from r308493, head/contrib/amd/include/nfs_common.h
Modified:
  stable/11/contrib/amd/AUTHORS
  stable/11/contrib/amd/BUGS
  stable/11/contrib/amd/COPYING
  stable/11/contrib/amd/ChangeLog
  stable/11/contrib/amd/FAQ
  stable/11/contrib/amd/INSTALL
  stable/11/contrib/amd/MIRRORS.html
  stable/11/contrib/amd/MIRRORS.txt
  stable/11/contrib/amd/NEWS
  stable/11/contrib/amd/README
  stable/11/contrib/amd/README.attrcache
  stable/11/contrib/amd/README.ldap
  stable/11/contrib/amd/README.y2k
  stable/11/contrib/amd/amd/am_ops.c
  stable/11/contrib/amd/amd/amd.8
  stable/11/contrib/amd/amd/amd.c
  stable/11/contrib/amd/amd/amd.h
  stable/11/contrib/amd/amd/amfs_auto.c
  stable/11/contrib/amd/amd/amfs_direct.c
  stable/11/contrib/amd/amd/amfs_error.c
  stable/11/contrib/amd/amd/amfs_generic.c
  stable/11/contrib/amd/amd/amfs_host.c
  stable/11/contrib/amd/amd/amfs_link.c
  stable/11/contrib/amd/amd/amfs_linkx.c
  stable/11/contrib/amd/amd/amfs_nfsl.c
  stable/11/contrib/amd/amd/amfs_nfsx.c
  stable/11/contrib/amd/amd/amfs_program.c
  stable/11/contrib/amd/amd/amfs_root.c
  stable/11/contrib/amd/amd/amfs_toplvl.c
  stable/11/contrib/amd/amd/amfs_union.c
  stable/11/contrib/amd/amd/amq_subr.c
  stable/11/contrib/amd/amd/amq_svc.c
  stable/11/contrib/amd/amd/autil.c
  stable/11/contrib/amd/amd/clock.c
  stable/11/contrib/amd/amd/conf.c
  stable/11/contrib/amd/amd/conf_parse.y
  stable/11/contrib/amd/amd/conf_tok.l
  stable/11/contrib/amd/amd/get_args.c
  stable/11/contrib/amd/amd/info_exec.c
  stable/11/contrib/amd/amd/info_file.c
  stable/11/contrib/amd/amd/info_hesiod.c
  stable/11/contrib/amd/amd/info_ldap.c
  stable/11/contrib/amd/amd/info_ndbm.c
  stable/11/contrib/amd/amd/info_nis.c
  stable/11/contrib/amd/amd/info_nisplus.c
  stable/11/contrib/amd/amd/info_passwd.c
  stable/11/contrib/amd/amd/info_union.c
  stable/11/contrib/amd/amd/map.c
  stable/11/contrib/amd/amd/mapc.c
  stable/11/contrib/amd/amd/mntfs.c
  stable/11/contrib/amd/amd/nfs_prot_svc.c
  stable/11/contrib/amd/amd/nfs_start.c
  stable/11/contrib/amd/amd/nfs_subr.c
  stable/11/contrib/amd/amd/ops_TEMPLATE.c
  stable/11/contrib/amd/amd/ops_cachefs.c
  stable/11/contrib/amd/amd/ops_cdfs.c
  stable/11/contrib/amd/amd/ops_efs.c
  stable/11/contrib/amd/amd/ops_lofs.c
  stable/11/contrib/amd/amd/ops_mfs.c
  stable/11/contrib/amd/amd/ops_nfs.c
  stable/11/contrib/amd/amd/ops_nfs3.c
  stable/11/contrib/amd/amd/ops_nullfs.c
  stable/11/contrib/amd/amd/ops_pcfs.c
  stable/11/contrib/amd/amd/ops_tfs.c
  stable/11/contrib/amd/amd/ops_tmpfs.c
  stable/11/contrib/amd/amd/ops_ufs.c
  stable/11/contrib/amd/amd/ops_umapfs.c
  

svn commit: r310489 - head/sys/cam/scsi

2016-12-23 Thread Alexander Motin
Author: mav
Date: Fri Dec 23 21:56:08 2016
New Revision: 310489
URL: https://svnweb.freebsd.org/changeset/base/310489

Log:
  Implement printing forwarded sense data.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/scsi/scsi_all.c
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/scsi/scsi_all.c
==
--- head/sys/cam/scsi/scsi_all.cFri Dec 23 20:14:05 2016
(r310488)
+++ head/sys/cam/scsi/scsi_all.cFri Dec 23 21:56:08 2016
(r310489)
@@ -4711,6 +4711,26 @@ scsi_sense_ata_sbuf(struct sbuf *sb, str
sbuf_printf(sb, "device: %02x, ", res->device);
 }
 
+void
+scsi_sense_forwarded_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,
+u_int sense_len, uint8_t *cdb, int cdb_len,
+struct scsi_inquiry_data *inq_data,
+struct scsi_sense_desc_header *header)
+{
+   struct scsi_sense_forwarded *forwarded;
+   const char *sense_key_desc;
+   const char *asc_desc;
+   int error_code, sense_key, asc, ascq;
+
+   forwarded = (struct scsi_sense_forwarded *)header;
+   scsi_extract_sense_len((struct scsi_sense_data *)forwarded->sense_data,
+   forwarded->length - 2, _code, _key, , , 1);
+   scsi_sense_desc(sense_key, asc, ascq, NULL, _key_desc, _desc);
+
+   sbuf_printf(sb, "Forwarded sense: %s asc:%x,%x (%s): ",
+   sense_key_desc, asc, ascq, asc_desc);
+}
+
 /*
  * Generic sense descriptor printing routine.  This is used when we have
  * not yet implemented a specific printing routine for this descriptor.
@@ -4758,7 +4778,8 @@ struct scsi_sense_desc_printer {
{SSD_DESC_STREAM, scsi_sense_stream_sbuf},
{SSD_DESC_BLOCK, scsi_sense_block_sbuf},
{SSD_DESC_ATA, scsi_sense_ata_sbuf},
-   {SSD_DESC_PROGRESS, scsi_sense_progress_sbuf}
+   {SSD_DESC_PROGRESS, scsi_sense_progress_sbuf},
+   {SSD_DESC_FORWARDED, scsi_sense_forwarded_sbuf}
 };
 
 void

Modified: head/sys/cam/scsi/scsi_all.h
==
--- head/sys/cam/scsi/scsi_all.hFri Dec 23 20:14:05 2016
(r310488)
+++ head/sys/cam/scsi/scsi_all.hFri Dec 23 21:56:08 2016
(r310489)
@@ -3532,6 +3532,8 @@ struct scsi_sense_forwarded
 #defineSSD_FORWARDED_SDS_UNK   0x00
 #defineSSD_FORWARDED_SDS_EXSRC 0x01
 #defineSSD_FORWARDED_SDS_EXDST 0x02
+   uint8_t status;
+   uint8_t sense_data[];
 };
 
 /*
@@ -3764,6 +3766,10 @@ void scsi_sense_ata_sbuf(struct sbuf *sb
 u_int sense_len, uint8_t *cdb, int cdb_len,
 struct scsi_inquiry_data *inq_data,
 struct scsi_sense_desc_header *header);
+void scsi_sense_forwarded_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,
+ u_int sense_len, uint8_t *cdb, int cdb_len,
+ struct scsi_inquiry_data *inq_data,
+ struct scsi_sense_desc_header *header);
 void scsi_sense_generic_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,
 u_int sense_len, uint8_t *cdb, int cdb_len,
 struct scsi_inquiry_data *inq_data,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310445 - in head/sys/mips: include mips

2016-12-23 Thread Adrian Chadd
That's a ... deeep stack. :( How big is each stackframe?


-adrian


On 22 December 2016 at 19:49, John Baldwin  wrote:
> On Friday, December 23, 2016 03:27:11 AM John Baldwin wrote:
>> Author: jhb
>> Date: Fri Dec 23 03:27:11 2016
>> New Revision: 310445
>> URL: https://svnweb.freebsd.org/changeset/base/310445
>>
>> Log:
>>   Teach DDB how to unwind across a kernel stack overflow.
>>
>>   Kernel stack overflows in MIPS call panic() directly from an assembly
>>   handler after storing the interrupted context's registers in a
>>   trapframe.  Rather than inferring the location of ra, sp, and pc from
>>   the instruction stream, recognize the pc of a kernel stack overflow
>>   and pull the registers from the trapframe.
>>
>>   Sponsored by:   DARPA / AFRL
>
> We should possibly use this same logic for other subroutines that use
> trapframes.  Trying to run a program that core dumps over NFS in my
> qemu mips64 machine triggers the stack overflow on a kernel built with
> gcc5.3 from ports.  The DDB stack trace doesn't get very far:
>
> panic: kernel stack overflow - trapframe at 0x80699eb0
> KDB: stack backtrace:
> db_trace_self+1c (?,?,?,?) ra 801620d8 sp 80699ac0 sz 16
> 801620ac+2c (?,?,?,?) ra 80357788 sp 80699ad0 sz 800
> 80357744+44 (?,?,?,?) ra 80304ff4 sp 80699df0 sz 16
> vpanic+f4 (?,?,?,?) ra 80305d84 sp 80699e00 sz 48
> panic+30 (?,80699eb0,ffec,802c901c) ra 
> 805388bc sp 80699e30 sz 96
> MipsTLBInvalidException+360 (?,?,?,?) ra 0 sp 80699e90 sz 0
> --- Kernel Stack Overflow ---
> 802c9018+4 (?,?,?,?) ra 805544e4 sp c0002a5b5fa0 sz 96
> 80554400+e4 (?,?,?,?) ra 802c90f4 sp c0002a5b6000 sz 48
> 802c9018+dc (?,?,?,?) ra 805563dc sp c0002a5b6030 sz 96
> cpu_intr+248 (?,?,?,?) ra 80538110 sp c0002a5b6090 sz 80
> MipsKernIntr+188 (?,?,?,?) ra 0 sp c0002a5b60e0 sz 368
> pid 607
> KDB: enter: panic
>
> (In particular, we probably should be using the trapframe logic employed
> here for MipsKernIntr.)
>
> I've patched kgdb to add a MIPS kernel target and taught it how to handle
> trapframes, etc. (and it can cross-debug, so I used an amd64 host to examine
> the dump) and it gives a more useful stack trace.  Unfortunately, increasing
> the kstack size on MIPS as a workaround for this issue seems to be very
> hard as the code in cpu_switch() hard codes exactly two TLB entries to cover
> the kernel stack and PCB to avoid TLB faults during a context switch.  I think
> if you create a kthread with a non-default kstack size on MIPS it's probably
> a ticking time bomb in that you might get a TLB miss when accessing the pcb.
>
> savectx () at /usr/home/john/work/git/freebsd/sys/mips/mips/swtch.S:171
> 171 SAVE_U_PCB_CONTEXT(ra, PCB_REG_PC, a0)
> (kgdb) where
> #0  savectx () at /usr/home/john/work/git/freebsd/sys/mips/mips/swtch.S:171
> #1  0x80304dfc in doadump (textdump=textdump@entry=0)
> at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:297
> #2  0x8015d868 in db_dump (dummy=,
> dummy2=, dummy3=, dummy4=)
> at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:546
> #3  0x8015e474 in db_command (
> last_cmdp=last_cmdp@entry=0x8069e778 ,
> cmd_table=,
> cmd_table@entry=0x8069e730 , 
> dopager=dopager@entry=1)
> at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:453
> #4  0x8015eab8 in db_command_loop ()
> at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:506
> #5  0x80162040 in db_trap (type=, code=)
> at /usr/home/john/work/git/freebsd/sys/ddb/db_main.c:248
> #6  0x803583e8 in kdb_trap (type=type@entry=9, code=code@entry=0,
> tf=tf@entry=0x80699ca0 )
> at /usr/home/john/work/git/freebsd/sys/kern/subr_kdb.c:654
> #7  0x8054ba10 in trap (trapframe=0x80699ca0 
> )
> at /usr/home/john/work/git/freebsd/sys/mips/mips/trap.c:828
> #8  
> #9  kdb_enter (why=0x805b6138 "panic", msg=)
> at /usr/home/john/work/git/freebsd/sys/kern/subr_kdb.c:444
> #10 0x8030503c in vpanic (fmt=,
> ap=ap@entry=0x80699e58 )
> at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:752
> ---Type  to continue, or q  to quit---
> #11 0x80305d84 in panic (fmt=)
> at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:690
> #12 
> #13 0x802c901c in intr_event_handle (ie=0x98a42400,
> frame=frame@entry=0x0)
> at /usr/home/john/work/git/freebsd/sys/kern/kern_intr.c:1397
> #14 0x805544e4 in gt_pci_intr (v=0x98ab0800)
> at /usr/home/john/work/git/freebsd/sys/mips/malta/gt_pci.c:236
> #15 0x802c90f4 in intr_event_handle (ie=0x98a43900,
> frame=frame@entry=0xc0002a5b6100)
>   

svn commit: r310488 - in head/sys/dev/mlx4: mlx4_core mlx4_ib

2016-12-23 Thread Ed Maste
Author: emaste
Date: Fri Dec 23 20:14:05 2016
New Revision: 310488
URL: https://svnweb.freebsd.org/changeset/base/310488

Log:
  mlx(4): remove date from log message
  
  Further to r310425, go one step further and just remove the date.
  
  Reviewed by:  hselasky
  Differential Revision:https://reviews.freebsd.org/D

Modified:
  head/sys/dev/mlx4/mlx4_core/mlx4.h
  head/sys/dev/mlx4/mlx4_core/mlx4_main.c
  head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c

Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h
==
--- head/sys/dev/mlx4/mlx4_core/mlx4.h  Fri Dec 23 19:42:17 2016
(r310487)
+++ head/sys/dev/mlx4/mlx4_core/mlx4.h  Fri Dec 23 20:14:05 2016
(r310488)
@@ -52,7 +52,6 @@
 #define DRV_NAME   "mlx4_core"
 #define PFXDRV_NAME ": "
 #define DRV_VERSION"2.1.6"
-#define DRV_RELDATE"Sep 30 2016"
 
 #define DRV_STACK_NAME "Linux-MLNX_OFED"
 #define DRV_STACK_VERSION  "2.1"

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Fri Dec 23 19:42:17 2016
(r310487)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Fri Dec 23 20:14:05 2016
(r310488)
@@ -174,7 +174,7 @@ MODULE_PARM_DESC(enable_64b_cqe_eqe,
 
 static char mlx4_version[] __devinitdata =
DRV_NAME ": Mellanox ConnectX VPI driver v"
-   DRV_VERSION " (" DRV_RELDATE ")\n";
+   DRV_VERSION "\n";
 
 static int log_num_mac = 7;
 module_param_named(log_num_mac, log_num_mac, int, 0444);

Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
==
--- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cFri Dec 23 19:42:17 2016
(r310487)
+++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cFri Dec 23 20:14:05 2016
(r310488)
@@ -59,7 +59,6 @@
 
 #define DRV_NAME   MLX4_IB_DRV_NAME
 #define DRV_VERSION"1.0"
-#define DRV_RELDATE"Sep 30 2016"
 
 #define MLX4_IB_DRIVER_PROC_DIR_NAME "driver/mlx4_ib"
 #define MLX4_IB_MRS_PROC_DIR_NAME "mrs"
@@ -102,7 +101,7 @@ static spinlock_t dev_num_str_lock;
 
 static const char mlx4_ib_version[] =
DRV_NAME ": Mellanox ConnectX InfiniBand driver v"
-   DRV_VERSION " (" DRV_RELDATE ")\n";
+   DRV_VERSION "\n";
 
 struct update_gid_work {
struct work_struct  work;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310487 - in stable: 10/sys/dev/acpica 11/sys/dev/acpica

2016-12-23 Thread John Baldwin
Author: jhb
Date: Fri Dec 23 19:42:17 2016
New Revision: 310487
URL: https://svnweb.freebsd.org/changeset/base/310487

Log:
  MFC 309588: Don't attach to Host-PCI bridges with a bad bus number.
  
  If the bus number assigned to a Host-PCI bridge doesn't match the first
  bus number in the associated producer range from _CRS, print a warning and
  fail to attach rather than panicking due to an assertion failure.
  
  At least one single-socket Dell machine leaves a "ghost" Host-PCI bridge
  device in the ACPI namespace that seems to correspond to the I/O hub in
  the second socket of a two-socket machine.  However, the BIOS doesn't
  configure the settings for this "ghost" bridge correctly, nor does it have
  any PCI devices behind it.

Modified:
  stable/10/sys/dev/acpica/acpi_pcib_acpi.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/acpica/acpi_pcib_acpi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/sys/dev/acpica/acpi_pcib_acpi.c
==
--- stable/10/sys/dev/acpica/acpi_pcib_acpi.c   Fri Dec 23 19:30:14 2016
(r310486)
+++ stable/10/sys/dev/acpica/acpi_pcib_acpi.c   Fri Dec 23 19:42:17 2016
(r310487)
@@ -480,10 +480,17 @@ acpi_pcib_acpi_attach(device_t dev)
pci_domain_release_bus(sc->ap_segment, dev, rid, bus_res);
}
 } else {
-#ifdef INVARIANTS
-   if (first_decoded_bus(sc, ) == 0)
-   KASSERT(start == sc->ap_bus, ("bus number mismatch"));
-#endif
+   /*
+* Require the bus number from _BBN to match the start of any
+* decoded range.
+*/
+   if (first_decoded_bus(sc, ) == 0 && sc->ap_bus != start) {
+   device_printf(dev,
+   "bus number %d does not match start of decoded range %ju\n",
+   sc->ap_bus, (uintmax_t)start);
+   pcib_host_res_free(dev, >ap_host_res);
+   return (ENXIO);
+   }
 }
 #else
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310487 - in stable: 10/sys/dev/acpica 11/sys/dev/acpica

2016-12-23 Thread John Baldwin
Author: jhb
Date: Fri Dec 23 19:42:17 2016
New Revision: 310487
URL: https://svnweb.freebsd.org/changeset/base/310487

Log:
  MFC 309588: Don't attach to Host-PCI bridges with a bad bus number.
  
  If the bus number assigned to a Host-PCI bridge doesn't match the first
  bus number in the associated producer range from _CRS, print a warning and
  fail to attach rather than panicking due to an assertion failure.
  
  At least one single-socket Dell machine leaves a "ghost" Host-PCI bridge
  device in the ACPI namespace that seems to correspond to the I/O hub in
  the second socket of a two-socket machine.  However, the BIOS doesn't
  configure the settings for this "ghost" bridge correctly, nor does it have
  any PCI devices behind it.

Modified:
  stable/11/sys/dev/acpica/acpi_pcib_acpi.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/dev/acpica/acpi_pcib_acpi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/11/sys/dev/acpica/acpi_pcib_acpi.c
==
--- stable/11/sys/dev/acpica/acpi_pcib_acpi.c   Fri Dec 23 19:30:14 2016
(r310486)
+++ stable/11/sys/dev/acpica/acpi_pcib_acpi.c   Fri Dec 23 19:42:17 2016
(r310487)
@@ -488,10 +488,17 @@ acpi_pcib_acpi_attach(device_t dev)
pci_domain_release_bus(sc->ap_segment, dev, rid, bus_res);
}
 } else {
-#ifdef INVARIANTS
-   if (first_decoded_bus(sc, ) == 0)
-   KASSERT(start == sc->ap_bus, ("bus number mismatch"));
-#endif
+   /*
+* Require the bus number from _BBN to match the start of any
+* decoded range.
+*/
+   if (first_decoded_bus(sc, ) == 0 && sc->ap_bus != start) {
+   device_printf(dev,
+   "bus number %d does not match start of decoded range %ju\n",
+   sc->ap_bus, (uintmax_t)start);
+   pcib_host_res_free(dev, >ap_host_res);
+   return (ENXIO);
+   }
 }
 #else
 /*
@@ -514,6 +521,9 @@ acpi_pcib_acpi_attach(device_t dev)
 
 if (device_add_child(dev, "pci", -1) == NULL) {
device_printf(device_get_parent(dev), "couldn't attach pci bus\n");
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   pcib_host_res_free(dev, >ap_host_res);
+#endif
return (ENXIO);
 }
 return (bus_generic_attach(dev));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310486 - head/sys/mips/ingenic

2016-12-23 Thread Alexander Kabaev
Author: kan
Date: Fri Dec 23 19:30:14 2016
New Revision: 310486
URL: https://svnweb.freebsd.org/changeset/base/310486

Log:
  Pass memattrs to fb device so that user mappings can inherit them
  
  Reviewed by:  jmcneill

Modified:
  head/sys/mips/ingenic/jz4780_lcd.c

Modified: head/sys/mips/ingenic/jz4780_lcd.c
==
--- head/sys/mips/ingenic/jz4780_lcd.c  Fri Dec 23 19:28:15 2016
(r310485)
+++ head/sys/mips/ingenic/jz4780_lcd.c  Fri Dec 23 19:30:14 2016
(r310486)
@@ -306,7 +306,10 @@ jzlcd_configure(struct jzlcd_softc *sc, 
sc->info.fb_stride = mode->hdisplay * (FB_BPP / NBBY);
sc->info.fb_width = mode->hdisplay;
sc->info.fb_height = mode->vdisplay;
-
+#ifdef VM_MEMATTR_WRITE_COMBINING
+   sc->info.fb_flags = FB_FLAG_MEMATTR;
+   sc->info.fb_memattr = VM_MEMATTR_WRITE_COMBINING;
+#endif
sc->fbdev = device_add_child(sc->dev, "fbd", device_get_unit(sc->dev));
if (sc->fbdev == NULL) {
device_printf(sc->dev, "failed to add fbd child\n");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310485 - in stable: 10/sys/amd64/amd64 10/sys/i386/i386 11/sys/amd64/amd64 11/sys/i386/i386

2016-12-23 Thread John Baldwin
Author: jhb
Date: Fri Dec 23 19:28:15 2016
New Revision: 310485
URL: https://svnweb.freebsd.org/changeset/base/310485

Log:
  MFC 308820,308821: Fixes for fatal page faults on x86.
  
  308820:
  Report page faults due to reserved bits in PTEs as a separate fault type.
  
  Rather than reporting a page fault due to a bad PTE as a protection
  violation with the "rsv" flag, treat these faults as a separate type of
  fault altogether.
  
  308821:
  MFamd64: Various fatal page fault fixes.
  
  - If a page fault is triggered due to reserved bits in a PTE, treat it
as a fatal fault and panic.
  - If PG_NX is in use, report whether a fatal page fault is due to an
instruction fetch or a data access.
  - If a fatal page fault is due to reserved bits in a PTE, report that as
the page fault type rather than a protection violation.

Modified:
  stable/10/sys/amd64/amd64/trap.c
  stable/10/sys/i386/i386/trap.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/amd64/amd64/trap.c
  stable/11/sys/i386/i386/trap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/sys/amd64/amd64/trap.c
==
--- stable/10/sys/amd64/amd64/trap.cFri Dec 23 18:29:10 2016
(r310484)
+++ stable/10/sys/amd64/amd64/trap.cFri Dec 23 19:28:15 2016
(r310485)
@@ -812,11 +812,11 @@ trap_fatal(frame, eva)
 #endif
if (type == T_PAGEFLT) {
printf("fault virtual address   = 0x%lx\n", eva);
-   printf("fault code  = %s %s %s%s, %s\n",
+   printf("fault code  = %s %s %s, %s\n",
code & PGEX_U ? "user" : "supervisor",
code & PGEX_W ? "write" : "read",
code & PGEX_I ? "instruction" : "data",
-   code & PGEX_RSV ? " rsv" : "",
+   code & PGEX_RSV ? "reserved bits in PTE" :
code & PGEX_P ? "protection violation" : "page not 
present");
}
printf("instruction pointer = 0x%lx:0x%lx\n",

Modified: stable/10/sys/i386/i386/trap.c
==
--- stable/10/sys/i386/i386/trap.c  Fri Dec 23 18:29:10 2016
(r310484)
+++ stable/10/sys/i386/i386/trap.c  Fri Dec 23 19:28:15 2016
(r310485)
@@ -879,6 +879,14 @@ trap_pfault(frame, usermode, eva)
}
 
/*
+* If the trap was caused by errant bits in the PTE then panic.
+*/
+   if (frame->tf_err & PGEX_RSV) {
+   trap_fatal(frame, eva);
+   return (-1);
+   }
+
+   /*
 * PGEX_I is defined only if the execute disable bit capability is
 * supported and enabled.
 */
@@ -968,9 +976,15 @@ trap_fatal(frame, eva)
 #endif
if (type == T_PAGEFLT) {
printf("fault virtual address   = 0x%x\n", eva);
-   printf("fault code  = %s %s, %s\n",
+   printf("fault code  = %s %s%s, %s\n",
code & PGEX_U ? "user" : "supervisor",
code & PGEX_W ? "write" : "read",
+#if defined(PAE) || defined(PAE_TABLES)
+   pg_nx != 0 ?
+   (code & PGEX_I ? " instruction" : " data") :
+#endif
+   "",
+   code & PGEX_RSV ? "reserved bits in PTE" :
code & PGEX_P ? "protection violation" : "page not 
present");
}
printf("instruction pointer = 0x%x:0x%x\n",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310485 - in stable: 10/sys/amd64/amd64 10/sys/i386/i386 11/sys/amd64/amd64 11/sys/i386/i386

2016-12-23 Thread John Baldwin
Author: jhb
Date: Fri Dec 23 19:28:15 2016
New Revision: 310485
URL: https://svnweb.freebsd.org/changeset/base/310485

Log:
  MFC 308820,308821: Fixes for fatal page faults on x86.
  
  308820:
  Report page faults due to reserved bits in PTEs as a separate fault type.
  
  Rather than reporting a page fault due to a bad PTE as a protection
  violation with the "rsv" flag, treat these faults as a separate type of
  fault altogether.
  
  308821:
  MFamd64: Various fatal page fault fixes.
  
  - If a page fault is triggered due to reserved bits in a PTE, treat it
as a fatal fault and panic.
  - If PG_NX is in use, report whether a fatal page fault is due to an
instruction fetch or a data access.
  - If a fatal page fault is due to reserved bits in a PTE, report that as
the page fault type rather than a protection violation.

Modified:
  stable/11/sys/amd64/amd64/trap.c
  stable/11/sys/i386/i386/trap.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/amd64/amd64/trap.c
  stable/10/sys/i386/i386/trap.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/11/sys/amd64/amd64/trap.c
==
--- stable/11/sys/amd64/amd64/trap.cFri Dec 23 18:29:10 2016
(r310484)
+++ stable/11/sys/amd64/amd64/trap.cFri Dec 23 19:28:15 2016
(r310485)
@@ -761,11 +761,11 @@ trap_fatal(frame, eva)
 #endif
if (type == T_PAGEFLT) {
printf("fault virtual address   = 0x%lx\n", eva);
-   printf("fault code  = %s %s %s%s, %s\n",
+   printf("fault code  = %s %s %s, %s\n",
code & PGEX_U ? "user" : "supervisor",
code & PGEX_W ? "write" : "read",
code & PGEX_I ? "instruction" : "data",
-   code & PGEX_RSV ? " rsv" : "",
+   code & PGEX_RSV ? "reserved bits in PTE" :
code & PGEX_P ? "protection violation" : "page not 
present");
}
printf("instruction pointer = 0x%lx:0x%lx\n",

Modified: stable/11/sys/i386/i386/trap.c
==
--- stable/11/sys/i386/i386/trap.c  Fri Dec 23 18:29:10 2016
(r310484)
+++ stable/11/sys/i386/i386/trap.c  Fri Dec 23 19:28:15 2016
(r310485)
@@ -857,6 +857,14 @@ trap_pfault(frame, usermode, eva)
}
 
/*
+* If the trap was caused by errant bits in the PTE then panic.
+*/
+   if (frame->tf_err & PGEX_RSV) {
+   trap_fatal(frame, eva);
+   return (-1);
+   }
+
+   /*
 * PGEX_I is defined only if the execute disable bit capability is
 * supported and enabled.
 */
@@ -926,9 +934,15 @@ trap_fatal(frame, eva)
 #endif
if (type == T_PAGEFLT) {
printf("fault virtual address   = 0x%x\n", eva);
-   printf("fault code  = %s %s, %s\n",
+   printf("fault code  = %s %s%s, %s\n",
code & PGEX_U ? "user" : "supervisor",
code & PGEX_W ? "write" : "read",
+#if defined(PAE) || defined(PAE_TABLES)
+   pg_nx != 0 ?
+   (code & PGEX_I ? " instruction" : " data") :
+#endif
+   "",
+   code & PGEX_RSV ? "reserved bits in PTE" :
code & PGEX_P ? "protection violation" : "page not 
present");
}
printf("instruction pointer = 0x%x:0x%x\n",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r308789 - head/sys/conf

2016-12-23 Thread Warner Losh
On Fri, Dec 23, 2016 at 9:35 AM, Ed Maste  wrote:
> On 17 November 2016 at 19:13, Gleb Smirnoff  wrote:
>> Author: glebius
>> Date: Fri Nov 18 00:13:30 2016
>> New Revision: 308789
>> URL: https://svnweb.freebsd.org/changeset/base/308789
>>
>> Log:
>>   If FreeBSD source tree is a subproject of a bigger project, then .git or
>>   .hg may reside above FreeBSD sources root.  Provide function findvcs()
>>   that will climb up and seek for presence of a VCS directory.
>
> This can incorrectly find an unrelated .git directory and provide a
> git revision unrelated to the FreeBSD source being built. For example,
> a build from my Subversion tree now reports "FreeBSD 12.0-CURRENT #2
> ad3f46a(master)" instead of "FreeBSD 12.0-CURRENT #5 r310482M".
>
> Can you explain your use case in a little more detail so that I can
> avoid breaking it with a change here? Do you commit FreeBSD snapshots
> into the "bigger project"?

This is done at work (Netflix). We import all the FreeBSD revisions
from github into our repo, and then merge them into the top level
FreeBSD directory from time to time using git's subtree functionality.
We also pull in our ports tree this way (so we have a ports directory
at the same level as our FreeBSD directory). So we don't have a
$TOPSRC/.git like you would if you'd just cloned directly from github.
Our .git directory lives in $TOPSRC/.git as a result. newvers.sh
should find the 'deepest' SCM it can, and use that instead of
apparently using the topmost (I'm surprised that you have FreeBSD
under a directory that has a git checkout in it, btw, but I know that
with my dotfile management repo, that sometimes happens by mistake).
And if this somehow produces a 'tie', the tie should go to svn.

Looking at how to fix this mess... woof. There's all kinds of crazy
here. Support for: git, git + svn, hg, p4, svn and svnlite. Sometimes
$VCS_cmd is defined if it exists at all on the system, other times
it's only defined if it exists on the system AND we think the tree is
under $VCS.

But the base of all this woe is that findvcs is called on a per-vcs
basis, rather than being called early to match one of N VCS
signatures. It would be better off searching each directory for each
file rather than finding any file at any level.

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310484 - in stable/10: share/man/man4 sys/conf sys/dev/isp

2016-12-23 Thread Kenneth D. Merry
Author: ken
Date: Fri Dec 23 18:29:10 2016
New Revision: 310484
URL: https://svnweb.freebsd.org/changeset/base/310484

Log:
  MFC, r310338:

r310338 | ken | 2016-12-20 14:17:07 -0700 (Tue, 20 Dec 2016) | 37 lines
  
Turn on FC-Tape by default in the isp(4) driver.
  
FC-Tape provides additional link level error recovery, and is
highly recommended for tape devices.  It will only be turned on for
a given target if the target supports it.
  
Without this setting, we default to whatever FC-Tape setting is in
NVRAM on the card.
  
This can be overridden by setting the following loader tunable, for
example for isp0:
  
hint.isp.0.nofctape=1
  
sys/conf/options:
Add a new kernel config option, ISP_FCTAPE_OFF, that
defaults the FC-Tape configuration to off.
  
sys/dev/isp/isp_pci.c:
If ISP_FCTAPE_OFF is defined, turn off FC-Tape.  Otherwise,
turn it on if the card supports it.
  
share/man/man4/isp.4:
Add a description of FC-Tape to the isp(4) man page.
  
Add descriptions of the fctape and nofctape options, as well as the
ISP_FCTAPE_OFF kernel configuration option.
  
Add the ispfw module and kernel drivers to the suggested
configurations at the top of the man page so that users are less
likely to leave it out.  The driver works well with the included
firmware, but may not work at all with whatever firmware the user
has flashed on their card.
  
Sponsored by:   Spectra Logic
  

  
  Sponsored by: Spectra Logic

Modified:
  stable/10/share/man/man4/isp.4
  stable/10/sys/conf/options
  stable/10/sys/dev/isp/isp_pci.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/isp.4
==
--- stable/10/share/man/man4/isp.4  Fri Dec 23 18:25:43 2016
(r310483)
+++ stable/10/share/man/man4/isp.4  Fri Dec 23 18:29:10 2016
(r310484)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 9, 2015
+.Dd December 20, 2016
 .Dt ISP 4
 .Os
 .Sh NAME
@@ -39,13 +39,15 @@ kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device scbus"
 .Cd "device isp"
+.Cd "device ispfw"
 .Ed
 .Pp
 Alternatively, to load the driver as a
-module at boot time, place the following line in
+module at boot time, place the following lines in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 isp_load="YES"
+ispfw_load="YES"
 .Ed
 .Sh DESCRIPTION
 This driver provides access to
@@ -62,6 +64,30 @@ Fibre Channel supports initiator and tar
 utilizing Class 3 and Class 2 (2200 and later) connections.
 Support is available for Public and Private loops, Point-to-Point
 and Fabric connections.
+.Pp
+FC-Tape is supported on 4Gb (2400) and newer controllers.
+FC-Tape is highly recommended for connections to tape drives that support
+it.
+It encompasses four elements from the the T-10 FCP-4 specification:
+.Bl -bullet -offset indent
+.It
+Precise Delivery of Commands
+.It
+Confirmed Completion of FCP I/O Operations
+.It
+Retransmission of Unsuccessfully Transmitted IUs
+.It
+Task Retry Identification
+.El
+.Pp
+Together these features allow for link level error recovery with tape
+devices.
+Without it, an initiator cannot, for instance, tell whether a tape write
+command that has timed out resulted in all, part or none of the data going to
+the tape drive.
+FC-Tape is automatically enabled when connecting controller that supports
+it to a target that supports it.
+It may be disabled using configuration and hint options described below.
 .Sh FIRMWARE
 Firmware loading is supported if the
 .Xr ispfw 4
@@ -120,6 +146,13 @@ Target mode support for Fibre Channel ad
 .Cd options ISP_TARGET_MODE
 .Pp
 option.
+.Pp
+To disable FC-Tape, use the following configuration option:
+.Pp
+.Cd options ISP_FCTAPE_OFF
+.Pp
+Note that even if the ISP_FCTAPE_OFF option is used, it may be overridden
+by the fctape hint described below.
 .Sh BOOT OPTIONS
 The following options are switchable by setting values in
 .Pa /boot/device.hints .
@@ -169,6 +202,11 @@ A hint value for a driver debug level (s
 for the values.
 .It Va hint.isp.0.vports
 A hint to create specified number of additional virtual ports.
+.It Va hint.isp.0.nofctape
+Set this to 1 to disable FC-Tape operation on the given isp instance.
+.It Va hint.isp.0.fctape
+Set this to 1 to enable FC-Tape operation on the given isp instance for
+targets that support it.
 .El
 .Sh SYSCTL OPTIONS
 .Bl -tag -width indent

Modified: stable/10/sys/conf/options
==
--- stable/10/sys/conf/options  Fri Dec 23 18:25:43 2016(r310483)
+++ stable/10/sys/conf/options  Fri Dec 23 18:29:10 2016(r310484)
@@ -374,6 

Re: svn commit: r310445 - in head/sys/mips: include mips

2016-12-23 Thread John Baldwin
On Friday, December 23, 2016 03:27:11 AM John Baldwin wrote:
> Author: jhb
> Date: Fri Dec 23 03:27:11 2016
> New Revision: 310445
> URL: https://svnweb.freebsd.org/changeset/base/310445
> 
> Log:
>   Teach DDB how to unwind across a kernel stack overflow.
>   
>   Kernel stack overflows in MIPS call panic() directly from an assembly
>   handler after storing the interrupted context's registers in a
>   trapframe.  Rather than inferring the location of ra, sp, and pc from
>   the instruction stream, recognize the pc of a kernel stack overflow
>   and pull the registers from the trapframe.
>   
>   Sponsored by:   DARPA / AFRL

We should possibly use this same logic for other subroutines that use
trapframes.  Trying to run a program that core dumps over NFS in my
qemu mips64 machine triggers the stack overflow on a kernel built with
gcc5.3 from ports.  The DDB stack trace doesn't get very far:

panic: kernel stack overflow - trapframe at 0x80699eb0
KDB: stack backtrace:
db_trace_self+1c (?,?,?,?) ra 801620d8 sp 80699ac0 sz 16
801620ac+2c (?,?,?,?) ra 80357788 sp 80699ad0 sz 800
80357744+44 (?,?,?,?) ra 80304ff4 sp 80699df0 sz 16
vpanic+f4 (?,?,?,?) ra 80305d84 sp 80699e00 sz 48
panic+30 (?,80699eb0,ffec,802c901c) ra 
805388bc sp 80699e30 sz 96
MipsTLBInvalidException+360 (?,?,?,?) ra 0 sp 80699e90 sz 0
--- Kernel Stack Overflow ---
802c9018+4 (?,?,?,?) ra 805544e4 sp c0002a5b5fa0 sz 96
80554400+e4 (?,?,?,?) ra 802c90f4 sp c0002a5b6000 sz 48
802c9018+dc (?,?,?,?) ra 805563dc sp c0002a5b6030 sz 96
cpu_intr+248 (?,?,?,?) ra 80538110 sp c0002a5b6090 sz 80
MipsKernIntr+188 (?,?,?,?) ra 0 sp c0002a5b60e0 sz 368
pid 607
KDB: enter: panic

(In particular, we probably should be using the trapframe logic employed
here for MipsKernIntr.)

I've patched kgdb to add a MIPS kernel target and taught it how to handle
trapframes, etc. (and it can cross-debug, so I used an amd64 host to examine
the dump) and it gives a more useful stack trace.  Unfortunately, increasing
the kstack size on MIPS as a workaround for this issue seems to be very
hard as the code in cpu_switch() hard codes exactly two TLB entries to cover
the kernel stack and PCB to avoid TLB faults during a context switch.  I think
if you create a kthread with a non-default kstack size on MIPS it's probably
a ticking time bomb in that you might get a TLB miss when accessing the pcb.

savectx () at /usr/home/john/work/git/freebsd/sys/mips/mips/swtch.S:171
171 SAVE_U_PCB_CONTEXT(ra, PCB_REG_PC, a0)
(kgdb) where
#0  savectx () at /usr/home/john/work/git/freebsd/sys/mips/mips/swtch.S:171
#1  0x80304dfc in doadump (textdump=textdump@entry=0)
at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:297
#2  0x8015d868 in db_dump (dummy=, 
dummy2=, dummy3=, dummy4=)
at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:546
#3  0x8015e474 in db_command (
last_cmdp=last_cmdp@entry=0x8069e778 , 
cmd_table=, 
cmd_table@entry=0x8069e730 , dopager=dopager@entry=1)
at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:453
#4  0x8015eab8 in db_command_loop ()
at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:506
#5  0x80162040 in db_trap (type=, code=)
at /usr/home/john/work/git/freebsd/sys/ddb/db_main.c:248
#6  0x803583e8 in kdb_trap (type=type@entry=9, code=code@entry=0, 
tf=tf@entry=0x80699ca0 )
at /usr/home/john/work/git/freebsd/sys/kern/subr_kdb.c:654
#7  0x8054ba10 in trap (trapframe=0x80699ca0 )
at /usr/home/john/work/git/freebsd/sys/mips/mips/trap.c:828
#8  
#9  kdb_enter (why=0x805b6138 "panic", msg=)
at /usr/home/john/work/git/freebsd/sys/kern/subr_kdb.c:444
#10 0x8030503c in vpanic (fmt=, 
ap=ap@entry=0x80699e58 )
at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:752
---Type  to continue, or q  to quit---
#11 0x80305d84 in panic (fmt=)
at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:690
#12 
#13 0x802c901c in intr_event_handle (ie=0x98a42400, 
frame=frame@entry=0x0)
at /usr/home/john/work/git/freebsd/sys/kern/kern_intr.c:1397
#14 0x805544e4 in gt_pci_intr (v=0x98ab0800)
at /usr/home/john/work/git/freebsd/sys/mips/malta/gt_pci.c:236
#15 0x802c90f4 in intr_event_handle (ie=0x98a43900, 
frame=frame@entry=0xc0002a5b6100)
at /usr/home/john/work/git/freebsd/sys/kern/kern_intr.c:1436
#16 0x805563dc in cpu_intr (tf=0xc0002a5b6100)
at /usr/home/john/work/git/freebsd/sys/mips/mips/intr_machdep.c:264
#17 
#18 le_pci_wrcsr (sc=0x98ae9400, port=, 
val=)
at 

svn commit: r310483 - in stable/11: share/man/man4 sys/conf sys/dev/isp

2016-12-23 Thread Kenneth D. Merry
Author: ken
Date: Fri Dec 23 18:25:43 2016
New Revision: 310483
URL: https://svnweb.freebsd.org/changeset/base/310483

Log:
  MFC, r310338:

r310338 | ken | 2016-12-20 14:17:07 -0700 (Tue, 20 Dec 2016) | 37 lines
  
Turn on FC-Tape by default in the isp(4) driver.
  
FC-Tape provides additional link level error recovery, and is
highly recommended for tape devices.  It will only be turned on for
a given target if the target supports it.
  
Without this setting, we default to whatever FC-Tape setting is in
NVRAM on the card.
  
This can be overridden by setting the following loader tunable, for
example for isp0:
  
hint.isp.0.nofctape=1
  
sys/conf/options:
Add a new kernel config option, ISP_FCTAPE_OFF, that
defaults the FC-Tape configuration to off.
  
sys/dev/isp/isp_pci.c:
If ISP_FCTAPE_OFF is defined, turn off FC-Tape.  Otherwise,
turn it on if the card supports it.
  
share/man/man4/isp.4:
Add a description of FC-Tape to the isp(4) man page.
  
Add descriptions of the fctape and nofctape options, as well as the
ISP_FCTAPE_OFF kernel configuration option.
  
Add the ispfw module and kernel drivers to the suggested
configurations at the top of the man page so that users are less
likely to leave it out.  The driver works well with the included
firmware, but may not work at all with whatever firmware the user
has flashed on their card.
  
Sponsored by:   Spectra Logic
  

  Sponsored by: Spectra Logic

Modified:
  stable/11/share/man/man4/isp.4
  stable/11/sys/conf/options
  stable/11/sys/dev/isp/isp_pci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/isp.4
==
--- stable/11/share/man/man4/isp.4  Fri Dec 23 16:06:41 2016
(r310482)
+++ stable/11/share/man/man4/isp.4  Fri Dec 23 18:25:43 2016
(r310483)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 9, 2015
+.Dd December 20, 2016
 .Dt ISP 4
 .Os
 .Sh NAME
@@ -39,13 +39,15 @@ kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device scbus"
 .Cd "device isp"
+.Cd "device ispfw"
 .Ed
 .Pp
 Alternatively, to load the driver as a
-module at boot time, place the following line in
+module at boot time, place the following lines in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 isp_load="YES"
+ispfw_load="YES"
 .Ed
 .Sh DESCRIPTION
 This driver provides access to
@@ -62,6 +64,30 @@ Fibre Channel supports initiator and tar
 utilizing Class 3 and Class 2 (2200 and later) connections.
 Support is available for Public and Private loops, Point-to-Point
 and Fabric connections.
+.Pp
+FC-Tape is supported on 4Gb (2400) and newer controllers.
+FC-Tape is highly recommended for connections to tape drives that support
+it.
+It encompasses four elements from the the T-10 FCP-4 specification:
+.Bl -bullet -offset indent
+.It
+Precise Delivery of Commands
+.It
+Confirmed Completion of FCP I/O Operations
+.It
+Retransmission of Unsuccessfully Transmitted IUs
+.It
+Task Retry Identification
+.El
+.Pp
+Together these features allow for link level error recovery with tape
+devices.
+Without it, an initiator cannot, for instance, tell whether a tape write
+command that has timed out resulted in all, part or none of the data going to
+the tape drive.
+FC-Tape is automatically enabled when connecting controller that supports
+it to a target that supports it.
+It may be disabled using configuration and hint options described below.
 .Sh FIRMWARE
 Firmware loading is supported if the
 .Xr ispfw 4
@@ -120,6 +146,13 @@ Target mode support for Fibre Channel ad
 .Cd options ISP_TARGET_MODE
 .Pp
 option.
+.Pp
+To disable FC-Tape, use the following configuration option:
+.Pp
+.Cd options ISP_FCTAPE_OFF
+.Pp
+Note that even if the ISP_FCTAPE_OFF option is used, it may be overridden
+by the fctape hint described below.
 .Sh BOOT OPTIONS
 The following options are switchable by setting values in
 .Pa /boot/device.hints .
@@ -169,6 +202,11 @@ A hint value for a driver debug level (s
 for the values.
 .It Va hint.isp.0.vports
 A hint to create specified number of additional virtual ports.
+.It Va hint.isp.0.nofctape
+Set this to 1 to disable FC-Tape operation on the given isp instance.
+.It Va hint.isp.0.fctape
+Set this to 1 to enable FC-Tape operation on the given isp instance for
+targets that support it.
 .El
 .Sh SYSCTL OPTIONS
 .Bl -tag -width indent

Modified: stable/11/sys/conf/options
==
--- stable/11/sys/conf/options  Fri Dec 23 16:06:41 2016(r310482)
+++ stable/11/sys/conf/options  Fri Dec 23 18:25:43 2016(r310483)
@@ -381,6 +381,7 

Re: svn commit: r308789 - head/sys/conf

2016-12-23 Thread Ed Maste
On 17 November 2016 at 19:13, Gleb Smirnoff  wrote:
> Author: glebius
> Date: Fri Nov 18 00:13:30 2016
> New Revision: 308789
> URL: https://svnweb.freebsd.org/changeset/base/308789
>
> Log:
>   If FreeBSD source tree is a subproject of a bigger project, then .git or
>   .hg may reside above FreeBSD sources root.  Provide function findvcs()
>   that will climb up and seek for presence of a VCS directory.

This can incorrectly find an unrelated .git directory and provide a
git revision unrelated to the FreeBSD source being built. For example,
a build from my Subversion tree now reports "FreeBSD 12.0-CURRENT #2
ad3f46a(master)" instead of "FreeBSD 12.0-CURRENT #5 r310482M".

Can you explain your use case in a little more detail so that I can
avoid breaking it with a change here? Do you commit FreeBSD snapshots
into the "bigger project"?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310481 - in head/sys/i386: i386 include

2016-12-23 Thread Jason A. Harmening
Author: jah
Date: Fri Dec 23 15:14:56 2016
New Revision: 310481
URL: https://svnweb.freebsd.org/changeset/base/310481

Log:
  Move the objects used to create temporary mappings for i386 pmap zero and copy
  operations to the MD PCPU region.  Change sysmap initialization to only
  allocate KVA pages for CPUs that are actually present.  As a minor
  optimization, this also prevents false sharing between adjacent sysmap objects
  since the pcpu struct is already cacheline-aligned.
  
  While here, move pc_qmap_addr initialization for the BSP into
  pmap_bootstrap(), which allows use of pmap_quick* functions during early boot.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D8833

Modified:
  head/sys/i386/i386/pmap.c
  head/sys/i386/include/pcpu.h

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Fri Dec 23 15:05:41 2016(r310480)
+++ head/sys/i386/i386/pmap.c   Fri Dec 23 15:14:56 2016(r310481)
@@ -257,14 +257,6 @@ vm_offset_t pv_vafree; /* freelist sto
 /*
  * All those kernel PT submaps that BSD is so fond of
  */
-struct sysmaps {
-   struct  mtx lock;
-   pt_entry_t *CMAP1;
-   pt_entry_t *CMAP2;
-   caddr_t CADDR1;
-   caddr_t CADDR2;
-};
-static struct sysmaps sysmaps_pcpu[MAXCPU];
 pt_entry_t *CMAP3;
 static pd_entry_t *KPTD;
 caddr_t ptvmmap = 0;
@@ -379,7 +371,7 @@ pmap_bootstrap(vm_paddr_t firstaddr)
 {
vm_offset_t va;
pt_entry_t *pte, *unused;
-   struct sysmaps *sysmaps;
+   struct pcpu *pc;
int i;
 
/*
@@ -441,16 +433,19 @@ pmap_bootstrap(vm_paddr_t firstaddr)
va = virtual_avail;
pte = vtopte(va);
 
+
/*
+* Initialize temporary map objects on the current CPU for use
+* during early boot.
 * CMAP1/CMAP2 are used for zeroing and copying pages.
 * CMAP3 is used for the boot-time memory test.
 */
-   for (i = 0; i < MAXCPU; i++) {
-   sysmaps = _pcpu[i];
-   mtx_init(>lock, "SYSMAPS", NULL, MTX_DEF);
-   SYSMAP(caddr_t, sysmaps->CMAP1, sysmaps->CADDR1, 1)
-   SYSMAP(caddr_t, sysmaps->CMAP2, sysmaps->CADDR2, 1)
-   }
+   pc = pcpu_find(curcpu);
+   mtx_init(>pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF);
+   SYSMAP(caddr_t, pc->pc_cmap_pte1, pc->pc_cmap_addr1, 1)
+   SYSMAP(caddr_t, pc->pc_cmap_pte2, pc->pc_cmap_addr2, 1)
+   SYSMAP(vm_offset_t, pte, pc->pc_qmap_addr, 1)
+
SYSMAP(caddr_t, CMAP3, CADDR3, 1);
 
/*
@@ -520,20 +515,33 @@ pmap_bootstrap(vm_paddr_t firstaddr)
 }
 
 static void
-pmap_init_qpages(void)
+pmap_init_reserved_pages(void)
 {
struct pcpu *pc;
+   vm_offset_t pages;
int i;
 
CPU_FOREACH(i) {
pc = pcpu_find(i);
-   pc->pc_qmap_addr = kva_alloc(PAGE_SIZE);
-   if (pc->pc_qmap_addr == 0)
-   panic("pmap_init_qpages: unable to allocate KVA");
+   /*
+* Skip if the mapping has already been initialized,
+* i.e. this is the BSP.
+*/
+   if (pc->pc_cmap_addr1 != 0)
+   continue;
+   mtx_init(>pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF);
+   pages = kva_alloc(PAGE_SIZE * 3);
+   if (pages == 0)
+   panic("%s: unable to allocate KVA", __func__);
+   pc->pc_cmap_pte1 = vtopte(pages);
+   pc->pc_cmap_pte2 = vtopte(pages + PAGE_SIZE);
+   pc->pc_cmap_addr1 = (caddr_t)pages;
+   pc->pc_cmap_addr2 = (caddr_t)(pages + PAGE_SIZE);
+   pc->pc_qmap_addr = pages + (PAGE_SIZE * 2);
}
 }
-
-SYSINIT(qpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_qpages, NULL);
+ 
+SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages, NULL);
 
 /*
  * Setup the PAT MSR.
@@ -4194,20 +4202,22 @@ pagezero(void *page)
 void
 pmap_zero_page(vm_page_t m)
 {
-   struct sysmaps *sysmaps;
+   pt_entry_t *cmap_pte2;
+   struct pcpu *pc;
 
-   sysmaps = _pcpu[PCPU_GET(cpuid)];
-   mtx_lock(>lock);
-   if (*sysmaps->CMAP2)
-   panic("pmap_zero_page: CMAP2 busy");
sched_pin();
-   *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M |
+   pc = pcpu_find(curcpu);
+   cmap_pte2 = pc->pc_cmap_pte2;
+   mtx_lock(>pc_cmap_lock);
+   if (*cmap_pte2)
+   panic("pmap_zero_page: CMAP2 busy");
+   *cmap_pte2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M |
pmap_cache_bits(m->md.pat_mode, 0);
-   invlcaddr(sysmaps->CADDR2);
-   pagezero(sysmaps->CADDR2);
-   *sysmaps->CMAP2 = 0;
+   invlcaddr(pc->pc_cmap_addr2);
+   pagezero(pc->pc_cmap_addr2);
+   *cmap_pte2 = 0;
+   mtx_unlock(>pc_cmap_lock);

svn commit: r310480 - stable/10/lib/libutil

2016-12-23 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Dec 23 15:05:41 2016
New Revision: 310480
URL: https://svnweb.freebsd.org/changeset/base/310480

Log:
  MFH (r309269): use malloc()ed buffers instead of stack buffers

Modified:
  stable/10/lib/libutil/gr_util.c
  stable/10/lib/libutil/pw_util.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libutil/gr_util.c
==
--- stable/10/lib/libutil/gr_util.c Fri Dec 23 15:02:40 2016
(r310479)
+++ stable/10/lib/libutil/gr_util.c Fri Dec 23 15:05:41 2016
(r310480)
@@ -164,11 +164,12 @@ gr_tmp(int mfd)
 int
 gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr)
 {
-   char buf[8192], *end, *line, *p, *q, *r, t;
+   char *buf, *end, *line, *p, *q, *r, *tmp;
struct group *fgr;
const struct group *sgr;
-   size_t len;
+   size_t len, size;
int eof, readlen;
+   char t;
 
if (old_gr == NULL && gr == NULL)
return(-1);
@@ -186,6 +187,10 @@ gr_copy(int ffd, int tfd, const struct g
if (sgr == NULL)
sgr = gr;
 
+   /* initialize the buffer */
+   if ((buf = malloc(size = 1024)) == NULL)
+   goto err;
+
eof = 0;
len = 0;
p = q = end = buf;
@@ -199,10 +204,16 @@ gr_copy(int ffd, int tfd, const struct g
if (q >= end) {
if (eof)
break;
-   if ((size_t)(q - p) >= sizeof(buf)) {
-   warnx("group line too long");
-   errno = EINVAL; /* hack */
-   goto err;
+   while ((size_t)(q - p) >= size) {
+   if ((tmp = realloc(buf, size * 2)) == NULL) {
+   warnx("group line too long");
+   goto err;
+   }
+   p = tmp + (p - buf);
+   q = tmp + (q - buf);
+   end = tmp + (end - buf);
+   buf = tmp;
+   size = size * 2;
}
if (p < end) {
q = memmove(buf, p, end -p);
@@ -210,7 +221,7 @@ gr_copy(int ffd, int tfd, const struct g
} else {
p = q = end = buf;
}
-   readlen = read(ffd, end, sizeof(buf) - (end -buf));
+   readlen = read(ffd, end, size - (end - buf));
if (readlen == -1)
goto err;
else
@@ -219,7 +230,7 @@ gr_copy(int ffd, int tfd, const struct g
break;
end += len;
len = end - buf;
-   if (len < (ssize_t)sizeof(buf)) {
+   if (len < size) {
eof = 1;
if (len > 0 && buf[len -1] != '\n')
++len, *end++ = '\n';
@@ -281,7 +292,7 @@ gr_copy(int ffd, int tfd, const struct g
if (write(tfd, q, end - q) != end - q)
goto err;
q = buf;
-   readlen = read(ffd, buf, sizeof(buf));
+   readlen = read(ffd, buf, size);
if (readlen == 0)
break;
else
@@ -303,12 +314,12 @@ gr_copy(int ffd, int tfd, const struct g
   write(tfd, "\n", 1) != 1)
goto err;
  done:
-   if (line != NULL)
-   free(line);
+   free(line);
+   free(buf);
return (0);
  err:
-   if (line != NULL)
-   free(line);
+   free(line);
+   free(buf);
return (-1);
 }
 

Modified: stable/10/lib/libutil/pw_util.c
==
--- stable/10/lib/libutil/pw_util.c Fri Dec 23 15:02:40 2016
(r310479)
+++ stable/10/lib/libutil/pw_util.c Fri Dec 23 15:05:41 2016
(r310480)
@@ -428,11 +428,12 @@ pw_make_v7(const struct passwd *pw)
 int
 pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw)
 {
-   char buf[8192], *end, *line, *p, *q, *r, t;
+   char *buf, *end, *line, *p, *q, *r, *tmp;
struct passwd *fpw;
const struct passwd *spw;
-   size_t len;
+   size_t len, size;
int eof, readlen;
+   char t;
 
if (old_pw == NULL && pw == NULL)
return (-1);
@@ -450,6 +451,10 @@ pw_copy(int ffd, int tfd, const struct p
if (spw == NULL)
spw = pw;
 
+   /* initialize the buffer */
+   

svn commit: r310479 - stable/11/lib/libutil

2016-12-23 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Dec 23 15:02:40 2016
New Revision: 310479
URL: https://svnweb.freebsd.org/changeset/base/310479

Log:
  MFH (r309269): use malloc()ed buffers instead of stack buffers

Modified:
  stable/11/lib/libutil/gr_util.c
  stable/11/lib/libutil/pw_util.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libutil/gr_util.c
==
--- stable/11/lib/libutil/gr_util.c Fri Dec 23 14:54:40 2016
(r310478)
+++ stable/11/lib/libutil/gr_util.c Fri Dec 23 15:02:40 2016
(r310479)
@@ -164,11 +164,12 @@ gr_tmp(int mfd)
 int
 gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr)
 {
-   char buf[8192], *end, *line, *p, *q, *r, t;
+   char *buf, *end, *line, *p, *q, *r, *tmp;
struct group *fgr;
const struct group *sgr;
-   size_t len;
+   size_t len, size;
int eof, readlen;
+   char t;
 
if (old_gr == NULL && gr == NULL)
return(-1);
@@ -186,6 +187,10 @@ gr_copy(int ffd, int tfd, const struct g
if (sgr == NULL)
sgr = gr;
 
+   /* initialize the buffer */
+   if ((buf = malloc(size = 1024)) == NULL)
+   goto err;
+
eof = 0;
len = 0;
p = q = end = buf;
@@ -199,10 +204,16 @@ gr_copy(int ffd, int tfd, const struct g
if (q >= end) {
if (eof)
break;
-   if ((size_t)(q - p) >= sizeof(buf)) {
-   warnx("group line too long");
-   errno = EINVAL; /* hack */
-   goto err;
+   while ((size_t)(q - p) >= size) {
+   if ((tmp = realloc(buf, size * 2)) == NULL) {
+   warnx("group line too long");
+   goto err;
+   }
+   p = tmp + (p - buf);
+   q = tmp + (q - buf);
+   end = tmp + (end - buf);
+   buf = tmp;
+   size = size * 2;
}
if (p < end) {
q = memmove(buf, p, end -p);
@@ -210,7 +221,7 @@ gr_copy(int ffd, int tfd, const struct g
} else {
p = q = end = buf;
}
-   readlen = read(ffd, end, sizeof(buf) - (end -buf));
+   readlen = read(ffd, end, size - (end - buf));
if (readlen == -1)
goto err;
else
@@ -219,7 +230,7 @@ gr_copy(int ffd, int tfd, const struct g
break;
end += len;
len = end - buf;
-   if (len < (ssize_t)sizeof(buf)) {
+   if (len < size) {
eof = 1;
if (len > 0 && buf[len -1] != '\n')
++len, *end++ = '\n';
@@ -281,7 +292,7 @@ gr_copy(int ffd, int tfd, const struct g
if (write(tfd, q, end - q) != end - q)
goto err;
q = buf;
-   readlen = read(ffd, buf, sizeof(buf));
+   readlen = read(ffd, buf, size);
if (readlen == 0)
break;
else
@@ -303,12 +314,12 @@ gr_copy(int ffd, int tfd, const struct g
   write(tfd, "\n", 1) != 1)
goto err;
  done:
-   if (line != NULL)
-   free(line);
+   free(line);
+   free(buf);
return (0);
  err:
-   if (line != NULL)
-   free(line);
+   free(line);
+   free(buf);
return (-1);
 }
 

Modified: stable/11/lib/libutil/pw_util.c
==
--- stable/11/lib/libutil/pw_util.c Fri Dec 23 14:54:40 2016
(r310478)
+++ stable/11/lib/libutil/pw_util.c Fri Dec 23 15:02:40 2016
(r310479)
@@ -427,11 +427,12 @@ pw_make_v7(const struct passwd *pw)
 int
 pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw)
 {
-   char buf[8192], *end, *line, *p, *q, *r, t;
+   char *buf, *end, *line, *p, *q, *r, *tmp;
struct passwd *fpw;
const struct passwd *spw;
-   size_t len;
+   size_t len, size;
int eof, readlen;
+   char t;
 
if (old_pw == NULL && pw == NULL)
return (-1);
@@ -449,6 +450,10 @@ pw_copy(int ffd, int tfd, const struct p
if (spw == NULL)
spw = pw;
 
+   /* initialize the buffer */
+   

svn commit: r310478 - head/sys/cam/ctl

2016-12-23 Thread Alexander Motin
Author: mav
Date: Fri Dec 23 14:54:40 2016
New Revision: 310478
URL: https://svnweb.freebsd.org/changeset/base/310478

Log:
  Add place-holders for TAPE STREAM MIRRORING subcommands of XCOPY.
  
  We do not support tapes, so this is only a comments.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl_cmd_table.c

Modified: head/sys/cam/ctl/ctl_cmd_table.c
==
--- head/sys/cam/ctl/ctl_cmd_table.cFri Dec 23 14:44:40 2016
(r310477)
+++ head/sys/cam/ctl/ctl_cmd_table.cFri Dec 23 14:54:40 2016
(r310478)
@@ -482,7 +482,7 @@ const struct ctl_cmd_entry ctl_cmd_table
 /* 15 */
 {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
 
-/* 16 */
+/* 16 SET TAPE STREAM MIRRORING */
 {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
 
 /* 17 */
@@ -506,6 +506,11 @@ const struct ctl_cmd_entry ctl_cmd_table
  CTL_FLAG_DATA_NONE,
  CTL_LUN_PAT_NONE,
  16, { 0x1c, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x07}},
+
+/* 1D COPY OPERATION CLOSE */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 1e-1f */
 };
 
 /* 84 RECEIVE COPY STATUS */
@@ -574,6 +579,50 @@ const struct ctl_cmd_entry ctl_cmd_table
  CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
  CTL_LUN_PAT_NONE,
  16, {0x08, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}},
+
+/* 09 */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 0A */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 0B */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 0C */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 0D */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 0E */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 0F */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 10 */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 11 */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 12 */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 13 */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 14 */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 15 */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 16 REPORT TAPE STREAM MIRRORING */
+{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+
+/* 17-1f */
 };
 
 /* 9B READ BUFFER(16) */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310138 - head/lib/libc/stdio

2016-12-23 Thread David Chisnall
On 22 Dec 2016, at 23:02, Baptiste Daroussin  wrote:
> 
> I think it is pretty clear that there are too many people requesting the 
> revert
> for the revert not to be done.

Even if this feature is desired, the implementation in the patch is broken and 
should be reverted until a correct implementation (one that doesn’t break the 
first time user code calls register_printf_*) is done.

David



smime.p7s
Description: S/MIME cryptographic signature


svn commit: r310472 - stable/10/sys/vm

2016-12-23 Thread Konstantin Belousov
Author: kib
Date: Fri Dec 23 09:39:50 2016
New Revision: 310472
URL: https://svnweb.freebsd.org/changeset/base/310472

Log:
  MFC r310182:
  In swp_pager_meta_free_all(), fix type of the index variable.  Style.

Modified:
  stable/10/sys/vm/swap_pager.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/vm/swap_pager.c
==
--- stable/10/sys/vm/swap_pager.c   Fri Dec 23 09:35:39 2016
(r310471)
+++ stable/10/sys/vm/swap_pager.c   Fri Dec 23 09:39:50 2016
(r310472)
@@ -1997,30 +1997,30 @@ swp_pager_meta_free(vm_object_t object, 
 static void
 swp_pager_meta_free_all(vm_object_t object)
 {
-   daddr_t index = 0;
+   struct swblock **pswap, *swap;
+   vm_pindex_t index;
+   daddr_t v;
+   int i;
 
VM_OBJECT_ASSERT_WLOCKED(object);
if (object->type != OBJT_SWAP)
return;
 
-   while (object->un_pager.swp.swp_bcount) {
-   struct swblock **pswap;
-   struct swblock *swap;
-
+   index = 0;
+   while (object->un_pager.swp.swp_bcount != 0) {
mtx_lock(_mtx);
pswap = swp_pager_hash(object, index);
if ((swap = *pswap) != NULL) {
-   int i;
-
for (i = 0; i < SWAP_META_PAGES; ++i) {
-   daddr_t v = swap->swb_pages[i];
+   v = swap->swb_pages[i];
if (v != SWAPBLK_NONE) {
--swap->swb_count;
swp_pager_freeswapspace(v, 1);
}
}
if (swap->swb_count != 0)
-   panic("swap_pager_meta_free_all: swb_count != 
0");
+   panic(
+   "swap_pager_meta_free_all: swb_count != 0");
*pswap = swap->swb_hnext;
uma_zfree(swap_zone, swap);
--object->un_pager.swp.swp_bcount;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310471 - stable/10/sys/kern

2016-12-23 Thread Konstantin Belousov
Author: kib
Date: Fri Dec 23 09:35:39 2016
New Revision: 310471
URL: https://svnweb.freebsd.org/changeset/base/310471

Log:
  MFC r310159:
  Switch from stdatomic.h to atomic.h for kernel.

Modified:
  stable/10/sys/kern/kern_event.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_event.c
==
--- stable/10/sys/kern/kern_event.c Fri Dec 23 09:30:34 2016
(r310470)
+++ stable/10/sys/kern/kern_event.c Fri Dec 23 09:35:39 2016
(r310471)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -66,6 +65,7 @@ __FBSDID("$FreeBSD$");
 #ifdef KTRACE
 #include 
 #endif
+#include 
 
 #include 
 
@@ -184,7 +184,7 @@ static struct filterops user_filtops = {
 };
 
 static uma_zone_t  knote_zone;
-static atomic_uint kq_ncallouts = ATOMIC_VAR_INIT(0);
+static unsigned intkq_ncallouts = 0;
 static unsigned intkq_calloutmax = 4 * 1024;
 SYSCTL_UINT(_kern, OID_AUTO, kq_calloutmax, CTLFLAG_RW,
 _calloutmax, 0, "Maximum number of callouts allocated for kqueue");
@@ -652,13 +652,11 @@ filt_timerattach(struct knote *kn)
if (to < 0)
return (EINVAL);
 
-   ncallouts = atomic_load_explicit(_ncallouts, memory_order_relaxed);
do {
+   ncallouts = kq_ncallouts;
if (ncallouts >= kq_calloutmax)
return (ENOMEM);
-   } while (!atomic_compare_exchange_weak_explicit(_ncallouts,
-   , ncallouts + 1, memory_order_relaxed,
-   memory_order_relaxed));
+   } while (!atomic_cmpset_int(_ncallouts, ncallouts, ncallouts + 1));
 
kn->kn_flags |= EV_CLEAR;   /* automatically set */
kn->kn_status &= ~KN_DETACHED;  /* knlist_add clears it */
@@ -683,7 +681,7 @@ filt_timerdetach(struct knote *kn)
callout_drain(calloutp);
free(calloutp, M_KQUEUE);
free(kn->kn_ptr.p_nexttime, M_KQUEUE);
-   old = atomic_fetch_sub_explicit(_ncallouts, 1, memory_order_relaxed);
+   old = atomic_fetchadd_int(_ncallouts, -1);
KASSERT(old > 0, ("Number of callouts cannot become negative"));
kn->kn_status |= KN_DETACHED;   /* knlist_remove sets it */
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310470 - stable/11/sys/vm

2016-12-23 Thread Konstantin Belousov
Author: kib
Date: Fri Dec 23 09:30:34 2016
New Revision: 310470
URL: https://svnweb.freebsd.org/changeset/base/310470

Log:
  MFC r310182:
  In swp_pager_meta_free_all(), fix type of the index variable.  Style.

Modified:
  stable/11/sys/vm/swap_pager.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/swap_pager.c
==
--- stable/11/sys/vm/swap_pager.c   Fri Dec 23 09:27:25 2016
(r310469)
+++ stable/11/sys/vm/swap_pager.c   Fri Dec 23 09:30:34 2016
(r310470)
@@ -1913,30 +1913,30 @@ swp_pager_meta_free(vm_object_t object, 
 static void
 swp_pager_meta_free_all(vm_object_t object)
 {
-   daddr_t index = 0;
+   struct swblock **pswap, *swap;
+   vm_pindex_t index;
+   daddr_t v;
+   int i;
 
VM_OBJECT_ASSERT_WLOCKED(object);
if (object->type != OBJT_SWAP)
return;
 
-   while (object->un_pager.swp.swp_bcount) {
-   struct swblock **pswap;
-   struct swblock *swap;
-
+   index = 0;
+   while (object->un_pager.swp.swp_bcount != 0) {
mtx_lock(_mtx);
pswap = swp_pager_hash(object, index);
if ((swap = *pswap) != NULL) {
-   int i;
-
for (i = 0; i < SWAP_META_PAGES; ++i) {
-   daddr_t v = swap->swb_pages[i];
+   v = swap->swb_pages[i];
if (v != SWAPBLK_NONE) {
--swap->swb_count;
swp_pager_freeswapspace(v, 1);
}
}
if (swap->swb_count != 0)
-   panic("swap_pager_meta_free_all: swb_count != 
0");
+   panic(
+   "swap_pager_meta_free_all: swb_count != 0");
*pswap = swap->swb_hnext;
uma_zfree(swap_zone, swap);
--object->un_pager.swp.swp_bcount;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310469 - stable/11/sys/kern

2016-12-23 Thread Konstantin Belousov
Author: kib
Date: Fri Dec 23 09:27:25 2016
New Revision: 310469
URL: https://svnweb.freebsd.org/changeset/base/310469

Log:
  MFC r310159:
  Switch from stdatomic.h to atomic.h for kernel.

Modified:
  stable/11/sys/kern/kern_event.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_event.c
==
--- stable/11/sys/kern/kern_event.c Fri Dec 23 09:10:57 2016
(r310468)
+++ stable/11/sys/kern/kern_event.c Fri Dec 23 09:27:25 2016
(r310469)
@@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -69,6 +68,7 @@ __FBSDID("$FreeBSD$");
 #ifdef KTRACE
 #include 
 #endif
+#include 
 
 #include 
 
@@ -188,7 +188,7 @@ static struct filterops user_filtops = {
 };
 
 static uma_zone_t  knote_zone;
-static atomic_uint kq_ncallouts = ATOMIC_VAR_INIT(0);
+static unsigned intkq_ncallouts = 0;
 static unsigned intkq_calloutmax = 4 * 1024;
 SYSCTL_UINT(_kern, OID_AUTO, kq_calloutmax, CTLFLAG_RW,
 _calloutmax, 0, "Maximum number of callouts allocated for kqueue");
@@ -672,13 +672,11 @@ filt_timerattach(struct knote *kn)
if (to < 0)
return (EINVAL);
 
-   ncallouts = atomic_load_explicit(_ncallouts, memory_order_relaxed);
do {
+   ncallouts = kq_ncallouts;
if (ncallouts >= kq_calloutmax)
return (ENOMEM);
-   } while (!atomic_compare_exchange_weak_explicit(_ncallouts,
-   , ncallouts + 1, memory_order_relaxed,
-   memory_order_relaxed));
+   } while (!atomic_cmpset_int(_ncallouts, ncallouts, ncallouts + 1));
 
kn->kn_flags |= EV_CLEAR;   /* automatically set */
kn->kn_status &= ~KN_DETACHED;  /* knlist_add clears it */
@@ -703,7 +701,7 @@ filt_timerdetach(struct knote *kn)
callout_drain(calloutp);
free(calloutp, M_KQUEUE);
free(kn->kn_ptr.p_nexttime, M_KQUEUE);
-   old = atomic_fetch_sub_explicit(_ncallouts, 1, memory_order_relaxed);
+   old = atomic_fetchadd_int(_ncallouts, -1);
KASSERT(old > 0, ("Number of callouts cannot become negative"));
kn->kn_status |= KN_DETACHED;   /* knlist_remove sets it */
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310467 - head/etc

2016-12-23 Thread Ngie Cooper
Author: ngie
Date: Fri Dec 23 08:59:23 2016
New Revision: 310467
URL: https://svnweb.freebsd.org/changeset/base/310467

Log:
  Provide some guidance when dealing with sections and variables contained
  within them
  
  For example, using variables designated for %usm requires uncommenting
  %usm section header
  
  MFC after:1 month

Modified:
  head/etc/snmpd.config

Modified: head/etc/snmpd.config
==
--- head/etc/snmpd.config   Fri Dec 23 08:54:44 2016(r310466)
+++ head/etc/snmpd.config   Fri Dec 23 08:59:23 2016(r310467)
@@ -116,6 +116,14 @@ snmpEnableAuthenTraps = 2
 # modules
 
 #
+# Control configuration for the modules in the module specific sections, e.g.
+# the "usm" module (begemotSnmpdModulePath."usm") can be controlled in the
+# %usm specific section. You must uncomment the section specific header in
+# order to use the enclosed variables, e.g. `usmUserStatus.$(engine).$(user1)`
+# can only be used if %usm is uncommented.
+#
+
+#
 # Bridge module
 #  This requires the mibII module.
 #
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310466 - head/etc

2016-12-23 Thread Ngie Cooper
Author: ngie
Date: Fri Dec 23 08:54:44 2016
New Revision: 310466
URL: https://svnweb.freebsd.org/changeset/base/310466

Log:
  Don't hardcode $(securityModelUSM) (3) in the authPriv example under the %vacm
  section
  
  MFC after:1 week

Modified:
  head/etc/snmpd.config

Modified: head/etc/snmpd.config
==
--- head/etc/snmpd.config   Fri Dec 23 08:52:10 2016(r310465)
+++ head/etc/snmpd.config   Fri Dec 23 08:54:44 2016(r310466)
@@ -256,10 +256,10 @@ begemotSnmpdModulePath."mibII"= "/usr/l
 #
 #Read-write-notify access to restricted for SNMPv3 USM users with authPriv
 #
-# vacmAccessStatus.$(write)."".3.$(authPriv) = 4
-# vacmAccessReadViewName.$(write)."".3.$(authPriv) = "restricted"
-# vacmAccessWriteViewName.$(write)."".3.$(authPriv) = "restricted"
-# vacmAccessNotifyViewName.$(write)."".3.$(authPriv) = "restricted"
+# vacmAccessStatus.$(write)."".$(securityModelUSM).$(authPriv) = 4
+# vacmAccessReadViewName.$(write)."".$(securityModelUSM).$(authPriv) = 
"restricted"
+# vacmAccessWriteViewName.$(write)."".$(securityModelUSM).$(authPriv) = 
"restricted"
+# vacmAccessNotifyViewName.$(write)."".$(securityModelUSM).$(authPriv) = 
"restricted"
 
 #%target
 # Send notifications to target tag "test"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310465 - head/sys/dev/hyperv/utilities

2016-12-23 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Dec 23 08:52:10 2016
New Revision: 310465
URL: https://svnweb.freebsd.org/changeset/base/310465

Log:
  hyperv/ic: Allow applying the samples from hypervisor unconditionally.
  
  MFC after:1 week
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/utilities/vmbus_timesync.c

Modified: head/sys/dev/hyperv/utilities/vmbus_timesync.c
==
--- head/sys/dev/hyperv/utilities/vmbus_timesync.c  Fri Dec 23 08:49:30 
2016(r310464)
+++ head/sys/dev/hyperv/utilities/vmbus_timesync.c  Fri Dec 23 08:52:10 
2016(r310465)
@@ -139,7 +139,7 @@ vmbus_timesync(struct vmbus_ic_softc *sc
}
 
if ((tsflags & VMBUS_ICMSG_TS_FLAG_SAMPLE) &&
-   vmbus_ts_sample_thresh > 0) {
+   vmbus_ts_sample_thresh >= 0) {
int64_t diff;
 
if (vmbus_ts_sample_verbose) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310463 - stable/11/sys/modules/ioat

2016-12-23 Thread Ngie Cooper
Author: ngie
Date: Fri Dec 23 08:44:10 2016
New Revision: 310463
URL: https://svnweb.freebsd.org/changeset/base/310463

Log:
  MFC r309521:
  
  Unbreak "make depend" with sys/modules/ioat by adding opt_ddb.h to SRCS

Modified:
  stable/11/sys/modules/ioat/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/modules/ioat/Makefile
==
--- stable/11/sys/modules/ioat/Makefile Fri Dec 23 08:41:28 2016
(r310462)
+++ stable/11/sys/modules/ioat/Makefile Fri Dec 23 08:44:10 2016
(r310463)
@@ -9,6 +9,7 @@ IOAT_SRC_PATH = ${.CURDIR}/../..
 KMOD=  ioat
 SRCS=  ioat.c ioat_test.c
 SRCS+= device_if.h bus_if.h pci_if.h
+SRCS+= opt_ddb.h
 
 CFLAGS+=   -I${IOAT_SRC_PATH}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310462 - head/sys/dev/hyperv/utilities

2016-12-23 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Dec 23 08:41:28 2016
New Revision: 310462
URL: https://svnweb.freebsd.org/changeset/base/310462

Log:
  hyperv/ic: Fix version4 timesync message format.
  
  It is not compat w/ the old timesync message format, which the message
  type stays the same as the old timesync message.
  
  MFC after:1 week
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/utilities/vmbus_icreg.h
  head/sys/dev/hyperv/utilities/vmbus_timesync.c

Modified: head/sys/dev/hyperv/utilities/vmbus_icreg.h
==
--- head/sys/dev/hyperv/utilities/vmbus_icreg.h Fri Dec 23 08:31:29 2016
(r310461)
+++ head/sys/dev/hyperv/utilities/vmbus_icreg.h Fri Dec 23 08:41:28 2016
(r310462)
@@ -114,8 +114,17 @@ struct vmbus_icmsg_timesync {
struct vmbus_icmsg_hdr  ic_hdr;
uint64_tic_hvtime;
uint64_tic_vmtime;
+   uint64_tic_rtt;
+   uint8_t ic_tsflags; /* VMBUS_ICMSG_TS_FLAG_ */
+} __packed;
+
+/* VMBUS_ICMSG_TYPE_TIMESYNC, MSGVER4 */
+struct vmbus_icmsg_timesync4 {
+   struct vmbus_icmsg_hdr  ic_hdr;
+   uint64_tic_hvtime;
uint64_tic_sent_tc;
uint8_t ic_tsflags; /* VMBUS_ICMSG_TS_FLAG_ */
+   uint8_t ic_rsvd[5];
 } __packed;
 
 #define VMBUS_ICMSG_TS_FLAG_SYNC   0x01

Modified: head/sys/dev/hyperv/utilities/vmbus_timesync.c
==
--- head/sys/dev/hyperv/utilities/vmbus_timesync.c  Fri Dec 23 08:31:29 
2016(r310461)
+++ head/sys/dev/hyperv/utilities/vmbus_timesync.c  Fri Dec 23 08:41:28 
2016(r310462)
@@ -48,8 +48,11 @@ __FBSDID("$FreeBSD$");
 #define VMBUS_TIMESYNC_MSGVER  \
VMBUS_IC_VERSION(VMBUS_TIMESYNC_MSGVER_MAJOR, 0)
 
+#define VMBUS_TIMESYNC_MSGVER4(sc) \
+   VMBUS_ICVER_LE(VMBUS_IC_VERSION(4, 0), (sc)->ic_msgver)
+
 #define VMBUS_TIMESYNC_DORTT(sc)   \
-   ((sc)->ic_msgver >= VMBUS_IC_VERSION(4, 0) && \
+   (VMBUS_TIMESYNC_MSGVER4((sc)) &&\
 (hyperv_features & CPUID_HV_MSR_TIME_REFCNT))
 
 static int vmbus_timesync_probe(device_t);
@@ -174,7 +177,6 @@ vmbus_timesync_cb(struct vmbus_channel *
 {
struct vmbus_ic_softc *sc = xsc;
struct vmbus_icmsg_hdr *hdr;
-   const struct vmbus_icmsg_timesync *msg;
int dlen, error;
uint64_t xactid;
void *data;
@@ -209,14 +211,28 @@ vmbus_timesync_cb(struct vmbus_channel *
break;
 
case VMBUS_ICMSG_TYPE_TIMESYNC:
-   if (dlen < sizeof(*msg)) {
-   device_printf(sc->ic_dev, "invalid timesync len %d\n",
-   dlen);
-   return;
+   if (VMBUS_TIMESYNC_MSGVER4(sc)) {
+   const struct vmbus_icmsg_timesync4 *msg4;
+
+   if (dlen < sizeof(*msg4)) {
+   device_printf(sc->ic_dev, "invalid timesync4 "
+   "len %d\n", dlen);
+   return;
+   }
+   msg4 = data;
+   vmbus_timesync(sc, msg4->ic_hvtime, msg4->ic_sent_tc,
+   msg4->ic_tsflags);
+   } else {
+   const struct vmbus_icmsg_timesync *msg;
+
+   if (dlen < sizeof(*msg)) {
+   device_printf(sc->ic_dev, "invalid timesync "
+   "len %d\n", dlen);
+   return;
+   }
+   msg = data;
+   vmbus_timesync(sc, msg->ic_hvtime, 0, msg->ic_tsflags);
}
-   msg = data;
-   vmbus_timesync(sc, msg->ic_hvtime, msg->ic_sent_tc,
-   msg->ic_tsflags);
break;
 
default:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"