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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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 

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"