Re: svn commit: r329371 - head/sys/compat/linuxkpi/common/include/asm

2018-02-16 Thread Hans Petter Selasky

On 02/17/18 01:42, Jan Beich wrote:

Hans Petter Selasky  writes:


Author: hselasky
Date: Fri Feb 16 15:20:21 2018
New Revision: 329371
URL: https://svnweb.freebsd.org/changeset/base/329371

Log:
   Allow the cmpxchg() macro in the LinuxKPI to work on pointers without
   generating compiler warnings, -Wint-conversion .

[...]

To generate errors instead ?

$ make clean all -C /usr/ports/graphics/drm-next-kmod
[...]
drm_lock.c:72:10: error: flexible array member 'u8' in a union is not allowed
 prev = cmpxchg(lock, old, new);
^


I believe this is a regression issue in GCC:

https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01505.html

--HPS
___
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: r329371 - head/sys/compat/linuxkpi/common/include/asm

2018-02-16 Thread Hans Petter Selasky

On 02/17/18 01:42, Jan Beich wrote:

To generate errors instead ?


Which compiler are you using?

This was tested with clang over here.

--HPS
___
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: r329445 - head/etc/devd

2018-02-16 Thread Warner Losh
Author: imp
Date: Sat Feb 17 06:57:38 2018
New Revision: 329445
URL: https://svnweb.freebsd.org/changeset/base/329445

Log:
  Pass in the NOMATCH event to devmatch
  
  In devd/devmatch.conf, we need to pass the event to the devmatch
  serivce. It gets passed to devmatch -p for matching. We always pass
  this, unlike hps' original patch, so we kill two birds with one stone
  and only match modules to the event passed in.
  
  Submitted by: hps@
  Sponsored by: Netflix

Modified:
  head/etc/devd/devmatch.conf

Modified: head/etc/devd/devmatch.conf
==
--- head/etc/devd/devmatch.conf Sat Feb 17 06:57:34 2018(r329444)
+++ head/etc/devd/devmatch.conf Sat Feb 17 06:57:38 2018(r329445)
@@ -9,7 +9,7 @@
 #
 # Generic NOMATCH event
 nomatch 100 {
-   action "service devmatch start";
+   action "service devmatch start '?$_'";
 };
 
 # Add the following to devd.conf to prevent this from running:
___
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: r329446 - head/sbin/devmatch

2018-02-16 Thread Warner Losh
Author: imp
Date: Sat Feb 17 06:57:43 2018
New Revision: 329446
URL: https://svnweb.freebsd.org/changeset/base/329446

Log:
  Implement --hints to read hints file directly
  
  In testing, it's often useful to copy a few files into a directory and
  kldxref them to ensure that particular cases are handled correctly.
  Add --hints (-h) to facilitate this testing and enable future
  automated testing.
  
  Sponsored by: Netflix

Modified:
  head/sbin/devmatch/devmatch.8
  head/sbin/devmatch/devmatch.c

Modified: head/sbin/devmatch/devmatch.8
==
--- head/sbin/devmatch/devmatch.8   Sat Feb 17 06:57:38 2018
(r329445)
+++ head/sbin/devmatch/devmatch.8   Sat Feb 17 06:57:43 2018
(r329446)
@@ -33,10 +33,11 @@
 .Nd print information about unattached devices
 .Sh SYNOPSIS
 .Nm
-.Op Fl adpuv
+.Op Fl adhpuv
 .Op Fl -all
 .Op Fl -dump
-.Op Fl -nomatch
+.Op Fl -hints Ar file
+.Op Fl -nomatch Ar event
 .Op Fl -unbound
 .Op Fl -verbose
 .Sh DESCRIPTION
@@ -51,7 +52,13 @@ Include all devices, not just the ones that are unatta
 Produce a human readable dump of the
 .Pa linker.hints
 file.
-.It Fl p Fl -nomatch
+.It Fl h Fl -hints Ar file
+Use the named
+.Ar file
+instead of
+.Pa linker.hints
+guessed from the current module load path.
+.It Fl p Fl -nomatch Ar event
 Parse and use a standard NOMATCH event from
 .Xr devd 8
 for matching instead of searching the device tree.

