svn commit: r332986 - head/usr.sbin/makefs

2018-04-24 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Apr 25 02:43:53 2018
New Revision: 332986
URL: https://svnweb.freebsd.org/changeset/base/332986

Log:
  makefs: Use ENODATA instead of ENOMSG as a translation for missing ENOATTR.
  
  This is consistent with what some linux filesystems do and has been
  adopted in our linuxulator.
  
  MFC after:3 days

Modified:
  head/usr.sbin/makefs/mtree.c

Modified: head/usr.sbin/makefs/mtree.c
==
--- head/usr.sbin/makefs/mtree.cWed Apr 25 02:42:57 2018
(r332985)
+++ head/usr.sbin/makefs/mtree.cWed Apr 25 02:43:53 2018
(r332986)
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
 #include "makefs.h"
 
 #ifndef ENOATTR
-#defineENOATTR ENOMSG
+#defineENOATTR ENODATA
 #endif
 
 #defineIS_DOT(nm)  ((nm)[0] == '.' && (nm)[1] == '\0')
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332985 - head/stand/forth

2018-04-24 Thread Kyle Evans
Author: kevans
Date: Wed Apr 25 02:42:57 2018
New Revision: 332985
URL: https://svnweb.freebsd.org/changeset/base/332985

Log:
  forthloader: Remove "EFI boot environment message"
  
  Contrary to what the message says, this is not only executed in an EFI
  context- it provides functions for use in an EFI environment. I don't think
  there's much reason to broadcast this fact when we haven't in the past, so
  just remove it.
  
  Reported by:  emaste (a while ago), cperciva

Modified:
  head/stand/forth/efi.4th

Modified: head/stand/forth/efi.4th
==
--- head/stand/forth/efi.4thWed Apr 25 02:42:11 2018(r332984)
+++ head/stand/forth/efi.4thWed Apr 25 02:42:57 2018(r332985)
@@ -37,5 +37,3 @@ only forth definitions
s" efi-autoresizecons" evaluate
then
 ;
-
-.( EFI boot environment) cr
___
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: r332980 - in stable/11/usr.sbin/makefs: . cd9660 ffs

2018-04-24 Thread Pedro Giffuni



On 04/24/18 21:15, Benno Rice wrote:



On Apr 24, 2018, at 9:50 PM, Pedro Giffuni > wrote:




On 24/04/2018 20:35, Benno Rice wrote:

Author: benno
Date: Wed Apr 25 01:35:06 2018
New Revision: 332980
URL: https://svnweb.freebsd.org/changeset/base/332980

Log:
  MFC r307927
  Be more precise when including headers so that we're less 
likely to

   depend on namespace pollution and as such become more portable. This
   means including headers like  or , but also
   making sure we include system/host headers before local headers.
  While here: define ENOATTR as ENOMSG in mtree.c. There is no 
ENOATTR

   on Linux.


Nope.
...


Modified: stable/11/usr.sbin/makefs/mtree.c
==
--- stable/11/usr.sbin/makefs/mtree.cWed Apr 25 01:30:29 2018(r332979)
+++ stable/11/usr.sbin/makefs/mtree.cWed Apr 25 01:35:06 2018(r332980)
@@ -46,10 +46,15 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
   #include "makefs.h"
+
+#ifndef ENOATTR
+#defineENOATTRENOMSG
+#endif
   #defineIS_DOT(nm)((nm)[0] == '.' && (nm)[1] == '\0')
 #defineIS_DOTDOT(nm)((nm)[0] == '.' && (nm)[1] == '.' && (nm)[2] == 
'\0')


This should be ENODATA, see r326282 for reference.


This is an old change I MFC’ed but did not originally author. Merging 
it reduced conflicts with other changes I needed to merge in order to 
merge the EFI changes for El Torito. I’m more than happy if someone 
wants to fix this up in head.



I see, good find then ;).

Thanks,

Pedro.

___
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: r332984 - head/sys/powerpc/ofw

2018-04-24 Thread Justin Hibbits
Author: jhibbits
Date: Wed Apr 25 02:42:11 2018
New Revision: 332984
URL: https://svnweb.freebsd.org/changeset/base/332984

Log:
  Increase the fdtmemreserv array limit to boot on POWER9
  
  Discussing with others, this needs to be at least 20 to boot on some POWER9
  nodes.  Linux made a similar change for the same reason, so increase to 32
  to give us some extra breathing room as well.  The input and output arrays
  are sized at 256, so much greater than the increase in the property array
  size.

Modified:
  head/sys/powerpc/ofw/ofw_machdep.c

Modified: head/sys/powerpc/ofw/ofw_machdep.c
==
--- head/sys/powerpc/ofw/ofw_machdep.c  Wed Apr 25 01:59:15 2018
(r332983)
+++ head/sys/powerpc/ofw/ofw_machdep.c  Wed Apr 25 02:42:11 2018
(r332984)
@@ -230,7 +230,7 @@ excise_fdt_reserved(struct mem_region *avail, int asz)
struct {
uint64_t address;
uint64_t size;
-   } fdtmap[16];
+   } fdtmap[32];
ssize_t fdtmapsize;
phandle_t chosen;
int i, j, k;
___
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: r332980 - in stable/11/usr.sbin/makefs: . cd9660 ffs

2018-04-24 Thread Benno Rice


> On Apr 24, 2018, at 9:50 PM, Pedro Giffuni  wrote:
> 
> 
> 
> On 24/04/2018 20:35, Benno Rice wrote:
>> Author: benno
>> Date: Wed Apr 25 01:35:06 2018
>> New Revision: 332980
>> URL: https://svnweb.freebsd.org/changeset/base/332980
>> 
>> Log:
>>   MFC r307927
>>   Be more precise when including headers so that we're less likely to
>>depend on namespace pollution and as such become more portable. This
>>means including headers like  or , but also
>>making sure we include system/host headers before local headers.
>>   While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR
>>on Linux.
>>   
> Nope.
> ...
> 
>> Modified: stable/11/usr.sbin/makefs/mtree.c
>> ==
>> --- stable/11/usr.sbin/makefs/mtree.cWed Apr 25 01:30:29 2018
>> (r332979)
>> +++ stable/11/usr.sbin/makefs/mtree.cWed Apr 25 01:35:06 2018
>> (r332980)
>> @@ -46,10 +46,15 @@ __FBSDID("$FreeBSD$");
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>#include "makefs.h"
>> +
>> +#ifndef ENOATTR
>> +#define ENOATTR ENOMSG
>> +#endif
>>#define   IS_DOT(nm)  ((nm)[0] == '.' && (nm)[1] == '\0')
>>  #define IS_DOTDOT(nm)   ((nm)[0] == '.' && (nm)[1] == '.' && (nm)[2] == 
>> '\0')
> 
> This should be ENODATA, see r326282 for reference.

This is an old change I MFC’ed but did not originally author. Merging it 
reduced conflicts with other changes I needed to merge in order to merge the 
EFI changes for El Torito. I’m more than happy if someone wants to fix this up 
in head.

Thanks,
Benno.
___
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: r332980 - in stable/11/usr.sbin/makefs: . cd9660 ffs

2018-04-24 Thread Pedro Giffuni



On 24/04/2018 20:35, Benno Rice wrote:

Author: benno
Date: Wed Apr 25 01:35:06 2018
New Revision: 332980
URL: https://svnweb.freebsd.org/changeset/base/332980

Log:
   MFC r307927
   
Be more precise when including headers so that we're less likely to

depend on namespace pollution and as such become more portable. This
means including headers like  or , but also
making sure we include system/host headers before local headers.
   
While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR

on Linux.
   

Nope.
...


Modified: stable/11/usr.sbin/makefs/mtree.c
==
--- stable/11/usr.sbin/makefs/mtree.c   Wed Apr 25 01:30:29 2018
(r332979)
+++ stable/11/usr.sbin/makefs/mtree.c   Wed Apr 25 01:35:06 2018
(r332980)
@@ -46,10 +46,15 @@ __FBSDID("$FreeBSD$");
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  
  #include "makefs.h"

+
+#ifndef ENOATTR
+#defineENOATTR ENOMSG
+#endif
  
  #define	IS_DOT(nm)	((nm)[0] == '.' && (nm)[1] == '\0')

  #define   IS_DOTDOT(nm)   ((nm)[0] == '.' && (nm)[1] == '.' && (nm)[2] == 
'\0')


This should be ENODATA, see r326282 for reference.

Cheers,

Pedro.


___
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: r332983 - in stable/11/usr.sbin/makefs: . cd9660

2018-04-24 Thread Benno Rice
Author: benno
Date: Wed Apr 25 01:59:15 2018
New Revision: 332983
URL: https://svnweb.freebsd.org/changeset/base/332983

Log:
  MFC r331463 (partial), r331467, r331468, r331843
  
  r331463, r331467, and r331468 are all replaced by r331843 but are included for
  completeness' sake. r331463 also contained a change to
  release/amd64/mkisoimages.sh which I've left out since those changes were
  also obsoleted by a later commit which will be merged later.
  
  r331843:
  
   Synchronise with NetBSD's version of EFI handling for El Torito images.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/usr.sbin/makefs/cd9660.c
  stable/11/usr.sbin/makefs/cd9660/cd9660_eltorito.c
  stable/11/usr.sbin/makefs/cd9660/cd9660_eltorito.h
  stable/11/usr.sbin/makefs/makefs.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/makefs/cd9660.c
==
--- stable/11/usr.sbin/makefs/cd9660.c  Wed Apr 25 01:54:24 2018
(r332982)
+++ stable/11/usr.sbin/makefs/cd9660.c  Wed Apr 25 01:59:15 2018
(r332983)
@@ -312,6 +312,7 @@ cd9660_prep_opts(fsinfo_t *fsopts)
OPT_STR('\0', "no-boot", "No boot support"),
OPT_STR('\0', "hard-disk-boot", "Boot from hard disk"),
OPT_STR('\0', "boot-load-segment", "Boot load segment"),
+   OPT_STR('\0', "platformid", "Section Header Platform ID"),
 
{ .name = NULL }
};
@@ -447,7 +448,8 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts
/* RRIP */
cd9660_eltorito_add_boot_option(diskStructure, name, 0);
rv = 1;
-   } else if (strcmp(name, "boot-load-segment") == 0) {
+   } else if (strcmp(name, "boot-load-segment") == 0 ||
+   strcmp(name, "platformid") == 0) {
if (buf[0] == '\0') {
warnx("Option `%s' doesn't contain a value",
name);

Modified: stable/11/usr.sbin/makefs/cd9660/cd9660_eltorito.c
==
--- stable/11/usr.sbin/makefs/cd9660/cd9660_eltorito.c  Wed Apr 25 01:54:24 
2018(r332982)
+++ stable/11/usr.sbin/makefs/cd9660/cd9660_eltorito.c  Wed Apr 25 01:59:15 
2018(r332983)
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660_eltorito.c,v 1.17 2011/06/23 02:35:56 enami Exp $   
*/
+/* $NetBSD: cd9660_eltorito.c,v 1.23 2018/03/28 06:48:55 nonaka Exp $  
*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -47,16 +47,19 @@ __FBSDID("$FreeBSD$");
 #defineELTORITO_DPRINTF(__x)
 #endif
 
+#include 
+
 static struct boot_catalog_entry *cd9660_init_boot_catalog_entry(void);
 static struct boot_catalog_entry *cd9660_boot_setup_validation_entry(char);
 static struct boot_catalog_entry *cd9660_boot_setup_default_entry(
 struct cd9660_boot_image *);
 static struct boot_catalog_entry *cd9660_boot_setup_section_head(char);
-static struct boot_catalog_entry *cd9660_boot_setup_validation_entry(char);
 #if 0
 static u_char cd9660_boot_get_system_type(struct cd9660_boot_image *);
 #endif
 
+static struct cd9660_boot_image *default_boot_image;
+
 int
 cd9660_add_boot_disk(iso9660_disk *diskStructure, const char *boot_info)
 {
@@ -171,9 +174,15 @@ cd9660_add_boot_disk(iso9660_disk *diskStructure, cons
 
new_image->serialno = diskStructure->image_serialno++;
 
+   new_image->platform_id = new_image->system;
+
/* TODO : Need to do anything about the boot image in the tree? */
diskStructure->is_bootable = 1;
 
+   /* First boot image is initial/default entry. */
+   if (default_boot_image == NULL)
+   default_boot_image = new_image;
+
return 1;
 }
 
@@ -207,6 +216,13 @@ cd9660_eltorito_add_boot_option(iso9660_disk *diskStru
warn("%s: strtoul", __func__);
return 0;
}
+   } else if (strcmp(option_string, "platformid") == 0) {
+   if (strcmp(value, "efi") == 0)
+   image->platform_id = ET_SYS_EFI;
+   else {
+   warn("%s: unknown platform: %s", __func__, value);
+   return 0;
+   }
} else {
return 0;
}
@@ -229,6 +245,7 @@ cd9660_boot_setup_validation_entry(char sys)
int i;
entry = cd9660_init_boot_catalog_entry();
 
+   entry->entry_type = ET_ENTRY_VE;
ve = >entry_data.VE;
 
