Re: svn commit: r344316 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-19 Thread Alexey Dokuchaev
On Tue, Feb 19, 2019 at 06:43:28PM -0500, Shawn Webb wrote:
> At the risk of painting a bikeshed a lovely color of neon purple, I'm
> curious about if/how these types of commits get merged upstream to
> (OpenZFS|Illumos|ZFS On Linux|where ever ZFS upstream is now|I'm very
> confused|is anyone else confused where upstream is?).
> 
> Who is upstream? Is work like this going to remain as a downstream
> patch to ZFS? Or is FreeBSD going to work to upstream this type of
> work?

I've always felt that we should've become upstream to everyone else
the moment we knew Oracle would eat Sun (20 April 2009), and never
understood why it didn't happen and now, ten years later, we're talking
about ZFS on fucking Linux becoming our upstream.  Something'd got very
wrong here and I'd like to know what and why.

> I hope my curiousity doesn't offend anyone. ;)

Not at all, I'm also confused and curious.

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


svn commit: r344343 - head/sys/arm/allwinner

2019-02-19 Thread Ganbold Tsagaankhuu
Author: ganbold
Date: Wed Feb 20 07:10:38 2019
New Revision: 344343
URL: https://svnweb.freebsd.org/changeset/base/344343

Log:
  Clarify notifications when battery capacity ratio
  reaches warning and shutdown thresholds.

Modified:
  head/sys/arm/allwinner/axp81x.c

Modified: head/sys/arm/allwinner/axp81x.c
==
--- head/sys/arm/allwinner/axp81x.c Wed Feb 20 06:54:32 2019
(r344342)
+++ head/sys/arm/allwinner/axp81x.c Wed Feb 20 07:10:38 2019
(r344343)
@@ -1088,9 +1088,9 @@ axp8xx_intr(void *arg)
if (bootverbose)
device_printf(dev, "AXP_IRQSTAT4 val: %x\n", val);
if (val & AXP_IRQSTAT4_BATLVL_LO0)
-   devctl_notify("PMU", "Battery", "lower than level 2", 
NULL);
+   devctl_notify("PMU", "Battery", "shutdown threshold", 
NULL);
if (val & AXP_IRQSTAT4_BATLVL_LO1)
-   devctl_notify("PMU", "Battery", "lower than level 1", 
NULL);
+   devctl_notify("PMU", "Battery", "warning threshold", 
NULL);
/* Acknowledge */
axp8xx_write(dev, AXP_IRQSTAT4, val);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344340 - head/usr.bin/calendar

2019-02-19 Thread Baptiste Daroussin
Author: bapt
Date: Wed Feb 20 06:40:52 2019
New Revision: 344340
URL: https://svnweb.freebsd.org/changeset/base/344340

Log:
  calendar: use iconv to respect the output encoding
  
  calendar(1) can have input in various encoding, specifying
  LANG= to enable calendar(1) to determine which one to use.
  
  The problem is the content of the calendar itself is exposed as is making it
  unreadable in many cases. For example french calendar which is encoded
  ISO8859-1 is rendered badly in a fr_FR.UTF-8 environment.
  
  Using iconv allows to solve this issue.
  This will also allow to keep only 1 encoding in base for those files without
  breaking user existing setup
  
  Reported by:  many
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D19221

Modified:
  head/usr.bin/calendar/Makefile
  head/usr.bin/calendar/calendar.c
  head/usr.bin/calendar/calendar.h
  head/usr.bin/calendar/events.c
  head/usr.bin/calendar/io.c

Modified: head/usr.bin/calendar/Makefile
==
--- head/usr.bin/calendar/Makefile  Wed Feb 20 06:03:21 2019
(r344339)
+++ head/usr.bin/calendar/Makefile  Wed Feb 20 06:40:52 2019
(r344340)
@@ -13,6 +13,10 @@ INTER=  de_AT.ISO_8859-15 de_DE.ISO8859-1 fr_F
 DE_LINKS=   de_DE.ISO8859-15
 FR_LINKS=   fr_FR.ISO8859-15
 
+.if ${MK_ICONV} == "yes"
+CFLAGS+=   -DWITH_ICONV
+.endif
+
 FILESGROUPS+=  CALS
 CALS=  calendars/calendar.all \
calendars/calendar.australia \

Modified: head/usr.bin/calendar/calendar.c
==
--- head/usr.bin/calendar/calendar.cWed Feb 20 06:03:21 2019
(r344339)
+++ head/usr.bin/calendar/calendar.cWed Feb 20 06:40:52 2019
(r344340)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -66,6 +67,9 @@ static char   *DEBUG = NULL;
 static time_t  f_time = 0;
 double UTCOffset = UTCOFFSET_NOTSET;
 intEastLongitude = LONGITUDE_NOTSET;
+#ifdef WITH_ICONV
+const char *outputEncoding;
+#endif
 
 static voidusage(void) __dead2;
 
@@ -80,6 +84,12 @@ main(int argc, char *argv[])
struct tm tp1, tp2;
 
(void)setlocale(LC_ALL, "");
+#ifdef WITH_ICONV
+   /* save the information about the encoding used in the terminal */
+   outputEncoding = strdup(nl_langinfo(CODESET));
+   if (outputEncoding == NULL)
+   errx(1, "cannot allocate memory");
+#endif
 
