svn commit: r332809 - head/usr.bin/grep

2018-04-19 Thread Kyle Evans
Author: kevans
Date: Fri Apr 20 03:29:06 2018
New Revision: 332809
URL: https://svnweb.freebsd.org/changeset/base/332809

Log:
  bsdgrep: Add some TODOs for future work on operating on chunks

Modified:
  head/usr.bin/grep/util.c

Modified: head/usr.bin/grep/util.c
==
--- head/usr.bin/grep/util.cFri Apr 20 03:23:19 2018(r332808)
+++ head/usr.bin/grep/util.cFri Apr 20 03:29:06 2018(r332809)
@@ -65,6 +65,7 @@ static boolfirst_match = true;
  */
 struct parsec {
regmatch_t  matches[MAX_MATCHES];   /* Matches made */
+   /* XXX TODO: This should be a chunk, not a line */
struct str  ln; /* Current line */
size_t  lnstart;/* Position in line */
size_t  matchidx;   /* Latest match index */
@@ -217,6 +218,10 @@ static bool
 procmatches(struct mprintc *mc, struct parsec *pc, bool matched)
 {
 
+   /*
+* XXX TODO: This should loop over pc->matches and handle things on a
+* line-by-line basis, setting up a `struct str` as needed.
+*/
/* Deal with any -B context or context separators */
if (matched) {
if (mc->doctx) {
@@ -327,12 +332,18 @@ procfile(const char *fn)
mcount = mlimit;
 
for (c = 0;  c == 0 || !(lflag || qflag); ) {
+   /*
+* XXX TODO: We need to revisit this in a chunking world. We're
+* not going to be doing per-line statistics because of the
+* overhead involved. procmatches can figure that stuff out as
+* needed. */
/* Reset per-line statistics */
pc.printed = 0;
pc.matchidx = 0;
pc.lnstart = 0;
pc.ln.boff = 0;
pc.ln.off += pc.ln.len + 1;
+   /* XXX TODO: Grab a chunk */
if ((pc.ln.dat = grep_fgetln(f, )) == NULL ||
pc.ln.len == 0)
break;
@@ -587,6 +598,7 @@ procline(struct parsec *pc)
continue;
}
 
+   /* XXX TODO: We will need to keep going, since we're chunky */
/* One pass if we are not recording matches */
if (!wflag && ((color == NULL && !oflag) || qflag || lflag || 
Lflag))
break;
___
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: r332808 - head/sys/powerpc/aim

2018-04-19 Thread Justin Hibbits
Author: jhibbits
Date: Fri Apr 20 03:23:19 2018
New Revision: 332808
URL: https://svnweb.freebsd.org/changeset/base/332808

Log:
  powerpc64: Set n_slbs = 32 for POWER9
  
  Summary:
  POWER9 also contains 32 slbs entries as explained by the POWER9 User Manual:
  
   "For HPT translation, the POWER9 core contains a unified (combined for both
 instruction and data), 32-entry, fully-associative SLB per thread"
  
  Submitted by: Breno Leitao
  Differential Revision: https://reviews.freebsd.org/D15128

Modified:
  head/sys/powerpc/aim/aim_machdep.c

Modified: head/sys/powerpc/aim/aim_machdep.c
==
--- head/sys/powerpc/aim/aim_machdep.c  Fri Apr 20 03:19:44 2018
(r332807)
+++ head/sys/powerpc/aim/aim_machdep.c  Fri Apr 20 03:23:19 2018
(r332808)
@@ -212,6 +212,7 @@ aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_of
case IBMPOWER7PLUS:
case IBMPOWER8:
case IBMPOWER8E:
+   case IBMPOWER9:
/* XXX: get from ibm,slb-size in device tree */
n_slbs = 32;
break;
___
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: r332807 - in head/sys/powerpc: include powerpc

2018-04-19 Thread Justin Hibbits
Author: jhibbits
Date: Fri Apr 20 03:19:44 2018
New Revision: 332807
URL: https://svnweb.freebsd.org/changeset/base/332807

Log:
  powerpc64: Add DSCR support
  
  Summary:
  Powerpc64 has support for a register called Data Stream Control Register
  (DSCR), which basically controls how the hardware controls the caching and
  prefetch for stream operations.
  
  Since mfdscr and mtdscr are privileged instructions, we need to emulate them,
  and
  keep the custom DSCR configuration per thread.
  
  The purpose of this feature is to change DSCR depending on the operation, set
  to DSCR Default Prefetch Depth to deepest on string operations, as memcpy.
  
  Submitted by: Breno Leitao
  Differential Revision: https://reviews.freebsd.org/D15081

Modified:
  head/sys/powerpc/include/pcb.h
  head/sys/powerpc/include/spr.h
  head/sys/powerpc/powerpc/exec_machdep.c
  head/sys/powerpc/powerpc/genassym.c
  head/sys/powerpc/powerpc/swtch64.S

Modified: head/sys/powerpc/include/pcb.h
==
--- head/sys/powerpc/include/pcb.h  Fri Apr 20 03:11:51 2018
(r332806)
+++ head/sys/powerpc/include/pcb.h  Fri Apr 20 03:19:44 2018
(r332807)
@@ -46,14 +46,16 @@ struct pcb {
register_t  pcb_sp; /* stack pointer */
register_t  pcb_toc;/* toc pointer */
register_t  pcb_lr; /* link register */
+   register_t  pcb_dscr;   /* dscr value */
struct  pmap *pcb_pm;   /* pmap of our vmspace */
jmp_buf *pcb_onfault;   /* For use during
copyin/copyout */
int pcb_flags;
-#definePCB_FPU 1   /* Process uses FPU */
-#definePCB_FPREGS  2   /* Process had FPU registers 
initialized */
-#definePCB_VEC 4   /* Process had Altivec initialized */
-#definePCB_VSX 8   /* Process had VSX initialized */
+#definePCB_FPU 0x1 /* Process uses FPU */
+#definePCB_FPREGS  0x2 /* Process had FPU registers 
initialized */
+#definePCB_VEC 0x4 /* Process had Altivec initialized */
+#definePCB_VSX 0x8 /* Process had VSX initialized */
+#definePCB_CDSCR   0x10/* Process had Custom DSCR initialized 
*/
struct fpu {
union {
double fpr;

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Fri Apr 20 03:11:51 2018
(r332806)
+++ head/sys/powerpc/include/spr.h  Fri Apr 20 03:19:44 2018
(r332807)
@@ -97,6 +97,7 @@
 #defineSPR_RTCL_R  0x005   /* .6. 601 RTC Lower - Read */
 #defineSPR_LR  0x008   /* 468 Link Register */
 #defineSPR_CTR 0x009   /* 468 Count Register */
+#defineSPR_DSCR0x011   /* Data Stream Control Register 
*/
 #defineSPR_DSISR   0x012   /* .68 DSI exception source */
 #define  DSISR_DIRECT0x8000 /* Direct-store error 
exception */
 #define  DSISR_NOTFOUND  0x4000 /* Translation not found */

Modified: head/sys/powerpc/powerpc/exec_machdep.c
==
--- head/sys/powerpc/powerpc/exec_machdep.c Fri Apr 20 03:11:51 2018
(r332806)
+++ head/sys/powerpc/powerpc/exec_machdep.c Fri Apr 20 03:19:44 2018
(r332807)
@@ -1021,11 +1021,46 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *
td->td_retval[1] = 0;
 }
 
+static int
+emulate_mfspr(int spr, int reg, struct trapframe *frame){
+   struct thread *td;
+
+   td = curthread;
+
+   if (spr == SPR_DSCR) {
+   // If DSCR was never set, get the default DSCR
+   if ((td->td_pcb->pcb_flags & PCB_CDSCR) == 0)
+   td->td_pcb->pcb_dscr = mfspr(SPR_DSCR);
+
+   frame->fixreg[reg] = td->td_pcb->pcb_dscr;
+   frame->srr0 += 4;
+   return 0;
+   } else
+   return SIGILL;
+}
+
+static int
+emulate_mtspr(int spr, int reg, struct trapframe *frame){
+   struct thread *td;
+
+   td = curthread;
+
+   if (spr == SPR_DSCR) {
+   td->td_pcb->pcb_flags |= PCB_CDSCR;
+   td->td_pcb->pcb_dscr = frame->fixreg[reg];
+   frame->srr0 += 4;
+   return 0;
+   } else
+   return SIGILL;
+}
+
+#define XFX 0xFC0007FF
 int
 ppc_instr_emulate(struct trapframe *frame, struct pcb *pcb)
 {
uint32_t instr;
int reg, sig;
+   int rs, spr;
 
instr = fuword32((void *)frame->srr0);
sig = SIGILL;
@@ -1035,9 +1070,15 @@ 

svn commit: r332806 - head/usr.bin/grep

2018-04-19 Thread Kyle Evans
Author: kevans
Date: Fri Apr 20 03:11:51 2018
New Revision: 332806
URL: https://svnweb.freebsd.org/changeset/base/332806

Log:
  bsdgrep: Clean up procmatches a little bit

Modified:
  head/usr.bin/grep/util.c

Modified: head/usr.bin/grep/util.c
==
--- head/usr.bin/grep/util.cFri Apr 20 03:08:46 2018(r332805)
+++ head/usr.bin/grep/util.cFri Apr 20 03:11:51 2018(r332806)
@@ -218,32 +218,41 @@ procmatches(struct mprintc *mc, struct parsec *pc, boo
 {
 
/* Deal with any -B context or context separators */
-   if (matched && mc->doctx) {
-   if (!first_match && (!mc->same_file || mc->last_outed > 0))
-   printf("--\n");
-   if (Bflag > 0)
-   printqueue();
-   mc->tail = Aflag;
-   }
+   if (matched) {
+   if (mc->doctx) {
+   if (!first_match &&
+   (!mc->same_file || mc->last_outed > 0))
+   printf("--\n");
+   if (Bflag > 0)
+   printqueue();
+   mc->tail = Aflag;
+   }
 
-   /* Print the matching line, but only if not quiet/binary */
-   if (matched && mc->printmatch) {
-   printline(pc, ':');
-   while (pc->matchidx >= MAX_MATCHES) {
-   /* Reset matchidx and try again */
-   pc->matchidx = 0;
-   if (procline(pc) == 0)
-   printline(pc, ':');
-   else
-   break;
+   /* Print the matching line, but only if not quiet/binary */
+   if (mc->printmatch) {
+   printline(pc, ':');
+   while (pc->matchidx >= MAX_MATCHES) {
+   /* Reset matchidx and try again */
+   pc->matchidx = 0;
+   if (procline(pc) == 0)
+   printline(pc, ':');
+   else
+   break;
+   }
+   first_match = false;
+   mc->same_file = true;
+   mc->last_outed = 0;
}
-   first_match = false;
-   mc->same_file = true;
-   mc->last_outed = 0;
-   }
 
-   if (!matched && mc->doctx) {
-   /* Deal with any -A context */
+   /* Count the matches if we have a match limit */
+   if (mflag) {
+   /* XXX TODO: Decrement by number of matched lines */
+   mcount -= 1;
+   if (mflag && mcount <= 0)
+   return (false);
+   }
+   } else if (mc->doctx) {
+   /* Not matching, deal with any -A context as needed */
if (mc->tail > 0) {
grep_printline(>ln, '-');
mc->tail--;
@@ -260,14 +269,6 @@ procmatches(struct mprintc *mc, struct parsec *pc, boo
if (Bflag == 0 || (Bflag > 0 && enqueue(>ln)))
++mc->last_outed;
}
-   }
-
-   /* Count the matches if we have a match limit */
-   if (matched && mflag) {
-   /* XXX TODO: Decrement by number of matched lines */
-   mcount -= 1;
-   if (mflag && mcount <= 0)
-   return (false);
}
 
return (true);
___
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: r332805 - head/usr.bin/grep

2018-04-19 Thread Kyle Evans
Author: kevans
Date: Fri Apr 20 03:08:46 2018
New Revision: 332805
URL: https://svnweb.freebsd.org/changeset/base/332805

Log:
  bsdgrep: Split match processing out of procfile
  
  procfile is getting kind of hairy, and it's not going to get better as we
  correct some more bits that assume we process one line at a time.

Modified:
  head/usr.bin/grep/util.c

Modified: head/usr.bin/grep/util.c
==
--- head/usr.bin/grep/util.cFri Apr 20 01:25:48 2018(r332804)
+++ head/usr.bin/grep/util.cFri Apr 20 03:08:46 2018(r332805)
@@ -72,6 +72,18 @@ struct parsec {
boolbinary; /* Binary file? */
 };
 
+/*
+ * Match printing context
+ */
+struct mprintc {
+   long long   tail;   /* Number of trailing lines to record */
+   int last_outed; /* Number of lines since last output */
+   booldoctx;  /* Printing context? */
+   boolprintmatch; /* Printing matches? */
+   boolsame_file;  /* Same file as previously printed? */
+};
+
+static bool procmatches(struct mprintc *mc, struct parsec *pc, bool matched);
 #ifdef WITH_INTERNAL_NOSPEC
 static int litexec(const struct pat *pat, const char *string,
 size_t nmatch, regmatch_t pmatch[]);
@@ -197,6 +209,71 @@ grep_tree(char **argv)
 }
 
 /*
+ * Process any matches in the current parsing context, return a boolean
+ * indicating whether we should halt any further processing or not. 'true' to
+ * continue processing, 'false' to halt.
+ */
+static bool
+procmatches(struct mprintc *mc, struct parsec *pc, bool matched)
+{
+
+   /* Deal with any -B context or context separators */
+   if (matched && mc->doctx) {
+   if (!first_match && (!mc->same_file || mc->last_outed > 0))
+   printf("--\n");
+   if (Bflag > 0)
+   printqueue();
+   mc->tail = Aflag;
+   }
+
+   /* Print the matching line, but only if not quiet/binary */
+   if (matched && mc->printmatch) {
+   printline(pc, ':');
+   while (pc->matchidx >= MAX_MATCHES) {
+   /* Reset matchidx and try again */
+   pc->matchidx = 0;
+   if (procline(pc) == 0)
+   printline(pc, ':');
+   else
+   break;
+   }
+   first_match = false;
+   mc->same_file = true;
+   mc->last_outed = 0;
+   }
+
+   if (!matched && mc->doctx) {
+   /* Deal with any -A context */
+   if (mc->tail > 0) {
+   grep_printline(>ln, '-');
+   mc->tail--;
+   if (Bflag > 0)
+   clearqueue();
+   } else {
+   /*
+* Enqueue non-matching lines for -B context.
+* If we're not actually doing -B context or if
+* the enqueue resulted in a line being rotated
+* out, then go ahead and increment last_outed
+* to signify a gap between context/match.
+*/
+   if (Bflag == 0 || (Bflag > 0 && enqueue(>ln)))
+   ++mc->last_outed;
+   }
+   }
+
+   /* Count the matches if we have a match limit */
+   if (matched && mflag) {
+   /* XXX TODO: Decrement by number of matched lines */
+   mcount -= 1;
+   if (mflag && mcount <= 0)
+   return (false);
+   }
+
+   return (true);
+}
+
+/*
  * Opens a file and processes it.  Each file is processed line-by-line
  * passing the lines to procline().
  */
@@ -204,13 +281,11 @@ int
 procfile(const char *fn)
 {
struct parsec pc;
-   long long tail;
+   struct mprintc mc;
struct file *f;
struct stat sb;
-   struct str *ln;
mode_t s;
-   int c, last_outed, t;
-   bool doctx, printmatch, same_file;
+   int c, t;
 
if (strcmp(fn, "-") == 0) {
fn = label != NULL ? label : getstr(1);
@@ -234,8 +309,6 @@ procfile(const char *fn)
return (0);
}
 
-   /* Convenience */
-   ln = 
pc.ln.file = grep_malloc(strlen(fn) + 1);
strcpy(pc.ln.file, fn);
pc.ln.line_no = 0;
@@ -243,17 +316,13 @@ procfile(const char *fn)
pc.ln.boff = 0;
pc.ln.off = -1;
pc.binary = f->binary;
-   pc.printed = 0;
-   tail = 0;
-   last_outed = 0;
-   same_file = false;
-   doctx = false;
-   printmatch = true;
+   memset(, 0, sizeof(mc));
+   mc.printmatch = true;
if ((pc.binary && binbehave == BINFILE_BIN) || cflag || qflag 

svn commit: r332803 - head/lib/clang/include/lld/Common

2018-04-19 Thread Ed Maste
Author: emaste
Date: Fri Apr 20 00:59:53 2018
New Revision: 332803
URL: https://svnweb.freebsd.org/changeset/base/332803

Log:
  lld: use correct number of digits in __FreeBSD_version-style ID
  
  __FreeBSD_version-style IDs should have 5 digits following the major.

Modified:
  head/lib/clang/include/lld/Common/Version.inc

Modified: head/lib/clang/include/lld/Common/Version.inc
==
--- head/lib/clang/include/lld/Common/Version.inc   Fri Apr 20 00:02:47 
2018(r332802)
+++ head/lib/clang/include/lld/Common/Version.inc   Fri Apr 20 00:59:53 
2018(r332803)
@@ -7,4 +7,4 @@
 
 #define LLD_REPOSITORY_STRING "FreeBSD"
 // -
-#define LLD_REVISION_STRING "326565-120001"
+#define LLD_REVISION_STRING "326565-121"
___
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: r332796 - head/tools/tools/sortbench

2018-04-19 Thread Brooks Davis
On Thu, Apr 19, 2018 at 04:53:03PM -0700, Rodney W. Grimes wrote:
> -- Start of PGP signed section.
> > The goal is to replace our merge sort with its weird limitations (you
> > can't sort things smaller than int on amd64 and it doesn't work with
> > pointer integrity schemes) with wikisort.  This and improvements to the
> > tests are the first steps in the process.
> 
> Couldnt this be a port, as most other benchmarks?
> Especially since it requires python to run.

I suppose it could, but it's intended to support and measure our base
system.  It's tiny, and the python orchestration is optional.  If people
really dislike the idea, we'll just put it on github.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r332796 - head/tools/tools/sortbench

2018-04-19 Thread Rodney W. Grimes
-- Start of PGP signed section.
> The goal is to replace our merge sort with its weird limitations (you
> can't sort things smaller than int on amd64 and it doesn't work with
> pointer integrity schemes) with wikisort.  This and improvements to the
> tests are the first steps in the process.
> 
> -- Brooks

Couldnt this be a port, as most other benchmarks?
Especially since it requires python to run.

> 
> On Thu, Apr 19, 2018 at 04:28:47PM -0700, Conrad Meyer wrote:
> > The commit log describes what the commit does, but not why it was
> > made.  What's the eventual goal / direction that this change leads to?
> > 
> > (The Phabricator revision doesn't elaborate further either.)
> > 
> > Thanks,
> > Conrad
> > 
> > On Thu, Apr 19, 2018 at 2:53 PM, Brooks Davis  wrote:
> > > Author: brooks
> > > Date: Thu Apr 19 21:53:57 2018
> > > New Revision: 332796
> > > URL: https://svnweb.freebsd.org/changeset/base/332796
> > >
> > > Log:
> > >   Add sortbench.
> > >
> > >   This is a set of benchmarks of qsort, mergesort, heapsort, and
> > >   optionally wikisort and a script to run them.
> > 
-- End of PGP section, PGP failed!

-- 
Rod Grimes rgri...@freebsd.org
___
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: r332796 - head/tools/tools/sortbench

2018-04-19 Thread Brooks Davis
The goal is to replace our merge sort with its weird limitations (you
can't sort things smaller than int on amd64 and it doesn't work with
pointer integrity schemes) with wikisort.  This and improvements to the
tests are the first steps in the process.

-- Brooks

On Thu, Apr 19, 2018 at 04:28:47PM -0700, Conrad Meyer wrote:
> The commit log describes what the commit does, but not why it was
> made.  What's the eventual goal / direction that this change leads to?
> 
> (The Phabricator revision doesn't elaborate further either.)
> 
> Thanks,
> Conrad
> 
> On Thu, Apr 19, 2018 at 2:53 PM, Brooks Davis  wrote:
> > Author: brooks
> > Date: Thu Apr 19 21:53:57 2018
> > New Revision: 332796
> > URL: https://svnweb.freebsd.org/changeset/base/332796
> >
> > Log:
> >   Add sortbench.
> >
> >   This is a set of benchmarks of qsort, mergesort, heapsort, and
> >   optionally wikisort and a script to run them.
> 


signature.asc
Description: PGP signature


Re: svn commit: r332796 - head/tools/tools/sortbench

2018-04-19 Thread Conrad Meyer
The commit log describes what the commit does, but not why it was
made.  What's the eventual goal / direction that this change leads to?

(The Phabricator revision doesn't elaborate further either.)

Thanks,
Conrad

On Thu, Apr 19, 2018 at 2:53 PM, Brooks Davis  wrote:
> Author: brooks
> Date: Thu Apr 19 21:53:57 2018
> New Revision: 332796
> URL: https://svnweb.freebsd.org/changeset/base/332796
>
> Log:
>   Add sortbench.
>
>   This is a set of benchmarks of qsort, mergesort, heapsort, and
>   optionally wikisort and a script to run them.
___
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: r332798 - head/tools/diag/prtblknos

2018-04-19 Thread Kirk McKusick
Author: mckusick
Date: Thu Apr 19 22:43:55 2018
New Revision: 332798
URL: https://svnweb.freebsd.org/changeset/base/332798

Log:
  Fix incorrect output for a file consisting of a single full-size
  block followed by a discontiguous fragment.
  
  Add checks for unallocated inodes and inodes with unknown mode
  types.
  
  Cleanup variable declarations by changing from type `int' to types
  like ufs_lbn_t, ufs2_daddr_t, etc.
  
  Reported by: bde

Modified:
  head/tools/diag/prtblknos/Makefile
  head/tools/diag/prtblknos/main.c
  head/tools/diag/prtblknos/prtblknos.c

Modified: head/tools/diag/prtblknos/Makefile
==
--- head/tools/diag/prtblknos/Makefile  Thu Apr 19 22:28:41 2018
(r332797)
+++ head/tools/diag/prtblknos/Makefile  Thu Apr 19 22:43:55 2018
(r332798)
@@ -9,6 +9,8 @@ SRCS=   main.c prtblknos.c
 
 LIBADD+=ufs
 
+WARNS?=3
+
 test:  ${PROG}
./${PROG} > a
 

Modified: head/tools/diag/prtblknos/main.c
==
--- head/tools/diag/prtblknos/main.cThu Apr 19 22:28:41 2018
(r332797)
+++ head/tools/diag/prtblknos/main.cThu Apr 19 22:43:55 2018
(r332798)
@@ -53,14 +53,17 @@ main(argc, argv)
struct statfs sfb;
char *xargv[4];
char ibuf[64];
-   char *fsname;
-   int inonum, error;
+   char *fsname, *filename;
+   ino_t inonum;
+   int error;
 
+   filename = NULL;
if (argc == 2) {
-   if (stat(argv[1], ) != 0)
-   err(1, "stat(%s)", argv[1]);
-   if (statfs(argv[1], ) != 0)
-   err(1, "statfs(%s)", argv[1]);
+   filename = argv[1];
+   if (lstat(filename, ) != 0)
+   err(1, "stat(%s)", filename);
+   if (statfs(filename, ) != 0)
+   err(1, "statfs(%s)", filename);
xargv[0] = argv[0];
xargv[1] = sfb.f_mntfromname;
sprintf(ibuf, "%jd", (intmax_t)sb.st_ino);
@@ -87,12 +90,17 @@ main(argc, argv)
while (*++argv) {
/* get the inode number. */
if ((inonum = atoi(*argv)) <= 0 ||
-inonum >= fs->fs_ipg * fs->fs_ncg)
+inonum >= (ino_t)fs->fs_ipg * fs->fs_ncg)
warnx("%s is not a valid inode number", *argv);
-   (void)printf("%d: ", inonum);
+   if (filename == NULL)
+   (void)printf("inode #%jd: ", (intmax_t)inonum);
+   else
+   (void)printf("%s (inode #%jd): ", filename,
+   (intmax_t)inonum);
 
if ((error = getino(, (void **), inonum, NULL)) < 0)
-   warn("Read of inode %d on %s failed", inonum, fsname);
+   warn("Read of inode %jd on %s failed",
+   (intmax_t)inonum, fsname);
 
prtblknos(, dp);
}

Modified: head/tools/diag/prtblknos/prtblknos.c
==
--- head/tools/diag/prtblknos/prtblknos.c   Thu Apr 19 22:28:41 2018
(r332797)
+++ head/tools/diag/prtblknos/prtblknos.c   Thu Apr 19 22:43:55 2018
(r332798)
@@ -40,16 +40,18 @@ union dinode {
 
 void prtblknos(struct uufsd *disk, union dinode *dp);
 
-static void  indirprt(struct uufsd *, int, int, int, ufs2_daddr_t, int);
-static char *distance(struct fs *, daddr_t, daddr_t);
-static void  printblk(struct fs *, int, ufs2_daddr_t, int, int);
+static const char *distance(struct fs *, ufs2_daddr_t, ufs2_daddr_t);
+static void  printblk(struct fs *, ufs_lbn_t, ufs2_daddr_t, int, ufs_lbn_t);
+static void  indirprt(struct uufsd *, int, ufs_lbn_t, ufs_lbn_t, ufs2_daddr_t,
+   ufs_lbn_t);
 
 void
 prtblknos(disk, dp)
struct uufsd *disk;
union dinode *dp;
 {
-   int i, len, lbn, mode, frags, numblks, blksperindir;
+   int i, mode, frags;
+   ufs_lbn_t lbn, lastlbn, len, blksperindir;
ufs2_daddr_t blkno;
struct fs *fs;
off_t size;
@@ -63,6 +65,12 @@ prtblknos(disk, dp)
mode = dp->dp2.di_mode;
}
switch (mode & IFMT) {
+   default:
+   printf("unknown inode type 0%d\n", (mode & IFMT));
+   return;
+   case 0:
+   printf("unallocated inode\n");
+   return;
case IFIFO:
printf("fifo\n");
return;
@@ -97,20 +105,20 @@ prtblknos(disk, dp)
printf("empty file\n");
return;
}
-   printf("regular file, size %ld\n", size);
+   printf("regular file, size %jd\n", (intmax_t)size);
break;
case IFDIR:
if (size == 0) {

svn commit: r332796 - head/tools/tools/sortbench

2018-04-19 Thread Brooks Davis
Author: brooks
Date: Thu Apr 19 21:53:57 2018
New Revision: 332796
URL: https://svnweb.freebsd.org/changeset/base/332796

Log:
  Add sortbench.
  
  This is a set of benchmarks of qsort, mergesort, heapsort, and
  optionally wikisort and a script to run them.
  
  Submitted by: Miles Fertel 
  Sponsored by: Google Summer of Code 2017
  Differential Revision:https://reviews.freebsd.org/D12677

Added:
  head/tools/tools/sortbench/
  head/tools/tools/sortbench/Makefile   (contents, props changed)
  head/tools/tools/sortbench/README   (contents, props changed)
  head/tools/tools/sortbench/bench.py   (contents, props changed)
  head/tools/tools/sortbench/sort_bench.c   (contents, props changed)

Added: head/tools/tools/sortbench/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/sortbench/Makefile Thu Apr 19 21:53:57 2018
(r332796)
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+PROG=  sort_bench
+MAN=
+
+LIBADD=m
+
+.ifdef WITH_WIKISORT
+CFLAGS=-I${SRCTOP}/lib/libc -DWIKI
+.endif
+
+CLEANDIRS= stats
+ELEMENT_BITS=  20
+bench: .PHONY
+   ${.CURDIR}/bench.py ${ELEMENT_BITS}
+   @echo "See results in ${.OBJDIR}/stats"
+
+.include 

Added: head/tools/tools/sortbench/README
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/sortbench/README   Thu Apr 19 21:53:57 2018
(r332796)
@@ -0,0 +1,17 @@
+$FreeBSD$
+
+Running:
+1. Compile mergesort_bench.c into mergesort_bench
+2. Run bench.py with python bench.py [elts]
+2a. Bench will optionally run 2 ^ elts elements as the dataset size when 
provided. Otherwise it will run 2 ^ 20 elements.
+
+Output:
+Files will be output in a new folder called stats with separate files for each 
statistical comparison and the raw results in a subfolder called data.
+This files will contain the results of the running of ministat with time 
required to sort as the dataset.
+
+Modifications:
+Change bench.py's WIKI variable to be true if you have wiki.c implemented and 
want to test it.
+
+As the script runs, it is running each of the stdlib sorting algorithms (and 
wikisort if provided) with 2 ^ elts elements,
+5 trials of the sort time as it's output. That output is saved in the data 
folder and then passed into the command line
+utility ministat which then provides the confidence interval of difference 
between the data in stats folder.

Added: head/tools/tools/sortbench/bench.py
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/sortbench/bench.py Thu Apr 19 21:53:57 2018
(r332796)
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+"""
+Copyright (c) 2017 Miles Fertel
+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.
+
+ $FreeBSD$
+"""
+
+from time import time
+import os
+import sys
+
+WIKI = False
+sorts=["heap", "merge", "quick"]
+if (WIKI):
+sorts.append("wiki")
+tests=["rand", "sort", "rev", "part"]
+runs = 5
+trials = 5
+outdir = "stats"
+datadir = '{}/data'.format(outdir)
+progname = "sort_bench"
+try:
+elts = sys.argv[1]
+except:
+elts = 20
+
+if (not os.path.isdir(datadir)):
+os.makedirs(datadir)
+
+for test in tests:
+files = []
+for sort in sorts:
+filename = '{}/{}{}'.format(datadir, test, sort)
+files.append(filename)
+with open(filename, 'w+') as f:
+for _ in range(trials):
+start = time()
+ret = os.system('./{} {} {} {} {}'.format(progname, sort, 
test, runs, 

svn commit: r332794 - in head: share/mk stand/i386

2018-04-19 Thread Ed Maste
Author: emaste
Date: Thu Apr 19 20:58:09 2018
New Revision: 332794
URL: https://svnweb.freebsd.org/changeset/base/332794

Log:
  Add support for linker-type-specific flags
  
  r332090 added a LINKER_TYPE test to add the --no-rosegment flag when
  linking the i386 loader components with lld.  Instead, introduce a
  general mechanism for setting LDFLAGS for a specific linker type,
  and use it for --no-rosegment.
  
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D14998

Modified:
  head/share/mk/bsd.sys.mk
  head/stand/i386/Makefile.inc

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkThu Apr 19 20:47:53 2018(r332793)
+++ head/share/mk/bsd.sys.mkThu Apr 19 20:58:09 2018(r332794)
@@ -226,6 +226,8 @@ ACFLAGS+=   ${ACFLAGS.${.IMPSRC:T}}
 CFLAGS+=   ${CFLAGS.${.IMPSRC:T}}
 CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}}
 
+LDFLAGS+=  ${LDFLAGS.${LINKER_TYPE}}
+
 .if defined(SRCTOP)
 # Prevent rebuilding during install to support read-only objdirs.
 .if ${.TARGETS:M*install*} == ${.TARGETS} && empty(.MAKE.MODE:Mmeta)

Modified: head/stand/i386/Makefile.inc
==
--- head/stand/i386/Makefile.incThu Apr 19 20:47:53 2018
(r332793)
+++ head/stand/i386/Makefile.incThu Apr 19 20:58:09 2018
(r332794)
@@ -2,13 +2,9 @@
 #
 # $FreeBSD$
 
-.sinclude 
-
 LOADER_ADDRESS?=0x20
 LDFLAGS+=  -nostdlib
-.if defined(LINKER_TYPE) && ${LINKER_TYPE} == "lld"
-LDFLAGS+=  -Wl,--no-rosegment
-.endif
+LDFLAGS.lld+=  -Wl,--no-rosegment
 
 # BTX components
 BTXDIR=${BOOTOBJ}/i386/btx
___
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: r332782 - in head/sys: amd64/linux amd64/linux32 compat/freebsd32 i386/linux kern sys

2018-04-19 Thread Ed Maste
On 19 April 2018 at 12:49, Brooks Davis  wrote:
>
> I do wonder if allocating AT_COUNT entries is quite right since some are
> emitted only optionally.  That said, it's not as though the waste is
> significant.

I think it's only a minor concern and not worth worrying about too
much, but John and I recently discussed the relationship between
sv_copyout_strings and sv_fixup and some more rework in this area
could address this too.
___
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: r332792 - in head/lib: libc/riscv libc/riscv/gen msun/riscv

2018-04-19 Thread Brooks Davis
Author: brooks
Date: Thu Apr 19 20:36:15 2018
New Revision: 332792
URL: https://svnweb.freebsd.org/changeset/base/332792

Log:
  Replace SOFTFLOAT with __riscv_float_abi_*.
  
  With SOFTFLOAT, libc and libm were built correctly, but any program
  including fenv.h itself assumed it was on a hardfloat systen and emitted
  inline fpu instructions for fedisableexcept() and friends.
  
  Unlike r315424 which did this for MIPS, I've used riscv_float_abi_soft
  and riscv_float_abi_double macros as appropriate rather than using
  __riscv_float_abi_soft exclusively.  This ensures that attempts to use an
  unsupported hardfloat ABI will fail.
  
  Reviewed by:  br
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10039

Modified:
  head/lib/libc/riscv/Makefile.inc
  head/lib/libc/riscv/gen/_setjmp.S
  head/lib/libc/riscv/gen/fabs.S
  head/lib/libc/riscv/gen/flt_rounds.c
  head/lib/libc/riscv/gen/setjmp.S
  head/lib/msun/riscv/Makefile.inc
  head/lib/msun/riscv/fenv.c
  head/lib/msun/riscv/fenv.h

Modified: head/lib/libc/riscv/Makefile.inc
==
--- head/lib/libc/riscv/Makefile.incThu Apr 19 20:31:52 2018
(r332791)
+++ head/lib/libc/riscv/Makefile.incThu Apr 19 20:36:15 2018
(r332792)
@@ -3,10 +3,6 @@
 # Machine dependent definitions for the RISC-V architecture.
 #
 
-.if ${MACHINE_ARCH:Mriscv*sf} != ""
-CFLAGS+=-DSOFTFLOAT
-.endif
-
 # Long double is quad precision
 GDTOASRCS+=strtorQ.c
 SRCS+=machdep_ldisQ.c

Modified: head/lib/libc/riscv/gen/_setjmp.S
==
--- head/lib/libc/riscv/gen/_setjmp.S   Thu Apr 19 20:31:52 2018
(r332791)
+++ head/lib/libc/riscv/gen/_setjmp.S   Thu Apr 19 20:36:15 2018
(r332792)
@@ -61,7 +61,7 @@ ENTRY(_setjmp)
sd  ra, (12 * 8)(a0)
addia0, a0, (13 * 8)
 
-#if !defined(_STANDALONE) && !defined(SOFTFLOAT)
+#if !defined(_STANDALONE) && defined(__riscv_float_abi_double)
/* Store the fpe registers */
fsd fs0, (0 * 16)(a0)
fsd fs1, (1 * 16)(a0)
@@ -114,7 +114,7 @@ ENTRY(_longjmp)
ld  ra, (12 * 8)(a0)
addia0, a0, (13 * 8)
 
-#if !defined(_STANDALONE) && !defined(SOFTFLOAT)
+#if !defined(_STANDALONE) && defined(__riscv_float_abi_double)
/* Restore the fpe registers */
fld fs0, (0 * 16)(a0)
fld fs1, (1 * 16)(a0)

Modified: head/lib/libc/riscv/gen/fabs.S
==
--- head/lib/libc/riscv/gen/fabs.S  Thu Apr 19 20:31:52 2018
(r332791)
+++ head/lib/libc/riscv/gen/fabs.S  Thu Apr 19 20:36:15 2018
(r332792)
@@ -35,7 +35,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#ifndef SOFTFLOAT
+#ifdef __riscv_float_abi_double
 ENTRY(fabs)
fabs.d  fa0, fa0
ret

Modified: head/lib/libc/riscv/gen/flt_rounds.c
==
--- head/lib/libc/riscv/gen/flt_rounds.cThu Apr 19 20:31:52 2018
(r332791)
+++ head/lib/libc/riscv/gen/flt_rounds.cThu Apr 19 20:36:15 2018
(r332792)
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#ifdef SOFTFLOAT
+#ifdef __riscv_float_abi_soft
 #include "softfloat-for-gcc.h"
 #include "milieu.h"
 #include "softfloat.h"
@@ -51,7 +51,7 @@ __flt_rounds(void)
 {
uint64_t mode;
 
-#ifdef SOFTFLOAT
+#ifdef __riscv_float_abi_soft
mode = __softfloat_float_rounding_mode;
 #else
__asm __volatile("csrr %0, fcsr" : "=r" (mode));

Modified: head/lib/libc/riscv/gen/setjmp.S
==
--- head/lib/libc/riscv/gen/setjmp.SThu Apr 19 20:31:52 2018
(r332791)
+++ head/lib/libc/riscv/gen/setjmp.SThu Apr 19 20:36:15 2018
(r332792)
@@ -75,7 +75,7 @@ ENTRY(setjmp)
sd  ra, (12 * 8)(a0)
addia0, a0, (13 * 8)
 
-#ifndef SOFTFLOAT
+#ifdef __riscv_float_abi_double
/* Store the fpe registers */
fsd fs0, (0 * 16)(a0)
fsd fs1, (1 * 16)(a0)
@@ -144,7 +144,7 @@ ENTRY(longjmp)
ld  ra, (12 * 8)(a0)
addia0, a0, (13 * 8)
 
-#ifndef SOFTFLOAT
+#ifdef __riscv_float_abi_double
/* Restore the fpe registers */
fld fs0, (0 * 16)(a0)
fld fs1, (1 * 16)(a0)

Modified: head/lib/msun/riscv/Makefile.inc
==
--- head/lib/msun/riscv/Makefile.incThu Apr 19 20:31:52 2018
(r332791)
+++ head/lib/msun/riscv/Makefile.incThu Apr 19 20:36:15 2018
(r332792)
@@ -1,8 +1,4 @@
 # $FreeBSD$
 
-.if ${MACHINE_ARCH:Mriscv*sf} != ""
-CFLAGS+=-DSOFTFLOAT
-.endif
-
 LDBL_PREC = 113
 SYM_MAPS += ${.CURDIR}/riscv/Symbol.map

Modified: head/lib/msun/riscv/fenv.c

svn commit: r332791 - head/sys/modules/random

2018-04-19 Thread Mark Murray
Author: markm
Date: Thu Apr 19 20:31:52 2018
New Revision: 332791
URL: https://svnweb.freebsd.org/changeset/base/332791

Log:
  Remove empty dir no longer required.
  
  Reported by:  Jung-uk Kim

Deleted:
  head/sys/modules/random/
___
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: r332790 - head/sys/fs/nfsserver

2018-04-19 Thread Rick Macklem
Author: rmacklem
Date: Thu Apr 19 20:30:33 2018
New Revision: 332790
URL: https://svnweb.freebsd.org/changeset/base/332790

Log:
  Fix OpenDowngrade for NFSv4.1 if a client sets the OPEN_SHARE_ACCESS_WANT* 
bits.
  
  The NFSv4.1 RFC specifies that the OPEN_SHARE_ACCESS_WANT bits can be set
  in the OpenDowngrade share_access argument and are basically ignored.
  I do not know of a extant NFSv4.1 client that does this, but this little
  patch fixes it just in case.
  It also changes the error from NFSERR_BADXDR to NFSERR_INVAL since the NFSv4.1
  RFC specifies this as the error to be returned if bogus bits are set.
  (The NFSv4.0 RFC didn't specify any error for this, so the error reply can
   be changed for NFSv4.0 as well.)
  Found by inspection while looking at a problem with OpenDowngrade reported
  for the ESXi 6.5 NFSv4.1 client.
  
  Reported by:  andreas.n...@frequentis.com
  PR:   227214
  MFC after:1 week

Modified:
  head/sys/fs/nfsserver/nfs_nfsdserv.c

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- head/sys/fs/nfsserver/nfs_nfsdserv.cThu Apr 19 20:25:19 2018
(r332789)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.cThu Apr 19 20:30:33 2018
(r332790)
@@ -3237,6 +3237,8 @@ nfsrvd_opendowngrade(struct nfsrv_descript *nd, __unus
tl += (NFSX_STATEIDOTHER / NFSX_UNSIGNED);
stp->ls_seq = fxdr_unsigned(u_int32_t, *tl++);
i = fxdr_unsigned(int, *tl++);
+   if ((nd->nd_flag & ND_NFSV41) != 0)
+   i &= ~NFSV4OPEN_WANTDELEGMASK;
switch (i) {
case NFSV4OPEN_ACCESSREAD:
stp->ls_flags = (NFSLCK_READACCESS | NFSLCK_DOWNGRADE);
@@ -3249,7 +3251,7 @@ nfsrvd_opendowngrade(struct nfsrv_descript *nd, __unus
NFSLCK_DOWNGRADE);
break;
default:
-   nd->nd_repstat = NFSERR_BADXDR;
+   nd->nd_repstat = NFSERR_INVAL;
}
i = fxdr_unsigned(int, *tl);
switch (i) {
@@ -3265,7 +3267,7 @@ nfsrvd_opendowngrade(struct nfsrv_descript *nd, __unus
stp->ls_flags |= (NFSLCK_READDENY | NFSLCK_WRITEDENY);
break;
default:
-   nd->nd_repstat = NFSERR_BADXDR;
+   nd->nd_repstat = NFSERR_INVAL;
}
 
clientid.lval[0] = stp->ls_stateid.other[0];
___
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: r332789 - head/usr.sbin/pwd_mkdb

2018-04-19 Thread Ed Maste
Author: emaste
Date: Thu Apr 19 20:25:19 2018
New Revision: 332789
URL: https://svnweb.freebsd.org/changeset/base/332789

Log:
  pwd_mkdb: warn that legacy support is deprecated (if specified)
  
  r283981 switched pwd_mkdb to emit only v4 database entries by default,
  and introduced a -l (legacy) option emit v3 entries in addition.  The
  commit message claims that legacy support will be removed in 12.0, so
  emit a warning now if it is used.

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

Modified: head/usr.sbin/pwd_mkdb/pwd_mkdb.c
==
--- head/usr.sbin/pwd_mkdb/pwd_mkdb.c   Thu Apr 19 18:34:38 2018
(r332788)
+++ head/usr.sbin/pwd_mkdb/pwd_mkdb.c   Thu Apr 19 20:25:19 2018
(r332789)
@@ -166,6 +166,8 @@ main(int argc, char *argv[])
 
if (argc != 1 || (username && (*username == '+' || *username == '-')))
usage();
+   if (lflag)
+   warnx("legacy (v3) database format support is deprecated");
 
/*
 * This could be changed to allow the user to interrupt.
___
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: r332788 - head/sys/powerpc/aim

2018-04-19 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Apr 19 18:34:38 2018
New Revision: 332788
URL: https://svnweb.freebsd.org/changeset/base/332788

Log:
  Fix detection of memory overlap with the kernel in the case where a memory
  region marked "available" by firmware is contained entirely in the kernel.
  
  This had a tendency to happen with FDTs passed by loader, though could for
  other reasons as well, and would result in the kernel slowly cannibalizing
  itself for other purposes, eventually resulting in a crash.
  
  A similar fix is needed for mmu_oea.c and should probably just be rolled
  at that point into some generic code in platform.c for taking a mem_region
  list and removing chunks.
  
  PR:   226974
  Submitted by: leandro.lup...@gmail.com
  Reviewed by:  jhibbits
  Differential Revision:D15121

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cThu Apr 19 18:10:44 2018
(r332787)
+++ head/sys/powerpc/aim/mmu_oea64.cThu Apr 19 18:34:38 2018
(r332788)
@@ -695,12 +695,27 @@ moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernel
unmapped_buf_allowed = hw_direct_map;
 }
 
+/* Quick sort callout for comparing physical addresses. */
+static int
+pa_cmp(const void *a, const void *b)
+{
+   const vm_paddr_t *pa = a, *pb = b;
+
+   if (*pa < *pb)
+   return (-1);
+   else if (*pa > *pb)
+   return (1);
+   else
+   return (0);
+}
+
 void
 moea64_early_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t 
kernelend)
 {
int i, j;
vm_size_t   physsz, hwphyssz;
vm_paddr_t  kernelphysstart, kernelphysend;
+   int rm_pavail;
 
 #ifndef __powerpc64__
/* We don't have a direct map since there is no BAT */
@@ -763,10 +778,18 @@ moea64_early_bootstrap(mmu_t mmup, vm_offset_t kernels
}
 
/* Check for overlap with the kernel and exception vectors */
+   rm_pavail = 0;
for (j = 0; j < 2*phys_avail_count; j+=2) {
if (phys_avail[j] < EXC_LAST)
phys_avail[j] += EXC_LAST;
 
+   if (phys_avail[j] >= kernelphysstart &&
+   phys_avail[j+1] <= kernelphysend) {
+   phys_avail[j] = phys_avail[j+1] = ~0;
+   rm_pavail++;
+   continue;
+   }
+
if (kernelphysstart >= phys_avail[j] &&
kernelphysstart < phys_avail[j+1]) {
if (kernelphysend < phys_avail[j+1]) {
@@ -792,6 +815,16 @@ moea64_early_bootstrap(mmu_t mmup, vm_offset_t kernels
phys_avail[j] = (kernelphysend & ~PAGE_MASK) +
PAGE_SIZE;
}
+   }
+
+   /* Remove physical available regions marked for removal (~0) */
+   if (rm_pavail) {
+   qsort(phys_avail, 2*phys_avail_count, sizeof(phys_avail[0]),
+   pa_cmp);
+   phys_avail_count -= rm_pavail;
+   for (i = 2*phys_avail_count;
+i < 2*(phys_avail_count + rm_pavail); i+=2)
+   phys_avail[i] = phys_avail[i+1] = 0;
}
 
physmem = btoc(physsz);
___
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: r332787 - head/sys/dev/cxgbe/tom

2018-04-19 Thread Navdeep Parhar
Author: np
Date: Thu Apr 19 18:10:44 2018
New Revision: 332787
URL: https://svnweb.freebsd.org/changeset/base/332787

Log:
  cxgbe(4): Fix bugs in the handling of COP rules that match on VLAN tag.
  
  Retrieve the tag from the correct ifnet and use the provided tag
  (instead of hardcoded 0x, implying no tag) in the routines that
  process offload policy.
  
  Submitted by: Krishnamraju Eraparaju @ Chelsio
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_connect.c
  head/sys/dev/cxgbe/tom/t4_tom.c

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==
--- head/sys/dev/cxgbe/tom/t4_connect.c Thu Apr 19 18:08:46 2018
(r332786)
+++ head/sys/dev/cxgbe/tom/t4_connect.c Thu Apr 19 18:10:44 2018
(r332787)
@@ -405,7 +405,7 @@ t4_connect(struct toedev *tod, struct socket *so, stru
struct ifnet *ifp = VLAN_COOKIE(rt_ifp);
 
vi = ifp->if_softc;
-   VLAN_TAG(ifp, );
+   VLAN_TAG(rt_ifp, );
} else if (rt_ifp->if_type == IFT_IEEE8023ADLAG)
DONT_OFFLOAD_ACTIVE_OPEN(ENOSYS); /* XXX: implement lagg+TOE */
else

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Thu Apr 19 18:08:46 2018
(r332786)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Thu Apr 19 18:10:44 2018
(r332787)
@@ -1234,7 +1234,7 @@ lookup_offload_policy(struct adapter *sc, int open_typ
switch (open_type) {
case OPEN_TYPE_ACTIVE:
case OPEN_TYPE_LISTEN:
-   pkt = prepare_pkt(open_type, 0x, inp, , );
+   pkt = prepare_pkt(open_type, vtag, inp, , );
break;
case OPEN_TYPE_PASSIVE:
MPASS(m != NULL);
___
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: r332786 - head/sys/i386/include

2018-04-19 Thread Konstantin Belousov
Author: kib
Date: Thu Apr 19 18:08:46 2018
New Revision: 332786
URL: https://svnweb.freebsd.org/changeset/base/332786

Log:
  Use symbolic constant, explaining the operation.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/i386/include/asmacros.h

Modified: head/sys/i386/include/asmacros.h
==
--- head/sys/i386/include/asmacros.hThu Apr 19 17:55:48 2018
(r332785)
+++ head/sys/i386/include/asmacros.hThu Apr 19 18:08:46 2018
(r332786)
@@ -190,7 +190,7 @@
movl$TF_SZ, %ecx
testl   $PSL_VM, TF_EFLAGS(%esp)
jz  1001f
-   addl$(4*4), %ecx
+   addl$VM86_STACK_SPACE, %ecx
 1001:  subl%ecx, %edx
movl%edx, %edi
movl%esp, %esi
___
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: r332782 - in head/sys: amd64/linux amd64/linux32 compat/freebsd32 i386/linux kern sys

2018-04-19 Thread Brooks Davis
On Thu, Apr 19, 2018 at 04:00:34PM +, John Baldwin wrote:
> Author: jhb
> Date: Thu Apr 19 16:00:34 2018
> New Revision: 332782
> URL: https://svnweb.freebsd.org/changeset/base/332782
> 
> Log:
>   Simplify the code to allocate stack for auxv, argv[], and environment 
> vectors.
>   
>   Remove auxarg_size as it was only used once right after a confusing
>   assignment in each of the variants of exec_copyout_strings().

Thanks!  I just tripped over auxarg_size's confusing nature in CheriBSD.

I do wonder if allocating AT_COUNT entries is quite right since some are
emitted only optionally.  That said, it's not as though the waste is
significant.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r332783 - head/sys/dev/nvme

2018-04-19 Thread Warner Losh
Author: imp
Date: Thu Apr 19 16:05:48 2018
New Revision: 332783
URL: https://svnweb.freebsd.org/changeset/base/332783

Log:
  Reword comment to remove awkward constructs, including an "it's" that
  shouldn't have been there at all (it wasn't a typo for its, rather a
  left-over from an older revision of the comment).
  
  Noticed by: many

Modified:
  head/sys/dev/nvme/nvme_ns.c

Modified: head/sys/dev/nvme/nvme_ns.c
==
--- head/sys/dev/nvme/nvme_ns.c Thu Apr 19 16:00:34 2018(r332782)
+++ head/sys/dev/nvme/nvme_ns.c Thu Apr 19 16:05:48 2018(r332783)
@@ -506,10 +506,9 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t 
ns->stripesize = 0;
 
/*
-* Some Intel devices advertise an alignment that improves performance,
-* but is in it's vendor specific space in the cdata. Use it for these
-* drives, if present, to suggest a stripe size.  Future versions of
-* Intel hardware will use fields standardized in NVMe 1.3 for this.
+* Older Intel devices advertise in vendor specific space an alignment
+* that improves performance.  If present use for the stripe size.  NVMe
+* 1.3 standardized this as NOIOB, and newer Intel drives use that.
 */
switch (pci_get_devid(ctrlr->dev)) {
case 0x09538086:/* Intel DC PC3500 */
___
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: r332782 - in head/sys: amd64/linux amd64/linux32 compat/freebsd32 i386/linux kern sys

2018-04-19 Thread John Baldwin
Author: jhb
Date: Thu Apr 19 16:00:34 2018
New Revision: 332782
URL: https://svnweb.freebsd.org/changeset/base/332782

Log:
  Simplify the code to allocate stack for auxv, argv[], and environment vectors.
  
  Remove auxarg_size as it was only used once right after a confusing
  assignment in each of the variants of exec_copyout_strings().
  
  Reviewed by:  emaste
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D15123

Modified:
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/i386/linux/linux_sysvec.c
  head/sys/kern/kern_exec.c
  head/sys/sys/imgact.h

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Thu Apr 19 15:52:45 2018
(r332781)
+++ head/sys/amd64/linux/linux_sysvec.c Thu Apr 19 16:00:34 2018
(r332782)
@@ -331,31 +331,21 @@ linux_copyout_strings(struct image_params *imgp)
roundup(sizeof(canary), sizeof(char *));
copyout(canary, (void *)imgp->canary, sizeof(canary));
 
-   /* If we have a valid auxargs ptr, prepare some room on the stack. */
+   vectp = (char **)destp;
if (imgp->auxargs) {
/*
-* 'AT_COUNT*2' is size for the ELF Auxargs data. This is for
-* lower compatibility.
+* Allocate room on the stack for the ELF auxargs
+* array.  It has LINUX_AT_COUNT entries.
 */
-   imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size :
-   (LINUX_AT_COUNT * 2);
-
-   /*
-* The '+ 2' is for the null pointers at the end of each of
-* the arg and env vector sets,and imgp->auxarg_size is room
-* for argument of Runtime loader.
-*/
-   vectp = (char **)(destp - (imgp->args->argc +
-   imgp->args->envc + 2 + imgp->auxarg_size) * sizeof(char *));
-
-   } else {
-   /*
-* The '+ 2' is for the null pointers at the end of each of
-* the arg and env vector sets
-*/
-   vectp = (char **)(destp - (imgp->args->argc +
-   imgp->args->envc + 2) * sizeof(char *));
+   vectp -= howmany(LINUX_AT_COUNT * sizeof(Elf64_Auxinfo),
+   sizeof(*vectp));
}
+
+   /*
+* Allocate room for the argv[] and env vectors including the
+* terminating NULL pointers.
+*/
+   vectp -= imgp->args->argc + 1 + imgp->args->envc + 1;
 
/* vectp also becomes our initial stack base. */
stack_base = (register_t *)vectp;

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Thu Apr 19 15:52:45 2018
(r332781)
+++ head/sys/amd64/linux32/linux32_sysvec.c Thu Apr 19 16:00:34 2018
(r332782)
@@ -793,31 +793,21 @@ linux_copyout_strings(struct image_params *imgp)
roundup(sizeof(canary), sizeof(char *));
copyout(canary, (void *)imgp->canary, sizeof(canary));
 
-   /* If we have a valid auxargs ptr, prepare some room on the stack. */
+   vectp = (uint32_t *)destp;
if (imgp->auxargs) {
/*
-* 'AT_COUNT*2' is size for the ELF Auxargs data. This is for
-* lower compatibility.
+* Allocate room on the stack for the ELF auxargs
+* array.  It has LINUX_AT_COUNT entries.
 */
-   imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size :
-   (LINUX_AT_COUNT * 2);
-   /*
-* The '+ 2' is for the null pointers at the end of each of
-* the arg and env vector sets,and imgp->auxarg_size is room
-* for argument of Runtime loader.
-*/
-   vectp = (u_int32_t *) (destp - (imgp->args->argc +
-   imgp->args->envc + 2 + imgp->auxarg_size) *
-   sizeof(u_int32_t));
-
-   } else {
-   /*
-* The '+ 2' is for the null pointers at the end of each of
-* the arg and env vector sets
-*/
-   vectp = (u_int32_t *)(destp - (imgp->args->argc +
-   imgp->args->envc + 2) * sizeof(u_int32_t));
+   vectp -= howmany(LINUX_AT_COUNT * sizeof(Elf32_Auxinfo),
+   sizeof(*vectp));
}
+
+   /*
+* Allocate room for the argv[] and env vectors including the
+* terminating NULL pointers.
+*/
+   vectp -= imgp->args->argc + 1 + imgp->args->envc + 1;
 
/* vectp also becomes our initial stack base. */
stack_base = vectp;

Modified: 

Re: svn commit: r332735 - head/sys/x86/x86

2018-04-19 Thread Eric Joyner
Is the limit going to be increased at some point? Is there a true limit
somewhere?

On Wed, Apr 18, 2018 at 11:45 AM, John Baldwin  wrote:

> Author: jhb
> Date: Wed Apr 18 18:45:34 2018
> New Revision: 332735
> URL: https://svnweb.freebsd.org/changeset/base/332735
>
> Log:
>   Fix two off-by-one errors when allocating MSI and MSI-X interrupts.
>
>   x86 enforces an (arbitray) limit on the number of available MSI and
>   MSI-X interrupts to simplify code (in particular, interrupt_source[]
>   is statically sized).  This means that an attempt to allocate an MSI
>   vector needs to fail if it would go beyond the limit, but the checks
>   for exceeding the limit had an off-by-one error.  In the case of MSI-X
>   which allocates interrupts one at a time this meant that IRQ 768 kept
>   getting handed out multiple times for msix_alloc() instead of failing
>   because all MSI IRQs were in use.
>
>   Tested by:lidl
>   MFC after:1 week
>
> Modified:
>   head/sys/x86/x86/msi.c
>
> Modified: head/sys/x86/x86/msi.c
> 
> ==
> --- head/sys/x86/x86/msi.c  Wed Apr 18 18:45:04 2018(r332734)
> +++ head/sys/x86/x86/msi.c  Wed Apr 18 18:45:34 2018(r332735)
> @@ -404,7 +404,7 @@ again:
> /* Do we need to create some new sources? */
> if (cnt < count) {
> /* If we would exceed the max, give up. */
> -   if (i + (count - cnt) > FIRST_MSI_INT + NUM_MSI_INTS) {
> +   if (i + (count - cnt) >= FIRST_MSI_INT + NUM_MSI_INTS) {
> mtx_unlock(_lock);
> free(mirqs, M_MSI);
> return (ENXIO);
> @@ -645,7 +645,7 @@ again:
> /* Do we need to create a new source? */
> if (msi == NULL) {
> /* If we would exceed the max, give up. */
> -   if (i + 1 > FIRST_MSI_INT + NUM_MSI_INTS) {
> +   if (i + 1 >= FIRST_MSI_INT + NUM_MSI_INTS) {
> mtx_unlock(_lock);
> return (ENXIO);
> }
>
>
___
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: r332773 - head/etc/rc.d

2018-04-19 Thread Kyle Evans
On Thu, Apr 19, 2018 at 10:40 AM, Rodney W. Grimes
 wrote:
>> On Thu, Apr 19, 2018 at 10:21 AM, Kyle Evans  wrote:
>> > On Thu, Apr 19, 2018 at 10:19 AM, Warner Losh  wrote:
>> >>
>> >>
>> >> On Thu, Apr 19, 2018 at 9:17 AM, Kyle Evans  wrote:
>> >>>
>> >>> On Thu, Apr 19, 2018 at 10:16 AM, Rodney W. Grimes
>> >>>  wrote:
>> >>> >> Author: kevans
>> >>> >> Date: Thu Apr 19 15:02:53 2018
>> >>> >> New Revision: 332773
>> >>> >> URL: https://svnweb.freebsd.org/changeset/base/332773
>> >>> >>
>> >>> >> Log:
>> >>> >>   Fix ddb rc script
>> >>> >>
>> >>> >>   r288291 added a call to limits(1), which isn't available before
>> >>> >> partitions
>> >>> >>   are mounted. This broke the ddb rc script, which does not provide 
>> >>> >> its
>> >>> >> own
>> >>> >>   start_cmd.
>> >>> >>
>> >>> >>   Alleviate the situation here by providing a start_cmd. We still have
>> >>> >> other
>> >>> >>   problems with diskless setups that need to be considered, but this 
>> >>> >> is
>> >>> >> a
>> >>> >>   start.
>> >>> >
>> >>> > Thanks,
>> >>> > Also didn't cy identify a second one of these?
>> >>> > Or am I confusing yet another issue?
>> >>> >
>> >>>
>> >>> He identified a second early script that didn't specify start_cmd, but
>> >>> it was a non-issue because it's invoked independently of rc.subr.
>> >>
>> >>
>> >> One would think that it shouldn't invoke limits at all if foo_limits= 
>> >> wasn't
>> >> specified... Would make the feature much less invasive.
>
> I agree.  This should be implemented,
> if it isn't already working that way.
>
>> >>
>> >
>> > foo_limits was introduced long after the initial invocation, which was
>> > introduced to enforce consistent limits of daemons run from rc.subr.
>> > Not doing this due to the lack of foo_flags would certainly kill the
>> > original intent, I'm afraid.
>>
>> I do wonder if some kind of kenv var or something would be appropriate
>> to disable this whole mess for some setups that it just clearly won't
>> work in, but maybe that's a terrible thought.
>
> I think you miss understood Warner.  He is saying that if there is no
> rc var *_limits there should be no invocation of limits(1) at all,
> making much of this whole mess for many of us a NOP.

No, I understood that perfectly... the *_limits rc var was introduced
much later just so one can add extra flags to this limits(1)
invocation. This would be counter-productive to the original intention
of the limits(1) invocation, which had no concept of foo_limits until
lately and was intended to just generally apply to all rc scripts
without a bunch of redundant crud in every rc script that it can apply
to.

> I actually believe that is how the code already works, but not sure.

Negative, as I've already mentioned a couple of times... limits(1) is
applied basically unconditionally.
___
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: r332773 - head/etc/rc.d

2018-04-19 Thread Rodney W. Grimes
> On Thu, Apr 19, 2018 at 10:21 AM, Kyle Evans  wrote:
> > On Thu, Apr 19, 2018 at 10:19 AM, Warner Losh  wrote:
> >>
> >>
> >> On Thu, Apr 19, 2018 at 9:17 AM, Kyle Evans  wrote:
> >>>
> >>> On Thu, Apr 19, 2018 at 10:16 AM, Rodney W. Grimes
> >>>  wrote:
> >>> >> Author: kevans
> >>> >> Date: Thu Apr 19 15:02:53 2018
> >>> >> New Revision: 332773
> >>> >> URL: https://svnweb.freebsd.org/changeset/base/332773
> >>> >>
> >>> >> Log:
> >>> >>   Fix ddb rc script
> >>> >>
> >>> >>   r288291 added a call to limits(1), which isn't available before
> >>> >> partitions
> >>> >>   are mounted. This broke the ddb rc script, which does not provide its
> >>> >> own
> >>> >>   start_cmd.
> >>> >>
> >>> >>   Alleviate the situation here by providing a start_cmd. We still have
> >>> >> other
> >>> >>   problems with diskless setups that need to be considered, but this is
> >>> >> a
> >>> >>   start.
> >>> >
> >>> > Thanks,
> >>> > Also didn't cy identify a second one of these?
> >>> > Or am I confusing yet another issue?
> >>> >
> >>>
> >>> He identified a second early script that didn't specify start_cmd, but
> >>> it was a non-issue because it's invoked independently of rc.subr.
> >>
> >>
> >> One would think that it shouldn't invoke limits at all if foo_limits= 
> >> wasn't
> >> specified... Would make the feature much less invasive.

I agree.  This should be implemented,
if it isn't already working that way.

> >>
> >
> > foo_limits was introduced long after the initial invocation, which was
> > introduced to enforce consistent limits of daemons run from rc.subr.
> > Not doing this due to the lack of foo_flags would certainly kill the
> > original intent, I'm afraid.
> 
> I do wonder if some kind of kenv var or something would be appropriate
> to disable this whole mess for some setups that it just clearly won't
> work in, but maybe that's a terrible thought.

I think you miss understood Warner.  He is saying that if there is no
rc var *_limits there should be no invocation of limits(1) at all,
making much of this whole mess for many of us a NOP.

I actually believe that is how the code already works, but not sure.


-- 
Rod Grimes rgri...@freebsd.org
___
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: r332780 - head/sys/dev/nvme

2018-04-19 Thread Warner Losh
Author: imp
Date: Thu Apr 19 15:39:20 2018
New Revision: 332780
URL: https://svnweb.freebsd.org/changeset/base/332780

Log:
  Intel drives have an optimal alignment for I/O. While they honor I/Os
  that cross this boundary, they perform better when this isn't the
  case. Intel uses the 3rd byte in the vendor specific area for
  this. The DC P3500 was previously listed without any explanation. Add
  the DC P3520 and DC P4500 to the list.
  
  There won't be any others drives needing this quirk. Intel has
  standardized a field in the namespace data in 1.3 (noiob).  A future
  patch will use that if it exists, with fallback to this method.
  
  Submitted by: Keith Busch
  Reviewed by: jimharris@

Modified:
  head/sys/dev/nvme/nvme_ns.c

Modified: head/sys/dev/nvme/nvme_ns.c
==
--- head/sys/dev/nvme/nvme_ns.c Thu Apr 19 15:29:10 2018(r332779)
+++ head/sys/dev/nvme/nvme_ns.c Thu Apr 19 15:39:20 2018(r332780)
@@ -505,9 +505,23 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t 
ns->id = id;
ns->stripesize = 0;
 
-   if (pci_get_devid(ctrlr->dev) == 0x09538086 && ctrlr->cdata.vs[3] != 0)
-   ns->stripesize =
-   (1 << ctrlr->cdata.vs[3]) * ctrlr->min_page_size;
+   /*
+* Some Intel devices advertise an alignment that improves performance,
+* but is in it's vendor specific space in the cdata. Use it for these
+* drives, if present, to suggest a stripe size.  Future versions of
+* Intel hardware will use fields standardized in NVMe 1.3 for this.
+*/
+   switch (pci_get_devid(ctrlr->dev)) {
+   case 0x09538086:/* Intel DC PC3500 */
+   case 0x0a538086:/* Intel DC PC3520 */
+   case 0x0a548086:/* Intel DC PC4500 */
+   if (ctrlr->cdata.vs[3] != 0)
+   ns->stripesize =
+   (1 << ctrlr->cdata.vs[3]) * ctrlr->min_page_size;
+   break;
+   default:
+   break;
+   }
 
/*
 * Namespaces are reconstructed after a controller reset, so check
___
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: r332773 - head/etc/rc.d

2018-04-19 Thread Kyle Evans
On Thu, Apr 19, 2018 at 10:21 AM, Kyle Evans  wrote:
> On Thu, Apr 19, 2018 at 10:19 AM, Warner Losh  wrote:
>>
>>
>> On Thu, Apr 19, 2018 at 9:17 AM, Kyle Evans  wrote:
>>>
>>> On Thu, Apr 19, 2018 at 10:16 AM, Rodney W. Grimes
>>>  wrote:
>>> >> Author: kevans
>>> >> Date: Thu Apr 19 15:02:53 2018
>>> >> New Revision: 332773
>>> >> URL: https://svnweb.freebsd.org/changeset/base/332773
>>> >>
>>> >> Log:
>>> >>   Fix ddb rc script
>>> >>
>>> >>   r288291 added a call to limits(1), which isn't available before
>>> >> partitions
>>> >>   are mounted. This broke the ddb rc script, which does not provide its
>>> >> own
>>> >>   start_cmd.
>>> >>
>>> >>   Alleviate the situation here by providing a start_cmd. We still have
>>> >> other
>>> >>   problems with diskless setups that need to be considered, but this is
>>> >> a
>>> >>   start.
>>> >
>>> > Thanks,
>>> > Also didn't cy identify a second one of these?
>>> > Or am I confusing yet another issue?
>>> >
>>>
>>> He identified a second early script that didn't specify start_cmd, but
>>> it was a non-issue because it's invoked independently of rc.subr.
>>
>>
>> One would think that it shouldn't invoke limits at all if foo_limits= wasn't
>> specified... Would make the feature much less invasive.
>>
>
> foo_limits was introduced long after the initial invocation, which was
> introduced to enforce consistent limits of daemons run from rc.subr.
> Not doing this due to the lack of foo_flags would certainly kill the
> original intent, I'm afraid.

I do wonder if some kind of kenv var or something would be appropriate
to disable this whole mess for some setups that it just clearly won't
work in, but maybe that's a terrible thought.
___
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: r332779 - head/sys/powerpc/powermac

2018-04-19 Thread Alexander Motin
Author: mav
Date: Thu Apr 19 15:29:10 2018
New Revision: 332779
URL: https://svnweb.freebsd.org/changeset/base/332779

Log:
  Release memory resource on cuda driver attach failure.
  
  Submitted by: Dmitry Luhtionov 

Modified:
  head/sys/powerpc/powermac/cuda.c

Modified: head/sys/powerpc/powermac/cuda.c
==
--- head/sys/powerpc/powermac/cuda.cThu Apr 19 15:24:21 2018
(r332778)
+++ head/sys/powerpc/powermac/cuda.cThu Apr 19 15:29:10 2018
(r332779)
@@ -165,12 +165,16 @@ cuda_attach(device_t dev)
RF_ACTIVE);
 if (sc->sc_irq == NULL) {
 device_printf(dev, "could not allocate interrupt\n");
+bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_memrid,
+sc->sc_memr);
 return (ENXIO);
 }
 
if (bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_MISC | INTR_MPSAFE 
| INTR_ENTROPY, NULL, cuda_intr, dev, >sc_ih) != 0) {
 device_printf(dev, "could not setup interrupt\n");
+bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_memrid,
+sc->sc_memr);
 bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irqrid,
 sc->sc_irq);
 return (ENXIO);
___
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: r332778 - head/sys/opencrypto

2018-04-19 Thread Conrad Meyer
Author: cem
Date: Thu Apr 19 15:24:21 2018
New Revision: 332778
URL: https://svnweb.freebsd.org/changeset/base/332778

Log:
  cryptosoft: Do not exceed crd_len around *crypt_multi
  
  When a caller passes in a uio or mbuf chain that is longer than crd_len, in
  tandem with a transform that supports the multi-block interface,
  swcr_encdec() would process the entire mbuf or uio instead of just the
  portion indicated by crd_len (+ crd_skip).
  
  De/encryption are performed in-place, so this would trash subsequent uio or
  mbuf contents.
  
  This was introduced in r331639 (mea culpa).  It only affects the
  {de,en}crypt_multi() family of interfaces.  That interface only has one
  consumer transform in-tree (for now): Chacha20.
  
  PR:   227605
  Submitted by: Valentin Vergez 

Modified:
  head/sys/opencrypto/cryptosoft.c

Modified: head/sys/opencrypto/cryptosoft.c
==
--- head/sys/opencrypto/cryptosoft.cThu Apr 19 15:11:18 2018
(r332777)
+++ head/sys/opencrypto/cryptosoft.cThu Apr 19 15:24:21 2018
(r332778)
@@ -253,7 +253,8 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data *
size_t nb, rem;
 
nb = blks;
-   rem = uio->uio_iov[ind].iov_len - k;
+   rem = MIN((size_t)i,
+   uio->uio_iov[ind].iov_len - (size_t)k);
idat = (uint8_t *)uio->uio_iov[ind].iov_base + k;
 
if (exf->reinit) {
___
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: r332773 - head/etc/rc.d

2018-04-19 Thread Kyle Evans
On Thu, Apr 19, 2018 at 10:19 AM, Warner Losh  wrote:
>
>
> On Thu, Apr 19, 2018 at 9:17 AM, Kyle Evans  wrote:
>>
>> On Thu, Apr 19, 2018 at 10:16 AM, Rodney W. Grimes
>>  wrote:
>> >> Author: kevans
>> >> Date: Thu Apr 19 15:02:53 2018
>> >> New Revision: 332773
>> >> URL: https://svnweb.freebsd.org/changeset/base/332773
>> >>
>> >> Log:
>> >>   Fix ddb rc script
>> >>
>> >>   r288291 added a call to limits(1), which isn't available before
>> >> partitions
>> >>   are mounted. This broke the ddb rc script, which does not provide its
>> >> own
>> >>   start_cmd.
>> >>
>> >>   Alleviate the situation here by providing a start_cmd. We still have
>> >> other
>> >>   problems with diskless setups that need to be considered, but this is
>> >> a
>> >>   start.
>> >
>> > Thanks,
>> > Also didn't cy identify a second one of these?
>> > Or am I confusing yet another issue?
>> >
>>
>> He identified a second early script that didn't specify start_cmd, but
>> it was a non-issue because it's invoked independently of rc.subr.
>
>
> One would think that it shouldn't invoke limits at all if foo_limits= wasn't
> specified... Would make the feature much less invasive.
>

foo_limits was introduced long after the initial invocation, which was
introduced to enforce consistent limits of daemons run from rc.subr.
Not doing this due to the lack of foo_flags would certainly kill the
original intent, I'm afraid.
___
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: r332773 - head/etc/rc.d

2018-04-19 Thread Warner Losh
On Thu, Apr 19, 2018 at 9:17 AM, Kyle Evans  wrote:

> On Thu, Apr 19, 2018 at 10:16 AM, Rodney W. Grimes
>  wrote:
> >> Author: kevans
> >> Date: Thu Apr 19 15:02:53 2018
> >> New Revision: 332773
> >> URL: https://svnweb.freebsd.org/changeset/base/332773
> >>
> >> Log:
> >>   Fix ddb rc script
> >>
> >>   r288291 added a call to limits(1), which isn't available before
> partitions
> >>   are mounted. This broke the ddb rc script, which does not provide its
> own
> >>   start_cmd.
> >>
> >>   Alleviate the situation here by providing a start_cmd. We still have
> other
> >>   problems with diskless setups that need to be considered, but this is
> a
> >>   start.
> >
> > Thanks,
> > Also didn't cy identify a second one of these?
> > Or am I confusing yet another issue?
> >
>
> He identified a second early script that didn't specify start_cmd, but
> it was a non-issue because it's invoked independently of rc.subr.
>

One would think that it shouldn't invoke limits at all if foo_limits=
wasn't specified... Would make the feature much less invasive.

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: r332773 - head/etc/rc.d

2018-04-19 Thread Kyle Evans
On Thu, Apr 19, 2018 at 10:16 AM, Rodney W. Grimes
 wrote:
>> Author: kevans
>> Date: Thu Apr 19 15:02:53 2018
>> New Revision: 332773
>> URL: https://svnweb.freebsd.org/changeset/base/332773
>>
>> Log:
>>   Fix ddb rc script
>>
>>   r288291 added a call to limits(1), which isn't available before partitions
>>   are mounted. This broke the ddb rc script, which does not provide its own
>>   start_cmd.
>>
>>   Alleviate the situation here by providing a start_cmd. We still have other
>>   problems with diskless setups that need to be considered, but this is a
>>   start.
>
> Thanks,
> Also didn't cy identify a second one of these?
> Or am I confusing yet another issue?
>

He identified a second early script that didn't specify start_cmd, but
it was a non-issue because it's invoked independently of rc.subr.
___
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: r332773 - head/etc/rc.d

2018-04-19 Thread Rodney W. Grimes
> Author: kevans
> Date: Thu Apr 19 15:02:53 2018
> New Revision: 332773
> URL: https://svnweb.freebsd.org/changeset/base/332773
> 
> Log:
>   Fix ddb rc script
>   
>   r288291 added a call to limits(1), which isn't available before partitions
>   are mounted. This broke the ddb rc script, which does not provide its own
>   start_cmd.
>   
>   Alleviate the situation here by providing a start_cmd. We still have other
>   problems with diskless setups that need to be considered, but this is a
>   start.

Thanks,
Also didn't cy identify a second one of these?
Or am I confusing yet another issue?

>   PR: 206291
>   Submitted by:   cy
>   Discussed with: rgrimes
>   MFC after:  3 days
> 
> Modified:
>   head/etc/rc.d/ddb
> 
> Modified: head/etc/rc.d/ddb
> ==
> --- head/etc/rc.d/ddb Thu Apr 19 15:02:42 2018(r332772)
> +++ head/etc/rc.d/ddb Thu Apr 19 15:02:53 2018(r332773)
> @@ -15,6 +15,7 @@ desc="DDB kernel debugger"
>  rcvar="ddb_enable"
>  command="/sbin/${name}"
>  start_precmd="ddb_prestart"
> +start_cmd="ddb_start"
>  stop_cmd=":"
>  
>  ddb_prestart()
> @@ -23,6 +24,11 @@ ddb_prestart()
>   if [ -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then
>   return 1
>   fi
> +}
> +
> +ddb_start()
> +{
> + ${command} ${command_args}
>  }
>  
>  load_rc_config $name
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r332773 - head/etc/rc.d

2018-04-19 Thread Kyle Evans
Author: kevans
Date: Thu Apr 19 15:02:53 2018
New Revision: 332773
URL: https://svnweb.freebsd.org/changeset/base/332773

Log:
  Fix ddb rc script
  
  r288291 added a call to limits(1), which isn't available before partitions
  are mounted. This broke the ddb rc script, which does not provide its own
  start_cmd.
  
  Alleviate the situation here by providing a start_cmd. We still have other
  problems with diskless setups that need to be considered, but this is a
  start.
  
  PR:   206291
  Submitted by: cy
  Discussed with:   rgrimes
  MFC after:3 days

Modified:
  head/etc/rc.d/ddb

Modified: head/etc/rc.d/ddb
==
--- head/etc/rc.d/ddb   Thu Apr 19 15:02:42 2018(r332772)
+++ head/etc/rc.d/ddb   Thu Apr 19 15:02:53 2018(r332773)
@@ -15,6 +15,7 @@ desc="DDB kernel debugger"
 rcvar="ddb_enable"
 command="/sbin/${name}"
 start_precmd="ddb_prestart"
+start_cmd="ddb_start"
 stop_cmd=":"
 
 ddb_prestart()
@@ -23,6 +24,11 @@ ddb_prestart()
if [ -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then
return 1
fi
+}
+
+ddb_start()
+{
+   ${command} ${command_args}
 }
 
 load_rc_config $name
___
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: r332774 - head/sys/netinet

2018-04-19 Thread Randall Stewart
Author: rrs
Date: Thu Apr 19 15:03:48 2018
New Revision: 332774
URL: https://svnweb.freebsd.org/changeset/base/332774

Log:
  These two modules need the tcp_hpts.h file for
  when the option is enabled (not sure how LINT/build-universe
  missed this) opps.
  
  Sponsored by: Netflix Inc

Modified:
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Thu Apr 19 15:02:53 2018(r332773)
+++ head/sys/netinet/tcp_subr.c Thu Apr 19 15:03:48 2018(r332774)
@@ -99,6 +99,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #ifdef INET6
 #include 

Modified: head/sys/netinet/tcp_usrreq.c
==
--- head/sys/netinet/tcp_usrreq.c   Thu Apr 19 15:02:53 2018
(r332773)
+++ head/sys/netinet/tcp_usrreq.c   Thu Apr 19 15:03:48 2018
(r332774)
@@ -94,6 +94,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #ifdef TCPPCAP
 #include 
 #endif
___
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: r332771 - head/sys/vm

2018-04-19 Thread Mark Johnston
Author: markj
Date: Thu Apr 19 14:09:44 2018
New Revision: 332771
URL: https://svnweb.freebsd.org/changeset/base/332771

Log:
  Initialize marker pages in vm_page_domain_init().
  
  They were previously initialized by the corresponding page daemon
  threads, but for vmd_inacthead this may be too late if
  vm_page_deactivate_noreuse() is called during boot.
  
  Reported and tested by:   cperciva
  Reviewed by:  alc, kib
  MFC after:1 week

Modified:
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_pagequeue.h

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Thu Apr 19 13:37:59 2018(r332770)
+++ head/sys/vm/vm_page.c   Thu Apr 19 14:09:44 2018(r332771)
@@ -437,6 +437,23 @@ sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS)
return (error);
 }
 
+/*
+ * Initialize a dummy page for use in scans of the specified paging queue.
+ * In principle, this function only needs to set the flag PG_MARKER.
+ * Nonetheless, it write busies and initializes the hold count to one as
+ * safety precautions.
+ */
+void
+vm_page_init_marker(vm_page_t marker, int queue)
+{
+
+   bzero(marker, sizeof(*marker));
+   marker->flags = PG_MARKER;
+   marker->busy_lock = VPB_SINGLE_EXCLUSIVER;
+   marker->queue = queue;
+   marker->hold_count = 1;
+}
+
 static void
 vm_page_domain_init(int domain)
 {
@@ -464,9 +481,13 @@ vm_page_domain_init(int domain)
TAILQ_INIT(>pq_pl);
mtx_init(>pq_mutex, pq->pq_name, "vm pagequeue",
MTX_DEF | MTX_DUPOK);
+   vm_page_init_marker(>vmd_markers[i], i);
}
mtx_init(>vmd_free_mtx, "vm page free queue", NULL, MTX_DEF);
mtx_init(>vmd_pageout_mtx, "vm pageout lock", NULL, MTX_DEF);
+   vm_page_init_marker(>vmd_inacthead, PQ_INACTIVE);
+   TAILQ_INSERT_HEAD(>vmd_pagequeues[PQ_INACTIVE].pq_pl,
+   >vmd_inacthead, plinks.q);
snprintf(vmd->vmd_name, sizeof(vmd->vmd_name), "%d", domain);
 }
 

Modified: head/sys/vm/vm_page.h
==
--- head/sys/vm/vm_page.h   Thu Apr 19 13:37:59 2018(r332770)
+++ head/sys/vm/vm_page.h   Thu Apr 19 14:09:44 2018(r332771)
@@ -490,6 +490,7 @@ void vm_page_free_phys_pglist(struct pglist *tq);
 bool vm_page_free_prep(vm_page_t m, bool pagequeue_locked);
 vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr);
 void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr);
+void vm_page_init_marker(vm_page_t m, int queue);
 int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t);
 void vm_page_launder(vm_page_t m);
 vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t);

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cThu Apr 19 13:37:59 2018(r332770)
+++ head/sys/vm/vm_pageout.cThu Apr 19 14:09:44 2018(r332771)
@@ -208,23 +208,6 @@ static void vm_pageout_laundry_worker(void *arg);
 static boolean_t vm_pageout_page_lock(vm_page_t, vm_page_t *);
 
 /*
- * Initialize a dummy page for marking the caller's place in the specified
- * paging queue.  In principle, this function only needs to set the flag
- * PG_MARKER.  Nonetheless, it write busies and initializes the hold count
- * to one as safety precautions.
- */ 
-static void
-vm_pageout_init_marker(vm_page_t marker, u_short queue)
-{
-
-   bzero(marker, sizeof(*marker));
-   marker->flags = PG_MARKER;
-   marker->busy_lock = VPB_SINGLE_EXCLUSIVER;
-   marker->queue = queue;
-   marker->hold_count = 1;
-}
-
-/*
  * vm_pageout_fallback_object_lock:
  * 
  * Lock vm object currently associated with `m'. VM_OBJECT_TRYWLOCK is
@@ -244,11 +227,11 @@ vm_pageout_fallback_object_lock(vm_page_t m, vm_page_t
struct vm_page marker;
struct vm_pagequeue *pq;
boolean_t unchanged;
-   u_short queue;
vm_object_t object;
+   int queue;
 
queue = m->queue;
-   vm_pageout_init_marker(, queue);
+   vm_page_init_marker(, queue);
pq = vm_page_pagequeue(m);
object = m->object;

@@ -293,14 +276,14 @@ vm_pageout_page_lock(vm_page_t m, vm_page_t *next)
struct vm_page marker;
struct vm_pagequeue *pq;
boolean_t unchanged;
-   u_short queue;
+   int queue;
 
vm_page_lock_assert(m, MA_NOTOWNED);
if (vm_page_trylock(m))
return (TRUE);
 
queue = m->queue;
-   vm_pageout_init_marker(, queue);
+   vm_page_init_marker(, queue);
pq = vm_page_pagequeue(m);
 
TAILQ_INSERT_AFTER(>pq_pl, m, , plinks.q);
@@ -694,8 +677,8 @@ vm_pageout_launder(struct vm_domain *vmd, int launder,
 {
struct vm_pagequeue *pq;
vm_object_t object;
-   vm_page_t 

svn commit: r332770 - in head/sys: conf netinet netinet/tcp_stacks sys

2018-04-19 Thread Randall Stewart
Author: rrs
Date: Thu Apr 19 13:37:59 2018
New Revision: 332770
URL: https://svnweb.freebsd.org/changeset/base/332770

Log:
  This commit brings in the TCP high precision timer system (tcp_hpts).
  It is the forerunner/foundational work of bringing in both Rack and BBR
  which use hpts for pacing out packets. The feature is optional and requires
  the TCPHPTS option to be enabled before the feature will be active. TCP
  modules that use it must assure that the base component is compile in
  the kernel in which they are loaded.
  
  MFC after:Never
  Sponsored by: Netflix Inc.
  Differential Revision:https://reviews.freebsd.org/D15020

Added:
  head/sys/netinet/tcp_hpts.c   (contents, props changed)
  head/sys/netinet/tcp_hpts.h   (contents, props changed)
  head/sys/sys/kern_prefetch.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/conf/options
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/tcp_stacks/fastpath.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet/tcp_var.h
  head/sys/sys/mbuf.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Apr 19 12:50:49 2018(r332769)
+++ head/sys/conf/files Thu Apr 19 13:37:59 2018(r332770)
@@ -4355,6 +4355,7 @@ netinet/tcp_log_buf.c optional tcp_blackbox 
inet | tc
 netinet/tcp_lro.c  optional inet | inet6
 netinet/tcp_output.c   optional inet | inet6
 netinet/tcp_offload.c  optional tcp_offload inet | tcp_offload inet6
+netinet/tcp_hpts.c  optional tcphpts inet | tcphpts inet6
 netinet/tcp_pcap.c optional inet tcppcap | inet6 tcppcap
 netinet/tcp_reass.coptional inet | inet6
 netinet/tcp_sack.c optional inet | inet6

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Thu Apr 19 12:50:49 2018(r332769)
+++ head/sys/conf/options   Thu Apr 19 13:37:59 2018(r332770)
@@ -218,6 +218,7 @@ SYSVMSG opt_sysvipc.h
 SYSVSEMopt_sysvipc.h
 SYSVSHMopt_sysvipc.h
 SW_WATCHDOGopt_watchdog.h
+TCPHPTS opt_inet.h
 TURNSTILE_PROFILING
 UMTX_PROFILING
 UMTX_CHAINSopt_global.h

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Thu Apr 19 12:50:49 2018(r332769)
+++ head/sys/netinet/in_pcb.c   Thu Apr 19 13:37:59 2018(r332770)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -87,6 +88,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef TCPHPTS
+#include 
+#endif
 #include 
 #include 
 #endif
@@ -1224,9 +1228,28 @@ in_pcbrele_rlocked(struct inpcb *inp)
}
return (0);
}
-
+   
KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__));
-
+#ifdef TCPHPTS
+   if (inp->inp_in_hpts || inp->inp_in_input) {
+   struct tcp_hpts_entry *hpts;
+   /*
+* We should not be on the hpts at 
+* this point in any form. we must
+* get the lock to be sure.
+*/
+   hpts = tcp_hpts_lock(inp);
+   if (inp->inp_in_hpts)
+   panic("Hpts:%p inp:%p at free still on hpts",
+ hpts, inp);
+   mtx_unlock(>p_mtx);
+   hpts = tcp_input_lock(inp);
+   if (inp->inp_in_input) 
+   panic("Hpts:%p inp:%p at free still on input hpts",
+ hpts, inp);
+   mtx_unlock(>p_mtx);
+   }
+#endif
INP_RUNLOCK(inp);
pcbinfo = inp->inp_pcbinfo;
uma_zfree(pcbinfo->ipi_zone, inp);
@@ -1255,7 +1278,26 @@ in_pcbrele_wlocked(struct inpcb *inp)
}
 
KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__));
-
+#ifdef TCPHPTS
+   if (inp->inp_in_hpts || inp->inp_in_input) {
+   struct tcp_hpts_entry *hpts;
+   /*
+* We should not be on the hpts at 
+* this point in any form. we must
+* get the lock to be sure.
+*/
+   hpts = tcp_hpts_lock(inp);
+   if (inp->inp_in_hpts)
+   panic("Hpts:%p inp:%p at free still on hpts",
+ hpts, inp);
+   mtx_unlock(>p_mtx);
+   hpts = tcp_input_lock(inp);
+   if (inp->inp_in_input) 
+   panic("Hpts:%p inp:%p at free still on input hpts",
+ hpts, inp);
+   mtx_unlock(>p_mtx);
+   }
+#endif

svn commit: r332769 - head/usr.bin/chpass

2018-04-19 Thread Ed Maste
Author: emaste
Date: Thu Apr 19 12:50:49 2018
New Revision: 332769
URL: https://svnweb.freebsd.org/changeset/base/332769

Log:
  chpass: reject change/expiry dates beyond y2106
  
  The pwd.db and spwd.db files store the change and expire dates as
  unsigned 32-bit ints, which overflow in 2106.  Reject larger values for
  now, until the introduction of a v5 password database.
  
  i386 has 32-bit time_t and so dates beyond y2038 are already rejected by
  mktime.
  
  PR:   227589
  Reviewed by:  lidl
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/chpass/util.c

Modified: head/usr.bin/chpass/util.c
==
--- head/usr.bin/chpass/util.c  Thu Apr 19 10:16:39 2018(r332768)
+++ head/usr.bin/chpass/util.c  Thu Apr 19 12:50:49 2018(r332769)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -136,6 +137,17 @@ bad:   return (1);
lt->tm_isdst = -1;
if ((tval = mktime(lt)) < 0)
return (1);
+#ifndef __i386__
+   /*
+* PR227589: The pwd.db and spwd.db files store the change and expire
+* dates as unsigned 32-bit ints which overflow in 2106, so larger
+* values must be rejected until the introduction of a v5 password
+* database.  i386 has 32-bit time_t and so dates beyond y2038 are
+* already rejected by mktime above.
+*/
+   if (tval > UINT32_MAX)
+   return (1);
+#endif
*store = tval;
return (0);
 }
___
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: r332559 - head/usr.sbin/mountd

2018-04-19 Thread Allan Jude

On 2018-04-16 8:02 PM, Rick Macklem wrote:

I wrote:

Julian Elischer wrote:

On 16/4/18 6:56 pm, Konstantin Belousov wrote:

[stuff snipped]

+ngroups =3D XU_NGROUPS + 1;

Why XU_NGROUPS and not the value of sysctl("kern.ngroups") ?

valid question.. because that is how many are allocated?
it was a "minimally invasive patch".. whoever used XU_NGROUPS before
should have fixed it.
Having said that, thanks for drawing out attention to it.. will
probably fix.

16 is the limit specified in the RFCs for Sun RPC, so that is the "on the wire" 
limit.
I haven't looked at the code. It might make sense to handle more here and then
set the limit at 16 after getting rid of duplicates, but I have no idea if =
it matters?

rick

Correcting my own post. Now that I've looked at the code, this doesn't go on
the wire. It does go in the exports structure, which means that this structure
would have to be revised (along with the syscall and VOP calls and the kernel
code that uses it). These credentials are for the "maproot/mapall" export
option and revising the export structure seems like quite a bit of work for this
case. (Until revised XU_NGROUPS is the correct value to set it to, since there
is a "struct xucred" in the exports structure.)

Since Julian Elischer has been emailing me about adding a "fsid" export option
which allows /etc/exports to set the FSID of the exported fs (which would also
need to go in the exports structure), it might be about time to rev. the exports
structure?

rick



I second the request for FSID as an export option. It is important for 
having smooth failover between NFS servers.


--
Allan Jude
___
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: r332645 - head/sbin/ifconfig

2018-04-19 Thread Alexey Dokuchaev
On Tue, Apr 17, 2018 at 12:54:59PM +, Andrew Gallatin wrote:
> New Revision: 332645
> URL: https://svnweb.freebsd.org/changeset/base/332645
> 
> Log:
>   Make lagg creation more fault tolerant
>   
>   - Warn, don't exit, when SIOCSLAGGPORT returns an error.
>   
>   When we exit with an error during lagg creation, a single
>   failed NIC (which no longer attaches) can prevent lagg
>   creation and other configuration, such as adding an IPv4
>   address, and thus leave a machine unreachable.

Hey Andrew,

Since you're on lagg(4) a bit, could you perhaps have a look at this
thread from last year on -net@:

https://lists.freebsd.org/pipermail/freebsd-net/2017-June/048284.html

I've been asked by several people that were using WiFi-CopperNet failover
which worked fine in FreeBSD 10.x but was broken since then.  I'm not
an src committer nor a network stack expert in this area nor I'm using
lagg(4), but perhaps you could expedite on handling this or at least point
us to a more appropriate channel (due to lack of interest on -net@).

./danfe
___
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"