ve->header_id[0] = 1;
@@ -263,6 +280,7 @@ cd9660_boot_setup_default_entry(struct cd9660_boot_ima
if (default_entry == NULL)
return NULL;
 
+   default_entry->entry_type = ET_ENTRY_IE;
ie = _entry->entry_data.IE;
 
ie->boot_indicator[0] = disk->bootable;
@@ -290,8 +308,12 @@ cd9660_boot_setup_section_head(char 

svn commit: r332982 - stable/11/release/tools

2018-04-24 Thread Colin Percival
Author: cperciva
Date: Wed Apr 25 01:54:24 2018
New Revision: 332982
URL: https://svnweb.freebsd.org/changeset/base/332982

Log:
  MFC r332663: Move panic-related settings from sysctl.conf to loader.conf so
  that they apply if an EC2 instance panics while booting.
  
  Sponsored by: https://www.patreon.com/cperciva

Modified:
  stable/11/release/tools/ec2.conf
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/release/tools/ec2.conf
==
--- stable/11/release/tools/ec2.confWed Apr 25 01:48:15 2018
(r332981)
+++ stable/11/release/tools/ec2.confWed Apr 25 01:54:24 2018
(r332982)
@@ -60,9 +60,9 @@ vm_extra_pre_umount() {
# The EC2 console is output-only, so while printing a backtrace can
# be useful, there's no point dropping into a debugger or waiting
# for a keypress.
-   echo 'debug.trace_on_panic=1' >> ${DESTDIR}/etc/sysctl.conf
-   echo 'debug.debugger_on_panic=0' >> ${DESTDIR}/etc/sysctl.conf
-   echo 'kern.panic_reboot_wait_time=0' >> ${DESTDIR}/etc/sysctl.conf
+   echo 'debug.trace_on_panic=1' >> ${DESTDIR}/boot/loader.conf
+   echo 'debug.debugger_on_panic=0' >> ${DESTDIR}/boot/loader.conf
+   echo 'kern.panic_reboot_wait_time=0' >> ${DESTDIR}/boot/loader.conf
 
# The console is not interactive, so we might as well boot quickly.
echo 'autoboot_delay="-1"' >> ${DESTDIR}/boot/loader.conf
___
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: r332981 - in stable/11/usr.sbin/makefs: . cd9660 ffs

2018-04-24 Thread Benno Rice
Author: benno
Date: Wed Apr 25 01:48:15 2018
New Revision: 332981
URL: https://svnweb.freebsd.org/changeset/base/332981

Log:
  MFC r316579
  
   makefs: use emalloc and friends
  
   The emalloc set of error-checking memory allocation routines were added
   to libnetbsd in r316572. Use them in makefs to reduce differences with
   NetBSD.
  
   NetBSD revs:
   cd9660.c 1.39
   ffs.c1.56
   makefs.c 1.42
   walk.c   1.27
   cd9660/cd9660_archimedes.c   1.2
   cd9660/cd9660_eltorito.c 1.20
   cd9660/cd9660_write.c1.16
   cd9660/iso9660_rrip.c1.12
   ffs/buf.c1.17
   ffs/mkfs.c   1.26
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/usr.sbin/makefs/cd9660.c
  stable/11/usr.sbin/makefs/cd9660/cd9660_archimedes.c
  stable/11/usr.sbin/makefs/cd9660/cd9660_eltorito.c
  stable/11/usr.sbin/makefs/cd9660/cd9660_write.c
  stable/11/usr.sbin/makefs/cd9660/iso9660_rrip.c
  stable/11/usr.sbin/makefs/ffs.c
  stable/11/usr.sbin/makefs/ffs/buf.c
  stable/11/usr.sbin/makefs/ffs/mkfs.c
  stable/11/usr.sbin/makefs/makefs.c
  stable/11/usr.sbin/makefs/mtree.c
  stable/11/usr.sbin/makefs/walk.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/makefs/cd9660.c
==
--- stable/11/usr.sbin/makefs/cd9660.c  Wed Apr 25 01:35:06 2018
(r332980)
+++ stable/11/usr.sbin/makefs/cd9660.c  Wed Apr 25 01:48:15 2018
(r332981)
@@ -105,6 +105,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include "makefs.h"
 #include "cd9660.h"
@@ -173,10 +174,8 @@ static cd9660node *cd9660_create_special_directory(iso
 static cd9660node *
 cd9660_allocate_cd9660node(void)
 {
-   cd9660node *temp;
+   cd9660node *temp = ecalloc(1, sizeof(*temp));
 
-   if ((temp = calloc(1, sizeof(cd9660node))) == NULL)
-   err(EXIT_FAILURE, "%s: calloc", __func__);
TAILQ_INIT(>cn_children);
temp->parent = temp->dot_record = temp->dot_dot_record = NULL;
temp->ptnext = temp->ptprev = temp->ptlast = NULL;
@@ -253,11 +252,8 @@ cd9660_set_defaults(iso9660_disk *diskStructure)
 void
 cd9660_prep_opts(fsinfo_t *fsopts)
 {
-   iso9660_disk *diskStructure;
+   iso9660_disk *diskStructure = ecalloc(1, sizeof(*diskStructure));
 
-   if ((diskStructure = calloc(1, sizeof(*diskStructure))) == NULL)
-   err(EXIT_FAILURE, "%s: calloc", __func__);
-
 #define OPT_STR(letter, name, desc) \
{ letter, name, NULL, OPT_STRBUF, 0, 0, desc }
 
@@ -440,9 +436,7 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts
rv = 0;
} else {
diskStructure->boot_image_directory =
-   malloc(strlen(buf) + 1);
-   if (diskStructure->boot_image_directory == NULL)
-   err(1, "malloc");
+   emalloc(strlen(buf) + 1);
/* BIG TODO: Add the max length function here */
rv = cd9660_arguments_set_string(buf, desc, 12,
'd', diskStructure->boot_image_directory);
@@ -522,12 +516,7 @@ cd9660_makefs(const char *image, const char *dir, fsno
/* Actually, we now need to add the REAL root node, at level 0 */
 
real_root = cd9660_allocate_cd9660node();
-   if ((real_root->isoDirRecord =
-   malloc( sizeof(iso_directory_record_cd9660) )) == NULL) {
-   CD9660_MEM_ALLOC_ERROR("cd9660_makefs");
-   exit(1);
-   }
-
+   real_root->isoDirRecord = emalloc(sizeof(*real_root->isoDirRecord));
/* Leave filename blank for root */
memset(real_root->isoDirRecord->name, 0,
ISO_FILENAME_MAXLENGTH_WITH_PADDING);
@@ -769,11 +758,7 @@ cd9660_setup_volume_descriptors(iso9660_disk *diskStru
volume_descriptor *temp, *t;
 
/* Set up the PVD */
-   if ((temp = malloc(sizeof(volume_descriptor))) == NULL) {
-   CD9660_MEM_ALLOC_ERROR("cd9660_setup_volume_descriptors");
-   exit(1);
-   }
-
+   temp = emalloc(sizeof(*temp));
temp->volumeDescriptorData =
   (unsigned char *)>primaryDescriptor;
temp->volumeDescriptorData[0] = ISO_VOLUME_DESCRIPTOR_PVD;
@@ -786,19 +771,10 @@ cd9660_setup_volume_descriptors(iso9660_disk *diskStru
sector++;
/* Set up boot support if enabled. BVD must reside in sector 17 */
if (diskStructure->is_bootable) {
-   if ((t = malloc(sizeof(volume_descriptor))) == NULL) {
-   CD9660_MEM_ALLOC_ERROR(
-   "cd9660_setup_volume_descriptors");
-   exit(1);
- 

svn commit: r332980 - in stable/11/usr.sbin/makefs: . cd9660 ffs

2018-04-24 Thread Benno Rice
Author: benno
Date: Wed Apr 25 01:35:06 2018
New Revision: 332980
URL: https://svnweb.freebsd.org/changeset/base/332980

Log:
  MFC r307927
  
   Be more precise when including headers so that we're less likely to
   depend on namespace pollution and as such become more portable. This
   means including headers like  or , but also
   making sure we include system/host headers before local headers.
  
   While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR
   on Linux.
  
   With this, makefs is ready for compilation on macOS and Linux.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/usr.sbin/makefs/cd9660.c
  stable/11/usr.sbin/makefs/cd9660/cd9660_archimedes.c
  stable/11/usr.sbin/makefs/cd9660/iso9660_rrip.c
  stable/11/usr.sbin/makefs/ffs/ffs_bswap.c
  stable/11/usr.sbin/makefs/ffs/ffs_subr.c
  stable/11/usr.sbin/makefs/mtree.c
  stable/11/usr.sbin/makefs/walk.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/makefs/cd9660.c
==
--- stable/11/usr.sbin/makefs/cd9660.c  Wed Apr 25 01:30:29 2018
(r332979)
+++ stable/11/usr.sbin/makefs/cd9660.c  Wed Apr 25 01:35:06 2018
(r332980)
@@ -100,10 +100,11 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
-#include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include "makefs.h"
 #include "cd9660.h"

Modified: stable/11/usr.sbin/makefs/cd9660/cd9660_archimedes.c
==
--- stable/11/usr.sbin/makefs/cd9660/cd9660_archimedes.cWed Apr 25 
01:30:29 2018(r332979)
+++ stable/11/usr.sbin/makefs/cd9660/cd9660_archimedes.cWed Apr 25 
01:35:06 2018(r332980)
@@ -42,9 +42,11 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "makefs.h"

Modified: stable/11/usr.sbin/makefs/cd9660/iso9660_rrip.c
==
--- stable/11/usr.sbin/makefs/cd9660/iso9660_rrip.c Wed Apr 25 01:30:29 
2018(r332979)
+++ stable/11/usr.sbin/makefs/cd9660/iso9660_rrip.c Wed Apr 25 01:35:06 
2018(r332980)
@@ -37,14 +37,16 @@
  * defined in iso9660_rrip.h
  */
 
-#include "makefs.h"
-#include "cd9660.h"
-#include "iso9660_rrip.h"
+#include 
+__FBSDID("$FreeBSD$");
+
 #include 
+#include 
 #include 
 
-#include 
-__FBSDID("$FreeBSD$");
+#include "makefs.h"
+#include "cd9660.h"
+#include "iso9660_rrip.h"
 
 static void cd9660_rrip_initialize_inode(cd9660node *);
 static int cd9660_susp_handle_continuation(iso9660_disk *, cd9660node *);

Modified: stable/11/usr.sbin/makefs/ffs/ffs_bswap.c
==
--- stable/11/usr.sbin/makefs/ffs/ffs_bswap.c   Wed Apr 25 01:30:29 2018
(r332979)
+++ stable/11/usr.sbin/makefs/ffs/ffs_bswap.c   Wed Apr 25 01:35:06 2018
(r332980)
@@ -40,17 +40,18 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-#include 
-#include "ffs/ufs_bswap.h"
-#include 
-
 #if !defined(_KERNEL)
 #include 
+#include 
 #include 
 #include 
 #include 
 #define panic(x)   printf("%s\n", (x)), abort()
 #endif
+
+#include 
+#include "ffs/ufs_bswap.h"
+#include 
 
 #definefs_old_postblofffs_spare5[0]
 #definefs_old_rotbloff fs_spare5[1]

Modified: stable/11/usr.sbin/makefs/ffs/ffs_subr.c
==
--- stable/11/usr.sbin/makefs/ffs/ffs_subr.cWed Apr 25 01:30:29 2018
(r332979)
+++ stable/11/usr.sbin/makefs/ffs/ffs_subr.cWed Apr 25 01:35:06 2018
(r332980)
@@ -35,6 +35,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 
 #include 
 #include 

Modified: stable/11/usr.sbin/makefs/mtree.c
==
--- stable/11/usr.sbin/makefs/mtree.c   Wed Apr 25 01:30:29 2018
(r332979)
+++ stable/11/usr.sbin/makefs/mtree.c   Wed Apr 25 01:35:06 2018
(r332980)
@@ -46,10 +46,15 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include "makefs.h"
+
+#ifndef ENOATTR
+#defineENOATTR ENOMSG
+#endif
 
 #defineIS_DOT(nm)  ((nm)[0] == '.' && (nm)[1] == '\0')
 #defineIS_DOTDOT(nm)   ((nm)[0] == '.' && (nm)[1] == '.' && (nm)[2] == 
'\0')

Modified: stable/11/usr.sbin/makefs/walk.c
==
--- stable/11/usr.sbin/makefs/walk.cWed Apr 25 01:30:29 2018
(r332979)
+++ stable/11/usr.sbin/makefs/walk.cWed Apr 25 01:35:06 2018
(r332980)
@@ -42,6 +42,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To 

svn commit: r332979 - stable/11/lib/libnetbsd

2018-04-24 Thread Benno Rice
Author: benno
Date: Wed Apr 25 01:30:29 2018
New Revision: 332979
URL: https://svnweb.freebsd.org/changeset/base/332979

Log:
  MFC r316572
  
   libnetbsd: add emalloc and friends
  
   These are error-checked versions of memory allocation routines used by
   NetBSD code, and are being added to facilitate updates to makefs.
  
  Sponsored by: iXsystems, Inc.

Added:
  stable/11/lib/libnetbsd/efun.c
 - copied unchanged from r316572, head/lib/libnetbsd/efun.c
Modified:
  stable/11/lib/libnetbsd/Makefile
  stable/11/lib/libnetbsd/util.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libnetbsd/Makefile
==
--- stable/11/lib/libnetbsd/MakefileWed Apr 25 01:20:25 2018
(r332978)
+++ stable/11/lib/libnetbsd/MakefileWed Apr 25 01:30:29 2018
(r332979)
@@ -7,7 +7,7 @@ LIB=netbsd
 
 CFLAGS+=   -I${.CURDIR}
 
-SRCS+= sockaddr_snprintf.c strsuftoll.c util.c util.h
+SRCS+= efun.c sockaddr_snprintf.c strsuftoll.c util.c util.h
 
 INTERNALLIB=
 

Copied: stable/11/lib/libnetbsd/efun.c (from r316572, head/lib/libnetbsd/efun.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/lib/libnetbsd/efun.c  Wed Apr 25 01:30:29 2018
(r332979, copy of r316572, head/lib/libnetbsd/efun.c)
@@ -0,0 +1,160 @@
+/* $NetBSD: efun.c,v 1.10 2015/07/26 02:20:30 kamil Exp $  */
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include 
+#ifdef __RCSID
+__RCSID("$NetBSD: efun.c,v 1.10 2015/07/26 02:20:30 kamil Exp $");
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static void (*efunc)(int, const char *, ...) = err;
+
+void (*
+esetfunc(void (*ef)(int, const char *, ...)))(int, const char *, ...)
+{
+   void (*of)(int, const char *, ...) = efunc;
+   efunc = ef == NULL ? (void (*)(int, const char *, ...))exit : ef;
+   return of;
+}
+
+size_t
+estrlcpy(char *dst, const char *src, size_t len)
+{
+   size_t rv;
+   if ((rv = strlcpy(dst, src, len)) >= len) {
+   errno = ENAMETOOLONG;
+   (*efunc)(1,
+   "Cannot copy string; %zu chars needed %zu provided",
+   rv, len);
+   }
+   return rv;
+}
+
+size_t
+estrlcat(char *dst, const char *src, size_t len)
+{
+   size_t rv;
+   if ((rv = strlcat(dst, src, len)) >= len) {
+   errno = ENAMETOOLONG;
+   (*efunc)(1,
+   "Cannot append to string; %zu chars needed %zu provided",
+   rv, len);
+   }
+   return rv;
+}
+
+char *
+estrdup(const char *s)
+{
+   char *d = strdup(s);
+   if (d == NULL)
+   (*efunc)(1, "Cannot copy string");
+   return d;
+}
+
+char *
+estrndup(const char *s, size_t len)
+{
+   char *d = strndup(s, len);
+   if (d == NULL)
+   (*efunc)(1, "Cannot copy string");
+   return d;
+}
+
+void *
+emalloc(size_t n)
+{
+   void *p = malloc(n);
+   if (p == NULL && n != 0)
+   (*efunc)(1, "Cannot allocate %zu bytes", n);
+   return p;
+}
+
+void *
+ecalloc(size_t n, size_t s)
+{
+   void *p = calloc(n, s);
+   if (p == NULL && n != 0 && s != 0)
+   (*efunc)(1, "Cannot allocate %zu blocks of size %zu", n, 

svn commit: r332978 - stable/11/usr.sbin/makefs

2018-04-24 Thread Benno Rice
Author: benno
Date: Wed Apr 25 01:20:25 2018
New Revision: 332978
URL: https://svnweb.freebsd.org/changeset/base/332978

Log:
  MFC r315304
  
   makefs: sync option parsing with NetBSD
  
   - add support for parsing different types; not just int
   - homogenize option parsing
   - fix single letter parsing
   - remove duplicated code
  
   NetBSD revisions:
   cd9660.c1.36 1.37 1.38 1.41 1.42 1.43
   ffs.c   1.50 1.51 1.52 1.53 1.56 1.57
   makefs.c1.36 1.37 1.38 1.39 1.40 1.42 1.43 1.44 1.46
   makefs.h1.28 1.29 1.31 1.32
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/usr.sbin/makefs/cd9660.c
  stable/11/usr.sbin/makefs/cd9660.h
  stable/11/usr.sbin/makefs/ffs.c
  stable/11/usr.sbin/makefs/makefs.c
  stable/11/usr.sbin/makefs/makefs.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/makefs/cd9660.c
==
--- stable/11/usr.sbin/makefs/cd9660.c  Wed Apr 25 01:12:40 2018
(r332977)
+++ stable/11/usr.sbin/makefs/cd9660.c  Wed Apr 25 01:20:25 2018
(r332978)
@@ -257,7 +257,70 @@ cd9660_prep_opts(fsinfo_t *fsopts)
if ((diskStructure = calloc(1, sizeof(*diskStructure))) == NULL)
err(EXIT_FAILURE, "%s: calloc", __func__);
 
+#define OPT_STR(letter, name, desc) \
+   { letter, name, NULL, OPT_STRBUF, 0, 0, desc }
+
+#define OPT_NUM(letter, name, field, min, max, desc) \
+   { letter, name, >field, \
+ sizeof(diskStructure->field) == 8 ? OPT_INT64 : \
+ (sizeof(diskStructure->field) == 4 ? OPT_INT32 : \
+ (sizeof(diskStructure->field) == 2 ? OPT_INT16 : OPT_INT8)), \
+ min, max, desc }
+
+#define OPT_BOOL(letter, name, field, desc) \
+   OPT_NUM(letter, name, field, 0, 1, desc)
+
+   const option_t cd9660_options[] = {
+   OPT_NUM('l', "isolevel", isoLevel,
+   1, 2, "ISO Level"),
+   OPT_NUM('v', "verbose", verbose_level,
+   0, 2, "Turns on verbose output"),
+
+   OPT_BOOL('h', "help", displayHelp,
+   "Show help message"),
+   OPT_BOOL('S', "follow-symlinks", follow_sym_links,
+   "Resolve symlinks in pathnames"),
+   OPT_BOOL('R', "rockridge", rock_ridge_enabled,
+   "Enable Rock-Ridge extensions"),
+   OPT_BOOL('C', "chrp-boot", chrp_boot,
+   "Enable CHRP boot"),
+   OPT_BOOL('K', "keep-bad-images", keep_bad_images,
+   "Keep bad images"),
+   OPT_BOOL('D', "allow-deep-trees", allow_deep_trees,
+   "Allow trees more than 8 levels"),
+   OPT_BOOL('a', "allow-max-name", allow_max_name,
+   "Allow 37 char filenames (unimplemented)"),
+   OPT_BOOL('i', "allow-illegal-chars", allow_illegal_chars,
+   "Allow illegal characters in filenames"),
+   OPT_BOOL('d', "allow-multidot", allow_multidot,
+   "Allow multiple periods in filenames"),
+   OPT_BOOL('o', "omit-trailing-period", omit_trailing_period,
+   "Omit trailing periods in filenames"),
+   OPT_BOOL('\0', "allow-lowercase", allow_lowercase,
+   "Allow lowercase characters in filenames"),
+   OPT_BOOL('\0', "archimedes", archimedes_enabled,
+   "Enable Archimedes structure"),
+   OPT_BOOL('\0', "no-trailing-padding", include_padding_areas,
+   "Include padding areas"),
+
+   OPT_STR('A', "applicationid", "Application Identifier"),
+   OPT_STR('P', "publisher", "Publisher Identifier"),
+   OPT_STR('p', "preparer", "Preparer Identifier"),
+   OPT_STR('L', "label", "Disk Label"),
+   OPT_STR('V', "volumeid", "Volume Set Identifier"),
+   OPT_STR('B', "bootimage", "Boot image parameter"),
+   OPT_STR('G', "generic-bootimage", "Generic boot image param"),
+   OPT_STR('\0', "bootimagedir", "Boot image directory"),
+   OPT_STR('\0', "no-emul-boot", "No boot emulation"),
+   OPT_STR('\0', "no-boot", "No boot support"),
+   OPT_STR('\0', "hard-disk-boot", "Boot from hard disk"),
+   OPT_STR('\0', "boot-load-segment", "Boot load segment"),
+
+   { .name = NULL }
+   };
+
fsopts->fs_specific = diskStructure;
+   fsopts->fs_options = copy_opts(cd9660_options);
 
cd9660_set_defaults(diskStructure);
 }
@@ -266,6 +329,7 @@ void
 cd9660_cleanup_opts(fsinfo_t *fsopts)
 {
free(fsopts->fs_specific);
+   free(fsopts->fs_options);
 }
 
 static int
@@ -302,144 +366,106 @@ cd9660_arguments_set_string(const char *val, const cha
 int
 cd9660_parse_opts(const char *option, fsinfo_t *fsopts)
 {
-   char *var, *val;
-   int rv;
+   int

svn commit: r332977 - in stable/11/usr.sbin/makefs: . cd9660

2018-04-24 Thread Benno Rice
Author: benno
Date: Wed Apr 25 01:12:40 2018
New Revision: 332977
URL: https://svnweb.freebsd.org/changeset/base/332977

Log:
  MFC r314117
  
   makefs: eliminate global cd9660 structure
  
   For diff reduction with NetBSD
  
   NetBSD file versions:
   cd9660.c 1.39
   cd9660.h 1.19
   cd9660/cd9660_debug.c 1.12
   cd9660/cd9660_eltorito.c 1.20
   cd9660/cd9660_write.c 1.16
   cd9660/iso9660_rrip.c 1.12
   cd9660/iso9660_rrip.h 1.6
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/usr.sbin/makefs/cd9660.c
  stable/11/usr.sbin/makefs/cd9660.h
  stable/11/usr.sbin/makefs/cd9660/cd9660_debug.c
  stable/11/usr.sbin/makefs/cd9660/cd9660_eltorito.c
  stable/11/usr.sbin/makefs/cd9660/cd9660_write.c
  stable/11/usr.sbin/makefs/cd9660/iso9660_rrip.c
  stable/11/usr.sbin/makefs/cd9660/iso9660_rrip.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/makefs/cd9660.c
==
--- stable/11/usr.sbin/makefs/cd9660.c  Tue Apr 24 23:22:45 2018
(r332976)
+++ stable/11/usr.sbin/makefs/cd9660.c  Wed Apr 25 01:12:40 2018
(r332977)
@@ -110,58 +110,59 @@ __FBSDID("$FreeBSD$");
 #include "cd9660/iso9660_rrip.h"
 #include "cd9660/cd9660_archimedes.h"
 
-/*
- * Global variables
- */
-iso9660_disk diskStructure;
-
-static void cd9660_finalize_PVD(void);
+static void cd9660_finalize_PVD(iso9660_disk *);
 static cd9660node *cd9660_allocate_cd9660node(void);
-static void cd9660_set_defaults(void);
+static void cd9660_set_defaults(iso9660_disk *);
 static int cd9660_arguments_set_string(const char *, const char *, int,
 char, char *);
 static void cd9660_populate_iso_dir_record(
 struct _iso_directory_record_cd9660 *, u_char, u_char, u_char,
 const char *);
-static void cd9660_setup_root_node(void);
-static int cd9660_setup_volume_descriptors(void);
+static void cd9660_setup_root_node(iso9660_disk *);
+static int cd9660_setup_volume_descriptors(iso9660_disk *);
 #if 0
 static int cd9660_fill_extended_attribute_record(cd9660node *);
 #endif
 static void cd9660_sort_nodes(cd9660node *);
-static int cd9660_translate_node_common(cd9660node *);
-static int cd9660_translate_node(fsnode *, cd9660node *);
+static int cd9660_translate_node_common(iso9660_disk *, cd9660node *);
+static int cd9660_translate_node(iso9660_disk *, fsnode *, cd9660node *);
 static int cd9660_compare_filename(const char *, const char *);
 static void cd9660_sorted_child_insert(cd9660node *, cd9660node *);
-static int cd9660_handle_collisions(cd9660node *, int);
-static cd9660node *cd9660_rename_filename(cd9660node *, int, int);
-static void cd9660_copy_filenames(cd9660node *);
+static int cd9660_handle_collisions(iso9660_disk *, cd9660node *, int);
+static cd9660node *cd9660_rename_filename(iso9660_disk *, cd9660node *, int,
+int);
+static void cd9660_copy_filenames(iso9660_disk *, cd9660node *);
 static void cd9660_sorting_nodes(cd9660node *);
 static int cd9660_count_collisions(cd9660node *);
-static cd9660node *cd9660_rrip_move_directory(cd9660node *);
-static int cd9660_add_dot_records(cd9660node *);
+static cd9660node *cd9660_rrip_move_directory(iso9660_disk *, cd9660node *);
+static int cd9660_add_dot_records(iso9660_disk *, cd9660node *);
 
-static void cd9660_convert_structure(fsnode *, cd9660node *, int,
+static void cd9660_convert_structure(iso9660_disk *, fsnode *, cd9660node *, 
int,
 int *, int *);
 static void cd9660_free_structure(cd9660node *);
-static int cd9660_generate_path_table(void);
-static int cd9660_level1_convert_filename(const char *, char *, int);
-static int cd9660_level2_convert_filename(const char *, char *, int);
+static int cd9660_generate_path_table(iso9660_disk *);
+static int cd9660_level1_convert_filename(iso9660_disk *, const char *, char *,
+int);
+static int cd9660_level2_convert_filename(iso9660_disk *, const char *, char *,
+int);
 #if 0
-static int cd9660_joliet_convert_filename(const char *, char *, int);
+static int cd9660_joliet_convert_filename(iso9660_disk *, const char *, char *,
+int);
 #endif
-static int cd9660_convert_filename(const char *, char *, int);
-static void cd9660_populate_dot_records(cd9660node *);
-static int64_t cd9660_compute_offsets(cd9660node *, int64_t);
+static int cd9660_convert_filename(iso9660_disk *, const char *, char *, int);
+static void cd9660_populate_dot_records(iso9660_disk *, cd9660node *);
+static int64_t cd9660_compute_offsets(iso9660_disk *, cd9660node *, int64_t);
 #if 0
 static int cd9660_copy_stat_info(cd9660node *, cd9660node *, int);
 #endif
-static cd9660node *cd9660_create_virtual_entry(const char *, cd9660node *, int,
-int);
-static cd9660node *cd9660_create_file(const char *, cd9660node *, cd9660node 
*);
-static cd9660node *cd9660_create_directory(const char *, cd9660node *,
+static cd9660node *cd9660_create_virtual_entry(iso9660_disk *, const char *,
+cd9660node *, int, int);
+static cd9660node 

Re: svn commit: r332967 - in head: cddl/lib/libdtrace sys/kern sys/netinet sys/netinet6 sys/sys

2018-04-24 Thread Cy Schubert
In message , Devin 
Teske writ
es:
> 
>
> --Apple-Mail=_782CDA06-B0D5-4122-82C6-1541344DA2A3
> Content-Transfer-Encoding: quoted-printable
> Content-Type: text/plain;
>   charset=us-ascii
>
>
> > On Apr 24, 2018, at 12:58 PM, Cy Schubert  =
> wrote:
> >=20
> > In message <201804241955.w3ojtcls014...@repo.freebsd.org>, Sean Bruno=20=
>
> > writes:
> >> Author: sbruno
> >> Date: Tue Apr 24 19:55:12 2018
> >> New Revision: 332967
> >> URL: https://svnweb.freebsd.org/changeset/base/332967
> >>=20
> >> Log:
> >>  Revert r332894 at the request of the submitter.
> >>=20
> >>  Submitted by: Johannes Lundberg 
> >>  Sponsored by: Limelight Networks
> >=20
> > Hi Sean,
> >=20
> > Why? Not that I agree or disagree with this commit specifically,=20
> > including the reason why in the log might assist someone browsing=20
> > through the log.
> >=20
>
> Comments in phab review https://reviews.freebsd.org/D11003 =
>  make it appear as though additional =
> changes are pending.

Yes.

Still would have been nice to have it documented. Oh well.



-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
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: r332957 - head/sys/kern

2018-04-24 Thread Conrad Meyer
I am fine with any optimization to this path you like, so long as
locks are neutered in panic and don't cause secondary panics.

On Tue, Apr 24, 2018 at 4:22 PM, Mateusz Guzik  wrote:
> On Tue, Apr 24, 2018 at 8:41 PM, Conrad Meyer  wrote:
>>
>> Author: cem
>> Date: Tue Apr 24 18:41:14 2018
>> New Revision: 332957
>> URL: https://svnweb.freebsd.org/changeset/base/332957
>>
>> Log:
>>   lockmgr: Add missed neutering during panic
>>
>>   r313683 introduced new lockmgr APIs that missed the panic-time neutering
>>   present in the rest of our locks.  Correct that by adding the usual
>> check.
>>
>>   Additionally, move the __lockmgr_args neutering above the assertions at
>> the
>>   top of the function.  Drop the interlock unlock because we shouldn't
>> have
>>   an unneutered interlock either.  No point trying to unlock it.
>>
>>   PR:   227749
>>   Reported by:  jtl
>>   Sponsored by: Dell EMC Isilon
>>
>> Modified:
>>   head/sys/kern/kern_lock.c
>>
>> Modified: head/sys/kern/kern_lock.c
>>
>> ==
>> --- head/sys/kern/kern_lock.c   Tue Apr 24 18:19:30 2018(r332956)
>> +++ head/sys/kern/kern_lock.c   Tue Apr 24 18:41:14 2018(r332957)
>> @@ -918,6 +918,9 @@ lockmgr_lock_fast_path(struct lock *lk, u_int flags, s
>> u_int op;
>> bool locked;
>>
>> +   if (__predict_false(panicstr != NULL))
>> +   return (0);
>> +
>>
>
> This only further pollutes the slowpath. I mean fastpath. All the fallback
> funcs check for panic, so there is no need to do it in regular kernels at
> this level.
>
> Instead, the firing assertion should also see if perhaps the kernel
> already has panicked.
>
> Alternatively, the checks added here can be conditional on INVARIANTS.
>
> --
> Mateusz Guzik 
___
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: r332967 - in head: cddl/lib/libdtrace sys/kern sys/netinet sys/netinet6 sys/sys

2018-04-24 Thread Devin Teske

> On Apr 24, 2018, at 4:22 PM, Devin Teske  wrote:
> 
>> 
>> On Apr 24, 2018, at 12:58 PM, Cy Schubert > > wrote:
>> 
>> In message <201804241955.w3ojtcls014...@repo.freebsd.org 
>> >, Sean Bruno 
>> writes:
>>> Author: sbruno
>>> Date: Tue Apr 24 19:55:12 2018
>>> New Revision: 332967
>>> URL: https://svnweb.freebsd.org/changeset/base/332967 
>>> 
>>> 
>>> Log:
>>>  Revert r332894 at the request of the submitter.
>>> 
>>>  Submitted by:  Johannes Lundberg 
>>>  Sponsored by:  Limelight Networks
>> 
>> Hi Sean,
>> 
>> Why? Not that I agree or disagree with this commit specifically, 
>> including the reason why in the log might assist someone browsing 
>> through the log.
>> 
> 
> Comments in phab review https://reviews.freebsd.org/D11003 
>  make it appear as though additional 
> changes are pending.

Specifically, ...

> On Apr 24, 2018, at 12:18 PM, Mark Johnston  wrote:
> A similar change is needed in udp.d. Without it, libdtrace fails to
> compile its libraries when initializing a consumer, so dtrace(1) is
> currently unusable on head without "-x nolibs".

-- 
Devin
___
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: r332976 - head/tests/sys/kern

2018-04-24 Thread John Baldwin
Author: jhb
Date: Tue Apr 24 23:22:45 2018
New Revision: 332976
URL: https://svnweb.freebsd.org/changeset/base/332976

Log:
  Shorten some recently-added lines that are an extra indent over 80 columns.

Modified:
  head/tests/sys/kern/ptrace_test.c

Modified: head/tests/sys/kern/ptrace_test.c
==
--- head/tests/sys/kern/ptrace_test.c   Tue Apr 24 23:20:15 2018
(r332975)
+++ head/tests/sys/kern/ptrace_test.c   Tue Apr 24 23:22:45 2018
(r332976)
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
 /*
  * Architectures with a user-visible breakpoint().
  */
-#if defined(__amd64__) || defined(__i386__) || defined(__mips__) ||
\
+#if defined(__amd64__) || defined(__i386__) || defined(__mips__) ||\
 defined(__sparc64__)
 #defineHAVE_BREAKPOINT
 #endif
@@ -68,9 +68,9 @@ __FBSDID("$FreeBSD$");
 #elif defined(__mips__)
 #defineSKIP_BREAK(reg) ((reg)->r_regs[PC] += 4)
 #elif defined(__sparc64__)
-#defineSKIP_BREAK(reg) do {
\
-   (reg)->r_tpc = (reg)->r_tnpc + 4;   
\
-   (reg)->r_tnpc += 8; 
\
+#defineSKIP_BREAK(reg) do {
\
+   (reg)->r_tpc = (reg)->r_tnpc + 4;   \
+   (reg)->r_tnpc += 8; \
 } while (0)
 #endif
 #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"


Re: svn commit: r332967 - in head: cddl/lib/libdtrace sys/kern sys/netinet sys/netinet6 sys/sys

2018-04-24 Thread Devin Teske

> On Apr 24, 2018, at 12:58 PM, Cy Schubert  wrote:
> 
> In message <201804241955.w3ojtcls014...@repo.freebsd.org>, Sean Bruno 
> writes:
>> Author: sbruno
>> Date: Tue Apr 24 19:55:12 2018
>> New Revision: 332967
>> URL: https://svnweb.freebsd.org/changeset/base/332967
>> 
>> Log:
>>  Revert r332894 at the request of the submitter.
>> 
>>  Submitted by:   Johannes Lundberg 
>>  Sponsored by:   Limelight Networks
> 
> Hi Sean,
> 
> Why? Not that I agree or disagree with this commit specifically, 
> including the reason why in the log might assist someone browsing 
> through the log.
> 

Comments in phab review https://reviews.freebsd.org/D11003 
 make it appear as though additional 
changes are pending.
-- 
Devin
___
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: r332957 - head/sys/kern

2018-04-24 Thread Mateusz Guzik
On Tue, Apr 24, 2018 at 8:41 PM, Conrad Meyer  wrote:

> Author: cem
> Date: Tue Apr 24 18:41:14 2018
> New Revision: 332957
> URL: https://svnweb.freebsd.org/changeset/base/332957
>
> Log:
>   lockmgr: Add missed neutering during panic
>
>   r313683 introduced new lockmgr APIs that missed the panic-time neutering
>   present in the rest of our locks.  Correct that by adding the usual
> check.
>
>   Additionally, move the __lockmgr_args neutering above the assertions at
> the
>   top of the function.  Drop the interlock unlock because we shouldn't have
>   an unneutered interlock either.  No point trying to unlock it.
>
>   PR:   227749
>   Reported by:  jtl
>   Sponsored by: Dell EMC Isilon
>
> Modified:
>   head/sys/kern/kern_lock.c
>
> Modified: head/sys/kern/kern_lock.c
> 
> ==
> --- head/sys/kern/kern_lock.c   Tue Apr 24 18:19:30 2018(r332956)
> +++ head/sys/kern/kern_lock.c   Tue Apr 24 18:41:14 2018(r332957)
> @@ -918,6 +918,9 @@ lockmgr_lock_fast_path(struct lock *lk, u_int flags, s
> u_int op;
> bool locked;
>
> +   if (__predict_false(panicstr != NULL))
> +   return (0);
> +
>
>
This only further pollutes the slowpath. I mean fastpath. All the fallback
funcs check for panic, so there is no need to do it in regular kernels at
this level.

Instead, the firing assertion should also see if perhaps the kernel
already has panicked.

Alternatively, the checks added here can be conditional on INVARIANTS.

-- 
Mateusz Guzik 
___
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: r332975 - head/share/man/man3

2018-04-24 Thread John Baldwin
Author: jhb
Date: Tue Apr 24 23:20:15 2018
New Revision: 332975
URL: https://svnweb.freebsd.org/changeset/base/332975

Log:
  Document the TRAP_CAP code for SIGTRAP.
  
  MFC after:3 days

Modified:
  head/share/man/man3/siginfo.3

Modified: head/share/man/man3/siginfo.3
==
--- head/share/man/man3/siginfo.3   Tue Apr 24 21:15:54 2018
(r332974)
+++ head/share/man/man3/siginfo.3   Tue Apr 24 23:20:15 2018
(r332975)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 14, 2016
+.Dd April 24, 2018
 .Dt SIGINFO 3
 .Os
 .Sh NAME
@@ -156,6 +156,8 @@ process breakpoint
 process trace trap
 .It Ta Dv TRAP_DTRACE Ta
 DTrace induced trap
+.It Ta Dv TRAP_CAP Ta
+capabilities protective trap
 .It Dv SIGCHLD Ta Dv CLD_EXITED Ta
 child has exited
 .It Ta Dv CLD_KILLED Ta
___
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: r332974 - in head/sys: amd64/include kern vm

2018-04-24 Thread Mark Johnston
Author: markj
Date: Tue Apr 24 21:15:54 2018
New Revision: 332974
URL: https://svnweb.freebsd.org/changeset/base/332974

Log:
  Improve VM page queue scalability.
  
  Currently both the page lock and a page queue lock must be held in
  order to enqueue, dequeue or requeue a page in a given page queue.
  The queue locks are a scalability bottleneck in many workloads. This
  change reduces page queue lock contention by batching queue operations.
  To detangle the page and page queue locks, per-CPU batch queues are
  used to reference pages with pending queue operations. The requested
  operation is encoded in the page's aflags field with the page lock
  held, after which the page is enqueued for a deferred batch operation.
  Page queue scans are similarly optimized to minimize the amount of
  work performed with a page queue lock held.
  
  Reviewed by:  kib, jeff (previous versions)
  Tested by:pho
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D14893

Modified:
  head/sys/amd64/include/vmparam.h
  head/sys/kern/subr_witness.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_pagequeue.h
  head/sys/vm/vm_phys.c
  head/sys/vm/vm_swapout.c

Modified: head/sys/amd64/include/vmparam.h
==
--- head/sys/amd64/include/vmparam.hTue Apr 24 20:49:16 2018
(r332973)
+++ head/sys/amd64/include/vmparam.hTue Apr 24 21:15:54 2018
(r332974)
@@ -227,4 +227,10 @@
 
 #defineZERO_REGION_SIZE(2 * 1024 * 1024)   /* 2MB */
 
+/*
+ * Use a fairly large batch size since we expect amd64 systems to have lots of
+ * memory.
+ */
+#defineVM_BATCHQUEUE_SIZE  31
+
 #endif /* _MACHINE_VMPARAM_H_ */

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cTue Apr 24 20:49:16 2018
(r332973)
+++ head/sys/kern/subr_witness.cTue Apr 24 21:15:54 2018
(r332974)
@@ -603,7 +603,6 @@ static struct witness_order_list_entry order_lists[] =
 * CDEV
 */
{ "vm map (system)", _class_mtx_sleep },
-   { "vm pagequeue", _class_mtx_sleep },
{ "vnode interlock", _class_mtx_sleep },
{ "cdev", _class_mtx_sleep },
{ NULL, NULL },
@@ -613,11 +612,11 @@ static struct witness_order_list_entry order_lists[] =
{ "vm map (user)", _class_sx },
{ "vm object", _class_rw },
{ "vm page", _class_mtx_sleep },
-   { "vm pagequeue", _class_mtx_sleep },
{ "pmap pv global", _class_rw },
{ "pmap", _class_mtx_sleep },
{ "pmap pv list", _class_rw },
{ "vm page free queue", _class_mtx_sleep },
+   { "vm pagequeue", _class_mtx_sleep },
{ NULL, NULL },
/*
 * kqueue/VFS interaction

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Tue Apr 24 20:49:16 2018(r332973)
+++ head/sys/vm/vm_object.c Tue Apr 24 21:15:54 2018(r332974)
@@ -720,14 +720,11 @@ static void
 vm_object_terminate_pages(vm_object_t object)
 {
vm_page_t p, p_next;
-   struct mtx *mtx, *mtx1;
-   struct vm_pagequeue *pq, *pq1;
-   int dequeued;
+   struct mtx *mtx;
 
VM_OBJECT_ASSERT_WLOCKED(object);
 
mtx = NULL;
-   pq = NULL;
 
/*
 * Free any remaining pageable pages.  This also removes them from the
@@ -737,60 +734,21 @@ vm_object_terminate_pages(vm_object_t object)
 */
TAILQ_FOREACH_SAFE(p, >memq, listq, p_next) {
vm_page_assert_unbusied(p);
-   if ((object->flags & OBJ_UNMANAGED) == 0) {
+   if ((object->flags & OBJ_UNMANAGED) == 0)
/*
 * vm_page_free_prep() only needs the page
 * lock for managed pages.
 */
-   mtx1 = vm_page_lockptr(p);
-   if (mtx1 != mtx) {
-   if (mtx != NULL)
-   mtx_unlock(mtx);
-   if (pq != NULL) {
-   vm_pagequeue_cnt_add(pq, dequeued);
-   vm_pagequeue_unlock(pq);
-   pq = NULL;
-   }
-   mtx = mtx1;
-   mtx_lock(mtx);
-   }
-   }
+   vm_page_change_lock(p, );
p->object = NULL;
if (p->wire_count != 0)
-   goto unlist;
-   VM_CNT_INC(v_pfree);
-   p->flags &= ~PG_ZERO;
-   if (p->queue != PQ_NONE) {
- 

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

2018-04-24 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 24 20:49:16 2018
New Revision: 332973
URL: https://svnweb.freebsd.org/changeset/base/332973

Log:
  Make the sysctl machdep.idle also a tunable.
  
  It is applied before it is possible for idle threads to execute on any
  CPU, allowing to work around against some bugs.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/x86/x86/cpu_machdep.c
==
--- head/sys/x86/x86/cpu_machdep.c  Tue Apr 24 20:33:08 2018
(r332972)
+++ head/sys/x86/x86/cpu_machdep.c  Tue Apr 24 20:49:16 2018
(r332973)
@@ -636,13 +636,33 @@ idle_sysctl_available(SYSCTL_HANDLER_ARGS)
 SYSCTL_PROC(_machdep, OID_AUTO, idle_available, CTLTYPE_STRING | CTLFLAG_RD,
 0, 0, idle_sysctl_available, "A", "list of available idle functions");
 
+static bool
+idle_selector(const char *new_idle_name)
+{
+   int i;
+
+   for (i = 0; idle_tbl[i].id_name != NULL; i++) {
+   if (strstr(idle_tbl[i].id_name, "mwait") &&
+   (cpu_feature2 & CPUID2_MON) == 0)
+   continue;
+   if (strcmp(idle_tbl[i].id_name, "acpi") == 0 &&
+   cpu_idle_hook == NULL)
+   continue;
+   if (strcmp(idle_tbl[i].id_name, new_idle_name))
+   continue;
+   cpu_idle_fn = idle_tbl[i].id_fn;
+   if (bootverbose)
+   printf("CPU idle set to %s\n", idle_tbl[i].id_name);
+   return (true);
+   }
+   return (false);
+}
+
 static int
 idle_sysctl(SYSCTL_HANDLER_ARGS)
 {
-   char buf[16];
-   int error;
-   char *p;
-   int i;
+   char buf[16], *p;
+   int error, i;
 
p = "unknown";
for (i = 0; idle_tbl[i].id_name != NULL; i++) {
@@ -655,23 +675,21 @@ idle_sysctl(SYSCTL_HANDLER_ARGS)
error = sysctl_handle_string(oidp, buf, sizeof(buf), req);
if (error != 0 || req->newptr == NULL)
return (error);
-   for (i = 0; idle_tbl[i].id_name != NULL; i++) {
-   if (strstr(idle_tbl[i].id_name, "mwait") &&
-   (cpu_feature2 & CPUID2_MON) == 0)
-   continue;
-   if (strcmp(idle_tbl[i].id_name, "acpi") == 0 &&
-   cpu_idle_hook == NULL)
-   continue;
-   if (strcmp(idle_tbl[i].id_name, buf))
-   continue;
-   cpu_idle_fn = idle_tbl[i].id_fn;
-   return (0);
-   }
-   return (EINVAL);
+   return (idle_selector(buf) ? 0 : EINVAL);
 }
 
 SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0,
 idle_sysctl, "A", "currently selected idle function");
+
+static void
+idle_tun(void *unused __unused)
+{
+   char tunvar[16];
+
+   if (TUNABLE_STR_FETCH("machdep.idle", tunvar, sizeof(tunvar)))
+   idle_selector(tunvar);
+}
+SYSINIT(idle_tun, SI_SUB_CPU, SI_ORDER_MIDDLE, idle_tun, NULL);
 
 static int panic_on_nmi = 1;
 SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN,
___
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: r332972 - head/sys/x86/x86

2018-04-24 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 24 20:33:08 2018
New Revision: 332972
URL: https://svnweb.freebsd.org/changeset/base/332972

Log:
  Extend ap_boot_mtx scope to also cover mca_init().
  
  Otherwise, under bootverbose, the lapic_enable_cmc() banner 'lapicX:
  CMCI unmasked' is printed by several CPUs in parallel, causing garbled
  output for the LAPIC dumps.
  
  Reported by:  royger
  Reviewed by:  jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D15157

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

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Tue Apr 24 20:29:40 2018(r332971)
+++ head/sys/x86/x86/mp_x86.c   Tue Apr 24 20:33:08 2018(r332972)
@@ -1007,9 +1007,9 @@ init_secondary_tail(void)
KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread"));
PCPU_SET(curthread, PCPU_GET(idlethread));
 
-   mca_init();
-
mtx_lock_spin(_boot_mtx);
+
+   mca_init();
 
/* Init local apic for irq's */
lapic_setup(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: r332971 - head/sys/x86/x86

2018-04-24 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 24 20:29:40 2018
New Revision: 332971
URL: https://svnweb.freebsd.org/changeset/base/332971

Log:
  Ensure that cmci_monitor() is not executed in parallel, since shared
  machine check banks must be only monitored by single CPU.
  
  Noted and reviewed by:jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D15157

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

Modified: head/sys/x86/x86/mca.c
==
--- head/sys/x86/x86/mca.c  Tue Apr 24 20:22:30 2018(r332970)
+++ head/sys/x86/x86/mca.c  Tue Apr 24 20:29:40 2018(r332971)
@@ -1119,6 +1119,14 @@ _mca_init(int boot)
if ((mask & (1UL << 5)) == 0)
wrmsr(MSR_MC0_CTL_MASK, mask | (1UL << 5));
}
+
+   /*
+* The cmci_monitor() must not be executed
+* simultaneously by several CPUs.
+*/
+   if (boot)
+   mtx_lock_spin(_lock);
+
for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) {
/* By default enable logging of all errors. */
ctl = 0xUL;
@@ -1158,6 +1166,8 @@ _mca_init(int boot)
/* Clear all errors. */
wrmsr(MSR_MC_STATUS(i), 0);
}
+   if (boot)
+   mtx_unlock_spin(_lock);
 
 #ifdef DEV_APIC
if (!amd_thresholding_supported() &&
___
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: r332970 - head/sys/x86/x86

2018-04-24 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 24 20:22:30 2018
New Revision: 332970
URL: https://svnweb.freebsd.org/changeset/base/332970

Log:
  Use IS_BSP() macro.
  
  Noted and reviewed by:jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days
  Differential revision:https://reviews.freebsd.org/D15157

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

Modified: head/sys/x86/x86/mca.c
==
--- head/sys/x86/x86/mca.c  Tue Apr 24 20:21:59 2018(r332969)
+++ head/sys/x86/x86/mca.c  Tue Apr 24 20:22:30 2018(r332970)
@@ -1103,7 +1103,7 @@ _mca_init(int boot)
if (mcg_cap & MCG_CAP_CTL_P)
/* Enable MCA features. */
wrmsr(MSR_MCG_CTL, MCG_CTL_ENABLE);
-   if (PCPU_GET(cpuid) == 0 && boot)
+   if (IS_BSP() && boot)
mca_setup(mcg_cap);
 
/*
___
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: r332968 - head/sys/vm

2018-04-24 Thread Mark Johnston
Author: markj
Date: Tue Apr 24 20:05:45 2018
New Revision: 332968
URL: https://svnweb.freebsd.org/changeset/base/332968

Log:
  Add a UMA zone flag to disable the use of buckets.
  
  This allows the creation of zones which don't do any caching in front of
  the keg. If the zone is a cache zone, this means that UMA will not
  attempt any memory allocations when allocating an item from the backend.
  This is intended for use after a panic by netdump, but likely has other
  applications.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D15184

Modified:
  head/sys/vm/uma.h
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma.h
==
--- head/sys/vm/uma.h   Tue Apr 24 19:55:12 2018(r332967)
+++ head/sys/vm/uma.h   Tue Apr 24 20:05:45 2018(r332968)
@@ -265,8 +265,8 @@ uma_zone_t uma_zcache_create(char *name, int size, uma
 * information in the vm_page.
 */
 #defineUMA_ZONE_SECONDARY  0x0200  /* Zone is a Secondary Zone */
-/* 0x0400 Unused */
-#defineUMA_ZONE_MAXBUCKET  0x0800  /* Use largest buckets */
+#defineUMA_ZONE_NOBUCKET   0x0400  /* Do not use buckets. */
+#defineUMA_ZONE_MAXBUCKET  0x0800  /* Use largest buckets. */
 #defineUMA_ZONE_CACHESPREAD0x1000  /*
 * Spread memory start locations across
 * all possible cache lines.  May

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Tue Apr 24 19:55:12 2018(r332967)
+++ head/sys/vm/uma_core.c  Tue Apr 24 20:05:45 2018(r332968)
@@ -1681,10 +1681,15 @@ zone_ctor(void *mem, int size, void *udata, int flags)
}
 
 out:
-   if ((arg->flags & UMA_ZONE_MAXBUCKET) == 0)
-   zone->uz_count = bucket_select(zone->uz_size);
-   else
+   KASSERT((arg->flags & (UMA_ZONE_MAXBUCKET | UMA_ZONE_NOBUCKET)) !=
+   (UMA_ZONE_MAXBUCKET | UMA_ZONE_NOBUCKET),
+   ("Invalid zone flag combination"));
+   if ((arg->flags & UMA_ZONE_MAXBUCKET) != 0)
zone->uz_count = BUCKET_MAX;
+   else if ((arg->flags & UMA_ZONE_NOBUCKET) != 0)
+   zone->uz_count = 0;
+   else
+   zone->uz_count = bucket_select(zone->uz_size);
zone->uz_count_min = zone->uz_count;
 
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332967 - in head: cddl/lib/libdtrace sys/kern sys/netinet sys/netinet6 sys/sys

2018-04-24 Thread Cy Schubert
In message <201804241955.w3ojtcls014...@repo.freebsd.org>, Sean Bruno 
writes:
> Author: sbruno
> Date: Tue Apr 24 19:55:12 2018
> New Revision: 332967
> URL: https://svnweb.freebsd.org/changeset/base/332967
>
> Log:
>   Revert r332894 at the request of the submitter.
>   
>   Submitted by:   Johannes Lundberg 
>   Sponsored by:   Limelight Networks

Hi Sean,

Why? Not that I agree or disagree with this commit specifically, 
including the reason why in the log might assist someone browsing 
through the log.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
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: r332967 - in head: cddl/lib/libdtrace sys/kern sys/netinet sys/netinet6 sys/sys

2018-04-24 Thread Sean Bruno
Author: sbruno
Date: Tue Apr 24 19:55:12 2018
New Revision: 332967
URL: https://svnweb.freebsd.org/changeset/base/332967

Log:
  Revert r332894 at the request of the submitter.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Limelight Networks

Modified:
  head/cddl/lib/libdtrace/tcp.d
  head/sys/kern/uipc_debug.c
  head/sys/kern/uipc_socket.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/ip_output.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/in6_pcb.c
  head/sys/netinet6/in6_src.c
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/udp6_usrreq.c
  head/sys/sys/socket.h
  head/sys/sys/socketvar.h

Modified: head/cddl/lib/libdtrace/tcp.d
==
--- head/cddl/lib/libdtrace/tcp.d   Tue Apr 24 19:51:05 2018
(r332966)
+++ head/cddl/lib/libdtrace/tcp.d   Tue Apr 24 19:55:12 2018
(r332967)
@@ -192,12 +192,12 @@ translator tcpsinfo_t < struct tcpcb *p > {
tcps_rport =p == NULL ? 0 : 
ntohs(p->t_inpcb->inp_inc.inc_ie.ie_fport);
tcps_laddr =p == NULL ? 0 :
p->t_inpcb->inp_vflag == INP_IPV4 ?
-   
inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr)
 :
-   inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.id6_addr);
+   
inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie46_local.ia46_addr4.s_addr)
 :
+   inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie6_local);
tcps_raddr =p == NULL ? 0 :
p->t_inpcb->inp_vflag == INP_IPV4 ?
-   
inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr)
 :
-   inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id6_addr);
+   
inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie46_foreign.ia46_addr4.s_addr)
 :
+   inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign);
tcps_state =p == NULL ? -1 : p->t_state;
tcps_iss =  p == NULL ? 0  : p->iss;
tcps_irs =  p == NULL ? 0  : p->irs;

Modified: head/sys/kern/uipc_debug.c
==
--- head/sys/kern/uipc_debug.c  Tue Apr 24 19:51:05 2018(r332966)
+++ head/sys/kern/uipc_debug.c  Tue Apr 24 19:55:12 2018(r332967)
@@ -77,7 +77,7 @@ db_print_sotype(short so_type)
 }
 
 static void
-db_print_sooptions(int so_options)
+db_print_sooptions(short so_options)
 {
int comma;
 
@@ -120,10 +120,6 @@ db_print_sooptions(int so_options)
}
if (so_options & SO_REUSEPORT) {
db_printf("%sSO_REUSEPORT", comma ? ", " : "");
-   comma = 1;
-   }
-   if (so_options & SO_REUSEPORT_LB) {
-   db_printf("%sSO_REUSEPORT_LB", comma ? ", " : "");
comma = 1;
}
if (so_options & SO_TIMESTAMP) {

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Tue Apr 24 19:51:05 2018(r332966)
+++ head/sys/kern/uipc_socket.c Tue Apr 24 19:55:12 2018(r332967)
@@ -1057,100 +1057,6 @@ sofree(struct socket *so)
 }
 
 /*
- * Let socket in same load balance group (same port and address)
- * inherit pending sockets of the closing socket.
- *
- * "so_inh" will inherit sockets from "so"
- */
-void
-soinherit(struct socket *so, struct socket *so_inh)
-{
-   TAILQ_HEAD(, socket) comp, incomp;
-   struct socket *sp, *head, *head_inh;
-   int qlen, incqlen;
-
-   KASSERT(so->so_options & SO_ACCEPTCONN,
-   ("so does not accept connection"));
-   KASSERT(so_inh->so_options & SO_ACCEPTCONN,
-   ("so_inh does not accept connection"));
-
-
-restart:
-   SOCK_LOCK(so);
-   if ((head = so->so_listen) != NULL &&
-   __predict_false(SOLISTEN_TRYLOCK(head) == 0)) {
-   SOCK_UNLOCK(so);
-   goto restart;
-   }
-
-restart_inh:
-   SOCK_LOCK(so_inh);
-   if ((head_inh = so_inh->so_listen) != NULL &&
-   __predict_false(SOLISTEN_TRYLOCK(head_inh) == 0)) {
-   SOCK_UNLOCK(so_inh);
-   goto restart_inh;
-   }
-
-   TAILQ_INIT();
-   TAILQ_INIT();
-
-   /*
-* Save completed queue and incompleted queue
-*/
-   TAILQ_CONCAT(, >sol_comp, so_list);
-   qlen = so->sol_qlen;
-   so->sol_qlen = 0;
-
-   TAILQ_CONCAT(, >sol_incomp, so_list);
-   incqlen = so->sol_incqlen;
-   so->sol_incqlen = 0;
-
-   /*
-* Append the saved completed queue and incompleted
-* queue to the socket inherits them.
-*
-* XXX
-* This may temporarily break the inheriting socket's
-* so_qlimit.
-*/
-   TAILQ_FOREACH(sp, , so_list) {
-   

svn commit: r332966 - in head: share/man/man4 sys/dev/lmc

2018-04-24 Thread Ed Maste
Author: emaste
Date: Tue Apr 24 19:51:05 2018
New Revision: 332966
URL: https://svnweb.freebsd.org/changeset/base/332966

Log:
  Add deprecation notice for lmc(4)
  
  We intend to remove support before FreeBSD 12 is branched.  These are
  available only as 32-bit PCI devices.  The driver has an ambiguous
  license and I have not been successful in contacting the driver's author
  in order to address this.
  
  The planned deprecation has been announced on -current and -stable; if
  we receive feedback that the driver is still useful and we are able to
  resolve the license issue this deprecation notice can be reverted.
  
  Reviewed by:  bapt, brooks, imp, rgrimes
  MFC after:2 weeks
  Relnotes: Yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D15182

Modified:
  head/share/man/man4/lmc.4
  head/sys/dev/lmc/if_lmc.c

Modified: head/share/man/man4/lmc.4
==
--- head/share/man/man4/lmc.4   Tue Apr 24 19:26:58 2018(r332965)
+++ head/share/man/man4/lmc.4   Tue Apr 24 19:51:05 2018(r332966)
@@ -43,7 +43,7 @@
 .\" this program; if not, write to the Free Software Foundation, Inc., 59
 .\" Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 .\"
-.Dd February 8, 2012
+.Dd April 24, 2018
 .Dt LMC 4
 .Os
 .\"
@@ -88,6 +88,13 @@ SPPP nor Netgraph are configured into the kernel.
 Netgraph and SPPP can both be enabled; Netgraph will be used if the
 .Va rawdata
 hook is connected.
+.\"
+.Sh DEPRECATION NOTICE
+The
+.Nm
+driver is not present in
+.Fx 12.0
+and later.
 .\"
 .Sh DESCRIPTION
 .\"

Modified: head/sys/dev/lmc/if_lmc.c
==
--- head/sys/dev/lmc/if_lmc.c   Tue Apr 24 19:26:58 2018(r332965)
+++ head/sys/dev/lmc/if_lmc.c   Tue Apr 24 19:51:05 2018(r332966)
@@ -4547,6 +4547,7 @@ fbsd_attach(device_t dev)
 
   /* Start the card and attach a kernel interface and line protocol. */
   if ((error = attach_card(sc, ""))) detach_card(sc);
+  gone_in_dev(dev, 12, "lmc(4) driver");
   return error;
   }
 
___
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: r332965 - head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD

2018-04-24 Thread Ed Maste
Author: emaste
Date: Tue Apr 24 19:26:58 2018
New Revision: 332965
URL: https://svnweb.freebsd.org/changeset/base/332965

Log:
  lldb: remove assertion that target_arch is FreeBSD
  
  The target is not necessarily a FreeBSD binary - for example, it may be
  a Linux binary running under the linuxulator.  Basic ptrace (live)
  debugging already worked in this case, except for the assertion.
  
  Sponsored by: Turing Robotic Industries Inc.

Modified:
  head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp

Modified: 
head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
==
--- 
head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp   
Tue Apr 24 19:23:26 2018(r332964)
+++ 
head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp   
Tue Apr 24 19:26:58 2018(r332965)
@@ -169,7 +169,6 @@ lldb::RegisterContextSP FreeBSDThread::GetRegisterCont
 RegisterInfoInterface *reg_interface = NULL;
 const ArchSpec _arch = GetProcess()->GetTarget().GetArchitecture();
 
-assert(target_arch.GetTriple().getOS() == llvm::Triple::FreeBSD);
 switch (target_arch.GetMachine()) {
 case llvm::Triple::aarch64:
   reg_interface = new RegisterInfoPOSIX_arm64(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: r332964 - head/usr.bin/kdump

2018-04-24 Thread Ed Maste
Author: emaste
Date: Tue Apr 24 19:23:26 2018
New Revision: 332964
URL: https://svnweb.freebsd.org/changeset/base/332964

Log:
  kdump: simplify/remove per-arch #ifdefs
  
  It is acceptable for syscallabi to map SV_ABI to SYSDECODE_ABI on all
  architectures; libsysdecode will return not-found sentinel values if
  it does not have a syscall name or errno mapping for a given
  architecture.
  
  Also, use __LP64__ for the SV_ILP32 -> SYSDECODE_ABI_LINUX32 mapping,
  for any future 32- on 64-bit linuxulator implementation.
  
  Reviewed by:  jhb
  Sponsored by: Turing Robotic Industries Inc.

Modified:
  head/usr.bin/kdump/kdump.c

Modified: head/usr.bin/kdump/kdump.c
==
--- head/usr.bin/kdump/kdump.c  Tue Apr 24 19:11:05 2018(r332963)
+++ head/usr.bin/kdump/kdump.c  Tue Apr 24 19:23:26 2018(r332964)
@@ -758,18 +758,14 @@ syscallabi(u_int sv_flags)
switch (sv_flags & SV_ABI_MASK) {
case SV_ABI_FREEBSD:
return (SYSDECODE_ABI_FREEBSD);
-#if defined(__amd64__) || defined(__i386__)
case SV_ABI_LINUX:
-#ifdef __amd64__
+#ifdef __LP64__
if (sv_flags & SV_ILP32)
return (SYSDECODE_ABI_LINUX32);
 #endif
return (SYSDECODE_ABI_LINUX);
-#endif
-#if defined(__aarch64__) || defined(__amd64__)
case SV_ABI_CLOUDABI:
return (SYSDECODE_ABI_CLOUDABI64);
-#endif
default:
return (SYSDECODE_ABI_UNKNOWN);
}
___
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: r332894 - in head: cddl/lib/libdtrace sys/kern sys/netinet sys/netinet6 sys/sys

2018-04-24 Thread Mark Johnston
On Mon, Apr 23, 2018 at 07:51:00PM +, Sean Bruno wrote:
> Author: sbruno
> Date: Mon Apr 23 19:51:00 2018
> New Revision: 332894
> URL: https://svnweb.freebsd.org/changeset/base/332894
> 
> Log:
>   Load balance sockets with new SO_REUSEPORT_LB option
>   
>   This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple
>   programs or threads to bind to the same port and incoming connections will 
> be
>   load balanced using a hash function.
>   
>   Most of the code was copied from a similar patch for DragonflyBSD.
>   
>   However, in DragonflyBSD, load balancing is a global on/off setting and can 
> not
>   be set per socket. This patch allows for simultaneous use of both the 
> current
>   SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system.
>   
>   Required changes to structures
>   Globally change so_options from 16 to 32 bit value to allow for more 
> options.
>   Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets.
>   
>   Limitations
>   As DragonflyBSD, a load balance group is limited to 256 pcbs
>   (256 programs or threads sharing the same socket).
>   
>   Submitted by:   Johannes Lundberg 
>   Sponsored by:   Limelight Networks
>   Differential Revision:  https://reviews.freebsd.org/D11003
> 
> Modified:
>   head/cddl/lib/libdtrace/tcp.d
>   head/sys/kern/uipc_debug.c
>   head/sys/kern/uipc_socket.c
>   head/sys/netinet/in_pcb.c
>   head/sys/netinet/in_pcb.h
>   head/sys/netinet/ip_output.c
>   head/sys/netinet/tcp_subr.c
>   head/sys/netinet/udp_usrreq.c
>   head/sys/netinet6/in6_pcb.c
>   head/sys/netinet6/in6_src.c
>   head/sys/netinet6/ip6_output.c
>   head/sys/netinet6/udp6_usrreq.c
>   head/sys/sys/socket.h
>   head/sys/sys/socketvar.h
> 
> Modified: head/cddl/lib/libdtrace/tcp.d
> ==
> --- head/cddl/lib/libdtrace/tcp.d Mon Apr 23 18:33:26 2018
> (r332893)
> +++ head/cddl/lib/libdtrace/tcp.d Mon Apr 23 19:51:00 2018
> (r332894)
> @@ -192,12 +192,12 @@ translator tcpsinfo_t < struct tcpcb *p > {
>   tcps_rport =p == NULL ? 0 : 
> ntohs(p->t_inpcb->inp_inc.inc_ie.ie_fport);
>   tcps_laddr =p == NULL ? 0 :
>   p->t_inpcb->inp_vflag == INP_IPV4 ?
> - 
> inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie46_local.ia46_addr4.s_addr)
>  :
> - inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie6_local);
> + 
> inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr)
>  :
> + inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.id6_addr);
>   tcps_raddr =p == NULL ? 0 :
>   p->t_inpcb->inp_vflag == INP_IPV4 ?
> - 
> inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie46_foreign.ia46_addr4.s_addr)
>  :
> - inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign);
> + 
> inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr)
>  :
> + inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id6_addr);
>   tcps_state =p == NULL ? -1 : p->t_state;
>   tcps_iss =  p == NULL ? 0  : p->iss;
>   tcps_irs =  p == NULL ? 0  : p->irs;

A similar change is needed in udp.d. Without it, libdtrace fails to
compile its libraries when initializing a consumer, so dtrace(1) is
currently unusable on head without "-x nolibs".
___
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: r332963 - head/sys/dev/usb/serial

2018-04-24 Thread Emmanuel Vadot
Author: manu
Date: Tue Apr 24 19:11:05 2018
New Revision: 332963
URL: https://svnweb.freebsd.org/changeset/base/332963

Log:
  uslcom: Both CP2104 and CP2105 can support up to 2Mbps baudrate
  
  MFC after:1 week

Modified:
  head/sys/dev/usb/serial/uslcom.c

Modified: head/sys/dev/usb/serial/uslcom.c
==
--- head/sys/dev/usb/serial/uslcom.cTue Apr 24 19:10:51 2018
(r332962)
+++ head/sys/dev/usb/serial/uslcom.cTue Apr 24 19:11:05 2018
(r332963)
@@ -612,7 +612,22 @@ uslcom_cfg_set_rts(struct ucom_softc *ucom, uint8_t on
 static int
 uslcom_pre_param(struct ucom_softc *ucom, struct termios *t)
 {
-   if (t->c_ospeed <= 0 || t->c_ospeed > 921600)
+   struct uslcom_softc *sc = ucom->sc_parent;
+   uint32_t maxspeed;
+
+   switch (sc->sc_partnum) {
+   case USLCOM_PARTNUM_CP2104:
+   case USLCOM_PARTNUM_CP2105:
+   maxspeed = 200;
+   break;
+   case USLCOM_PARTNUM_CP2101:
+   case USLCOM_PARTNUM_CP2102:
+   case USLCOM_PARTNUM_CP2103:
+   default:
+   maxspeed = 921600;
+   break;
+   }
+   if (t->c_ospeed <= 0 || t->c_ospeed > maxspeed)
return (EINVAL);
return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332962 - head/sys/kern

2018-04-24 Thread Conrad Meyer
Author: cem
Date: Tue Apr 24 19:10:51 2018
New Revision: 332962
URL: https://svnweb.freebsd.org/changeset/base/332962

Log:
  Do not totally silence suppressed secondary kasserts unless 
debug.kassert.do_log is disabled
  
  To totally silence and ignore secondary kassert violations after a primary
  panic, set debug.kassert.do_log=0 and debug.kassert.suppress_in_panic=1.
  
  Additional assertion warnings shouldn't block core dump and may alert the
  developer to another erroneous condition.  Secondary stack traces may be
  printed, identically to the unsuppressed case where panic() is reentered --
  controlled via debug.trace_all_panics.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Tue Apr 24 19:09:53 2018
(r332961)
+++ head/sys/kern/kern_shutdown.c   Tue Apr 24 19:10:51 2018
(r332962)
@@ -718,13 +718,24 @@ kassert_panic(const char *fmt, ...)
static char buf[256];
va_list ap;
 
-   /* If we already panic'd, don't create a double-fault. */
-   if (panicstr != NULL && kassert_suppress_in_panic)
-   return;
-
va_start(ap, fmt);
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
+
+   /*
+* If we are suppressing secondary panics, log the warning but do not
+* re-enter panic/kdb.
+*/
+   if (panicstr != NULL && kassert_suppress_in_panic) {
+   if (kassert_do_log) {
+   printf("KASSERT failed: %s\n", buf);
+#ifdef KDB
+   if (trace_all_panics && trace_on_panic)
+   kdb_backtrace();
+#endif
+   }
+   return;
+   }
 
/*
 * panic if we're not just warning, or if we've exceeded
___
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: r332961 - head/sys/dev/usb/serial

2018-04-24 Thread Emmanuel Vadot
Author: manu
Date: Tue Apr 24 19:09:53 2018
New Revision: 332961
URL: https://svnweb.freebsd.org/changeset/base/332961

Log:
  uslcom: Apply style(9) and be consistant with function names
  
  MFC after:1 week

Modified:
  head/sys/dev/usb/serial/uslcom.c

Modified: head/sys/dev/usb/serial/uslcom.c
==
--- head/sys/dev/usb/serial/uslcom.cTue Apr 24 18:59:40 2018
(r332960)
+++ head/sys/dev/usb/serial/uslcom.cTue Apr 24 19:09:53 2018
(r332961)
@@ -64,7 +64,7 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, debug, CTLFLAG_RW
 _debug, 0, "Debug level");
 #endif
 
-#defineUSLCOM_BULK_BUF_SIZE1024
+#defineUSLCOM_BULK_BUF_SIZE1024
 #defineUSLCOM_CONFIG_INDEX 0
 
 /* Request types */
@@ -73,13 +73,13 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, debug, CTLFLAG_RW
 
 /* Request codes */
 #defineUSLCOM_IFC_ENABLE   0x00
-#defineUSLCOM_SET_BAUDDIV  0x01
+#defineUSLCOM_SET_BAUDDIV  0x01
 #defineUSLCOM_SET_LINE_CTL 0x03
 #defineUSLCOM_SET_BREAK0x05
 #defineUSLCOM_SET_MHS  0x07
 #defineUSLCOM_GET_MDMSTS   0x08
 #defineUSLCOM_SET_FLOW 0x13
-#defineUSLCOM_SET_BAUDRATE 0x1e
+#defineUSLCOM_SET_BAUDRATE 0x1e
 #defineUSLCOM_VENDOR_SPECIFIC  0xff
 
 /* USLCOM_IFC_ENABLE values */
@@ -87,7 +87,7 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, debug, CTLFLAG_RW
 #defineUSLCOM_IFC_ENABLE_EN0x01
 
 /* USLCOM_SET_MHS/USLCOM_GET_MDMSTS values */
-#defineUSLCOM_MHS_DTR_ON   0x0001  
+#defineUSLCOM_MHS_DTR_ON   0x0001
 #defineUSLCOM_MHS_DTR_SET  0x0100
 #defineUSLCOM_MHS_RTS_ON   0x0002
 #defineUSLCOM_MHS_RTS_SET  0x0200
@@ -112,11 +112,11 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, debug, CTLFLAG_RW
 #defineUSLCOM_SET_BREAK_ON 0x01
 
 /* USLCOM_SET_FLOW values - 1st word */
-#defineUSLCOM_FLOW_DTR_ON  0x0001 /* DTR static active */
-#defineUSLCOM_FLOW_CTS_HS  0x0008 /* CTS handshake */
+#defineUSLCOM_FLOW_DTR_ON  0x0001 /* DTR static active */
+#defineUSLCOM_FLOW_CTS_HS  0x0008 /* CTS handshake */
 /* USLCOM_SET_FLOW values - 2nd word */
-#defineUSLCOM_FLOW_RTS_ON  0x0040 /* RTS static active */
-#defineUSLCOM_FLOW_RTS_HS  0x0080 /* RTS handshake */
+#defineUSLCOM_FLOW_RTS_ON  0x0040 /* RTS static active */
+#defineUSLCOM_FLOW_RTS_HS  0x0080 /* RTS handshake */
 
 /* USLCOM_VENDOR_SPECIFIC values */
 #defineUSLCOM_GET_PARTNUM  0x370B
@@ -146,10 +146,10 @@ struct uslcom_softc {
struct usb_device *sc_udev;
struct mtx sc_mtx;
 
-   uint8_t  sc_msr;
-   uint8_t  sc_lsr;
-   uint8_t  sc_iface_no;
-   uint8_t  sc_partnum;
+   uint8_t sc_msr;
+   uint8_t sc_lsr;
+   uint8_t sc_iface_no;
+   uint8_t sc_partnum;
 };
 
 static device_probe_t uslcom_probe;
@@ -161,18 +161,18 @@ static usb_callback_t uslcom_write_callback;
 static usb_callback_t uslcom_read_callback;
 static usb_callback_t uslcom_control_callback;
 
-static voiduslcom_free(struct ucom_softc *);
-static void uslcom_open(struct ucom_softc *);
-static void uslcom_close(struct ucom_softc *);
+static void uslcom_free(struct ucom_softc *);
 static uint8_t uslcom_get_partnum(struct uslcom_softc *);
-static void uslcom_set_dtr(struct ucom_softc *, uint8_t);
-static void uslcom_set_rts(struct ucom_softc *, uint8_t);
-static void uslcom_set_break(struct ucom_softc *, uint8_t);
+static void uslcom_cfg_open(struct ucom_softc *);
+static void uslcom_cfg_close(struct ucom_softc *);
+static void uslcom_cfg_set_dtr(struct ucom_softc *, uint8_t);
+static void uslcom_cfg_set_rts(struct ucom_softc *, uint8_t);
+static void uslcom_cfg_set_break(struct ucom_softc *, uint8_t);
+static void uslcom_cfg_param(struct ucom_softc *, struct termios *);
+static void uslcom_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *);
 static int uslcom_ioctl(struct ucom_softc *, uint32_t, caddr_t, int,
-   struct thread *);
+struct thread *);
 static int uslcom_pre_param(struct ucom_softc *, struct termios *);
-static void uslcom_param(struct ucom_softc *, struct termios *);
-static void uslcom_get_status(struct ucom_softc *, uint8_t *, uint8_t *);
 static void uslcom_start_read(struct ucom_softc *);
 static void uslcom_stop_read(struct ucom_softc *);
 static void uslcom_start_write(struct ucom_softc *);
@@ -180,7 +180,6 @@ static void uslcom_stop_write(struct ucom_softc *);
 static void uslcom_poll(struct ucom_softc *ucom);
 
 static const struct usb_config uslcom_config[USLCOM_N_TRANSFER] = {
-
[USLCOM_BULK_DT_WR] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
@@ -210,15 +209,15 @@ 

svn commit: r332960 - head/sys/kern

2018-04-24 Thread Conrad Meyer
Author: cem
Date: Tue Apr 24 18:59:40 2018
New Revision: 332960
URL: https://svnweb.freebsd.org/changeset/base/332960

Log:
  Fix debug.kassert.do_log description text
  
  This has been an (incorrect) copy-paste duplicate of debug.kassert.warn_only
  since it was originally committed in r243980.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Tue Apr 24 18:54:20 2018
(r332959)
+++ head/sys/kern/kern_shutdown.c   Tue Apr 24 18:59:40 2018
(r332960)
@@ -667,7 +667,8 @@ SYSCTL_UINT(_debug_kassert, OID_AUTO, do_ktr, CTLFLAG_
 #endif
 
 SYSCTL_INT(_debug_kassert, OID_AUTO, do_log, CTLFLAG_RWTUN,
-_do_log, 0, "KASSERT triggers a panic (1) or just a warning (0)");
+_do_log, 0,
+"If warn_only is enabled, log (1) or do not log (0) assertion violations");
 
 SYSCTL_INT(_debug_kassert, OID_AUTO, warnings, CTLFLAG_RWTUN,
 _warnings, 0, "number of KASSERTs that have been triggered");
___
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: r332959 - head/sys/kern

2018-04-24 Thread Conrad Meyer
Author: cem
Date: Tue Apr 24 18:54:20 2018
New Revision: 332959
URL: https://svnweb.freebsd.org/changeset/base/332959

Log:
  panic: Optionally, trace secondary panics
  
  To diagnose and fix secondary panics, it is useful to have a stack trace.
  When panic tracing is enabled, optionally trace secondary panics as well.
  
  The option is configured with the tunable/sysctl debug.trace_all_panics.
  
  (The original concern that inspired only tracing the primary panic was
  likely that the secondary trace may scroll the original panic message or trace
  off the screen.  This is less of a concern for serial consoles with logging.
  Not everything has a serial console, though, so the behavior is optional.)
  
  Discussed with:   jhb
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Tue Apr 24 18:47:35 2018
(r332958)
+++ head/sys/kern/kern_shutdown.c   Tue Apr 24 18:54:20 2018
(r332959)
@@ -124,12 +124,16 @@ SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic,
 
 #ifdef KDB_TRACE
 static int trace_on_panic = 1;
+static bool trace_all_panics = true;
 #else
 static int trace_on_panic = 0;
+static bool trace_all_panics = false;
 #endif
 SYSCTL_INT(_debug, OID_AUTO, trace_on_panic,
 CTLFLAG_RWTUN | CTLFLAG_SECURE,
 _on_panic, 0, "Print stack trace on kernel panic");
+SYSCTL_BOOL(_debug, OID_AUTO, trace_all_panics, CTLFLAG_RWTUN,
+_all_panics, 0, "Print stack traces on secondary kernel panics");
 #endif /* KDB */
 
 static int sync_on_panic = 0;
@@ -829,7 +833,7 @@ vpanic(const char *fmt, va_list ap)
 #endif
printf("time = %jd\n", (intmax_t )time_second);
 #ifdef KDB
-   if (newpanic && trace_on_panic)
+   if ((newpanic || trace_all_panics) && trace_on_panic)
kdb_backtrace();
if (debugger_on_panic)
kdb_enter(KDB_WHY_PANIC, "panic");
___
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: r332958 - head/sys/kern

2018-04-24 Thread Jonathan T. Looney
Author: jtl
Date: Tue Apr 24 18:47:35 2018
New Revision: 332958
URL: https://svnweb.freebsd.org/changeset/base/332958

Log:
  Update r332860 by changing the default from suppressing post-panic
  assertions to not suppressing post-panic assertions.
  
  There are some post-panic assertions that are valuable and we shouldn't
  default to disabling them.  However, when a user trips over them, the
  user can still adjust the tunable/sysctl to suppress them temporarily to
  get conduct troubleshooting (e.g. get a core dump).
  
  Reported by:  cem, markj

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Tue Apr 24 18:41:14 2018
(r332957)
+++ head/sys/kern/kern_shutdown.c   Tue Apr 24 18:47:35 2018
(r332958)
@@ -642,7 +642,7 @@ static int kassert_do_log = 1;
 static int kassert_log_pps_limit = 4;
 static int kassert_log_mute_at = 0;
 static int kassert_log_panic_at = 0;
-static int kassert_suppress_in_panic = 1;
+static int kassert_suppress_in_panic = 0;
 static int kassert_warnings = 0;
 
 SYSCTL_NODE(_debug, OID_AUTO, kassert, CTLFLAG_RW, NULL, "kassert options");
___
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: r332957 - head/sys/kern

2018-04-24 Thread Conrad Meyer
Author: cem
Date: Tue Apr 24 18:41:14 2018
New Revision: 332957
URL: https://svnweb.freebsd.org/changeset/base/332957

Log:
  lockmgr: Add missed neutering during panic
  
  r313683 introduced new lockmgr APIs that missed the panic-time neutering
  present in the rest of our locks.  Correct that by adding the usual check.
  
  Additionally, move the __lockmgr_args neutering above the assertions at the
  top of the function.  Drop the interlock unlock because we shouldn't have
  an unneutered interlock either.  No point trying to unlock it.
  
  PR:   227749
  Reported by:  jtl
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/kern/kern_lock.c

Modified: head/sys/kern/kern_lock.c
==
--- head/sys/kern/kern_lock.c   Tue Apr 24 18:19:30 2018(r332956)
+++ head/sys/kern/kern_lock.c   Tue Apr 24 18:41:14 2018(r332957)
@@ -918,6 +918,9 @@ lockmgr_lock_fast_path(struct lock *lk, u_int flags, s
u_int op;
bool locked;
 
+   if (__predict_false(panicstr != NULL))
+   return (0);
+
op = flags & LK_TYPE_MASK;
locked = false;
switch (op) {
@@ -1100,6 +1103,9 @@ lockmgr_unlock_fast_path(struct lock *lk, u_int flags,
const char *file;
int line;
 
+   if (__predict_false(panicstr != NULL))
+   return (0);
+
file = __FILE__;
line = __LINE__;
 
@@ -1146,6 +1152,9 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lo
int contested = 0;
 #endif
 
+   if (panicstr != NULL)
+   return (0);
+
error = 0;
tid = (uintptr_t)curthread;
op = (flags & LK_TYPE_MASK);
@@ -1172,11 +1181,6 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lo
lk->lock_object.lo_name, file, line));
 
class = (flags & LK_INTERLOCK) ? LOCK_CLASS(ilk) : NULL;
-   if (panicstr != NULL) {
-   if (flags & LK_INTERLOCK)
-   class->lc_unlock(ilk);
-   return (0);
-   }
 
if (lk->lock_object.lo_flags & LK_NOSHARE) {
switch (op) {
___
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: r332860 - head/sys/kern

2018-04-24 Thread Conrad Meyer
Next time you encounter something like this, please file a bug.
There's no reason to have broken kernel dumps for a year.  It took 10
minutes to diagnose.

On Tue, Apr 24, 2018 at 10:38 AM, Andrew Gallatin  wrote:
> On 04/24/18 13:24, Jonathan T. Looney wrote:
>>
>> On Mon, Apr 23, 2018 at 6:04 PM, John Baldwin > > wrote:
>>  >
>>  > I think this is actually a key question.  In my experience to date I
>> have not
>>  > encountered a large number of post-panic assertion failures.  Given
>> that
>>  > we already break all locks and disable assertions for locks I'd be
>> curious
>>  > which assertions are actually failing.  My inclination given my
>> experiences
>>  > to date would be to explicitly ignore those as we do for locking if it
>> is
>>  > constrained set rather than blacklisting all of them.  However, I would
>> be
>>  > most interested in seeing some examples of assertions that are failing.
>>
>> The latest example (the one that prompted me to finally commit this) is in
>> lockmgr_sunlock_try(): 'panic: Assertion (*xp & ~LK_EXCLUSIVE_SPINNERS) ==
>> LK_SHARERS_LOCK(1) failed at /usr/src/sys/kern/kern_lock.c:541'
>>
>> I don't see any obvious recent changes that would have caused this, so
>> this is probably a case where a change to another file suddenly made us trip
>> over this assert.
>
>
> FWIW, that assertion has prevented me from getting a dump from an
> INVARIANTS kernel for at least a year.
>
> Drew
___
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: r332956 - stable/11/stand/common

2018-04-24 Thread Benno Rice
Author: benno
Date: Tue Apr 24 18:19:30 2018
New Revision: 332956
URL: https://svnweb.freebsd.org/changeset/base/332956

Log:
  MFC r332085
  
   Add an ISO9660 "partition table" type to loader.
  
   When booted via isoboot(8) loader will be handed a disk that simply contains
   an ISO9660 image. Currently this confuses it greatly. Teach it how to spot
   that it's in this situation and that ISO9660 has one "partition" covering
   the whole disk.
  
  Sponsored by: iXsystems, Inc.

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

Modified: stable/11/stand/common/disk.c
==
--- stable/11/stand/common/disk.c   Tue Apr 24 18:13:28 2018
(r332955)
+++ stable/11/stand/common/disk.c   Tue Apr 24 18:19:30 2018
(r332956)
@@ -270,6 +270,9 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
dev->d_offset = part.start;
od->entrysize = part.end - part.start + 1;
}
+   } else if (ptable_gettype(od->table) == PTABLE_ISO9660) {
+   dev->d_offset = 0;
+   od->entrysize = mediasize;
} else if (slice >= 0) {
/* Try to get information about partition */
if (slice == 0)

Modified: stable/11/stand/common/part.c
==
--- stable/11/stand/common/part.c   Tue Apr 24 18:13:28 2018
(r332955)
+++ stable/11/stand/common/part.c   Tue Apr 24 18:19:30 2018
(r332956)
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -97,6 +99,7 @@ static struct parttypes {
{ PART_LINUX,   "Linux" },
{ PART_LINUX_SWAP,  "Linux swap" },
{ PART_DOS, "DOS/Windows" },
+   { PART_ISO9660, "ISO9660" },
 };
 
 const char *
@@ -603,6 +606,45 @@ out:
 }
 #endif /* LOADER_VTOC8_SUPPORT */
 
+#define cdb2devb(bno)   ((bno) * ISO_DEFAULT_BLOCK_SIZE / table->sectorsize)
+
+static struct ptable *
+ptable_iso9660read(struct ptable *table, void *dev, diskread_t dread)
+{
+   uint8_t *buf;
+   struct iso_primary_descriptor *vd;
+   struct pentry *entry;
+
+   buf = malloc(table->sectorsize);
+   if (buf == NULL)
+   return (table);
+   
+   if (dread(dev, buf, 1, cdb2devb(16)) != 0) {
+   DEBUG("read failed");
+   ptable_close(table);
+   table = NULL;
+   goto out;
+   }
+   vd = (struct iso_primary_descriptor *)buf;
+   if (bcmp(vd->id, ISO_STANDARD_ID, sizeof vd->id) != 0)
+   goto out;
+
+   entry = malloc(sizeof(*entry));
+   if (entry == NULL)
+   goto out;
+   entry->part.start = 0;
+   entry->part.end = table->sectors;
+   entry->part.type = PART_ISO9660;
+   entry->part.index = 0;
+   STAILQ_INSERT_TAIL(>entries, entry, entry);
+
+   table->type = PTABLE_ISO9660;
+
+out:
+   free(buf);
+   return (table);
+}
+
 struct ptable *
 ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize,
 diskread_t *dread)
@@ -633,6 +675,11 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect
table->sectorsize = sectorsize;
table->type = PTABLE_NONE;
STAILQ_INIT(>entries);
+
+   if (ptable_iso9660read(table, dev, dread) != NULL) {
+   if (table->type == PTABLE_ISO9660)
+   goto out;
+   }
 
 #ifdef LOADER_VTOC8_SUPPORT
if (be16dec(buf + offsetof(struct vtoc8, magic)) == VTOC_MAGIC) {

Modified: stable/11/stand/common/part.h
==
--- stable/11/stand/common/part.h   Tue Apr 24 18:13:28 2018
(r332955)
+++ stable/11/stand/common/part.h   Tue Apr 24 18:19:30 2018
(r332956)
@@ -36,7 +36,8 @@ enum ptable_type {
PTABLE_BSD,
PTABLE_MBR,
PTABLE_GPT,
-   PTABLE_VTOC8
+   PTABLE_VTOC8,
+   PTABLE_ISO9660
 };
 
 enum partition_type {
@@ -52,6 +53,7 @@ enum partition_type {
PART_LINUX,
PART_LINUX_SWAP,
PART_DOS,
+   PART_ISO9660
 };
 
 struct ptable_entry {
___
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: r332860 - head/sys/kern

2018-04-24 Thread John Baldwin
On Tuesday, April 24, 2018 01:24:30 PM Jonathan T. Looney wrote:
> On Mon, Apr 23, 2018 at 6:04 PM, John Baldwin  wrote:
> >
> > I think this is actually a key question.  In my experience to date I have
> not
> > encountered a large number of post-panic assertion failures.  Given that
> > we already break all locks and disable assertions for locks I'd be curious
> > which assertions are actually failing.  My inclination given my
> experiences
> > to date would be to explicitly ignore those as we do for locking if it is
> > constrained set rather than blacklisting all of them.  However, I would be
> > most interested in seeing some examples of assertions that are failing.
> 
> The latest example (the one that prompted me to finally commit this) is in
> lockmgr_sunlock_try(): 'panic: Assertion (*xp & ~LK_EXCLUSIVE_SPINNERS) ==
> LK_SHARERS_LOCK(1) failed at /usr/src/sys/kern/kern_lock.c:541'

So that's one of the few assertions in a locking primitive that hasn't been
explicitly neutered.  I would neuter it explicitly by adjusting that assertion
to not fail if panicstr != NULL.  lockmgr() itself is mostly neutered already,
though I would move the existing panicstr check in _lockmgr_args slightly higher
above the list of KASSERT()'s.  I would say this is just a bug in lockmgr in
that it isn't careful to break locks and ignore assertions during a panic.  I
consider locking assertions to be a class that should be neutered, but I think
it's a different argument to expand that to ignoring all assertions.  Do you
have any examples of non-locking assertions?

> I don't see any obvious recent changes that would have caused this, so this
> is probably a case where a change to another file suddenly made us trip
> over this assert.

It's arguably a bug in r313683 which is only a year old.

-- 
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: r332953 - stable/11/stand/i386/gptboot

2018-04-24 Thread Benno Rice
Author: benno
Date: Tue Apr 24 18:10:04 2018
New Revision: 332953
URL: https://svnweb.freebsd.org/changeset/base/332953

Log:
  MFC r332082
  
   Use consistent whitespace.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/stand/i386/gptboot/gptboot.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/i386/gptboot/gptboot.c
==
--- stable/11/stand/i386/gptboot/gptboot.c  Tue Apr 24 17:53:27 2018
(r332952)
+++ stable/11/stand/i386/gptboot/gptboot.c  Tue Apr 24 18:10:04 2018
(r332953)
@@ -132,87 +132,93 @@ xfsread(ufs_ino_t inode, void *buf, size_t nbyte)
 static void
 bios_getmem(void)
 {
-uint64_t size;
+   uint64_t size;
 
-/* Parse system memory map */
-v86.ebx = 0;
-do {
-   v86.ctl = V86_FLAGS;
-   v86.addr = MEM_EXT; /* int 0x15 function 0xe820*/
-   v86.eax = 0xe820;
-   v86.ecx = sizeof(struct bios_smap);
-   v86.edx = SMAP_SIG;
-   v86.es = VTOPSEG();
-   v86.edi = VTOPOFF();
-   v86int();
-   if ((v86.efl & 1) || (v86.eax != SMAP_SIG))
-   break;
-   /* look for a low-memory segment that's large enough */
-   if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) &&
-   (smap.length >= (512 * 1024)))
-   bios_basemem = smap.length;
-   /* look for the first segment in 'extended' memory */
-   if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0x10)) {
-   bios_extmem = smap.length;
-   }
+   /* Parse system memory map */
+   v86.ebx = 0;
+   do {
+   v86.ctl = V86_FLAGS;
+   v86.addr = MEM_EXT; /* int 0x15 function 0xe820*/
+   v86.eax = 0xe820;
+   v86.ecx = sizeof(struct bios_smap);
+   v86.edx = SMAP_SIG;
+   v86.es = VTOPSEG();
+   v86.edi = VTOPOFF();
+   v86int();
+   if ((v86.efl & 1) || (v86.eax != SMAP_SIG))
+   break;
+   /* look for a low-memory segment that's large enough */
+   if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) &&
+   (smap.length >= (512 * 1024)))
+   bios_basemem = smap.length;
+   /* look for the first segment in 'extended' memory */
+   if ((smap.type == SMAP_TYPE_MEMORY) &&
+   (smap.base == 0x10)) {
+   bios_extmem = smap.length;
+   }
 
-   /*
-* Look for the largest segment in 'extended' memory beyond
-* 1MB but below 4GB.
-*/
-   if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base > 0x10) &&
-   (smap.base < 0x1ull)) {
-   size = smap.length;
+   /*
+* Look for the largest segment in 'extended' memory beyond
+* 1MB but below 4GB.
+*/
+   if ((smap.type == SMAP_TYPE_MEMORY) &&
+   (smap.base > 0x10) && (smap.base < 0x1ull)) {
+   size = smap.length;
 
-   /*
-* If this segment crosses the 4GB boundary, truncate it.
-*/
-   if (smap.base + size > 0x1ull)
-   size = 0x1ull - smap.base;
+   /*
+* If this segment crosses the 4GB boundary,
+* truncate it.
+*/
+   if (smap.base + size > 0x1ull)
+   size = 0x1ull - smap.base;
 
-   if (size > high_heap_size) {
-   high_heap_size = size;
-   high_heap_base = smap.base;
-   }
-   }
-} while (v86.ebx != 0);
+   if (size > high_heap_size) {
+   high_heap_size = size;
+   high_heap_base = smap.base;
+   }
+   }
+   } while (v86.ebx != 0);
 
-/* Fall back to the old compatibility function for base memory */
-if (bios_basemem == 0) {
-   v86.ctl = 0;
-   v86.addr = 0x12;/* int 0x12 */
-   v86int();
+   /* Fall back to the old compatibility function for base memory */
+   if (bios_basemem == 0) {
+   v86.ctl = 0;
+   v86.addr = 0x12;/* int 0x12 */
+   v86int();
 
-   bios_basemem = (v86.eax & 0x) * 1024;
-}
+   bios_basemem = (v86.eax & 0x) * 1024;
+   }
 
-/* Fall back through several compatibility functions for extended memory */
-if (bios_extmem == 0) {
-   v86.ctl = V86_FLAGS;
-   v86.addr = 0x15;/* int 0x15 function 0xe801*/
-   v86.eax = 0xe801;
-   v86int();
-   if (!(v86.efl & 1)) {
-   bios_extmem = ((v86.ecx & 0x) + ((v86.edx & 0x) * 

svn commit: r332955 - in stable/11: stand/i386 stand/i386/isoboot stand/libsa sys/fs/cd9660

2018-04-24 Thread Benno Rice
Author: benno
Date: Tue Apr 24 18:13:28 2018
New Revision: 332955
URL: https://svnweb.freebsd.org/changeset/base/332955

Log:
  MFC r332084
  
   Add isoboot(8) for booting BIOS systems from HDDs containing ISO images.
  
   This is part of a project for adding the ability to create hybrid CD/USB boot
   images. In the BIOS case when booting from something that isn't a CD we need
   some extra boot code to actually find our next stage (loader) within an
   ISO9660 filesystem. This code will reside in a GPT partition (similar to
   gptboot(8) from which it is derived) and looks for /boot/loader in an
   ISO9660 filesystem on the image.
  
  Sponsored by: iXsystems, Inc.

Added:
  stable/11/stand/i386/isoboot/
 - copied from r332084, head/stand/i386/isoboot/
  stable/11/stand/libsa/cd9660read.c
 - copied unchanged from r332084, head/stand/libsa/cd9660read.c
Modified:
  stable/11/stand/i386/Makefile
  stable/11/sys/fs/cd9660/iso.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/i386/Makefile
==
--- stable/11/stand/i386/Makefile   Tue Apr 24 18:11:33 2018
(r332954)
+++ stable/11/stand/i386/Makefile   Tue Apr 24 18:13:28 2018
(r332955)
@@ -5,7 +5,7 @@ NO_OBJ=t
 .include 
 
 SUBDIR.yes=mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot \
-   libi386
+   isoboot libi386
 
 SUBDIR.${MK_LOADER_FIREWIRE}+= libfirewire
 

Copied: stable/11/stand/libsa/cd9660read.c (from r332084, 
head/stand/libsa/cd9660read.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/stand/libsa/cd9660read.c  Tue Apr 24 18:13:28 2018
(r332955, copy of r332084, head/stand/libsa/cd9660read.c)
@@ -0,0 +1,364 @@
+/*
+ * Copyright (C) 1996 Wolfgang Solfrank.
+ * Copyright (C) 1996 TooLs GmbH.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ * This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
+ */
+
+/* Originally derived from libsa/cd9660.c: */
+/* $NetBSD: cd9660.c,v 1.5 1997/06/26 19:11:33 drochner Exp $  */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+
+static uint64_t cd9660_lookup(const char *);
+static ssize_t cd9660_fsread(uint64_t, void *, size_t);
+
+#defineSUSP_CONTINUATION   "CE"
+#defineSUSP_PRESENT"SP"
+#defineSUSP_STOP   "ST"
+#defineSUSP_EXTREF "ER"
+#defineRRIP_NAME   "NM"
+
+typedef struct {
+   ISO_SUSP_HEADER h;
+   u_char signature[ISODCL (  5,6)];
+   u_char len_skp  [ISODCL (  7,7)]; /* 711 */
+} ISO_SUSP_PRESENT;
+
+static int
+read_iso_block(void *buffer, daddr_t blkno)
+{
+
+   return (drvread(, buffer, blkno * 4, 4));
+}
+
+static ISO_SUSP_HEADER *
+susp_lookup_record(const char *identifier, struct iso_directory_record *dp,
+int lenskip)
+{
+   static char susp_buffer[ISO_DEFAULT_BLOCK_SIZE];
+   ISO_SUSP_HEADER *sh;
+   ISO_RRIP_CONT *shc;
+   char *p, *end;
+   int error;
+
+   p = dp->name + isonum_711(dp->name_len) + lenskip;
+   /* Names of even length have a padding byte after the name. */
+   if ((isonum_711(dp->name_len) & 1) == 0)
+   p++;
+   end = (char *)dp + isonum_711(dp->length);
+   while (p + 3 < 

svn commit: r332954 - stable/11/stand/i386/gptboot

2018-04-24 Thread Benno Rice
Author: benno
Date: Tue Apr 24 18:11:33 2018
New Revision: 332954
URL: https://svnweb.freebsd.org/changeset/base/332954

Log:
  MFC r332083:
  
   Various style(9) fixes.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/stand/i386/gptboot/gptboot.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/i386/gptboot/gptboot.c
==
--- stable/11/stand/i386/gptboot/gptboot.c  Tue Apr 24 18:10:04 2018
(r332953)
+++ stable/11/stand/i386/gptboot/gptboot.c  Tue Apr 24 18:11:33 2018
(r332954)
@@ -370,6 +370,7 @@ main(void)
 void
 exit(int x)
 {
+
while (1);
__unreachable();
 }
@@ -491,12 +492,13 @@ load(void)
 static int
 parse_cmds(char *cmdstr, int *dskupdated)
 {
-   char *arg = cmdstr;
+   char *arg;
char *ep, *p, *q;
const char *cp;
unsigned int drv;
int c, i, j;
 
+   arg = cmdstr;
*dskupdated = 0;
while ((c = *arg++)) {
if (c == ' ' || c == '\t' || c == '\n')
@@ -533,7 +535,7 @@ parse_cmds(char *cmdstr, int *dskupdated)
}
for (i = 0; c != optstr[i]; i++)
if (i == NOPT - 1)
-   return -1;
+   return (-1);
opts ^= OPT_SET(flags[i]);
}
ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) :
@@ -553,23 +555,23 @@ parse_cmds(char *cmdstr, int *dskupdated)
arg += 2;
}
if (q - arg != 2)
-   return -1;
+   return (-1);
for (i = 0; arg[0] != dev_nm[i][0] ||
arg[1] != dev_nm[i][1]; i++)
if (i == NDEV - 1)
-   return -1;
+   return (-1);
dsk.type = i;
arg += 3;
dsk.unit = *arg - '0';
if (arg[1] != 'p' || dsk.unit > 9)
-   return -1;
+   return (-1);
arg += 2;
dsk.part = *arg - '0';
if (dsk.part < 1 || dsk.part > 9)
-   return -1;
+   return (-1);
arg++;
if (arg[0] != ')')
-   return -1;
+   return (-1);
arg++;
if (drv == -1)
drv = dsk.unit;
@@ -579,13 +581,13 @@ parse_cmds(char *cmdstr, int *dskupdated)
}
if ((i = ep - arg)) {
if ((size_t)i >= sizeof(kname))
-   return -1;
+   return (-1);
memcpy(kname, arg, i + 1);
}
}
arg = p;
}
-   return 0;
+   return (0);
 }
 
 static int
@@ -617,7 +619,9 @@ vdev_read(void *vdev __unused, void *priv, off_t off, 
char *p;
daddr_t lba;
unsigned int nb;
-   struct dsk *dskp = (struct dsk *) priv;
+   struct dsk *dskp;
+
+   dskp = (struct dsk *)priv;
 
if ((off & (DEV_BSIZE - 1)) || (bytes & (DEV_BSIZE - 1)))
return (-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: r332951 - in head/sys/mips: include mips

2018-04-24 Thread John Baldwin
Author: jhb
Date: Tue Apr 24 17:53:16 2018
New Revision: 332951
URL: https://svnweb.freebsd.org/changeset/base/332951

Log:
  Fix PT_STEP single-stepping for mips.
  
  Note that GDB at least implements single stepping for MIPS using software
  breakpoints explicitly rather than using PT_STEP, so this has only been
  tested via tests in ptrace_test which now pass rather than fail.
  
  - Fix several places to use uintptr_t instead of int for virtual addresses.
  - Check for errors from ptrace_read_int() when setting a breakpoint for a
step.
  - Properly check for errors from ptrace_write_int() as it returns non-zero,
not negative values on failure.
  - Change the error returns for ptrace_read_int() and ptrace_write_int() from
ENOMEM to EFAULT.
  - Clear a single step breakpoint when it traps rather than waiting for it
to be cleared from ptrace().  This matches the behavior of the arm port
and in general seems a bit more reliable than waiting for ptrace() to
clear it via FIX_SSTEP.
  - Drop the PROC_LOCK around ptrace_write_int() in ptrace_clear_single_step()
since it can sleep.
  - Reorder the breakpoint handler in trap() to only read the instruction if
the address matches the current thread's breakpoint address.
  - Replace various #if 0'd debugging printfs with KTR_PTRACE traces.
  
  Tested on:mips64

Modified:
  head/sys/mips/include/proc.h
  head/sys/mips/mips/pm_machdep.c
  head/sys/mips/mips/trap.c

Modified: head/sys/mips/include/proc.h
==
--- head/sys/mips/include/proc.hTue Apr 24 17:46:33 2018
(r332950)
+++ head/sys/mips/include/proc.hTue Apr 24 17:53:16 2018
(r332951)
@@ -55,7 +55,7 @@ struct mdthread {
 #else
int md_upte[KSTACK_PAGES];
 #endif
-   int md_ss_addr; /* single step address for ptrace */
+   uintptr_t   md_ss_addr; /* single step address for ptrace */
int md_ss_instr;/* single step instruction for ptrace */
register_t  md_saved_intr;
u_int   md_spinlock_count;

Modified: head/sys/mips/mips/pm_machdep.c
==
--- head/sys/mips/mips/pm_machdep.c Tue Apr 24 17:46:33 2018
(r332950)
+++ head/sys/mips/mips/pm_machdep.c Tue Apr 24 17:53:16 2018
(r332951)
@@ -216,29 +216,29 @@ ptrace_set_pc(struct thread *td, unsigned long addr)
 }
 
 static int
-ptrace_read_int(struct thread *td, off_t addr, int *v)
+ptrace_read_int(struct thread *td, uintptr_t addr, int *v)
 {
 
if (proc_readmem(td, td->td_proc, addr, v, sizeof(*v)) != sizeof(*v))
-   return (ENOMEM);
+   return (EFAULT);
return (0);
 }
 
 static int
-ptrace_write_int(struct thread *td, off_t addr, int v)
+ptrace_write_int(struct thread *td, uintptr_t addr, int v)
 {
 
if (proc_writemem(td, td->td_proc, addr, , sizeof(v)) != sizeof(v))
-   return (ENOMEM);
+   return (EFAULT);
return (0);
 }
 
 int
 ptrace_single_step(struct thread *td)
 {
-   unsigned va;
+   uintptr_t va;
struct trapframe *locr0 = td->td_frame;
-   int i;
+   int error;
int bpinstr = MIPS_BREAK_SSTEP;
int curinstr;
struct proc *p;
@@ -248,46 +248,52 @@ ptrace_single_step(struct thread *td)
/*
 * Fetch what's at the current location.
 */
-   ptrace_read_int(td,  (off_t)locr0->pc, );
+   error = ptrace_read_int(td, locr0->pc, );
+   if (error)
+   goto out;
 
+   CTR3(KTR_PTRACE,
+   "ptrace_single_step: tid %d, current instr at %#lx: %#08x",
+   td->td_tid, locr0->pc, curinstr);
+
/* compute next address after current location */
-   if(curinstr != 0) {
+   if (locr0->cause & MIPS_CR_BR_DELAY) {
va = MipsEmulateBranch(locr0, locr0->pc, locr0->fsr,
(uintptr_t));
} else {
va = locr0->pc + 4;
}
if (td->td_md.md_ss_addr) {
-   printf("SS %s (%d): breakpoint already set at %x (va %x)\n",
+   printf("SS %s (%d): breakpoint already set at %lx (va %lx)\n",
p->p_comm, p->p_pid, td->td_md.md_ss_addr, va); /* XXX */
-   PROC_LOCK(p);
-   return (EFAULT);
+   error = EFAULT;
+   goto out;
}
td->td_md.md_ss_addr = va;
/*
 * Fetch what's at the current location.
 */
-   ptrace_read_int(td, (off_t)va, >td_md.md_ss_instr);
+   error = ptrace_read_int(td, (off_t)va, >td_md.md_ss_instr);
+   if (error)
+   goto out;
 
/*
 * Store breakpoint instruction at the "next" location now.
 */
-   i = ptrace_write_int (td, va, bpinstr);
+   error = ptrace_write_int(td, va, bpinstr);
 

svn commit: r332952 - stable/11/usr.bin/mkimg

2018-04-24 Thread Benno Rice
Author: benno
Date: Tue Apr 24 17:53:27 2018
New Revision: 332952
URL: https://svnweb.freebsd.org/changeset/base/332952

Log:
  MFC r332436, r332440
  
  r332436:
   Add the ability to specify absolute and relative offsets to size partitions.
  
   To create hybrid boot media we want to specify a partition at a known 
location.
   This extends the syntax of size partitions to include an optional offset that
   can be absolute or relative. It also introduces validation to make sure that
   this hasn't resulted in overlapping partitions. I haven't added this to the
   file and process partition specifications yet but the mechanics are designed
   such that if someone comes up with a good way of specifying the offset it
   will be fairly easy to add in.
  
  r332440:
   Fix a conditional that got mucked up.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/usr.bin/mkimg/mkimg.c
  stable/11/usr.bin/mkimg/scheme.h

Modified: stable/11/usr.bin/mkimg/mkimg.c
==
--- stable/11/usr.bin/mkimg/mkimg.c Tue Apr 24 17:53:16 2018
(r332951)
+++ stable/11/usr.bin/mkimg/mkimg.c Tue Apr 24 17:53:27 2018
(r332952)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -170,13 +171,14 @@ usage(const char *why)
print_schemes(1);
fputc('\n', stderr);
fprintf(stderr, "partition specification:\n");
-   fprintf(stderr, "\t[/]::\t-  empty partition of given "
-   "size\n");
-   fprintf(stderr, "\t[/]:=\t-  partition content and size "
-   "are determined\n\t\t\t\t   by the named file\n");
-   fprintf(stderr, "\t[/]:-\t-  partition content and size "
-   "are taken from\n\t\t\t\t   the output of the command to run\n");
-   fprintf(stderr, "\t-\t\t\t-  unused partition entry\n");
+   fprintf(stderr, "\t[/]::[:[+]]\t-  "
+   "empty partition of given size and\n\t\t\t\t\t"
+   "   optional relative or absolute offset\n");
+   fprintf(stderr, "\t[/]:=\t\t-  partition content and size "
+   "are\n\t\t\t\t\t   determined by the named file\n");
+   fprintf(stderr, "\t[/]:-\t\t-  partition content and size "
+   "are taken\n\t\t\t\t\t   from the output of the command to run\n");
+   fprintf(stderr, "\t-\t\t\t\t-  unused partition entry\n");
fprintf(stderr, "\twhere:\n");
fprintf(stderr, "\t\t\t-  scheme neutral partition type\n");
fprintf(stderr, "\t\t\t-  optional scheme-dependent partition "
@@ -397,12 +399,48 @@ capacity_resize(lba_t end)
 }
 
 static void
+mkimg_validate(void)
+{
+   struct part *part, *part2;
+   lba_t start, end, start2, end2;
+   int i, j;
+
+   i = 0;
+
+   TAILQ_FOREACH(part, , link) {
+   start = part->block;
+   end = part->block + part->size;
+   j = i + 1;
+   part2 = TAILQ_NEXT(part, link);
+   if (part2 == NULL)
+   break;
+
+   TAILQ_FOREACH_FROM(part2, , link) {
+   start2 = part2->block;
+   end2 = part2->block + part2->size;
+
+   if ((start >= start2 && start < end2) ||
+   (end > start2 && end <= end2)) {
+   errx(1, "partition %d overlaps partition %d",
+   i, j);
+   }
+
+   j++;
+   }
+
+   i++;
+   }
+}
+
+static void
 mkimg(void)
 {
FILE *fp;
struct part *part;
-   lba_t block;
-   off_t bytesize;
+   lba_t block, blkoffset;
+   off_t bytesize, byteoffset;
+   char *size, *offset;
+   bool abs_offset;
int error, fd;
 
/* First check partition information */
@@ -413,17 +451,46 @@ mkimg(void)
}
 
block = scheme_metadata(SCHEME_META_IMG_START, 0);
+   abs_offset = false;
TAILQ_FOREACH(part, , link) {
-   block = scheme_metadata(SCHEME_META_PART_BEFORE, block);
-   if (verbose)
-   fprintf(stderr, "partition %d: starting block %llu "
-   "... ", part->index + 1, (long long)block);
-   part->block = block;
+   byteoffset = blkoffset = 0;
+   abs_offset = false;
+
+   /* Look for an offset. Set size too if we can. */
switch (part->kind) {
case PART_KIND_SIZE:
-   if (expand_number(part->contents, ) == -1)
+   offset = part->contents;
+   size = strsep(, ":");
+   if (expand_number(size, ) == -1)
error = errno;
+   if (offset != NULL) {
+   if (*offset != '+')
+

svn commit: r332950 - head/share/man/man4

2018-04-24 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Apr 24 17:46:33 2018
New Revision: 332950
URL: https://svnweb.freebsd.org/changeset/base/332950

Log:
  Use more common format for sysctls/tunables descriptions in USB man pages.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man4/ehci.4
  head/share/man/man4/ohci.4
  head/share/man/man4/ucom.4
  head/share/man/man4/ugen.4
  head/share/man/man4/uhci.4
  head/share/man/man4/uhid.4
  head/share/man/man4/ukbd.4
  head/share/man/man4/ums.4
  head/share/man/man4/uplcom.4
  head/share/man/man4/usb.4
  head/share/man/man4/xhci.4

Modified: head/share/man/man4/ehci.4
==
--- head/share/man/man4/ehci.4  Tue Apr 24 17:42:25 2018(r332949)
+++ head/share/man/man4/ehci.4  Tue Apr 24 17:46:33 2018(r332950)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 3, 2017
+.Dd April 24, 2018
 .Dt EHCI 4
 .Os
 .Sh NAME
@@ -88,16 +88,14 @@ The default value is 0 (off).
 .It Va hw.usb.ehci.no_hs
 This tunable disables USB devices to attach like HIGH-speed ones and will 
force all attached devices to attach to the FULL- or LOW-speed companion 
controller.
 The default value is 0 (off).
-.Sh MIB Variables
-The
-.Nm
-driver exposes the following variables in the
-.Va hw.usb.ehci
-branch of the
-.Xr sysctl 3
-MIB:
-.Bl -tag -width ".Va debug"
-.It Va debug
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va hw.usb.ehci.debug
 Debug output level, where 0 is debugging disabled and larger values increase
 debug message verbosity.
 Default is 0.

Modified: head/share/man/man4/ohci.4
==
--- head/share/man/man4/ohci.4  Tue Apr 24 17:42:25 2018(r332949)
+++ head/share/man/man4/ohci.4  Tue Apr 24 17:46:33 2018(r332950)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 3, 2017
+.Dd April 24, 2018
 .Dt OHCI 4
 .Os
 .Sh NAME
@@ -59,16 +59,14 @@ NVIDIA nForce3
 .It
 Sun PCIO-2 (RIO USB)
 .El
-.Sh MIB Variables
-The
-.Nm
-driver exposes the following variables in the
-.Va hw.usb.ohci
-branch of the
-.Xr sysctl 3
-MIB:
-.Bl -tag -width ".Va debug"
-.It Va debug
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va hw.usb.ohci.debug
 Debug output level, where 0 is debugging disabled and larger values increase
 debug message verbosity.
 Default is 0.

Modified: head/share/man/man4/ucom.4
==
--- head/share/man/man4/ucom.4  Tue Apr 24 17:42:25 2018(r332949)
+++ head/share/man/man4/ucom.4  Tue Apr 24 17:46:33 2018(r332950)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 3, 2017
+.Dd April 24, 2018
 .Dt UCOM 4
 .Os
 .Sh NAME
@@ -63,20 +63,18 @@ This means that normal programs such as
 or
 .Xr ppp 8
 can be used to access the device.
-.Sh MIB Variables
-The
-.Nm
-driver exposes the following variables in the
-.Va hw.usb.ucom
-branch of the
-.Xr sysctl 3
-MIB:
-.Bl -tag -width ".Va pps_mode"
-.It Va debug
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va hw.usb.ucom.debug
 Debug output level, where 0 is debugging disabled and larger values increase
 debug message verbosity.
 Default is 0.
-.It Va pps_mode
+.It Va hw.usb.ucom.pps_mode
 Enables and configure PPS capture mode as described below.
 .Sh Pulse Per Second (PPS) Timing Interface
 The

Modified: head/share/man/man4/ugen.4
==
--- head/share/man/man4/ugen.4  Tue Apr 24 17:42:25 2018(r332949)
+++ head/share/man/man4/ugen.4  Tue Apr 24 17:46:33 2018(r332950)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 3, 2017
+.Dd April 24, 2018
 .Dt UGEN 4
 .Os
 .Sh NAME
@@ -291,16 +291,14 @@ and
 .Va alt_index
 should be set to
 .Dv USB_CURRENT_ALT_INDEX .
-.Sh MIB Variables
-The
-.Nm
-driver exposes the following variables in the
-.Va hw.usb.ugen
-branch of the
-.Xr sysctl 3
-MIB:
-.Bl -tag -width ".Va debug"
-.It Va debug
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va hw.usb.ugen.debug
 Debug output level, where 0 is debugging disabled and larger values increase
 debug message verbosity.
 Default is 0.

Modified: head/share/man/man4/uhci.4
==
--- head/share/man/man4/uhci.4  Tue Apr 24 17:42:25 2018(r332949)
+++ head/share/man/man4/uhci.4  Tue Apr 24 17:46:33 2018(r332950)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 3, 2017
+.Dd April 24, 2018
 .Dt 

svn commit: r332949 - head/sys/net

2018-04-24 Thread Mark Johnston
Author: markj
Date: Tue Apr 24 17:42:25 2018
New Revision: 332949
URL: https://svnweb.freebsd.org/changeset/base/332949

Log:
  Use dead_bpf_if instead of bp_null.
  
  This fixes a -Wunused error when DEV_BPF and NETGRAPH_BPF are not
  defined.
  
  Also remove a stray semicolon added in r332812.
  
  X-MFC with:   r332812

Modified:
  head/sys/net/bpf.c

Modified: head/sys/net/bpf.c
==
--- head/sys/net/bpf.c  Tue Apr 24 17:37:29 2018(r332948)
+++ head/sys/net/bpf.c  Tue Apr 24 17:42:25 2018(r332949)
@@ -2663,7 +2663,7 @@ bpfdetach(struct ifnet *ifp)
 */
BPFIF_WLOCK(bp);
bp->bif_flags |= BPFIF_FLAG_DYING;
-   *bp->bif_bpf = (struct bpf_if *)_bpf_if;;
+   *bp->bif_bpf = (struct bpf_if *)_bpf_if;
BPFIF_WUNLOCK(bp);
 
CTR4(KTR_NET, "%s: sheduling free for encap %d (%p) for if %p",
@@ -2982,13 +2982,13 @@ bpf_stats_sysctl(SYSCTL_HANDLER_ARGS)
 SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE,bpf_drvinit,NULL);
 
 #else /* !DEV_BPF && !NETGRAPH_BPF */
+
 /*
  * NOP stubs to allow bpf-using drivers to load and function.
  *
  * A 'better' implementation would allow the core bpf functionality
  * to be loaded at runtime.
  */
-static struct bpf_if bp_null;
 
 void
 bpf_tap(struct bpf_if *bp, u_char *pkt, u_int pktlen)
@@ -3016,7 +3016,7 @@ void
 bpfattach2(struct ifnet *ifp, u_int dlt, u_int hdrlen, struct bpf_if **driverp)
 {
 
-   *driverp = _null;
+   *driverp = (struct bpf_if *)_bpf_if;
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332860 - head/sys/kern

2018-04-24 Thread Mark Johnston
On Tue, Apr 24, 2018 at 01:24:30PM -0400, Jonathan T. Looney wrote:
> On Mon, Apr 23, 2018 at 6:04 PM, John Baldwin  wrote:
> >
> > I think this is actually a key question.  In my experience to date I have
> not
> > encountered a large number of post-panic assertion failures.  Given that
> > we already break all locks and disable assertions for locks I'd be curious
> > which assertions are actually failing.  My inclination given my
> experiences
> > to date would be to explicitly ignore those as we do for locking if it is
> > constrained set rather than blacklisting all of them.  However, I would be
> > most interested in seeing some examples of assertions that are failing.
> 
> The latest example (the one that prompted me to finally commit this) is in
> lockmgr_sunlock_try(): 'panic: Assertion (*xp & ~LK_EXCLUSIVE_SPINNERS) ==
> LK_SHARERS_LOCK(1) failed at /usr/src/sys/kern/kern_lock.c:541'
> 
> I don't see any obvious recent changes that would have caused this, so this
> is probably a case where a change to another file suddenly made us trip
> over this assert.
> 
> And, that really illustrates my overall point:

Mine too. :)

Why is anything trying to acquire a lockmgr lock after a panic? What is
the stack? I suspect that CAM is completing non-dump CCBs after a panic,
which can cause deadlocks if the completion handler needs to perform a
TLB shootdown after destroying a mapping, for example. In fact, I had
forgotten that Isilon has some CAM patches which attempt to address this
because of the problems that such deadlocks had caused. I will work on
getting these reviewed and upstreamed.

> most assertions in
> general-use code have limited value after a panic.
>
> We expect developers to write high-quality assertions so we can catch bugs.
> This requires that they understand how their code will be used. However,
> once we've panic'd, many assumptions behind code change and the assertions
> are no longer valid. (And, sometimes, it is difficult for a developer to
> predict how these things will change in a panic situation.) We can either
> play whack-a-mole to modify assertions as we trip over them in our
> post-panic work, or we can switch to an opt-in model where we only check
> assertions which the developer actually intends to run post-panic.
> 
> Playing whack-a-mole seems like a Sisyphean task which will burn out
> developers and/or frustrate people who run INVARIANTS kernels. Switching to
> an opt-in model seems like the better long-term strategy.
> 
> Having said all of that, I am cognizant of at least two things:
> 1) Mark Johnston has done a lot of work in coredumps and thinks there are
> post-panic assertions that have value.
> 2) Until we have both agreement to switch our post-panic assertion paradigm
> and also infrastructure to allow developers to opt in, it probably is not
> wise to disable all assertions by default.
> 
> So, I will follow Mark's suggestions: I will change the default. I will
> also change the code so we print a limited number of failed assertions.

Thanks.

> However, I think that changing the post-panic assertion paradigm is an
> important conversation to have. We want people to run our INVARIANTS
> kernels. And, we want to get high-quality reports from those. I think we
> could better serve those goals by changing the post-panic assertion
> paradigm.
> 
> Jonathan
___
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: r332860 - head/sys/kern

2018-04-24 Thread Andrew Gallatin

On 04/24/18 13:24, Jonathan T. Looney wrote:
On Mon, Apr 23, 2018 at 6:04 PM, John Baldwin > wrote:

 >
 > I think this is actually a key question.  In my experience to date I 
have not

 > encountered a large number of post-panic assertion failures.  Given that
 > we already break all locks and disable assertions for locks I'd be 
curious
 > which assertions are actually failing.  My inclination given my 
experiences

 > to date would be to explicitly ignore those as we do for locking if it is
 > constrained set rather than blacklisting all of them.  However, I 
would be

 > most interested in seeing some examples of assertions that are failing.

The latest example (the one that prompted me to finally commit this) is 
in lockmgr_sunlock_try(): 'panic: Assertion (*xp & 
~LK_EXCLUSIVE_SPINNERS) == LK_SHARERS_LOCK(1) failed at 
/usr/src/sys/kern/kern_lock.c:541'


I don't see any obvious recent changes that would have caused this, so 
this is probably a case where a change to another file suddenly made us 
trip over this assert.


FWIW, that assertion has prevented me from getting a dump from an
INVARIANTS kernel for at least a year.

Drew
___
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: r332948 - stable/11/contrib/top

2018-04-24 Thread Kurt Lidl
Author: lidl
Date: Tue Apr 24 17:37:29 2018
New Revision: 332948
URL: https://svnweb.freebsd.org/changeset/base/332948

Log:
  MFC r332671: top: fix warnings from clang/gcc
  
  Add includes for  and  where necessary, and
  rename a few internal functions to have a "top_" prefix to avoid
  clashes with standard names from curses.h/termcap.h headers.
  
  Top now compiles without warnings on both gcc and clang.

Modified:
  stable/11/contrib/top/display.c
  stable/11/contrib/top/screen.c
  stable/11/contrib/top/screen.h
  stable/11/contrib/top/top.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/top/display.c
==
--- stable/11/contrib/top/display.c Tue Apr 24 17:35:13 2018
(r332947)
+++ stable/11/contrib/top/display.c Tue Apr 24 17:37:29 2018
(r332948)
@@ -32,7 +32,9 @@
 
 #include 
 
+#include 
 #include 
+#include 
 #include 
 #include 
 
@@ -255,7 +257,7 @@ double *avenrun;
 register int i;
 
 /* i_loadave also clears the screen, since it is first */
-clear();
+top_clear();
 
 /* mpid == -1 implies this system doesn't have an _mpid */
 if (mpid != -1)
@@ -796,7 +798,7 @@ i_message()
 }
 if (next_msg[0] != '\0')
 {
-   standout(next_msg);
+   top_standout(next_msg);
msglen = strlen(next_msg);
next_msg[0] = '\0';
 }
@@ -1076,7 +1078,7 @@ caddr_t a1, a2, a3;
i = strlen(next_msg);
if ((type & MT_delayed) == 0)
{
-   type & MT_standout ? standout(next_msg) :
+   type & MT_standout ? top_standout(next_msg) :
 fputs(next_msg, stdout);
(void) clear_eol(msglen - i);
msglen = i;
@@ -1088,7 +1090,7 @@ caddr_t a1, a2, a3;
 {
if ((type & MT_delayed) == 0)
{
-   type & MT_standout ? standout(next_msg) : fputs(next_msg, stdout);
+   type & MT_standout ? top_standout(next_msg) : fputs(next_msg, 
stdout);
msglen = strlen(next_msg);
next_msg[0] = '\0';
}

Modified: stable/11/contrib/top/screen.c
==
--- stable/11/contrib/top/screen.c  Tue Apr 24 17:35:13 2018
(r332947)
+++ stable/11/contrib/top/screen.c  Tue Apr 24 17:37:29 2018
(r332948)
@@ -45,6 +45,8 @@
 #  endif
 # endif
 #endif
+#include 
+#include 
 #include "screen.h"
 #include "boolean.h"
 
@@ -432,10 +434,7 @@ get_screensize()
 }
 
 void
-standout(msg)
-
-char *msg;
-
+top_standout(char *msg)
 {
 if (smart_terminal)
 {
@@ -450,8 +449,7 @@ char *msg;
 }
 
 void
-clear()
-
+top_clear()
 {
 if (smart_terminal)
 {
@@ -460,10 +458,7 @@ clear()
 }
 
 int
-clear_eol(len)
-
-int len;
-
+clear_eol(int len)
 {
 if (smart_terminal && !overstrike && len > 0)
 {
@@ -496,12 +491,8 @@ go_home()
 
 /* This has to be defined as a subroutine for tputs (instead of a macro) */
 
-void
-putstdout(ch)
-
-char ch;
-
+int
+putstdout(int ch)
 {
-putchar(ch);
+return putchar(ch);
 }
-

Modified: stable/11/contrib/top/screen.h
==
--- stable/11/contrib/top/screen.h  Tue Apr 24 17:35:13 2018
(r332947)
+++ stable/11/contrib/top/screen.h  Tue Apr 24 17:37:29 2018
(r332948)
@@ -28,10 +28,10 @@ extern int  screen_length;
 extern int  screen_width;
 
 /* a function that puts a single character on stdout */
-void   putstdout(char ch);
+intputstdout(int ch);
 intclear_eol(int len);
-void   standout(char *msg);
-void   clear(void);
+void   top_standout(char *msg);
+void   top_clear(void);
 void   go_home(void);
 void   reinit_screen(void);
 void   get_screensize(void);

Modified: stable/11/contrib/top/top.c
==
--- stable/11/contrib/top/top.c Tue Apr 24 17:35:13 2018(r332947)
+++ stable/11/contrib/top/top.c Tue Apr 24 17:37:29 2018(r332948)
@@ -39,6 +39,7 @@ char *copyright =
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -79,7 +80,7 @@ int pcpu_stats = No;
 sigret_t leave();
 sigret_t tstop();
 #ifdef SIGWINCH
-sigret_t winch();
+sigret_t top_winch(int);
 #endif
 
 volatile sig_atomic_t leaveflag;
@@ -681,7 +682,7 @@ char *argv[];
 (void) signal(SIGQUIT, leave);
 (void) signal(SIGTSTP, tstop);
 #ifdef SIGWINCH
-(void) signal(SIGWINCH, winch);
+(void) signal(SIGWINCH, top_winch);
 #endif
 #ifdef SIGRELSE
 sigrelse(SIGINT);
@@ -896,7 +897,7 @@ restart:
max_topn = display_resize();
 
/* reset the signal handler */
-   (void) signal(SIGWINCH, winch);
+   (void) signal(SIGWINCH, top_winch);
 
reset_display();
winchflag = 0;

svn commit: r332947 - stable/11/usr.bin/etdump

2018-04-24 Thread Benno Rice
Author: benno
Date: Tue Apr 24 17:35:13 2018
New Revision: 332947
URL: https://svnweb.freebsd.org/changeset/base/332947

Log:
  Actually MFC r331949, r332437, r332438
  
  (Previous commit didn't have new files added.)
  
  r331949:
   Add the etdump utility for dumping El Torito boot catalog information.
  
   This can be used to check existing images but will be used in the future to
   find EFI ESP images placed in El Torito catalogs so they can be used for
   hybrid boot purposes.
  
  r332427:
   Check the return value of fseek.
  
  r332438:
   Remove a debugging printf that crept in.
  
  Sponsored by: iXsystems, Inc.
  Pointy hat to:benno

Added:
  stable/11/usr.bin/etdump/
  stable/11/usr.bin/etdump/Makefile   (contents, props changed)
  stable/11/usr.bin/etdump/etdump.1   (contents, props changed)
  stable/11/usr.bin/etdump/etdump.c   (contents, props changed)
  stable/11/usr.bin/etdump/etdump.h   (contents, props changed)
  stable/11/usr.bin/etdump/output_shell.c   (contents, props changed)
  stable/11/usr.bin/etdump/output_text.c   (contents, props changed)

Added: stable/11/usr.bin/etdump/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/usr.bin/etdump/Makefile   Tue Apr 24 17:35:13 2018
(r332947)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PROG=  etdump
+
+MAKEFS_SRC=${SRCTOP}/usr.sbin/makefs
+
+CFLAGS+=   -I${SRCTOP}/sys/fs/cd9660 -I${MAKEFS_SRC} \
+   -I${MAKEFS_SRC}/cd9660
+
+.PATH: ${MAKEFS_SRC}/cd9660
+
+SRCS=  etdump.c output_shell.c output_text.c cd9660_conversion.c
+
+.include 

Added: stable/11/usr.bin/etdump/etdump.1
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/usr.bin/etdump/etdump.1   Tue Apr 24 17:35:13 2018
(r332947)
@@ -0,0 +1,104 @@
+.\" Copyright (c) 2018 iXsystems, Inc
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 3, 2018
+.Dt ETDUMP 8
+.Os
+.Sh NAME
+.Nm etdump
+.Nd Dump El Torito boot catalog information from ISO images
+.Sh SYNOPSIS
+.Nm
+.Op Fl f Ar format
+.Op Fl o Ar file
+.Ar
+.Sh DESCRIPTION
+This program reads El Torito boot catalog information from an ISO image and
+outputs it in various formats.
+It can be used to check the catalog in an image or to output catalog data in
+a format that can be used by other tools such as shell scripts.
+.Pp
+Supported options are:
+.Bl -tag -width flag
+.It Fl f Ar format Fl -format Ar format
+Select the output format.
+Supported output formats are:
+.Bl -tag -width shell -offset indent
+.It Sy text
+Human-readable text (default)
+.It Sy shell
+Each boot entry is emitted as a string suitable for passing to a sh-compatible
+eval command.
+The variables emitted are:
+.Bl -tag -width et_platform -offset indent
+.It et_platform
+The platform ID from the section header.
+Set to 'default' for the initial (default) entry.
+.It et_system
+The system ID from the boot entry.
+.It et_lba
+The starting LBA (2048-byte blocks) of the boot image.
+.It et_sectors
+The number of sectors (512-byte sectors) that comprise the boot image.
+.El
+.El
+.It Fl o Ar file Fl -output Ar file
+Write output to
+.Ar file .
+If '-' is specified then standard out is used.
+.El
+.Sh EXAMPLES
+To see what entries are in a given boot catalog run
+.Nm
+passing the filename of the image as an argument like so:
+.Bd -literal -offset indent
+% etdump bootonly.iso
+Image in bootonly.iso
+Default entry
+   System i386
+   Start LBA 420 (0x1a4), sector count 4 (0x4)
+ 

svn commit: r332946 - stable/11/usr.bin

2018-04-24 Thread Benno Rice
Author: benno
Date: Tue Apr 24 17:33:30 2018
New Revision: 332946
URL: https://svnweb.freebsd.org/changeset/base/332946

Log:
  MFC r331949, r332437, r332438
  
  r331949:
   Add the etdump utility for dumping El Torito boot catalog information.
  
   This can be used to check existing images but will be used in the future to
   find EFI ESP images placed in El Torito catalogs so they can be used for
   hybrid boot purposes.
  
  r332427:
   Check the return value of fseek.
  
  r332438:
   Remove a debugging printf that crept in.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/usr.bin/Makefile

Modified: stable/11/usr.bin/Makefile
==
--- stable/11/usr.bin/Makefile  Tue Apr 24 17:31:20 2018(r332945)
+++ stable/11/usr.bin/Makefile  Tue Apr 24 17:33:30 2018(r332946)
@@ -41,6 +41,7 @@ SUBDIR=   alias \
elfdump \
enigma \
env \
+   etdump \
expand \
false \
fetch \
___
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: r332945 - head/sys/mips/mips

2018-04-24 Thread John Baldwin
Author: jhb
Date: Tue Apr 24 17:31:20 2018
New Revision: 332945
URL: https://svnweb.freebsd.org/changeset/base/332945

Log:
  Don't fetch the current instruction for faults on user "trap" instructions.
  
  The value of 'instr' was not used to handle the fault.
  
  Reported by:  GCC's -Wunused-but-set-variable

Modified:
  head/sys/mips/mips/trap.c

Modified: head/sys/mips/mips/trap.c
==
--- head/sys/mips/mips/trap.c   Tue Apr 24 17:22:17 2018(r332944)
+++ head/sys/mips/mips/trap.c   Tue Apr 24 17:31:20 2018(r332945)
@@ -875,15 +875,12 @@ dofault:
case T_TRAP + T_USER:
{
intptr_t va;
-   uint32_t instr;
struct trapframe *locr0 = td->td_frame;
 
/* compute address of trap instruction */
va = trapframe->pc;
if (DELAYBRANCH(trapframe->cause))
va += sizeof(int);
-   /* read break instruction */
-   instr = fuword32((caddr_t)va);
 
if (DELAYBRANCH(trapframe->cause)) {/* Check BD bit 
*/
locr0->pc = MipsEmulateBranch(locr0, 
trapframe->pc, 0,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332860 - head/sys/kern

2018-04-24 Thread Jonathan T. Looney
On Mon, Apr 23, 2018 at 6:04 PM, John Baldwin  wrote:
>
> I think this is actually a key question.  In my experience to date I have
not
> encountered a large number of post-panic assertion failures.  Given that
> we already break all locks and disable assertions for locks I'd be curious
> which assertions are actually failing.  My inclination given my
experiences
> to date would be to explicitly ignore those as we do for locking if it is
> constrained set rather than blacklisting all of them.  However, I would be
> most interested in seeing some examples of assertions that are failing.

The latest example (the one that prompted me to finally commit this) is in
lockmgr_sunlock_try(): 'panic: Assertion (*xp & ~LK_EXCLUSIVE_SPINNERS) ==
LK_SHARERS_LOCK(1) failed at /usr/src/sys/kern/kern_lock.c:541'

I don't see any obvious recent changes that would have caused this, so this
is probably a case where a change to another file suddenly made us trip
over this assert.

And, that really illustrates my overall point: most assertions in
general-use code have limited value after a panic.

We expect developers to write high-quality assertions so we can catch bugs.
This requires that they understand how their code will be used. However,
once we've panic'd, many assumptions behind code change and the assertions
are no longer valid. (And, sometimes, it is difficult for a developer to
predict how these things will change in a panic situation.) We can either
play whack-a-mole to modify assertions as we trip over them in our
post-panic work, or we can switch to an opt-in model where we only check
assertions which the developer actually intends to run post-panic.

Playing whack-a-mole seems like a Sisyphean task which will burn out
developers and/or frustrate people who run INVARIANTS kernels. Switching to
an opt-in model seems like the better long-term strategy.

Having said all of that, I am cognizant of at least two things:
1) Mark Johnston has done a lot of work in coredumps and thinks there are
post-panic assertions that have value.
2) Until we have both agreement to switch our post-panic assertion paradigm
and also infrastructure to allow developers to opt in, it probably is not
wise to disable all assertions by default.

So, I will follow Mark's suggestions: I will change the default. I will
also change the code so we print a limited number of failed assertions.

However, I think that changing the post-panic assertion paradigm is an
important conversation to have. We want people to run our INVARIANTS
kernels. And, we want to get high-quality reports from those. I think we
could better serve those goals by changing the post-panic assertion
paradigm.

Jonathan
___
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: r332944 - head/sys/mips/mips

2018-04-24 Thread John Baldwin
Author: jhb
Date: Tue Apr 24 17:22:17 2018
New Revision: 332944
URL: https://svnweb.freebsd.org/changeset/base/332944

Log:
  Use a cleaner test for the branch delay (BD) bit in DELAYBRANCH.
  
  Rather than casting the value of cause to int and checking for a negative
  value to determine if bit 31 is set, use a binary and with MIPS_CR_BR_DELAY.

Modified:
  head/sys/mips/mips/trap.c

Modified: head/sys/mips/mips/trap.c
==
--- head/sys/mips/mips/trap.c   Tue Apr 24 17:13:31 2018(r332943)
+++ head/sys/mips/mips/trap.c   Tue Apr 24 17:22:17 2018(r332944)
@@ -281,7 +281,7 @@ struct trapdebug trapdebug[TRAPSIZE], *trp = trapdebug
 #endif
 
 #defineKERNLAND(x) ((vm_offset_t)(x) >= VM_MIN_KERNEL_ADDRESS && 
(vm_offset_t)(x) < VM_MAX_KERNEL_ADDRESS)
-#defineDELAYBRANCH(x)  ((int)(x) < 0)
+#defineDELAYBRANCH(x)  ((x) & MIPS_CR_BR_DELAY)
 
 /*
  * MIPS load/store access type
___
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: r332943 - stable/11/usr.sbin/daemon

2018-04-24 Thread Ian Lepore
Author: ian
Date: Tue Apr 24 17:13:31 2018
New Revision: 332943
URL: https://svnweb.freebsd.org/changeset/base/332943

Log:
  MFC r332518, r332527
  
  r332518:
  Add an option to daemon(8) to specify a delay between restarts of a
  supervised program.  The existing -r option has a hard-coded delay of one
  second.  This change adds a -R option which takes a delay in seconds.  This
  can be used to prevent log spam and rapid restarts, similar to init(8)'s
  behavior of adding a delay between rapid restarts when it's supervising a
  program.
  
  r332527:
  Fix cut-and-pasted line to have the right option letter.

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

Modified: stable/11/usr.sbin/daemon/daemon.8
==
--- stable/11/usr.sbin/daemon/daemon.8  Tue Apr 24 17:00:08 2018
(r332942)
+++ stable/11/usr.sbin/daemon/daemon.8  Tue Apr 24 17:13:31 2018
(r332943)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 22, 2016
+.Dd April 15, 2018
 .Dt DAEMON 8
 .Os
 .Sh NAME
@@ -44,6 +44,7 @@
 .Op Fl s Ar syslog_priority
 .Op Fl T Ar syslog_tag
 .Op Fl l Ar syslog_facility
+.Op Fl R Ar restart_delay_seconds
 .Ar command arguments ...
 .Sh DESCRIPTION
 The
@@ -114,7 +115,11 @@ regardless of whether the
 .Fl u
 option is used or not.
 .It Fl r
-Supervise and restart the program if it has been terminated.
+Supervise and restart the program after a one-second delay if it has
+been terminated.
+.It Fl R restart_delay_seconds
+Supervise and restart the program after the specified delay
+if it has been terminated.
 .It Fl t Ar title
 Set the title for the daemon process.
 The default is the daemonized invocation.

Modified: stable/11/usr.sbin/daemon/daemon.c
==
--- stable/11/usr.sbin/daemon/daemon.c  Tue Apr 24 17:00:08 2018
(r332942)
+++ stable/11/usr.sbin/daemon/daemon.c  Tue Apr 24 17:13:31 2018
(r332943)
@@ -99,7 +99,7 @@ main(int argc, char *argv[])
dosyslog = 0;
outfn = NULL;
title = NULL;
-   while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:T:")) != -1) {
+   while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:R:T:")) != -1) {
switch (ch) {
case 'c':
nochdir = 0;
@@ -130,6 +130,11 @@ main(int argc, char *argv[])
case 'r':
restart = 1;
break;
+   case 'R':
+   restart = strtol(optarg, , 0);
+   if (p == optarg || restart < 1)
+   errx(6, "invalid restart delay");
+   break;
case 's':
logpri = get_log_mapping(optarg, prioritynames);
if (logpri == -1)
@@ -359,7 +364,7 @@ restart:
goto exit;
}
if (restart && !terminate) {
-   daemon_sleep(1, 0);
+   daemon_sleep(restart, 0);
close(pfd[0]);
pfd[0] = -1;
goto restart;
@@ -558,7 +563,7 @@ usage(void)
"usage: daemon [-cfrS] [-p child_pidfile] [-P supervisor_pidfile]\n"
"  [-u user] [-o output_file] [-t title]\n"
"  [-l syslog_facility] [-s syslog_priority]\n"
-   "  [-T syslog_tag] [-m output_mask]\n"
+   "  [-T syslog_tag] [-m output_mask] [-R 
restart_delay_secs]\n"
"command arguments ...\n");
exit(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: r332942 - in stable/11: share/man/man4 sys/dev/spibus sys/modules/spigen sys/sys

2018-04-24 Thread Ian Lepore
Author: ian
Date: Tue Apr 24 17:00:08 2018
New Revision: 332942
URL: https://svnweb.freebsd.org/changeset/base/332942

Log:
  MFC r331868, r332046, r332194-r332196, r332198, r332219, r332231, r332233, 
r332240, r332258-r332259, r332261, r332292
  
  r331868:
  Add opt_platform.h for several modules that have #ifdef FDT in the source.
  
  Submitted by: Andre Albsmeier 
  
  r332046:
  Add a missing MODULE_DEPEND().
  
  r332194:
  Add support for writing/changing spi device ivars.  The SPI mode (polarity
  and phase) and the maximum bus speed can be changed.  The chip select
  number cannot be changed, because the device instances which are children
  of spibus are inherently associated with the chip select number they were
  instantiated for.
  
  r332195:
  A couple minor improvements to spibus.c...
  
   - Change the description string to "SPI bus" (was "spibus bus").
  
   - This is the default driver for a SPI bus, not a generic implementation,
 so return the probe value that indicates such.
  
   - Use device_delete_children() at detach time, instead of a local loop
 to enumerate the children and detach each one individually.
  
  r332196:
  Return BUS_PROBE_DEFAULT, not zero, because this is not the one driver
  implementation that must be used, it's just the base system default driver.
  
  Also add a comment noting that we're being more liberal about the bus
  frequency property than the dts binding documents require.
  
  r332198:
  Arrange the list of generated sources as 1-per-line alphbetical, and add
  the files required when building for FDT-based systems.
  
  r332219:
  Remove the existing identify() hack to force-add a spigen device on
  FDT-based systems, and instead add proper FDT probe code.  Because this
  driver is freebsd-specific and just provides generic userland access to run
  spibus transactions, there is no bindings document to mandate a compatible
  string, so just arbitrarily use "freebsd,spigen".
  
  r332231:
  Generate a spibus_set_[ivarname]() convenience function for each ivar,
  now that they can be set.
  
  r332233:
  Add an ioctl to get/set the SPI transfer mode.  Also, make the bus clock
  frequency ioctl actually set the corresponding ivar instead of just storing
  the value locally in the softc (and then not using it for anything).  Also,
  return the correct error code if the ioctl cmd is not recognized.
  
  r332240:
  Add the ioctl definitions for spigen get/set spi mode.  Should have been
  part of r332233.
  
  r332258:
  Don't check for impossible NULL return from malloc(..., M_WAITOK).
  
  r332259:
  Cast the data pointer to the correct type for the data being accessed (as
  opposed to one that accidentally worked on the one arch I test-compiled for
  on my first try).
  
  Reported by:  np@, O. Hartmann 
  Pointy hat:   ian@
  
  r332261:
  Add a manpage for spigen(4).
  
  r332292:
  Allow hinted attachment on FDT-based systems.  Instead of returning ENXIO
  when the FDT data doesn't enable the device instance, return
  BUS_PROBE_NOWILDCARD, the same as for non-FDT systems.

Added:
  stable/11/share/man/man4/spigen.4
 - copied unchanged from r332261, head/share/man/man4/spigen.4
Modified:
  stable/11/sys/dev/spibus/ofw_spibus.c
  stable/11/sys/dev/spibus/spibus.c
  stable/11/sys/dev/spibus/spibusvar.h
  stable/11/sys/dev/spibus/spigen.c
  stable/11/sys/modules/spigen/Makefile
  stable/11/sys/sys/spigenio.h
Directory Properties:
  stable/11/   (props changed)

Copied: stable/11/share/man/man4/spigen.4 (from r332261, 
head/share/man/man4/spigen.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/share/man/man4/spigen.4   Tue Apr 24 17:00:08 2018
(r332942, copy of r332261, head/share/man/man4/spigen.4)
@@ -0,0 +1,206 @@
+.\"
+.\" Copyright (c) 2018 Ian Lepore 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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; 

svn commit: r332941 - stable/11/sys/dev/wl

2018-04-24 Thread Ian Lepore
Author: ian
Date: Tue Apr 24 16:45:13 2018
New Revision: 332941
URL: https://svnweb.freebsd.org/changeset/base/332941

Log:
  Fix wl(4) after r332288, using the same fix applied in r332331.  This
  driver no longer exists in head, so this is a direct commit to 11-stable.

Modified:
  stable/11/sys/dev/wl/if_wl.c

Modified: stable/11/sys/dev/wl/if_wl.c
==
--- stable/11/sys/dev/wl/if_wl.cTue Apr 24 15:59:39 2018
(r332940)
+++ stable/11/sys/dev/wl/if_wl.cTue Apr 24 16:45:13 2018
(r332941)
@@ -1426,7 +1426,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* read out the number of used cache elements */
 case SIOCGWLCITEM:
WL_LOCK(sc);
-   ifr_data_get_ptr(ifr) = (caddr_t) sc->w_sigitems;
+   ifr->ifr_ifru.ifru_data = (caddr_t) sc->w_sigitems;
WL_UNLOCK(sc);
break;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332940 - head/lib/libc/secure

2018-04-24 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 24 15:59:39 2018
New Revision: 332940
URL: https://svnweb.freebsd.org/changeset/base/332940

Log:
  Carefully update stack guard bytes inside __guard_setup().
  
  This is necessary to make sure that functions that can have stack
  protection are not used to update the stack guard. If not, the stack
  guard check would fail when it shouldn't.
  
  guard_setup() calls elf_aux_info(), which, in turn, calls memcpy() to
  update stack_chk_guard.  If either elf_aux_info() or memcpy() have
  stack protection enabled, __stack_chk_guard will be modified before
  returning from them, causing the stack protection check to fail.
  
  This change uses a temporary buffer to delay changing
  __stack_chk_guard until elf_aux_info() returns.
  
  Submitted by: Luis Pires
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D15173

Modified:
  head/lib/libc/secure/stack_protector.c

Modified: head/lib/libc/secure/stack_protector.c
==
--- head/lib/libc/secure/stack_protector.c  Tue Apr 24 15:04:07 2018
(r332939)
+++ head/lib/libc/secure/stack_protector.c  Tue Apr 24 15:59:39 2018
(r332940)
@@ -54,15 +54,27 @@ static void
 __guard_setup(void)
 {
static const int mib[2] = { CTL_KERN, KERN_ARND };
+   volatile long tmp_stack_chk_guard[nitems(__stack_chk_guard)];
size_t len;
-   int error;
+   int error, idx;
 
if (__stack_chk_guard[0] != 0)
return;
-   error = _elf_aux_info(AT_CANARY, __stack_chk_guard,
-   sizeof(__stack_chk_guard));
-   if (error == 0 && __stack_chk_guard[0] != 0)
+   /*
+* Avoid using functions which might have stack protection
+* enabled, to update the __stack_chk_guard.  First fetch the
+* data into a temporal array, then do manual volatile copy to
+* not allow optimizer to call memcpy() behind us.
+*/
+   error = _elf_aux_info(AT_CANARY, (void *)tmp_stack_chk_guard,
+   sizeof(tmp_stack_chk_guard));
+   if (error == 0 && tmp_stack_chk_guard[0] != 0) {
+   for (idx = 0; idx < nitems(__stack_chk_guard); idx++) {
+   __stack_chk_guard[idx] = tmp_stack_chk_guard[idx];
+   tmp_stack_chk_guard[idx] = 0;
+   }
return;
+   }
 
len = sizeof(__stack_chk_guard);
if (__sysctl(mib, nitems(mib), __stack_chk_guard, , NULL, 0) ==
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332939 - in stable/11/sys/cddl: contrib/opensolaris/uts/common/dtrace dev/dtrace

2018-04-24 Thread Mark Johnston
Author: markj
Date: Tue Apr 24 15:04:07 2018
New Revision: 332939
URL: https://svnweb.freebsd.org/changeset/base/332939

Log:
  MFC r332364:
  Assert that dtrace_probe() doesn't re-enter itself.

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  stable/11/sys/cddl/dev/dtrace/dtrace_cddl.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c   Tue Apr 
24 14:55:22 2018(r332938)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c   Tue Apr 
24 15:04:07 2018(r332939)
@@ -7116,6 +7116,44 @@ dtrace_store_by_ref(dtrace_difo_t *dp, caddr_t tomax, 
 }
 
 /*
+ * Disables interrupts and sets the per-thread inprobe flag. When DEBUG is
+ * defined, we also assert that we are not recursing unless the probe ID is an
+ * error probe.
+ */
+static dtrace_icookie_t
+dtrace_probe_enter(dtrace_id_t id)
+{
+   dtrace_icookie_t cookie;
+
+   cookie = dtrace_interrupt_disable();
+
+   /*
+* Unless this is an ERROR probe, we are not allowed to recurse in
+* dtrace_probe(). Recursing into DTrace probe usually means that a
+* function is instrumented that should not have been instrumented or
+* that the ordering guarantee of the records will be violated,
+* resulting in unexpected output. If there is an exception to this
+* assertion, a new case should be added.
+*/
+   ASSERT(curthread->t_dtrace_inprobe == 0 ||
+   id == dtrace_probeid_error);
+   curthread->t_dtrace_inprobe = 1;
+
+   return (cookie);
+}
+
+/*
+ * Disables interrupts and clears the per-thread inprobe flag.
+ */
+static void
+dtrace_probe_exit(dtrace_icookie_t cookie)
+{
+
+   curthread->t_dtrace_inprobe = 0;
+   dtrace_interrupt_enable(cookie);
+}
+
+/*
  * If you're looking for the epicenter of DTrace, you just found it.  This
  * is the function called by the provider to fire a probe -- from which all
  * subsequent probe-context DTrace activity emanates.
@@ -7149,7 +7187,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t
return;
 #endif
 
-   cookie = dtrace_interrupt_disable();
+   cookie = dtrace_probe_enter(id);
probe = dtrace_probes[id - 1];
cpuid = curcpu;
onintr = CPU_ON_INTR(CPU);
@@ -7160,7 +7198,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t
 * We have hit in the predicate cache; we know that
 * this predicate would evaluate to be false.
 */
-   dtrace_interrupt_enable(cookie);
+   dtrace_probe_exit(cookie);
return;
}
 
@@ -7172,7 +7210,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t
/*
 * We don't trace anything if we're panicking.
 */
-   dtrace_interrupt_enable(cookie);
+   dtrace_probe_exit(cookie);
return;
}
 
@@ -7858,7 +7896,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t
if (vtime)
curthread->t_dtrace_start = dtrace_gethrtime();
 
-   dtrace_interrupt_enable(cookie);
+   dtrace_probe_exit(cookie);
 }
 
 /*

Modified: stable/11/sys/cddl/dev/dtrace/dtrace_cddl.h
==
--- stable/11/sys/cddl/dev/dtrace/dtrace_cddl.h Tue Apr 24 14:55:22 2018
(r332938)
+++ stable/11/sys/cddl/dev/dtrace/dtrace_cddl.h Tue Apr 24 15:04:07 2018
(r332939)
@@ -46,6 +46,7 @@ typedef struct kdtrace_proc {
 typedef struct kdtrace_thread {
u_int8_ttd_dtrace_stop; /* Indicates a DTrace-desired stop */
u_int8_ttd_dtrace_sig;  /* Signal sent via DTrace's raise() */
+   u_int8_ttd_dtrace_inprobe; /* Are we in a probe? */
u_int   td_predcache;   /* DTrace predicate cache */
u_int64_t   td_dtrace_vtime; /* DTrace virtual time */
u_int64_t   td_dtrace_start; /* DTrace slice start time */
@@ -97,6 +98,7 @@ typedef struct kdtrace_thread {
 #definet_dtrace_start  td_dtrace->td_dtrace_start
 #definet_dtrace_stop   td_dtrace->td_dtrace_stop
 #definet_dtrace_sigtd_dtrace->td_dtrace_sig
+#definet_dtrace_inprobetd_dtrace->td_dtrace_inprobe
 #definet_predcache td_dtrace->td_predcache
 #definet_dtrace_ft td_dtrace->td_dtrace_ft
 #definet_dtrace_on td_dtrace->td_dtrace_on
___
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: r332936 - in head/sys: compat/linprocfs fs/procfs

2018-04-24 Thread Eitan Adler
Author: eadler
Date: Tue Apr 24 14:49:09 2018
New Revision: 332936
URL: https://svnweb.freebsd.org/changeset/base/332936

Log:
  [procfs] Split procfs_attr into multiple functions
  
  Reviewed by:  des, kib
  Discussed with:   mmacy
  Differential Revision:https://reviews.freebsd.org/D15150

Modified:
  head/sys/compat/linprocfs/linprocfs.c
  head/sys/fs/procfs/procfs.c
  head/sys/fs/procfs/procfs.h

Modified: head/sys/compat/linprocfs/linprocfs.c
==
--- head/sys/compat/linprocfs/linprocfs.c   Tue Apr 24 14:35:39 2018
(r332935)
+++ head/sys/compat/linprocfs/linprocfs.c   Tue Apr 24 14:49:09 2018
(r332936)
@@ -1591,7 +1591,7 @@ linprocfs_init(PFS_INIT_ARGS)
pfs_create_file(dir, "maps", _doprocmaps,
NULL, NULL, NULL, PFS_RD);
pfs_create_file(dir, "mem", _doprocmem,
-   _attr, _candebug, NULL, PFS_RDWR|PFS_RAW);
+   procfs_attr_rw, _candebug, NULL, PFS_RDWR | PFS_RAW);
pfs_create_file(dir, "mounts", _domtab,
NULL, NULL, NULL, PFS_RD);
pfs_create_link(dir, "root", _doprocroot,

Modified: head/sys/fs/procfs/procfs.c
==
--- head/sys/fs/procfs/procfs.c Tue Apr 24 14:35:39 2018(r332935)
+++ head/sys/fs/procfs/procfs.c Tue Apr 24 14:49:09 2018(r332936)
@@ -98,24 +98,10 @@ procfs_docurproc(PFS_FILL_ARGS)
return (0);
 }
 
-/*
- * Adjust mode for some nodes that need it
- */
-int
-procfs_attr(PFS_ATTR_ARGS)
-{
+static int
+procfs_attr(PFS_ATTR_ARGS, int mode) {
 
-   /* XXX inefficient, split into separate functions */
-   if (strcmp(pn->pn_name, "note") == 0 ||
-   strcmp(pn->pn_name, "notepg") == 0)
-   vap->va_mode = 0200;
-   else if (strcmp(pn->pn_name, "mem") == 0 ||
-   strcmp(pn->pn_name, "regs") == 0 ||
-   strcmp(pn->pn_name, "dbregs") == 0 ||
-   strcmp(pn->pn_name, "fpregs") == 0 ||
-   strcmp(pn->pn_name, "osrel") == 0)
-   vap->va_mode = 0600;
-
+   vap->va_mode = mode;
if (p != NULL) {
PROC_LOCK_ASSERT(p, MA_OWNED);
 
@@ -126,6 +112,27 @@ procfs_attr(PFS_ATTR_ARGS)
return (0);
 }
 
+int
+procfs_attr_all_rx(PFS_ATTR_ARGS)
+{
+
+   return (procfs_attr(td, p, pn, vap, 0555));
+}
+
+int
+procfs_attr_rw(PFS_ATTR_ARGS)
+{
+
+   return (procfs_attr(td, p, pn, vap, 0600));
+}
+
+int
+procfs_attr_w(PFS_ATTR_ARGS)
+{
+
+   return (procfs_attr(td, p, pn, vap, 0200));
+}
+
 /*
  * Visibility: some files only exist for non-system processes
  * Non-static because linprocfs uses it.
@@ -164,33 +171,33 @@ procfs_init(PFS_INIT_ARGS)
NULL, NULL, NULL, 0);
 
dir = pfs_create_dir(root, "pid",
-   procfs_attr, NULL, NULL, PFS_PROCDEP);
+   procfs_attr_all_rx, NULL, NULL, PFS_PROCDEP);
pfs_create_file(dir, "cmdline", procfs_doproccmdline,
NULL, NULL, NULL, PFS_RD);
pfs_create_file(dir, "dbregs", procfs_doprocdbregs,
-   procfs_attr, procfs_candebug, NULL, PFS_RDWR|PFS_RAW);
+   procfs_attr_rw, procfs_candebug, NULL, PFS_RDWR | PFS_RAW);
pfs_create_file(dir, "etype", procfs_doproctype,
NULL, NULL, NULL, PFS_RD);
pfs_create_file(dir, "fpregs", procfs_doprocfpregs,
-   procfs_attr, procfs_candebug, NULL, PFS_RDWR|PFS_RAW);
+   procfs_attr_rw, procfs_candebug, NULL, PFS_RDWR | PFS_RAW);
pfs_create_file(dir, "map", procfs_doprocmap,
NULL, procfs_notsystem, NULL, PFS_RD);
node = pfs_create_file(dir, "mem", procfs_doprocmem,
-   procfs_attr, procfs_candebug, NULL, PFS_RDWR|PFS_RAW);
+   procfs_attr_rw, procfs_candebug, NULL, PFS_RDWR | PFS_RAW);
node->pn_ioctl = procfs_ioctl;
node->pn_close = procfs_close;
pfs_create_file(dir, "note", procfs_doprocnote,
-   procfs_attr, procfs_candebug, NULL, PFS_WR);
+   procfs_attr_w, procfs_candebug, NULL, PFS_WR);
pfs_create_file(dir, "notepg", procfs_doprocnote,
-   procfs_attr, procfs_candebug, NULL, PFS_WR);
+   procfs_attr_w, procfs_candebug, NULL, PFS_WR);
pfs_create_file(dir, "regs", procfs_doprocregs,
-   procfs_attr, procfs_candebug, NULL, PFS_RDWR|PFS_RAW);
+   procfs_attr_rw, procfs_candebug, NULL, PFS_RDWR | PFS_RAW);
pfs_create_file(dir, "rlimit", procfs_doprocrlimit,
NULL, NULL, NULL, PFS_RD);
pfs_create_file(dir, "status", procfs_doprocstatus,
NULL, NULL, NULL, PFS_RD);
pfs_create_file(dir, "osrel", procfs_doosrel,
-   procfs_attr, procfs_candebug, NULL, PFS_RDWR);
+   procfs_attr_rw, procfs_candebug, NULL, PFS_RDWR);
 
pfs_create_link(dir, "file", procfs_doprocfile,
NULL, procfs_notsystem, NULL, 0);

Modified: head/sys/fs/procfs/procfs.h

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

2018-04-24 Thread Mark Johnston
Author: markj
Date: Tue Apr 24 14:35:39 2018
New Revision: 332935
URL: https://svnweb.freebsd.org/changeset/base/332935

Log:
  MFC r332658:
  Ensure that m and skip_m belong to the same object.

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

Modified: stable/11/sys/vm/vm_page.c
==
--- stable/11/sys/vm/vm_page.c  Tue Apr 24 14:02:46 2018(r332934)
+++ stable/11/sys/vm/vm_page.c  Tue Apr 24 14:35:39 2018(r332935)
@@ -3733,6 +3733,8 @@ vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip
int i, npages;
 
object = m->object;
+   if (skip_m != NULL && skip_m->object != object)
+   return (false);
VM_OBJECT_ASSERT_LOCKED(object);
npages = atop(pagesizes[m->psind]);
 
___
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: r332934 - head/sys/x86/x86

2018-04-24 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 24 14:02:46 2018
New Revision: 332934
URL: https://svnweb.freebsd.org/changeset/base/332934

Log:
  Use relaxed atomics to access the monitor line.
  
  We must ensure that accesses occur, they do not have any other
  compiler-visible effects.  Bruce found some situations where
  optimization could remove an access, and provided a patch to use
  volatile qualifier for the state variables.  Since volatile behaviour
  there is the compiler-specific interpretation of the keyword, use
  relaxed atomics instead, which gives exactly the desired semantic.
  
  Noted by and discussed with:  bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/x86/x86/cpu_machdep.c
==
--- head/sys/x86/x86/cpu_machdep.c  Tue Apr 24 13:52:39 2018
(r332933)
+++ head/sys/x86/x86/cpu_machdep.c  Tue Apr 24 14:02:46 2018
(r332934)
@@ -163,12 +163,12 @@ acpi_cpu_idle_mwait(uint32_t mwait_hint)
 */
 
state = (int *)PCPU_PTR(monitorbuf);
-   KASSERT(*state == STATE_SLEEPING,
-   ("cpu_mwait_cx: wrong monitorbuf state"));
-   *state = STATE_MWAIT;
+   KASSERT(atomic_load_int(state) == STATE_SLEEPING,
+   ("cpu_mwait_cx: wrong monitorbuf state"));
+   atomic_store_int(state, STATE_MWAIT);
handle_ibrs_entry();
cpu_monitor(state, 0, 0);
-   if (*state == STATE_MWAIT)
+   if (atomic_load_int(state) == STATE_MWAIT)
cpu_mwait(MWAIT_INTRBREAK, mwait_hint);
handle_ibrs_exit();
 
@@ -176,7 +176,7 @@ acpi_cpu_idle_mwait(uint32_t mwait_hint)
 * We should exit on any event that interrupts mwait, because
 * that event might be a wanted interrupt.
 */
-   *state = STATE_RUNNING;
+   atomic_store_int(state, STATE_RUNNING);
 }
 
 /* Get current clock frequency for the given cpu id. */
@@ -408,7 +408,7 @@ cpu_idle_acpi(sbintime_t sbt)
int *state;
 
state = (int *)PCPU_PTR(monitorbuf);
-   *state = STATE_SLEEPING;
+   atomic_store_int(state, STATE_SLEEPING);
 
/* See comments in cpu_idle_hlt(). */
disable_intr();
@@ -418,7 +418,7 @@ cpu_idle_acpi(sbintime_t sbt)
cpu_idle_hook(sbt);
else
acpi_cpu_c1();
-   *state = STATE_RUNNING;
+   atomic_store_int(state, STATE_RUNNING);
 }
 
 static void
@@ -427,7 +427,7 @@ cpu_idle_hlt(sbintime_t sbt)
int *state;
 
state = (int *)PCPU_PTR(monitorbuf);
-   *state = STATE_SLEEPING;
+   atomic_store_int(state, STATE_SLEEPING);
 
/*
 * Since we may be in a critical section from cpu_idle(), if
@@ -450,7 +450,7 @@ cpu_idle_hlt(sbintime_t sbt)
enable_intr();
else
acpi_cpu_c1();
-   *state = STATE_RUNNING;
+   atomic_store_int(state, STATE_RUNNING);
 }
 
 static void
@@ -459,21 +459,22 @@ cpu_idle_mwait(sbintime_t sbt)
int *state;
 
state = (int *)PCPU_PTR(monitorbuf);
-   *state = STATE_MWAIT;
+   atomic_store_int(state, STATE_MWAIT);
 
/* See comments in cpu_idle_hlt(). */
disable_intr();
if (sched_runnable()) {
+   atomic_store_int(state, STATE_RUNNING);
enable_intr();
-   *state = STATE_RUNNING;
return;
}
+
cpu_monitor(state, 0, 0);
-   if (*state == STATE_MWAIT)
+   if (atomic_load_int(state) == STATE_MWAIT)
__asm __volatile("sti; mwait" : : "a" (MWAIT_C1), "c" (0));
else
enable_intr();
-   *state = STATE_RUNNING;
+   atomic_store_int(state, STATE_RUNNING);
 }
 
 static void
@@ -483,7 +484,7 @@ cpu_idle_spin(sbintime_t sbt)
int i;
 
state = (int *)PCPU_PTR(monitorbuf);
-   *state = STATE_RUNNING;
+   atomic_store_int(state, STATE_RUNNING);
 
/*
 * The sched_runnable() call is racy but as long as there is
@@ -577,20 +578,21 @@ out:
 int
 cpu_idle_wakeup(int cpu)
 {
-   struct pcpu *pcpu;
int *state;
 
-   pcpu = pcpu_find(cpu);
-   state = (int *)pcpu->pc_monitorbuf;
-   /*
-* This doesn't need to be atomic since missing the race will
-* simply result in unnecessary IPIs.
-*/
-   if (*state == STATE_SLEEPING)
+   state = (int *)pcpu_find(cpu)->pc_monitorbuf;
+   switch (atomic_load_int(state)) {
+   case STATE_SLEEPING:
return (0);
-   if (*state == STATE_MWAIT)
-   *state = STATE_RUNNING;
-   return (1);
+   case STATE_MWAIT:
+   atomic_store_int(state, STATE_RUNNING);
+   return (1);
+   case STATE_RUNNING:
+   return (1);
+   default:
+   panic("bad monitor state");
+   return (1);
+   }
 }
 
 /*

svn commit: r332933 - stable/10/sys/cam/scsi

2018-04-24 Thread Kenneth D. Merry
Author: ken
Date: Tue Apr 24 13:52:39 2018
New Revision: 332933
URL: https://svnweb.freebsd.org/changeset/base/332933

Log:
  MFC r332458:

r332458 | ken | 2018-04-12 15:21:18 -0600 (Thu, 12 Apr 2018) | 34 lines
  
Handle Programmable Early Warning for control commands in sa(4).
  
When the tape position is inside the Early Warning area, the tape
drive will return a sense key of NO SENSE, and an ASC/ASCQ of
0x00,0x02, which means: End-of-partition/medium detected".  If
this was in response to a control command like WRITE FILEMARKS,
we correctly translate this as informational status and return
0 from saerror().
  
Programmable Early Warning should be handled the same way, but
we weren't handling it that way.  As a result, if a PEW status
(sense key of NO SENSE, ASC/ASCQ of 0x00,0x07, "Programmable early
warning detected") came back in response to a WRITE FILEMARKS,
we returned an error.
  
The impact of this was that if an application was writing to a
sa(4) device, and a PEW area was set (in the Device Configuration
Extension subpage -- mode page 0x10, subpage 1), and a filemark
needed to be written on close, we could wind up returning an error
to the user on close because of a "failure" to write the filemarks.
  
It actually isn't a failure, but rather just a status report from
the drive, and shouldn't be treated as a failure.
  
sys/cam/scsi/scsi_sa.c:
For control commands in saerror(), treat asc/ascq 0x00,0x07
the same as 0x00,{0-5} -- not an error.  Return 0, since
the command actually did succeed.
  
Reported by:Dr. Andreas Haakh 
Tested by:  Dr. Andreas Haakh 
Sponsored by:   Spectra Logic


Modified:
  stable/10/sys/cam/scsi/scsi_sa.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_sa.c
==
--- stable/10/sys/cam/scsi/scsi_sa.cTue Apr 24 13:44:19 2018
(r332932)
+++ stable/10/sys/cam/scsi/scsi_sa.cTue Apr 24 13:52:39 2018
(r332933)
@@ -3453,12 +3453,13 @@ saerror(union ccb *ccb, u_int32_t cflgs, u_int32_t sfl
break;
}
/*
-* If this was just EOM/EOP, Filemark, Setmark or ILI detected
-* on a non read/write command, we assume it's not an error
-* and propagate the residule and return.
+* If this was just EOM/EOP, Filemark, Setmark, ILI or
+* PEW detected on a non read/write command, we assume
+* it's not an error and propagate the residual and return.
 */
-   if ((aqvalid && asc == 0 && ascq > 0 && ascq <= 5) ||
-   (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) {
+   if ((aqvalid && asc == 0 && ((ascq > 0 && ascq <= 5)
+ || (ascq == 0x07)))
+|| (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) {
csio->resid = resid;
QFRLS(ccb);
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332932 - head/sys/amd64/vmm

2018-04-24 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 24 13:44:19 2018
New Revision: 332932
URL: https://svnweb.freebsd.org/changeset/base/332932

Log:
  Correct undesirable interaction between caching of %cr4 in bhyve and
  invltlb_glob().
  
  Reviewed by:  grehan, jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D15138

Modified:
  head/sys/amd64/vmm/vmm_host.c

Modified: head/sys/amd64/vmm/vmm_host.c
==
--- head/sys/amd64/vmm/vmm_host.c   Tue Apr 24 13:07:17 2018
(r332931)
+++ head/sys/amd64/vmm/vmm_host.c   Tue Apr 24 13:44:19 2018
(r332932)
@@ -61,7 +61,16 @@ vmm_host_state_init(void)
 */
vmm_host_cr0 = rcr0() | CR0_TS;
 
-   vmm_host_cr4 = rcr4();
+   /*
+* On non-PCID or PCID but without INVPCID support machines,
+* we flush kernel i.e. global TLB entries, by temporary
+* clearing the CR4.PGE bit, see invltlb_glob().  If
+* preemption occurs at the wrong time, cached vmm_host_cr4
+* might store the value with CR4.PGE cleared.  Since FreeBSD
+* requires support for PG_G on amd64, just set it
+* unconditionally.
+*/
+   vmm_host_cr4 = rcr4() | CR4_PGE;
 
/*
 * Only permit a guest to use XSAVE if the host is using
___
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: r332931 - in head/sys: conf dev/amdsbwd

2018-04-24 Thread Eitan Adler
Author: eadler
Date: Tue Apr 24 13:07:17 2018
New Revision: 332931
URL: https://svnweb.freebsd.org/changeset/base/332931

Log:
  [amdsbwd] teach amdsbwd that it has options
  
  AMDSBWD_DEBUG was previously checked for as a #define but it was not
  possible to define it
  
  Reviewed by:  kevans
  Discussed with:   kenm

Modified:
  head/sys/conf/options
  head/sys/dev/amdsbwd/amdsbwd.c

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Tue Apr 24 12:50:21 2018(r332930)
+++ head/sys/conf/options   Tue Apr 24 13:07:17 2018(r332931)
@@ -1006,3 +1006,6 @@ EKCD  opt_ekcd.h
 
 # NVME options
 NVME_USE_NVD   opt_nvme.h
+
+# amdsbwd options
+AMDSBWD_DEBUG  opt_amdsbwd.h

Modified: head/sys/dev/amdsbwd/amdsbwd.c
==
--- head/sys/dev/amdsbwd/amdsbwd.c  Tue Apr 24 12:50:21 2018
(r332930)
+++ head/sys/dev/amdsbwd/amdsbwd.c  Tue Apr 24 13:07:17 2018
(r332931)
@@ -49,6 +49,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_amdsbwd.h"
+
 #include 
 #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: r332930 - in head/sys: compat/linux conf i386/i386 i386/include i386/linux modules/linux

2018-04-24 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 24 12:50:21 2018
New Revision: 332930
URL: https://svnweb.freebsd.org/changeset/base/332930

Log:
  Fix futexes on i386 after the 4/4G split.
  
  Use proper method to access userspace.  For now, only the slow copyout
  path is implemented.
  
  Reported and tested by:   tijl (previous version)
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/i386/linux/linux_copyout.c
 - copied, changed from r332929, head/sys/i386/linux/linux_support.s
Deleted:
  head/sys/i386/linux/linux_support.s
Modified:
  head/sys/compat/linux/linux_futex.c
  head/sys/compat/linux/linux_futex.h
  head/sys/conf/files.i386
  head/sys/i386/i386/copyout.c
  head/sys/i386/include/md_var.h
  head/sys/modules/linux/Makefile

Modified: head/sys/compat/linux/linux_futex.c
==
--- head/sys/compat/linux/linux_futex.c Tue Apr 24 12:17:28 2018
(r332929)
+++ head/sys/compat/linux/linux_futex.c Tue Apr 24 12:50:21 2018
(r332930)
@@ -273,14 +273,6 @@ static int handle_futex_death(struct linux_emuldata *,
 static int fetch_robust_entry(struct linux_robust_list **,
 struct linux_robust_list **, unsigned int *);
 
-/* support.s */
-int futex_xchgl(int oparg, uint32_t *uaddr, int *oldval);
-int futex_addl(int oparg, uint32_t *uaddr, int *oldval);
-int futex_orl(int oparg, uint32_t *uaddr, int *oldval);
-int futex_andl(int oparg, uint32_t *uaddr, int *oldval);
-int futex_xorl(int oparg, uint32_t *uaddr, int *oldval);
-
-
 static int
 futex_copyin_timeout(int op, struct l_timespec *luts, int clockrt,
 struct timespec *ts)

Modified: head/sys/compat/linux/linux_futex.h
==
--- head/sys/compat/linux/linux_futex.h Tue Apr 24 12:17:28 2018
(r332929)
+++ head/sys/compat/linux/linux_futex.h Tue Apr 24 12:50:21 2018
(r332930)
@@ -78,6 +78,11 @@ extern struct mtx futex_mtx;
 #defineFUTEX_TID_MASK  0x3fff
 #defineFUTEX_BITSET_MATCH_ANY  0x
 
+int futex_xchgl(int oparg, uint32_t *uaddr, int *oldval);
+int futex_addl(int oparg, uint32_t *uaddr, int *oldval);
+int futex_orl(int oparg, uint32_t *uaddr, int *oldval);
+int futex_andl(int oparg, uint32_t *uaddr, int *oldval);
+int futex_xorl(int oparg, uint32_t *uaddr, int *oldval);
 void   release_futexes(struct thread *,
struct linux_emuldata *);
 

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Tue Apr 24 12:17:28 2018(r332929)
+++ head/sys/conf/files.i386Tue Apr 24 12:50:21 2018(r332930)
@@ -536,11 +536,10 @@ i386/ibcs2/ibcs2_xenix.c  optional ibcs2
 i386/ibcs2/ibcs2_xenix_sysent.coptional ibcs2
 i386/ibcs2/imgact_coff.c   optional ibcs2
 i386/linux/imgact_linux.c  optional compat_linux
+i386/linux/linux_copyout.c optional compat_linux
 i386/linux/linux_dummy.c   optional compat_linux
 i386/linux/linux_machdep.c optional compat_linux
 i386/linux/linux_ptrace.c  optional compat_linux
-i386/linux/linux_support.s optional compat_linux   \
-   dependency  "linux_assym.h"
 i386/linux/linux_sysent.c  optional compat_linux
 i386/linux/linux_sysvec.c  optional compat_linux
 i386/pci/pci_cfgreg.c  optional pci

Modified: head/sys/i386/i386/copyout.c
==
--- head/sys/i386/i386/copyout.cTue Apr 24 12:17:28 2018
(r332929)
+++ head/sys/i386/i386/copyout.cTue Apr 24 12:50:21 2018
(r332930)
@@ -97,7 +97,7 @@ copyout_init_tramp(void)
(uintptr_t)suword_fast + setidt_disp);
 }
 
-static int
+int
 cp_slow0(vm_offset_t uva, size_t len, bool write,
 void (*f)(vm_offset_t, void *), void *arg)
 {

Modified: head/sys/i386/include/md_var.h
==
--- head/sys/i386/include/md_var.h  Tue Apr 24 12:17:28 2018
(r332929)
+++ head/sys/i386/include/md_var.h  Tue Apr 24 12:50:21 2018
(r332930)
@@ -55,6 +55,8 @@ structsegment_descriptor;
 union savefpu;
 
 void   bcopyb(const void *from, void *to, size_t len);
+intcp_slow0(vm_offset_t uva, size_t len, bool write,
+   void (*f)(vm_offset_t, void *), void *arg);
 void   cpu_switch_load_gs(void) __asm(__STRING(cpu_switch_load_gs));
 void   copyout_init_tramp(void);
 void   doreti_iret(void) __asm(__STRING(doreti_iret));

Copied and modified: head/sys/i386/linux/linux_copyout.c (from r332929, 
head/sys/i386/linux/linux_support.s)
==
--- head/sys/i386/linux/linux_support.s Tue Apr 24 12:17:28 2018
(r332929, copy source)
+++ head/sys/i386/linux/linux_copyout.c Tue Apr 24 12:50:21 2018
(r332930)
@@ -1,9 +1,12 @@
 /*-
  

svn commit: r332929 - stable/11/usr.sbin/pwd_mkdb

2018-04-24 Thread Ed Maste
Author: emaste
Date: Tue Apr 24 12:17:28 2018
New Revision: 332929
URL: https://svnweb.freebsd.org/changeset/base/332929

Log:
  pwd_mkdb: add legacy support deprecation notice
  
  MFC r332789: pwd_mkdb: warn that legacy support is deprecated (if specified)
  
  r283981 switched pwd_mkdb to emit only v4 database entries by default,
  and introduced a -l (legacy) option emit v3 entries in addition.  The
  commit message claims that legacy support will be removed in 12.0, so
  emit a warning now if it is used.
  
  MFC r332875: pwd_mkdb: add deprecation notice in manpage too
  
  Followon to r332789; as reported on the -current and -stable lists and
  in review D15144 the -l option will be removed before FreeBSD 12.0.
  
  Relnotes: Yes
  Sponsored by: The FreeBSD Foundation

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

Modified: stable/11/usr.sbin/pwd_mkdb/pwd_mkdb.8
==
--- stable/11/usr.sbin/pwd_mkdb/pwd_mkdb.8  Tue Apr 24 10:32:25 2018
(r332928)
+++ stable/11/usr.sbin/pwd_mkdb/pwd_mkdb.8  Tue Apr 24 12:17:28 2018
(r332929)
@@ -28,7 +28,7 @@
 .\"@(#)pwd_mkdb.8  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd February 5, 2014
+.Dd April 24, 2018
 .Dt PWD_MKDB 8
 .Os
 .Sh NAME
@@ -129,6 +129,11 @@ which enables generation of legacy format
 .Pq v3
 entries.
 The legacy format entries are endianness dependent.
+The
+.Fl l
+option is deprecated and is not present in
+.Fx 12.0
+and later.
 .Pp
 The following options may be specified and will affect the
 generation of legacy entries.

Modified: stable/11/usr.sbin/pwd_mkdb/pwd_mkdb.c
==
--- stable/11/usr.sbin/pwd_mkdb/pwd_mkdb.c  Tue Apr 24 10:32:25 2018
(r332928)
+++ stable/11/usr.sbin/pwd_mkdb/pwd_mkdb.c  Tue Apr 24 12:17:28 2018
(r332929)
@@ -164,6 +164,8 @@ main(int argc, char *argv[])
 
if (argc != 1 || (username && (*username == '+' || *username == '-')))
usage();
+   if (lflag)
+   warnx("legacy (v3) database format support is deprecated");
 
/*
 * This could be changed to allow the user to interrupt.
___
svn-src-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: r332928 - stable/10/sys/ofed/include/linux

2018-04-24 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Apr 24 10:32:25 2018
New Revision: 332928
URL: https://svnweb.freebsd.org/changeset/base/332928

Log:
  MFC r329372 and r329464:
  Implement enable_irq() and disable_irq() in the LinuxKPI and add checks for
  valid IRQ tag before setting up or tearing down an interrupt handler in the
  LinuxKPI. This is needed when the interrupt handler is disabled
  before freeing the interrupt.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/include/linux/interrupt.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/include/linux/interrupt.h
==
--- stable/10/sys/ofed/include/linux/interrupt.hTue Apr 24 10:11:01 
2018(r332927)
+++ stable/10/sys/ofed/include/linux/interrupt.hTue Apr 24 10:32:25 
2018(r332928)
@@ -118,6 +118,39 @@ 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 = _pci_find_irq_dev(irq);
+   if (dev == NULL)
+   return -EINVAL;
+   irqe = _irq_ent(dev, irq);
+   if (irqe == NULL || irqe->tag != NULL)
+   return -EINVAL;
+   return -bus_setup_intr(dev->bsddev, irqe->res, INTR_TYPE_NET | 
INTR_MPSAFE,
+   NULL, _irq_handler, irqe, >tag);
+}
+
+static inline void
+disable_irq(unsigned int irq)
+{
+   struct irq_ent *irqe;
+   struct device *dev;
+
+   dev = _pci_find_irq_dev(irq);
+   if (dev == NULL)
+   return;
+   irqe = _irq_ent(dev, irq);
+   if (irqe == NULL)
+   return;
+   if (irqe->tag != NULL)
+   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;
@@ -148,7 +181,8 @@ free_irq(unsigned int irq, void *device)
irqe = _irq_ent(dev, irq);
if (irqe == NULL)
return;
-   bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag);
+   if (irqe->tag != NULL)
+   bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag);
bus_release_resource(dev->bsddev, SYS_RES_IRQ, rid, irqe->res);
list_del(>links);
kfree(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: r332924 - stable/11/sys/dev/bktr

2018-04-24 Thread Thomas Zander
Author: riggs (ports committer)
Date: Tue Apr 24 10:07:13 2018
New Revision: 332924
URL: https://svnweb.freebsd.org/changeset/base/332924

Log:
  MFC r332861:
  
Remove unused definition bl_dfp; fix build with bktr compiled into kernel
  
  Approved by:  cognet

Modified:
  stable/11/sys/dev/bktr/msp34xx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/bktr/msp34xx.c
==
--- stable/11/sys/dev/bktr/msp34xx.cTue Apr 24 10:07:07 2018
(r332923)
+++ stable/11/sys/dev/bktr/msp34xx.cTue Apr 24 10:07:13 2018
(r332924)
@@ -109,10 +109,6 @@
 #define VIDEO_SOUND_LANG2  8
 
 #define DFP_COUNT 0x41
-static const int bl_dfp[] = {
-   0x00, 0x01, 0x02, 0x03,  0x06, 0x08, 0x09, 0x0a,
-   0x0b, 0x0d, 0x0e, 0x10
-};
 
 struct msp3400c {
int simple;
___
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: r332922 - stable/10/sys/ofed/include/linux

2018-04-24 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Apr 24 10:05:23 2018
New Revision: 332922
URL: https://svnweb.freebsd.org/changeset/base/332922

Log:
  MFC r331355:
  Clear old MSIX IRQ numbers in the LinuxKPI.
  
  When disabling the MSIX IRQ vectors for a PCI device through the
  LinuxKPI, make sure any old MSIX IRQ numbers are no longer visible to
  the linux_pci_find_irq_dev() function else IRQs can be requested from
  the wrong PCI device.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/include/linux/pci.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/include/linux/pci.h
==
--- stable/10/sys/ofed/include/linux/pci.h  Tue Apr 24 10:03:16 2018
(r332921)
+++ stable/10/sys/ofed/include/linux/pci.h  Tue Apr 24 10:05:23 2018
(r332922)
@@ -349,6 +349,15 @@ pci_disable_msix(struct pci_dev *pdev)
 {
 
pci_release_msi(pdev->dev.bsddev);
+
+   /*
+* The MSIX IRQ numbers associated with this PCI device are no
+* longer valid and might be re-assigned. Make sure
+* linux_pci_find_irq_dev() does no longer see them by
+* resetting their references to zero:
+*/
+   pdev->dev.msix = 0;
+   pdev->dev.msix_max = 0;
 }
 
 #definePCI_CAP_ID_EXP  PCIY_EXPRESS
___
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: r332920 - stable/10/sys/dev/bktr

2018-04-24 Thread Thomas Zander
Author: riggs (ports committer)
Date: Tue Apr 24 10:02:17 2018
New Revision: 332920
URL: https://svnweb.freebsd.org/changeset/base/332920

Log:
  MFC r332861:
  
Remove unused definition bl_dfp; fix build with bktr compiled into kernel
  
  Approved by:  cognet

Modified:
  stable/10/sys/dev/bktr/msp34xx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/bktr/msp34xx.c
==
--- stable/10/sys/dev/bktr/msp34xx.cTue Apr 24 10:02:12 2018
(r332919)
+++ stable/10/sys/dev/bktr/msp34xx.cTue Apr 24 10:02:17 2018
(r332920)
@@ -109,10 +109,6 @@
 #define VIDEO_SOUND_LANG2  8
 
 #define DFP_COUNT 0x41
-static const int bl_dfp[] = {
-   0x00, 0x01, 0x02, 0x03,  0x06, 0x08, 0x09, 0x0a,
-   0x0b, 0x0d, 0x0e, 0x10
-};
 
 struct msp3400c {
int simple;
___
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: r332918 - in head/sys: dev/acpica x86/acpica

2018-04-24 Thread Andriy Gapon
Author: avg
Date: Tue Apr 24 09:42:58 2018
New Revision: 332918
URL: https://svnweb.freebsd.org/changeset/base/332918

Log:
  add a new ACPI suspend debugging knob, debug.acpi.suspend_deep_bounce
  
  This sysctl allows a deeper dive into the sleep abyss comparing to
  debug.acpi.suspend_bounce.  When the new sysctl is set the system will
  execute the suspend sequence up to the call to AcpiEnterSleepState().
  That includes saving processor contexts and parking APs.  Then, instead
  of actually entering the sleep state, the BSP will call resumectx() to
  emulate the wakeup.  The APs should get restarted by the sequence of
  Init and Startup IPIs that BSP sends to them.
  
  MFC after:8 days

Modified:
  head/sys/dev/acpica/acpi.c
  head/sys/x86/acpica/acpi_wakeup.c

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Tue Apr 24 08:48:20 2018(r332917)
+++ head/sys/dev/acpica/acpi.c  Tue Apr 24 09:42:58 2018(r332918)
@@ -291,6 +291,11 @@ static int acpi_susp_bounce;
 SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW,
 _susp_bounce, 0, "Don't actually suspend, just test devices.");
 
+int acpi_susp_deep_bounce;
+SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_deep_bounce, CTLFLAG_RW,
+_susp_deep_bounce, 0, "Don't actually suspend, "
+"bail out just before entering the sleep state.");
+
 /*
  * ACPI can only be loaded as a module by the loader; activating it after
  * system bootstrap time is not useful, and can be fatal to the system.

Modified: head/sys/x86/acpica/acpi_wakeup.c
==
--- head/sys/x86/acpica/acpi_wakeup.c   Tue Apr 24 08:48:20 2018
(r332917)
+++ head/sys/x86/acpica/acpi_wakeup.c   Tue Apr 24 09:42:58 2018
(r332918)
@@ -79,6 +79,7 @@ CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024);
 
 extern int acpi_resume_beep;
 extern int acpi_reset_video;
+extern int acpi_susp_deep_bounce;
 
 #ifdef SMP
 extern struct susppcb  **susppcbs;
@@ -263,6 +264,9 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
 */
PTD[KPTDI] = PTD[LOWPTDI];
 #endif
+
+   if (acpi_susp_deep_bounce)
+   resumectx(pcb);
 
/* Call ACPICA to enter the desired sleep state */
if (state == ACPI_STATE_S4 && sc->acpi_s4bios)
___
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: r332911 - head/sys/kern

2018-04-24 Thread Mateusz Guzik
Author: mjg
Date: Tue Apr 24 06:10:36 2018
New Revision: 332911
URL: https://svnweb.freebsd.org/changeset/base/332911

Log:
  lockf: change the owner hash from pid to vnode-based
  
  This adds a bit missed due to the patch split, see r332882
  
  Tested by:pho

Modified:
  head/sys/kern/kern_lockf.c

Modified: head/sys/kern/kern_lockf.c
==
--- head/sys/kern/kern_lockf.c  Tue Apr 24 05:42:10 2018(r332910)
+++ head/sys/kern/kern_lockf.c  Tue Apr 24 06:10:36 2018(r332911)
@@ -105,7 +105,7 @@ struct owner_graph;
 #define SELF   0x1
 #define OTHERS 0x2
 static void lf_init(void *);
-static int  lf_hash_owner(caddr_t, struct flock *, int);
+static int  lf_hash_owner(caddr_t, struct vnode *, struct flock *, int);
 static int  lf_owner_matches(struct lock_owner *, caddr_t, struct flock *,
 int);
 static struct lockf_entry *
@@ -301,7 +301,7 @@ SYSINIT(lf_init, SI_SUB_LOCK, SI_ORDER_FIRST, lf_init,
  * Generate a hash value for a lock owner.
  */
 static int
-lf_hash_owner(caddr_t id, struct flock *fl, int flags)
+lf_hash_owner(caddr_t id, struct vnode *vp, struct flock *fl, int flags)
 {
uint32_t h;
 
@@ -311,9 +311,7 @@ lf_hash_owner(caddr_t id, struct flock *fl, int flags)
} else if (flags & F_FLOCK) {
h = ((uintptr_t) id) >> 7;
} else {
-   struct proc *p = (struct proc *) id;
-   h = HASHSTEP(0, p->p_pid);
-   h = HASHSTEP(h, 0);
+   h = ((uintptr_t) vp) >> 7;
}
 
return (h % LOCK_OWNER_HASH_SIZE);
@@ -500,7 +498,7 @@ retry_setlock:
 * Map our arguments to an existing lock owner or create one
 * if this is the first time we have seen this owner.
 */
-   hash = lf_hash_owner(id, fl, flags);
+   hash = lf_hash_owner(id, vp, fl, flags);
sx_xlock(_lock_owners[hash].lock);
LIST_FOREACH(lo, _lock_owners[hash].list, lo_link)
if (lf_owner_matches(lo, id, fl, flags))
___
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"