while ((ch = getopt(argc, argv, "-A:aB:D:dF:f:l:t:U:W:?")) != -1)
switch (ch) {

Modified: head/usr.bin/calendar/calendar.h
==
--- head/usr.bin/calendar/calendar.hWed Feb 20 06:03:21 2019
(r344339)
+++ head/usr.bin/calendar/calendar.hWed Feb 20 06:40:52 2019
(r344340)
@@ -59,6 +59,9 @@ extern struct fixs neaster, npaskha, ncny, nfullmoon, 
 extern struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice;
 extern double UTCOffset;
 extern int EastLongitude;
+#ifdef WITH_ICONV
+extern const char *outputEncoding;
+#endif
 
 #define isleap(y) y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
 
@@ -197,3 +200,7 @@ voidfpom(int year, double utcoffset, double *ffms, 
do
 void   equinoxsolstice(int year, double UTCoffset, int *equinoxdays, int 
*solsticedays);
 void   fequinoxsolstice(int year, double UTCoffset, double *equinoxdays, 
double *solsticedays);
 intcalculatesunlongitude30(int year, int degreeGMToffset, int 
*ichinesemonths);
+
+#ifdef WITH_ICONV
+void   set_new_encoding(void);
+#endif

Modified: head/usr.bin/calendar/events.c
==
--- head/usr.bin/calendar/events.c  Wed Feb 20 06:03:21 2019
(r344339)
+++ head/usr.bin/calendar/events.c  Wed Feb 20 06:40:52 2019
(r344340)
@@ -35,10 +35,120 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef WITH_ICONV
+#include 
+#include 
+#include 
 
+static iconv_t conv = (iconv_t)-1;
+static char *currentEncoding = NULL;
+
+#endif
+
 #include "pathnames.h"
 #include "calendar.h"
 
+#ifdef WITH_ICONV
+void
+set_new_encoding(void)
+{
+   const char *newenc;
+
+   newenc = nl_langinfo(CODESET);
+   if (currentEncoding == NULL) {
+   currentEncoding = strdup(newenc);
+   if (currentEncoding == NULL)
+   errx(1, "set_new_encoding: cannot allocate memory");
+   return;
+   }
+   if (strcmp(currentEncoding, newenc) == 0)
+   return;
+   free(currentEncoding);
+   currentEncoding = strdup(newenc);
+   if (currentEncoding == NULL)
+   errx(1, "set_new_encoding: cannot allocate memory");
+   if (conv != (iconv_t) -1) {
+   iconv_close(conv);
+ 

svn commit: r344337 - head/usr.sbin/efivar

2019-02-19 Thread Rebecca Cran
Author: bcran
Date: Wed Feb 20 05:19:16 2019
New Revision: 344337
URL: https://svnweb.freebsd.org/changeset/base/344337

Log:
  Add the unix path to the output of `efivar --load-option`
  
  Reviewed by:  imp
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D19242

Modified:
  head/usr.sbin/efivar/efiutil.c

Modified: head/usr.sbin/efivar/efiutil.c
==
--- head/usr.sbin/efivar/efiutil.c  Wed Feb 20 03:07:11 2019
(r344336)
+++ head/usr.sbin/efivar/efiutil.c  Wed Feb 20 05:19:16 2019
(r344337)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2017 Netflix, Inc.
+ * Copyright (c) 2017-2019 Netflix, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -120,6 +120,7 @@ bindump(uint8_t *data, size_t datalen)
 void
 efi_print_load_option(uint8_t *data, size_t datalen, int Aflag, int bflag, int 
uflag)
 {
+   char *dev, *relpath, *abspath;
uint8_t *ep = data + datalen;
uint8_t *walker = data;
uint32_t attr;
@@ -131,6 +132,7 @@ efi_print_load_option(uint8_t *data, size_t datalen, i
int len;
void *opt;
int optlen;
+   int rv;
 
if (datalen < sizeof(attr) + sizeof(fplen) + sizeof(efi_char))
return;
@@ -162,8 +164,15 @@ efi_print_load_option(uint8_t *data, size_t datalen, i
free(str);
while (dp < edp && SIZE(dp, edp) > sizeof(efidp_header)) {
efidp_format_device_path(buf, sizeof(buf), dp, SIZE(dp, edp));
+   rv = efivar_device_path_to_unix_path(dp, &dev, &relpath, 
&abspath);
dp = (efidp)((char *)dp + efidp_size(dp));
printf(" %s\n", buf);
+   if (rv == 0) {
+   printf("  %*s:%s\n", len + (int)strlen(dev), dev, 
relpath);
+   free(dev);
+   free(relpath);
+   free(abspath);
+   }
}
if (optlen == 0)
return;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344335 - head/stand/uboot/common

2019-02-19 Thread Ian Lepore
Author: ian
Date: Wed Feb 20 03:00:55 2019
New Revision: 344335
URL: https://svnweb.freebsd.org/changeset/base/344335

Log:
  Fix the handling of legacy-format devices in the u-boot loaderdev variable.
  When I added support for the standard loader(8) disk0s2a: type formats,
  the parsing of legacy format was broken because it also contains a colon,
  but it comes before the slice and partition. That would cause disk_parsedev()
  to return success with the slice and partition set to wildcard values.
  
  This change examines the string first, and if it contains spaces, dots, or
  a colon at any position other than the end, it must be a legacy-format
  string and we don't even try to use disk_parsedev() on it.
  
  Reported by:  Manuel Stuhn

Modified:
  head/stand/uboot/common/main.c

Modified: head/stand/uboot/common/main.c
==
--- head/stand/uboot/common/main.c  Wed Feb 20 02:49:26 2019
(r344334)
+++ head/stand/uboot/common/main.c  Wed Feb 20 03:00:55 2019
(r344335)
@@ -226,16 +226,23 @@ get_load_device(int *type, int *unit, int *slice, int 
p = get_device_type(devstr, type);
 
/*
-* If type is DEV_TYP_STOR we have a disk-like device.  If we can parse
-* the remainder of the string as a standard unit+slice+partition (e.g.,
-* 0s2a or 1p12), return those results.  Otherwise we'll fall through to
-* the code that parses the legacy format.
+* If type is DEV_TYP_STOR we have a disk-like device.  If the remainder
+* of the string contains spaces, dots, or a colon in any location other
+* than the last char, it's legacy format.  Otherwise it might be
+* standard loader(8) format (e.g., disk0s2a or mmc1p12), so try to
+* parse the remainder of the string as such, and if it works, return
+* those results. Otherwise we'll fall through to the code that parses
+* the legacy format.
 */
-   if ((*type & DEV_TYP_STOR) && disk_parsedev(&dev, p, NULL) == 0) {
-   *unit = dev.dd.d_unit;
-   *slice = dev.d_slice;
-   *partition = dev.d_partition;
-   return;
+   if (*type & DEV_TYP_STOR) {
+   size_t len = strlen(p);
+   if (strcspn(p, " .") == len && strcspn(p, ":") >= len - 1 &&
+   disk_parsedev(&dev, p, NULL) == 0) {
+   *unit = dev.dd.d_unit;
+   *slice = dev.d_slice;
+   *partition = dev.d_partition;
+   return;
+   }
}
 
/* Ignore optional spaces after the device name. */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344334 - head/sys/fs/fuse

2019-02-19 Thread Conrad Meyer
Author: cem
Date: Wed Feb 20 02:49:26 2019
New Revision: 344334
URL: https://svnweb.freebsd.org/changeset/base/344334

Log:
  Fuse: whitespace and style(9) cleanup
  
  Take a pass through fixing some of the most egregious whitespace issues in
  fs/fuse.  Also fix some style(9) warts while here.  Not 100% cleaned up, but
  somewhat less painful to look at and edit.
  
  No functional change.

Modified:
  head/sys/fs/fuse/fuse.h
  head/sys/fs/fuse/fuse_device.c
  head/sys/fs/fuse/fuse_file.c
  head/sys/fs/fuse/fuse_file.h
  head/sys/fs/fuse/fuse_internal.h
  head/sys/fs/fuse/fuse_ipc.c
  head/sys/fs/fuse/fuse_ipc.h
  head/sys/fs/fuse/fuse_node.c
  head/sys/fs/fuse/fuse_node.h
  head/sys/fs/fuse/fuse_vfsops.c
  head/sys/fs/fuse/fuse_vnops.c

Modified: head/sys/fs/fuse/fuse.h
==
--- head/sys/fs/fuse/fuse.h Wed Feb 20 02:48:59 2019(r344333)
+++ head/sys/fs/fuse/fuse.h Wed Feb 20 02:49:26 2019(r344334)
@@ -197,26 +197,27 @@ do {  \
 #define FUSE_TRACE  0
 #endif
 
-#define DEBUGX(cond, fmt, ...) do { \
-if (((cond))) { \
-printf("%s: " fmt, __func__, ## __VA_ARGS__);   \
-} } while (0)
+#define DEBUGX(cond, fmt, ...) do {\
+   if (((cond))) { \
+   printf("%s: " fmt, __func__, ## __VA_ARGS__);   \
+   }   \
+} while (0)
 
-#define fuse_lck_mtx_lock(mtx) do { \
-DEBUGX(FUSE_DEBUG_LOCK, "0:   lock(%s): %s@%d by %d\n", \
-__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  \
-mtx_lock(&(mtx));   \
-DEBUGX(FUSE_DEBUG_LOCK, "1:   lock(%s): %s@%d by %d\n", \
-__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  \
-} while (0)
+#define fuse_lck_mtx_lock(mtx) do {
\
+   DEBUGX(FUSE_DEBUG_LOCK, "0:   lock(%s): %s@%d by %d\n", 
\
+   __STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  
\
+   mtx_lock(&(mtx));   
\
+   DEBUGX(FUSE_DEBUG_LOCK, "1:   lock(%s): %s@%d by %d\n", 
\
+   __STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  
\
+} while (0)
 
-#define fuse_lck_mtx_unlock(mtx) do {   \
-DEBUGX(FUSE_DEBUG_LOCK, "0: unlock(%s): %s@%d by %d\n", \
-__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  \
-mtx_unlock(&(mtx)); \
-DEBUGX(FUSE_DEBUG_LOCK, "1: unlock(%s): %s@%d by %d\n", \
-__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  \
-} while (0)
+#define fuse_lck_mtx_unlock(mtx) do {  
\
+   DEBUGX(FUSE_DEBUG_LOCK, "0: unlock(%s): %s@%d by %d\n", 
\
+   __STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  
\
+   mtx_unlock(&(mtx)); 
\
+   DEBUGX(FUSE_DEBUG_LOCK, "1: unlock(%s): %s@%d by %d\n", 
\
+   __STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  
\
+} while (0)
 
 void fuse_ipc_init(void);
 void fuse_ipc_destroy(void);

Modified: head/sys/fs/fuse/fuse_device.c
==
--- head/sys/fs/fuse/fuse_device.c  Wed Feb 20 02:48:59 2019
(r344333)
+++ head/sys/fs/fuse/fuse_device.c  Wed Feb 20 02:49:26 2019
(r344334)
@@ -317,7 +317,7 @@ again:
return (err);
 }
 
-static __inline int
+static inline int
 fuse_ohead_audit(struct fuse_out_header *ohead, struct uio *uio)
 {
FS_DEBUG("Out header -- len: %i, error: %i, unique: %llu; iovecs: %d\n",

Modified: head/sys/fs/fuse/fuse_file.c
==
--- head/sys/fs/fuse/fuse_file.cWed Feb 20 02:48:59 2019
(r344333)
+++ head/sys/fs/fuse/fuse_file.cWed Feb 20 02:49:26 2019
(r344334)
@@ -91,11 +91,8 @@ SYSCTL_INT(_vfs_fuse, OID_AUTO, filehandle_count, CTLF
 &fuse_fh_count, 0, "number of open FUSE filehandles");
 
 int
-fuse_filehandle_open(struct vnode *vp,
-fufh_type_t fufh_type,
-struct fuse_filehandle **fufhp,
-struct thread *td,
-struct ucred *cred)
+fuse_filehandle_open(struct vnode *vp, fufh_type_t fufh_type,
+struct fuse_filehandle **fufhp, struct thread *td, struct ucred *cred)
 {
struct fuse_dispatcher fdi;
struct fuse_open_in *foi;
@@ -114,8 +111

svn commit: r344333 - head/sys/fs/fuse

2019-02-19 Thread Conrad Meyer
Author: cem
Date: Wed Feb 20 02:48:59 2019
New Revision: 344333
URL: https://svnweb.freebsd.org/changeset/base/344333

Log:
  fuse: add descriptions for remaining sysctls
  
  (Except reclaim revoked; I don't know what that goal of that one is.)

Modified:
  head/sys/fs/fuse/fuse_file.c
  head/sys/fs/fuse/fuse_vnops.c

Modified: head/sys/fs/fuse/fuse_file.c
==
--- head/sys/fs/fuse/fuse_file.cWed Feb 20 02:40:38 2019
(r344332)
+++ head/sys/fs/fuse/fuse_file.cWed Feb 20 02:48:59 2019
(r344333)
@@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$");
 static int fuse_fh_count = 0;
 
 SYSCTL_INT(_vfs_fuse, OID_AUTO, filehandle_count, CTLFLAG_RD,
-&fuse_fh_count, 0, "");
+&fuse_fh_count, 0, "number of open FUSE filehandles");
 
 int
 fuse_filehandle_open(struct vnode *vp,

Modified: head/sys/fs/fuse/fuse_vnops.c
==
--- head/sys/fs/fuse/fuse_vnops.c   Wed Feb 20 02:40:38 2019
(r344332)
+++ head/sys/fs/fuse/fuse_vnops.c   Wed Feb 20 02:48:59 2019
(r344333)
@@ -180,17 +180,17 @@ struct vop_vector fuse_vnops = {
 static u_long fuse_lookup_cache_hits = 0;
 
 SYSCTL_ULONG(_vfs_fuse, OID_AUTO, lookup_cache_hits, CTLFLAG_RD,
-&fuse_lookup_cache_hits, 0, "");
+&fuse_lookup_cache_hits, 0, "number of positive cache hits in lookup");
 
 static u_long fuse_lookup_cache_misses = 0;
 
 SYSCTL_ULONG(_vfs_fuse, OID_AUTO, lookup_cache_misses, CTLFLAG_RD,
-&fuse_lookup_cache_misses, 0, "");
+&fuse_lookup_cache_misses, 0, "number of cache misses in lookup");
 
 intfuse_lookup_cache_enable = 1;
 
 SYSCTL_INT(_vfs_fuse, OID_AUTO, lookup_cache_enable, CTLFLAG_RW,
-&fuse_lookup_cache_enable, 0, "");
+&fuse_lookup_cache_enable, 0, "if non-zero, enable lookup cache");
 
 /*
  * XXX: This feature is highly experimental and can bring to instabilities,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344332 - head/sys/x86/x86

2019-02-19 Thread Bruce Evans
Author: bde
Date: Wed Feb 20 02:40:38 2019
New Revision: 344332
URL: https://svnweb.freebsd.org/changeset/base/344332

Log:
  Fix hangs in r341810 waiting for AP startup.
  
  idle_td is dereferenced without thread-locking it to make its contents is
  invariant, and was accessed without telling the compiler that its contents
  is invariant.  Some compilers optimized accesses to the supposedly invariant
  contents by moving the critical checks for changes outside of the loop that
  waits for changes.  Fix this using atomic ops.
  
  This bug only showed up for the following configuration: a Turion2
  system, amd64 kernels, compiled by gcc, and SCHED_4BSD.  clang fails
  to do the optimization with all CFLAGS that I tried, because it doesn't
  fully optimize the '__asm __volatile' for cpu_spinwait() although this
  asm has no memory clobber.  gcc only does the optimization with most
  CFLAGS.  I mostly used -Os with all compilers.  i386 works because gcc
  -m32 -Os only moves 1 or the 2 accesses outside of the loop.
  Non-Turion2 systems and SCHED_ULE worked due to different timing (when
  all APs start before the BP checks them outside of the loop).
  
  Reviewed by:  kib

Modified:
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Wed Feb 20 02:14:41 2019(r344331)
+++ head/sys/x86/x86/mp_x86.c   Wed Feb 20 02:40:38 2019(r344332)
@@ -1088,8 +1088,8 @@ smp_after_idle_runnable(void *arg __unused)
 
for (cpu = 1; cpu < mp_ncpus; cpu++) {
idle_td = pcpu_find(cpu)->pc_idlethread;
-   while (idle_td->td_lastcpu == NOCPU &&
-   idle_td->td_oncpu == NOCPU)
+   while (atomic_load_int(&idle_td->td_lastcpu) == NOCPU &&
+   atomic_load_int(&idle_td->td_oncpu) == NOCPU)
cpu_spinwait();
kmem_free((vm_offset_t)bootstacks[cpu], kstack_pages *
PAGE_SIZE);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344331 - head/sys/teken

2019-02-19 Thread Bruce Evans
Author: bde
Date: Wed Feb 20 02:14:41 2019
New Revision: 344331
URL: https://svnweb.freebsd.org/changeset/base/344331

Log:
  Attempt to complete fixing programmable function keys for syscons.
  
  The flag for the driver capability of supporting the fix is independent
  of the flag for cons25 mode so that it can be managed independently, but
  I forget to preserve it when resetting the terminal.

Modified:
  head/sys/teken/teken_subr.h

Modified: head/sys/teken/teken_subr.h
==
--- head/sys/teken/teken_subr.h Wed Feb 20 01:12:59 2019(r344330)
+++ head/sys/teken/teken_subr.h Wed Feb 20 02:14:41 2019(r344331)
@@ -1000,7 +1000,7 @@ teken_subr_do_reset(teken_t *t)
t->t_scrollreg.ts_begin = 0;
t->t_scrollreg.ts_end = t->t_winsize.tp_row;
t->t_originreg = t->t_scrollreg;
-   t->t_stateflags &= TS_8BIT|TS_CONS25;
+   t->t_stateflags &= TS_8BIT | TS_CONS25 | TS_CONS25KEYS;
t->t_stateflags |= TS_AUTOWRAP;
 
t->t_scs[0] = teken_scs_us_ascii;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r344292 - head/sys/dev/acpica

2019-02-19 Thread Bruce Evans

On Tue, 19 Feb 2019, Tom Jones wrote:


Log:
 Fix style after r340832

 Reported by:   jhb
 Reviewed by:   jhb, jtl
 Approved by:   jtl (mentor)


Unfortunately, acpi (even the FreeBSD dev/acpica part) has a very
non-KNF style.  It is unclear even what this style is, so it is hard to
write changes consistent with it.  But it is clear that this style isn't
the one one used in the line after the one touched by this commit.


Modified: head/sys/dev/acpica/acpi_battery.c
==
--- head/sys/dev/acpica/acpi_battery.c  Tue Feb 19 18:50:20 2019
(r344291)
+++ head/sys/dev/acpica/acpi_battery.c  Tue Feb 19 19:04:52 2019
(r344292)
@@ -172,7 +172,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
 * Be sure we can get various info from the battery.
 */
if (ACPI_BATT_GET_STATUS(batt_dev, &bst[i]) != 0 ||
-   ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
+   ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
continue;

/* If a battery is not installed, we sometimes get strange values. */


acpica uses 4-column indents, especially in this file, so the 'continue' line
is clearly misindented here.

acpica's indentation for continued lines is unclear.  The KNF 4-column
continuation indent works very badly when the main indent is also 4-column.
But it is used in similar code (including a 'continue' just 5 lines after
here).  So it is consistently bad here.

Elsewhere, acpica seems to use gnu style (-lp).  Here and 5 lines later,
that accidentally gives the 4-column indent by lining up with the
parentheses of 'if (',

A quick look at some other files shows many examples of gnu style (-lp)
for long function parameter lists, and many similar regressions towards
KNF style.

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


svn commit: r344325 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Feb 20 00:25:45 2019
New Revision: 344325
URL: https://svnweb.freebsd.org/changeset/base/344325

Log:
  Simplify the code. No functional changes.
  
  Reviewed by:  rpokala

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.cWed Feb 
20 00:19:11 2019(r344324)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.cWed Feb 
20 00:25:45 2019(r344325)
@@ -568,10 +568,7 @@ vdev_raidz_map_alloc(abd_t *abd, uint64_t size, uint64
abd_alloc_linear(rm->rm_col[c].rc_size, B_TRUE);
}
 
-   rm->rm_col[c].rc_abd = abd_get_offset(abd, 0);
-   off = rm->rm_col[c].rc_size;
-
-   for (c = c + 1; c < acols; c++) {
+   for (off = 0; c < acols; c++) {
rm->rm_col[c].rc_abd = abd_get_offset(abd, off);
off += rm->rm_col[c].rc_size;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344320 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Feb 19 23:53:33 2019
New Revision: 344320
URL: https://svnweb.freebsd.org/changeset/base/344320

Log:
  Simplify the code.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c  Tue Feb 
19 23:44:00 2019(r344319)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c  Tue Feb 
19 23:53:33 2019(r344320)
@@ -360,16 +360,13 @@ trim_map_write_start(zio_t *zio)
return (B_FALSE);
}
 
-   ts = avl_find(&tm->tm_queued_frees, &tsearch, NULL);
-   if (ts != NULL) {
-   /*
-* Loop until all overlapping segments are removed.
-*/
-   do {
-   trim_map_segment_remove(tm, ts, start, end);
-   ts = avl_find(&tm->tm_queued_frees, &tsearch, NULL);
-   } while (ts != NULL);
+   /*
+* Loop until all overlapping segments are removed.
+*/
+   while ((ts = avl_find(&tm->tm_queued_frees, &tsearch, NULL)) != NULL) {
+   trim_map_segment_remove(tm, ts, start, end);
}
+
avl_add(&tm->tm_inflight_writes, zio);
 
mutex_exit(&tm->tm_lock);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344319 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Feb 19 23:44:00 2019
New Revision: 344319
URL: https://svnweb.freebsd.org/changeset/base/344319

Log:
  Correct typo in the comment.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.cTue Feb 
19 23:43:15 2019(r344318)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.cTue Feb 
19 23:44:00 2019(r344319)
@@ -2558,7 +2558,7 @@ vdev_raidz_io_done(zio_t *zio)
/*
 * We're here because either:
 *
-*  total_errors == rm_first_datacol, or
+*  total_errors == rm_firstdatacol, or
 *  vdev_raidz_combrec() failed
 *
 * In either case, there is enough bad data to prevent
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r344316 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-19 Thread Shawn Webb
On Tue, Feb 19, 2019 at 11:35:56PM +, Pawel Jakub Dawidek wrote:
> Author: pjd
> Date: Tue Feb 19 23:35:55 2019
> New Revision: 344316
> URL: https://svnweb.freebsd.org/changeset/base/344316
> 
> Log:
>   The way ZFS searches for its vdevs is the following: first it looks for
>   a vdev that has the same name as the one stored in metadata and that has
>   all VDEV labels in place. If it cannot find a GEOM provider with the given
>   name and all VDEV labels it will scan all GEOM providers for the best match
>   (the most VDEV labels available), but here the name is ignored.
>   
>   In case the ZFS pool is created, eg. using GPT partition label:
>   
>   # zpool create tank /dev/gpt/tank
>   
>   everything works, and on every import ZFS will pick /dev/gpt/tank and
>   not /dev/da0p4.
>   
>   The problem occurs when da0p4 is extended and ZFS is unable to find all
>   VDEV labels in /dev/gpt/tank anymore (the VDEV labels stored at the end
>   of the partition are now somewhere else). In this case it will scan all
>   GEOM providers and will pick the first one with the best match, ie. da0p4.
>   
>   Fix this problem by checking the VDEV/provider name even if we get the same
>   match. If the name is the same as the one we have in pool's metadata, prefer
>   this GEOM provider.
>   
>   Reported by:oshogbo, Michal Mroz 
>   Tested by:  Michal Mroz 
>   Obtained from:  Fudo Security
> 
> Modified:
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c

At the risk of painting a bikeshed a lovely color of neon purple, I'm
curious about if/how these types of commits get merged upstream to
(OpenZFS|Illumos|ZFS On Linux|where ever ZFS upstream is now|I'm very
confused|is anyone else confused where upstream is?).

Who is upstream? Is work like this going to remain as a downstream
patch to ZFS? Or is FreeBSD going to work to upstream this type of
work?

I hope my curiousity doesn't offend anyone. ;)

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

Tor-ified Signal:+1 443-546-8752
Tor+XMPP+OTR:latt...@is.a.hacker.sx
GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


svn commit: r344318 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Feb 19 23:43:15 2019
New Revision: 344318
URL: https://svnweb.freebsd.org/changeset/base/344318

Log:
  Change assertion to log the incorrect io_type we've got.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.cTue Feb 
19 23:41:23 2019(r344317)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.cTue Feb 
19 23:43:15 2019(r344318)
@@ -2020,7 +2020,7 @@ vdev_raidz_io_start(zio_t *zio)
return;
}
 
-   ASSERT(zio->io_type == ZIO_TYPE_READ);
+   ASSERT3U(zio->io_type, ==, ZIO_TYPE_READ);
 
/*
 * Iterate over the columns in reverse order so that we hit the parity
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344317 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Feb 19 23:41:23 2019
New Revision: 344317
URL: https://svnweb.freebsd.org/changeset/base/344317

Log:
  Grabage-collect no longer used variable.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.cTue Feb 
19 23:35:55 2019(r344316)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.cTue Feb 
19 23:41:23 2019(r344317)
@@ -270,7 +270,6 @@ static void
 vdev_raidz_map_free(raidz_map_t *rm)
 {
int c;
-   size_t size;
 
for (c = 0; c < rm->rm_firstdatacol; c++) {
if (rm->rm_col[c].rc_abd != NULL)
@@ -281,11 +280,9 @@ vdev_raidz_map_free(raidz_map_t *rm)
rm->rm_col[c].rc_size);
}
 
-   size = 0;
for (c = rm->rm_firstdatacol; c < rm->rm_cols; c++) {
if (rm->rm_col[c].rc_abd != NULL)
abd_put(rm->rm_col[c].rc_abd);
-   size += rm->rm_col[c].rc_size;
}
 
if (rm->rm_abd_copy != NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344316 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Feb 19 23:35:55 2019
New Revision: 344316
URL: https://svnweb.freebsd.org/changeset/base/344316

Log:
  The way ZFS searches for its vdevs is the following: first it looks for
  a vdev that has the same name as the one stored in metadata and that has
  all VDEV labels in place. If it cannot find a GEOM provider with the given
  name and all VDEV labels it will scan all GEOM providers for the best match
  (the most VDEV labels available), but here the name is ignored.
  
  In case the ZFS pool is created, eg. using GPT partition label:
  
# zpool create tank /dev/gpt/tank
  
  everything works, and on every import ZFS will pick /dev/gpt/tank and
  not /dev/da0p4.
  
  The problem occurs when da0p4 is extended and ZFS is unable to find all
  VDEV labels in /dev/gpt/tank anymore (the VDEV labels stored at the end
  of the partition are now somewhere else). In this case it will scan all
  GEOM providers and will pick the first one with the best match, ie. da0p4.
  
  Fix this problem by checking the VDEV/provider name even if we get the same
  match. If the name is the same as the one we have in pool's metadata, prefer
  this GEOM provider.
  
  Reported by:  oshogbo, Michal Mroz 
  Tested by:Michal Mroz 
  Obtained from:Fudo Security

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Feb 
19 23:24:39 2019(r344315)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Feb 
19 23:35:55 2019(r344316)
@@ -692,10 +692,12 @@ vdev_geom_attach_by_guids(vdev_t *vd)
struct g_geom *gp;
struct g_provider *pp, *best_pp;
struct g_consumer *cp;
+   const char *vdpath;
enum match match, best_match;
 
g_topology_assert();
 
+   vdpath = vd->vdev_path + sizeof("/dev/") - 1;
cp = NULL;
best_pp = NULL;
best_match = NO_MATCH;
@@ -710,6 +712,10 @@ vdev_geom_attach_by_guids(vdev_t *vd)
if (match > best_match) {
best_match = match;
best_pp = pp;
+   } else if (match == best_match) {
+   if (strcmp(pp->name, vdpath) == 0) {
+   best_pp = pp;
+   }
}
if (match == FULL_MATCH)
goto out;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344315 - head/release/tools

2019-02-19 Thread Colin Percival
Author: cperciva
Date: Tue Feb 19 23:24:39 2019
New Revision: 344315
URL: https://svnweb.freebsd.org/changeset/base/344315

Log:
  Fix sed script to insert Amazon NTP server into ntp.conf once rather
  than twice.
  
  Reported by:  Rafal Lukawiecki
  MFC after:1 week

Modified:
  head/release/tools/ec2.conf

Modified: head/release/tools/ec2.conf
==
--- head/release/tools/ec2.conf Tue Feb 19 23:22:39 2019(r344314)
+++ head/release/tools/ec2.conf Tue Feb 19 23:24:39 2019(r344315)
@@ -96,7 +96,7 @@ vm_extra_pre_umount() {
 
# Use the NTP service provided by Amazon
sed -i '' -e 's/^pool/#pool/' \
-   -e 's/^#server.*/server 169.254.169.123 iburst/' \
+   -e '1,/^#server/s/^#server.*/server 169.254.169.123 iburst/' \
${DESTDIR}/etc/ntp.conf
 
# The first time the AMI boots, the installed "first boot" scripts
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344314 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Feb 19 23:22:39 2019
New Revision: 344314
URL: https://svnweb.freebsd.org/changeset/base/344314

Log:
  In the vdev_geom_open_by_path() function we assume that vdev path starts
  with "/dev/". Make sure this is the case.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Feb 
19 22:46:50 2019(r344313)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Feb 
19 23:22:39 2019(r344314)
@@ -794,7 +794,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *
/*
 * We must have a pathname, and it must be absolute.
 */
-   if (vd->vdev_path == NULL || vd->vdev_path[0] != '/') {
+   if (vd->vdev_path == NULL || strncmp(vd->vdev_path, "/dev/", 5) != 0) {
vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL;
return (EINVAL);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344310 - head/lib/libc/tests/sys

2019-02-19 Thread Enji Cooper
Author: ngie
Date: Tue Feb 19 22:19:31 2019
New Revision: 344310
URL: https://svnweb.freebsd.org/changeset/base/344310

Log:
  Make `server_cat(..)` handle short receives
  
  In short, the prior code was far too simplistic when it came to calling 
recv(2)
  and failed intermittently (or in the case of Jenkins, deterministically).
  
  Handle short recv(2)s by checking the return code and incrementing the window
  into the buffer by the number of received bytes. If the number of received
  bytes <= 0, then bail out of the loop, and test the total number of received
  bytes vs the expected number of bytes sent for equality, and base whether or
  not the test passes/fails on that fact.
  
  Remove the expected failure, now that the hdtr testcases deterministically 
pass
  on my host after this change [1].
  
  PR:   234809 [1], 235200
  Reviewed by:  asomers
  Approved by:  emaste (mentor)
  MFC after:1 week
  Differential Revision: https://reviews.freebsd.org/D19188

Modified:
  head/lib/libc/tests/sys/sendfile_test.c

Modified: head/lib/libc/tests/sys/sendfile_test.c
==
--- head/lib/libc/tests/sys/sendfile_test.c Tue Feb 19 21:58:23 2019
(r344309)
+++ head/lib/libc/tests/sys/sendfile_test.c Tue Feb 19 22:19:31 2019
(r344310)
@@ -156,6 +156,8 @@ setup_client(int domain, int type, int port)
"Will try to connect to host='%s', address_family=%d, "
"socket_type=%d\n",
host, res->ai_family, res->ai_socktype);
+   /* Avoid a double print when forked by flushing. */
+   fflush(stdout);
sock = make_socket(res->ai_family, res->ai_socktype, res->ai_protocol);
error = connect(sock, (struct sockaddr*)res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
@@ -187,6 +189,8 @@ setup_server(int domain, int type, int port)
"Will try to bind socket to host='%s', address_family=%d, "
"socket_type=%d\n",
host, res->ai_family, res->ai_socktype);
+   /* Avoid a double print when forked by flushing. */
+   fflush(stdout);
error = bind(sock, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
ATF_REQUIRE_EQ_MSG(error, 0, "bind failed: %s", strerror(errno));
@@ -204,11 +208,17 @@ setup_server(int domain, int type, int port)
 static void
 server_cat(const char *dest_filename, int server_sock, size_t len)
 {
-   char *buffer;
+   char *buffer, *buf_window_ptr;
int recv_sock;
-   ssize_t received_bytes;
+   size_t buffer_size;
+   ssize_t received_bytes, recv_ret;
 
-   buffer = calloc(len + 1, sizeof(char));
+   /*
+* Ensure that there isn't excess data sent across the wire by
+* capturing 10 extra bytes (plus 1 for nul).
+*/
+   buffer_size = len + 10 + 1;
+   buffer = calloc(buffer_size, sizeof(char));
if (buffer == NULL)
err(1, "malloc failed");
 
@@ -216,32 +226,26 @@ server_cat(const char *dest_filename, int server_sock,
if (recv_sock == -1)
err(1, "accept failed");
 
-   /*
-* XXX: this assumes the simplest case where all data is received in a
-* single recv(2) call.
-*/
-   if (recv(recv_sock, buffer, len, 0) == -1)
-   err(1, "recv failed");
+   buf_window_ptr = buffer;
+   received_bytes = 0;
+   do {
+   recv_ret = recv(recv_sock, buf_window_ptr,
+   buffer_size - received_bytes, 0);
+   if (recv_ret <= 0)
+   break;
+   buf_window_ptr += recv_ret;
+   received_bytes += recv_ret;
+   } while (received_bytes < buffer_size);
 
atf_utils_create_file(dest_filename, "%s", buffer);
 
-   /*
-* This recv(2) call helps ensure the amount of sent data is exactly
-* what was specified by `len`.
-*/
-   received_bytes = recv(recv_sock, buffer, len, 0);
-   switch (received_bytes) {
-   case -1:
-   err(1, "recv failed");
-   case 0:
-   break;
-   default:
-   errx(1, "received unexpected data: %s", buffer);
-   }
-
(void)close(recv_sock);
(void)close(server_sock);
free(buffer);
+
+   if (received_bytes != len)
+   errx(1, "received unexpected data: %zd != %zd", received_bytes,
+   len);
 }
 
 static int
@@ -666,10 +670,6 @@ hdtr_positive_test(int domain)
trailers[0].iov_len = strlen(trailers[0].iov_base);
offset = 0;
nbytes = 0;
-
-   atf_tc_expect_fail(
-   "The header/trailer testcases fail today with a data mismatch; "
-   "bug # 234809");
 
for (i = 0; i < nitems(testcases); i++) {
struct sf_hdtr hdtr;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/li

svn commit: r344309 - head/sys/teken

2019-02-19 Thread Ed Schouten
Author: ed
Date: Tue Feb 19 21:58:23 2019
New Revision: 344309
URL: https://svnweb.freebsd.org/changeset/base/344309

Log:
  Place an upper bound on the number of iterations for REP.
  
  Right now it's possible to invoke the REP escape sequence with a maximum
  of tens of millions of iterations. In practice, there is never any need
  to do this. Calling it more frequently than the number of cells in the
  terminal hardly makes any sense. By placing a limit on it, we can
  prevent users from exhausting resources in inside the terminal emulator.
  
  As support for this escape sequence is not present in any of the stable
  branches, there is no need to MFC.
  
  Reported by:  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11255

Modified:
  head/sys/teken/teken_subr.h

Modified: head/sys/teken/teken_subr.h
==
--- head/sys/teken/teken_subr.h Tue Feb 19 21:49:48 2019(r344308)
+++ head/sys/teken/teken_subr.h Tue Feb 19 21:58:23 2019(r344309)
@@ -1337,8 +1337,11 @@ teken_subr_vertical_position_absolute(teken_t *t, unsi
 static void
 teken_subr_repeat_last_graphic_char(teken_t *t, unsigned int rpts)
 {
+   unsigned int max_repetitions;
 
+   max_repetitions = t->t_winsize.tp_row * t->t_winsize.tp_col;
+   if (rpts > max_repetitions)
+   rpts = max_repetitions;
for (; t->t_last != 0 && rpts > 0; rpts--)
teken_subr_regular_character(t, t->t_last);
 }
-
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344308 - head/sys/teken

2019-02-19 Thread Ed Schouten
Author: ed
Date: Tue Feb 19 21:49:48 2019
New Revision: 344308
URL: https://svnweb.freebsd.org/changeset/base/344308

Log:
  Add missing __unused attributes to unused function arguments.
  
  This fixes the userspace build of libteken.

Modified:
  head/sys/teken/teken_subr.h

Modified: head/sys/teken/teken_subr.h
==
--- head/sys/teken/teken_subr.h Tue Feb 19 21:33:02 2019(r344307)
+++ head/sys/teken/teken_subr.h Tue Feb 19 21:49:48 2019(r344308)
@@ -372,7 +372,7 @@ teken_subr_cursor_up(teken_t *t, unsigned int nrows)
 }
 
 static void
-teken_subr_set_cursor_style(teken_t *t, unsigned int style)
+teken_subr_set_cursor_style(teken_t *t __unused, unsigned int style __unused)
 {
 
/* TODO */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344307 - head/sys/geom

2019-02-19 Thread Mark Johnston
Author: markj
Date: Tue Feb 19 21:33:02 2019
New Revision: 344307
URL: https://svnweb.freebsd.org/changeset/base/344307

Log:
  Limit the number of entries allocated for a REPORT_ZONES command.
  
  The DIOCGETZONE ioctl can be used to fetch the zone list of an SMR
  drive, and the caller specifies the number of entries it wants to fetch.
  Clamp the caller's request to a sane limit so that a user cannot attempt
  large allocations. Callers already need to invoke the ioctl multiple
  times to fetch the full list in general, so there's no harm in limiting
  the number of entries returned.
  
  Fix style while here.
  
  admbug:   807
  Reported by:  Ilja Van Sprundel 
  Reviewed by:  asomers, ken
  Tested by:ken
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19249

Modified:
  head/sys/geom/geom_dev.c

Modified: head/sys/geom/geom_dev.c
==
--- head/sys/geom/geom_dev.cTue Feb 19 21:27:30 2019(r344306)
+++ head/sys/geom/geom_dev.cTue Feb 19 21:33:02 2019(r344307)
@@ -677,8 +677,10 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data
alloc_size = 0;
 
if (zone_args->zone_cmd == DISK_ZONE_REPORT_ZONES) {
-
rep = &zone_args->zone_params.report;
+#defineMAXENTRIES  (MAXPHYS / sizeof(struct disk_zone_rep_entry))
+   if (rep->entries_allocated > MAXENTRIES)
+   rep->entries_allocated = MAXENTRIES;
alloc_size = rep->entries_allocated *
sizeof(struct disk_zone_rep_entry);
if (alloc_size != 0)
@@ -688,15 +690,11 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data
rep->entries = new_entries;
}
error = g_io_zonecmd(zone_args, cp);
-   if ((zone_args->zone_cmd == DISK_ZONE_REPORT_ZONES)
-&& (alloc_size != 0)
-&& (error == 0)) {
+   if (zone_args->zone_cmd == DISK_ZONE_REPORT_ZONES &&
+   alloc_size != 0 && error == 0)
error = copyout(new_entries, old_entries, alloc_size);
-   }
-   if ((old_entries != NULL)
-&& (rep != NULL))
+   if (old_entries != NULL && rep != NULL)
rep->entries = old_entries;
-
if (new_entries != NULL)
g_free(new_entries);
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344306 - head/bin/sh

2019-02-19 Thread Jilles Tjoelker
Author: jilles
Date: Tue Feb 19 21:27:30 2019
New Revision: 344306
URL: https://svnweb.freebsd.org/changeset/base/344306

Log:
  sh: Send normal output from bind builtin to stdout
  
  PR:   233343
  Submitted by: Yuichiro NAITO (original version)

Modified:
  head/bin/sh/histedit.c
  head/bin/sh/output.c
  head/bin/sh/output.h

Modified: head/bin/sh/histedit.c
==
--- head/bin/sh/histedit.c  Tue Feb 19 21:22:22 2019(r344305)
+++ head/bin/sh/histedit.c  Tue Feb 19 21:27:30 2019(r344306)
@@ -472,10 +472,31 @@ str_to_event(const char *str, int last)
 int
 bindcmd(int argc, char **argv)
 {
+   int ret;
+   FILE *old;
+   FILE *out;
 
if (el == NULL)
error("line editing is disabled");
-   return (el_parse(el, argc, __DECONST(const char **, argv)));
+
+   INTOFF;
+
+   out = out1fp();
+   if (out == NULL)
+   error("Out of space");
+
+   el_get(el, EL_GETFP, 1, &old);
+   el_set(el, EL_SETFP, 1, out);
+
+   ret = el_parse(el, argc, __DECONST(const char **, argv));
+
+   el_set(el, EL_SETFP, 1, old);
+
+   fclose(out);
+
+   INTON;
+
+   return ret;
 }
 
 #else

Modified: head/bin/sh/output.c
==
--- head/bin/sh/output.cTue Feb 19 21:22:22 2019(r344305)
+++ head/bin/sh/output.cTue Feb 19 21:27:30 2019(r344306)
@@ -340,6 +340,12 @@ doformat(struct output *dest, const char *f, va_list a
}
 }
 
+FILE *
+out1fp(void)
+{
+   return fwopen(out1, doformat_wr);
+}
+
 /*
  * Version of write which resumes after a signal is caught.
  */

Modified: head/bin/sh/output.h
==
--- head/bin/sh/output.hTue Feb 19 21:22:22 2019(r344305)
+++ head/bin/sh/output.hTue Feb 19 21:27:30 2019(r344306)
@@ -39,6 +39,7 @@
 
 #include 
 #include 
+#include 
 
 struct output {
char *nextc;
@@ -75,6 +76,7 @@ void out1fmt(const char *, ...) __printflike(1, 2);
 void out2fmt_flush(const char *, ...) __printflike(1, 2);
 void fmtstr(char *, int, const char *, ...) __printflike(3, 4);
 void doformat(struct output *, const char *, va_list) __printflike(2, 0);
+FILE *out1fp(void);
 int xwrite(int, const char *, int);
 
 #define outc(c, file)  ((file)->nextc == (file)->bufend ? (emptyoutbuf(file), 
*(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344305 - head/sys/geom

2019-02-19 Thread Mark Johnston
Author: markj
Date: Tue Feb 19 21:22:22 2019
New Revision: 344305
URL: https://svnweb.freebsd.org/changeset/base/344305

Log:
  Impose a limit on the number of GEOM_CTL arguments.
  
  Otherwise a privileged user can trigger a memory allocation of
  unbounded size, or an integer overflow in the subsequent
  geom_alloc_copyin() call, leading to out-of-bounds accesses.
  
  Hard-code a large limit to circumvent this problem.
  
  admbug:   854
  Reported by:  Anonymous of the Shellphish Grill Team
  Reviewed by:  ae
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19251

Modified:
  head/sys/geom/geom_ctl.c

Modified: head/sys/geom/geom_ctl.c
==
--- head/sys/geom/geom_ctl.cTue Feb 19 21:20:50 2019(r344304)
+++ head/sys/geom/geom_ctl.cTue Feb 19 21:22:22 2019(r344305)
@@ -139,6 +139,12 @@ gctl_copyin(struct gctl_req *req)
char *p;
u_int i;
 
+   if (req->narg > 2048) {
+   gctl_error(req, "too many arguments");
+   req->arg = NULL;
+   return;
+   }
+
ap = geom_alloc_copyin(req, req->arg, req->narg * sizeof(*ap));
if (ap == NULL) {
gctl_error(req, "bad control request");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344304 - in head/sys: amd64/conf i386/conf

2019-02-19 Thread Warner Losh
Author: imp
Date: Tue Feb 19 21:20:50 2019
New Revision: 344304
URL: https://svnweb.freebsd.org/changeset/base/344304

Log:
  Remove drm from LINT kernels
  
  drm was accidentally left in the LINT kernels.
  
  Pointy hat to: imp

Modified:
  head/sys/amd64/conf/NOTES
  head/sys/i386/conf/NOTES

Modified: head/sys/amd64/conf/NOTES
==
--- head/sys/amd64/conf/NOTES   Tue Feb 19 20:26:03 2019(r344303)
+++ head/sys/amd64/conf/NOTES   Tue Feb 19 21:20:50 2019(r344304)
@@ -286,17 +286,6 @@ optionsACPI_DEBUG
 # The cpufreq(4) driver provides support for non-ACPI CPU frequency control
 device cpufreq
 
-# Direct Rendering modules for 3D acceleration.
-device drm # DRM core module required by DRM drivers
-device mach64drm   # ATI Rage Pro, Rage Mobility P/M, Rage XL
-device mgadrm  # AGP Matrox G200, G400, G450, G550
-device r128drm # ATI Rage 128
-device savagedrm   # S3 Savage3D, Savage4
-device sisdrm  # SiS 300/305, 540, 630
-device tdfxdrm # 3dfx Voodoo 3/4/5 and Banshee
-device viadrm  # VIA
-optionsDRM_DEBUG   # Include debug printfs (slow)
-
 #
 # Network interfaces:
 #

Modified: head/sys/i386/conf/NOTES
==
--- head/sys/i386/conf/NOTESTue Feb 19 20:26:03 2019(r344303)
+++ head/sys/i386/conf/NOTESTue Feb 19 21:20:50 2019(r344304)
@@ -489,17 +489,6 @@ device aibs
 # The cpufreq(4) driver provides support for non-ACPI CPU frequency control
 device cpufreq
 
-# Direct Rendering modules for 3D acceleration.
-device drm # DRM core module required by DRM drivers
-device mach64drm   # ATI Rage Pro, Rage Mobility P/M, Rage XL
-device mgadrm  # AGP Matrox G200, G400, G450, G550
-device r128drm # ATI Rage 128
-device savagedrm   # S3 Savage3D, Savage4
-device sisdrm  # SiS 300/305, 540, 630
-device tdfxdrm # 3dfx Voodoo 3/4/5 and Banshee
-device viadrm  # VIA
-optionsDRM_DEBUG   # Include debug printfs (slow)
-
 #
 # Network interfaces:
 #
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344303 - head/usr.bin/mkuzip

2019-02-19 Thread Konstantin Belousov
Author: kib
Date: Tue Feb 19 20:26:03 2019
New Revision: 344303
URL: https://svnweb.freebsd.org/changeset/base/344303

Log:
  Minor cleanup for mkuzip(8) man page.
  
  List all single-letter options in summary.
  Order options alphabetically.
  
  Sponsored by: Mellanox Technologies
  MFC after:3 days

Modified:
  head/usr.bin/mkuzip/mkuzip.8

Modified: head/usr.bin/mkuzip/mkuzip.8
==
--- head/usr.bin/mkuzip/mkuzip.8Tue Feb 19 20:12:12 2019
(r344302)
+++ head/usr.bin/mkuzip/mkuzip.8Tue Feb 19 20:26:03 2019
(r344303)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 17, 2006
+.Dd February 19, 2019
 .Dt MKUZIP 8
 .Os
 .Sh NAME
@@ -35,10 +35,10 @@
 class
 .Sh SYNOPSIS
 .Nm
-.Op Fl v
+.Op Fl dLSsvZ
+.Op Fl j Ar compression_jobs
 .Op Fl o Ar outfile
 .Op Fl s Ar cluster_size
-.Op Fl j Ar compression_jobs
 .Ar infile
 .Sh DESCRIPTION
 The
@@ -68,6 +68,33 @@ locating each individual cluster is written to the out
 .Pp
 The options are:
 .Bl -tag -width indent
+.It Fl j Ar compression_jobs
+Specify the number of compression jobs that
+.Nm
+runs in parallel to speed up compression.
+When option is not specified the number of jobs set to be equal
+to the value of
+.Va hw.ncpu
+.Xr sysctl 8
+variable.
+.It Fl d
+Enable de-duplication.
+When the option is enabled the
+.Nm
+detects identical blocks in the input and replaces each subsequent occurence
+of such block with pointer to the very first one in the output.
+Setting this option results is moderate decrease of compressed image size,
+typically around 3-5% of a final size of the compressed image.
+.It Fl L
+Use
+.Xr lzma 3
+compression algorithm instead of the default
+.Xr zlib 3 .
+The
+.Xr lzma 3
+provides noticeable better compression levels on the same data set
+at the expense of much slower compression speed (10-20x) and somewhat slower
+decompression (2-3x).
 .It Fl o Ar outfile
 Name of the output file
 .Ar outfile .
@@ -79,16 +106,9 @@ compression or
 .Pa .ulzma
 for the
 .Xr lzma 3 .
-.It Fl L
-Use
-.Xr lzma 3
-compression algorithm instead of the default
-.Xr zlib 3 .
-The
-.Xr lzma 3
-provides noticeable better compression levels on the same data set
-at the expense of much slower compression speed (10-20x) and somewhat slower
-decompression (2-3x).
+.It Fl S
+Print summary about the compression ratio as well as output
+file size after file has been processed.
 .It Fl s Ar cluster_size
 Split the image into clusters of
 .Ar cluster_size
@@ -111,26 +131,6 @@ Setting
 .Fl Z
 results is slight increase of compressed image size, typically less than 0.1%
 of a final size of the compressed image.
-.It Fl d
-Enable de-duplication.
-When the option is enabled the
-.Nm
-detects identical blocks in the input and replaces each subsequent occurence
-of such block with pointer to the very first one in the output.
-Setting this option results is moderate decrease of compressed image size,
-typically around 3-5% of a final size of the compressed image.
-.It Fl S
-Print summary about the compression ratio as well as output
-file size after file has been processed.
-.It Fl j Ar compression_jobs
-Specify the number of compression jobs that
-.Nm
-runs in parallel to speed up compression.
-When option is not specified the number of jobs set to be equal
-to the value of
-.Va hw.ncpu
-.Xr sysctl 8
-variable.
 .El
 .Sh NOTES
 The compression ratio largely depends on the cluster size used.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344302 - head/sbin/fsck_ffs

2019-02-19 Thread Kirk McKusick
Author: mckusick
Date: Tue Feb 19 20:12:12 2019
New Revision: 344302
URL: https://svnweb.freebsd.org/changeset/base/344302

Log:
  Ensure that inode updates are properly flushed out during the first
  pass of fsck_ffs. Some changes, such as check-hash corrections were
  being lost.
  
  Reported by: Michael Tuexen (tuexen@)
  Tested by:   Michael Tuexen (tuexen@)
  MFC after:   3 days

Modified:
  head/sbin/fsck_ffs/inode.c

Modified: head/sbin/fsck_ffs/inode.c
==
--- head/sbin/fsck_ffs/inode.c  Tue Feb 19 19:57:55 2019(r344301)
+++ head/sbin/fsck_ffs/inode.c  Tue Feb 19 20:12:12 2019(r344302)
@@ -349,9 +349,11 @@ getnextinode(ino_t inumber, int rebuildcg)
lastinum += fullcnt;
}
/*
+* Flush old contents in case they have been updated.
 * If getblk encounters an error, it will already have zeroed
 * out the buffer, so we do not need to do so here.
 */
+   flush(fswritefd, &inobuf);
getblk(&inobuf, blk, size);
nextinop = inobuf.b_un.b_buf;
}
@@ -461,6 +463,10 @@ void
 freeinodebuf(void)
 {
 
+   /*
+* Flush old contents in case they have been updated.
+*/
+   flush(fswritefd, &inobuf);
if (inobuf.b_un.b_buf != NULL)
free((char *)inobuf.b_un.b_buf);
inobuf.b_un.b_buf = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344301 - head/sys/netinet6

2019-02-19 Thread Tom Jones
Author: thj
Date: Tue Feb 19 19:57:55 2019
New Revision: 344301
URL: https://svnweb.freebsd.org/changeset/base/344301

Log:
  When dropping a fragment queue count the number of fragments in the queue
  
  When dropping a fragment queue, account for the number of fragments in the
  queue. This improves accounting between the number of fragments received and
  the number of fragments dropped.
  
  Reviewed by:  jtl, bz, transport
  Approved by:  jtl (mentor), bz (mentor)
  Differential Revision:https://review.freebsd.org/D17521

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Tue Feb 19 19:37:09 2019(r344300)
+++ head/sys/netinet6/frag6.c   Tue Feb 19 19:57:55 2019(r344301)
@@ -593,7 +593,7 @@ insert:
 af6 = af6->ip6af_down) {
if (af6->ip6af_off != next) {
if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) {
-   IP6STAT_INC(ip6s_fragdropped);
+   IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag);
frag6_freef(q6, hash);
}
IP6Q_UNLOCK(hash);
@@ -603,7 +603,7 @@ insert:
}
if (af6->ip6af_up->ip6af_mff) {
if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) {
-   IP6STAT_INC(ip6s_fragdropped);
+   IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag);
frag6_freef(q6, hash);
}
IP6Q_UNLOCK(hash);
@@ -861,7 +861,8 @@ frag6_slowtimo(void)
--q6->ip6q_ttl;
q6 = q6->ip6q_next;
if (q6->ip6q_prev->ip6q_ttl == 0) {
-   IP6STAT_INC(ip6s_fragtimeout);
+   IP6STAT_ADD(ip6s_fragtimeout,
+   q6->ip6q_prev->ip6q_nfrag);
/* XXX in6_ifstat_inc(ifp, 
ifs6_reass_fail) */
frag6_freef(q6->ip6q_prev, i);
}
@@ -879,7 +880,8 @@ frag6_slowtimo(void)
(V_ip6_maxfragpackets > 0 &&
V_ip6q[i].count > V_ip6_maxfragbucketsize)) &&
head->ip6q_prev != head) {
-   IP6STAT_INC(ip6s_fragoverflow);
+   IP6STAT_ADD(ip6s_fragoverflow,
+   q6->ip6q_prev->ip6q_nfrag);
/* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
frag6_freef(head->ip6q_prev, i);
}
@@ -896,7 +898,8 @@ frag6_slowtimo(void)
IP6Q_LOCK(i);
head = IP6Q_HEAD(i);
if (head->ip6q_prev != head) {
-   IP6STAT_INC(ip6s_fragoverflow);
+   IP6STAT_ADD(ip6s_fragoverflow,
+   q6->ip6q_prev->ip6q_nfrag);
/* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
frag6_freef(head->ip6q_prev, i);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344299 - in head/sys: conf dev/drm2 dev/drm2/i915 dev/drm2/radeon dev/drm2/radeon/reg_srcs

2019-02-19 Thread Warner Losh
Author: imp
Date: Tue Feb 19 19:37:02 2019
New Revision: 344299
URL: https://svnweb.freebsd.org/changeset/base/344299

Log:
  Remove the i915 and radeon drivers.
  
  Per discussions on arch@ and elsewhere, the maintenance of this code
  has moved to the drm-kmod and drm-legacy-kmod ports. Remove the i915
  and radeon drivers from the tree.
  
  Approved by: graphics team
  Reviewed by: manu@, mmel@
  Differential Revision: https://reviews.freebsd.org/D19196

Deleted:
  head/sys/dev/drm2/ati_pcigart.c
  head/sys/dev/drm2/i915/dvo.h
  head/sys/dev/drm2/i915/dvo_ch7017.c
  head/sys/dev/drm2/i915/dvo_ch7xxx.c
  head/sys/dev/drm2/i915/dvo_ivch.c
  head/sys/dev/drm2/i915/dvo_ns2501.c
  head/sys/dev/drm2/i915/dvo_sil164.c
  head/sys/dev/drm2/i915/dvo_tfp410.c
  head/sys/dev/drm2/i915/i915_debug.c
  head/sys/dev/drm2/i915/i915_dma.c
  head/sys/dev/drm2/i915/i915_drm.h
  head/sys/dev/drm2/i915/i915_drv.c
  head/sys/dev/drm2/i915/i915_drv.h
  head/sys/dev/drm2/i915/i915_gem.c
  head/sys/dev/drm2/i915/i915_gem_context.c
  head/sys/dev/drm2/i915/i915_gem_evict.c
  head/sys/dev/drm2/i915/i915_gem_execbuffer.c
  head/sys/dev/drm2/i915/i915_gem_gtt.c
  head/sys/dev/drm2/i915/i915_gem_stolen.c
  head/sys/dev/drm2/i915/i915_gem_tiling.c
  head/sys/dev/drm2/i915/i915_ioc32.c
  head/sys/dev/drm2/i915/i915_irq.c
  head/sys/dev/drm2/i915/i915_reg.h
  head/sys/dev/drm2/i915/i915_suspend.c
  head/sys/dev/drm2/i915/intel_acpi.c
  head/sys/dev/drm2/i915/intel_bios.c
  head/sys/dev/drm2/i915/intel_bios.h
  head/sys/dev/drm2/i915/intel_crt.c
  head/sys/dev/drm2/i915/intel_ddi.c
  head/sys/dev/drm2/i915/intel_display.c
  head/sys/dev/drm2/i915/intel_dp.c
  head/sys/dev/drm2/i915/intel_drv.h
  head/sys/dev/drm2/i915/intel_dvo.c
  head/sys/dev/drm2/i915/intel_fb.c
  head/sys/dev/drm2/i915/intel_hdmi.c
  head/sys/dev/drm2/i915/intel_iic.c
  head/sys/dev/drm2/i915/intel_lvds.c
  head/sys/dev/drm2/i915/intel_modes.c
  head/sys/dev/drm2/i915/intel_opregion.c
  head/sys/dev/drm2/i915/intel_overlay.c
  head/sys/dev/drm2/i915/intel_panel.c
  head/sys/dev/drm2/i915/intel_pm.c
  head/sys/dev/drm2/i915/intel_ringbuffer.c
  head/sys/dev/drm2/i915/intel_ringbuffer.h
  head/sys/dev/drm2/i915/intel_sdvo.c
  head/sys/dev/drm2/i915/intel_sdvo_regs.h
  head/sys/dev/drm2/i915/intel_sprite.c
  head/sys/dev/drm2/i915/intel_tv.c
  head/sys/dev/drm2/radeon/ObjectID.h
  head/sys/dev/drm2/radeon/README
  head/sys/dev/drm2/radeon/atom-bits.h
  head/sys/dev/drm2/radeon/atom-names.h
  head/sys/dev/drm2/radeon/atom-types.h
  head/sys/dev/drm2/radeon/atom.c
  head/sys/dev/drm2/radeon/atom.h
  head/sys/dev/drm2/radeon/atombios.h
  head/sys/dev/drm2/radeon/atombios_crtc.c
  head/sys/dev/drm2/radeon/atombios_dp.c
  head/sys/dev/drm2/radeon/atombios_encoders.c
  head/sys/dev/drm2/radeon/atombios_i2c.c
  head/sys/dev/drm2/radeon/avivod.h
  head/sys/dev/drm2/radeon/cayman_blit_shaders.c
  head/sys/dev/drm2/radeon/cayman_blit_shaders.h
  head/sys/dev/drm2/radeon/cayman_reg_safe.h
  head/sys/dev/drm2/radeon/evergreen.c
  head/sys/dev/drm2/radeon/evergreen_blit_kms.c
  head/sys/dev/drm2/radeon/evergreen_blit_shaders.c
  head/sys/dev/drm2/radeon/evergreen_blit_shaders.h
  head/sys/dev/drm2/radeon/evergreen_cs.c
  head/sys/dev/drm2/radeon/evergreen_hdmi.c
  head/sys/dev/drm2/radeon/evergreen_reg.h
  head/sys/dev/drm2/radeon/evergreen_reg_safe.h
  head/sys/dev/drm2/radeon/evergreend.h
  head/sys/dev/drm2/radeon/ni.c
  head/sys/dev/drm2/radeon/ni_reg.h
  head/sys/dev/drm2/radeon/nid.h
  head/sys/dev/drm2/radeon/r100.c
  head/sys/dev/drm2/radeon/r100_reg_safe.h
  head/sys/dev/drm2/radeon/r100_track.h
  head/sys/dev/drm2/radeon/r100d.h
  head/sys/dev/drm2/radeon/r200.c
  head/sys/dev/drm2/radeon/r200_reg_safe.h
  head/sys/dev/drm2/radeon/r300.c
  head/sys/dev/drm2/radeon/r300_reg.h
  head/sys/dev/drm2/radeon/r300_reg_safe.h
  head/sys/dev/drm2/radeon/r300d.h
  head/sys/dev/drm2/radeon/r420.c
  head/sys/dev/drm2/radeon/r420_reg_safe.h
  head/sys/dev/drm2/radeon/r420d.h
  head/sys/dev/drm2/radeon/r500_reg.h
  head/sys/dev/drm2/radeon/r520.c
  head/sys/dev/drm2/radeon/r520d.h
  head/sys/dev/drm2/radeon/r600.c
  head/sys/dev/drm2/radeon/r600_audio.c
  head/sys/dev/drm2/radeon/r600_blit_kms.c
  head/sys/dev/drm2/radeon/r600_blit_shaders.c
  head/sys/dev/drm2/radeon/r600_blit_shaders.h
  head/sys/dev/drm2/radeon/r600_cp.h
  head/sys/dev/drm2/radeon/r600_cs.c
  head/sys/dev/drm2/radeon/r600_cs.h
  head/sys/dev/drm2/radeon/r600_hdmi.c
  head/sys/dev/drm2/radeon/r600_reg.h
  head/sys/dev/drm2/radeon/r600_reg_safe.h
  head/sys/dev/drm2/radeon/r600d.h
  head/sys/dev/drm2/radeon/radeon.h
  head/sys/dev/drm2/radeon/radeon_acpi.c
  head/sys/dev/drm2/radeon/radeon_acpi.h
  head/sys/dev/drm2/radeon/radeon_agp.c
  head/sys/dev/drm2/radeon/radeon_asic.c
  head/sys/dev/drm2/radeon/radeon_asic.h
  head/sys/dev/drm2/radeon/radeon_atombios.c
  head/sys/dev/drm2/radeon/radeon_benchmark.c
  head/sys/dev/drm2/radeon/radeon_bios.c
  head/sys/dev/drm2/radeon/radeon_blit_common.h
  head/sys/dev/drm2/radeo

svn commit: r344300 - in head: . sys/sys

2019-02-19 Thread Warner Losh
Author: imp
Date: Tue Feb 19 19:37:09 2019
New Revision: 344300
URL: https://svnweb.freebsd.org/changeset/base/344300

Log:
  Add an UPDATING entry for the removal of drm and drm2
  
  Also bump FreeBSD version to 1300013 since this series is a big
  change.

Modified:
  head/UPDATING
  head/sys/sys/param.h

Modified: head/UPDATING
==
--- head/UPDATING   Tue Feb 19 19:37:02 2019(r344299)
+++ head/UPDATING   Tue Feb 19 19:37:09 2019(r344300)
@@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20190219:
+   drm and drm2 have been removed from the tree. Please see
+   https://wiki.freebsd.org/Graphics for the latest information on
+   migrating to the drm ports.
+
 20190131:
Iflib is no longer unconditionally compiled into the kernel.  Drivers
using iflib and statically compiled into the kernel, now require

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hTue Feb 19 19:37:02 2019(r344299)
+++ head/sys/sys/param.hTue Feb 19 19:37:09 2019(r344300)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300012  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300013  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344298 - in head/sys: conf modules modules/drm2 modules/drm2/drm2 modules/drm2/i915kms modules/drm2/radeonkms modules/drm2/radeonkmsfw modules/drm2/radeonkmsfw/ARUBA_me modules/drm2/ra...

2019-02-19 Thread Warner Losh
Author: imp
Date: Tue Feb 19 19:36:56 2019
New Revision: 344298
URL: https://svnweb.freebsd.org/changeset/base/344298

Log:
  Remove drm2 modules.
  
  Remove support for compiling drm2 as a module. This has transitioned
  to the drm-kmod or drm-legacy-kmodw ports.
  
  Approved by: graphics team
  Reviewed by: manu@, mmel@
  Differential Revision: https://reviews.freebsd.org/D19196

Deleted:
  head/sys/modules/drm2/Makefile
  head/sys/modules/drm2/Makefile.inc
  head/sys/modules/drm2/drm2/Makefile
  head/sys/modules/drm2/i915kms/Makefile
  head/sys/modules/drm2/radeonkms/Makefile
  head/sys/modules/drm2/radeonkmsfw/ARUBA_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/ARUBA_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/ARUBA_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/BARTS_mc/Makefile
  head/sys/modules/drm2/radeonkmsfw/BARTS_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/BARTS_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/BTC_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/CAICOS_mc/Makefile
  head/sys/modules/drm2/radeonkmsfw/CAICOS_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/CAICOS_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/CAYMAN_mc/Makefile
  head/sys/modules/drm2/radeonkmsfw/CAYMAN_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/CAYMAN_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/CAYMAN_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/CEDAR_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/CEDAR_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/CEDAR_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/CYPRESS_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/CYPRESS_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/CYPRESS_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/CYPRESS_uvd/Makefile
  head/sys/modules/drm2/radeonkmsfw/HAINAN_ce/Makefile
  head/sys/modules/drm2/radeonkmsfw/HAINAN_mc/Makefile
  head/sys/modules/drm2/radeonkmsfw/HAINAN_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/HAINAN_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/HAINAN_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/JUNIPER_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/JUNIPER_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/JUNIPER_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/Makefile
  head/sys/modules/drm2/radeonkmsfw/Makefile.inc
  head/sys/modules/drm2/radeonkmsfw/OLAND_ce/Makefile
  head/sys/modules/drm2/radeonkmsfw/OLAND_mc/Makefile
  head/sys/modules/drm2/radeonkmsfw/OLAND_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/OLAND_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/OLAND_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/PALM_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/PALM_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/PITCAIRN_ce/Makefile
  head/sys/modules/drm2/radeonkmsfw/PITCAIRN_mc/Makefile
  head/sys/modules/drm2/radeonkmsfw/PITCAIRN_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/PITCAIRN_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/PITCAIRN_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/R100_cp/Makefile
  head/sys/modules/drm2/radeonkmsfw/R200_cp/Makefile
  head/sys/modules/drm2/radeonkmsfw/R300_cp/Makefile
  head/sys/modules/drm2/radeonkmsfw/R420_cp/Makefile
  head/sys/modules/drm2/radeonkmsfw/R520_cp/Makefile
  head/sys/modules/drm2/radeonkmsfw/R600_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/R600_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/R600_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/R700_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/REDWOOD_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/REDWOOD_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/REDWOOD_rlc/Makefile
  head/sys/modules/drm2/radeonkmsfw/RS600_cp/Makefile
  head/sys/modules/drm2/radeonkmsfw/RS690_cp/Makefile
  head/sys/modules/drm2/radeonkmsfw/RS780_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/RS780_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV610_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV610_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV620_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV620_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV630_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV630_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV635_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV635_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV670_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV670_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV710_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV710_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV710_uvd/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV730_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV730_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV770_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/RV770_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/SUMO2_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/SUMO2_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw/SUMO_me/Makefile
  head/sys/modules/drm2/radeonkmsfw/SUMO_pfp/Makefile
  head/sys/modules/drm2/radeonkmsfw

svn commit: r344297 - in head/sys: conf dev/drm modules modules/drm modules/drm/drm modules/drm/mach64 modules/drm/mga modules/drm/r128 modules/drm/savage modules/drm/sis modules/drm/tdfx modules/d...

2019-02-19 Thread Warner Losh
Author: imp
Date: Tue Feb 19 19:36:43 2019
New Revision: 344297
URL: https://svnweb.freebsd.org/changeset/base/344297

Log:
  Per discussions on arch@ and elsewhere, retire drm module / drives.
  
  Retire the drm modules / drivers. These are now handled by the
  drm-legacy-kmod port and/or the drm-kmod port. All future
  development and maintanace will be handled there.
  
  Approved by: graphics team
  Reviewed by: manu@, mmel@
  Differential Revision: https://reviews.freebsd.org/D19196

Deleted:
  head/sys/dev/drm/ati_pcigart.c
  head/sys/dev/drm/drm.h
  head/sys/dev/drm/drmP.h
  head/sys/dev/drm/drm_agpsupport.c
  head/sys/dev/drm/drm_atomic.h
  head/sys/dev/drm/drm_auth.c
  head/sys/dev/drm/drm_bufs.c
  head/sys/dev/drm/drm_context.c
  head/sys/dev/drm/drm_dma.c
  head/sys/dev/drm/drm_drawable.c
  head/sys/dev/drm/drm_drv.c
  head/sys/dev/drm/drm_fops.c
  head/sys/dev/drm/drm_hashtab.c
  head/sys/dev/drm/drm_hashtab.h
  head/sys/dev/drm/drm_internal.h
  head/sys/dev/drm/drm_ioctl.c
  head/sys/dev/drm/drm_irq.c
  head/sys/dev/drm/drm_linux_list.h
  head/sys/dev/drm/drm_lock.c
  head/sys/dev/drm/drm_memory.c
  head/sys/dev/drm/drm_mm.c
  head/sys/dev/drm/drm_mm.h
  head/sys/dev/drm/drm_pci.c
  head/sys/dev/drm/drm_pciids.h
  head/sys/dev/drm/drm_sarea.h
  head/sys/dev/drm/drm_scatter.c
  head/sys/dev/drm/drm_sman.c
  head/sys/dev/drm/drm_sman.h
  head/sys/dev/drm/drm_sysctl.c
  head/sys/dev/drm/drm_vm.c
  head/sys/dev/drm/mach64_dma.c
  head/sys/dev/drm/mach64_drm.h
  head/sys/dev/drm/mach64_drv.c
  head/sys/dev/drm/mach64_drv.h
  head/sys/dev/drm/mach64_irq.c
  head/sys/dev/drm/mach64_state.c
  head/sys/dev/drm/mga_dma.c
  head/sys/dev/drm/mga_drm.h
  head/sys/dev/drm/mga_drv.c
  head/sys/dev/drm/mga_drv.h
  head/sys/dev/drm/mga_irq.c
  head/sys/dev/drm/mga_state.c
  head/sys/dev/drm/mga_ucode.h
  head/sys/dev/drm/mga_warp.c
  head/sys/dev/drm/r128_cce.c
  head/sys/dev/drm/r128_drm.h
  head/sys/dev/drm/r128_drv.c
  head/sys/dev/drm/r128_drv.h
  head/sys/dev/drm/r128_irq.c
  head/sys/dev/drm/r128_state.c
  head/sys/dev/drm/savage_bci.c
  head/sys/dev/drm/savage_drm.h
  head/sys/dev/drm/savage_drv.c
  head/sys/dev/drm/savage_drv.h
  head/sys/dev/drm/savage_state.c
  head/sys/dev/drm/sis_drm.h
  head/sys/dev/drm/sis_drv.c
  head/sys/dev/drm/sis_drv.h
  head/sys/dev/drm/sis_ds.c
  head/sys/dev/drm/sis_ds.h
  head/sys/dev/drm/sis_mm.c
  head/sys/dev/drm/tdfx_drv.c
  head/sys/dev/drm/tdfx_drv.h
  head/sys/dev/drm/via_3d_reg.h
  head/sys/dev/drm/via_dma.c
  head/sys/dev/drm/via_dmablit.c
  head/sys/dev/drm/via_dmablit.h
  head/sys/dev/drm/via_drm.h
  head/sys/dev/drm/via_drv.c
  head/sys/dev/drm/via_drv.h
  head/sys/dev/drm/via_irq.c
  head/sys/dev/drm/via_map.c
  head/sys/dev/drm/via_mm.c
  head/sys/dev/drm/via_verifier.c
  head/sys/dev/drm/via_verifier.h
  head/sys/dev/drm/via_video.c
  head/sys/modules/drm/Makefile
  head/sys/modules/drm/Makefile.inc
  head/sys/modules/drm/drm/Makefile
  head/sys/modules/drm/mach64/Makefile
  head/sys/modules/drm/mga/Makefile
  head/sys/modules/drm/r128/Makefile
  head/sys/modules/drm/savage/Makefile
  head/sys/modules/drm/sis/Makefile
  head/sys/modules/drm/tdfx/Makefile
  head/sys/modules/drm/via/Makefile
Modified:
  head/sys/conf/files
  head/sys/conf/kern.opts.mk
  head/sys/modules/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Feb 19 19:17:20 2019(r344296)
+++ head/sys/conf/files Tue Feb 19 19:36:43 2019(r344297)
@@ -1541,55 +1541,6 @@ dev/dcons/dcons_crom.c   optional dcons_crom
 dev/dcons/dcons_os.c   optional dcons
 dev/de/if_de.c optional de pci
 dev/dme/if_dme.c   optional dme
-dev/drm/ati_pcigart.c  optional drm
-dev/drm/drm_agpsupport.c   optional drm
-dev/drm/drm_auth.c optional drm
-dev/drm/drm_bufs.c optional drm
-dev/drm/drm_context.c  optional drm
-dev/drm/drm_dma.c  optional drm
-dev/drm/drm_drawable.c optional drm
-dev/drm/drm_drv.c  optional drm
-dev/drm/drm_fops.c optional drm
-dev/drm/drm_hashtab.c  optional drm
-dev/drm/drm_ioctl.coptional drm
-dev/drm/drm_irq.c  optional drm
-dev/drm/drm_lock.c optional drm
-dev/drm/drm_memory.c   optional drm
-dev/drm/drm_mm.c   optional drm
-dev/drm/drm_pci.c  optional drm
-dev/drm/drm_scatter.c  optional drm
-dev/drm/drm_sman.c optional drm
-dev/drm/drm_sysctl.c   optional drm
-dev/drm/drm_vm.c   optional drm
-dev/drm/mach64_dma.c   optional mach64drm
-dev/drm/mach64_drv.c   optional mach64drm
-dev/drm/mach64_irq.c   optional mach64drm
-dev/drm/mach64_state.c optional mach64drm
-dev/drm/mga_dma.c  optional mgadrm
-dev/drm/mga_drv.c  optional mgadrm
-dev/drm/mga_irq.c  optional mgadrm
-dev/

svn commit: r344296 - in head/sys: amd64/include i386/include

2019-02-19 Thread Konstantin Belousov
Author: kib
Date: Tue Feb 19 19:17:20 2019
New Revision: 344296
URL: https://svnweb.freebsd.org/changeset/base/344296

Log:
  Provide convenience C wrappers for RDPKRU and WRPKRU instructions.
  
  Reviewed by:  markj
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days
  Differential revision:https://reviews.freebsd.org/D18893

Modified:
  head/sys/amd64/include/cpufunc.h
  head/sys/i386/include/cpufunc.h

Modified: head/sys/amd64/include/cpufunc.h
==
--- head/sys/amd64/include/cpufunc.hTue Feb 19 19:16:28 2019
(r344295)
+++ head/sys/amd64/include/cpufunc.hTue Feb 19 19:17:20 2019
(r344296)
@@ -627,6 +627,22 @@ cpu_mwait(u_long extensions, u_int hints)
__asm __volatile("mwait" : : "a" (hints), "c" (extensions));
 }
 
+static __inline uint32_t
+rdpkru(void)
+{
+   uint32_t res;
+
+   __asm __volatile("rdpkru" :  "=a" (res) : "c" (0) : "edx");
+   return (res);
+}
+
+static __inline void
+wrpkru(uint32_t mask)
+{
+
+   __asm __volatile("wrpkru" :  : "a" (mask),  "c" (0), "d" (0));
+}
+
 #ifdef _KERNEL
 /* This is defined in  but is too painful to get to */
 #ifndefMSR_FSBASE

Modified: head/sys/i386/include/cpufunc.h
==
--- head/sys/i386/include/cpufunc.h Tue Feb 19 19:16:28 2019
(r344295)
+++ head/sys/i386/include/cpufunc.h Tue Feb 19 19:17:20 2019
(r344296)
@@ -726,6 +726,22 @@ intr_restore(register_t eflags)
write_eflags(eflags);
 }
 
+static __inline uint32_t
+rdpkru(void)
+{
+   uint32_t res;
+
+   __asm __volatile("rdpkru" :  "=a" (res) : "c" (0) : "edx");
+   return (res);
+}
+
+static __inline void
+wrpkru(uint32_t mask)
+{
+
+   __asm __volatile("wrpkru" :  : "a" (mask),  "c" (0), "d" (0));
+}
+
 #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */
 
 intbreakpoint(void);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344295 - in stable/11/stand: common i386/libi386 i386/zfsboot

2019-02-19 Thread Kyle Evans
Author: kevans
Date: Tue Feb 19 19:16:28 2019
New Revision: 344295
URL: https://svnweb.freebsd.org/changeset/base/344295

Log:
  MFC r335245-r335248, r335254, r335276, r335298, r335398, r335868, r335883
  
  r335245:
  Correct logic error in biosdisk.c:bd_realstrategy()
  
  The wrong condition is used when evaluating the return of disk_ioctl()
  This results in reaching the 'We should not get here' branch in most casts
  
  r335246:
  biosdisk.c remove redundant variable
  
  `rdev` and `disk` serve the same purpose, read the partition table without
  the `d_offset` or `d_slice` set, so the read is relative to the start of
  the disk. Reuse the already initialized `disk` instead of making another
  copy later.
  
  r335247:
  biosdisk.c: add missing \n to error message
  
  r335248:
  biosdisk.c: fix type in debug printf
  
  r335254:
  Avoid reading past the end of the disk in zfsboot.c and biosdisk.c
  
  The GELI boot code rounds reads up to 4k, since the encrypted sectors are
  4k, and must be decrypted as a unit. With oddball sized disks (almost
  always virtual), this can lead to reading past the end of the disk.
  
  r335276:
  gptboot, zfsboot, gptzfsboot: Enable the video and serial consoles early
  
  Normally the serial console is not enabled until /boot.config is read and
  we know how the serial console should be configured.  Initialize the
  consoles early in 'dual' mode (serial & keyboard) with a default serial
  rate of 115200. Then serial is re-initialized once the disk is decrypted
  and the /boot.config file can be read.
  
  This allows the GELIBoot passphrase to be provided via the serial console.
  
  r335298:
  stand/common/disk.c: Update debug printf
  
  This was missed in r330809 because it is compiled out by default
  
  r335398:
  Revert r335276
  
  This was causing issues for people booting.
  I will likely bring this back as an optional feature, similar to
  boot0sio, like gptboot-serial or something.
  
  r335868:
  stand/common/disk.c: Read partition table relative to the start of the disk
  
  If a disk is of an oddball size, like the 200mb + 512b used in rootgen.sh,
  when disk_open() is called on a GELI encrypted partition, attempts to read
  the partition table fail, as they pass through the decryption process which
  turns the already plaintext data into jibberish.
  
  When reading the partition table, always pass a slice and partition setting
  of -1, and an offset of 0. Setting the slice to -1 prevents a false
  positive when checking the slice against the cache of GELI encrypted
  slices.
  
  r335883:
  stand/common/disk.c: dev->d_offset still needs to be set to 0
  
  With r335868, I thought this was no longer necessary. I was wrong.

Modified:
  stable/11/stand/common/disk.c
  stable/11/stand/i386/libi386/biosdisk.c
  stable/11/stand/i386/zfsboot/zfsboot.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/common/disk.c
==
--- stable/11/stand/common/disk.c   Tue Feb 19 19:15:15 2019
(r344294)
+++ stable/11/stand/common/disk.c   Tue Feb 19 19:16:28 2019
(r344295)
@@ -219,20 +219,13 @@ disk_ioctl(struct disk_devdesc *dev, u_long cmd, void 
 int
 disk_open(struct disk_devdesc *dev, uint64_t mediasize, u_int sectorsize)
 {
+   struct disk_devdesc partdev;
struct open_disk *od;
struct ptable *table;
struct ptable_entry part;
int rc, slice, partition;
 
rc = 0;
-   /*
-* While we are reading disk metadata, make sure we do it relative
-* to the start of the disk
-*/
-   dev->d_offset = 0;
-   table = NULL;
-   slice = dev->d_slice;
-   partition = dev->d_partition;
od = (struct open_disk *)malloc(sizeof(struct open_disk));
if (od == NULL) {
DEBUG("no memory");
@@ -242,11 +235,25 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
od->entrysize = 0;
od->mediasize = mediasize;
od->sectorsize = sectorsize;
+   /*
+* While we are reading disk metadata, make sure we do it relative
+* to the start of the disk
+*/
+   memcpy(&partdev, dev, sizeof(partdev));
+   partdev.d_offset = 0;
+   partdev.d_slice = -1;
+   partdev.d_partition = -1;
+
+   dev->d_offset = 0;
+   table = NULL;
+   slice = dev->d_slice;
+   partition = dev->d_partition;
+
DEBUG("%s unit %d, slice %d, partition %d => %p",
-   disk_fmtdev(dev), dev->d_unit, dev->d_slice, dev->d_partition, od);
+   disk_fmtdev(dev), dev->dd.d_unit, dev->d_slice, dev->d_partition, 
od);
 
/* Determine disk layout. */
-   od->table = ptable_open(dev, mediasize / sectorsize, sectorsize,
+   od->table = ptable_open(&partdev, mediasize / sectorsize, sectorsize,
ptblread);
if (od->table == NULL) {
DEBUG("Can't read partition

svn commit: r344294 - head/lib/libc/posix1e

2019-02-19 Thread Sean Eric Fagan
Author: sef
Date: Tue Feb 19 19:15:15 2019
New Revision: 344294
URL: https://svnweb.freebsd.org/changeset/base/344294

Log:
  Remove some redundant code in _posix1e_acl_strip_np
  
  This was discovered through examination -- acl_copy_entry() copies the
  tag type and permset fields.
  
  Reviewed by:  trasz, pfg
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D19240

Modified:
  head/lib/libc/posix1e/acl_strip.c

Modified: head/lib/libc/posix1e/acl_strip.c
==
--- head/lib/libc/posix1e/acl_strip.c   Tue Feb 19 19:13:48 2019
(r344293)
+++ head/lib/libc/posix1e/acl_strip.c   Tue Feb 19 19:15:15 2019
(r344294)
@@ -70,7 +70,6 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculat
 {
acl_t acl_new, acl_old;
acl_entry_t entry, entry_new;
-   acl_permset_t perm;
acl_tag_t tag;
int entry_id, have_mask_entry;
 
@@ -104,15 +103,7 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculat
case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_OTHER:
-   if (acl_get_tag_type(entry, &tag) == -1)
-   goto fail;
-   if (acl_get_permset(entry, &perm) == -1)
-   goto fail;
if (acl_create_entry(&acl_new, &entry_new) == -1)
-   goto fail;
-   if (acl_set_tag_type(entry_new, tag) == -1)
-   goto fail;
-   if (acl_set_permset(entry_new, perm) == -1)
goto fail;
if (acl_copy_entry(entry_new, entry) == -1)
goto fail;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344293 - head/sys/x86/include

2019-02-19 Thread Konstantin Belousov
Author: kib
Date: Tue Feb 19 19:13:48 2019
New Revision: 344293
URL: https://svnweb.freebsd.org/changeset/base/344293

Log:
  Add definition for %cr4 PKRU enable bit.
  
  Reviewed by:  markj
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days
  Differential revision:https://reviews.freebsd.org/D18893

Modified:
  head/sys/x86/include/specialreg.h

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Tue Feb 19 19:04:52 2019
(r344292)
+++ head/sys/x86/include/specialreg.h   Tue Feb 19 19:13:48 2019
(r344293)
@@ -77,6 +77,7 @@
 #defineCR4_XSAVE 0x0004/* XSETBV/XGETBV */
 #defineCR4_SMEP 0x0010 /* Supervisor-Mode Execution Prevention 
*/
 #defineCR4_SMAP 0x0020 /* Supervisor-Mode Access Prevention */
+#defineCR4_PKE 0x0040  /* Protection Keys Enable */
 
 /*
  * Bits in AMD64 special registers.  EFER is 64 bits wide.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344292 - head/sys/dev/acpica

2019-02-19 Thread Tom Jones
Author: thj
Date: Tue Feb 19 19:04:52 2019
New Revision: 344292
URL: https://svnweb.freebsd.org/changeset/base/344292

Log:
  Fix style after r340832
  
  Reported by:  jhb
  Reviewed by:  jhb, jtl
  Approved by:  jtl (mentor)
  MFC after:3 days
  Differential Revision:https://reviews/freebsd.org/D18354

Modified:
  head/sys/dev/acpica/acpi_battery.c

Modified: head/sys/dev/acpica/acpi_battery.c
==
--- head/sys/dev/acpica/acpi_battery.c  Tue Feb 19 18:50:20 2019
(r344291)
+++ head/sys/dev/acpica/acpi_battery.c  Tue Feb 19 19:04:52 2019
(r344292)
@@ -172,7 +172,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
 * Be sure we can get various info from the battery.
 */
if (ACPI_BATT_GET_STATUS(batt_dev, &bst[i]) != 0 ||
-   ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
+   ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
continue;
 
/* If a battery is not installed, we sometimes get strange values. */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344291 - in stable/11/stand: arm/loader libsa

2019-02-19 Thread Kyle Evans
Author: kevans
Date: Tue Feb 19 18:50:20 2019
New Revision: 344291
URL: https://svnweb.freebsd.org/changeset/base/344291

Log:
  MFC r335125-r335127, r335148, r335224
  
  r335125:
  libsa: cstyle cleanup for open/close/read/write sources
  
  r335126:
  libsa: f_rabuf could be NULL
  
  It is possible that we will not get RA buffer from open(), therefore
  we must validate RA.
  
  r335127:
  libsa: remobe unneeded check before free()
  
  free() is checking for NULL, remove duplicate check.
  
  r335148:
  libsa: open() should use NULL instead of typecasted 0
  
  r335224:
  Remove empty directory

Deleted:
  stable/11/stand/arm/loader/
Modified:
  stable/11/stand/libsa/close.c
  stable/11/stand/libsa/open.c
  stable/11/stand/libsa/read.c
  stable/11/stand/libsa/write.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/libsa/close.c
==
--- stable/11/stand/libsa/close.c   Tue Feb 19 18:48:17 2019
(r344290)
+++ stable/11/stand/libsa/close.c   Tue Feb 19 18:50:20 2019
(r344291)
@@ -32,30 +32,30 @@
  * SUCH DAMAGE.
  *
  * @(#)close.c 8.1 (Berkeley) 6/11/93
- *  
  *
+ *
  * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
  * All Rights Reserved.
  *
  * Author: Alessandro Forin
- * 
+ *
  * Permission to use, copy, modify and distribute this software and its
  * documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
  * software, derivative works or modified versions, and any portions
  * thereof, and that both notices appear in supporting documentation.
- * 
+ *
  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- * 
+ *
  * Carnegie Mellon requests users of this software to return to
- * 
+ *
  *  Software Distribution Coordinator  or  software.distribut...@cs.cmu.edu
  *  School of Computer Science
  *  Carnegie Mellon University
  *  Pittsburgh PA 15213-3890
- * 
+ *
  * any improvements or extensions that they make and grant Carnegie the
  * rights to redistribute these changes.
  */
@@ -68,31 +68,30 @@ __FBSDID("$FreeBSD$");
 int
 close(int fd)
 {
-struct open_file   *f = &files[fd];
-interr1 = 0, err2 = 0;
+   struct open_file *f = &files[fd];
+   int err1 = 0, err2 = 0;
 
-if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
-   errno = EBADF;
-   return (-1);
-}
-if (f->f_rabuf != NULL) {
+   if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
+   errno = EBADF;
+   return (-1);
+   }
free(f->f_rabuf);
f->f_rabuf = NULL;
-}
-if (!(f->f_flags & F_RAW) && f->f_ops)
-   err1 = (f->f_ops->fo_close)(f);
-if (!(f->f_flags & F_NODEV) && f->f_dev)
-   err2 = (f->f_dev->dv_close)(f);
-if (f->f_devdata != NULL)
-   devclose(f);
-f->f_flags = 0;
-if (err1) {
-   errno = err1;
-   return (-1);
-}
-if (err2) {
-   errno = err2;
-   return (-1);
-}
-return (0);
+
+   if (!(f->f_flags & F_RAW) && f->f_ops)
+   err1 = (f->f_ops->fo_close)(f);
+   if (!(f->f_flags & F_NODEV) && f->f_dev)
+   err2 = (f->f_dev->dv_close)(f);
+   if (f->f_devdata != NULL)
+   devclose(f);
+   f->f_flags = 0;
+   if (err1) {
+   errno = err1;
+   return (-1);
+   }
+   if (err2) {
+   errno = err2;
+   return (-1);
+   }
+   return (0);
 }

Modified: stable/11/stand/libsa/open.c
==
--- stable/11/stand/libsa/open.cTue Feb 19 18:48:17 2019
(r344290)
+++ stable/11/stand/libsa/open.cTue Feb 19 18:50:20 2019
(r344291)
@@ -32,30 +32,30 @@
  * SUCH DAMAGE.
  *
  * @(#)open.c  8.1 (Berkeley) 6/11/93
- *  
  *
+ *
  * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
  * All Rights Reserved.
  *
  * Author: Alessandro Forin
- * 
+ *
  * Permission to use, copy, modify and distribute this software and its
  * documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
  * software, derivative works or modified versions, and any portions
  * thereof, and that both notices appear in supporting documentation.
- * 
+ *
  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- * 
+ *
  * Carnegie Mellon requests users of this software to return to
- * 
+ *
  *  Software Distribution Coordinator  or  software.distribut...@cs.cmu.edu
  *  School o

svn commit: r344290 - in stable/11/stand: common efi/loader i386/loader mips/beri/loader pc98/loader powerpc/kboot powerpc/ofw sparc64/loader uboot/common userboot/userboot

2019-02-19 Thread Kyle Evans
Author: kevans
Date: Tue Feb 19 18:48:17 2019
New Revision: 344290
URL: https://svnweb.freebsd.org/changeset/base/344290

Log:
  MFC r335117: stand bootprog_info consolidation
  
  bootprog_info is generated in vers.c. Move it's definition to
  bootstrap.h and remove all the redundant copies.

Modified:
  stable/11/stand/common/bootstrap.h
  stable/11/stand/efi/loader/main.c
  stable/11/stand/i386/loader/main.c
  stable/11/stand/mips/beri/loader/loader.h
  stable/11/stand/pc98/loader/main.c
  stable/11/stand/powerpc/kboot/main.c
  stable/11/stand/powerpc/ofw/main.c
  stable/11/stand/sparc64/loader/main.c
  stable/11/stand/uboot/common/main.c
  stable/11/stand/userboot/userboot/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/common/bootstrap.h
==
--- stable/11/stand/common/bootstrap.h  Tue Feb 19 18:45:40 2019
(r344289)
+++ stable/11/stand/common/bootstrap.h  Tue Feb 19 18:48:17 2019
(r344290)
@@ -161,6 +161,11 @@ char   *pnp_eisaformat(uint8_t *data);
 extern int isapnp_readport;
 
 /*
+ * Version information
+ */
+extern char bootprog_info[];
+
+/*
  * Preloaded file metadata header.
  *
  * Metadata are allocated on our heap, and copied into kernel space

Modified: stable/11/stand/efi/loader/main.c
==
--- stable/11/stand/efi/loader/main.c   Tue Feb 19 18:45:40 2019
(r344289)
+++ stable/11/stand/efi/loader/main.c   Tue Feb 19 18:48:17 2019
(r344290)
@@ -53,8 +53,6 @@ __FBSDID("$FreeBSD$");
 
 #include "loader_efi.h"
 
-extern char bootprog_info[];
-
 struct arch_switch archsw; /* MI/MD interface boundary */
 
 EFI_GUID acpi = ACPI_TABLE_GUID;

Modified: stable/11/stand/i386/loader/main.c
==
--- stable/11/stand/i386/loader/main.c  Tue Feb 19 18:45:40 2019
(r344289)
+++ stable/11/stand/i386/loader/main.c  Tue Feb 19 18:48:17 2019
(r344290)
@@ -79,9 +79,6 @@ struct zfs_boot_args  *zargs;
 static voidi386_zfs_probe(void);
 #endif
 
-/* from vers.c */
-extern char bootprog_info[];
-
 /* XXX debugging */
 extern char end[];
 

Modified: stable/11/stand/mips/beri/loader/loader.h
==
--- stable/11/stand/mips/beri/loader/loader.h   Tue Feb 19 18:45:40 2019
(r344289)
+++ stable/11/stand/mips/beri/loader/loader.h   Tue Feb 19 18:48:17 2019
(r344290)
@@ -58,7 +58,4 @@ extern struct bootinfo boot2_bootinfo;
 /* metadata.c */
 intmd_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtbp);
 
-/* vers.c */
-extern charbootprog_info[];
-
 #endif /* !_BOOT_LOADER_H_ */

Modified: stable/11/stand/pc98/loader/main.c
==
--- stable/11/stand/pc98/loader/main.c  Tue Feb 19 18:45:40 2019
(r344289)
+++ stable/11/stand/pc98/loader/main.c  Tue Feb 19 18:48:17 2019
(r344290)
@@ -65,9 +65,6 @@ static intisa_inb(int port);
 static voidisa_outb(int port, int value);
 void   exit(int code);
 
-/* from vers.c */
-extern char bootprog_info[];
-
 /* XXX debugging */
 extern char end[];
 

Modified: stable/11/stand/powerpc/kboot/main.c
==
--- stable/11/stand/powerpc/kboot/main.cTue Feb 19 18:45:40 2019
(r344289)
+++ stable/11/stand/powerpc/kboot/main.cTue Feb 19 18:48:17 2019
(r344290)
@@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$");
 struct arch_switch archsw;
 extern void *_end;
 
-extern char bootprog_info[];
-
 int kboot_getdev(void **vdev, const char *devspec, const char **path);
 ssize_t kboot_copyin(const void *src, vm_offset_t dest, const size_t len);
 ssize_t kboot_copyout(vm_offset_t src, void *dest, const size_t len);

Modified: stable/11/stand/powerpc/ofw/main.c
==
--- stable/11/stand/powerpc/ofw/main.c  Tue Feb 19 18:45:40 2019
(r344289)
+++ stable/11/stand/powerpc/ofw/main.c  Tue Feb 19 18:48:17 2019
(r344290)
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
 struct arch_switch archsw; /* MI/MD interface boundary */
 
 extern char end[];
-extern char bootprog_info[];
 
 uint32_t   acells, scells;
 

Modified: stable/11/stand/sparc64/loader/main.c
==
--- stable/11/stand/sparc64/loader/main.c   Tue Feb 19 18:45:40 2019
(r344289)
+++ stable/11/stand/sparc64/loader/main.c   Tue Feb 19 18:48:17 2019
(r344290)
@@ -75,8 +75,6 @@ __FBSDID("$FreeBSD$");
 #include "libofw.h"
 #include "dev_net.h"
 
-extern char bootprog_info[];
-

svn commit: r344286 - stable/11/stand/common

2019-02-19 Thread Kyle Evans
Author: kevans
Date: Tue Feb 19 18:34:00 2019
New Revision: 344286
URL: https://svnweb.freebsd.org/changeset/base/344286

Log:
  MFC r332557-r332558, r332560, r332565: loader command cleanup-lite
  
  r332557:
  loader: make sure we use snprintf() in commands.c
  
  Safeguard against memory corruptions.
  
  r332558:
  loader: command_errmsg should be const
  
  Use const char * for command_errmsg.
  
  r332560:
  loader: make sure we do not return garbage from help_getnext
  
  Since we do free subtopic and desc in help_getnext(), we need to set them also
  NULL, so we make sure we dont get double free().
  
  r332565:
  loader: cstyle cleanup of command.c
  
  just clean it up. no functional changes intended.

Modified:
  stable/11/stand/common/bootstrap.h
  stable/11/stand/common/commands.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/common/bootstrap.h
==
--- stable/11/stand/common/bootstrap.h  Tue Feb 19 18:32:05 2019
(r344285)
+++ stable/11/stand/common/bootstrap.h  Tue Feb 19 18:34:00 2019
(r344286)
@@ -36,7 +36,7 @@
 /* Commands and return values; nonzero return sets command_errmsg != NULL */
 typedef int(bootblk_cmd_t)(int argc, char *argv[]);
 #defineCOMMAND_ERRBUFSZ(256)
-extern char*command_errmsg;
+extern const char *command_errmsg;
 extern charcommand_errbuf[COMMAND_ERRBUFSZ];
 #define CMD_OK 0
 #define CMD_WARN   1

Modified: stable/11/stand/common/commands.c
==
--- stable/11/stand/common/commands.c   Tue Feb 19 18:32:05 2019
(r344285)
+++ stable/11/stand/common/commands.c   Tue Feb 19 18:34:00 2019
(r344286)
@@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
 
 #include "bootstrap.h"
 
-char   *command_errmsg;
+const char *command_errmsg;
 /* XXX should have procedural interface for setting, size limit? */
 char   command_errbuf[COMMAND_ERRBUFSZ];
 
@@ -61,155 +61,160 @@ here
 COMMAND_SET(help, "help", "detailed help", command_help);
 
 static int
-help_getnext(int fd, char **topic, char **subtopic, char **desc) 
+help_getnext(int fd, char **topic, char **subtopic, char **desc)
 {
-char   line[81], *cp, *ep;
+   charline[81], *cp, *ep;
 
-/* Make sure we provide sane values. */
-*topic = *subtopic = *desc = NULL;
-for (;;) {
-   if (fgetstr(line, 80, fd) < 0)
-   return(0);
-   
-   if ((strlen(line) < 3) || (line[0] != '#') || (line[1] != ' '))
-   continue;
-
+   /* Make sure we provide sane values. */
*topic = *subtopic = *desc = NULL;
-   cp = line + 2;
-   while((cp != NULL) && (*cp != 0)) {
-   ep = strchr(cp, ' ');
-   if ((*cp == 'T') && (*topic == NULL)) {
-   if (ep != NULL)
-   *ep++ = 0;
-   *topic = strdup(cp + 1);
-   } else if ((*cp == 'S') && (*subtopic == NULL)) {
-   if (ep != NULL)
-   *ep++ = 0;
-   *subtopic = strdup(cp + 1);
-   } else if (*cp == 'D') {
-   *desc = strdup(cp + 1);
-   ep = NULL;
-   }
-   cp = ep;
+   for (;;) {
+   if (fgetstr(line, 80, fd) < 0)
+   return (0);
+
+   if (strlen(line) < 3 || line[0] != '#' || line[1] != ' ')
+   continue;
+
+   cp = line + 2;
+   while (cp != NULL && *cp != 0) {
+   ep = strchr(cp, ' ');
+   if (*cp == 'T' && *topic == NULL) {
+   if (ep != NULL)
+   *ep++ = 0;
+   *topic = strdup(cp + 1);
+   } else if (*cp == 'S' && *subtopic == NULL) {
+   if (ep != NULL)
+   *ep++ = 0;
+   *subtopic = strdup(cp + 1);
+   } else if (*cp == 'D') {
+   *desc = strdup(cp + 1);
+   ep = NULL;
+   }
+   cp = ep;
+   }
+   if (*topic == NULL) {
+   free(*subtopic);
+   free(*desc);
+   *subtopic = *desc = NULL;
+   continue;
+   }
+   return (1);
}
-   if (*topic == NULL) {
-   free(*subtopic);
-   free(*desc);
-   continue;
-   }
-   return(1);
-}
 }
 
 static int
 help_emitsummary(char *topic, char *subtopic, char *desc)
 {
-inti;
-
-pager_output("");
-pager_output(topic);
-i = strlen(topic);
-if (subtopic != NULL) {
-   pager_output(" ");
-   pager_output(subtopic);
-  

svn commit: r344289 - in stable/11/stand: . efi/loader libsa

2019-02-19 Thread Kyle Evans
Author: kevans
Date: Tue Feb 19 18:45:40 2019
New Revision: 344289
URL: https://svnweb.freebsd.org/changeset/base/344289

Log:
  MFC r335069-r335071, r335110, r335116: stand housecleaning
  
  r335069:
  Remove fail: label. It's unused.
  
  r335070:
  Remove unused variables.
  
  [kevans@: removed ufs.c modifications; those depend on ufs rewrite bits]
  
  r335071:
  Initialize variables we later free so they aren't used
  uninitialized in the error path.
  Remove unused variables.
  
  r335110:
  Remove redundant defs.mk includes. They aren't needed.
  
  r335116:
  Use bool for vargood, since it's a boolean.

Modified:
  stable/11/stand/efi/loader/main.c
  stable/11/stand/ficl.mk
  stable/11/stand/libsa/nfs.c
  stable/11/stand/libsa/open.c
  stable/11/stand/libsa/tftp.c
  stable/11/stand/loader.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/loader/main.c
==
--- stable/11/stand/efi/loader/main.c   Tue Feb 19 18:37:45 2019
(r344288)
+++ stable/11/stand/efi/loader/main.c   Tue Feb 19 18:45:40 2019
(r344289)
@@ -415,7 +415,8 @@ main(int argc, CHAR16 *argv[])
 {
char var[128];
EFI_GUID *guid;
-   int i, j, vargood, howto;
+   int i, j, howto;
+   bool vargood;
UINTN k;
int has_kbd;
char *s;
@@ -532,14 +533,14 @@ main(int argc, CHAR16 *argv[])
}
}
} else {
-   vargood = 0;
+   vargood = false;
for (j = 0; argv[i][j] != 0; j++) {
if (j == sizeof(var)) {
-   vargood = 0;
+   vargood = false;
break;
}
if (j > 0 && argv[i][j] == '=')
-   vargood = 1;
+   vargood = true;
var[j] = (char)argv[i][j];
}
if (vargood) {

Modified: stable/11/stand/ficl.mk
==
--- stable/11/stand/ficl.mk Tue Feb 19 18:37:45 2019(r344288)
+++ stable/11/stand/ficl.mk Tue Feb 19 18:45:40 2019(r344289)
@@ -2,8 +2,6 @@
 
 # Common flags to build FICL related files
 
-.include "defs.mk"
-
 .if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1
 FICL_CPUARCH=  i386
 .elif ${MACHINE_ARCH:Mmips64*} != ""

Modified: stable/11/stand/libsa/nfs.c
==
--- stable/11/stand/libsa/nfs.c Tue Feb 19 18:37:45 2019(r344288)
+++ stable/11/stand/libsa/nfs.c Tue Feb 19 18:45:40 2019(r344289)
@@ -249,7 +249,7 @@ int
 nfs_lookupfh(struct nfs_iodesc *d, const char *name, struct nfs_iodesc *newfd)
 {
void *pkt = NULL;
-   int len, rlen, pos;
+   int len, pos;
struct args {
uint32_t fhsize;
uint32_t fhplusname[1 +
@@ -465,14 +465,13 @@ int
 nfs_open(const char *upath, struct open_file *f)
 {
struct iodesc *desc;
-   struct nfs_iodesc *currfd;
+   struct nfs_iodesc *currfd = NULL;
char buf[2 * NFS_V3MAXFHSIZE + 3];
u_char *fh;
char *cp;
int i;
 #ifndef NFS_NOSYMLINK
-   struct nfs_iodesc *newfd;
-   struct nfsv3_fattrs *fa;
+   struct nfs_iodesc *newfd = NULL;
char *ncp;
int c;
char namebuf[NFS_MAXPATHLEN + 1];
@@ -480,7 +479,7 @@ nfs_open(const char *upath, struct open_file *f)
int nlinks = 0;
 #endif
int error;
-   char *path;
+   char *path = NULL;
 
if (netproto != NET_NFS)
return (EINVAL);

Modified: stable/11/stand/libsa/open.c
==
--- stable/11/stand/libsa/open.cTue Feb 19 18:37:45 2019
(r344288)
+++ stable/11/stand/libsa/open.cTue Feb 19 18:45:40 2019
(r344289)
@@ -141,7 +141,6 @@ open(const char *fname, int mode)
 }
 error = besterror;
 
- fail:
 if ((f->f_flags & F_NODEV) == 0 && f->f_dev != NULL)
f->f_dev->dv_close(f);
 if (error)

Modified: stable/11/stand/libsa/tftp.c
==
--- stable/11/stand/libsa/tftp.cTue Feb 19 18:37:45 2019
(r344288)
+++ stable/11/stand/libsa/tftp.cTue Feb 19 18:45:40 2019
(r344289)
@@ -186,7 +186,6 @@ recvtftp(struct iodesc *d, void **pkt, void **payload,
struct tftprecv_extra *extra;
struct tftp_handle *h;
struct tftphdr *t;
-   unsigned short *rtype;
void *ptr = NULL;
ssize_t len;
 

Modified: stable/11/stand/loader.mk

svn commit: r344288 - stable/11/stand/libsa

2019-02-19 Thread Kyle Evans
Author: kevans
Date: Tue Feb 19 18:37:45 2019
New Revision: 344288
URL: https://svnweb.freebsd.org/changeset/base/344288

Log:
  MFC r334868: Add st_mtime, st_ino and st_dev for ufs_stat

Modified:
  stable/11/stand/libsa/ufs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/libsa/ufs.c
==
--- stable/11/stand/libsa/ufs.c Tue Feb 19 18:35:49 2019(r344287)
+++ stable/11/stand/libsa/ufs.c Tue Feb 19 18:37:45 2019(r344288)
@@ -124,6 +124,7 @@ struct file {
ufs2_daddr_tf_buf_blkno;/* block number of data block */
char*f_buf; /* buffer for data block */
size_t  f_buf_size; /* size of data block */
+   int f_inumber;  /* inumber */
 };
 #define DIP(fp, field) \
((fp)->f_fs->fs_magic == FS_UFS1_MAGIC ? \
@@ -185,6 +186,7 @@ read_inode(inumber, f)
fp->f_buf_blkno = -1;
}
fp->f_seekp = 0;
+   fp->f_inumber = inumber;
 out:
free(buf);
return (rc); 
@@ -831,6 +833,20 @@ ufs_stat(f, sb)
sb->st_uid = DIP(fp, di_uid);
sb->st_gid = DIP(fp, di_gid);
sb->st_size = DIP(fp, di_size);
+   sb->st_mtime = DIP(fp, di_mtime);
+   /*
+* The items below are ufs specific!
+* Other fs types will need their own solution
+* if these fields are needed.
+*/
+   sb->st_ino = fp->f_inumber;
+   /*
+* We need something to differentiate devs.
+* fs_id is unique but 64bit, we xor the two
+* halves to squeeze it into 32bits.
+*/
+   sb->st_dev = (dev_t)(fp->f_fs->fs_id[0] ^ fp->f_fs->fs_id[1]);
+
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344287 - stable/11

2019-02-19 Thread Kyle Evans
Author: kevans
Date: Tue Feb 19 18:35:49 2019
New Revision: 344287
URL: https://svnweb.freebsd.org/changeset/base/344287

Log:
  MFC r65, r333471:
  
  r65:
  We don't use f_devdata, so don't set it. Should that need to change
  later, we can. This leaves ZFS as the only irregular f_devdata
  user in the tree.
  
  r333471:
  Revert r65
  
  Even though we don't use it, it appears something else requires it to
  be != 0 to work. This breaks tftp boot in loader.efi, so revert until
  that can be sorted out.

Modified:
Directory Properties:
  stable/11/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344285 - stable/11/stand/common

2019-02-19 Thread Kyle Evans
Author: kevans
Date: Tue Feb 19 18:32:05 2019
New Revision: 344285
URL: https://svnweb.freebsd.org/changeset/base/344285

Log:
  MFC r332555: loader: provide values in help_getnext()
  
  With r328289 we attempt to make sure we free the resources allocated in
  help_getnext(), however, it is possible that we get no resources allocated
  and help_getnext() will return early.
  
  Make sure we have pointers set to NULL early in help_getnext().

Modified:
  stable/11/stand/common/commands.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/common/commands.c
==
--- stable/11/stand/common/commands.c   Tue Feb 19 18:30:37 2019
(r344284)
+++ stable/11/stand/common/commands.c   Tue Feb 19 18:32:05 2019
(r344285)
@@ -64,7 +64,9 @@ static int
 help_getnext(int fd, char **topic, char **subtopic, char **desc) 
 {
 char   line[81], *cp, *ep;
-
+
+/* Make sure we provide sane values. */
+*topic = *subtopic = *desc = NULL;
 for (;;) {
if (fgetstr(line, 80, fd) < 0)
return(0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344283 - stable/11/stand/common

2019-02-19 Thread Kyle Evans
Author: kevans
Date: Tue Feb 19 18:28:32 2019
New Revision: 344283
URL: https://svnweb.freebsd.org/changeset/base/344283

Log:
  MFC r330757: stand/interp_lua: correct errorr => error

Modified:
  stable/11/stand/common/interp_lua.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/common/interp_lua.c
==
--- stable/11/stand/common/interp_lua.c Tue Feb 19 18:22:57 2019
(r344282)
+++ stable/11/stand/common/interp_lua.c Tue Feb 19 18:28:32 2019
(r344283)
@@ -123,7 +123,7 @@ interp_init(void)
if (interp_include(filename) != 0) {
 const char *errstr = lua_tostring(luap, -1);
 errstr = errstr == NULL ? "unknown" : errstr;
-printf("Startup errorr in %s:\nLUA ERROR: %s.\n", filename, 
errstr);
+printf("Startup error in %s:\nLUA ERROR: %s.\n", filename, 
errstr);
 lua_pop(luap, 1);
}
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344284 - stable/11

2019-02-19 Thread Kyle Evans
Author: kevans
Date: Tue Feb 19 18:30:37 2019
New Revision: 344284
URL: https://svnweb.freebsd.org/changeset/base/344284

Log:
  MFC r332270, r332272, r332275, r332413: nop
  
  r332270:
  loader: include efi.4th only if we do have uefi
  
  Also simplify efi.4th.
  
  r332272:
  loader: 332270 did use wrong path for efi.4th
  
  The correct  path is still /boot/efi.4th
  
  r332275:
  loader: 332270 did left out stand/i386/loader/loader.rc
  
  we have 2 instances of loader.rc...
  
  r332413:
  Revert r332275, r332272, r332270
  
  There's problems with them. The order of efi stuff isn't quite right,
  and there's various problems. Revert until thos problems can be fixed.

Modified:
Directory Properties:
  stable/11/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344282 - stable/11/sys/netinet

2019-02-19 Thread Kristof Provost
Author: kp
Date: Tue Feb 19 18:22:57 2019
New Revision: 344282
URL: https://svnweb.freebsd.org/changeset/base/344282

Log:
  MFC r344061:
  
  garp: Fix vnet related panic for gratuitous arp
  
  Gratuitous ARP packets are sent from a timer, which means we don't have a vnet
  context set. As a result we panic trying to send the packet.
  
  Set the vnet context based on the interface associated with the interface
  address.
  
  To reproduce:
  sysctl net.link.ether.inet.garp_rexmit_count=2
  ifconfig vtnet1 10.0.0.1/24 up
  
  PR:   235699
  Reviewed by:  vangyzen@

Modified:
  stable/11/sys/netinet/if_ether.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/if_ether.c
==
--- stable/11/sys/netinet/if_ether.cTue Feb 19 18:22:55 2019
(r344281)
+++ stable/11/sys/netinet/if_ether.cTue Feb 19 18:22:57 2019
(r344282)
@@ -1351,6 +1351,8 @@ garp_rexmit(void *arg)
return;
}
 
+   CURVNET_SET(ia->ia_ifa.ifa_ifp->if_vnet);
+
/*
 * Drop lock while the ARP request is generated.
 */
@@ -1378,6 +1380,8 @@ garp_rexmit(void *arg)
ifa_free(&ia->ia_ifa);
}
}
+
+   CURVNET_RESTORE();
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344281 - stable/12/sys/netinet

2019-02-19 Thread Kristof Provost
Author: kp
Date: Tue Feb 19 18:22:55 2019
New Revision: 344281
URL: https://svnweb.freebsd.org/changeset/base/344281

Log:
  MFC r344061:
  
  garp: Fix vnet related panic for gratuitous arp
  
  Gratuitous ARP packets are sent from a timer, which means we don't have a vnet
  context set. As a result we panic trying to send the packet.
  
  Set the vnet context based on the interface associated with the interface
  address.
  
  To reproduce:
  sysctl net.link.ether.inet.garp_rexmit_count=2
  ifconfig vtnet1 10.0.0.1/24 up
  
  PR:   235699
  Reviewed by:  vangyzen@

Modified:
  stable/12/sys/netinet/if_ether.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/if_ether.c
==
--- stable/12/sys/netinet/if_ether.cTue Feb 19 17:38:24 2019
(r344280)
+++ stable/12/sys/netinet/if_ether.cTue Feb 19 18:22:55 2019
(r344281)
@@ -1345,6 +1345,8 @@ garp_rexmit(void *arg)
return;
}
 
+   CURVNET_SET(ia->ia_ifa.ifa_ifp->if_vnet);
+
/*
 * Drop lock while the ARP request is generated.
 */
@@ -1372,6 +1374,8 @@ garp_rexmit(void *arg)
ifa_free(&ia->ia_ifa);
}
}
+
+   CURVNET_RESTORE();
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344280 - head/usr.sbin/freebsd-update

2019-02-19 Thread Ed Maste
Author: emaste
Date: Tue Feb 19 17:38:24 2019
New Revision: 344280
URL: https://svnweb.freebsd.org/changeset/base/344280

Log:
  freebsd-update: Clarify help text
  
  Improve help text to include example release numbers for reference
  and clarify the -F option.
  
  PR:   231185, 214619
  Submitted by: Gerald Aryeetey 
  Reviewed by:  delphij, rgrimes
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D18944

Modified:
  head/usr.sbin/freebsd-update/freebsd-update.8
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/usr.sbin/freebsd-update/freebsd-update.8
==
--- head/usr.sbin/freebsd-update/freebsd-update.8   Tue Feb 19 17:03:34 
2019(r344279)
+++ head/usr.sbin/freebsd-update/freebsd-update.8   Tue Feb 19 17:38:24 
2019(r344280)
@@ -89,13 +89,13 @@ Read configuration options from
 .It Fl F
 Force
 .Nm Cm fetch
-to proceed where it normally would not, such as an unfinished upgrade
+to proceed in the case of an unfinished upgrade.
 .It Fl k Ar KEY
 Trust an RSA key with SHA256 of
 .Ar KEY .
 (default: read value from configuration file.)
 .It Fl r Ar newrelease
-Specify the new release to which
+Specify the new release (e.g. 11.2-RELEASE) to which
 .Nm
 should upgrade (upgrade command only).
 .It Fl s Ar server

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==
--- head/usr.sbin/freebsd-update/freebsd-update.sh  Tue Feb 19 17:03:34 
2019(r344279)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh  Tue Feb 19 17:38:24 
2019(r344280)
@@ -45,7 +45,8 @@ Options:
   (default: /var/db/freebsd-update/)
   -f conffile  -- Read configuration options from conffile
   (default: /etc/freebsd-update.conf)
-  -F   -- Force a fetch operation to proceed
+  -F   -- Force a fetch operation to proceed in the
+  case of an unfinished upgrade
   -k KEY   -- Trust an RSA key with SHA256 hash of KEY
   -r release   -- Target for upgrade (e.g., 11.1-RELEASE)
   -s server-- Server from which to fetch updates
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344279 - head/sys/kern

2019-02-19 Thread Andrew Turner
Author: andrew
Date: Tue Feb 19 17:03:34 2019
New Revision: 344279
URL: https://svnweb.freebsd.org/changeset/base/344279

Log:
  Create a common function to handle freeing the kcov info struct.
  
  Both places that may free the kcov info struct are identical. Create a new
  common function to hold the code.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/kern/kern_kcov.c

Modified: head/sys/kern/kern_kcov.c
==
--- head/sys/kern/kern_kcov.c   Tue Feb 19 15:46:43 2019(r344278)
+++ head/sys/kern/kern_kcov.c   Tue Feb 19 17:03:34 2019(r344279)
@@ -136,6 +136,7 @@ static d_mmap_single_t  kcov_mmap_single;
 static d_ioctl_t   kcov_ioctl;
 
 static int  kcov_alloc(struct kcov_info *info, size_t entries);
+static void kcov_free(struct kcov_info *info);
 static void kcov_init(const void *unused);
 
 static struct cdevsw kcov_cdevsw = {
@@ -288,14 +289,7 @@ kcov_mmap_cleanup(void *arg)
 * The KCOV_STATE_DYING stops new threads from using it.
 * The lack of a thread means nothing is currently using the buffers.
 */
-
-   if (info->kvaddr != 0) {
-   pmap_qremove(info->kvaddr, info->bufsize / PAGE_SIZE);
-   kva_free(info->kvaddr, info->bufsize);
-   }
-   if (info->bufobj != NULL && !info->mmap)
-   vm_object_deallocate(info->bufobj);
-   free(info, M_KCOV_INFO);
+   kcov_free(info);
 }
 
 static int
@@ -398,6 +392,19 @@ kcov_alloc(struct kcov_info *info, size_t entries)
return (0);
 }
 
+static void
+kcov_free(struct kcov_info *info)
+{
+
+   if (info->kvaddr != 0) {
+   pmap_qremove(info->kvaddr, info->bufsize / PAGE_SIZE);
+   kva_free(info->kvaddr, info->bufsize);
+   }
+   if (info->bufobj != NULL && !info->mmap)
+   vm_object_deallocate(info->bufobj);
+   free(info, M_KCOV_INFO);
+}
+
 static int
 kcov_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag __unused,
 struct thread *td)
@@ -531,14 +538,7 @@ kcov_thread_dtor(void *arg __unused, struct thread *td
 * The KCOV_STATE_DYING stops new threads from using it.
 * It also stops the current thread from trying to use the info struct.
 */
-
-   if (info->kvaddr != 0) {
-   pmap_qremove(info->kvaddr, info->bufsize / PAGE_SIZE);
-   kva_free(info->kvaddr, info->bufsize);
-   }
-   if (info->bufobj != NULL && !info->mmap)
-   vm_object_deallocate(info->bufobj);
-   free(info, M_KCOV_INFO);
+   kcov_free(info);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344278 - head/sys/kern

2019-02-19 Thread Mark Johnston
Author: markj
Date: Tue Feb 19 15:46:43 2019
New Revision: 344278
URL: https://svnweb.freebsd.org/changeset/base/344278

Log:
  Move a racy assertion in filt_pipewrite().
  
  EVFILT_WRITE knotes for pipes live on the knlist for the other end of the
  pipe.  Since they do not hold a reference on the corresponding file
  structure, they may be removed from the knlist by pipeclose() while still
  remaining active.  In this case, there is no knlist lock acquired before
  filt_pipewrite() is called, so the assertion fails.
  
  Fix the problem by first checking whether that end of the pipe has been
  closed.  These checks are memory safe since the knote holds a reference
  on one end of the pipe, and the pipe structure is not freed until both
  ends are closed.  The checks are not racy since PIPE_EOF is never cleared
  after being set, and pipe_present is never set back to PIPE_ACTIVE after
  pipeclose() has been called.
  
  PR:   235640
  Reported and tested by:   pho
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19224

Modified:
  head/sys/kern/sys_pipe.c

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cTue Feb 19 12:45:37 2019(r344277)
+++ head/sys/kern/sys_pipe.cTue Feb 19 15:46:43 2019(r344278)
@@ -1741,15 +1741,19 @@ static int
 filt_pipewrite(struct knote *kn, long hint)
 {
struct pipe *wpipe;
-   
+
+   /*
+* If this end of the pipe is closed, the knote was removed from the
+* knlist and the list lock (i.e., the pipe lock) is therefore not held.
+*/
wpipe = kn->kn_hook;
-   PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
if (wpipe->pipe_present != PIPE_ACTIVE ||
(wpipe->pipe_state & PIPE_EOF)) {
kn->kn_data = 0;
kn->kn_flags |= EV_EOF;
return (1);
}
+   PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
kn->kn_data = (wpipe->pipe_buffer.size > 0) ?
(wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) : PIPE_BUF;
if (wpipe->pipe_state & PIPE_DIRECTW)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r344272 - stable/11/sys/dev/vmware/vmxnet3

2019-02-19 Thread Vincenzo Maffione
Il giorno mar 19 feb 2019 alle ore 15:47 Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net> ha scritto:

> > Hi Rodney,
> >
> >
> > Il giorno mar 19 feb 2019 alle ore 15:36 Rodney W. Grimes <
> > free...@pdx.rh.cn85.dnsmgr.net> ha scritto:
> >
> > > > Author: vmaffione
> > > > Date: Tue Feb 19 10:07:48 2019
> > > > New Revision: 344272
> > > > URL: https://svnweb.freebsd.org/changeset/base/344272
> > > >
> > > > Log:
> > > >   vmx(4): add native netmap support
> > > >
> > > >   This change adds native netmap support for the vmx(4) adapter
> > > >   (vmxnet3). Native support comes for free in 12, since the driver
> has
> > > been
> > >^^^
> > > This commit is to stable/11
> > >
> >
> > Yes, this commit is meant for stable/11. Since in head vmx(4) has been
> > ported to iflib, netmap support form vmx(4)
> > is already available there through iflib.
> > In stable/11, on the other hand, vmx(4) is not using iflib, thus explicit
> > netmap support is needed (hence this commit).
> >
> >
> > >
> > > >   ported to iflib. To make it minimally intrusive, the native
> support is
> > > >   only enabled if vmxnet3.netmap_native is set at boot (e.g., in
> > > loader.conf).
> > > >
> > > >   Tested on stable/11 running inside vmplayer.
> > > >
> > > >   Submitted by:   Giuseppe Lettieri 
> > > >   Reviewed by:vmaffione, bryanv
> > > >   Sponsored by:   Sunny Valley Networks
> > > >   Differential Revision:  https://reviews.freebsd.org/D19104
> > >
> > > Huh?  When did the vmx driver in stable/11 become iflib'ed?
> > >
> >
> > It didn't. The vmx driver has been ported to iflib in head.
>
> Ok, the wording of this commit message was very confusing,
> first it should of had a line:
> Direct commit to stable/11 as this code no longer exists in head.
>

Sorry, I did not know about this.


>
> Second,
> It would of been much clearer to not even mention the iflib
> in head and stable/12.
>
> Your first line and the one following sentance with out
> any additional details other than the fact this is a direct
> commit would of been clearer.
>
> Log:
> vmx(4): add native netmap support
>
> This change adds native netmap support for the vmx(4)
> adapter
> (vmxnet3).
>
> This is a direct commit to stable/11,
> this code does not exist in ^/head due to iflib
> converstion of vmx(4).
>
>
Sounds reasonable, thanks for the feedback!

Cheers,
  Vincenzo



> >
> > Cheers,
> >   Vincenzo
> >
> >
> > >
> > > >
> > > > Added:
> > > >   stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h   (contents, props
> > > changed)
> > > > Modified:
> > > >   stable/11/sys/dev/vmware/vmxnet3/if_vmx.c
> > > >
> > > > Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c
> > > >
> > >
> ==
> > > > --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 03:46:32
> 2019
> > >   (r344271)
> > > > +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 10:07:48
> 2019
> > >   (r344272)
> > > > @@ -239,6 +239,10 @@ typedef enum {
> > > >
> > > >  static void  vmxnet3_barrier(struct vmxnet3_softc *,
> vmxnet3_barrier_t);
> > > >
> > > > +#ifdef DEV_NETMAP
> > > > +#include "vmx_netmap.h"
> > > > +#endif
> > > > +
> > > >  /* Tunables. */
> > > >  static int vmxnet3_mq_disable = 0;
> > > >  TUNABLE_INT("hw.vmx.mq_disable", &vmxnet3_mq_disable);
> > > > @@ -270,6 +274,9 @@ DRIVER_MODULE(vmx, pci, vmxnet3_driver,
> > > vmxnet3_devcla
> > > >
> > > >  MODULE_DEPEND(vmx, pci, 1, 1, 1);
> > > >  MODULE_DEPEND(vmx, ether, 1, 1, 1);
> > > > +#ifdef DEV_NETMAP
> > > > +MODULE_DEPEND(vmx, netmap, 1, 1, 1);
> > > > +#endif
> > > >
> > > >  #define VMXNET3_VMWARE_VENDOR_ID 0x15AD
> > > >  #define VMXNET3_VMWARE_DEVICE_ID 0x07B0
> > > > @@ -347,6 +354,10 @@ vmxnet3_attach(device_t dev)
> > > >   vmxnet3_start_taskqueue(sc);
> > > >  #endif
> > > >
> > > > +#ifdef DEV_NETMAP
> > > > + vmxnet3_netmap_attach(sc);
> > > > +#endif
> > > > +
> > > >  fail:
> > > >   if (error)
> > > >   vmxnet3_detach(dev);
> > > > @@ -390,6 +401,10 @@ vmxnet3_detach(device_t dev)
> > > >  #endif
> > > >   vmxnet3_free_interrupts(sc);
> > > >
> > > > +#ifdef DEV_NETMAP
> > > > + netmap_detach(ifp);
> > > > +#endif
> > > > +
> > > >   if (ifp != NULL) {
> > > >   if_free(ifp);
> > > >   sc->vmx_ifp = NULL;
> > > > @@ -1846,6 +1861,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *txq)
> > > >   txr = &txq->vxtxq_cmd_ring;
> > > >   txc = &txq->vxtxq_comp_ring;
> > > >
> > > > +#ifdef DEV_NETMAP
> > > > + if (netmap_tx_irq(sc->vmx_ifp, txq - sc->vmx_txq) !=
> NM_IRQ_PASS)
> > > > + return;
> > > > +#endif
> > > > +
> > > >   VMXNET3_TXQ_LOCK_ASSERT(txq);
> > > >
> > > >   for (;;) {
> > > > @@ -2111,6 +2131,15 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *rxq)
> > > >   ifp

Re: svn commit: r344272 - stable/11/sys/dev/vmware/vmxnet3

2019-02-19 Thread Rodney W. Grimes
> Hi Rodney,
> 
> 
> Il giorno mar 19 feb 2019 alle ore 15:36 Rodney W. Grimes <
> free...@pdx.rh.cn85.dnsmgr.net> ha scritto:
> 
> > > Author: vmaffione
> > > Date: Tue Feb 19 10:07:48 2019
> > > New Revision: 344272
> > > URL: https://svnweb.freebsd.org/changeset/base/344272
> > >
> > > Log:
> > >   vmx(4): add native netmap support
> > >
> > >   This change adds native netmap support for the vmx(4) adapter
> > >   (vmxnet3). Native support comes for free in 12, since the driver has
> > been
> >^^^
> > This commit is to stable/11
> >
> 
> Yes, this commit is meant for stable/11. Since in head vmx(4) has been
> ported to iflib, netmap support form vmx(4)
> is already available there through iflib.
> In stable/11, on the other hand, vmx(4) is not using iflib, thus explicit
> netmap support is needed (hence this commit).
> 
> 
> >
> > >   ported to iflib. To make it minimally intrusive, the native support is
> > >   only enabled if vmxnet3.netmap_native is set at boot (e.g., in
> > loader.conf).
> > >
> > >   Tested on stable/11 running inside vmplayer.
> > >
> > >   Submitted by:   Giuseppe Lettieri 
> > >   Reviewed by:vmaffione, bryanv
> > >   Sponsored by:   Sunny Valley Networks
> > >   Differential Revision:  https://reviews.freebsd.org/D19104
> >
> > Huh?  When did the vmx driver in stable/11 become iflib'ed?
> >
> 
> It didn't. The vmx driver has been ported to iflib in head.

Ok, the wording of this commit message was very confusing,
first it should of had a line:
Direct commit to stable/11 as this code no longer exists in head.

Second,
It would of been much clearer to not even mention the iflib
in head and stable/12.

Your first line and the one following sentance with out
any additional details other than the fact this is a direct
commit would of been clearer.

Log:
vmx(4): add native netmap support

This change adds native netmap support for the vmx(4) adapter
(vmxnet3).

This is a direct commit to stable/11,
this code does not exist in ^/head due to iflib
converstion of vmx(4).

> 
> Cheers,
>   Vincenzo
> 
> 
> >
> > >
> > > Added:
> > >   stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h   (contents, props
> > changed)
> > > Modified:
> > >   stable/11/sys/dev/vmware/vmxnet3/if_vmx.c
> > >
> > > Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c
> > >
> > ==
> > > --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 03:46:32 2019
> >   (r344271)
> > > +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 10:07:48 2019
> >   (r344272)
> > > @@ -239,6 +239,10 @@ typedef enum {
> > >
> > >  static void  vmxnet3_barrier(struct vmxnet3_softc *, vmxnet3_barrier_t);
> > >
> > > +#ifdef DEV_NETMAP
> > > +#include "vmx_netmap.h"
> > > +#endif
> > > +
> > >  /* Tunables. */
> > >  static int vmxnet3_mq_disable = 0;
> > >  TUNABLE_INT("hw.vmx.mq_disable", &vmxnet3_mq_disable);
> > > @@ -270,6 +274,9 @@ DRIVER_MODULE(vmx, pci, vmxnet3_driver,
> > vmxnet3_devcla
> > >
> > >  MODULE_DEPEND(vmx, pci, 1, 1, 1);
> > >  MODULE_DEPEND(vmx, ether, 1, 1, 1);
> > > +#ifdef DEV_NETMAP
> > > +MODULE_DEPEND(vmx, netmap, 1, 1, 1);
> > > +#endif
> > >
> > >  #define VMXNET3_VMWARE_VENDOR_ID 0x15AD
> > >  #define VMXNET3_VMWARE_DEVICE_ID 0x07B0
> > > @@ -347,6 +354,10 @@ vmxnet3_attach(device_t dev)
> > >   vmxnet3_start_taskqueue(sc);
> > >  #endif
> > >
> > > +#ifdef DEV_NETMAP
> > > + vmxnet3_netmap_attach(sc);
> > > +#endif
> > > +
> > >  fail:
> > >   if (error)
> > >   vmxnet3_detach(dev);
> > > @@ -390,6 +401,10 @@ vmxnet3_detach(device_t dev)
> > >  #endif
> > >   vmxnet3_free_interrupts(sc);
> > >
> > > +#ifdef DEV_NETMAP
> > > + netmap_detach(ifp);
> > > +#endif
> > > +
> > >   if (ifp != NULL) {
> > >   if_free(ifp);
> > >   sc->vmx_ifp = NULL;
> > > @@ -1846,6 +1861,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *txq)
> > >   txr = &txq->vxtxq_cmd_ring;
> > >   txc = &txq->vxtxq_comp_ring;
> > >
> > > +#ifdef DEV_NETMAP
> > > + if (netmap_tx_irq(sc->vmx_ifp, txq - sc->vmx_txq) != NM_IRQ_PASS)
> > > + return;
> > > +#endif
> > > +
> > >   VMXNET3_TXQ_LOCK_ASSERT(txq);
> > >
> > >   for (;;) {
> > > @@ -2111,6 +2131,15 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *rxq)
> > >   ifp = sc->vmx_ifp;
> > >   rxc = &rxq->vxrxq_comp_ring;
> > >
> > > +#ifdef DEV_NETMAP
> > > + {
> > > + int dummy;
> > > + if (netmap_rx_irq(ifp, rxq - sc->vmx_rxq, &dummy) !=
> > > + NM_IRQ_PASS)
> > > + return;
> > > + }
> > > +#endif
> > > +
> > >   VMXNET3_RXQ_LOCK_ASSERT(rxq);
> > >
> > >   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
> > > @@ -2401,6 +2430,10 @@ vmxnet3_stop_rendezvous(struct vmxnet3_softc *sc)

Re: svn commit: r344272 - stable/11/sys/dev/vmware/vmxnet3

2019-02-19 Thread Vincenzo Maffione
Hi Rodney,


Il giorno mar 19 feb 2019 alle ore 15:36 Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net> ha scritto:

> > Author: vmaffione
> > Date: Tue Feb 19 10:07:48 2019
> > New Revision: 344272
> > URL: https://svnweb.freebsd.org/changeset/base/344272
> >
> > Log:
> >   vmx(4): add native netmap support
> >
> >   This change adds native netmap support for the vmx(4) adapter
> >   (vmxnet3). Native support comes for free in 12, since the driver has
> been
>^^^
> This commit is to stable/11
>

Yes, this commit is meant for stable/11. Since in head vmx(4) has been
ported to iflib, netmap support form vmx(4)
is already available there through iflib.
In stable/11, on the other hand, vmx(4) is not using iflib, thus explicit
netmap support is needed (hence this commit).


>
> >   ported to iflib. To make it minimally intrusive, the native support is
> >   only enabled if vmxnet3.netmap_native is set at boot (e.g., in
> loader.conf).
> >
> >   Tested on stable/11 running inside vmplayer.
> >
> >   Submitted by:   Giuseppe Lettieri 
> >   Reviewed by:vmaffione, bryanv
> >   Sponsored by:   Sunny Valley Networks
> >   Differential Revision:  https://reviews.freebsd.org/D19104
>
> Huh?  When did the vmx driver in stable/11 become iflib'ed?
>

It didn't. The vmx driver has been ported to iflib in head.

Cheers,
  Vincenzo


>
> >
> > Added:
> >   stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h   (contents, props
> changed)
> > Modified:
> >   stable/11/sys/dev/vmware/vmxnet3/if_vmx.c
> >
> > Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c
> >
> ==
> > --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 03:46:32 2019
>   (r344271)
> > +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 10:07:48 2019
>   (r344272)
> > @@ -239,6 +239,10 @@ typedef enum {
> >
> >  static void  vmxnet3_barrier(struct vmxnet3_softc *, vmxnet3_barrier_t);
> >
> > +#ifdef DEV_NETMAP
> > +#include "vmx_netmap.h"
> > +#endif
> > +
> >  /* Tunables. */
> >  static int vmxnet3_mq_disable = 0;
> >  TUNABLE_INT("hw.vmx.mq_disable", &vmxnet3_mq_disable);
> > @@ -270,6 +274,9 @@ DRIVER_MODULE(vmx, pci, vmxnet3_driver,
> vmxnet3_devcla
> >
> >  MODULE_DEPEND(vmx, pci, 1, 1, 1);
> >  MODULE_DEPEND(vmx, ether, 1, 1, 1);
> > +#ifdef DEV_NETMAP
> > +MODULE_DEPEND(vmx, netmap, 1, 1, 1);
> > +#endif
> >
> >  #define VMXNET3_VMWARE_VENDOR_ID 0x15AD
> >  #define VMXNET3_VMWARE_DEVICE_ID 0x07B0
> > @@ -347,6 +354,10 @@ vmxnet3_attach(device_t dev)
> >   vmxnet3_start_taskqueue(sc);
> >  #endif
> >
> > +#ifdef DEV_NETMAP
> > + vmxnet3_netmap_attach(sc);
> > +#endif
> > +
> >  fail:
> >   if (error)
> >   vmxnet3_detach(dev);
> > @@ -390,6 +401,10 @@ vmxnet3_detach(device_t dev)
> >  #endif
> >   vmxnet3_free_interrupts(sc);
> >
> > +#ifdef DEV_NETMAP
> > + netmap_detach(ifp);
> > +#endif
> > +
> >   if (ifp != NULL) {
> >   if_free(ifp);
> >   sc->vmx_ifp = NULL;
> > @@ -1846,6 +1861,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *txq)
> >   txr = &txq->vxtxq_cmd_ring;
> >   txc = &txq->vxtxq_comp_ring;
> >
> > +#ifdef DEV_NETMAP
> > + if (netmap_tx_irq(sc->vmx_ifp, txq - sc->vmx_txq) != NM_IRQ_PASS)
> > + return;
> > +#endif
> > +
> >   VMXNET3_TXQ_LOCK_ASSERT(txq);
> >
> >   for (;;) {
> > @@ -2111,6 +2131,15 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *rxq)
> >   ifp = sc->vmx_ifp;
> >   rxc = &rxq->vxrxq_comp_ring;
> >
> > +#ifdef DEV_NETMAP
> > + {
> > + int dummy;
> > + if (netmap_rx_irq(ifp, rxq - sc->vmx_rxq, &dummy) !=
> > + NM_IRQ_PASS)
> > + return;
> > + }
> > +#endif
> > +
> >   VMXNET3_RXQ_LOCK_ASSERT(rxq);
> >
> >   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
> > @@ -2401,6 +2430,10 @@ vmxnet3_stop_rendezvous(struct vmxnet3_softc *sc)
> >   struct vmxnet3_txqueue *txq;
> >   int i;
> >
> > +#ifdef DEV_NETMAP
> > + netmap_disable_all_rings(sc->vmx_ifp);
> > +#endif
> > +
> >   for (i = 0; i < sc->vmx_nrxqueues; i++) {
> >   rxq = &sc->vmx_rxq[i];
> >   VMXNET3_RXQ_LOCK(rxq);
> > @@ -2454,6 +2487,10 @@ vmxnet3_txinit(struct vmxnet3_softc *sc, struct
> vmxnet
> >   bzero(txr->vxtxr_txd,
> >   txr->vxtxr_ndesc * sizeof(struct vmxnet3_txdesc));
> >
> > +#ifdef DEV_NETMAP
> > + vmxnet3_netmap_txq_init(sc, txq);
> > +#endif
> > +
> >   txc = &txq->vxtxq_comp_ring;
> >   txc->vxcr_next = 0;
> >   txc->vxcr_gen = VMXNET3_INIT_GEN;
> > @@ -2468,6 +2505,10 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct
> vmxnet
> >   struct vmxnet3_rxring *rxr;
> >   struct vmxnet3_comp_ring *rxc;
> >   int i, populate, idx, frame_size, error;
> > +#ifdef DEV_NETMAP
> > + struct netmap_adapter *na;
> > + struct netmap_slot *slot;
> > +#

Re: svn commit: r344272 - stable/11/sys/dev/vmware/vmxnet3

2019-02-19 Thread Rodney W. Grimes
> Author: vmaffione
> Date: Tue Feb 19 10:07:48 2019
> New Revision: 344272
> URL: https://svnweb.freebsd.org/changeset/base/344272
> 
> Log:
>   vmx(4): add native netmap support
>   
>   This change adds native netmap support for the vmx(4) adapter
>   (vmxnet3). Native support comes for free in 12, since the driver has been
   ^^^
This commit is to stable/11

>   ported to iflib. To make it minimally intrusive, the native support is
>   only enabled if vmxnet3.netmap_native is set at boot (e.g., in loader.conf).
>   
>   Tested on stable/11 running inside vmplayer.
>   
>   Submitted by:   Giuseppe Lettieri 
>   Reviewed by:vmaffione, bryanv
>   Sponsored by:   Sunny Valley Networks
>   Differential Revision:  https://reviews.freebsd.org/D19104

Huh?  When did the vmx driver in stable/11 become iflib'ed?

> 
> Added:
>   stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h   (contents, props changed)
> Modified:
>   stable/11/sys/dev/vmware/vmxnet3/if_vmx.c
> 
> Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c
> ==
> --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 03:46:32 2019
> (r344271)
> +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Tue Feb 19 10:07:48 2019
> (r344272)
> @@ -239,6 +239,10 @@ typedef enum {
>  
>  static void  vmxnet3_barrier(struct vmxnet3_softc *, vmxnet3_barrier_t);
>  
> +#ifdef DEV_NETMAP
> +#include "vmx_netmap.h"
> +#endif
> +
>  /* Tunables. */
>  static int vmxnet3_mq_disable = 0;
>  TUNABLE_INT("hw.vmx.mq_disable", &vmxnet3_mq_disable);
> @@ -270,6 +274,9 @@ DRIVER_MODULE(vmx, pci, vmxnet3_driver, vmxnet3_devcla
>  
>  MODULE_DEPEND(vmx, pci, 1, 1, 1);
>  MODULE_DEPEND(vmx, ether, 1, 1, 1);
> +#ifdef DEV_NETMAP
> +MODULE_DEPEND(vmx, netmap, 1, 1, 1);
> +#endif
>  
>  #define VMXNET3_VMWARE_VENDOR_ID 0x15AD
>  #define VMXNET3_VMWARE_DEVICE_ID 0x07B0
> @@ -347,6 +354,10 @@ vmxnet3_attach(device_t dev)
>   vmxnet3_start_taskqueue(sc);
>  #endif
>  
> +#ifdef DEV_NETMAP
> + vmxnet3_netmap_attach(sc);
> +#endif
> +
>  fail:
>   if (error)
>   vmxnet3_detach(dev);
> @@ -390,6 +401,10 @@ vmxnet3_detach(device_t dev)
>  #endif
>   vmxnet3_free_interrupts(sc);
>  
> +#ifdef DEV_NETMAP
> + netmap_detach(ifp);
> +#endif
> +
>   if (ifp != NULL) {
>   if_free(ifp);
>   sc->vmx_ifp = NULL;
> @@ -1846,6 +1861,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *txq)
>   txr = &txq->vxtxq_cmd_ring;
>   txc = &txq->vxtxq_comp_ring;
>  
> +#ifdef DEV_NETMAP
> + if (netmap_tx_irq(sc->vmx_ifp, txq - sc->vmx_txq) != NM_IRQ_PASS)
> + return;
> +#endif
> +
>   VMXNET3_TXQ_LOCK_ASSERT(txq);
>  
>   for (;;) {
> @@ -2111,6 +2131,15 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *rxq)
>   ifp = sc->vmx_ifp;
>   rxc = &rxq->vxrxq_comp_ring;
>  
> +#ifdef DEV_NETMAP
> + {
> + int dummy;
> + if (netmap_rx_irq(ifp, rxq - sc->vmx_rxq, &dummy) !=
> + NM_IRQ_PASS)
> + return;
> + }
> +#endif
> +
>   VMXNET3_RXQ_LOCK_ASSERT(rxq);
>  
>   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
> @@ -2401,6 +2430,10 @@ vmxnet3_stop_rendezvous(struct vmxnet3_softc *sc)
>   struct vmxnet3_txqueue *txq;
>   int i;
>  
> +#ifdef DEV_NETMAP
> + netmap_disable_all_rings(sc->vmx_ifp);
> +#endif
> +
>   for (i = 0; i < sc->vmx_nrxqueues; i++) {
>   rxq = &sc->vmx_rxq[i];
>   VMXNET3_RXQ_LOCK(rxq);
> @@ -2454,6 +2487,10 @@ vmxnet3_txinit(struct vmxnet3_softc *sc, struct vmxnet
>   bzero(txr->vxtxr_txd,
>   txr->vxtxr_ndesc * sizeof(struct vmxnet3_txdesc));
>  
> +#ifdef DEV_NETMAP
> + vmxnet3_netmap_txq_init(sc, txq);
> +#endif
> +
>   txc = &txq->vxtxq_comp_ring;
>   txc->vxcr_next = 0;
>   txc->vxcr_gen = VMXNET3_INIT_GEN;
> @@ -2468,6 +2505,10 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet
>   struct vmxnet3_rxring *rxr;
>   struct vmxnet3_comp_ring *rxc;
>   int i, populate, idx, frame_size, error;
> +#ifdef DEV_NETMAP
> + struct netmap_adapter *na;
> + struct netmap_slot *slot;
> +#endif
>  
>   ifp = sc->vmx_ifp;
>   frame_size = ETHER_ALIGN + sizeof(struct ether_vlan_header) +
> @@ -2498,12 +2539,24 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet
>   else
>   populate = VMXNET3_RXRINGS_PERQ;
>  
> +#ifdef DEV_NETMAP
> + na = NA(ifp);
> + slot = netmap_reset(na, NR_RX, rxq - sc->vmx_rxq, 0);
> +#endif
> +
>   for (i = 0; i < populate; i++) {
>   rxr = &rxq->vxrxq_cmd_ring[i];
>   rxr->vxrxr_fill = 0;
>   rxr->vxrxr_gen = VMXNET3_INIT_GEN;
>   bzero(rxr->vxrxr_rxd,
>   rxr->vxrxr_ndesc * sizeof(struct vmxnet3_rxdesc));
> +#ifdef DEV_NETMAP
> + if (slot != NULL) {
> +  

svn commit: r344277 - head/sys/fs/nfsclient

2019-02-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Feb 19 12:45:37 2019
New Revision: 344277
URL: https://svnweb.freebsd.org/changeset/base/344277

Log:
  Work around the "nfscl: bad open cnt on server" assertion
  that can happen when rerooting into NFSv4 rootfs with kernel
  built with INVARIANTS.
  
  I've talked to rmacklem@ (back in 2017), and while the root cause
  is still unknown, the case guarded by assertion (nfscl_doclose()
  being called from VOP_INACTIVE) is believed to be safe, and the
  whole thing seems to run just fine.
  
  Obtained from:CheriBSD
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/fs/nfsclient/nfs_clstate.c

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==
--- head/sys/fs/nfsclient/nfs_clstate.c Tue Feb 19 11:07:02 2019
(r344276)
+++ head/sys/fs/nfsclient/nfs_clstate.c Tue Feb 19 12:45:37 2019
(r344277)
@@ -3188,8 +3188,11 @@ lookformore:
!NFSBCMP(op->nfso_fh, nfhp->nfh_fh,
nfhp->nfh_len)) {
/* Found an open, close it. */
+#ifdef DIAGNOSTIC
KASSERT((op->nfso_opencnt == 0),
-   ("nfscl: bad open cnt on server"));
+   ("nfscl: bad open cnt on server (%d)",
+op->nfso_opencnt));
+#endif
NFSUNLOCKCLSTATE();
nfsrpc_doclose(VFSTONFS(vnode_mount(vp)), op,
p);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344276 - head/sys/rpc/rpcsec_gss

2019-02-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Feb 19 11:07:02 2019
New Revision: 344276
URL: https://svnweb.freebsd.org/changeset/base/344276

Log:
  Bump the default kern.rpc.gss.client_max from 128 to 1024.
  
  The old value resulted in bad performance, with high kernel
  and gssd(8) load, with more than ~64 clients; it also triggered
  crashes, which are to be fixed by a different patch.
  
  PR:   235582
  Discussed with:   rmacklem@
  MFC after:2 weeks

Modified:
  head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c

Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
==
--- head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cTue Feb 19 10:40:35 2019
(r344275)
+++ head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cTue Feb 19 11:07:02 2019
(r344276)
@@ -170,7 +170,7 @@ struct svc_rpc_gss_cookedcred {
 };
 
 #define CLIENT_HASH_SIZE   256
-#define CLIENT_MAX 128
+#define CLIENT_MAX 1024
 u_int svc_rpc_gss_client_max = CLIENT_MAX;
 u_int svc_rpc_gss_client_hash_size = CLIENT_HASH_SIZE;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344275 - stable/11/sys/rpc/rpcsec_gss

2019-02-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Feb 19 10:40:35 2019
New Revision: 344275
URL: https://svnweb.freebsd.org/changeset/base/344275

Log:
  MFC r342114:
  
  Add kern.rpc.gss.client_max, to make it possible to bump it easily.
  This can drastically lower the load on gssd(8) on large NFS servers.

Modified:
  stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
==
--- stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c   Tue Feb 19 10:28:59 
2019(r344274)
+++ stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c   Tue Feb 19 10:40:35 
2019(r344275)
@@ -168,9 +168,22 @@ struct svc_rpc_gss_cookedcred {
 
 #define CLIENT_HASH_SIZE   256
 #define CLIENT_MAX 128
+u_int svc_rpc_gss_client_max = CLIENT_MAX;
+
+SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RW, 0, "RPC");
+SYSCTL_NODE(_kern_rpc, OID_AUTO, gss, CTLFLAG_RW, 0, "GSS");
+
+SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_max, CTLFLAG_RW,
+&svc_rpc_gss_client_max, 0,
+"Max number of rpc-gss clients");
+
+static u_int svc_rpc_gss_client_count;
+SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_count, CTLFLAG_RD,
+&svc_rpc_gss_client_count, 0,
+"Number of rpc-gss clients");
+
 struct svc_rpc_gss_client_list svc_rpc_gss_client_hash[CLIENT_HASH_SIZE];
 struct svc_rpc_gss_client_list svc_rpc_gss_clients;
-static size_t svc_rpc_gss_client_count;
 static uint32_t svc_rpc_gss_next_clientid = 1;
 
 static void
@@ -666,7 +679,7 @@ svc_rpc_gss_timeout_clients(void)
 */
sx_xlock(&svc_rpc_gss_lock);
client = TAILQ_LAST(&svc_rpc_gss_clients, svc_rpc_gss_client_list);
-   while (svc_rpc_gss_client_count > CLIENT_MAX && client != NULL) {
+   while (svc_rpc_gss_client_count > svc_rpc_gss_client_max && client != 
NULL) {
svc_rpc_gss_forget_client_locked(client);
sx_xunlock(&svc_rpc_gss_lock);
svc_rpc_gss_release_client(client);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344274 - stable/12/sys/rpc/rpcsec_gss

2019-02-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Feb 19 10:28:59 2019
New Revision: 344274
URL: https://svnweb.freebsd.org/changeset/base/344274

Log:
  MFC r342114:
  
  Add kern.rpc.gss.client_max, to make it possible to bump it easily.
  This can drastically lower the load on gssd(8) on large NFS servers.

Modified:
  stable/12/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
==
--- stable/12/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c   Tue Feb 19 10:17:49 
2019(r344273)
+++ stable/12/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c   Tue Feb 19 10:28:59 
2019(r344274)
@@ -171,9 +171,22 @@ struct svc_rpc_gss_cookedcred {
 
 #define CLIENT_HASH_SIZE   256
 #define CLIENT_MAX 128
+u_int svc_rpc_gss_client_max = CLIENT_MAX;
+
+SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RW, 0, "RPC");
+SYSCTL_NODE(_kern_rpc, OID_AUTO, gss, CTLFLAG_RW, 0, "GSS");
+
+SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_max, CTLFLAG_RW,
+&svc_rpc_gss_client_max, 0,
+"Max number of rpc-gss clients");
+
+static u_int svc_rpc_gss_client_count;
+SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_count, CTLFLAG_RD,
+&svc_rpc_gss_client_count, 0,
+"Number of rpc-gss clients");
+
 struct svc_rpc_gss_client_list svc_rpc_gss_client_hash[CLIENT_HASH_SIZE];
 struct svc_rpc_gss_client_list svc_rpc_gss_clients;
-static size_t svc_rpc_gss_client_count;
 static uint32_t svc_rpc_gss_next_clientid = 1;
 
 static void
@@ -669,7 +682,7 @@ svc_rpc_gss_timeout_clients(void)
 */
sx_xlock(&svc_rpc_gss_lock);
client = TAILQ_LAST(&svc_rpc_gss_clients, svc_rpc_gss_client_list);
-   while (svc_rpc_gss_client_count > CLIENT_MAX && client != NULL) {
+   while (svc_rpc_gss_client_count > svc_rpc_gss_client_max && client != 
NULL) {
svc_rpc_gss_forget_client_locked(client);
sx_xunlock(&svc_rpc_gss_lock);
svc_rpc_gss_release_client(client);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344273 - head/sys/rpc/rpcsec_gss

2019-02-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Feb 19 10:17:49 2019
New Revision: 344273
URL: https://svnweb.freebsd.org/changeset/base/344273

Log:
  Add kern.rpc.gss.client_hash tunable, to make it possible to bump
  it easily.  This can lower the load on gssd(8) on large NFS servers.
  
  Submitted by: Per Andersson 
  Reviewed by:  rmacklem@
  MFC after:2 weeks
  Sponsored by: Chalmers University of Technology

Modified:
  head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c

Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
==
--- head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cTue Feb 19 10:07:48 2019
(r344272)
+++ head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cTue Feb 19 10:17:49 2019
(r344273)
@@ -172,6 +172,7 @@ struct svc_rpc_gss_cookedcred {
 #define CLIENT_HASH_SIZE   256
 #define CLIENT_MAX 128
 u_int svc_rpc_gss_client_max = CLIENT_MAX;
+u_int svc_rpc_gss_client_hash_size = CLIENT_HASH_SIZE;
 
 SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RW, 0, "RPC");
 SYSCTL_NODE(_kern_rpc, OID_AUTO, gss, CTLFLAG_RW, 0, "GSS");
@@ -180,12 +181,16 @@ SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_max, CTLFL
 &svc_rpc_gss_client_max, 0,
 "Max number of rpc-gss clients");
 
+SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_hash, CTLFLAG_RDTUN,
+&svc_rpc_gss_client_hash_size, 0,
+"Size of rpc-gss client hash table");
+
 static u_int svc_rpc_gss_client_count;
 SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_count, CTLFLAG_RD,
 &svc_rpc_gss_client_count, 0,
 "Number of rpc-gss clients");
 
-struct svc_rpc_gss_client_list svc_rpc_gss_client_hash[CLIENT_HASH_SIZE];
+struct svc_rpc_gss_client_list *svc_rpc_gss_client_hash;
 struct svc_rpc_gss_client_list svc_rpc_gss_clients;
 static uint32_t svc_rpc_gss_next_clientid = 1;
 
@@ -194,7 +199,8 @@ svc_rpc_gss_init(void *arg)
 {
int i;
 
-   for (i = 0; i < CLIENT_HASH_SIZE; i++)
+   svc_rpc_gss_client_hash = mem_alloc(sizeof(struct 
svc_rpc_gss_client_list) * svc_rpc_gss_client_hash_size);
+   for (i = 0; i < svc_rpc_gss_client_hash_size; i++)
TAILQ_INIT(&svc_rpc_gss_client_hash[i]);
TAILQ_INIT(&svc_rpc_gss_clients);
svc_auth_reg(RPCSEC_GSS, svc_rpc_gss, rpc_gss_svc_getcred);
@@ -530,7 +536,7 @@ svc_rpc_gss_find_client(struct svc_rpc_gss_clientid *i
if (id->ci_hostid != hostid || id->ci_boottime != boottime.tv_sec)
return (NULL);
 
-   list = &svc_rpc_gss_client_hash[id->ci_id % CLIENT_HASH_SIZE];
+   list = &svc_rpc_gss_client_hash[id->ci_id % 
svc_rpc_gss_client_hash_size];
sx_xlock(&svc_rpc_gss_lock);
TAILQ_FOREACH(client, list, cl_link) {
if (client->cl_id.ci_id == id->ci_id) {
@@ -569,7 +575,7 @@ svc_rpc_gss_create_client(void)
getboottime(&boottime);
client->cl_id.ci_boottime = boottime.tv_sec;
client->cl_id.ci_id = svc_rpc_gss_next_clientid++;
-   list = &svc_rpc_gss_client_hash[client->cl_id.ci_id % CLIENT_HASH_SIZE];
+   list = &svc_rpc_gss_client_hash[client->cl_id.ci_id % 
svc_rpc_gss_client_hash_size];
sx_xlock(&svc_rpc_gss_lock);
TAILQ_INSERT_HEAD(list, client, cl_link);
TAILQ_INSERT_HEAD(&svc_rpc_gss_clients, client, cl_alllink);
@@ -635,7 +641,7 @@ svc_rpc_gss_forget_client_locked(struct svc_rpc_gss_cl
struct svc_rpc_gss_client_list *list;
 
sx_assert(&svc_rpc_gss_lock, SX_XLOCKED);
-   list = &svc_rpc_gss_client_hash[client->cl_id.ci_id % CLIENT_HASH_SIZE];
+   list = &svc_rpc_gss_client_hash[client->cl_id.ci_id % 
svc_rpc_gss_client_hash_size];
TAILQ_REMOVE(list, client, cl_link);
TAILQ_REMOVE(&svc_rpc_gss_clients, client, cl_alllink);
svc_rpc_gss_client_count--;
@@ -650,7 +656,7 @@ svc_rpc_gss_forget_client(struct svc_rpc_gss_client *c
struct svc_rpc_gss_client_list *list;
struct svc_rpc_gss_client *tclient;
 
-   list = &svc_rpc_gss_client_hash[client->cl_id.ci_id % CLIENT_HASH_SIZE];
+   list = &svc_rpc_gss_client_hash[client->cl_id.ci_id % 
svc_rpc_gss_client_hash_size];
sx_xlock(&svc_rpc_gss_lock);
TAILQ_FOREACH(tclient, list, cl_link) {
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344272 - stable/11/sys/dev/vmware/vmxnet3

2019-02-19 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Feb 19 10:07:48 2019
New Revision: 344272
URL: https://svnweb.freebsd.org/changeset/base/344272

Log:
  vmx(4): add native netmap support
  
  This change adds native netmap support for the vmx(4) adapter
  (vmxnet3). Native support comes for free in 12, since the driver has been
  ported to iflib. To make it minimally intrusive, the native support is
  only enabled if vmxnet3.netmap_native is set at boot (e.g., in loader.conf).
  
  Tested on stable/11 running inside vmplayer.
  
  Submitted by: Giuseppe Lettieri 
  Reviewed by:  vmaffione, bryanv
  Sponsored by: Sunny Valley Networks
  Differential Revision:https://reviews.freebsd.org/D19104

Added:
  stable/11/sys/dev/vmware/vmxnet3/vmx_netmap.h   (contents, props changed)
Modified:
  stable/11/sys/dev/vmware/vmxnet3/if_vmx.c

Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c
==
--- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c   Tue Feb 19 03:46:32 2019
(r344271)
+++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c   Tue Feb 19 10:07:48 2019
(r344272)
@@ -239,6 +239,10 @@ typedef enum {
 
 static voidvmxnet3_barrier(struct vmxnet3_softc *, vmxnet3_barrier_t);
 
+#ifdef DEV_NETMAP
+#include "vmx_netmap.h"
+#endif
+
 /* Tunables. */
 static int vmxnet3_mq_disable = 0;
 TUNABLE_INT("hw.vmx.mq_disable", &vmxnet3_mq_disable);
@@ -270,6 +274,9 @@ DRIVER_MODULE(vmx, pci, vmxnet3_driver, vmxnet3_devcla
 
 MODULE_DEPEND(vmx, pci, 1, 1, 1);
 MODULE_DEPEND(vmx, ether, 1, 1, 1);
+#ifdef DEV_NETMAP
+MODULE_DEPEND(vmx, netmap, 1, 1, 1);
+#endif
 
 #define VMXNET3_VMWARE_VENDOR_ID   0x15AD
 #define VMXNET3_VMWARE_DEVICE_ID   0x07B0
@@ -347,6 +354,10 @@ vmxnet3_attach(device_t dev)
vmxnet3_start_taskqueue(sc);
 #endif
 
+#ifdef DEV_NETMAP
+   vmxnet3_netmap_attach(sc);
+#endif
+
 fail:
if (error)
vmxnet3_detach(dev);
@@ -390,6 +401,10 @@ vmxnet3_detach(device_t dev)
 #endif
vmxnet3_free_interrupts(sc);
 
+#ifdef DEV_NETMAP
+   netmap_detach(ifp);
+#endif
+
if (ifp != NULL) {
if_free(ifp);
sc->vmx_ifp = NULL;
@@ -1846,6 +1861,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *txq)
txr = &txq->vxtxq_cmd_ring;
txc = &txq->vxtxq_comp_ring;
 
+#ifdef DEV_NETMAP
+   if (netmap_tx_irq(sc->vmx_ifp, txq - sc->vmx_txq) != NM_IRQ_PASS)
+   return;
+#endif
+
VMXNET3_TXQ_LOCK_ASSERT(txq);
 
for (;;) {
@@ -2111,6 +2131,15 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *rxq)
ifp = sc->vmx_ifp;
rxc = &rxq->vxrxq_comp_ring;
 
+#ifdef DEV_NETMAP
+   {
+   int dummy;
+   if (netmap_rx_irq(ifp, rxq - sc->vmx_rxq, &dummy) !=
+   NM_IRQ_PASS)
+   return;
+   }
+#endif
+
VMXNET3_RXQ_LOCK_ASSERT(rxq);
 
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
@@ -2401,6 +2430,10 @@ vmxnet3_stop_rendezvous(struct vmxnet3_softc *sc)
struct vmxnet3_txqueue *txq;
int i;
 
+#ifdef DEV_NETMAP
+   netmap_disable_all_rings(sc->vmx_ifp);
+#endif
+
for (i = 0; i < sc->vmx_nrxqueues; i++) {
rxq = &sc->vmx_rxq[i];
VMXNET3_RXQ_LOCK(rxq);
@@ -2454,6 +2487,10 @@ vmxnet3_txinit(struct vmxnet3_softc *sc, struct vmxnet
bzero(txr->vxtxr_txd,
txr->vxtxr_ndesc * sizeof(struct vmxnet3_txdesc));
 
+#ifdef DEV_NETMAP
+   vmxnet3_netmap_txq_init(sc, txq);
+#endif
+
txc = &txq->vxtxq_comp_ring;
txc->vxcr_next = 0;
txc->vxcr_gen = VMXNET3_INIT_GEN;
@@ -2468,6 +2505,10 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet
struct vmxnet3_rxring *rxr;
struct vmxnet3_comp_ring *rxc;
int i, populate, idx, frame_size, error;
+#ifdef DEV_NETMAP
+   struct netmap_adapter *na;
+   struct netmap_slot *slot;
+#endif
 
ifp = sc->vmx_ifp;
frame_size = ETHER_ALIGN + sizeof(struct ether_vlan_header) +
@@ -2498,12 +2539,24 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet
else
populate = VMXNET3_RXRINGS_PERQ;
 
+#ifdef DEV_NETMAP
+   na = NA(ifp);
+   slot = netmap_reset(na, NR_RX, rxq - sc->vmx_rxq, 0);
+#endif
+
for (i = 0; i < populate; i++) {
rxr = &rxq->vxrxq_cmd_ring[i];
rxr->vxrxr_fill = 0;
rxr->vxrxr_gen = VMXNET3_INIT_GEN;
bzero(rxr->vxrxr_rxd,
rxr->vxrxr_ndesc * sizeof(struct vmxnet3_rxdesc));
+#ifdef DEV_NETMAP
+   if (slot != NULL) {
+   vmxnet3_netmap_rxq_init(sc, rxq, rxr, slot);
+   i = populate;
+   break;
+   }
+#endif
 
for (idx = 0; idx < rxr->vxrxr_ndesc; idx++) {
error = vmxnet3_newbuf(sc, rxr);
@@ -2625,6 +2678,10 @@ vmxnet3_init_locked(struct vmxnet3_softc *sc)