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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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