Modified: head/sbin/devmatch/devmatch.c
==
--- head/sbin/devmatch/devmatch.c   Sat Feb 17 06:57:38 2018
(r329445)
+++ head/sbin/devmatch/devmatch.c   Sat Feb 17 06:57:43 2018
(r329446)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 static struct option longopts[] = {
{ "all",no_argument,NULL,   'a' },
{ "dump",   no_argument,NULL,   'd' },
+   { "hints",  required_argument,  NULL,   'h' },
{ "nomatch",required_argument,  NULL,   'p' },
{ "unbound",no_argument,NULL,   'u' },
{ "verbose",no_argument,NULL,   'v' },
@@ -55,6 +56,7 @@ static struct option longopts[] = {
 
 static int all_flag;
 static int dump_flag;
+static char *linker_hints;
 static char *nomatch_str;
 static int unbound_flag;
 static int verbose_flag;
@@ -62,47 +64,66 @@ static int verbose_flag;
 static void *hints;
 static void *hints_end;
 
+static void *
+read_hints(const char *fn, size_t *len)
+{
+   void *h;
+   int fd;
+   struct stat sb;
+
+   fd = open(fn, O_RDONLY);
+   if (fd < 0) {
+   if (errno == ENOENT)
+   return NULL;
+   err(1, "Can't open %s for reading", fn);
+   }
+   if (fstat(fd, ) != 0)
+   err(1, "Can't fstat %s\n", fn);
+   h = malloc(sb.st_size);
+   if (h == NULL)
+   err(1, "not enough space to read hints file of %ju bytes", 
(uintmax_t)sb.st_size);
+   if (read(fd, h, sb.st_size) != sb.st_size)
+   err(1, "Can't read in %ju bytes from %s", 
(uintmax_t)sb.st_size, fn);
+   close(fd);
+   *len = sb.st_size;
+   return h;
+}
+
 static void
 read_linker_hints(void)
 {
char fn[MAXPATHLEN];
-   struct stat sb;
char *modpath, *p, *q;
-   size_t buflen;
-   int fd;
+   size_t buflen, len;
 
-   if (sysctlbyname("kern.module_path", NULL, , NULL, 0) < 0)
-   errx(1, "Can't find kernel module path.");
-   modpath = malloc(buflen);
-   if (modpath == NULL)
-   err(1, "Can't get memory for modpath.");
-   if (sysctlbyname("kern.module_path", modpath, , NULL, 0) < 0)
-   errx(1, "Can't find kernel module path.");
-   p = modpath;
-   while ((q = strsep(, ";")) != NULL) {
-   snprintf(fn, sizeof(fn), "%s/linker.hints", q);
-   fd = open(fn, O_RDONLY);
-   if (fd < 0) {
-   if (errno == ENOENT)
+   if (linker_hints == NULL) {
+   if (sysctlbyname("kern.module_path", NULL, , NULL, 0) < 
0)
+   errx(1, "Can't find kernel module path.");
+   modpath = malloc(buflen);
+   if (modpath == NULL)
+   err(1, "Can't get memory for modpath.");
+   if (sysctlbyname("kern.module_path", modpath, , NULL, 0) 
< 0)
+   errx(1, "Can't find kernel module path.");
+   p = modpath;
+   while ((q = strsep(, ";")) != NULL) {
+   snprintf(fn, sizeof(fn), "%s/linker.hints", q);
+   hints = read_hints(fn, );
+   if (hints == NULL)
continue;
-   err(1, "Can't open %s for reading", fn);
+   break;
  

svn commit: r329443 - head/sbin/devmatch

2018-02-16 Thread Warner Losh
Author: imp
Date: Sat Feb 17 06:57:30 2018
New Revision: 329443
URL: https://svnweb.freebsd.org/changeset/base/329443

Log:
  Tweak the 'I' flagged value
  
  'I' was omitting 'zero' values. This is not quite correct, and was put
  in as a hack but not documented. Remove it. If we find what the hack
  was really needed for, we'll either fix the need for it, or invent a
  new flagged value type.
  
  Submitted by: hps@
  Sponsored by: Netflix

Modified:
  head/sbin/devmatch/devmatch.c

Modified: head/sbin/devmatch/devmatch.c
==
--- head/sbin/devmatch/devmatch.c   Sat Feb 17 06:57:25 2018
(r329442)
+++ head/sbin/devmatch/devmatch.c   Sat Feb 17 06:57:30 2018
(r329443)
@@ -285,7 +285,7 @@ search_hints(const char *bus, const char *dev, const c
break;
/*FALLTHROUGH*/
case 'I':
-   if (v != ival && ival 
!= 0)
+   if (v != ival)
notme++;
break;
case 'G':
___
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: r329444 - head/sbin/devmatch

2018-02-16 Thread Warner Losh
Author: imp
Date: Sat Feb 17 06:57:34 2018
New Revision: 329444
URL: https://svnweb.freebsd.org/changeset/base/329444

Log:
  Add option to parse NOMATCH event and suggest modules to load
  
  Add --nomatch/-p to search for individual drivers based on a NOMATCH
  event from devd.
  
  Submitted by: hps (earlier version)
  Sponsored by: Netflix

Modified:
  head/sbin/devmatch/devmatch.8
  head/sbin/devmatch/devmatch.c

Modified: head/sbin/devmatch/devmatch.8
==
--- head/sbin/devmatch/devmatch.8   Sat Feb 17 06:57:30 2018
(r329443)
+++ head/sbin/devmatch/devmatch.8   Sat Feb 17 06:57:34 2018
(r329444)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 12, 2018
+.Dd February 16, 2018
 .Dt DEVMATCH 8
 .Os
 .Sh NAME
@@ -33,9 +33,10 @@
 .Nd print information about unattached devices
 .Sh SYNOPSIS
 .Nm
-.Op Fl aduv
+.Op Fl adpuv
 .Op Fl -all
 .Op Fl -dump
+.Op Fl -nomatch
 .Op Fl -unbound
 .Op Fl -verbose
 .Sh DESCRIPTION
@@ -50,6 +51,10 @@ Include all devices, not just the ones that are unatta
 Produce a human readable dump of the
 .Pa linker.hints
 file.
+.It Fl p Fl -nomatch
+Parse and use a standard NOMATCH event from
+.Xr devd 8
+for matching instead of searching the device tree.
 .It Fl u Fl -unbound
 Attempt to produce a list of those drivers with PNP info whose driver
 tables with that PNP info can't be found.

Modified: head/sbin/devmatch/devmatch.c
==
--- head/sbin/devmatch/devmatch.c   Sat Feb 17 06:57:30 2018
(r329443)
+++ head/sbin/devmatch/devmatch.c   Sat Feb 17 06:57:34 2018
(r329444)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 static struct option longopts[] = {
{ "all",no_argument,NULL,   'a' },
{ "dump",   no_argument,NULL,   'd' },
+   { "nomatch",required_argument,  NULL,   'p' },
{ "unbound",no_argument,NULL,   'u' },
{ "verbose",no_argument,NULL,   'v' },
{ NULL, 0,  NULL,   0 }
@@ -54,6 +55,7 @@ static struct option longopts[] = {
 
 static int all_flag;
 static int dump_flag;
+static char *nomatch_str;
 static int unbound_flag;
 static int verbose_flag;
 
@@ -398,6 +400,46 @@ find_unmatched(struct devinfo_dev *dev, void *arg)
 }
 
 static void
+find_nomatch(char *nomatch)
+{
+   char *bus, *pnpinfo, *tmp;
+
+   /*
+* Find our bus name. It will include the unit number. We have to search
+* backwards to avoid false positive for any PNP string that has ' on '
+* in them, which would come earlier in the string. Like if there were
+* an 'Old Bard' ethernet card made by 'Stratford on Avon Hardware' or
+* something silly like that.
+*/
+   tmp = nomatch + strlen(nomatch) - 4;
+   while (tmp > nomatch && strncmp(tmp, " on ", 4) != 0)
+   tmp--;
+   if (tmp == nomatch)
+   errx(1, "No bus found in nomatch string: '%s'", nomatch);
+   bus = tmp + 4;
+   *tmp = '\0';
+   tmp = bus + strlen(bus) - 1;
+   while (tmp > bus && isdigit(*tmp))
+   tmp--;
+   *++tmp = '\0';
+
+   /*
+* Note: the NOMATCH events place both the bus location as well as the
+* pnp info after the 'at' and we don't know where one stops and the
+* other begins, so we pass the whole thing to our search routine.
+*/
+   if (*nomatch == '?')
+   nomatch++;
+   if (strncmp(nomatch, " at ", 4) != 0)
+   errx(1, "Malformed NOMATCH string: '%s'", nomatch);
+   pnpinfo = nomatch + 4;
+
+   search_hints(bus, "", pnpinfo);
+
+   exit(0);
+}
+
+static void
 usage(void)
 {
 
@@ -410,7 +452,7 @@ main(int argc, char **argv)
struct devinfo_dev *root;
int ch;
 
-   while ((ch = getopt_long(argc, argv, "aduv",
+   while ((ch = getopt_long(argc, argv, "adp:uv",
longopts, NULL)) != -1) {
switch (ch) {
case 'a':
@@ -419,6 +461,9 @@ main(int argc, char **argv)
case 'd':
dump_flag++;
break;
+   case 'p':
+   nomatch_str = optarg;
+   break;
case 'u':
unbound_flag++;
break;
@@ -441,6 +486,8 @@ main(int argc, char **argv)
exit(0);
}
 
+   if (nomatch_str != NULL)
+   find_nomatch(nomatch_str);
if (devinfo_init())
err(1, "devinfo_init");
if ((root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE)) == NULL)
___
svn-src-all@freebsd.org mailing list

svn commit: r329442 - head/sbin/devmatch

2018-02-16 Thread Warner Losh
Author: imp
Date: Sat Feb 17 06:57:25 2018
New Revision: 329442
URL: https://svnweb.freebsd.org/changeset/base/329442

Log:
  Implement 'T' field matching.
  
  Implement 'T' field matching. This is needed to prevent false
  positives. However, it's not general enough. It only handles one field
  and there's a ton of edge cases even with that it likely wouldn't
  handle. To do it more generally and also eliminate a lot of the
  hackiness that's in this program now, we'd need to creating
  directories for lookups ala awk, pearl, python, etc. It appears to be
  sufficient, though, to get my keyboard loaded on boot.
  
  Sponsored by: Netflix

Modified:
  head/sbin/devmatch/devmatch.c

Modified: head/sbin/devmatch/devmatch.c
==
--- head/sbin/devmatch/devmatch.c   Sat Feb 17 06:57:21 2018
(r329441)
+++ head/sbin/devmatch/devmatch.c   Sat Feb 17 06:57:25 2018
(r329442)
@@ -265,6 +265,7 @@ search_hints(const char *bus, const char *dev, const c
bit = -1;
do {
switch (*cp) {
+   /* All integer fields */
case 'I':
case 'J':
case 'G':
@@ -300,6 +301,7 @@ search_hints(const char *bus, const char *dev, const c
break;
}
break;
+   /* String fields */
case 'D':
case 'Z':
getstr(, val1);
@@ -311,6 +313,22 @@ search_hints(const char *bus, const char *dev, const c
break;
s = pnpval_as_str(cp + 2, 
pnpinfo);
if (strcmp(s, val1) != 0)
+   notme++;
+   break;
+   /* Key override fields, 
required to be last in the string */
+   case 'T':
+   /*
+* This is imperfect and only 
does one key and will be redone
+* to be more general for 
multiple keys. Currently, nothing
+* does that.
+*/
+   if (dump_flag)  
/* No per-row data stored */
+   break;
+   if (cp[strlen(cp) - 1] == ';')  
/* Skip required ; at end */
+   cp[strlen(cp) - 1] = 
'\0';  /* in case it's not there */
+   if ((s = strstr(pnpinfo, cp + 
2)) == NULL)
+   notme++;
+   else if (s > pnpinfo && s[-1] 
!= ' ')
notme++;
break;
default:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r329441 - head/etc/rc.d

2018-02-16 Thread Warner Losh
Author: imp
Date: Sat Feb 17 06:57:21 2018
New Revision: 329441
URL: https://svnweb.freebsd.org/changeset/base/329441

Log:
  If we're passed an argument, then treat it as a single NOMATCH event
  to parse rather than searching for all events. Pass with new -p arg to
  devmatch. devmatch will use that one event rather than walking the
  entire tree.
  
  kldload will stop at the first failure. So we need to loop.  Also,
  symbolic links may confused kldload into trying (and failing) to load
  multiple modules at once, so guard against that.
  
  Noticed by: hps (with similar patch)
  Sponsored by: Netflix

Modified:
  head/etc/rc.d/devmatch

Modified: head/etc/rc.d/devmatch
==
--- head/etc/rc.d/devmatch  Sat Feb 17 06:57:17 2018(r329440)
+++ head/etc/rc.d/devmatch  Sat Feb 17 06:57:21 2018(r329441)
@@ -37,17 +37,26 @@ desc="Use devmatch(8) to load kernel modules"
 
 start_cmd="${name}_start"
 stop_cmd=':'
+[ -n "$2" ] && one_nomatch="-p '$2'"
 
 devmatch_start()
 {
local x
 
-   x=$(devmatch | sort -u)
+   x=$(devmatch ${one_nomatch} | sort -u)
 
[ -n "$x" ] || return
 
+   # While kldload can accept multiple modules
+   # on the line at once, we loop here in case
+   # there's some weird error with one of them.
+   # We also optimize against the false positives
+   # or drivers that have symbolic links that
+   # confuse devmatch by running it -n.
echo "Autoloading modules: ${x}"
-   kldload ${x}
+   for m in ${x}; do
+   kldload -n ${m}
+   done
 }
 
 load_rc_config $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: r329440 - head/sys/dev/usb

2018-02-16 Thread Warner Losh
Author: imp
Date: Sat Feb 17 06:57:17 2018
New Revision: 329440
URL: https://svnweb.freebsd.org/changeset/base/329440

Log:
  Correct the PNP information generated by the usb driver to match the
  artificial NOMATCH usb does in lieu of creating a device_t for devices
  with no drivers. Also, correct bus to be 'uhub' since where USB
  devices attach, even though 'usb' is more logical, we need the
  physical bus here.
  
  Submitted by: hps@

Modified:
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usbdi.h

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Sat Feb 17 06:57:12 2018(r329439)
+++ head/sys/dev/usb/usb_hub.c  Sat Feb 17 06:57:17 2018(r329440)
@@ -1733,7 +1733,12 @@ uhub_child_pnpinfo_string(device_t parent, device_t ch
}
iface = usbd_get_iface(res.udev, res.iface_index);
if (iface && iface->idesc) {
-   snprintf(buf, buflen, "vendor=0x%04x product=0x%04x "
+   snprintf(buf, buflen,
+   "bus=usb "
+#if USB_HAVE_UGEN
+   "device=%s "
+#endif
+   "vendor=0x%04x product=0x%04x "
"devclass=0x%02x devsubclass=0x%02x "
"devproto=0x%02x "
"sernum=\"%s\" "
@@ -1741,6 +1746,9 @@ uhub_child_pnpinfo_string(device_t parent, device_t ch
"mode=%s "
"intclass=0x%02x intsubclass=0x%02x "
"intprotocol=0x%02x" "%s%s",
+#if USB_HAVE_UGEN
+   res.udev->ugen_name,
+#endif
UGETW(res.udev->ddesc.idVendor),
UGETW(res.udev->ddesc.idProduct),
res.udev->ddesc.bDeviceClass,

Modified: head/sys/dev/usb/usbdi.h
==
--- head/sys/dev/usb/usbdi.hSat Feb 17 06:57:12 2018(r329439)
+++ head/sys/dev/usb/usbdi.hSat Feb 17 06:57:17 2018(r329440)
@@ -337,18 +337,18 @@ struct usb_device_id {
 } __aligned(32);
 
 #define USB_STD_PNP_INFO 
"M16:mask;U16:vendor;U16:product;L16:release;G16:release;" \
-   "U8:devclass;U8:devsubclass;U8:devprotocol;" \
+   "U8:devclass;U8:devsubclass;U8:devproto;" \
"U8:intclass;U8:intsubclass;U8:intprotocol;"
 #define USB_STD_PNP_HOST_INFO USB_STD_PNP_INFO "T:mode=host;"
 #define USB_STD_PNP_DEVICE_INFO USB_STD_PNP_INFO "T:mode=device;"
 #define USB_PNP_HOST_INFO(table)   \
-   MODULE_PNP_INFO(USB_STD_PNP_HOST_INFO, usb, table, table, 
sizeof(table[0]), \
+   MODULE_PNP_INFO(USB_STD_PNP_HOST_INFO, uhub, table, table, 
sizeof(table[0]), \
sizeof(table) / sizeof(table[0]))
 #define USB_PNP_DEVICE_INFO(table) \
-   MODULE_PNP_INFO(USB_STD_PNP_DEVICE_INFO, usb, table, table, 
sizeof(table[0]), \
+   MODULE_PNP_INFO(USB_STD_PNP_DEVICE_INFO, uhub, table, table, 
sizeof(table[0]), \
sizeof(table) / sizeof(table[0]))
 #define USB_PNP_DUAL_INFO(table)   \
-   MODULE_PNP_INFO(USB_STD_PNP_INFO, usb, table, table, sizeof(table[0]), \
+   MODULE_PNP_INFO(USB_STD_PNP_INFO, uhub, table, table, sizeof(table[0]), 
\
sizeof(table) / sizeof(table[0]))
 
 /* check that the size of the structure above is correct */
___
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: r329439 - head/sbin/devmatch

2018-02-16 Thread Warner Losh
Author: imp
Date: Sat Feb 17 06:57:12 2018
New Revision: 329439
URL: https://svnweb.freebsd.org/changeset/base/329439

Log:
  Warn when we encounter unknown PNP field specifiers.
  
  The 'T' field went unimplemented for months due to a lack of warning.
  Add a warnings to detect mistakes sooner.
  
  Sponsored by: Netflix

Modified:
  head/sbin/devmatch/devmatch.c

Modified: head/sbin/devmatch/devmatch.c
==
--- head/sbin/devmatch/devmatch.c   Sat Feb 17 06:57:08 2018
(r329438)
+++ head/sbin/devmatch/devmatch.c   Sat Feb 17 06:57:12 2018
(r329439)
@@ -314,6 +314,7 @@ search_hints(const char *bus, const char *dev, const c
notme++;
break;
default:
+   fprintf(stderr, "Unknown field 
type %c\n:", *cp);
break;
}
bit++;
___
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: r329438 - head/share/man/man9

2018-02-16 Thread Warner Losh
Author: imp
Date: Sat Feb 17 06:57:08 2018
New Revision: 329438
URL: https://svnweb.freebsd.org/changeset/base/329438

Log:
  Add description for T specifier. It's for PNP keys that are checked
  programatically that must be true for a device to match, but aren't in
  the table as discrete fields.
  
  Sponsored by: Netflix

Modified:
  head/share/man/man9/MODULE_PNP_INFO.9

Modified: head/share/man/man9/MODULE_PNP_INFO.9
==
--- head/share/man/man9/MODULE_PNP_INFO.9   Sat Feb 17 06:57:03 2018
(r329437)
+++ head/share/man/man9/MODULE_PNP_INFO.9   Sat Feb 17 06:57:08 2018
(r329438)
@@ -109,6 +109,11 @@ A pointer to a human readable description for the devi
 A pointer that should be ignored.
 .It Dq Vt E
 EISA PNP Identifier.
+.It Dq Vt T
+PNP info that's true for the for the whole table.
+The driver code checks for these condition pragmatically before using
+this table to match devices.
+This item must come last in the list.
 .El
 .Pp
 The pseudo-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: r329437 - in head: sys/sys usr.sbin/kldxref

2018-02-16 Thread Warner Losh
Author: imp
Date: Sat Feb 17 06:57:03 2018
New Revision: 329437
URL: https://svnweb.freebsd.org/changeset/base/329437

Log:
  Fixup minor nits in the PNP_INFO protocol.
  
  Sponsored by: Netflix

Modified:
  head/sys/sys/module.h
  head/usr.sbin/kldxref/kldxref.c

Modified: head/sys/sys/module.h
==
--- head/sys/sys/module.h   Sat Feb 17 05:53:41 2018(r329436)
+++ head/sys/sys/module.h   Sat Feb 17 06:57:03 2018(r329437)
@@ -201,7 +201,7 @@ struct mod_pnp_match_info 
  * D   pointer to a string to human readable description for device
  * P   A pointer that should be ignored
  * E   EISA PNP Identifier (in binary, but bus publishes string)
- * K   Key for whole table. pnp_name=value. must be last, if present.
+ * T   Key for whole table. pnp_name=value. must be last, if present.
  *
  * The pnp_name "#" is reserved for other fields that should be ignored.
  * Otherwise pnp_name must match the name from the parent device's pnpinfo

Modified: head/usr.sbin/kldxref/kldxref.c
==
--- head/usr.sbin/kldxref/kldxref.c Sat Feb 17 05:53:41 2018
(r329436)
+++ head/usr.sbin/kldxref/kldxref.c Sat Feb 17 06:57:03 2018
(r329437)
@@ -213,12 +213,12 @@ typedef TAILQ_HEAD(pnp_head, pnp_elt) pnp_list;
  * typeOutput  Meaning
  * I   uint32_tInteger equality comparison
  * J   uint32_tPair of uint16_t fields converted to native
-   byte order. The two fields both must match.
+ * byte order. The two fields both must match.
  * G   uint32_tGreater than or equal to
  * L   uint32_tLess than or equal to
  * M   uint32_tMask of which fields to test. Fields that
-   take up space increment the count. This
-   field must be first, and resets the count.
+ * take up space increment the count. This
+ * field must be first, and resets the count.
  * D   string  Description of the device this pnp info is for
  * Z   string  pnp string must match this
  * T   nothing T fields set pnp values that must be true for
___
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: r329436 - head/stand/lua

2018-02-16 Thread Kyle Evans
On Fri, Feb 16, 2018 at 11:53 PM, Kyle Evans  wrote:
> Author: kevans
> Date: Sat Feb 17 05:53:41 2018
> New Revision: 329436
> URL: https://svnweb.freebsd.org/changeset/base/329436
>
> Log:
>   stand/lua: Debugging string snuck in...
>
> Modified:
>   head/stand/lua/password.lua
>

With this, I think our lualoader menu is fairly stable as-is. Things
should calm down while we sketch out the details of boot environment
bits.
___
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: r329436 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 05:53:41 2018
New Revision: 329436
URL: https://svnweb.freebsd.org/changeset/base/329436

Log:
  stand/lua: Debugging string snuck in...

Modified:
  head/stand/lua/password.lua

Modified: head/stand/lua/password.lua
==
--- head/stand/lua/password.lua Sat Feb 17 05:52:25 2018(r329435)
+++ head/stand/lua/password.lua Sat Feb 17 05:53:41 2018(r329436)
@@ -80,7 +80,7 @@ function password.check()
do_prompt(prompt, pwd);
end
 
-   local boot_pwd = "boot" --loader.getenv("bootlock_password");
+   local boot_pwd = loader.getenv("bootlock_password");
compare("Boot password: ", boot_pwd);
 
local geli_prompt = loader.getenv("geom_eli_passphrase_prompt");
___
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: r329435 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 05:52:25 2018
New Revision: 329435
URL: https://svnweb.freebsd.org/changeset/base/329435

Log:
  stand/lua: Style pass
  
  These are the style points that I'd like to try and maintain in our lua
  scripts:
  - Parentheses around conditionals
  - Trailing semicolons, except on block terminators
  - s:method(...) instead of string.method(s, ...) where applicable
  
  There's likely more, but that'll get hammered out as we continue.

Modified:
  head/stand/lua/color.lua
  head/stand/lua/config.lua
  head/stand/lua/core.lua
  head/stand/lua/drawer.lua
  head/stand/lua/menu.lua
  head/stand/lua/password.lua
  head/stand/lua/screen.lua

Modified: head/stand/lua/color.lua
==
--- head/stand/lua/color.luaSat Feb 17 05:28:06 2018(r329434)
+++ head/stand/lua/color.luaSat Feb 17 05:52:25 2018(r329435)
@@ -45,36 +45,35 @@ color.DIM = 2;
 
 function color.isEnabled()
local c = loader.getenv("loader_color");
-   if c ~= nil then
-   if c:lower() == "no"  or c == "0" then
+   if (c ~= nil) then
+   if (c:lower() == "no") or (c == "0") then
return false;
end
end
-   return not core.bootserial();
+   return (not core.bootserial());
 end
 
-color.disabled = not color.isEnabled();
+color.disabled = (not color.isEnabled());
 
-
 function color.escapef(c)
-   if color.disabled then
+   if (color.disabled) then
return c;
end
return "\027[3"..c.."m";
 end
 
 function color.escapeb(c)
-   if color.disabled then
+   if (color.disabled) then
return c;
end
return "\027[4"..c.."m";
 end
 
 function color.escape(fg, bg, att)
-   if color.disabled then
+   if (color.disabled) then
return "";
end
-   if not att then
+   if (not att) then
att = ""
else
att = att..";";
@@ -83,17 +82,17 @@ function color.escape(fg, bg, att)
 end
 
 function color.default()
-   if color.disabled then
+   if (color.disabled) then
return "";
end
return "\027[0;37;40m";
 end
 
 function color.highlight(str)
-   if color.disabled then
+   if (color.disabled) then
return str;
end
return "\027[1m"..str.."\027[0m";
 end
 
-return color
+return color;

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 17 05:28:06 2018(r329434)
+++ head/stand/lua/config.lua   Sat Feb 17 05:52:25 2018(r329435)
@@ -280,7 +280,7 @@ function config.loadkernel(other_kernel)
end
 
return try_load(bootfile);
-   end;
+   end
 
-- kernel not set, try load from default module_path
if kernel == nil then

Modified: head/stand/lua/core.lua
==
--- head/stand/lua/core.lua Sat Feb 17 05:28:06 2018(r329434)
+++ head/stand/lua/core.lua Sat Feb 17 05:52:25 2018(r329435)
@@ -128,13 +128,13 @@ function core.kernelList()
 
local kernels = {};
local i = 0;
-   if k ~= nil then
+   if (k ~= nil) then
i = i + 1;
kernels[i] = k;
end
 
for n in v:gmatch("([^; ]+)[; ]?") do
-   if n ~= k then
+   if (n ~= k) then
i = i + 1;
kernels[i] = n;
end
@@ -160,23 +160,23 @@ end
 function core.bootserial()
local c = loader.getenv("console");
 
-   if c ~= nil then
-   if c:find("comconsole") ~= nil then
+   if (c ~= nil) then
+   if (c:find("comconsole") ~= nil) then
return true;
end
end
 
local s = loader.getenv("boot_serial");
-   if s ~= nil then
+   if (s ~= nil) then
return true;
end
 
local m = loader.getenv("boot_multicons");
-   if m ~= nil then
+   if (m ~= nil) then
return true;
end
return false;
 end
 
-core.setACPI(core.getACPIPresent(false))
-return core
+core.setACPI(core.getACPIPresent(false));
+return core;

Modified: head/stand/lua/drawer.lua
==
--- head/stand/lua/drawer.lua   Sat Feb 17 05:28:06 2018(r329434)
+++ head/stand/lua/drawer.lua   Sat Feb 17 05:52:25 2018(r329435)
@@ -179,7 +179,7 @@ function drawer.drawmenu(m)
 
if (#choices < caridx) then
caridx = 1;
-   end;
+   end
name = 

svn commit: r329434 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 05:28:06 2018
New Revision: 329434
URL: https://svnweb.freebsd.org/changeset/base/329434

Log:
  stand/lua: Check for nil (GELI prompt)

Modified:
  head/stand/lua/password.lua

Modified: head/stand/lua/password.lua
==
--- head/stand/lua/password.lua Sat Feb 17 05:26:28 2018(r329433)
+++ head/stand/lua/password.lua Sat Feb 17 05:28:06 2018(r329434)
@@ -83,8 +83,8 @@ function password.check()
local boot_pwd = loader.getenv("bootlock_password");
compare("Boot password: ", boot_pwd);
 
-   local geli_pass_prompt = loader.getenv("geom_eli_passphrase_prompt");
-   if (geli_pass_prompt:lower() == "yes") then
+   local geli_prompt = loader.getenv("geom_eli_passphrase_prompt");
+   if (geli_prompt ~= nil) and (geli_prompt:lower() == "yes") then
local passphrase = do_prompt("GELI Passphrase: ");
loader.setenv("kern.geom.eli.passphrase", passphrase)
end
___
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: r329433 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 05:26:28 2018
New Revision: 329433
URL: https://svnweb.freebsd.org/changeset/base/329433

Log:
  stand/lua: Add optional GELI passphrase prompt
  
  Prompt for GELI passphrase when geom_eli_passphrase_prompt has been set to
  "YES" in loader.conf(5).
  
  This entailed breaking out the password prompt into its own function that
  can be reused between the password compare bits and this prompt that simply
  takes the entered password and passes it along in the environment as
  kern.geom.eli.passphrase.
  
  I've also added a TODO to re-evaluate later if we want the "password
  masking" -- it is currently not functional, so one still can't observe the
  length of the password typed at the prompt.

Modified:
  head/stand/lua/password.lua

Modified: head/stand/lua/password.lua
==
--- head/stand/lua/password.lua Sat Feb 17 05:02:38 2018(r329432)
+++ head/stand/lua/password.lua Sat Feb 17 05:26:28 2018(r329433)
@@ -40,7 +40,8 @@ function password.read()
if ch == core.KEY_ENTER then
break;
end
-
+   -- XXX TODO: Evaluate if we really want this or not, as a
+   -- security consideration of sorts
if (ch == core.KEY_BACKSPACE) or (ch == core.KEY_DELETE) then
if n > 0 then
n = n - 1;
@@ -58,22 +59,35 @@ end
 
 function password.check()
screen.defcursor();
-   local function compare(prompt, pwd)
-   if (pwd == nil) then
-   return;
-   end
+   -- pwd is optionally supplied if we want to check it
+   local function do_prompt(prompt, pwd)
while true do
loader.printc(prompt);
-   if (pwd == password.read()) then
-   break;
+   local read_pwd = password.read();
+   if (not pwd) or (pwd == read_pwd) then
+   return read_pwd;
end
print("\n\nloader: incorrect password!\n");
loader.delay(3*1000*1000);
end
+   -- Throw an extra newline out after the password prompt
+   print("")
end
+   local function compare(prompt, pwd)
+   if (pwd == nil) then
+   return;
+   end
+   do_prompt(prompt, pwd);
+   end
 
local boot_pwd = loader.getenv("bootlock_password");
compare("Boot password: ", boot_pwd);
+
+   local geli_pass_prompt = loader.getenv("geom_eli_passphrase_prompt");
+   if (geli_pass_prompt:lower() == "yes") then
+   local passphrase = do_prompt("GELI Passphrase: ");
+   loader.setenv("kern.geom.eli.passphrase", passphrase)
+   end
 
local pwd = loader.getenv("password");
if (pwd ~=nil) then
___
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: r329432 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 05:02:38 2018
New Revision: 329432
URL: https://svnweb.freebsd.org/changeset/base/329432

Log:
  stand/lua: Try to load alternate kernels as directories first
  
  This is the procedure that config.loadkernel tries to go through, but
  reloading kernel config didn't use this function. Amend config.loadkernel to
  take an optional other_kernel.
  
  While here, be a little more verbose ("Trying to load kernel") so that it's
  easy to follow where we've gone wrong.

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 17 04:46:06 2018(r329431)
+++ head/stand/lua/config.lua   Sat Feb 17 05:02:38 2018(r329432)
@@ -253,9 +253,11 @@ function config.parse(name, silent)
return status;
 end
 
-function config.loadkernel()
+-- other_kernel is optionally the name of a kernel to load, if not the default
+-- or autoloaded default from the module_path
+function config.loadkernel(other_kernel)
local flags = loader.getenv("kernel_options") or "";
-   local kernel = loader.getenv("kernel");
+   local kernel = other_kernel or loader.getenv("kernel");
 
local try_load = function (names)
for name in names:gmatch("([^;]+)%s*;?") do
@@ -265,7 +267,7 @@ function config.loadkernel()
end
end
return nil;
-   end;
+   end
 
local load_bootfile = function()
local bootfile = loader.getenv("bootfile");
@@ -294,6 +296,9 @@ function config.loadkernel()
local module_path = loader.getenv("module_path");
local res = nil;
 
+   if other_kern ~= nil then
+   kernel = other_kern;
+   end
-- first try load kernel with module_path = /boot/${kernel}
-- then try load with module_path=${kernel}
local paths = {"/boot/"..kernel, kernel};
@@ -355,22 +360,23 @@ function config.load(file)
 end
 
 function config.reload(kernel)
-   local res = 1;
+   local kernel_loaded = false;
 
-- unload all modules
print("Unloading modules...");
loader.perform("unload");
 
-   if kernel ~= nil then
-   res = loader.perform("load "..kernel);
-   if res == 0 then
+   if (kernel ~= nil) then
+   print("Trying to load '" .. kernel .. "'")
+   kernel_loaded = config.loadkernel(kernel);
+   if (kernel_loaded) then
print("Kernel '"..kernel.."' loaded!");
end
end
 
-- failed to load kernel or it is nil
-- then load default
-   if res == 1 then
+   if (not kernel_loaded) then
print("Loading default kernel...");
config.loadkernel();
end
___
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: r329429 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 04:33:37 2018
New Revision: 329429
URL: https://svnweb.freebsd.org/changeset/base/329429

Log:
  stand/lua: Add debug method to dump modules

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 17 04:22:36 2018(r329428)
+++ head/stand/lua/config.lua   Sat Feb 17 04:33:37 2018(r329429)
@@ -37,6 +37,14 @@ function config.setKey(k, n, v)
modules[k][n] = v;
 end
 
+function config.dumpModules()
+   print("== Dumping modules")
+   for k, v in pairs(modules) do
+   print(k, v.load);
+   end
+   print("== Dump ended")
+end
+
 local pattern_table = {
[1] = {
str = "^%s*(#.*)",
___
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: r329431 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 04:46:06 2018
New Revision: 329431
URL: https://svnweb.freebsd.org/changeset/base/329431

Log:
  stand/lua: Correct test sense, this should have been 'not nil'

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 17 04:43:41 2018(r329430)
+++ head/stand/lua/config.lua   Sat Feb 17 04:46:06 2018(r329431)
@@ -305,7 +305,7 @@ function config.loadkernel()
 
-- succeeded add path to module_path
if res ~= nil then
-   if module_path == nil then
+   if module_path ~= nil then
loader.setenv("module_path", v..";"..
module_path);
end
___
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: r329430 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 04:43:41 2018
New Revision: 329430
URL: https://svnweb.freebsd.org/changeset/base/329430

Log:
  stand/lua: Address some nits
  
  1.) Instead of string.function(s, ...), use s:function(...)
  2.) Don't try to concatenate `res`, it was just tested to be nil
  3.) Note that "Loading configuration" is configured modules, and be a little
  more precise in mentioning what failed ("loading of one or more modules")

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 17 04:33:37 2018(r329429)
+++ head/stand/lua/config.lua   Sat Feb 17 04:43:41 2018(r329430)
@@ -38,11 +38,11 @@ function config.setKey(k, n, v)
 end
 
 function config.dumpModules()
-   print("== Dumping modules")
+   print("== Dumping modules");
for k, v in pairs(modules) do
print(k, v.load);
end
-   print("== Dump ended")
+   print("== Dump ended");
 end
 
 local pattern_table = {
@@ -57,7 +57,7 @@ local pattern_table = {
if modules[k] == nil then
modules[k] = {};
end
-   modules[k].load = string.upper(v);
+   modules[k].load = v:upper();
end
},
--  module_name="value"
@@ -133,9 +133,9 @@ local pattern_table = {
 
 function config.isValidComment(c)
if c ~= nil then
-   local s = string.match(c, "^%s*#.*");
+   local s = c:match("^%s*#.*");
if s == nil then
-   s = string.match(c, "^%s*$");
+   s = c:match("^%s*$");
end
if s == nil then
return false;
@@ -221,13 +221,13 @@ function config.parse(name, silent)
local n = 1;
local status = true;
 
-   for line in string.gmatch(text, "([^\n]+)") do
+   for line in text:gmatch("([^\n]+)") do
 
-   if string.match(line, "^%s*$") == nil then
+   if line:match("^%s*$") == nil then
local found = false;
 
for i, val in ipairs(pattern_table) do
-   local k, v, c = string.match(line, val.str);
+   local k, v, c = line:match(val.str);
if k ~= nil then
found = true;
 
@@ -287,7 +287,7 @@ function config.loadkernel()
if res ~= nil then
return true;
else
-   print("Failed to load kernel '"..res.."'");
+   print("No kernel set, failed to load from module_path");
return false;
end
else
@@ -338,7 +338,7 @@ function config.load(file)
 
local f = loader.getenv("loader_conf_files");
if f ~= nil then
-   for name in string.gmatch(f, "([%w%p]+)%s*") do
+   for name in f:gmatch("([%w%p]+)%s*") do
if not config.parse(name) then
 -- print("Failed to parse configuration: 
'"..name.."'");
end
@@ -348,9 +348,9 @@ function config.load(file)
print("Loading kernel...");
config.loadkernel();
 
-   print("Loading configurations...");
+   print("Loading configured modules...");
if not config.loadmod(modules) then
-   print("Could not load configurations!");
+   print("Could not load one or more modules!");
end
 end
 
___
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: r329427 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 04:07:16 2018
New Revision: 329427
URL: https://svnweb.freebsd.org/changeset/base/329427

Log:
  stand/lua: Color non-default kernels blue

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Sat Feb 17 03:39:55 2018(r329426)
+++ head/stand/lua/menu.lua Sat Feb 17 04:07:16 2018(r329427)
@@ -204,11 +204,17 @@ menu.welcome = {
return "Kernel: ";
end
 
-   local kernel_name = color.escapef(color.GREEN) ..
-   choice .. color.default();
-   if (idx == 1) then
-   kernel_name = "default/" .. kernel_name;
+   local is_default = (idx == 1);
+   local kernel_name = "";
+   local name_color;
+   if is_default then
+   name_color = color.escapef(color.GREEN);
+   kernel_name = "default/";
+   else
+   name_color = color.escapef(color.BLUE);
end
+   kernel_name = kernel_name .. name_color .. choice ..
+   color.default();
return color.highlight("K").."ernel: " .. kernel_name ..
" (" .. idx ..
" of " .. #all_choices .. ")";
___
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: r329428 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 04:22:36 2018
New Revision: 329428
URL: https://svnweb.freebsd.org/changeset/base/329428

Log:
  stand/lua: Correct some trivial errors in config
  
  An empty module_path to start with isn't ideal, but if all modules are
  contained within a kernel directory (which is what we just tested) then it
  isn't strictly an error. Don't assume that module_path has a value already.
  
  When we fail to load the kernel, printing the result (which is guaranteed to
  be nil) is not intended; print the name of the kernel.

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 17 04:07:16 2018(r329427)
+++ head/stand/lua/config.lua   Sat Feb 17 04:22:36 2018(r329428)
@@ -297,7 +297,10 @@ function config.loadkernel()
 
-- succeeded add path to module_path
if res ~= nil then
-   loader.setenv("module_path", 
v..";"..module_path);
+   if module_path == nil then
+   loader.setenv("module_path", v..";"..
+   module_path);
+   end
return true;
end
end
@@ -308,7 +311,7 @@ function config.loadkernel()
if res ~= nil then
return true;
else
-   print("Failed to load kernel '"..res.."'");
+   print("Failed to load kernel '"..kernel.."'");
return false;
end
end
___
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: r329425 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 03:13:05 2018
New Revision: 329425
URL: https://svnweb.freebsd.org/changeset/base/329425

Log:
  stand/lua: Enable menu autoboot; it seems to work

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Sat Feb 17 03:12:35 2018(r329424)
+++ head/stand/lua/menu.lua Sat Feb 17 03:13:05 2018(r329425)
@@ -264,7 +264,7 @@ function menu.run(m)
screen.defcursor();
local alias_table = drawer.drawscreen(m);
 
--- menu.autoboot();
+   menu.autoboot();
 
cont = true;
while cont do
___
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: r329424 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 03:12:35 2018
New Revision: 329424
URL: https://svnweb.freebsd.org/changeset/base/329424

Log:
  stand/lua: Don't set autoboot_delay=NO in menu autoboot sequence
  
  We'll set it later if "Escape to loader prompt" is actually chosen, there's
  no need to be setting it here.

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Sat Feb 17 02:14:01 2018(r329423)
+++ head/stand/lua/menu.lua Sat Feb 17 03:12:35 2018(r329424)
@@ -375,8 +375,6 @@ function menu.autoboot()
if ch == core.KEY_ENTER then
break;
else
-   -- prevent autoboot when escaping to interpreter
-   loader.setenv("autoboot_delay", "NO");
-- erase autoboot msg
screen.setcursor(0, y);
print(""
___
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: r329426 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 03:39:55 2018
New Revision: 329426
URL: https://svnweb.freebsd.org/changeset/base/329426

Log:
  stand/lua: Correct interpretation of autoboot_delay
  
  autoboot_delay=NO is documented to wait for input and *not* autoboot, which
  is the exact opposite of the current behavior.
  
  Additionally, autoboot_delay=-1 is documented to disallow the user from
  interrupting the boot (i.e. autoboot immediately), which was not previously
  honored.
  
  This also fixes the case insensitive comparison to be truly case
  insensitive. This is kind of nit-picky, but the previous version would only
  accept "no" and "NO".

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Sat Feb 17 03:13:05 2018(r329425)
+++ head/stand/lua/menu.lua Sat Feb 17 03:39:55 2018(r329426)
@@ -353,7 +353,9 @@ function menu.autoboot()
menu.already_autoboot = true;
 
local ab = loader.getenv("autoboot_delay");
-   if ab == "NO" or ab == "no" then
+   if (ab ~= nil) and (ab:lower() == "no") then
+   return;
+   elseif (tonumber(ab) == -1) then
core.boot();
end
ab = tonumber(ab) or 10;
___
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: r329423 - stable/11/stand/libsa

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Sat Feb 17 02:14:01 2018
New Revision: 329423
URL: https://svnweb.freebsd.org/changeset/base/329423

Log:
  MFC r329264: libsa: Fix IP recv timeout
  
  [This is slightly modified to not set `t` in the middle of the loop so that
  the connection will eventually timeout after MAXTMO]
  
  readip() doesn't, at the moment, properly indicate to callers that it has
  timed out. One can tell that it's timed out if errno == EAGAIN when it
  returns, but this is not ideal. Restructure it a little bit to explicitly
  set errno to ETIMEDOUT if we've exhausted tleft.
  
  I found two places that care about where it timed out or not: sendrecv in
  net.c and sendrecv_tftp. Both are structured to pass smaller timeout values
  to readip while tracking a larger timeout. Neither of them were able to do
  this properly with readip not indicating ETIMEDOUT, so fix it.
  
  While here, straighten out the time (t/t1) usage in sendrecv_tftp.
  
  This would have manifested itself in periodic failures to NFS/TFTP boot for
  no apparent reason because MINTMO/MAXTMO were not actually being respected
  properly. Problems were not reported with NFS, only TFTP.

Modified:
  stable/11/stand/libsa/ip.c
  stable/11/stand/libsa/net.c
  stable/11/stand/libsa/tftp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/libsa/ip.c
==
--- stable/11/stand/libsa/ip.c  Sat Feb 17 00:24:50 2018(r329422)
+++ stable/11/stand/libsa/ip.c  Sat Feb 17 02:14:01 2018(r329423)
@@ -416,8 +416,13 @@ readip(struct iodesc *d, void **pkt, void **payload, t
while ((getsecs() - t) < tleft) {
errno = 0;
ret = readipv4(d, pkt, payload, tleft, proto);
+   if (ret >= 0)
+   return (ret);
+   /* Bubble up the error if it wasn't successful */
if (errno != EAGAIN)
-   break;
+   return (-1);
}
-   return (ret);
+   /* We've exhausted tleft; timeout */
+   errno = ETIMEDOUT;
+   return (-1);
 }

Modified: stable/11/stand/libsa/net.c
==
--- stable/11/stand/libsa/net.c Sat Feb 17 00:24:50 2018(r329422)
+++ stable/11/stand/libsa/net.c Sat Feb 17 02:14:01 2018(r329423)
@@ -118,7 +118,7 @@ sendrecv(struct iodesc *d,
/* Try to get a packet and process it. */
cc = (*rproc)(d, pkt, payload, tleft);
/* Return on data, EOF or real error. */
-   if (cc != -1 || errno != 0)
+   if (cc != -1 || (errno != 0 && errno != ETIMEDOUT))
return (cc);
 
/* Timed out or didn't get the packet we're waiting for */

Modified: stable/11/stand/libsa/tftp.c
==
--- stable/11/stand/libsa/tftp.cSat Feb 17 00:24:50 2018
(r329422)
+++ stable/11/stand/libsa/tftp.cSat Feb 17 02:14:01 2018
(r329423)
@@ -638,14 +638,20 @@ sendrecv_tftp(struct tftp_handle *h,
if (cc == -1) {
/* Error on transmit; wait before retrying */
while ((getsecs() - t1) < tleft);
+   t1 = getsecs();
continue;
}
 
+   t1 = getsecs();
 recvnext:
+   if ((getsecs() - t) > MAXTMO) {
+   errno = ETIMEDOUT;
+   return -1;
+   }
/* Try to get a packet and process it. */
cc = (*rproc)(h, pkt, payload, tleft, rtype);
/* Return on data, EOF or real error. */
-   if (cc != -1 || errno != 0)
+   if (cc != -1 || (errno != 0 && errno != ETIMEDOUT))
return (cc);
if ((getsecs() - t1) < tleft) {
goto recvnext;
___
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: r329371 - head/sys/compat/linuxkpi/common/include/asm

2018-02-16 Thread Jan Beich
Hans Petter Selasky  writes:

> Author: hselasky
> Date: Fri Feb 16 15:20:21 2018
> New Revision: 329371
> URL: https://svnweb.freebsd.org/changeset/base/329371
>
> Log:
>   Allow the cmpxchg() macro in the LinuxKPI to work on pointers without
>   generating compiler warnings, -Wint-conversion .
[...]

To generate errors instead ?

$ make clean all -C /usr/ports/graphics/drm-next-kmod
[...]
drm_lock.c:72:10: error: flexible array member 'u8' in a union is not allowed
prev = cmpxchg(lock, old, new);
   ^
/usr/src/sys/compat/linuxkpi/common/include/asm/atomic.h:165:6: note: expanded 
from macro 'cmpxchg'
u8 u8[];\
   ^
drm_lock.c:72:10: error: flexible array member 'u16' in a union is not allowed
/usr/src/sys/compat/linuxkpi/common/include/asm/atomic.h:166:7: note: expanded 
from macro 'cmpxchg'
u16 u16[];  \
^
drm_lock.c:72:10: error: flexible array member 'u32' in a union is not allowed
/usr/src/sys/compat/linuxkpi/common/include/asm/atomic.h:167:7: note: expanded 
from macro 'cmpxchg'
u32 u32[];  \
^
drm_lock.c:72:10: error: flexible array member 'u64' in a union is not allowed
/usr/src/sys/compat/linuxkpi/common/include/asm/atomic.h:168:7: note: expanded 
from macro 'cmpxchg'
u64 u64[];  \
^
___
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: r329422 - head/sys/kern

2018-02-16 Thread Mateusz Guzik
Author: mjg
Date: Sat Feb 17 00:24:50 2018
New Revision: 329422
URL: https://svnweb.freebsd.org/changeset/base/329422

Log:
  On process exit signal the parent after dropping the proctree lock.

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Sat Feb 17 00:23:56 2018(r329421)
+++ head/sys/kern/kern_exit.c   Sat Feb 17 00:24:50 2018(r329422)
@@ -193,6 +193,7 @@ exit1(struct thread *td, int rval, int signo)
struct proc *p, *nq, *q, *t;
struct thread *tdt;
ksiginfo_t *ksi, *ksi1;
+   int signal_parent;
 
mtx_assert(, MA_NOTOWNED);
KASSERT(rval == 0 || signo == 0, ("exit1 rv %d sig %d", rval, signo));
@@ -559,6 +560,7 @@ exit1(struct thread *td, int rval, int signo)
 * procdesc_exit() to serialize concurrent calls to close() and
 * exit().
 */
+   signal_parent = 0;
if (p->p_procdesc == NULL || procdesc_exit(p)) {
/*
 * Notify parent that we're gone.  If parent has the
@@ -588,17 +590,24 @@ exit1(struct thread *td, int rval, int signo)
} else
mtx_unlock(>p_pptr->p_sigacts->ps_mtx);
 
-   if (p->p_pptr == p->p_reaper || p->p_pptr == initproc)
-   childproc_exited(p);
-   else if (p->p_sigparent != 0) {
-   if (p->p_sigparent == SIGCHLD)
-   childproc_exited(p);
-   else/* LINUX thread */
-   kern_psignal(p->p_pptr, p->p_sigparent);
+   if (p->p_pptr == p->p_reaper || p->p_pptr == initproc) {
+   signal_parent = 1;
+   } else if (p->p_sigparent != 0) {
+   if (p->p_sigparent == SIGCHLD) {
+   signal_parent = 1;
+   } else { /* LINUX thread */
+   signal_parent = 2;
+   }
}
} else
PROC_LOCK(p->p_pptr);
sx_xunlock(_lock);
+
+   if (signal_parent == 1) {
+   childproc_exited(p);
+   } else if (signal_parent == 2) {
+   kern_psignal(p->p_pptr, p->p_sigparent);
+   }
 
/* Tell the prison that we are gone. */
prison_proc_free(p->p_ucred->cr_prison);
___
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: r329421 - head/sys/kern

2018-02-16 Thread Mateusz Guzik
Author: mjg
Date: Sat Feb 17 00:23:56 2018
New Revision: 329421
URL: https://svnweb.freebsd.org/changeset/base/329421

Log:
  Unref the prison after proctree is dropped.

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Sat Feb 17 00:23:28 2018(r329420)
+++ head/sys/kern/kern_exit.c   Sat Feb 17 00:23:56 2018(r329421)
@@ -530,9 +530,6 @@ exit1(struct thread *td, int rval, int signo)
PROC_LOCK(p);
p->p_xthread = td;
 
-   /* Tell the prison that we are gone. */
-   prison_proc_free(p->p_ucred->cr_prison);
-
 #ifdef KDTRACE_HOOKS
/*
 * Tell the DTrace fasttrap provider about the exit if it
@@ -602,6 +599,9 @@ exit1(struct thread *td, int rval, int signo)
} else
PROC_LOCK(p->p_pptr);
sx_xunlock(_lock);
+
+   /* Tell the prison that we are gone. */
+   prison_proc_free(p->p_ucred->cr_prison);
 
/*
 * The state PRS_ZOMBIE prevents other proesses from sending
___
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: r329420 - head/sys/kern

2018-02-16 Thread Mateusz Guzik
Author: mjg
Date: Sat Feb 17 00:23:28 2018
New Revision: 329420
URL: https://svnweb.freebsd.org/changeset/base/329420

Log:
  Postpone sx_sunlock(_lock) on fork until after allproc is dropped.
  
  There is a significant contention on the lock during -j 128 package build.
  This change drops total wait time on this lock by 60%.

Modified:
  head/sys/kern/kern_fork.c

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Sat Feb 17 00:21:50 2018(r329419)
+++ head/sys/kern/kern_fork.c   Sat Feb 17 00:23:28 2018(r329420)
@@ -401,8 +401,6 @@ do_fork(struct thread *td, struct fork_req *fr, struct
 
trypid = fork_findpid(fr->fr_flags);
 
-   sx_sunlock(_lock);
-
p2->p_state = PRS_NEW;  /* protect against others */
p2->p_pid = trypid;
AUDIT_ARG_PID(p2->p_pid);
@@ -414,6 +412,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct
PROC_LOCK(p1);
 
sx_xunlock(_lock);
+   sx_sunlock(_lock);
 
bcopy(>p_startcopy, >p_startcopy,
__rangeof(struct proc, p_startcopy, p_endcopy));
@@ -977,8 +976,8 @@ fork1(struct thread *td, struct fork_req *fr)
}
 
error = EAGAIN;
-   sx_sunlock(_lock);
sx_xunlock(_lock);
+   sx_sunlock(_lock);
 #ifdef MAC
mac_proc_destroy(newproc);
 #endif
___
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: r329419 - head/sys/kern

2018-02-16 Thread Mateusz Guzik
Author: mjg
Date: Sat Feb 17 00:21:50 2018
New Revision: 329419
URL: https://svnweb.freebsd.org/changeset/base/329419

Log:
  Tidy up kern_wait6
  
  - don't relock curproc in msleep
  - don't relock proctree if P_STATCHILD is spotted
  - reformat the proc_to_reap call in the main loop

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Sat Feb 17 00:12:30 2018(r329418)
+++ head/sys/kern/kern_exit.c   Sat Feb 17 00:21:50 2018(r329419)
@@ -1202,21 +1202,21 @@ loop:
q->p_flag &= ~P_STATCHILD;
PROC_UNLOCK(q);
}
-   nfound = 0;
sx_xlock(_lock);
+loop_locked:
+   nfound = 0;
LIST_FOREACH(p, >p_children, p_sibling) {
pid = p->p_pid;
ret = proc_to_reap(td, p, idtype, id, status, options,
wrusage, siginfo, 0);
if (ret == 0)
continue;
-   else if (ret == 1)
-   nfound++;
-   else {
+   else if (ret != 1) {
td->td_retval[0] = pid;
return (0);
}
 
+   nfound++;
PROC_LOCK_ASSERT(p, MA_OWNED);
 
if ((options & (WTRAPPED | WUNTRACED)) != 0)
@@ -1237,7 +1237,7 @@ loop:
report_alive_proc(td, p, siginfo, status, options,
CLD_TRAPPED);
return (0);
-   }
+   }
if ((options & WUNTRACED) != 0 &&
(p->p_flag & P_STOPPED_SIG) != 0 &&
p->p_suspcount == p->p_numthreads &&
@@ -1293,13 +1293,13 @@ loop:
return (0);
}
PROC_LOCK(q);
-   sx_xunlock(_lock);
if (q->p_flag & P_STATCHILD) {
q->p_flag &= ~P_STATCHILD;
-   error = 0;
-   } else
-   error = msleep(q, >p_mtx, PWAIT | PCATCH, "wait", 0);
-   PROC_UNLOCK(q);
+   PROC_UNLOCK(q);
+   goto loop_locked;
+   }
+   sx_xunlock(_lock);
+   error = msleep(q, >p_mtx, PWAIT | PCATCH | PDROP, "wait", 0);
if (error)
return (error);
goto loop;
___
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: r329418 - head/stand/i386/boot2

2018-02-16 Thread Benno Rice
Author: benno
Date: Sat Feb 17 00:12:30 2018
New Revision: 329418
URL: https://svnweb.freebsd.org/changeset/base/329418

Log:
  Revert r329269.
  
  I tried to rework a section to fit inside 80 columns but the change ended
  up being functional. Back this out so I can readdress.

Modified:
  head/stand/i386/boot2/boot2.c

Modified: head/stand/i386/boot2/boot2.c
==
--- head/stand/i386/boot2/boot2.c   Fri Feb 16 23:59:50 2018
(r329417)
+++ head/stand/i386/boot2/boot2.c   Sat Feb 17 00:12:30 2018
(r329418)
@@ -72,33 +72,33 @@ extern uint32_t _end;
 
 static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */
 static const unsigned char flags[NOPT] = {
-   RBX_DUAL,
-   RBX_SERIAL,
-   RBX_ASKNAME,
-   RBX_CDROM,
-   RBX_CONFIG,
-   RBX_KDB,
-   RBX_GDB,
-   RBX_MUTE,
-   RBX_NOINTR,
-   RBX_PAUSE,
-   RBX_QUIET,
-   RBX_DFLTROOT,
-   RBX_SINGLE,
-   RBX_VERBOSE
+RBX_DUAL,
+RBX_SERIAL,
+RBX_ASKNAME,
+RBX_CDROM,
+RBX_CONFIG,
+RBX_KDB,
+RBX_GDB,
+RBX_MUTE,
+RBX_NOINTR,
+RBX_PAUSE,
+RBX_QUIET,
+RBX_DFLTROOT,
+RBX_SINGLE,
+RBX_VERBOSE
 };
 
 static const char *const dev_nm[NDEV] = {"ad", "da", "fd"};
 static const unsigned char dev_maj[NDEV] = {30, 4, 2};
 
 static struct dsk {
-   unsigned drive;
-   unsigned type;
-   unsigned unit;
-   uint8_t slice;
-   uint8_t part;
-   unsigned start;
-   int init;
+unsigned drive;
+unsigned type;
+unsigned unit;
+uint8_t slice;
+uint8_t part;
+unsigned start;
+int init;
 } dsk;
 static char cmd[512], cmddup[512], knamebuf[1024];
 static const char *kname;
@@ -126,21 +126,18 @@ static void memcpy(void *, const void *, int);
 static void
 memcpy(void *dst, const void *src, int len)
 {
-   const char *s;
-   char *d;
+const char *s = src;
+char *d = dst;
 
-   s = src;
-   d = dst;
-   while (len--)
-   *d++ = *s++;
+while (len--)
+*d++ = *s++;
 }
 
 static inline int
 strcmp(const char *s1, const char *s2)
 {
-
-   for (; *s1 == *s2 && *s1; s1++, s2++);
-   return ((unsigned char)*s1 - (unsigned char)*s2);
+for (; *s1 == *s2 && *s1; s1++, s2++);
+return (unsigned char)*s1 - (unsigned char)*s2;
 }
 
 #defineUFS_SMALL_CGBASE
@@ -149,519 +146,501 @@ strcmp(const char *s1, const char *s2)
 static int
 xfsread(ufs_ino_t inode, void *buf, size_t nbyte)
 {
-
-   if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
-   printf("Invalid %s\n", "format");
-   return (-1);
-   }
-   return (0);
+if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
+   printf("Invalid %s\n", "format");
+   return -1;
+}
+return 0;
 }
 
 static inline void
 getstr(void)
 {
-   char *s;
-   int c;
+char *s;
+int c;
 
-   s = cmd;
-   for (;;) {
-   switch (c = xgetc(0)) {
-   case 0:
-   break;
-   case '\177':
-   case '\b':
-   if (s > cmd) {
-   s--;
-   printf("\b \b");
-   }
-   break;
-   case '\n':
-   case '\r':
-   *s = 0;
-   return;
-   default:
-   if (s - cmd < sizeof(cmd) - 1)
-   *s++ = c;
-   putchar(c);
-   }
+s = cmd;
+for (;;) {
+   switch (c = xgetc(0)) {
+   case 0:
+   break;
+   case '\177':
+   case '\b':
+   if (s > cmd) {
+   s--;
+   printf("\b \b");
+   }
+   break;
+   case '\n':
+   case '\r':
+   *s = 0;
+   return;
+   default:
+   if (s - cmd < sizeof(cmd) - 1)
+   *s++ = c;
+   putchar(c);
}
+}
 }
 
 static inline void
 putc(int c)
 {
-
-   v86.addr = 0x10;
-   v86.eax = 0xe00 | (c & 0xff);
-   v86.ebx = 0x7;
-   v86int();
+v86.addr = 0x10;
+v86.eax = 0xe00 | (c & 0xff);
+v86.ebx = 0x7;
+v86int();
 }
 
 int
 main(void)
 {
-   uint8_t autoboot;
-   ufs_ino_t ino;
-   size_t nbyte;
+uint8_t autoboot;
+ufs_ino_t ino;
+size_t nbyte;
 
-   dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x1) - __base);
-   v86.ctl = V86_FLAGS;
-   v86.efl = PSL_RESERVED_DEFAULT | PSL_I;
-   dsk.drive = *(uint8_t *)PTOV(ARGS);
-   dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD;
-   dsk.unit = dsk.drive & DRV_MASK;
-   dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1;
-   bootinfo.bi_version = BOOTINFO_VERSION;
-   bootinfo.bi_size = sizeof(bootinfo);
+dmadat = (void *)(roundup2(__base + 

svn commit: r329417 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 23:59:50 2018
New Revision: 329417
URL: https://svnweb.freebsd.org/changeset/base/329417

Log:
  stand/lua: Make CAROUSEL_ENTRY func parameters consistent with name
  
  We have no need for the index yet, but add it anyways to keep signatures
  consistent.

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Fri Feb 16 23:18:42 2018(r329416)
+++ head/stand/lua/menu.lua Fri Feb 16 23:59:50 2018(r329417)
@@ -213,7 +213,7 @@ menu.welcome = {
" (" .. idx ..
" of " .. #all_choices .. ")";
end,
-   func = function(choice, all_choices)
+   func = function(idx, choice, all_choices)
if (#all_choices > 1) then
config.reload(choice);
end
@@ -302,7 +302,7 @@ function menu.run(m)
if (#choices > 0) then
caridx = (caridx % #choices) + 1;
menu.setCarouselIndex(carid, caridx);
-   sel_entry.func(choices[caridx],
+   sel_entry.func(caridx, choices[caridx],
choices);
end
elseif (sel_entry.entry_type == core.MENU_SUBMENU) then
___
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: r329416 - head/sys/x86/x86

2018-02-16 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 16 23:18:42 2018
New Revision: 329416
URL: https://svnweb.freebsd.org/changeset/base/329416

Log:
  Remove unused symbols.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Fri Feb 16 22:57:52 2018(r329415)
+++ head/sys/x86/x86/mp_x86.c   Fri Feb 16 23:18:42 2018(r329416)
@@ -75,15 +75,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#define WARMBOOT_TARGET0
-#define WARMBOOT_OFF   (KERNBASE + 0x0467)
-#define WARMBOOT_SEG   (KERNBASE + 0x0469)
-
-#define CMOS_REG   (0x70)
-#define CMOS_DATA  (0x71)
-#define BIOS_RESET (0x0f)
-#define BIOS_WARM  (0x0a)
-
 static MALLOC_DEFINE(M_CPUS, "cpus", "CPU items");
 
 /* lock region used by kernel profiling */
___
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: r329415 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 22:57:52 2018
New Revision: 329415
URL: https://svnweb.freebsd.org/changeset/base/329415

Log:
  stand/lua: Don't reload kernel config if we only have one kernel
  
  Don't move this into config.reload because we may want to force reloads if
  /boot changes out from under us later.
  
  As a caution: changing kernels in lualoader at the moment might not be
  loading all of your modules (in my testing, at least) from loader.conf(5).
  This is a known problem.

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Fri Feb 16 22:51:08 2018(r329414)
+++ head/stand/lua/menu.lua Fri Feb 16 22:57:52 2018(r329415)
@@ -213,8 +213,10 @@ menu.welcome = {
" (" .. idx ..
" of " .. #all_choices .. ")";
end,
-   func = function(choice)
-   config.reload(choice);
+   func = function(choice, all_choices)
+   if (#all_choices > 1) then
+   config.reload(choice);
+   end
end,
alias = {"k", "K"}
},
@@ -300,7 +302,8 @@ function menu.run(m)
if (#choices > 0) then
caridx = (caridx % #choices) + 1;
menu.setCarouselIndex(carid, caridx);
-   sel_entry.func(choices[caridx]);
+   sel_entry.func(choices[caridx],
+   choices);
end
elseif (sel_entry.entry_type == core.MENU_SUBMENU) then
-- recurse
___
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: r329414 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 22:51:08 2018
New Revision: 329414
URL: https://svnweb.freebsd.org/changeset/base/329414

Log:
  stand/lua: Don't try to divide by 0; do nothing

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Fri Feb 16 22:17:30 2018(r329413)
+++ head/stand/lua/menu.lua Fri Feb 16 22:51:08 2018(r329414)
@@ -297,9 +297,11 @@ function menu.run(m)
local caridx = menu.getCarouselIndex(carid);
local choices = sel_entry.items();
 
-   caridx = (caridx % #choices) + 1;
-   menu.setCarouselIndex(carid, caridx);
-   sel_entry.func(choices[caridx]);
+   if (#choices > 0) then
+   caridx = (caridx % #choices) + 1;
+   menu.setCarouselIndex(carid, caridx);
+   sel_entry.func(choices[caridx]);
+   end
elseif (sel_entry.entry_type == core.MENU_SUBMENU) then
-- recurse
cont = menu.run(sel_entry.submenu());
___
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: r329413 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 22:17:30 2018
New Revision: 329413
URL: https://svnweb.freebsd.org/changeset/base/329413

Log:
  stand/lua: Allow MENU_RETURN items to have a func, fix escape to prompt

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Fri Feb 16 21:59:08 2018(r329412)
+++ head/stand/lua/menu.lua Fri Feb 16 22:17:30 2018(r329413)
@@ -161,6 +161,9 @@ menu.welcome = {
name = function()
return color.highlight("Esc").."ape to loader prompt";
end,
+   func = function()
+   loader.setenv("autoboot_delay", "NO")
+   end,
alias = {core.KEYSTR_ESCAPE}
},
 
@@ -301,6 +304,10 @@ function menu.run(m)
-- recurse
cont = menu.run(sel_entry.submenu());
elseif (sel_entry.entry_type == core.MENU_RETURN) then
+   -- allow entry to have a function/side effect
+   if (sel_entry.func ~= nil) then
+   sel_entry.func();
+   end
-- break recurse
cont = false;
end
___
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: r329412 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-02-16 Thread Alan Somers
Author: asomers
Date: Fri Feb 16 21:59:08 2018
New Revision: 329412
URL: https://svnweb.freebsd.org/changeset/base/329412

Log:
  zfs: fix formatting in a log statement
  
  Submitted by: Dave Baukus 
  MFC after:3 weeks
  Sponsored by: Spectra Logic Corp

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 Fri Feb 
16 20:46:44 2018(r329411)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Feb 
16 21:59:08 2018(r329412)
@@ -239,7 +239,7 @@ vdev_geom_attach(struct g_provider *pp, vdev_t *vd, bo
}
error = g_access(cp, 1, 0, 1);
if (error != 0) {
-   ZFS_LOG(1, "%s(%d): g_access failed: %d", __func__,
+   ZFS_LOG(1, "%s(%d): g_access failed: %d\n", __func__,
   __LINE__, error);
vdev_geom_detach(cp, B_FALSE);
return (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: r329411 - head/usr.sbin/trpt

2018-02-16 Thread Conrad Meyer
Author: cem
Date: Fri Feb 16 20:46:44 2018
New Revision: 329411
URL: https://svnweb.freebsd.org/changeset/base/329411

Log:
  trpt(8): Clean up build hack to detect ancient compiler
  
  Detect ancient GCC specifically, rather than using target architecture as a
  crude heuristic.
  
  Side note: compilers should really ignore -Wno- and -Wno-error= flags they
  don't recognize.  Seems like modern compilers produce warnings instead of
  errors.  Though, with -Werror they turn into errors.  Clang's error can be
  disabled with -Wno-error=unknown-warning-option, but GCC doesn't seem to
  have a named method to disable the specific warning.
  
  Submitted by: rpokala@ (earlier version)
  Suggested by: rpokala@
  Reviewed by:  tinderbox
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.sbin/trpt/Makefile

Modified: head/usr.sbin/trpt/Makefile
==
--- head/usr.sbin/trpt/Makefile Fri Feb 16 20:45:32 2018(r329410)
+++ head/usr.sbin/trpt/Makefile Fri Feb 16 20:46:44 2018(r329411)
@@ -8,8 +8,7 @@ MAN=trpt.8
 BINGRP=kmem
 BINMODE= 2555
 
-.if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "amd64" && \
-${MACHINE_CPUARCH} != "i386" && ${MACHINE_CPUARCH} != "riscv"
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 5
 WARNS?=4
 .endif
 
@@ -19,8 +18,7 @@ CFLAGS+= -DINET6
 
 .include 
 
-.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
-${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "riscv"
+.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 5
 # Several included system headers tickle this warning in ways that are
 # difficult to work around in this program.
 CFLAGS+= -Wno-missing-variable-declarations
___
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: r329410 - in head: contrib/compiler-rt/lib/asan contrib/llvm/include/llvm/IR contrib/llvm/include/llvm/MC contrib/llvm/include/llvm/Support contrib/llvm/lib/CodeGen contrib/llvm/lib/Cod...

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 20:45:32 2018
New Revision: 329410
URL: https://svnweb.freebsd.org/changeset/base/329410

Log:
  Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
  6.0.0 (branches/release_60 r325330).
  
  MFC after:3 months
  X-MFC-With:   r327952
  PR:   224669

Added:
  head/contrib/llvm/include/llvm/MC/MCAsmMacro.h
 - copied unchanged from r329405, 
vendor/llvm/dist-release_60/include/llvm/MC/MCAsmMacro.h
Modified:
  head/contrib/compiler-rt/lib/asan/asan_linux.cc
  head/contrib/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
  head/contrib/llvm/include/llvm/IR/IntrinsicsX86.td
  head/contrib/llvm/include/llvm/MC/MCContext.h
  head/contrib/llvm/include/llvm/Support/GenericDomTreeConstruction.h
  head/contrib/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
  head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  head/contrib/llvm/lib/CodeGen/LivePhysRegs.cpp
  head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  head/contrib/llvm/lib/CodeGen/SplitKit.cpp
  head/contrib/llvm/lib/CodeGen/SplitKit.h
  head/contrib/llvm/lib/IR/AutoUpgrade.cpp
  head/contrib/llvm/lib/MC/MCParser/AsmParser.cpp
  head/contrib/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  head/contrib/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
  head/contrib/llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.cpp
  head/contrib/llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.h
  head/contrib/llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.td
  head/contrib/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
  head/contrib/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
  head/contrib/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
  head/contrib/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
  head/contrib/llvm/lib/Target/AMDGPU/VOP2Instructions.td
  head/contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
  head/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp
  head/contrib/llvm/lib/Target/X86/X86DomainReassignment.cpp
  head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
  head/contrib/llvm/lib/Target/X86/X86IntrinsicsInfo.h
  head/contrib/llvm/lib/Target/X86/X86RetpolineThunks.cpp
  head/contrib/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h
  head/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp
  head/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp
  head/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp
  head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp
  head/contrib/llvm/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp
  head/contrib/llvm/tools/clang/lib/Format/TokenAnnotator.cpp
  head/contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.cpp
  head/contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.h
  head/contrib/llvm/tools/clang/lib/Headers/avx512bwintrin.h
  head/contrib/llvm/tools/clang/lib/Headers/avx512fintrin.h
  head/contrib/llvm/tools/clang/lib/Lex/LiteralSupport.cpp
  head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp
  head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp
  head/contrib/llvm/tools/lld/COFF/PDB.cpp
  head/contrib/llvm/tools/lld/ELF/Driver.cpp
  head/contrib/llvm/tools/lld/ELF/InputFiles.cpp
  head/contrib/llvm/tools/lld/ELF/Options.td
  head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
  
head/contrib/llvm/tools/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  head/lib/clang/include/clang/Basic/Version.inc
  head/lib/clang/include/lld/Common/Version.inc
  head/lib/clang/include/llvm/Support/VCSRevision.h
Directory Properties:
  head/contrib/compiler-rt/   (props changed)
  head/contrib/libc++/   (props changed)
  head/contrib/llvm/   (props changed)
  head/contrib/llvm/tools/clang/   (props changed)
  head/contrib/llvm/tools/lld/   (props changed)
  head/contrib/llvm/tools/lldb/   (props changed)

Modified: head/contrib/compiler-rt/lib/asan/asan_linux.cc
==
--- head/contrib/compiler-rt/lib/asan/asan_linux.cc Fri Feb 16 20:44:50 
2018(r329409)
+++ head/contrib/compiler-rt/lib/asan/asan_linux.cc Fri Feb 16 20:45:32 
2018(r329410)
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -214,7 +215,7 @@ void AsanCheckIncompatibleRT() {
   // the functions in dynamic ASan runtime instead of the functions in
   // system libraries, causing crashes later in ASan initialization.
   MemoryMappingLayout proc_maps(/*cache_enabled*/true);
-  char filename[128];
+  char filename[PATH_MAX];
   MemoryMappedSegment segment(filename, sizeof(filename));
   while (proc_maps.Next()) {
 if (IsDynamicRTName(segment.filename)) {

Modified: head/contrib/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
==
--- head/contrib/llvm/include/llvm/IR/IntrinsicsAMDGPU.td   Fri Feb 16 
20:44:50 2018(r329409)
+++ 

svn commit: r329407 - head/tools/boot

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 20:26:18 2018
New Revision: 329407
URL: https://svnweb.freebsd.org/changeset/base/329407

Log:
  lua-test: Image the loader test directory if it doesn't exist yet

Modified:
  head/tools/boot/lua-test.sh

Modified: head/tools/boot/lua-test.sh
==
--- head/tools/boot/lua-test.sh Fri Feb 16 20:23:48 2018(r329406)
+++ head/tools/boot/lua-test.sh Fri Feb 16 20:26:18 2018(r329407)
@@ -1,19 +1,22 @@
 #!/bin/sh
 # $FreeBSD$
 
+# Will image the test directory (default /tmp/loadertest) if it doesn't exist
+
 die() {
 echo $*
 exit 1
 }
 
 dir=$1
+scriptdir=$(dirname $(realpath $0))
 cd $(make -V SRCTOP)/stand
 obj=$(make -V .OBJDIR)
 t=$obj/userboot/test/test
 u=$obj/userboot/userboot/userboot.so
 
 [ -n "$dir" ] || dir=/tmp/loadertest
-[ -d "$dir" ] || die "Directory $dir doesn't exist"
+[ -d "$dir" ] || ${scriptdir}/lua-img.sh ${dir}
 [ -f "$dir/boot/lua/loader.lua" ] || die "No boot/lua/loader.lua found"
 [ -f "$dir/boot/kernel/kernel" ] || die "No kernel to load"
 [ -x "$t" ] || die "no userboot test jig found ($t)"
___
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: r329406 - head/tools/boot

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 20:23:48 2018
New Revision: 329406
URL: https://svnweb.freebsd.org/changeset/base/329406

Log:
  Default to /tmp/loadertest for lua test scripts

Modified:
  head/tools/boot/lua-img.sh
  head/tools/boot/lua-test.sh

Modified: head/tools/boot/lua-img.sh
==
--- head/tools/boot/lua-img.sh  Fri Feb 16 19:11:00 2018(r329405)
+++ head/tools/boot/lua-img.sh  Fri Feb 16 20:23:48 2018(r329406)
@@ -2,6 +2,7 @@
 # $FreeBSD$
 
 # Quick script to build a suitable /boot dir somewhere in the tree for testing.
+# dir may be passed in, will default to /tmp/loadertest if not specified
 
 die() {
 echo $*
@@ -11,7 +12,7 @@ die() {
 dir=$1
 cd $(make -V SRCTOP)
 
-[ -n "$dir" ] || die "No directory specified"
+[ -n "$dir" ] || dir=/tmp/loadertest
 
 set -e
 

Modified: head/tools/boot/lua-test.sh
==
--- head/tools/boot/lua-test.sh Fri Feb 16 19:11:00 2018(r329405)
+++ head/tools/boot/lua-test.sh Fri Feb 16 20:23:48 2018(r329406)
@@ -12,7 +12,7 @@ obj=$(make -V .OBJDIR)
 t=$obj/userboot/test/test
 u=$obj/userboot/userboot/userboot.so
 
-[ -n "$dir" ] || die "No directory specified"
+[ -n "$dir" ] || dir=/tmp/loadertest
 [ -d "$dir" ] || die "Directory $dir doesn't exist"
 [ -f "$dir/boot/lua/loader.lua" ] || die "No boot/lua/loader.lua found"
 [ -f "$dir/boot/kernel/kernel" ] || die "No kernel to load"
___
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: r329404 - in vendor/lldb/dist-release_60/source/Plugins: Platform/NetBSD Process/NetBSD

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:57 2018
New Revision: 329404
URL: https://svnweb.freebsd.org/changeset/base/329404

Log:
  Vendor import of lldb release_60 branch r325330:
  https://llvm.org/svn/llvm-project/lldb/branches/release_60@325330

Modified:
  vendor/lldb/dist-release_60/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
  
vendor/lldb/dist-release_60/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp

Modified: 
vendor/lldb/dist-release_60/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
==
--- 
vendor/lldb/dist-release_60/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp   
Fri Feb 16 19:10:54 2018(r329403)
+++ 
vendor/lldb/dist-release_60/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp   
Fri Feb 16 19:10:57 2018(r329404)
@@ -45,20 +45,10 @@ static uint32_t g_initialize_count = 0;
 
 PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log) {
-const char *arch_name;
-if (arch && arch->GetArchitectureName())
-  arch_name = arch->GetArchitectureName();
-else
-  arch_name = "";
+  LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
+   arch ? arch->GetArchitectureName() : "",
+   arch ? arch->GetTriple().getTriple() : "");
 
-const char *triple_cstr =
-arch ? arch->GetTriple().getTriple().c_str() : "";
-
-log->Printf("PlatformNetBSD::%s(force=%s, arch={%s,%s})", __FUNCTION__,
-force ? "true" : "false", arch_name, triple_cstr);
-  }
-
   bool create = force;
   if (create == false && arch && arch->IsValid()) {
 const llvm::Triple  = arch->GetTriple();
@@ -72,18 +62,10 @@ PlatformSP PlatformNetBSD::CreateInstance(bool force, 
 }
   }
 
+  LLDB_LOG(log, "create = {0}", create);
   if (create) {
-if (log)
-  log->Printf("PlatformNetBSD::%s() creating remote-netbsd platform",
-  __FUNCTION__);
 return PlatformSP(new PlatformNetBSD(false));
   }
-
-  if (log)
-log->Printf(
-"PlatformNetBSD::%s() aborting creation of remote-netbsd platform",
-__FUNCTION__);
-
   return PlatformSP();
 }
 
@@ -258,19 +240,15 @@ bool PlatformNetBSD::CanDebugProcess() {
 }
 
 // For local debugging, NetBSD will override the debug logic to use llgs-launch
-// rather than
-// lldb-launch, llgs-attach.  This differs from current lldb-launch,
-// debugserver-attach
-// approach on MacOSX.
-lldb::ProcessSP PlatformNetBSD::DebugProcess(
-ProcessLaunchInfo _info, Debugger ,
-Target *target, // Can be NULL, if NULL create a new
-// target, else use existing one
-Status ) {
+// rather than lldb-launch, llgs-attach.  This differs from current 
lldb-launch,
+// debugserver-attach approach on MacOSX.
+lldb::ProcessSP
+PlatformNetBSD::DebugProcess(ProcessLaunchInfo _info, Debugger 
,
+ Target *target, // Can be NULL, if NULL create a 
new
+ // target, else use existing one
+ Status ) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-log->Printf("PlatformNetBSD::%s entered (target %p)", __FUNCTION__,
-static_cast(target));
+  LLDB_LOG(log, "target {0}", target);
 
   // If we're a remote host, use standard behavior from parent class.
   if (!IsHost())
@@ -293,61 +271,42 @@ lldb::ProcessSP PlatformNetBSD::DebugProcess(
 
   // Ensure we have a target.
   if (target == nullptr) {
-if (log)
-  log->Printf("PlatformNetBSD::%s creating new target", __FUNCTION__);
-
+LLDB_LOG(log, "creating new target");
 TargetSP new_target_sp;
 error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
   nullptr, new_target_sp);
 if (error.Fail()) {
-  if (log)
-log->Printf("PlatformNetBSD::%s failed to create new target: %s",
-__FUNCTION__, error.AsCString());
+  LLDB_LOG(log, "failed to create new target: {0}", error);
   return process_sp;
 }
 
 target = new_target_sp.get();
 if (!target) {
   error.SetErrorString("CreateTarget() returned nullptr");
-  if (log)
-log->Printf("PlatformNetBSD::%s failed: %s", __FUNCTION__,
-error.AsCString());
+  LLDB_LOG(log, "error: {0}", error);
   return process_sp;
 }
-  } else {
-if (log)
-  log->Printf("PlatformNetBSD::%s using provided target", __FUNCTION__);
   }
 
   // Mark target as currently selected target.
   debugger.GetTargetList().SetSelectedTarget(target);
 
   // Now create the gdb-remote process.
-  if (log)
-log->Printf(
-"PlatformNetBSD::%s having target create process with gdb-remote 
plugin",
-__FUNCTION__);
+  LLDB_LOG(log, "having target create process with gdb-remote plugin");
   process_sp = 

svn commit: r329400 - in vendor/libc++/dist-release_60: . test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area test/std/utilities/meta/meta.unary/meta.unary.prop

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:44 2018
New Revision: 329400
URL: https://svnweb.freebsd.org/changeset/base/329400

Log:
  Vendor import of libc++ release_60 branch r325330:
  https://llvm.org/svn/llvm-project/libcxx/branches/release_60@325330

Modified:
  vendor/libc++/dist-release_60/CMakeLists.txt
  
vendor/libc++/dist-release_60/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
  
vendor/libc++/dist-release_60/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp

Modified: vendor/libc++/dist-release_60/CMakeLists.txt
==
--- vendor/libc++/dist-release_60/CMakeLists.txtFri Feb 16 19:10:40 
2018(r329399)
+++ vendor/libc++/dist-release_60/CMakeLists.txtFri Feb 16 19:10:44 
2018(r329400)
@@ -135,6 +135,9 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
   elseif (APPLE)
 set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
 set(LIBCXX_CXX_ABI_SYSTEM 1)
+  elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt")
+set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
   else()
 set(LIBCXX_CXX_ABI_LIBNAME "default")
   endif()

Modified: 
vendor/libc++/dist-release_60/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
==
--- 
vendor/libc++/dist-release_60/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
  Fri Feb 16 19:10:40 2018(r329399)
+++ 
vendor/libc++/dist-release_60/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
  Fri Feb 16 19:10:44 2018(r329400)
@@ -32,12 +32,13 @@ int main()
 #ifndef TEST_HAS_NO_EXCEPTIONS
 try {
 #endif
-   std::string str(2147483648, 'a');
-   SB sb;
-   sb.str(str);
-   assert(sb.pubpbase() <= sb.pubpptr());
+std::string str(2147483648, 'a');
+SB sb;
+sb.str(str);
+assert(sb.pubpbase() <= sb.pubpptr());
 #ifndef TEST_HAS_NO_EXCEPTIONS
-   }
-   catch (const std::bad_alloc &) {}
+}
+catch (const std::length_error &) {} // maybe the string can't take 2GB
+catch (const std::bad_alloc&) {} // maybe we don't have enough RAM
 #endif
 }

Modified: 
vendor/libc++/dist-release_60/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp
==
--- 
vendor/libc++/dist-release_60/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp
 Fri Feb 16 19:10:40 2018(r329399)
+++ 
vendor/libc++/dist-release_60/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp
 Fri Feb 16 19:10:44 2018(r329400)
@@ -55,7 +55,8 @@ class NotEmpty
 virtual ~NotEmpty();
 };
 
-union Union {};
+union EmptyUnion {};
+struct NonEmptyUnion {int x; unsigned y;};
 
 struct bit_zero
 {
@@ -84,6 +85,7 @@ int main()
 {
 test_has_not_has_unique_object_representations();
 test_has_not_has_unique_object_representations();
+test_has_not_has_unique_object_representations();
 test_has_not_has_unique_object_representations();
 test_has_not_has_unique_object_representations();
 test_has_not_has_unique_object_representations();
@@ -97,7 +99,7 @@ int main()
 
 
 test_has_unique_object_representations();
-test_has_unique_object_representations();
+test_has_unique_object_representations();
 test_has_unique_object_representations();
 test_has_unique_object_representations();
 
___
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: r329401 - vendor/libc++/libc++-release_60-r325330

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:47 2018
New Revision: 329401
URL: https://svnweb.freebsd.org/changeset/base/329401

Log:
  Tag libc++ release_60 branch r325330.

Added:
  vendor/libc++/libc++-release_60-r325330/
 - copied from r329400, vendor/libc++/dist-release_60/
___
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: r329405 - vendor/lldb/lldb-release_60-r325330

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:11:00 2018
New Revision: 329405
URL: https://svnweb.freebsd.org/changeset/base/329405

Log:
  Tag lldb release_60 branch r325330.

Added:
  vendor/lldb/lldb-release_60-r325330/
 - copied from r329404, vendor/lldb/dist-release_60/
___
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: r329403 - vendor/lld/lld-release_60-r325330

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:54 2018
New Revision: 329403
URL: https://svnweb.freebsd.org/changeset/base/329403

Log:
  Tag lld release_60 branch r325330.

Added:
  vendor/lld/lld-release_60-r325330/
 - copied from r329402, vendor/lld/dist-release_60/
___
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: r329396 - in vendor/clang/dist-release_60: docs include/clang/AST lib/AST lib/CodeGen lib/Format lib/Headers lib/Lex lib/Sema test/CodeGen test/CodeGenCXX test/Lexer test/Sema test/Sema...

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:26 2018
New Revision: 329396
URL: https://svnweb.freebsd.org/changeset/base/329396

Log:
  Vendor import of clang release_60 branch r325330:
  https://llvm.org/svn/llvm-project/cfe/branches/release_60@325330

Added:
  vendor/clang/dist-release_60/test/CodeGenCXX/dllimport-missing-key.cpp   
(contents, props changed)
  vendor/clang/dist-release_60/test/CodeGenCXX/microsoft-abi-emit-dependent.cpp 
  (contents, props changed)
  vendor/clang/dist-release_60/test/CodeGenCXX/msabi-swiftcall-cc.cpp   
(contents, props changed)
  vendor/clang/dist-release_60/test/Sema/cxx-as-c.c   (contents, props changed)
Modified:
  vendor/clang/dist-release_60/docs/ReleaseNotes.rst
  vendor/clang/dist-release_60/include/clang/AST/DeclBase.h
  vendor/clang/dist-release_60/lib/AST/ASTContext.cpp
  vendor/clang/dist-release_60/lib/AST/DeclBase.cpp
  vendor/clang/dist-release_60/lib/AST/MicrosoftMangle.cpp
  vendor/clang/dist-release_60/lib/CodeGen/CodeGenModule.cpp
  vendor/clang/dist-release_60/lib/CodeGen/ItaniumCXXABI.cpp
  vendor/clang/dist-release_60/lib/CodeGen/TargetInfo.cpp
  vendor/clang/dist-release_60/lib/Format/TokenAnnotator.cpp
  vendor/clang/dist-release_60/lib/Format/UnwrappedLineParser.cpp
  vendor/clang/dist-release_60/lib/Format/UnwrappedLineParser.h
  vendor/clang/dist-release_60/lib/Headers/avx512bwintrin.h
  vendor/clang/dist-release_60/lib/Headers/avx512fintrin.h
  vendor/clang/dist-release_60/lib/Lex/LiteralSupport.cpp
  vendor/clang/dist-release_60/lib/Sema/SemaChecking.cpp
  vendor/clang/dist-release_60/lib/Sema/SemaDecl.cpp
  vendor/clang/dist-release_60/lib/Sema/SemaInit.cpp
  vendor/clang/dist-release_60/test/CodeGen/avx512bw-builtins.c
  vendor/clang/dist-release_60/test/CodeGen/avx512f-builtins.c
  vendor/clang/dist-release_60/test/CodeGen/ms_abi.c
  vendor/clang/dist-release_60/test/CodeGenCXX/dllimport-rtti.cpp
  vendor/clang/dist-release_60/test/Lexer/cxx1y_digit_separators.cpp
  vendor/clang/dist-release_60/test/Sema/bitfield.c
  vendor/clang/dist-release_60/test/Sema/compare.c
  vendor/clang/dist-release_60/test/SemaCXX/init-expr-crash.cpp
  vendor/clang/dist-release_60/test/SemaCXX/type-traits.cpp
  vendor/clang/dist-release_60/test/SemaTemplate/instantiate-init.cpp
  vendor/clang/dist-release_60/unittests/Format/FormatTest.cpp

Modified: vendor/clang/dist-release_60/docs/ReleaseNotes.rst
==
--- vendor/clang/dist-release_60/docs/ReleaseNotes.rst  Fri Feb 16 19:10:22 
2018(r329395)
+++ vendor/clang/dist-release_60/docs/ReleaseNotes.rst  Fri Feb 16 19:10:26 
2018(r329396)
@@ -132,6 +132,11 @@ New Compiler Flags
   difference between the ``-std=c17`` and ``-std=c11`` language modes is the
   value of the ``__STDC_VERSION__`` macro, as C17 is a bug fix release.
 
+- Added the ``-fexperimental-isel`` and ``-fno-experimental-isel`` flags to
+  enable/disable the new GlobalISel instruction selection framework. This
+  feature is enabled by default for AArch64 at the ``-O0`` optimization level.
+  Support for other targets or optimization levels is currently incomplete.
+
 Deprecated Compiler Flags
 -
 

Modified: vendor/clang/dist-release_60/include/clang/AST/DeclBase.h
==
--- vendor/clang/dist-release_60/include/clang/AST/DeclBase.h   Fri Feb 16 
19:10:22 2018(r329395)
+++ vendor/clang/dist-release_60/include/clang/AST/DeclBase.h   Fri Feb 16 
19:10:26 2018(r329396)
@@ -836,6 +836,10 @@ class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) Decl { (pu
 
   void setLexicalDeclContext(DeclContext *DC);
 
+  /// Determine whether this declaration is a templated entity (whether it is
+  // within the scope of a template parameter).
+  bool isTemplated() const;
+
   /// isDefinedOutsideFunctionOrMethod - This predicate returns true if this
   /// scoped decl is defined outside the current function or method.  This is
   /// roughly global variables and functions, but also handles enums (which

Modified: vendor/clang/dist-release_60/lib/AST/ASTContext.cpp
==
--- vendor/clang/dist-release_60/lib/AST/ASTContext.cpp Fri Feb 16 19:10:22 
2018(r329395)
+++ vendor/clang/dist-release_60/lib/AST/ASTContext.cpp Fri Feb 16 19:10:26 
2018(r329396)
@@ -2145,7 +2145,7 @@ static bool unionHasUniqueObjectRepresentations(const 
 if (FieldSize != UnionSize)
   return false;
   }
-  return true;
+  return !RD->field_empty();
 }
 
 static bool isStructEmpty(QualType Ty) {

Modified: vendor/clang/dist-release_60/lib/AST/DeclBase.cpp
==
--- vendor/clang/dist-release_60/lib/AST/DeclBase.cpp   Fri Feb 16 19:10:22 
2018(r329395)
+++ vendor/clang/dist-release_60/lib/AST/DeclBase.cpp   Fri Feb 16 19:10:26 
2018

svn commit: r329399 - vendor/compiler-rt/compiler-rt-release_60-r325330

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:40 2018
New Revision: 329399
URL: https://svnweb.freebsd.org/changeset/base/329399

Log:
  Tag compiler-rt release_60 branch r325330.

Added:
  vendor/compiler-rt/compiler-rt-release_60-r325330/
 - copied from r329398, vendor/compiler-rt/dist-release_60/
___
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: r329402 - in vendor/lld/dist-release_60: COFF ELF test/COFF test/ELF test/ELF/Inputs

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:49 2018
New Revision: 329402
URL: https://svnweb.freebsd.org/changeset/base/329402

Log:
  Vendor import of lld release_60 branch r325330:
  https://llvm.org/svn/llvm-project/lld/branches/release_60@325330

Added:
  vendor/lld/dist-release_60/test/ELF/Inputs/mips-gp-dips-corrupt-ver.s   
(contents, props changed)
  vendor/lld/dist-release_60/test/ELF/Inputs/mips-gp-dips-corrupt-ver.so   
(contents, props changed)
  vendor/lld/dist-release_60/test/ELF/mips-gp-disp-ver.s   (contents, props 
changed)
Modified:
  vendor/lld/dist-release_60/COFF/PDB.cpp
  vendor/lld/dist-release_60/ELF/Driver.cpp
  vendor/lld/dist-release_60/ELF/InputFiles.cpp
  vendor/lld/dist-release_60/ELF/Options.td
  vendor/lld/dist-release_60/test/COFF/pdb-type-server-missing.yaml
  vendor/lld/dist-release_60/test/ELF/pie.s

Modified: vendor/lld/dist-release_60/COFF/PDB.cpp
==
--- vendor/lld/dist-release_60/COFF/PDB.cpp Fri Feb 16 19:10:47 2018
(r329401)
+++ vendor/lld/dist-release_60/COFF/PDB.cpp Fri Feb 16 19:10:49 2018
(r329402)
@@ -96,10 +96,11 @@ class PDBLinker { (public)
   /// If the object does not use a type server PDB (compiled with /Z7), we 
merge
   /// all the type and item records from the .debug$S stream and fill in the
   /// caller-provided ObjectIndexMap.
-  const CVIndexMap (ObjFile *File, CVIndexMap );
+  Expected mergeDebugT(ObjFile *File,
+  CVIndexMap );
 
-  const CVIndexMap (ObjFile *File,
-TypeServer2Record );
+  Expected maybeMergeTypeServerPDB(ObjFile *File,
+  TypeServer2Record );
 
   /// Add the section map and section contributions to the PDB.
   void addSections(ArrayRef OutputSections,
@@ -140,6 +141,10 @@ class PDBLinker { (public)
 
   /// Type index mappings of type server PDBs that we've loaded so far.
   std::map TypeServerIndexMappings;
+
+  /// List of TypeServer PDBs which cannot be loaded.
+  /// Cached to prevent repeated load attempts.
+  std::set MissingTypeServerPDBs;
 };
 }
 
@@ -230,8 +235,8 @@ maybeReadTypeServerRecord(CVTypeArray ) {
   return std::move(TS);
 }
 
-const CVIndexMap ::mergeDebugT(ObjFile *File,
- CVIndexMap ) {
+Expected PDBLinker::mergeDebugT(ObjFile *File,
+   CVIndexMap ) 
{
   ArrayRef Data = getDebugSection(File, ".debug$T");
   if (Data.empty())
 return ObjectIndexMap;
@@ -304,11 +309,19 @@ tryToLoadPDB(const GUID , StringRef TSPath
   return std::move(NS);
 }
 
-const CVIndexMap ::maybeMergeTypeServerPDB(ObjFile *File,
- TypeServer2Record ) {
-  // First, check if we already loaded a PDB with this GUID. Return the type
+Expected PDBLinker::maybeMergeTypeServerPDB(ObjFile *File,
+   
TypeServer2Record ) {
+  const GUID& TSId = TS.getGuid();
+  StringRef TSPath = TS.getName();
+
+  // First, check if the PDB has previously failed to load.
+  if (MissingTypeServerPDBs.count(TSId))
+return make_error(
+  pdb::generic_error_code::type_server_not_found, TSPath);
+
+  // Second, check if we already loaded a PDB with this GUID. Return the type
   // index mapping if we have it.
-  auto Insertion = TypeServerIndexMappings.insert({TS.getGuid(), 
CVIndexMap()});
+  auto Insertion = TypeServerIndexMappings.insert({TSId, CVIndexMap()});
   CVIndexMap  = Insertion.first->second;
   if (!Insertion.second)
 return IndexMap;
@@ -319,18 +332,21 @@ const CVIndexMap ::maybeMergeTypeServerPDB(O
   // Check for a PDB at:
   // 1. The given file path
   // 2. Next to the object file or archive file
-  auto ExpectedSession = tryToLoadPDB(TS.getGuid(), TS.getName());
+  auto ExpectedSession = tryToLoadPDB(TSId, TSPath);
   if (!ExpectedSession) {
 consumeError(ExpectedSession.takeError());
 StringRef LocalPath =
 !File->ParentName.empty() ? File->ParentName : File->getName();
 SmallString<128> Path = sys::path::parent_path(LocalPath);
 sys::path::append(
-Path, sys::path::filename(TS.getName(), sys::path::Style::windows));
-ExpectedSession = tryToLoadPDB(TS.getGuid(), Path);
+Path, sys::path::filename(TSPath, sys::path::Style::windows));
+ExpectedSession = tryToLoadPDB(TSId, Path);
   }
-  if (auto E = ExpectedSession.takeError())
-fatal("Type server PDB was not found: " + toString(std::move(E)));
+  if (auto E = ExpectedSession.takeError()) {
+TypeServerIndexMappings.erase(TSId);
+MissingTypeServerPDBs.emplace(TSId);
+return std::move(E);
+  }
 
   auto ExpectedTpi = (*ExpectedSession)->getPDBFile().getPDBTpiStream();
   if (auto E = ExpectedTpi.takeError())
@@ -707,7 +723,16 @@ void PDBLinker::addObjFile(ObjFile *File) {
   // 

svn commit: r329395 - vendor/llvm/llvm-release_60-r325330

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:22 2018
New Revision: 329395
URL: https://svnweb.freebsd.org/changeset/base/329395

Log:
  Tag llvm release_60 branch r325330.

Added:
  vendor/llvm/llvm-release_60-r325330/
 - copied from r329394, vendor/llvm/dist-release_60/
___
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: r329397 - vendor/clang/clang-release_60-r325330

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:34 2018
New Revision: 329397
URL: https://svnweb.freebsd.org/changeset/base/329397

Log:
  Tag clang release_60 branch r325330.

Added:
  vendor/clang/clang-release_60-r325330/
 - copied from r329396, vendor/clang/dist-release_60/
___
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: r329398 - vendor/compiler-rt/dist-release_60/lib/asan

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:37 2018
New Revision: 329398
URL: https://svnweb.freebsd.org/changeset/base/329398

Log:
  Vendor import of compiler-rt release_60 branch r325330:
  https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@325330

Modified:
  vendor/compiler-rt/dist-release_60/lib/asan/asan_linux.cc

Modified: vendor/compiler-rt/dist-release_60/lib/asan/asan_linux.cc
==
--- vendor/compiler-rt/dist-release_60/lib/asan/asan_linux.cc   Fri Feb 16 
19:10:34 2018(r329397)
+++ vendor/compiler-rt/dist-release_60/lib/asan/asan_linux.cc   Fri Feb 16 
19:10:37 2018(r329398)
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -214,7 +215,7 @@ void AsanCheckIncompatibleRT() {
   // the functions in dynamic ASan runtime instead of the functions in
   // system libraries, causing crashes later in ASan initialization.
   MemoryMappingLayout proc_maps(/*cache_enabled*/true);
-  char filename[128];
+  char filename[PATH_MAX];
   MemoryMappedSegment segment(filename, sizeof(filename));
   while (proc_maps.Next()) {
 if (IsDynamicRTName(segment.filename)) {
___
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: r329394 - in vendor/llvm/dist-release_60: docs include/llvm/IR include/llvm/MC include/llvm/Support lib/CodeGen lib/CodeGen/AsmPrinter lib/CodeGen/SelectionDAG lib/IR lib/MC/MCParser li...

2018-02-16 Thread Dimitry Andric
Author: dim
Date: Fri Feb 16 19:10:15 2018
New Revision: 329394
URL: https://svnweb.freebsd.org/changeset/base/329394

Log:
  Vendor import of llvm release_60 branch r325330:
  https://llvm.org/svn/llvm-project/llvm/branches/release_60@325330

Added:
  vendor/llvm/dist-release_60/include/llvm/MC/MCAsmMacro.h   (contents, props 
changed)
  vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pk.i16.ll
  vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pk.u16.ll
  vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pknorm.i16.ll
  vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pknorm.u16.ll
  vendor/llvm/dist-release_60/test/CodeGen/ARM/splitkit.ll
  vendor/llvm/dist-release_60/test/CodeGen/Thumb/stm-scavenging.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/inline-asm-modifier-V.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/pr36199.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/retpoline-regparm.ll
  vendor/llvm/dist-release_60/test/DebugInfo/X86/void-typedef.ll
  vendor/llvm/dist-release_60/test/MC/AsmParser/inline_macro_duplication.ll
Modified:
  vendor/llvm/dist-release_60/docs/ReleaseNotes.rst
  vendor/llvm/dist-release_60/include/llvm/IR/IntrinsicsAMDGPU.td
  vendor/llvm/dist-release_60/include/llvm/IR/IntrinsicsX86.td
  vendor/llvm/dist-release_60/include/llvm/MC/MCContext.h
  vendor/llvm/dist-release_60/include/llvm/Support/GenericDomTreeConstruction.h
  vendor/llvm/dist-release_60/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
  vendor/llvm/dist-release_60/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  vendor/llvm/dist-release_60/lib/CodeGen/LivePhysRegs.cpp
  vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  vendor/llvm/dist-release_60/lib/CodeGen/SplitKit.cpp
  vendor/llvm/dist-release_60/lib/CodeGen/SplitKit.h
  vendor/llvm/dist-release_60/lib/IR/AutoUpgrade.cpp
  vendor/llvm/dist-release_60/lib/MC/MCParser/AsmParser.cpp
  vendor/llvm/dist-release_60/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  vendor/llvm/dist-release_60/lib/Target/AMDGPU/AMDGPUISelLowering.h
  vendor/llvm/dist-release_60/lib/Target/AMDGPU/AMDGPUInstrInfo.cpp
  vendor/llvm/dist-release_60/lib/Target/AMDGPU/AMDGPUInstrInfo.h
  vendor/llvm/dist-release_60/lib/Target/AMDGPU/AMDGPUInstrInfo.td
  vendor/llvm/dist-release_60/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
  vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIISelLowering.cpp
  vendor/llvm/dist-release_60/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
  vendor/llvm/dist-release_60/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
  vendor/llvm/dist-release_60/lib/Target/AMDGPU/VOP2Instructions.td
  vendor/llvm/dist-release_60/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
  vendor/llvm/dist-release_60/lib/Target/X86/X86AsmPrinter.cpp
  vendor/llvm/dist-release_60/lib/Target/X86/X86DomainReassignment.cpp
  vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.cpp
  vendor/llvm/dist-release_60/lib/Target/X86/X86IntrinsicsInfo.h
  vendor/llvm/dist-release_60/lib/Target/X86/X86RetpolineThunks.cpp
  vendor/llvm/dist-release_60/lib/Transforms/InstCombine/InstCombineCalls.cpp
  vendor/llvm/dist-release_60/test/CodeGen/ARM/pr25838.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/avx512-intrinsics-fast-isel.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/avx512-intrinsics-upgrade.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/avx512-intrinsics.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/avx512-mask-op.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/avx512bw-intrinsics-fast-isel.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/avx512bw-intrinsics-upgrade.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/avx512bw-intrinsics.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/domain-reassignment.mir
  vendor/llvm/dist-release_60/test/CodeGen/X86/retpoline-external.ll
  vendor/llvm/dist-release_60/test/CodeGen/X86/retpoline.ll
  vendor/llvm/dist-release_60/test/MC/X86/x86-64.s
  
vendor/llvm/dist-release_60/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll

Modified: vendor/llvm/dist-release_60/docs/ReleaseNotes.rst
==
--- vendor/llvm/dist-release_60/docs/ReleaseNotes.rst   Fri Feb 16 18:50:06 
2018(r329393)
+++ vendor/llvm/dist-release_60/docs/ReleaseNotes.rst   Fri Feb 16 19:10:15 
2018(r329394)
@@ -71,6 +71,13 @@ Non-comprehensive list of changes in this release
 Changes to the LLVM IR
 --
 
+Changes to the AArch64 Target
+-
+
+During this release:
+
+ * Enabled the new GlobalISel instruction selection framework by default at 
``-O0``.
+
 Changes to the ARM Target
 -
 
@@ -80,6 +87,28 @@ During this release the ARM target has:
   isn't the default.
 
 
+Changes to the Hexagon Target
+-
+
+* The Hexagon backend now supports V65 ISA.
+
+* The ``-mhvx`` option now takes an optional value that specified the ISA
+  

svn commit: r329393 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 18:50:06 2018
New Revision: 329393
URL: https://svnweb.freebsd.org/changeset/base/329393

Log:
  stand/lua: Use escaped dot instead of single character class

Modified:
  head/stand/lua/screen.lua

Modified: head/stand/lua/screen.lua
==
--- head/stand/lua/screen.lua   Fri Feb 16 18:49:50 2018(r329392)
+++ head/stand/lua/screen.lua   Fri Feb 16 18:50:06 2018(r329393)
@@ -34,7 +34,7 @@ local core = require("core");
 -- XXX TODO: This should be fixed in the interpreter to not print decimals
 function intstring(num)
local str = tostring(num)
-   local decimal = string.find(str, "[.]")
+   local decimal = string.find(str, "%.")
 
if decimal then
return string.sub(str, 1, decimal - 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: r329392 - stable/11/usr.sbin/mountd

2018-02-16 Thread Brad Davis
Author: brd (doc,ports committer)
Date: Fri Feb 16 18:49:50 2018
New Revision: 329392
URL: https://svnweb.freebsd.org/changeset/base/329392

Log:
  MFC r329009
  
  mountd(8): Produce vaguely meaningful error messages
  
  Approved by:  cem, will

Modified:
  stable/11/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/mountd/mountd.c
==
--- stable/11/usr.sbin/mountd/mountd.c  Fri Feb 16 18:23:27 2018
(r329391)
+++ stable/11/usr.sbin/mountd/mountd.c  Fri Feb 16 18:49:50 2018
(r329392)
@@ -199,7 +199,7 @@ static struct hostlist *get_ht(void);
 static int get_line(void);
 static voidget_mountlist(void);
 static int get_net(char *, struct netmsk *, int);
-static voidgetexp_err(struct exportlist *, struct grouplist *);
+static voidgetexp_err(struct exportlist *, struct grouplist *, const char 
*);
 static struct grouplist*get_grp(void);
 static voidhang_dirp(struct dirlist *, struct grouplist *,
struct exportlist *, int);
@@ -1448,12 +1448,13 @@ get_exportlist_one(void)
tgrp = grp = get_grp();
while (len > 0) {
if (len > MNTNAMLEN) {
-   getexp_err(ep, tgrp);
+   getexp_err(ep, tgrp, "mountpoint too long");
goto nextline;
}
if (*cp == '-') {
if (ep == (struct exportlist *)NULL) {
-   getexp_err(ep, tgrp);
+   getexp_err(ep, tgrp,
+   "flag before export path definition");
goto nextline;
}
if (debug)
@@ -1461,7 +1462,7 @@ get_exportlist_one(void)
got_nondir = 1;
if (do_opt(, , ep, grp, _host,
, )) {
-   getexp_err(ep, tgrp);
+   getexp_err(ep, tgrp, NULL);
goto nextline;
}
} else if (*cp == '/') {
@@ -1469,8 +1470,7 @@ get_exportlist_one(void)
*endcp = '\0';
if (v4root_phase > 1) {
if (dirp != NULL) {
-   syslog(LOG_ERR, "Multiple V4 dirs");
-   getexp_err(ep, tgrp);
+   getexp_err(ep, tgrp, "Multiple V4 
dirs");
goto nextline;
}
}
@@ -1480,14 +1480,12 @@ get_exportlist_one(void)
syslog(LOG_ERR, "Warning: exporting of "
"automounted fs %s not supported", cp);
if (got_nondir) {
-   syslog(LOG_ERR, "dirs must be first");
-   getexp_err(ep, tgrp);
+   getexp_err(ep, tgrp, "dirs must be first");
goto nextline;
}
if (v4root_phase == 1) {
if (dirp != NULL) {
-   syslog(LOG_ERR, "Multiple V4 dirs");
-   getexp_err(ep, tgrp);
+   getexp_err(ep, tgrp, "Multiple V4 
dirs");
goto nextline;
}
if (strlen(v4root_dirpath) == 0) {
@@ -1497,7 +1495,7 @@ get_exportlist_one(void)
!= 0) {
syslog(LOG_ERR,
"different V4 dirpath %s", cp);
-   getexp_err(ep, tgrp);
+   getexp_err(ep, tgrp, NULL);
goto nextline;
}
dirp = cp;
@@ -1510,7 +1508,8 @@ get_exportlist_one(void)
fsb.f_fsid.val[0] ||
ep->ex_fs.val[1] !=
fsb.f_fsid.val[1]) {
-   getexp_err(ep, tgrp);
+   getexp_err(ep, tgrp,
+   "fsid mismatch");
goto nextline;
}

Re: svn commit: r329269 - head/stand/i386/boot2

2018-02-16 Thread John Baldwin
On Friday, February 16, 2018 11:44:45 AM Mark Johnston wrote:
> On Wed, Feb 14, 2018 at 06:07:27PM +, Benno Rice wrote:
> > Author: benno
> > Date: Wed Feb 14 18:07:27 2018
> > New Revision: 329269
> > URL: https://svnweb.freebsd.org/changeset/base/329269
> > 
> > Log:
> >   Reformat to come significantly closer to style(9).
> >   
> >   Reviewed by:  imp, jhibbits
> >   Differential Revision:https://reviews.freebsd.org/D14366
> > 
> > Modified:
> >   head/stand/i386/boot2/boot2.c
> > 
> > Modified: head/stand/i386/boot2/boot2.c
> > ==
> > --- head/stand/i386/boot2/boot2.c   Wed Feb 14 18:05:37 2018
> > (r329268)
> > +++ head/stand/i386/boot2/boot2.c   Wed Feb 14 18:07:27 2018
> > (r329269)
> > [...]
> >  #if SERIAL
> > -   } else if (c == 'S') {
> > -   j = 0;
> > -   while ((unsigned int)(i = *arg++ - '0') <= 9)
> > -   j = j * 10 + i;
> > -   if (j > 0 && i == -'0') {
> > -   comspeed = j;
> > -   break;
> > -   }
> > -   /* Fall through to error below ('S' not in optstr[]). */
> > +   } else if (c == 'S') {
> > +   j = 0;
> > +   while (*arg <= '9') {
> > +   i = (unsigned int)(*arg - '0');
> > +   j = j * 10 + i;
> > +   arg++;
> > +   }
> > +   if (j > 0 && i == -'0') {
> > +   comspeed = j;
> > +   break;
> > +   }
> 
> The gcc build is failing now with a claim that "i" may be used
> uninitialized in the if-statement above. It looks like a bogus error
> though.

If this commit mixed functional changes with the reindent it needs to be
reverted and the reindent needs to be re-committed as a separate commit.

The functional changes (if intended) should then be a separate commit once
they are tested.

-- 
John Baldwin
___
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: r329391 - stable/11/sys/dev/cxgbe/iw_cxgbe

2018-02-16 Thread Navdeep Parhar
Author: np
Date: Fri Feb 16 18:23:27 2018
New Revision: 329391
URL: https://svnweb.freebsd.org/changeset/base/329391

Log:
  iw_cxgbe:  Follow-up fix to r329017, which updated the code associated
  with QP flush.
  
  This is a direct commit to stable/11.
  
  Sponsored by: Chelsio Communications

Modified:
  stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c

Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c
==
--- stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c   Fri Feb 16 18:07:04 2018
(r329390)
+++ stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c   Fri Feb 16 18:23:27 2018
(r329391)
@@ -1036,7 +1036,8 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4i
/* locking heirarchy: cq lock first, then qp lock. */
spin_lock_irqsave(>lock, flag);
spin_lock(>lock);
-   c4iw_flush_hw_cq(schp);
+   if (schp != rchp)
+   c4iw_flush_hw_cq(schp);
flushed = c4iw_flush_sq(qhp);
spin_unlock(>lock);
spin_unlock_irqrestore(>lock, flag);
___
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: r329390 - head/usr.bin/ipcs

2018-02-16 Thread Li-Wen Hsu
Author: lwhsu (ports committer)
Date: Fri Feb 16 18:07:04 2018
New Revision: 329390
URL: https://svnweb.freebsd.org/changeset/base/329390

Log:
  Follow r329348 in ipcs for getting rid of the requirement to include SysV IPC
  headers with _KERNEL
  
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D14398

Modified:
  head/usr.bin/ipcs/ipc.c
  head/usr.bin/ipcs/ipcs.c

Modified: head/usr.bin/ipcs/ipc.c
==
--- head/usr.bin/ipcs/ipc.c Fri Feb 16 18:04:27 2018(r329389)
+++ head/usr.bin/ipcs/ipc.c Fri Feb 16 18:07:04 2018(r329390)
@@ -35,11 +35,12 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#define _KERNEL
+#define_WANT_SYSVMSG_INTERNALS
+#include 
+#define_WANT_SYSVSEM_INTERNALS
 #include 
+#define_WANT_SYSVSHM_INTERNALS
 #include 
-#include 
-#undef _KERNEL
 
 #include 
 #include 

Modified: head/usr.bin/ipcs/ipcs.c
==
--- head/usr.bin/ipcs/ipcs.cFri Feb 16 18:04:27 2018(r329389)
+++ head/usr.bin/ipcs/ipcs.cFri Feb 16 18:07:04 2018(r329390)
@@ -32,11 +32,12 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#define _KERNEL
+#define_WANT_SYSVMSG_INTERNALS
+#include 
+#define_WANT_SYSVSEM_INTERNALS
 #include 
+#define_WANT_SYSVSHM_INTERNALS
 #include 
-#include 
-#undef _KERNEL
 
 #include 
 #include 
___
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: r329389 - head/sys/x86/xen

2018-02-16 Thread Roger Pau Monné
Author: royger
Date: Fri Feb 16 18:04:27 2018
New Revision: 329389
URL: https://svnweb.freebsd.org/changeset/base/329389

Log:
  xen/pv: remove the attach of the ISA bus from the Xen PV bus
  
  There's no need to attach the ISA bus from the Xen PV one.
  
  Sponsored by:   Citrix Systems R

Modified:
  head/sys/x86/xen/xenpv.c

Modified: head/sys/x86/xen/xenpv.c
==
--- head/sys/x86/xen/xenpv.cFri Feb 16 17:50:06 2018(r329388)
+++ head/sys/x86/xen/xenpv.cFri Feb 16 18:04:27 2018(r329389)
@@ -93,24 +93,20 @@ xenpv_probe(device_t dev)
 static int
 xenpv_attach(device_t dev)
 {
-   device_t child;
+   int error;
 
/*
 * Let our child drivers identify any child devices that they
 * can find.  Once that is done attach any devices that we
 * found.
 */
-   bus_generic_probe(dev);
-   bus_generic_attach(dev);
+   error = bus_generic_probe(dev);
+   if (error)
+   return (error);
 
-   if (!devclass_get_device(devclass_find("isa"), 0)) {
-   child = BUS_ADD_CHILD(dev, 0, "isa", 0);
-   if (child == NULL)
-   panic("Failed to attach ISA bus.");
-   device_probe_and_attach(child);
-   }
+   error = bus_generic_attach(dev);
 
-   return (0);
+   return (error);
 }
 
 static struct resource *
___
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: r329388 - head/sys/contrib/ck/include

2018-02-16 Thread Olivier Houchard
Author: cognet
Date: Fri Feb 16 17:50:06 2018
New Revision: 329388
URL: https://svnweb.freebsd.org/changeset/base/329388

Log:
  Define CK_MD_TSO for the relevant arches (i386, amd64 and sparc64).
  Defaulting to CK_MD_RMO has the unfortunate side effect of generating
  memory barriers that are useless on those arches, and the even more
  unfortunate side effect of generating lfence/sfence/mfence on i386, even
  if older CPUs don't support it.
  This should fix the panic reported when using IPFW on a Pentium 3.
  Note that mfence and sfence might still be used in a few case, but that
  shouldn't happen in FreeBSD right now, and should be fixed upstream first.
  
  MFC after:1 week

Modified:
  head/sys/contrib/ck/include/ck_md.h

Modified: head/sys/contrib/ck/include/ck_md.h
==
--- head/sys/contrib/ck/include/ck_md.h Fri Feb 16 17:46:07 2018
(r329387)
+++ head/sys/contrib/ck/include/ck_md.h Fri Feb 16 17:50:06 2018
(r329388)
@@ -53,10 +53,6 @@
 #define CK_PR_DISABLE_DOUBLE
 #endif /* CK_PR_DISABLE_DOUBLE */
 
-#ifndef CK_MD_RMO
-#define CK_MD_RMO
-#endif /* CK_MD_RMO */
-
 #define CK_VERSION "0.6.0"
 #define CK_GIT_SHA ""
 
@@ -65,11 +61,20 @@
  */
 #if defined(__i386__) && !defined(__x86__)
 #define __x86__
+#define CK_MD_TSO
+#elif defined(__amd64__)
+#define CK_MD_TSO
 #elif defined(__sparc64__) && !defined(__sparcv9__)
 #define __sparcv9__
+#define CK_MD_TSO
 #elif defined(__powerpc64__) && !defined(__ppc64__)
 #define __ppc64__
 #elif defined(__powerpc__) && !defined(__ppc__)
 #define __ppc__
 #endif
+
+#if !defined(CK_MD_RMO) && !defined(CK_MD_TSO) && !defined(CK_MD_PSO)
+#define CK_MD_RMO
+#endif
+
 #endif /* CK_MD_H */
___
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: r329387 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 17:46:07 2018
New Revision: 329387
URL: https://svnweb.freebsd.org/changeset/base/329387

Log:
  stand/lua: Chop off the decimal for numbers passed to setcursor
  
  Decimals screw up the escape sequence and the cursor will not get set. Right
  now this only affects setting the cursor for drawing "Welcome to FreeBSD" --
  the resulting number after our (x+(w/2)-9) calculation gets output as
  "14.0."
  
  This should be fixed at the interpreter level, rather than here, but this is
  not a widespread problem at the moment so we'll fix it up in further work.
  
  Reported by:  David Wolfskill 
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D14375

Modified:
  head/stand/lua/screen.lua

Modified: head/stand/lua/screen.lua
==
--- head/stand/lua/screen.lua   Fri Feb 16 17:42:38 2018(r329386)
+++ head/stand/lua/screen.lua   Fri Feb 16 17:46:07 2018(r329387)
@@ -31,6 +31,17 @@ local screen = {};
 local color = require("color");
 local core = require("core");
 
+-- XXX TODO: This should be fixed in the interpreter to not print decimals
+function intstring(num)
+   local str = tostring(num)
+   local decimal = string.find(str, "[.]")
+
+   if decimal then
+   return string.sub(str, 1, decimal - 1)
+   end
+   return str
+end
+
 function screen.clear()
if core.bootserial() then
return;
@@ -42,7 +53,8 @@ function screen.setcursor(x, y)
if core.bootserial() then
return;
end
-   loader.printc("\027["..y..";"..x.."H");
+
+   loader.printc("\027["..intstring(y)..";"..intstring(x).."H");
 end
 
 function screen.setforeground(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: r329386 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 17:42:38 2018
New Revision: 329386
URL: https://svnweb.freebsd.org/changeset/base/329386

Log:
  stand/lua: Correct usage and acceptance of BACKSPACE/DELETE keys

Modified:
  head/stand/lua/core.lua
  head/stand/lua/menu.lua
  head/stand/lua/password.lua

Modified: head/stand/lua/core.lua
==
--- head/stand/lua/core.lua Fri Feb 16 17:08:42 2018(r329385)
+++ head/stand/lua/core.lua Fri Feb 16 17:42:38 2018(r329386)
@@ -29,8 +29,9 @@
 local core = {};
 
 -- Commonly appearing constants
+core.KEY_BACKSPACE = 8;
 core.KEY_ENTER = 13;
-core.KEY_BACKSPACE = 127;
+core.KEY_DELETE= 127;
 
 core.KEYSTR_ESCAPE = "\027";
 

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Fri Feb 16 17:08:42 2018(r329385)
+++ head/stand/lua/menu.lua Fri Feb 16 17:42:38 2018(r329386)
@@ -266,7 +266,8 @@ function menu.run(m)
local key = io.getchar();
 
-- Special key behaviors
-   if (key == core.KEY_BACKSPACE) and (m ~= menu.welcome) then
+   if ((key == core.KEY_BACKSPACE) or (key == core.KEY_DELETE)) and
+   (m ~= menu.welcome) then
break
elseif (key == core.KEY_ENTER) then
core.boot();

Modified: head/stand/lua/password.lua
==
--- head/stand/lua/password.lua Fri Feb 16 17:08:42 2018(r329385)
+++ head/stand/lua/password.lua Fri Feb 16 17:42:38 2018(r329386)
@@ -41,7 +41,7 @@ function password.read()
break;
end
 
-   if ch == core.KEY_BACKSPACE then
+   if (ch == core.KEY_BACKSPACE) or (ch == core.KEY_DELETE) then
if n > 0 then
n = n - 1;
-- loader.printc("\008 \008");
___
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: r329384 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-02-16 Thread Alan Somers
Author: asomers
Date: Fri Feb 16 16:56:09 2018
New Revision: 329384
URL: https://svnweb.freebsd.org/changeset/base/329384

Log:
  Handle generic pathconf attributes in the .zfs ctldir
  
  MFC instructions: change the value of _PC_LINK_MAX to INT_MAX
  
  Reported by:  jhb
  MFC after:19 days
  X-MFC-With:   329265
  Sponsored by: Spectra Logic Corp

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cFri Feb 
16 16:41:19 2018(r329383)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cFri Feb 
16 16:56:09 2018(r329384)
@@ -743,7 +743,7 @@ zfsctl_common_pathconf(ap)
 */
switch (ap->a_name) {
case _PC_LINK_MAX:
-   *ap->a_retval = INT_MAX;
+   *ap->a_retval = MIN(LONG_MAX, ZFS_LINK_MAX);
return (0);
 
case _PC_FILESIZEBITS:
@@ -766,8 +766,12 @@ zfsctl_common_pathconf(ap)
*ap->a_retval = ACL_MAX_ENTRIES;
return (0);
 
+   case _PC_NAME_MAX:
+   *ap->a_retval = NAME_MAX;
+   return (0);
+
default:
-   return (EINVAL);
+   return (vop_stdpathconf(ap));
}
 }
 
___
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: r329269 - head/stand/i386/boot2

2018-02-16 Thread Mark Johnston
On Wed, Feb 14, 2018 at 06:07:27PM +, Benno Rice wrote:
> Author: benno
> Date: Wed Feb 14 18:07:27 2018
> New Revision: 329269
> URL: https://svnweb.freebsd.org/changeset/base/329269
> 
> Log:
>   Reformat to come significantly closer to style(9).
>   
>   Reviewed by:imp, jhibbits
>   Differential Revision:  https://reviews.freebsd.org/D14366
> 
> Modified:
>   head/stand/i386/boot2/boot2.c
> 
> Modified: head/stand/i386/boot2/boot2.c
> ==
> --- head/stand/i386/boot2/boot2.c Wed Feb 14 18:05:37 2018
> (r329268)
> +++ head/stand/i386/boot2/boot2.c Wed Feb 14 18:07:27 2018
> (r329269)
> [...]
>  #if SERIAL
> - } else if (c == 'S') {
> - j = 0;
> - while ((unsigned int)(i = *arg++ - '0') <= 9)
> - j = j * 10 + i;
> - if (j > 0 && i == -'0') {
> - comspeed = j;
> - break;
> - }
> - /* Fall through to error below ('S' not in optstr[]). */
> + } else if (c == 'S') {
> + j = 0;
> + while (*arg <= '9') {
> + i = (unsigned int)(*arg - '0');
> + j = j * 10 + i;
> + arg++;
> + }
> + if (j > 0 && i == -'0') {
> + comspeed = j;
> + break;
> + }

The gcc build is failing now with a claim that "i" may be used
uninitialized in the if-statement above. It looks like a bogus error
though.
___
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: r329383 - in stable/11: share/man/man9 sys/amd64/include sys/i386/include

2018-02-16 Thread Mark Johnston
Author: markj
Date: Fri Feb 16 16:41:19 2018
New Revision: 329383
URL: https://svnweb.freebsd.org/changeset/base/329383

Log:
  MFC r315718, r316031:
  Add support for 8- and 16-bit atomic_(f)cmpset to x86.

Modified:
  stable/11/share/man/man9/atomic.9
  stable/11/sys/amd64/include/atomic.h
  stable/11/sys/i386/include/atomic.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man9/atomic.9
==
--- stable/11/share/man/man9/atomic.9   Fri Feb 16 16:22:54 2018
(r329382)
+++ stable/11/share/man/man9/atomic.9   Fri Feb 16 16:41:19 2018
(r329383)
@@ -328,9 +328,9 @@ if (*dst == old) {
 .Ed
 .El
 .Pp
-The
+Some architectures do not implement the
 .Fn atomic_cmpset
-functions are not implemented for the types
+functions for the types
 .Dq Li char ,
 .Dq Li short ,
 .Dq Li 8 ,
@@ -367,9 +367,9 @@ function also returns
 despite
 .Dl *old == *dst .
 .Pp
-The
+Some architectures do not implement the
 .Fn atomic_fcmpset
-functions are not implemented for the types
+functions for the types
 .Dq Li char ,
 .Dq Li short ,
 .Dq Li 8 ,

Modified: stable/11/sys/amd64/include/atomic.h
==
--- stable/11/sys/amd64/include/atomic.hFri Feb 16 16:22:54 2018
(r329382)
+++ stable/11/sys/amd64/include/atomic.hFri Feb 16 16:41:19 2018
(r329383)
@@ -99,8 +99,13 @@
 void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \
 void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
 
+intatomic_cmpset_char(volatile u_char *dst, u_char expect, u_char src);
+intatomic_cmpset_short(volatile u_short *dst, u_short expect, u_short src);
 intatomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src);
 intatomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src);
+intatomic_fcmpset_char(volatile u_char *dst, u_char *expect, u_char src);
+intatomic_fcmpset_short(volatile u_short *dst, u_short *expect,
+   u_short src);
 intatomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src);
 intatomic_fcmpset_long(volatile u_long *dst, u_long *expect, u_long src);
 u_int  atomic_fetchadd_int(volatile u_int *p, u_int v);
@@ -157,85 +162,62 @@ atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##
 struct __hack
 
 /*
- * Atomic compare and set, used by the mutex functions
+ * Atomic compare and set, used by the mutex functions.
  *
- * if (*dst == expect) *dst = src (all 32 bit words)
+ * cmpset:
+ * if (*dst == expect)
+ * *dst = src
  *
- * Returns 0 on failure, non-zero on success
+ * fcmpset:
+ * if (*dst == *expect)
+ * *dst = src
+ * else
+ * *expect = *dst
+ *
+ * Returns 0 on failure, non-zero on success.
  */
-
-static __inline int
-atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src)
-{
-   u_char res;
-
-   __asm __volatile(
-   "   " MPLOCKED ""
-   "   cmpxchgl %3,%1 ;"
-   "   sete%0 ;"
-   "# atomic_cmpset_int"
-   : "=q" (res),   /* 0 */
- "+m" (*dst),  /* 1 */
- "+a" (expect) /* 2 */
-   : "r" (src) /* 3 */
-   : "memory", "cc");
-   return (res);
+#defineATOMIC_CMPSET(TYPE) \
+static __inline int\
+atomic_cmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE expect, u_##TYPE src) \
+{  \
+   u_char res; \
+   \
+   __asm __volatile(   \
+   "   " MPLOCKED ""   \
+   "   cmpxchg %3,%1 ; "   \
+   "   sete%0 ;"   \
+   "# atomic_cmpset_" #TYPE "  "   \
+   : "=q" (res),   /* 0 */ \
+ "+m" (*dst),  /* 1 */ \
+ "+a" (expect) /* 2 */ \
+   : "r" (src) /* 3 */ \
+   : "memory", "cc");  \
+   return (res);   \
+}  \
+   \
+static __inline int\
+atomic_fcmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE *expect, u_##TYPE src) \
+{  \
+   u_char res; \
+   \
+   __asm __volatile(   \
+   "   " MPLOCKED ""   \
+   "   cmpxchg %3,%1 

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

2018-02-16 Thread Alan Somers
On Thu, Feb 15, 2018 at 12:18 PM, John Baldwin  wrote:

> On Wednesday, February 14, 2018 03:49:31 PM Alan Somers wrote:
> > Author: asomers
> > Date: Wed Feb 14 15:49:31 2018
> > New Revision: 329265
> > URL: https://svnweb.freebsd.org/changeset/base/329265
> >
> > Log:
> >   Implement .vop_pathconf and .vop_getacl for the .zfs ctldir
> >
> >   zfsctl_common_pathconf will report all the same variables that regular
> ZFS
> >   volumes report. zfsctl_common_getacl will report an ACL equivalent to
> 555,
> >   except that you can't read xattrs or edit attributes.
> >
> >   Fixes a bug where "ls .zfs" will occasionally print something like:
> >   ls: .zfs/.: Operation not supported
> >
> >   PR: 225793
> >   Reviewed by:avg
> >   MFC after:  3 weeks
> >   Sponsored by:   Spectra Logic Corp
> >   Differential Revision:  https://reviews.freebsd.org/D14365
> >
> > Modified:
> >   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
> >
> > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/
> zfs_ctldir.c
> > 
> ==
> > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
> Wed Feb 14 15:40:13 2018(r329264)
> > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
> Wed Feb 14 15:49:31 2018(r329265)
> > @@ -80,6 +80,10 @@
> >
> >  #include "zfs_namecheck.h"
> >
> > +/* Common access mode for all virtual directories under the ctldir */
> > +const u_short zfsctl_ctldir_mode = S_IRUSR | S_IXUSR | S_IRGRP |
> S_IXGRP |
> > +S_IROTH | S_IXOTH;
> > +
> >  /*
> >   * "Synthetic" filesystem implementation.
> >   */
> > @@ -496,8 +500,7 @@ zfsctl_common_getattr(vnode_t *vp, vattr_t *vap)
> >   vap->va_nblocks = 0;
> >   vap->va_seq = 0;
> >   vn_fsid(vp, vap);
> > - vap->va_mode = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP |
> > - S_IROTH | S_IXOTH;
> > + vap->va_mode = zfsctl_ctldir_mode;
> >   vap->va_type = VDIR;
> >   /*
> >* We live in the now (for atime).
> > @@ -724,6 +727,87 @@ zfsctl_root_vptocnp(struct vop_vptocnp_args *ap)
> >   return (0);
> >  }
> >
> > +static int
> > +zfsctl_common_pathconf(ap)
> > + struct vop_pathconf_args /* {
> > + struct vnode *a_vp;
> > + int a_name;
> > + int *a_retval;
> > + } */ *ap;
> > +{
> > + /*
> > +  * We care about ACL variables so that user land utilities like ls
> > +  * can display them correctly.  Since the ctldir's st_dev is set
> to be
> > +  * the same as the parent dataset, we must support all variables
> that
> > +  * it supports.
> > +  */
> > + switch (ap->a_name) {
> > + case _PC_LINK_MAX:
> > + *ap->a_retval = INT_MAX;
> > + return (0);
>
> On HEAD this should probably match the existing ZFS pathconf
> (min(LONG_MAX, ZFS_LINK_MAX IIRC), though if these directories can only
> ever have a link count of 2 (which seems true from zfsctl_common_getattr())
> then it would be fine to return '2' here instead.  For stable you'd have to
> restrict it to LINK_MAX if you don't use '2'.
>
> Also, you should call vfs_stdpathconf() in the default: case.
>
> --
> John Baldwin
>

All good points.  I don't think a max link count of 2 is correct, though,
because the real link count can be higher than that.  See
zfsctl_root_getattr and zfsctl_snapdir_getattr.  I'll set it the way that
zfs_pathconf does.  Also, it looks like I need to add _PC_NAME_MAX.
-Alan
___
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: r329349 - head/stand/lua

2018-02-16 Thread Warner Losh
On Feb 16, 2018 6:58 AM, "Kyle Evans"  wrote:

On Thu, Feb 15, 2018 at 9:12 PM, Kyle Evans  wrote:
> Author: kevans
> Date: Fri Feb 16 03:12:24 2018
> New Revision: 329349
> URL: https://svnweb.freebsd.org/changeset/base/329349
>
> Log:
>   stand/lua: Reduce magic numbers
>
>   Enter/backspace values are hardcoded in both the menu and password
scripts.
>   Separate these out to core for reuse between the two.
>
> Modified:
>   head/stand/lua/core.lua
>   head/stand/lua/menu.lua
>   head/stand/lua/password.lua
>
> Modified: head/stand/lua/core.lua
> 
==
> --- head/stand/lua/core.lua Fri Feb 16 01:33:01 2018(r329348)
> +++ head/stand/lua/core.lua Fri Feb 16 03:12:24 2018(r329349)
> @@ -28,6 +28,10 @@
>
>  local core = {};
>
> +-- Commonly appearing constants
> +core.KEY_ENTER = 13
> +core.KEY_BACKSPACE = 127
> +
>  function core.setVerbose(b)
> if (b == nil) then
> b = not core.verbose;
>
> Modified: head/stand/lua/menu.lua
> 
==
> --- head/stand/lua/menu.lua Fri Feb 16 01:33:01 2018(r329348)
> +++ head/stand/lua/menu.lua Fri Feb 16 03:12:24 2018(r329349)
> @@ -273,9 +273,9 @@ function menu.run(m)
> local key = io.getchar();
>
> -- Special key behaviors
> -   if (key == 127) and (m ~= menu.welcome) then
> +   if (key == core.KEY_BACKSPACE) and (m ~= menu.welcome)
then
> break
> -   elseif (key == 13) then
> +   elseif (key == core.KEY_ENTER) then
> core.boot();
> -- Should not return
> end
> @@ -357,7 +357,7 @@ function menu.autoboot()
> screen.defcursor();
> if io.ischar() then
> local ch = io.getchar();
> -   if ch == 13 then
> +   if ch == core.KEY_ENTER then
> break;
> else
> -- prevent autoboot when escaping to
interpreter
>
> Modified: head/stand/lua/password.lua
> 
==
> --- head/stand/lua/password.lua Fri Feb 16 01:33:01 2018(r329348)
> +++ head/stand/lua/password.lua Fri Feb 16 03:12:24 2018(r329349)
> @@ -37,11 +37,11 @@ function password.read()
>
> repeat
> ch = io.getchar();
> -   if ch == 13 then
> +   if ch == core.KEY_ENTER then
> break;
> end
>
> -   if ch == 8 then
> +   if ch == core.KEY_BACKSPACE then

It's worth noting that this changes the comparison from 'ch == 8' to
'ch == 127'. The password prompt was non-functional on my test systems
until this change, because I can never type my password right the
first time. =)

Pointed out by: cem@


History has shown we likely want to  accept both BS (8) and DEL (127) as
logical 'backwards erase character' signals.

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


svn commit: r329382 - head/release/arm64

2018-02-16 Thread Andrew Turner
Author: andrew
Date: Fri Feb 16 16:22:54 2018
New Revision: 329382
URL: https://svnweb.freebsd.org/changeset/base/329382

Log:
  Put the pine64 root filesystem on teh correct partition.
  
  The Pine64 root filesystem was incorrectly created directly on the MBR
  partition. This can cause the loader to get confused when loading the
  kernel from this filesystem.
  
  The loader will see this as a small partition meaning later checks to
  ensure it doesn't read past the end of the disk incorrectly report a
  failure. This seems to work mostly by accident with the released images as
  they are smaller than the reported size, however after growfs has run the
  image may no longer boot.
  
  Reviewed by:  gjb, emaste, imp
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14343

Modified:
  head/release/arm64/PINE64.conf

Modified: head/release/arm64/PINE64.conf
==
--- head/release/arm64/PINE64.conf  Fri Feb 16 16:16:33 2018
(r329381)
+++ head/release/arm64/PINE64.conf  Fri Feb 16 16:22:54 2018
(r329382)
@@ -11,7 +11,7 @@ FAT_SIZE="54m -b 1m"
 FAT_TYPE="16"
 IMAGE_SIZE="2560M"
 KERNEL="GENERIC"
-MD_ARGS="-x 16384 -y 255"
+MD_ARGS="-x 63 -y 255"
 NODOC=1
 PART_SCHEME="MBR"
 export BOARDNAME="PINE64"
@@ -25,7 +25,7 @@ arm_install_uboot() {
of=/dev/${mddev} bs=1k seek=8 conv=sync
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
-   chroot ${CHROOTDIR} mount /dev/${mddev}s2 ${UFSMOUNT}
+   chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}
 
BOOTFILES="$(chroot ${CHROOTDIR} \
env TARGET=${EMBEDDED_TARGET} TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \
___
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: r329381 - in stable/11/sys: sys vm

2018-02-16 Thread Mateusz Guzik
Author: mjg
Date: Fri Feb 16 16:16:33 2018
New Revision: 329381
URL: https://svnweb.freebsd.org/changeset/base/329381

Log:
  MFC r324610:
  
  Reduce traffic on vm_cnt.v_free_count
  
  The variable is modified with the highly contended page free queue lock.
  It unnecessarily shares a cacheline with purely read-only fields and is
  re-read after the lock is dropped in the page allocation code making the
  hold time longer.
  
  Pad the variable just like the others and store the value as found with
  the lock held instead of re-reading.
  
  Provides a modest 1%-ish speed up in concurrent page faults.
  
  Due to KBI constraints the field is not moved in this commit, only re-read is
  avoided.

Modified:
  stable/11/sys/sys/vmmeter.h
  stable/11/sys/vm/vm_page.c
  stable/11/sys/vm/vm_phys.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/vmmeter.h
==
--- stable/11/sys/sys/vmmeter.h Fri Feb 16 16:07:58 2018(r329380)
+++ stable/11/sys/sys/vmmeter.h Fri Feb 16 16:16:33 2018(r329381)
@@ -175,10 +175,10 @@ vm_paging_target(void)
  * Returns TRUE if the pagedaemon needs to be woken up.
  */
 static inline int
-vm_paging_needed(void)
+vm_paging_needed(u_int free_count)
 {
 
-   return (vm_cnt.v_free_count < vm_pageout_wakeup_thresh);
+   return (free_count < vm_pageout_wakeup_thresh);
 }
 
 /*

Modified: stable/11/sys/vm/vm_page.c
==
--- stable/11/sys/vm/vm_page.c  Fri Feb 16 16:07:58 2018(r329380)
+++ stable/11/sys/vm/vm_page.c  Fri Feb 16 16:16:33 2018(r329381)
@@ -1601,6 +1601,7 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi
 {
vm_page_t m;
int flags, req_class;
+   u_int free_count;
 
KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) &&
(object != NULL || (req & VM_ALLOC_SBUSY) == 0) &&
@@ -1672,7 +1673,7 @@ again:
 *  At this point we had better have found a good page.
 */
KASSERT(m != NULL, ("missing page"));
-   vm_phys_freecnt_adj(m, -1);
+   free_count = vm_phys_freecnt_adj(m, -1);
if ((m->flags & PG_ZERO) != 0)
vm_page_zero_count--;
mtx_unlock(_page_queue_free_mtx);
@@ -1737,7 +1738,7 @@ again:
 * Don't wakeup too often - wakeup the pageout daemon when
 * we would be nearly out of memory.
 */
-   if (vm_paging_needed())
+   if (vm_paging_needed(free_count))
pagedaemon_wakeup();
 
return (m);
@@ -1933,7 +1934,7 @@ retry:
pmap_page_set_memattr(m, memattr);
pindex++;
}
-   if (vm_paging_needed())
+   if (vm_paging_needed(vm_cnt.v_free_count))
pagedaemon_wakeup();
return (m_ret);
 }
@@ -1982,7 +1983,7 @@ vm_page_t
 vm_page_alloc_freelist(int flind, int req)
 {
vm_page_t m;
-   u_int flags;
+   u_int flags, free_count;
int req_class;
 
req_class = req & VM_ALLOC_CLASS_MASK;
@@ -2013,7 +2014,7 @@ again:
mtx_unlock(_page_queue_free_mtx);
return (NULL);
}
-   vm_phys_freecnt_adj(m, -1);
+   free_count = vm_phys_freecnt_adj(m, -1);
if ((m->flags & PG_ZERO) != 0)
vm_page_zero_count--;
mtx_unlock(_page_queue_free_mtx);
@@ -2037,7 +2038,7 @@ again:
}
/* Unmanaged pages don't use "act_count". */
m->oflags = VPO_UNMANAGED;
-   if (vm_paging_needed())
+   if (vm_paging_needed(free_count))
pagedaemon_wakeup();
return (m);
 }

Modified: stable/11/sys/vm/vm_phys.h
==
--- stable/11/sys/vm/vm_phys.h  Fri Feb 16 16:07:58 2018(r329380)
+++ stable/11/sys/vm/vm_phys.h  Fri Feb 16 16:16:33 2018(r329381)
@@ -112,13 +112,13 @@ vm_phys_domain(vm_page_t m)
 #endif
 }
 
-static inline void
+static inline u_int
 vm_phys_freecnt_adj(vm_page_t m, int adj)
 {
 
mtx_assert(_page_queue_free_mtx, MA_OWNED);
-   vm_cnt.v_free_count += adj;
vm_phys_domain(m)->vmd_free_count += adj;
+   return (vm_cnt.v_free_count += adj);
 }
 
 #endif /* _KERNEL */
___
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: r329380 - stable/11/sys/kern

2018-02-16 Thread Mateusz Guzik
Author: mjg
Date: Fri Feb 16 16:07:58 2018
New Revision: 329380
URL: https://svnweb.freebsd.org/changeset/base/329380

Log:
  MFC r327875,r327905,r327914:
  
  mtx: use fcmpset to cover setting MTX_CONTESTED
  
  ===
  
  rwlock: try regular read unlock even in the hard path
  
  Saves on turnstile trips if the lock got more readers.
  
  ===
  
  sx: retry hard shared unlock just like in r327905 for rwlocks

Modified:
  stable/11/sys/kern/kern_mutex.c
  stable/11/sys/kern/kern_rwlock.c
  stable/11/sys/kern/kern_sx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_mutex.c
==
--- stable/11/sys/kern/kern_mutex.c Fri Feb 16 16:05:02 2018
(r329379)
+++ stable/11/sys/kern/kern_mutex.c Fri Feb 16 16:07:58 2018
(r329380)
@@ -576,6 +576,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v)
 
ts = turnstile_trywait(>lock_object);
v = MTX_READ_VALUE(m);
+retry_turnstile:
 
/*
 * Check if the lock has been released while spinning for
@@ -607,10 +608,8 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v)
 * or the state of the MTX_RECURSED bit changed.
 */
if ((v & MTX_CONTESTED) == 0 &&
-   !atomic_cmpset_ptr(>mtx_lock, v, v | MTX_CONTESTED)) {
-   turnstile_cancel(ts);
-   v = MTX_READ_VALUE(m);
-   continue;
+   !atomic_fcmpset_ptr(>mtx_lock, , v | MTX_CONTESTED)) {
+   goto retry_turnstile;
}
 
/*

Modified: stable/11/sys/kern/kern_rwlock.c
==
--- stable/11/sys/kern/kern_rwlock.cFri Feb 16 16:05:02 2018
(r329379)
+++ stable/11/sys/kern/kern_rwlock.cFri Feb 16 16:07:58 2018
(r329380)
@@ -769,9 +769,9 @@ __rw_runlock_hard(struct rwlock *rw, struct thread *td
turnstile_chain_lock(>lock_object);
v = RW_READ_VALUE(rw);
 retry_ts:
-   if (__predict_false(RW_READERS(v) > 1)) {
+   if (__rw_runlock_try(rw, td, )) {
turnstile_chain_unlock(>lock_object);
-   continue;
+   break;
}
 
v &= (RW_LOCK_WAITERS | RW_LOCK_WRITE_SPINNER);

Modified: stable/11/sys/kern/kern_sx.c
==
--- stable/11/sys/kern/kern_sx.cFri Feb 16 16:05:02 2018
(r329379)
+++ stable/11/sys/kern/kern_sx.cFri Feb 16 16:07:58 2018
(r329380)
@@ -1191,7 +1191,7 @@ _sx_sunlock_try(struct sx *sx, uintptr_t *xp)
 static void __noinline
 _sx_sunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_LINE_ARG_DEF)
 {
-   int wakeup_swapper;
+   int wakeup_swapper = 0;
uintptr_t setx;
 
if (SCHEDULER_STOPPED())
@@ -1211,6 +1211,9 @@ _sx_sunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_
for (;;) {
MPASS(x & SX_LOCK_EXCLUSIVE_WAITERS);
MPASS(!(x & SX_LOCK_SHARED_WAITERS));
+   if (_sx_sunlock_try(sx, ))
+   break;
+
/*
 * Wake up semantic here is quite simple:
 * Just wake up all the exclusive waiters.
___
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: r329379 - stable/11/sys/kern

2018-02-16 Thread Mateusz Guzik
Author: mjg
Date: Fri Feb 16 16:05:02 2018
New Revision: 329379
URL: https://svnweb.freebsd.org/changeset/base/329379

Log:
  MFC r327874:
  
  vfs: tidy up vdrop
  
  Skip vfs_refcount_release_if_not_last if the interlock is held and just
  go straight to refcount_release.
  
  While here do cosmetic rearrangement of _vhold to better show it contains
  equivalent behaviour.

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

Modified: stable/11/sys/kern/vfs_subr.c
==
--- stable/11/sys/kern/vfs_subr.c   Fri Feb 16 16:01:39 2018
(r329378)
+++ stable/11/sys/kern/vfs_subr.c   Fri Feb 16 16:05:02 2018
(r329379)
@@ -2769,14 +2769,14 @@ _vhold(struct vnode *vp, bool locked)
else
ASSERT_VI_UNLOCKED(vp, __func__);
CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
-   if (!locked && vfs_refcount_acquire_if_not_zero(>v_holdcnt)) {
-   VNASSERT((vp->v_iflag & VI_FREE) == 0, vp,
-   ("_vhold: vnode with holdcnt is free"));
-   return;
-   }
-
-   if (!locked)
+   if (!locked) {
+   if (vfs_refcount_acquire_if_not_zero(>v_holdcnt)) {
+   VNASSERT((vp->v_iflag & VI_FREE) == 0, vp,
+   ("_vhold: vnode with holdcnt is free"));
+   return;
+   }
VI_LOCK(vp);
+   }
if ((vp->v_iflag & VI_FREE) == 0) {
refcount_acquire(>v_holdcnt);
if (!locked)
@@ -2830,14 +2830,11 @@ _vdrop(struct vnode *vp, bool locked)
CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
if ((int)vp->v_holdcnt <= 0)
panic("vdrop: holdcnt %d", vp->v_holdcnt);
-   if (vfs_refcount_release_if_not_last(>v_holdcnt)) {
-   if (locked)
-   VI_UNLOCK(vp);
-   return;
-   }
-
-   if (!locked)
+   if (!locked) {
+   if (vfs_refcount_release_if_not_last(>v_holdcnt))
+   return;
VI_LOCK(vp);
+   }
if (refcount_release(>v_holdcnt) == 0) {
VI_UNLOCK(vp);
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: r329378 - head/sys/compat/linuxkpi/common/include/linux

2018-02-16 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 16 16:01:39 2018
New Revision: 329378
URL: https://svnweb.freebsd.org/changeset/base/329378

Log:
  Implement mutex_trylock_recursive() in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/mutex.h

Modified: head/sys/compat/linuxkpi/common/include/linux/mutex.h
==
--- head/sys/compat/linuxkpi/common/include/linux/mutex.h   Fri Feb 16 
15:52:28 2018(r329377)
+++ head/sys/compat/linuxkpi/common/include/linux/mutex.h   Fri Feb 16 
16:01:39 2018(r329378)
@@ -77,6 +77,21 @@ typedef struct mutex {
!!sx_try_xlock(&(_m)->sx);  \
 })
 
+enum mutex_trylock_recursive_enum {
+   MUTEX_TRYLOCK_FAILED = 0,
+   MUTEX_TRYLOCK_SUCCESS = 1,
+   MUTEX_TRYLOCK_RECURSIVE = 2,
+};
+
+static inline __must_check enum mutex_trylock_recursive_enum
+mutex_trylock_recursive(struct mutex *lock)
+{
+   if (unlikely(sx_xholder(>sx) == curthread))
+   return (MUTEX_TRYLOCK_RECURSIVE);
+
+   return (mutex_trylock(lock));
+}
+
 #definemutex_init(_m) \
linux_mutex_init(_m, mutex_name(#_m), SX_NOWITNESS)
 
___
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: r329377 - head/sys/compat/linuxkpi/common/include/linux

2018-02-16 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 16 15:52:28 2018
New Revision: 329377
URL: https://svnweb.freebsd.org/changeset/base/329377

Log:
  Implement memdup_user_nul() in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/string.h

Modified: head/sys/compat/linuxkpi/common/include/linux/string.h
==
--- head/sys/compat/linuxkpi/common/include/linux/string.h  Fri Feb 16 
15:41:16 2018(r329376)
+++ head/sys/compat/linuxkpi/common/include/linux/string.h  Fri Feb 16 
15:52:28 2018(r329377)
@@ -71,6 +71,22 @@ memdup_user(const void *ptr, size_t len)
 }
 
 static inline void *
+memdup_user_nul(const void *ptr, size_t len)
+{
+   char *retval;
+   int error;
+
+   retval = malloc(len + 1, M_KMALLOC, M_WAITOK);
+   error = linux_copyin(ptr, retval, len);
+   if (error != 0) {
+   free(retval, M_KMALLOC);
+   return (ERR_PTR(error));
+   }
+   retval[len] = '\0';
+   return (retval);
+}
+
+static inline void *
 kmemdup(const void *src, size_t len, gfp_t gfp)
 {
void *dst;
___
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: r329376 - in head/sys/compat/linuxkpi/common: include/linux src

2018-02-16 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 16 15:41:16 2018
New Revision: 329376
URL: https://svnweb.freebsd.org/changeset/base/329376

Log:
  Implement tasklet_enable() and tasklet_disable() in the LinuxKPI.
  
  MFC after:1 week
  Requested by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/interrupt.h
  head/sys/compat/linuxkpi/common/src/linux_tasklet.c

Modified: head/sys/compat/linuxkpi/common/include/linux/interrupt.h
==
--- head/sys/compat/linuxkpi/common/include/linux/interrupt.h   Fri Feb 16 
15:41:03 2018(r329375)
+++ head/sys/compat/linuxkpi/common/include/linux/interrupt.h   Fri Feb 16 
15:41:16 2018(r329376)
@@ -200,5 +200,7 @@ extern void tasklet_schedule(struct tasklet_struct *);
 extern void tasklet_kill(struct tasklet_struct *);
 extern void tasklet_init(struct tasklet_struct *, tasklet_func_t *,
 unsigned long data);
+extern void tasklet_enable(struct tasklet_struct *);
+extern void tasklet_disable(struct tasklet_struct *);
 
 #endif /* _LINUX_INTERRUPT_H_ */

Modified: head/sys/compat/linuxkpi/common/src/linux_tasklet.c
==
--- head/sys/compat/linuxkpi/common/src/linux_tasklet.c Fri Feb 16 15:41:03 
2018(r329375)
+++ head/sys/compat/linuxkpi/common/src/linux_tasklet.c Fri Feb 16 15:41:16 
2018(r329376)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #defineTASKLET_ST_BUSY 1
 #defineTASKLET_ST_EXEC 2
 #defineTASKLET_ST_LOOP 3
+#defineTASKLET_ST_PAUSED 4
 
 #defineTASKLET_ST_CMPSET(ts, old, new) \
atomic_cmpset_ptr((volatile uintptr_t *)&(ts)->entry.tqe_prev, old, new)
@@ -195,4 +196,22 @@ tasklet_kill(struct tasklet_struct *ts)
/* wait until tasklet is no longer busy */
while (TASKLET_ST_GET(ts) != TASKLET_ST_IDLE)
pause("W", 1);
+}
+
+void
+tasklet_enable(struct tasklet_struct *ts)
+{
+   (void) TASKLET_ST_CMPSET(ts, TASKLET_ST_PAUSED, TASKLET_ST_IDLE);
+}
+
+void
+tasklet_disable(struct tasklet_struct *ts)
+{
+   while (1) {
+   if (TASKLET_ST_GET(ts) == TASKLET_ST_PAUSED) 
+   break;
+   if (TASKLET_ST_CMPSET(ts, TASKLET_ST_IDLE, TASKLET_ST_PAUSED))
+   break;
+   pause("W", 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: r329375 - in head: lib/libufs stand/libsa sys/geom sys/geom/journal sys/geom/label sys/ufs/ffs

2018-02-16 Thread Mark Johnston
Author: markj
Date: Fri Feb 16 15:41:03 2018
New Revision: 329375
URL: https://svnweb.freebsd.org/changeset/base/329375

Log:
  Fix a memory leak introduced in r328426.
  
  ffs_sbget() may return a superblock buffer even if it fails, so the
  caller must be prepared to free it in this case. Moreover, when tasting
  alternate superblock locations in a loop, ffs_sbget()'s readfunc
  callback must free the previously allocated buffer.
  
  Reported and tested by:   pho
  Reviewed by:  kib (previous version)
  Differential Revision:https://reviews.freebsd.org/D14390

Modified:
  head/lib/libufs/sblock.c
  head/stand/libsa/ufs.c
  head/sys/geom/geom_io.c
  head/sys/geom/journal/g_journal_ufs.c
  head/sys/geom/label/g_label_ufs.c
  head/sys/ufs/ffs/ffs_subr.c
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/lib/libufs/sblock.c
==
--- head/lib/libufs/sblock.cFri Feb 16 15:38:22 2018(r329374)
+++ head/lib/libufs/sblock.cFri Feb 16 15:41:03 2018(r329375)
@@ -150,6 +150,7 @@ use_pread(void *devfd, off_t loc, void **bufp, int siz
int fd;
 
fd = *(int *)devfd;
+   free(*bufp);
if ((*bufp = malloc(size)) == NULL)
return (ENOSPC);
if (pread(fd, *bufp, size, loc) != size)

Modified: head/stand/libsa/ufs.c
==
--- head/stand/libsa/ufs.c  Fri Feb 16 15:38:22 2018(r329374)
+++ head/stand/libsa/ufs.c  Fri Feb 16 15:41:03 2018(r329375)
@@ -687,6 +687,7 @@ ufs_use_sa_read(void *devfd, off_t loc, void **bufp, i
int error;
 
f = (struct open_file *)devfd;
+   free(*bufp);
if ((*bufp = malloc(size)) == NULL)
return (ENOSPC);
error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, loc / DEV_BSIZE,

Modified: head/sys/geom/geom_io.c
==
--- head/sys/geom/geom_io.c Fri Feb 16 15:38:22 2018(r329374)
+++ head/sys/geom/geom_io.c Fri Feb 16 15:41:03 2018(r329375)
@@ -966,6 +966,8 @@ g_use_g_read_data(void *devfd, off_t loc, void **bufp,
 */
if (loc % cp->provider->sectorsize != 0)
return (ENOENT);
+   if (*bufp != NULL)
+   g_free(*bufp);
*bufp = g_read_data(cp, loc, size, NULL);
if (*bufp == NULL)
return (ENOENT);

Modified: head/sys/geom/journal/g_journal_ufs.c
==
--- head/sys/geom/journal/g_journal_ufs.c   Fri Feb 16 15:38:22 2018
(r329374)
+++ head/sys/geom/journal/g_journal_ufs.c   Fri Feb 16 15:41:03 2018
(r329375)
@@ -70,10 +70,13 @@ g_journal_ufs_dirty(struct g_consumer *cp)
struct fs *fs;
int error;
 
+   fs = NULL;
if (SBLOCKSIZE % cp->provider->sectorsize != 0 ||
ffs_sbget(cp, , -1, NULL, g_use_g_read_data) != 0) {
GJ_DEBUG(0, "Cannot find superblock to mark file system %s "
"as dirty.", cp->provider->name);
+   if (fs != NULL)
+   g_free(fs);
return;
}
GJ_DEBUG(0, "clean=%d flags=0x%x", fs->fs_clean, fs->fs_flags);

Modified: head/sys/geom/label/g_label_ufs.c
==
--- head/sys/geom/label/g_label_ufs.c   Fri Feb 16 15:38:22 2018
(r329374)
+++ head/sys/geom/label/g_label_ufs.c   Fri Feb 16 15:41:03 2018
(r329375)
@@ -75,9 +75,14 @@ g_label_ufs_taste_common(struct g_consumer *cp, char *
pp = cp->provider;
label[0] = '\0';
 
+   fs = NULL;
if (SBLOCKSIZE % pp->sectorsize != 0 ||
-   ffs_sbget(cp, , -1, NULL, g_use_g_read_data) != 0)
+   ffs_sbget(cp, , -1, NULL, g_use_g_read_data) != 0) {
+   if (fs != NULL)
+   g_free(fs);
return;
+   }
+
/*
 * Check for magic. We also need to check if file system size
 * is almost equal to providers size, because sysinstall(8)

Modified: head/sys/ufs/ffs/ffs_subr.c
==
--- head/sys/ufs/ffs/ffs_subr.c Fri Feb 16 15:38:22 2018(r329374)
+++ head/sys/ufs/ffs/ffs_subr.c Fri Feb 16 15:41:03 2018(r329375)
@@ -172,6 +172,7 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper
int32_t *lp;
char *buf;
 
+   *fsp = NULL;
if (altsuperblock != -1) {
if ((ret = readsuper(devfd, fsp, altsuperblock, readfunc)) != 0)
return (ret);
@@ -209,9 +210,11 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper
size = fs->fs_bsize;
if (i + fs->fs_frag > blks)
size = 

svn commit: r329374 - head/sys/vm

2018-02-16 Thread Mark Johnston
Author: markj
Date: Fri Feb 16 15:38:22 2018
New Revision: 329374
URL: https://svnweb.freebsd.org/changeset/base/329374

Log:
  Use the conventional name for an array of pages.
  
  No functional change intended.
  
  Discussed with:   kib
  MFC after:3 days

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cFri Feb 16 15:38:02 2018(r329373)
+++ head/sys/vm/swap_pager.cFri Feb 16 15:38:22 2018(r329374)
@@ -1084,16 +1084,16 @@ swap_pager_unswapped(vm_page_t m)
 /*
  * swap_pager_getpages() - bring pages in from swap
  *
- * Attempt to page in the pages in array "m" of length "count".  The caller
- * may optionally specify that additional pages preceding and succeeding
- * the specified range be paged in.  The number of such pages is returned
- * in the "rbehind" and "rahead" parameters, and they will be in the
- * inactive queue upon return.
+ * Attempt to page in the pages in array "ma" of length "count".  The
+ * caller may optionally specify that additional pages preceding and
+ * succeeding the specified range be paged in.  The number of such pages
+ * is returned in the "rbehind" and "rahead" parameters, and they will
+ * be in the inactive queue upon return.
  *
- * The pages in "m" must be busied and will remain busied upon return.
+ * The pages in "ma" must be busied and will remain busied upon return.
  */
 static int
-swap_pager_getpages(vm_object_t object, vm_page_t *m, int count, int *rbehind,
+swap_pager_getpages(vm_object_t object, vm_page_t *ma, int count, int *rbehind,
 int *rahead)
 {
struct buf *bp;
@@ -1108,7 +1108,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, 
bp = getpbuf(_rcount);
VM_OBJECT_WLOCK(object);
 
-   if (!swap_pager_haspage(object, m[0]->pindex, , )) {
+   if (!swap_pager_haspage(object, ma[0]->pindex, , )) {
relpbuf(bp, _rcount);
return (VM_PAGER_FAIL);
}
@@ -1120,15 +1120,15 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, 
KASSERT(reqcount - 1 <= maxahead,
("page count %d extends beyond swap block", reqcount));
*rahead = imin(*rahead, maxahead - (reqcount - 1));
-   pindex = m[reqcount - 1]->pindex;
-   msucc = TAILQ_NEXT(m[reqcount - 1], listq);
+   pindex = ma[reqcount - 1]->pindex;
+   msucc = TAILQ_NEXT(ma[reqcount - 1], listq);
if (msucc != NULL && msucc->pindex - pindex - 1 < *rahead)
*rahead = msucc->pindex - pindex - 1;
}
if (rbehind != NULL) {
*rbehind = imin(*rbehind, maxbehind);
-   pindex = m[0]->pindex;
-   mpred = TAILQ_PREV(m[0], pglist, listq);
+   pindex = ma[0]->pindex;
+   mpred = TAILQ_PREV(ma[0], pglist, listq);
if (mpred != NULL && pindex - mpred->pindex - 1 < *rbehind)
*rbehind = pindex - mpred->pindex - 1;
}
@@ -1139,7 +1139,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, 
shift = rbehind != NULL ? *rbehind : 0;
if (shift != 0) {
for (i = 1; i <= shift; i++) {
-   p = vm_page_alloc(object, m[0]->pindex - i,
+   p = vm_page_alloc(object, ma[0]->pindex - i,
VM_ALLOC_NORMAL);
if (p == NULL) {
/* Shift allocated pages to the left. */
@@ -1154,11 +1154,11 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, 
*rbehind = shift;
}
for (i = 0; i < reqcount; i++)
-   bp->b_pages[i + shift] = m[i];
+   bp->b_pages[i + shift] = ma[i];
if (rahead != NULL) {
for (i = 0; i < *rahead; i++) {
p = vm_page_alloc(object,
-   m[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL);
+   ma[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL);
if (p == NULL)
break;
bp->b_pages[shift + reqcount + i] = p;
@@ -1203,7 +1203,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, 
 * Instead, we look at the one page we are interested in which we
 * still hold a lock on even through the I/O completion.
 *
-* The other pages in our m[] array are also released on completion,
+* The other pages in our ma[] array are also released on completion,
 * so we cannot assume they are valid anymore either.
 *
 * NOTE: b_blkno is destroyed by the call to swapdev_strategy
@@ -1217,8 +1217,8 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, 
 * is set in the 

svn commit: r329373 - head/sys/conf

2018-02-16 Thread Ed Maste
Author: emaste
Date: Fri Feb 16 15:38:02 2018
New Revision: 329373
URL: https://svnweb.freebsd.org/changeset/base/329373

Log:
  Correct module symbol export handling
  
  EXPORT_SYMS can be set to YES, NO, a list of symbols to export from a
  module, or to a filename containing such a list.  For the case that it
  is set to a symbol list, replace spaces in the list with newlines, so
  the created file is in the format expected by kmod_syms.awk.
  
  Reviewed by:  imp, jhb
  MFC after:1 month
  Sponsored by: Turing Robotic Industries Inc.
  Differential Revision:https://reviews.freebsd.org/D14284

Modified:
  head/sys/conf/kmod.mk

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Fri Feb 16 15:37:33 2018(r329372)
+++ head/sys/conf/kmod.mk   Fri Feb 16 15:38:02 2018(r329373)
@@ -243,14 +243,14 @@ ${FULLPROG}: ${OBJS}
 .if ${EXPORT_SYMS} == NO
:> export_syms
 .elif !exists(${.CURDIR}/${EXPORT_SYMS})
-   echo ${EXPORT_SYMS} > export_syms
+   echo -n "${EXPORT_SYMS:@s@$s${.newline}@}" > export_syms
 .else
grep -v '^#' < ${EXPORT_SYMS} > export_syms
 .endif
${AWK} -f ${SYSDIR}/conf/kmod_syms.awk ${.TARGET} \
export_syms | xargs -J% ${OBJCOPY} % ${.TARGET}
 .endif
-.endif
+.endif # defined(EXPORT_SYMS)
 .if defined(PREFIX_SYMS)
${AWK} -v prefix=${PREFIX_SYMS} -f ${SYSDIR}/conf/kmod_syms_prefix.awk \
${.TARGET} /dev/null | xargs -J% ${OBJCOPY} % ${.TARGET}
___
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: r329372 - head/sys/compat/linuxkpi/common/include/linux

2018-02-16 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 16 15:37:33 2018
New Revision: 329372
URL: https://svnweb.freebsd.org/changeset/base/329372

Log:
  Implement enable_irq() and disable_irq() in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/interrupt.h

Modified: head/sys/compat/linuxkpi/common/include/linux/interrupt.h
==
--- head/sys/compat/linuxkpi/common/include/linux/interrupt.h   Fri Feb 16 
15:20:21 2018(r329371)
+++ head/sys/compat/linuxkpi/common/include/linux/interrupt.h   Fri Feb 16 
15:37:33 2018(r329372)
@@ -112,6 +112,38 @@ request_irq(unsigned int irq, irq_handler_t handler, u
 }
 
 static inline int
+enable_irq(unsigned int irq)
+{
+   struct irq_ent *irqe;
+   struct device *dev;
+
+   dev = linux_pci_find_irq_dev(irq);
+   if (dev == NULL)
+   return -EINVAL;
+   irqe = linux_irq_ent(dev, irq);
+   if (irqe == NULL)
+   return -EINVAL;
+   return -bus_setup_intr(dev->bsddev, irqe->res, INTR_TYPE_NET | 
INTR_MPSAFE,
+   NULL, linux_irq_handler, irqe, >tag);
+}
+
+static inline void
+disable_irq(unsigned int irq)
+{
+   struct irq_ent *irqe;
+   struct device *dev;
+
+   dev = linux_pci_find_irq_dev(irq);
+   if (dev == NULL)
+   return;
+   irqe = linux_irq_ent(dev, irq);
+   if (irqe == NULL)
+   return;
+   bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag);
+   irqe->tag = NULL;
+}
+
+static inline int
 bind_irq_to_cpu(unsigned int irq, int cpu_id)
 {
struct irq_ent *irqe;
___
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: r329371 - head/sys/compat/linuxkpi/common/include/asm

2018-02-16 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 16 15:20:21 2018
New Revision: 329371
URL: https://svnweb.freebsd.org/changeset/base/329371

Log:
  Allow the cmpxchg() macro in the LinuxKPI to work on pointers without
  generating compiler warnings, -Wint-conversion .
  
  Requested by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/asm/atomic.h

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic.hFri Feb 16 
15:00:14 2018(r329370)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic.hFri Feb 16 
15:20:21 2018(r329371)
@@ -159,36 +159,41 @@ atomic_cmpxchg(atomic_t *v, int old, int new)
return (ret);
 }
 
-#definecmpxchg(ptr, old, new) ({   \
-   __typeof(*(ptr)) __ret; \
-   \
-   CTASSERT(sizeof(__ret) == 1 || sizeof(__ret) == 2 ||\
-   sizeof(__ret) == 4 || sizeof(__ret) == 8);  \
-   \
-   __ret = (old);  \
-   switch (sizeof(__ret)) {\
-   case 1: \
-   while (!atomic_fcmpset_8((volatile int8_t *)(ptr), \
-   (int8_t *)&__ret, (new)) && __ret == (old)) \
-   ;   \
-   break;  \
-   case 2: \
-   while (!atomic_fcmpset_16((volatile int16_t *)(ptr), \
-   (int16_t *)&__ret, (new)) && __ret == (old)) \
-   ;   \
-   break;  \
-   case 4: \
-   while (!atomic_fcmpset_32((volatile int32_t *)(ptr), \
-   (int32_t *)&__ret, (new)) && __ret == (old)) \
-   ;   \
-   break;  \
-   case 8: \
-   while (!atomic_fcmpset_64((volatile int64_t *)(ptr), \
-   (int64_t *)&__ret, (new)) && __ret == (old)) \
-   ;   \
-   break;  \
-   }   \
-   __ret;  \
+#definecmpxchg(ptr, old, new) ({   
\
+   union { \
+   __typeof(*(ptr)) val;   \
+   u8 u8[];\
+   u16 u16[];  \
+   u32 u32[];  \
+   u64 u64[];  \
+   } __ret = { .val = (old) }, __new = { .val = (new) };   \
+   \
+   CTASSERT(sizeof(__ret.val) == 1 || sizeof(__ret.val) == 2 ||\
+   sizeof(__ret.val) == 4 || sizeof(__ret.val) == 8);  \
+   \
+   switch (sizeof(__ret.val)) {\
+   case 1: \
+   while (!atomic_fcmpset_8((volatile u8 *)(ptr),  \
+   __ret.u8, __new.u8[0]) && __ret.val == (old))   \
+   ;   \
+   break;  \
+   case 2: \
+   while (!atomic_fcmpset_16((volatile u16 *)(ptr),\
+   __ret.u16, __new.u16[0]) && __ret.val == (old)) \
+   ;   \
+   break;  \
+   case 4: \
+   while (!atomic_fcmpset_32((volatile u32 *)(ptr),\
+   __ret.u32, __new.u32[0]) && __ret.val == (old)) \
+   ;   \
+   break;  \
+   case 8:

svn commit: r329370 - in head/sys: amd64/linux32 compat/linux i386/linux

2018-02-16 Thread Ed Maste
Author: emaste
Date: Fri Feb 16 15:00:14 2018
New Revision: 329370
URL: https://svnweb.freebsd.org/changeset/base/329370

Log:
  Rationalize license text on Linuxolator files
  
  Many licenses on Linuxolator files contained small variations from the
  standard FreeBSD license text.  To avoid license proliferation switch to
  the standard 2-clause FreeBSD license for those files where I have
  permission from each of the listed copyright holders.  Additional files
  waiting on permission from others are listed in review D14210.
  
  Approved by:  kan, marcel, sos, rdivacky
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/amd64/linux32/linux32_dummy.c
  head/sys/compat/linux/linux_file.c
  head/sys/compat/linux/linux_ioctl.c
  head/sys/compat/linux/linux_ipc.c
  head/sys/compat/linux/linux_mib.c
  head/sys/compat/linux/linux_signal.c
  head/sys/compat/linux/linux_socket.c
  head/sys/compat/linux/linux_stats.c
  head/sys/compat/linux/linux_sysctl.c
  head/sys/i386/linux/imgact_linux.c
  head/sys/i386/linux/linux_dummy.c
  head/sys/i386/linux/linux_machdep.c
  head/sys/i386/linux/linux_ptrace.c
  head/sys/i386/linux/linux_sysvec.c

Modified: head/sys/amd64/linux32/linux32_dummy.c
==
--- head/sys/amd64/linux32/linux32_dummy.c  Fri Feb 16 14:59:11 2018
(r329369)
+++ head/sys/amd64/linux32/linux32_dummy.c  Fri Feb 16 15:00:14 2018
(r329370)
@@ -1,5 +1,5 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 1994-1995 Søren Schmidt
  * All rights reserved.
@@ -8,24 +8,22 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer
- *in this position and unchanged.
+ *notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #include 

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Fri Feb 16 14:59:11 2018
(r329369)
+++ head/sys/compat/linux/linux_file.c  Fri Feb 16 15:00:14 2018
(r329370)
@@ -1,5 +1,5 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 1994-1995 Søren Schmidt
  * All rights reserved.
@@ -8,24 +8,22 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer
- *in this position and unchanged.
+ *notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- 

svn commit: r329369 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 14:59:11 2018
New Revision: 329369
URL: https://svnweb.freebsd.org/changeset/base/329369

Log:
  stand/lua: Remove sneaky kernel assignment

Modified:
  head/stand/lua/core.lua

Modified: head/stand/lua/core.lua
==
--- head/stand/lua/core.lua Fri Feb 16 14:57:42 2018(r329368)
+++ head/stand/lua/core.lua Fri Feb 16 14:59:11 2018(r329369)
@@ -125,7 +125,6 @@ function core.kernelList()
local k = loader.getenv("kernel");
local v = loader.getenv("kernels") or "";
 
-   v = "kernel;kernel.GENERIC"
local kernels = {};
local i = 0;
if k ~= nil then
___
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: r329368 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 14:57:42 2018
New Revision: 329368
URL: https://svnweb.freebsd.org/changeset/base/329368

Log:
  stand/lua: Create/use some MENU_ constants where applicable

Modified:
  head/stand/lua/core.lua
  head/stand/lua/drawer.lua
  head/stand/lua/menu.lua

Modified: head/stand/lua/core.lua
==
--- head/stand/lua/core.lua Fri Feb 16 14:39:41 2018(r329367)
+++ head/stand/lua/core.lua Fri Feb 16 14:57:42 2018(r329368)
@@ -29,11 +29,17 @@
 local core = {};
 
 -- Commonly appearing constants
-core.KEY_ENTER = 13;
-core.KEY_BACKSPACE = 127;
+core.KEY_ENTER = 13;
+core.KEY_BACKSPACE = 127;
 
-core.KEYSTR_ESCAPE = "\027";
+core.KEYSTR_ESCAPE = "\027";
 
+core.MENU_RETURN   = "return";
+core.MENU_ENTRY= "entry";
+core.MENU_SEPARATOR= "separator";
+core.MENU_SUBMENU  = "submenu";
+core.MENU_CAROUSEL_ENTRY   = "carousel_entry";
+
 function core.setVerbose(b)
if (b == nil) then
b = not core.verbose;
@@ -119,6 +125,7 @@ function core.kernelList()
local k = loader.getenv("kernel");
local v = loader.getenv("kernels") or "";
 
+   v = "kernel;kernel.GENERIC"
local kernels = {};
local i = 0;
if k ~= nil then

Modified: head/stand/lua/drawer.lua
==
--- head/stand/lua/drawer.lua   Fri Feb 16 14:39:41 2018(r329367)
+++ head/stand/lua/drawer.lua   Fri Feb 16 14:57:42 2018(r329368)
@@ -29,6 +29,7 @@
 local drawer = {};
 
 local color = require("color");
+local core = require("core");
 local screen = require("screen");
 
 drawer.brand_position = {x = 2, y = 1};
@@ -166,12 +167,12 @@ function drawer.drawmenu(m)
local alias_table = {};
local entry_num = 0;
for line_num, e in ipairs(m) do
-   if (e.entry_type ~= "separator") then
+   if (e.entry_type ~= core.MENU_SEPARATOR) then
entry_num = entry_num + 1;
screen.setcursor(x, y + line_num);
local name = "";
 
-   if (e.entry_type == "carousel_entry") then
+   if (e.entry_type == core.MENU_CAROUSEL_ENTRY) then
local carid = e.carousel_id;
local caridx = menu.getCarouselIndex(carid);
local choices = e.items();

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Fri Feb 16 14:39:41 2018(r329367)
+++ head/stand/lua/menu.lua Fri Feb 16 14:57:42 2018(r329368)
@@ -50,7 +50,7 @@ local welcome;
 menu.boot_options = {
-- return to welcome menu
{
-   entry_type = "return",
+   entry_type = core.MENU_RETURN,
name = function()
return "Back to main menu"..color.highlight(" 
[Backspace]");
end
@@ -58,7 +58,7 @@ menu.boot_options = {
 
-- load defaults
{
-   entry_type = "entry",
+   entry_type = core.MENU_ENTRY,
name = function()
return "Load System "..color.highlight("D").."efaults";
end,
@@ -69,14 +69,14 @@ menu.boot_options = {
},
 
{
-   entry_type = "separator",
+   entry_type = core.MENU_SEPARATOR,
name = function()
return "";
end
},
 
{
-   entry_type = "separator",
+   entry_type = core.MENU_SEPARATOR,
name = function()
return "Boot Options:";
end
@@ -84,7 +84,7 @@ menu.boot_options = {
 
-- acpi
{
-   entry_type = "entry",
+   entry_type = core.MENU_ENTRY,
name = function()
return OnOff(color.highlight("A").."CPI   :", 
core.acpi);
end,
@@ -95,7 +95,7 @@ menu.boot_options = {
},
-- safe mode
{
-   entry_type = "entry",
+   entry_type = core.MENU_ENTRY,
name = function()
return OnOff("Safe "..color.highlight("M").."ode  :", 
core.sm);
end,
@@ -106,7 +106,7 @@ menu.boot_options = {
},
-- single user
{
-   entry_type = "entry",
+   entry_type = core.MENU_ENTRY,
name = function()
return OnOff(color.highlight("S").."ingle user:", 
core.su);
end,
@@ -117,7 +117,7 @@ menu.boot_options = {
},
-- verbose boot
{
-   entry_type = "entry",
+   entry_type = core.MENU_ENTRY,
  

svn commit: r329367 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 14:39:41 2018
New Revision: 329367
URL: https://svnweb.freebsd.org/changeset/base/329367

Log:
  stand/lua: Create a "carousel" menu entry type
  
  This is a pre-cursor to boot environment support in lualoader. Create a new
  menu item type, "carousel_entry", that generally provides a callback to get
  the list of items, a carousel_id for storing the current value, and the
  standard name/func functions that an entry has.
  
  The difference between this and a normal menu item, functionally, is that
  selecting a carousel item will automatically rotate through available items
  and wrap back at the beginning when the list is exhausted.
  
  The 'name' function takes the choice index, current choice, and the list of
  choices as parameters so that the menu item can decorate the name freely as
  desired.
  
  The 'func' function takes the current choice as a parameter, so it can act
  accordingly.
  
  The kernel menu item has been rewritten to use the carousel_entry type as
  both an example and initial test of its functionality before it is used for
  boot environment options.

Modified:
  head/stand/lua/drawer.lua
  head/stand/lua/menu.lua

Modified: head/stand/lua/drawer.lua
==
--- head/stand/lua/drawer.lua   Fri Feb 16 13:57:43 2018(r329366)
+++ head/stand/lua/drawer.lua   Fri Feb 16 14:39:41 2018(r329367)
@@ -169,7 +169,21 @@ function drawer.drawmenu(m)
if (e.entry_type ~= "separator") then
entry_num = entry_num + 1;
screen.setcursor(x, y + line_num);
-   print(entry_num .. ". "..e.name());
+   local name = "";
+
+   if (e.entry_type == "carousel_entry") then
+   local carid = e.carousel_id;
+   local caridx = menu.getCarouselIndex(carid);
+   local choices = e.items();
+
+   if (#choices < caridx) then
+   caridx = 1;
+   end;
+   name = e.name(caridx, choices[caridx], choices);
+   else
+   name = e.name();
+   end
+   print(entry_num .. ". "..name);
 
-- fill the alias table
alias_table[tostring(entry_num)] = e;

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Fri Feb 16 13:57:43 2018(r329366)
+++ head/stand/lua/menu.lua Fri Feb 16 14:39:41 2018(r329367)
@@ -39,7 +39,7 @@ local OnOff;
 local skip;
 local run;
 local autoboot;
-local current_kernel_index = 1;
+local carousel_choices = {};
 
 --loader menu tree:
 --rooted at menu.welcome
@@ -193,34 +193,25 @@ menu.welcome = {
 
-- kernel options
{
-   entry_type = "entry",
-   name = function()
-   local kernels = core.kernelList();
-   if #kernels == 0 then
+   entry_type = "carousel_entry",
+   carousel_id = "kernel",
+   items = core.kernelList,
+   name = function(idx, choice, all_choices)
+   if #all_choices == 0 then
return "Kernel: ";
end
 
local kernel_name = color.escapef(color.GREEN) ..
-   kernels[current_kernel_index] .. color.default();
-   if (current_kernel_index == 1) then
+   choice .. color.default();
+   if (idx == 1) then
kernel_name = "default/" .. kernel_name;
end
return color.highlight("K").."ernel: " .. kernel_name ..
-   " (" .. current_kernel_index ..
-   " of " .. #kernels .. ")";
+   " (" .. idx ..
+   " of " .. #all_choices .. ")";
end,
-   func = function()
-
-   -- dynamically build the kernel menu:
-   local kernels = core.kernelList();
-   -- Don't do anything if we don't have multiple kernels
-   if #kernels <= 1 then
-   return nil;
-   end
-   current_kernel_index = (current_kernel_index % #kernels)
-   + 1;
-   local current_kernel = kernels[current_kernel_index];
-   config.reload(current_kernel)
+   func = function(choice)
+   config.reload(choice);
end,
 

Re: svn commit: r329269 - head/stand/i386/boot2

2018-02-16 Thread Bruce Evans

On Wed, 14 Feb 2018, Benno Rice wrote:


Log:
 Reformat to come significantly closer to style(9).


This gives unreadable diffs.  It does more than reformatting.  Bugs have been
reported.  They must be in the non-reformatting changes.


Modified: head/stand/i386/boot2/boot2.c
==
--- head/stand/i386/boot2/boot2.c   Wed Feb 14 18:05:37 2018
(r329268)
+++ head/stand/i386/boot2/boot2.c   Wed Feb 14 18:07:27 2018
(r329269)
...
#if SERIAL
-   } else if (c == 'S') {
-   j = 0;
-   while ((unsigned int)(i = *arg++ - '0') <= 9)
-   j = j * 10 + i;
-   if (j > 0 && i == -'0') {
-   comspeed = j;
-   break;
-   }
-   /* Fall through to error below ('S' not in optstr[]). */
+   } else if (c == 'S') {
+   j = 0;
+   while (*arg <= '9') {
+   i = (unsigned int)(*arg - '0');
+   j = j * 10 + i;
+   arg++;
+   }
+   if (j > 0 && i == -'0') {
+   comspeed = j;
+   break;
+   }
+   /*
+* Fall through to error below
+* ('S' not in optstr[]).
+*/
#endif


The bugs seem to be only here.  The old code uses a bogus cast to
obfuscate its classification of digits.  The change breaks the
classification of digits by moving the cast to a place where it has
no effect.  Even space separators and '\0' terminators are now
misclassified as digits.  Space separators seem to be broken anyway,
so -S only worked if it is the last arg.  Now it never works, since
the terminating char is never '\0'.

Moving the increment of 'arg' is risky but seems to have no effect
since -S must be at the end to work so no further advance of arg is
useful.

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"


Re: svn commit: r329349 - head/stand/lua

2018-02-16 Thread Kyle Evans
On Thu, Feb 15, 2018 at 9:12 PM, Kyle Evans  wrote:
> Author: kevans
> Date: Fri Feb 16 03:12:24 2018
> New Revision: 329349
> URL: https://svnweb.freebsd.org/changeset/base/329349
>
> Log:
>   stand/lua: Reduce magic numbers
>
>   Enter/backspace values are hardcoded in both the menu and password scripts.
>   Separate these out to core for reuse between the two.
>
> Modified:
>   head/stand/lua/core.lua
>   head/stand/lua/menu.lua
>   head/stand/lua/password.lua
>
> Modified: head/stand/lua/core.lua
> ==
> --- head/stand/lua/core.lua Fri Feb 16 01:33:01 2018(r329348)
> +++ head/stand/lua/core.lua Fri Feb 16 03:12:24 2018(r329349)
> @@ -28,6 +28,10 @@
>
>  local core = {};
>
> +-- Commonly appearing constants
> +core.KEY_ENTER = 13
> +core.KEY_BACKSPACE = 127
> +
>  function core.setVerbose(b)
> if (b == nil) then
> b = not core.verbose;
>
> Modified: head/stand/lua/menu.lua
> ==
> --- head/stand/lua/menu.lua Fri Feb 16 01:33:01 2018(r329348)
> +++ head/stand/lua/menu.lua Fri Feb 16 03:12:24 2018(r329349)
> @@ -273,9 +273,9 @@ function menu.run(m)
> local key = io.getchar();
>
> -- Special key behaviors
> -   if (key == 127) and (m ~= menu.welcome) then
> +   if (key == core.KEY_BACKSPACE) and (m ~= menu.welcome) then
> break
> -   elseif (key == 13) then
> +   elseif (key == core.KEY_ENTER) then
> core.boot();
> -- Should not return
> end
> @@ -357,7 +357,7 @@ function menu.autoboot()
> screen.defcursor();
> if io.ischar() then
> local ch = io.getchar();
> -   if ch == 13 then
> +   if ch == core.KEY_ENTER then
> break;
> else
> -- prevent autoboot when escaping to 
> interpreter
>
> Modified: head/stand/lua/password.lua
> ==
> --- head/stand/lua/password.lua Fri Feb 16 01:33:01 2018(r329348)
> +++ head/stand/lua/password.lua Fri Feb 16 03:12:24 2018(r329349)
> @@ -37,11 +37,11 @@ function password.read()
>
> repeat
> ch = io.getchar();
> -   if ch == 13 then
> +   if ch == core.KEY_ENTER then
> break;
> end
>
> -   if ch == 8 then
> +   if ch == core.KEY_BACKSPACE then

It's worth noting that this changes the comparison from 'ch == 8' to
'ch == 127'. The password prompt was non-functional on my test systems
until this change, because I can never type my password right the
first time. =)

Pointed out by: cem@
___
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: r329366 - head/stand/lua

2018-02-16 Thread Kyle Evans
Author: kevans
Date: Fri Feb 16 13:57:43 2018
New Revision: 329366
URL: https://svnweb.freebsd.org/changeset/base/329366

Log:
  stand/lua: Set ACPI's default the proper way (setACPI)

Modified:
  head/stand/lua/core.lua

Modified: head/stand/lua/core.lua
==
--- head/stand/lua/core.lua Fri Feb 16 13:32:46 2018(r329365)
+++ head/stand/lua/core.lua Fri Feb 16 13:57:43 2018(r329366)
@@ -171,5 +171,5 @@ function core.bootserial()
return false;
 end
 
-core.acpi = core.getACPIPresent(false);
+core.setACPI(core.getACPIPresent(false))
 return core
___
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: r329365 - head/sys/amd64/include

2018-02-16 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 16 13:32:46 2018
New Revision: 329365
URL: https://svnweb.freebsd.org/changeset/base/329365

Log:
  Use local symbol for offset.
  
  Small global symbols confuse ddb which matches them against small
  unrelated displacements and makes the disassembly ugly.
  
  Reported by:  bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/amd64/include/asmacros.h
==
--- head/sys/amd64/include/asmacros.h   Fri Feb 16 07:02:14 2018
(r329364)
+++ head/sys/amd64/include/asmacros.h   Fri Feb 16 13:32:46 2018
(r329365)
@@ -175,11 +175,11 @@
.endm
 
.macro  MOVE_STACKS qw
-   offset=0
+   .L.offset=0
.rept   \qw
-   movqoffset(%rsp),%rdx
-   movq%rdx,offset(%rax)
-   offset=offset+8
+   movq.L.offset(%rsp),%rdx
+   movq%rdx,.L.offset(%rax)
+   .L.offset=.L.offset+8
.endr
.endm
 
___
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: r329269 - head/stand/i386/boot2

2018-02-16 Thread Olivier Cochard-Labbé
On Wed, Feb 14, 2018 at 7:07 PM, Benno Rice  wrote:

> Author: benno
> Date: Wed Feb 14 18:07:27 2018
> New Revision: 329269
> URL: https://svnweb.freebsd.org/changeset/base/329269
>
> Log:
>   Reformat to come significantly closer to style(9).
>
>   Reviewed by:  imp, jhibbits
>   Differential Revision:https://reviews.freebsd.org/D14366
>
> Modified:
>   head/stand/i386/boot2/boot2.c
>
>
​Hi,

I've got 2 regressions with this commit on my headless servers (Netgate RCC
and PC Engines​
​).

I'm using this configuration file on all my headless servers:
[root@netgate]~# cat /boot.config
-S115200 -h

Now with this commit, I meet a first regression: they all stop to boot
automatically at the boot stage.

**
/boot/config: -S115200 -h

FreeBSD/x86 boot
Default: 0:ad(0,a)/boot/loader
boot:
***

I had to connect to the serial console and to press "enter" here for
continuing the boot process.
Once the boot process go to the next stage, I meet the second regression:
loader menu is correctly displayed, but dmesg messages are no visible on
the console.

Regards,

Olivier
___
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"