svn commit: r323606 - stable/11/cddl/contrib/opensolaris/lib/libdtrace/common

2017-09-14 Thread Mark Johnston
Author: markj
Date: Fri Sep 15 00:34:59 2017
New Revision: 323606
URL: https://svnweb.freebsd.org/changeset/base/323606

Log:
  MFC r323498:
  Add a O_CLOEXEC use missed in r323166.

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c   Fri Sep 
15 00:32:22 2017(r323605)
+++ stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c   Fri Sep 
15 00:34:59 2017(r323606)
@@ -,7 +,7 @@ dt_vopen(int version, int flags, int *errp,
 */
if (err == ENOENT && modfind("dtraceall") < 0) {
kldload("dtraceall"); /* ignore the error */
-   dtfd = open("/dev/dtrace/dtrace", O_RDWR);
+   dtfd = open("/dev/dtrace/dtrace", O_RDWR | O_CLOEXEC);
err = errno;
}
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323605 - in stable/10: etc/pkg release/pkg_repos sys/conf sys/sys

2017-09-14 Thread Marius Strobl
Author: marius
Date: Fri Sep 15 00:32:22 2017
New Revision: 323605
URL: https://svnweb.freebsd.org/changeset/base/323605

Log:
  - Reset stable/10 back to -PRERELEASE status now that releng/10.4
has been branched.
  - Update __FreeBSD_version to reflect the new -STABLE branch.
  - Switch the pkg(8) configuration for the default installation and the
DVD image creation back to the latest set, i. e. revert r322737.
  
  Approved by:  re (implicit)

Modified:
  stable/10/etc/pkg/FreeBSD.conf
  stable/10/release/pkg_repos/release-dvd.conf
  stable/10/sys/conf/newvers.sh
  stable/10/sys/sys/param.h

Modified: stable/10/etc/pkg/FreeBSD.conf
==
--- stable/10/etc/pkg/FreeBSD.conf  Fri Sep 15 00:31:25 2017
(r323604)
+++ stable/10/etc/pkg/FreeBSD.conf  Fri Sep 15 00:32:22 2017
(r323605)
@@ -8,7 +8,7 @@
 #
 
 FreeBSD: {
-  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly;,
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest;,
   mirror_type: "srv",
   signature_type: "fingerprints",
   fingerprints: "/usr/share/keys/pkg",

Modified: stable/10/release/pkg_repos/release-dvd.conf
==
--- stable/10/release/pkg_repos/release-dvd.confFri Sep 15 00:31:25 
2017(r323604)
+++ stable/10/release/pkg_repos/release-dvd.confFri Sep 15 00:32:22 
2017(r323605)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 release: {
-  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly;,
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest;,
   mirror_type: "srv",
   signature_type: "fingerprints",
   fingerprints: "/usr/share/keys/pkg",

Modified: stable/10/sys/conf/newvers.sh
==
--- stable/10/sys/conf/newvers.sh   Fri Sep 15 00:31:25 2017
(r323604)
+++ stable/10/sys/conf/newvers.sh   Fri Sep 15 00:32:22 2017
(r323605)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.4"
-BRANCH="BETA4"
+BRANCH="PRERELEASE"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi

Modified: stable/10/sys/sys/param.h
==
--- stable/10/sys/sys/param.h   Fri Sep 15 00:31:25 2017(r323604)
+++ stable/10/sys/sys/param.h   Fri Sep 15 00:32:22 2017(r323605)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1003516  /* Master, propagated to newvers */
+#define __FreeBSD_version 1004500  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323604 - in releng/10.4: release/pkg_repos sys/conf sys/sys

2017-09-14 Thread Marius Strobl
Author: marius
Date: Fri Sep 15 00:31:25 2017
New Revision: 323604
URL: https://svnweb.freebsd.org/changeset/base/323604

Log:
  - Copy stable/10@323601 to releng/10.4 in preparation for 10.4-RC1
builds.
  - Update newvers.sh to reflect RC1.
  - Update __FreeBSD_version to reflect 10.4.
  - Switch the pkg(8) repository to use the 10.4 release package set for
DVD image creation.
  
  Approved by:  re (implicit)

Added:
 - copied from r323601, stable/10/
Directory Properties:
  releng/10.4/   (props changed)
Modified:
  releng/10.4/release/pkg_repos/release-dvd.conf
  releng/10.4/sys/conf/newvers.sh
  releng/10.4/sys/sys/param.h

Modified: releng/10.4/release/pkg_repos/release-dvd.conf
==
--- stable/10/release/pkg_repos/release-dvd.confThu Sep 14 22:19:56 
2017(r323601)
+++ releng/10.4/release/pkg_repos/release-dvd.conf  Fri Sep 15 00:31:25 
2017(r323604)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 release: {
-  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly;,
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_4;,
   mirror_type: "srv",
   signature_type: "fingerprints",
   fingerprints: "/usr/share/keys/pkg",

Modified: releng/10.4/sys/conf/newvers.sh
==
--- stable/10/sys/conf/newvers.sh   Thu Sep 14 22:19:56 2017
(r323601)
+++ releng/10.4/sys/conf/newvers.sh Fri Sep 15 00:31:25 2017
(r323604)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.4"
-BRANCH="BETA4"
+BRANCH="RC1"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi

Modified: releng/10.4/sys/sys/param.h
==
--- stable/10/sys/sys/param.h   Thu Sep 14 22:19:56 2017(r323601)
+++ releng/10.4/sys/sys/param.h Fri Sep 15 00:31:25 2017(r323604)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1003516  /* Master, propagated to newvers */
+#define __FreeBSD_version 1004000  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323603 - svnadmin/conf

2017-09-14 Thread Marius Strobl
Author: marius
Date: Fri Sep 15 00:31:04 2017
New Revision: 323603
URL: https://svnweb.freebsd.org/changeset/base/323603

Log:
  Require explicit re@ approval for commits to releng/10.4.
  
  Approved by:  re (implicit)

Modified:
  svnadmin/conf/approvers

Modified: svnadmin/conf/approvers
==
--- svnadmin/conf/approvers Fri Sep 15 00:08:36 2017(r323602)
+++ svnadmin/conf/approvers Fri Sep 15 00:31:04 2017(r323603)
@@ -21,6 +21,7 @@
 ^stable/10/re
 ^release/  re
 ^releng/11.[0-1]/  (security-officer|so)
+^releng/10.4/  re
 ^releng/10.[0-3]/  (security-officer|so)
 ^releng/9.[0-3]/   (security-officer|so)
 ^releng/8.[0-4]/   (security-officer|so)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323602 - head/share/misc

2017-09-14 Thread Craig Leres
Author: leres (ports committer)
Date: Fri Sep 15 00:08:36 2017
New Revision: 323602
URL: https://svnweb.freebsd.org/changeset/base/323602

Log:
  Add myself (leres) as a ports committer with ler and matthew as mentors.
  
  Reviewed by:  matthew (mentor)
  Approved by:  matthew (mentor)
  Differential Revision:https://reviews.freebsd.org/D12372

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotThu Sep 14 22:19:56 2017
(r323601)
+++ head/share/misc/committers-ports.dotFri Sep 15 00:08:36 2017
(r323602)
@@ -149,6 +149,7 @@ lawrance [label="Sam Lawrance\nlawra...@freebsd.org\n2
 lbr [label="Lars Balker Rasmussen\n...@freebsd.org\n2006/04/30"]
 leeym [label="Yen-Ming Lee\nle...@freebsd.org\n2002/08/14"]
 ler [label="Larry Rosenman\n...@freebsd.org\n2017/01/09"]
+leres [label="Craig Leres\nle...@freebsd.org\n2017/10/10"]
 lev [label="Lev Serebryakov\n...@freebsd.org\n2003/06/17"]
 lifanov [label="Nikolai Lifanov\nlifa...@freebsd.org\n2016/12/11"]
 linimon [label="Mark Linimon\nlini...@freebsd.org\n2003/10/23"]
@@ -468,6 +469,8 @@ lawrance -> itetcu
 
 leeym -> clsung
 
+ler -> leres
+
 lifanov -> ultima
 
 lioux -> pat
@@ -502,6 +505,7 @@ mat -> thierry
 mat -> tobik
 mat -> woodsb02
 
+matthew -> leres
 matthew -> lifanov
 matthew -> ultima
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323601 - stable/10/release/doc/en_US.ISO8859-1/relnotes

2017-09-14 Thread Glen Barber
Author: gjb
Date: Thu Sep 14 22:19:56 2017
New Revision: 323601
URL: https://svnweb.freebsd.org/changeset/base/323601

Log:
  Document r301772, Dummynet AQM imported to the base system.
  
  Submitted by: truckman
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Thu Sep 14 
21:06:08 2017(r323600)
+++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Thu Sep 14 
22:19:56 2017(r323601)
@@ -571,6 +571,10 @@
 
   Network Protocols
 
+  Dummynet AQM, an independent
+   implementation of CoDel and FQ-CoDel for ipfw/dummynet has
+   been imported to the base system.
+
   Support for GARP
(gratuitous ARP) retransmit has been added.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323600 - head/sys/dev/cxgbe/crypto

2017-09-14 Thread John Baldwin
Author: jhb
Date: Thu Sep 14 21:06:08 2017
New Revision: 323600
URL: https://svnweb.freebsd.org/changeset/base/323600

Log:
  Fix some incorrect sysctl pointers for some error stats.
  
  The bad_session, sglist_error, and process_error sysctl nodes were
  returning the value of the pad_error node instead of the appropriate
  error counters.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/crypto/t4_crypto.c

Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c
==
--- head/sys/dev/cxgbe/crypto/t4_crypto.c   Thu Sep 14 20:42:19 2017
(r323599)
+++ head/sys/dev/cxgbe/crypto/t4_crypto.c   Thu Sep 14 21:06:08 2017
(r323600)
@@ -1483,11 +1483,12 @@ ccr_sysctls(struct ccr_softc *sc)
SYSCTL_ADD_U64(ctx, children, OID_AUTO, "pad_error", CTLFLAG_RD,
>stats_pad_error, 0, "Padding errors");
SYSCTL_ADD_U64(ctx, children, OID_AUTO, "bad_session", CTLFLAG_RD,
-   >stats_pad_error, 0, "Requests with invalid session ID");
+   >stats_bad_session, 0, "Requests with invalid session ID");
SYSCTL_ADD_U64(ctx, children, OID_AUTO, "sglist_error", CTLFLAG_RD,
-   >stats_pad_error, 0, "Requests for which DMA mapping failed");
+   >stats_sglist_error, 0,
+   "Requests for which DMA mapping failed");
SYSCTL_ADD_U64(ctx, children, OID_AUTO, "process_error", CTLFLAG_RD,
-   >stats_pad_error, 0, "Requests failed during queueing");
+   >stats_process_error, 0, "Requests failed during queueing");
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323599 - head/usr.sbin/tcpdrop

2017-09-14 Thread Michael Tuexen
Author: tuexen
Date: Thu Sep 14 20:42:19 2017
New Revision: 323599
URL: https://svnweb.freebsd.org/changeset/base/323599

Log:
  Bump date missed in r323596. Trim trailing whitespace.
  
  Sponsored by: Netflix, Inc.

Modified:
  head/usr.sbin/tcpdrop/tcpdrop.8

Modified: head/usr.sbin/tcpdrop/tcpdrop.8
==
--- head/usr.sbin/tcpdrop/tcpdrop.8 Thu Sep 14 19:50:07 2017
(r323598)
+++ head/usr.sbin/tcpdrop/tcpdrop.8 Thu Sep 14 20:42:19 2017
(r323599)
@@ -17,7 +17,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 12, 2017
+.Dd September 14, 2017
 .Dt TCPDROP 8
 .Os
 .Sh NAME
@@ -88,7 +88,7 @@ will attempt to drop all TCP connections being in the 
 .Ar state
 and using the TCP stack
 .Ar stack .
-Since TCP connections in the 
+Since TCP connections in the
 .Dv TIME_WAIT
 state are not tied to any TCP stack, using the option
 .Fl s Dv TIME_WAIT
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r323290 - head/sys/vm

2017-09-14 Thread Mark Johnston
On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote:
> Hi Mark,
> 
> On 07.09.17 23:43, Mark Johnston wrote:
> > Author: markj
> > Date: Thu Sep  7 21:43:39 2017
> > New Revision: 323290
> > URL: https://svnweb.freebsd.org/changeset/base/323290
> > 
> > Log:
> >Speed up vm_page_array initialization.
> >
> >We currently initialize the vm_page array in three passes: one to zero
> >the array, one to initialize the "order" field of each page (necessary
> >when inserting them into the vm_phys buddy allocator one-by-one), and
> >one to initialize the remaining non-zero fields and individually insert
> >each page into the allocator.
> >
> >Merge the three passes into one following a suggestion from alc:
> >initialize vm_page fields in a single pass, and use vm_phys_free_contig()
> >to efficiently insert physical memory segments into the buddy allocator.
> >This reduces the initialization time to a third or a quarter of what it
> >was before on most systems that I tested.
> >
> >Reviewed by: alc, kib
> >MFC after:   3 weeks
> >Differential Revision:   https://reviews.freebsd.org/D12248
> > 
> > Modified:
> >head/sys/vm/vm_page.c
> >head/sys/vm/vm_phys.c
> >head/sys/vm/vm_phys.h
> 
> I just found out that this commit breaks booting my powerpc64 Quad G5.
> It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].
> 
> Sometimes it hangs earlier when the kbd is not there yet (usb), then I 
> can't get the process/task where it hangs.
> 
> Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD)
> 
> Any ideas how to find out what's wrong?

Are you able to break into DDB when the hang occurs? If so, the output
of "show page" would be helpful.

Are you running with INVARIANTS configured? If not, please try that.

> The previous revision, r323289 seems stable, at least it survived 
> several kernel builds.

Could you apply the patch below and capture the first page or so of
output from after the kernel starts booting?

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index fda8d1cf37f7..6862195c3e9c 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -648,8 +648,11 @@ vm_page_startup(vm_offset_t vaddr)
 * Add physical memory segments corresponding to the available
 * physical pages.
 */
-   for (i = 0; phys_avail[i + 1] != 0; i += 2)
+   for (i = 0; phys_avail[i + 1] != 0; i += 2) {
+   printf("adding phys_avail seg %#jx - %#jx\n",
+   phys_avail[i], phys_avail[i + 1]);
vm_phys_add_seg(phys_avail[i], phys_avail[i + 1]);
+   }
 
/*
 * Initialize the physical memory allocator.
@@ -664,6 +667,8 @@ vm_page_startup(vm_offset_t vaddr)
vm_cnt.v_free_count = 0;
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = _phys_segs[segind];
+   printf("inserting seg %d: %#jx - %#jx\n", segind,
+   (uintmax_t)seg->start, (uintmax_t)seg->end);
for (pa = seg->start; pa < seg->end; pa += PAGE_SIZE)
vm_phys_init_page(pa);
 
@@ -679,6 +684,7 @@ vm_page_startup(vm_offset_t vaddr)
seg->end > phys_avail[i + 1])
continue;
 
+   printf("inserting seg %d into vm_phys\n", segind);
m = seg->first_page;
pagecount = (u_long)atop(seg->end - seg->start);
 
@@ -694,6 +700,7 @@ vm_page_startup(vm_offset_t vaddr)
break;
}
}
+   printf("v_free_count: %u\n", vm_cnt.v_free_count);
 
/*
 * Remove blacklisted pages from the physical memory allocator.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-09-14 Thread Gleb Smirnoff
  Steven,

  I don't want to MFC that, since that will hurt performance on stable/11
due to ACCEPT_LOCK().

On Thu, Sep 14, 2017 at 08:31:57AM +0100, Steven Hartland wrote:
S> Is this something that will be MFC'ed to 11 or is this 12 / CURRENT only?
S> 
S> On 13/09/2017 23:11, Gleb Smirnoff wrote:
S> > Author: glebius
S> > Date: Wed Sep 13 22:11:05 2017
S> > New Revision: 323566
S> > URL: https://svnweb.freebsd.org/changeset/base/323566
S> >
S> > Log:
S> >Use soref() in sendfile(2) instead fhold() to reference a socket.
S> >
S> >The problem is that fdrop() requires syscall context, as it may
S> >enter sleep in some cases.  The reason to use it in the original
S> >non-blocking sendfile implementation, was to avoid use of global
S> >ACCEPT_LOCK() on every I/O completion. Now in head sorele() no
S> >longer requires this lock.
S> >
S> > Modified:
S> >head/sys/kern/kern_sendfile.c
S> >
S> > Modified: head/sys/kern/kern_sendfile.c
S> > 
==
S> > --- head/sys/kern/kern_sendfile.c  Wed Sep 13 21:56:49 2017
(r323565)
S> > +++ head/sys/kern/kern_sendfile.c  Wed Sep 13 22:11:05 2017
(r323566)
S> > @@ -80,7 +80,7 @@ struct sf_io {
S> >volatile u_int  nios;
S> >u_int   error;
S> >int npages;
S> > -  struct file *sock_fp;
S> > +  struct socket   *so;
S> >struct mbuf *m;
S> >vm_page_t   pa[];
S> >   };
S> > @@ -255,7 +255,7 @@ static void
S> >   sendfile_iodone(void *arg, vm_page_t *pg, int count, int error)
S> >   {
S> >struct sf_io *sfio = arg;
S> > -  struct socket *so;
S> > +  struct socket *so = sfio->so;
S> >   
S> >for (int i = 0; i < count; i++)
S> >if (pg[i] != bogus_page)
S> > @@ -267,8 +267,6 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i
S> >if (!refcount_release(>nios))
S> >return;
S> >   
S> > -  so = sfio->sock_fp->f_data;
S> > -
S> >if (sfio->error) {
S> >struct mbuf *m;
S> >   
S> > @@ -296,8 +294,8 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i
S> >CURVNET_RESTORE();
S> >}
S> >   
S> > -  /* XXXGL: curthread */
S> > -  fdrop(sfio->sock_fp, curthread);
S> > +  SOCK_LOCK(so);
S> > +  sorele(so);
S> >free(sfio, M_TEMP);
S> >   }
S> >   
S> > @@ -724,6 +722,7 @@ retry_space:
S> >sfio = malloc(sizeof(struct sf_io) +
S> >npages * sizeof(vm_page_t), M_TEMP, M_WAITOK);
S> >refcount_init(>nios, 1);
S> > +  sfio->so = so;
S> >sfio->error = 0;
S> >   
S> >nios = sendfile_swapin(obj, sfio, off, space, npages, rhpages,
S> > @@ -858,9 +857,8 @@ prepend_header:
S> >error = (*so->so_proto->pr_usrreqs->pru_send)
S> >(so, 0, m, NULL, NULL, td);
S> >} else {
S> > -  sfio->sock_fp = sock_fp;
S> >sfio->npages = npages;
S> > -  fhold(sock_fp);
S> > +  soref(so);
S> >error = (*so->so_proto->pr_usrreqs->pru_send)
S> >(so, PRUS_NOTREADY, m, NULL, NULL, td);
S> >sendfile_iodone(sfio, NULL, 0, 0);
S> >
S> 

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


Re: svn commit: r323290 - head/sys/vm

2017-09-14 Thread Andreas Tobler

Hi Mark,

On 07.09.17 23:43, Mark Johnston wrote:

Author: markj
Date: Thu Sep  7 21:43:39 2017
New Revision: 323290
URL: https://svnweb.freebsd.org/changeset/base/323290

Log:
   Speed up vm_page_array initialization.
   
   We currently initialize the vm_page array in three passes: one to zero

   the array, one to initialize the "order" field of each page (necessary
   when inserting them into the vm_phys buddy allocator one-by-one), and
   one to initialize the remaining non-zero fields and individually insert
   each page into the allocator.
   
   Merge the three passes into one following a suggestion from alc:

   initialize vm_page fields in a single pass, and use vm_phys_free_contig()
   to efficiently insert physical memory segments into the buddy allocator.
   This reduces the initialization time to a third or a quarter of what it
   was before on most systems that I tested.
   
   Reviewed by:	alc, kib

   MFC after:   3 weeks
   Differential Revision:   https://reviews.freebsd.org/D12248

Modified:
   head/sys/vm/vm_page.c
   head/sys/vm/vm_phys.c
   head/sys/vm/vm_phys.h


I just found out that this commit breaks booting my powerpc64 Quad G5.
It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].

Sometimes it hangs earlier when the kbd is not there yet (usb), then I 
can't get the process/task where it hangs.


Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD)

Any ideas how to find out what's wrong?
The previous revision, r323289 seems stable, at least it survived 
several kernel builds.


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


svn commit: r323598 - head/lib/libedit

2017-09-14 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Sep 14 19:50:07 2017
New Revision: 323598
URL: https://svnweb.freebsd.org/changeset/base/323598

Log:
  libedit: raise the warning level to 3.
  
  NetBSD has the warning level to 5 but that actually triggers -Wcast-qual.

Modified:
  head/lib/libedit/Makefile

Modified: head/lib/libedit/Makefile
==
--- head/lib/libedit/Makefile   Thu Sep 14 19:18:24 2017(r323597)
+++ head/lib/libedit/Makefile   Thu Sep 14 19:50:07 2017(r323598)
@@ -7,6 +7,8 @@ LIB=edit
 SHLIB_MAJOR=   7
 SHLIBDIR?= /lib
 
+WARNS?=3
+
 OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
hist.c keymacro.c map.c chartype.c \
parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c
@@ -40,8 +42,6 @@ CLEANFILES+=  tokenizern.c historyn.c
 CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR
 #CFLAGS+= -DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
 #CFLAGS+= -DDEBUG_PASTE -DDEBUG_EDIT
-
-WARNS?=1
 
 SUBDIR= edit/readline
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323597 - head/lib/libc/net

2017-09-14 Thread Konstantin Belousov
Author: kib
Date: Thu Sep 14 19:18:24 2017
New Revision: 323597
URL: https://svnweb.freebsd.org/changeset/base/323597

Log:
  Silently handle freeaddrinfo(NULL) for compatibility with code which
  works on other OSes.  Also avoid unnecessary NULL check, free(NULL) is
  valid.
  
  Reviewed by:  bjk (man page), hrs, hselasky, ume
  Sponsored by: Mellanox Technologies
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D12354

Modified:
  head/lib/libc/net/getaddrinfo.3
  head/lib/libc/net/getaddrinfo.c

Modified: head/lib/libc/net/getaddrinfo.3
==
--- head/lib/libc/net/getaddrinfo.3 Thu Sep 14 18:50:40 2017
(r323596)
+++ head/lib/libc/net/getaddrinfo.3 Thu Sep 14 19:18:24 2017
(r323597)
@@ -18,7 +18,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 21, 2015
+.Dd September 13, 2017
 .Dt GETADDRINFO 3
 .Os
 .Sh NAME
@@ -351,6 +351,17 @@ pointer should be a
 .Li addrinfo
 structure created by a call to
 .Fn getaddrinfo .
+.Sh IMPLEMENTATION NOTES
+The behavior of
+.Li freeadrinfo(NULL)
+is left unspecified by both
+.St -susv4
+and
+.Dv "RFC 3493" .
+The current implementation ignores a
+.Dv NULL
+argument for compatibility with programs that rely on the implementation
+details of other operating systems.
 .Sh RETURN VALUES
 .Fn getaddrinfo
 returns zero on success or one of the error codes listed in

Modified: head/lib/libc/net/getaddrinfo.c
==
--- head/lib/libc/net/getaddrinfo.c Thu Sep 14 18:50:40 2017
(r323596)
+++ head/lib/libc/net/getaddrinfo.c Thu Sep 14 19:18:24 2017
(r323597)
@@ -35,7 +35,7 @@
  *   in the source code.  This is because RFC2553 is silent about which error
  *   code must be returned for which situation.
  * - freeaddrinfo(NULL).  RFC2553 is silent about it.  XNET 5.2 says it is
- *   invalid.  current code - SEGV on freeaddrinfo(NULL)
+ *   invalid.  Current code accepts NULL to be compatible with other OSes.
  *
  * Note:
  * - The code filters out AFs that are not supported by the kernel,
@@ -359,14 +359,13 @@ freeaddrinfo(struct addrinfo *ai)
 {
struct addrinfo *next;
 
-   do {
+   while (ai != NULL) {
next = ai->ai_next;
-   if (ai->ai_canonname)
-   free(ai->ai_canonname);
+   free(ai->ai_canonname);
/* no need to free(ai->ai_addr) */
free(ai);
ai = next;
-   } while (ai);
+   }
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323596 - head/usr.sbin/tcpdrop

2017-09-14 Thread Michael Tuexen
Author: tuexen
Date: Thu Sep 14 18:50:40 2017
New Revision: 323596
URL: https://svnweb.freebsd.org/changeset/base/323596

Log:
  Add a description how tcpdrop handles the case of specifying the
  -s and the -S option.
  
  Sponsored by: Netflix, Inc.

Modified:
  head/usr.sbin/tcpdrop/tcpdrop.8

Modified: head/usr.sbin/tcpdrop/tcpdrop.8
==
--- head/usr.sbin/tcpdrop/tcpdrop.8 Thu Sep 14 18:07:30 2017
(r323595)
+++ head/usr.sbin/tcpdrop/tcpdrop.8 Thu Sep 14 18:50:40 2017
(r323596)
@@ -78,6 +78,26 @@ is one of
 .Dv FIN_WAIT_2 , or
 .Dv TIME_WAIT .
 .Pp
+If
+.Fl S Ar stack
+and
+.Fl s Ar state
+are specified,
+.Nm
+will attempt to drop all TCP connections being in the state
+.Ar state
+and using the TCP stack
+.Ar stack .
+Since TCP connections in the 
+.Dv TIME_WAIT
+state are not tied to any TCP stack, using the option
+.Fl s Dv TIME_WAIT
+in combination with the
+.Fl S Ar stack
+option results in
+.Nm
+not dropping any TCP connection.
+.Pp
 The
 .Fl l
 flag may be given in addition to the
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323595 - stable/10/release/doc/en_US.ISO8859-1/relnotes

2017-09-14 Thread Glen Barber
Author: gjb
Date: Thu Sep 14 18:07:30 2017
New Revision: 323595
URL: https://svnweb.freebsd.org/changeset/base/323595

Log:
  Document r316348, pw(8) respecting pw.conf(5).
  Document r322793, GEOM_JOURNAL flush_queue handling fixed.
  
  Submitted by: eugen
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Thu Sep 14 
18:05:54 2017(r323594)
+++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Thu Sep 14 
18:07:30 2017(r323595)
@@ -191,6 +191,9 @@
added, providing one-time -style options
for .
 
+  The  utility has been updated
+   to properly respect , if present.
+
   The  utility has been
added, providing command-line access to features and debugging
facilities of  devices.
@@ -357,6 +360,10 @@
updated to prevent keep state from
incorrectly implying keep frags, matching
the behavior documented in .
+
+  The 
+   JOURNAL class has been updated to fix
+   flush_queue handling.
 
 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323594 - head/sys/kern

2017-09-14 Thread Gleb Smirnoff
Author: glebius
Date: Thu Sep 14 18:05:54 2017
New Revision: 323594
URL: https://svnweb.freebsd.org/changeset/base/323594

Log:
  Fix locking in soisconnected().
  
  When a newborn socket moves from incomplete queue to complete
  one, we need to obtain the listening socket lock after the child,
  which is a wrong order.  The old code did that in potentially
  endless loop of mtx_trylock().  The new one does only one attempt
  of mtx_trylock(), and in case of failure references listening
  socket, unlocks child and locks everything in right order.  In
  case if listening socket shuts down during that, just bail out.
  
  Reported & tested by: Jason Eggleston 
  Reported & tested by: Jason Wolfe 

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Thu Sep 14 17:29:51 2017(r323593)
+++ head/sys/kern/uipc_socket.c Thu Sep 14 18:05:54 2017(r323594)
@@ -3688,24 +3688,41 @@ soisconnecting(struct socket *so)
 void
 soisconnected(struct socket *so)
 {
-   struct socket *head;
-   int ret;
 
-   /*
-* XXXGL: this is the only place where we acquire socket locks
-* in reverse order: first child, then listening socket.  To
-* avoid possible LOR, use try semantics.
-*/
-restart:
SOCK_LOCK(so);
-   if ((head = so->so_listen) != NULL &&
-   __predict_false(SOLISTEN_TRYLOCK(head) == 0)) {
-   SOCK_UNLOCK(so);
-   goto restart;
-   }
so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
so->so_state |= SS_ISCONNECTED;
-   if (head != NULL && (so->so_qstate == SQ_INCOMP)) {
+
+   if (so->so_qstate == SQ_INCOMP) {
+   struct socket *head = so->so_listen;
+   int ret;
+
+   KASSERT(head, ("%s: so %p on incomp of NULL", __func__, so));
+   /*
+* Promoting a socket from incomplete queue to complete, we
+* need to go through reverse order of locking.  We first do
+* trylock, and if that doesn't succeed, we go the hard way
+* leaving a reference and rechecking consistency after proper
+* locking.
+*/
+   if (__predict_false(SOLISTEN_TRYLOCK(head) == 0)) {
+   soref(head);
+   SOCK_UNLOCK(so);
+   SOLISTEN_LOCK(head);
+   SOCK_LOCK(so);
+   if (__predict_false(head != so->so_listen)) {
+   /*
+* The socket went off the listen queue,
+* should be lost race to close(2) of sol.
+* The socket is about to soabort().
+*/
+   SOCK_UNLOCK(so);
+   sorele(head);
+   return;
+   }
+   /* Not the last one, as so holds a ref. */
+   refcount_release(>so_count);
+   }
 again:
if ((so->so_options & SO_ACCEPTFILTER) == 0) {
TAILQ_REMOVE(>sol_incomp, so, so_list);
@@ -3734,8 +3751,6 @@ again:
}
return;
}
-   if (head != NULL)
-   SOLISTEN_UNLOCK(head);
SOCK_UNLOCK(so);
wakeup(>so_timeo);
sorwakeup(so);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323593 - in head/sys: arm64/arm64 arm64/include conf

2017-09-14 Thread Andrew Turner
Author: andrew
Date: Thu Sep 14 17:29:51 2017
New Revision: 323593
URL: https://svnweb.freebsd.org/changeset/base/323593

Log:
  Add support for handling undefined instructions in userspace and the
  kernel. We can register callbacks to perform the required operation on the
  saved registers before returning.
  
  This is initially used to work around a bug in old versions of QEMU that
  trigger such an exception when reading from an ID register when it should
  load z zero value.
  
  I expect this could be used with other exception types, e.g. to emulate
  special register access from userland.
  
  Sponsored by: DARPA, AFRL

Added:
  head/sys/arm64/arm64/undefined.c   (contents, props changed)
  head/sys/arm64/include/undefined.h   (contents, props changed)
Modified:
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/arm64/trap.c
  head/sys/conf/files.arm64

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Thu Sep 14 16:58:26 2017
(r323592)
+++ head/sys/arm64/arm64/identcpu.c Thu Sep 14 17:29:51 2017
(r323593)
@@ -897,11 +897,7 @@ identify_cpu(void)
cpu_desc[cpu].id_aa64isar1 = READ_SPECIALREG(ID_AA64ISAR1_EL1);
cpu_desc[cpu].id_aa64mmfr0 = READ_SPECIALREG(ID_AA64MMFR0_EL1);
cpu_desc[cpu].id_aa64mmfr1 = READ_SPECIALREG(ID_AA64MMFR1_EL1);
-#ifdef NOTYET
cpu_desc[cpu].id_aa64mmfr2 = READ_SPECIALREG(ID_AA64MMFR2_EL1);
-#else
-   cpu_desc[cpu].id_aa64mmfr2 = 0;
-#endif
cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(ID_AA64PFR0_EL1);
cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(ID_AA64PFR1_EL1);
 

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Thu Sep 14 16:58:26 2017
(r323592)
+++ head/sys/arm64/arm64/machdep.c  Thu Sep 14 17:29:51 2017
(r323593)
@@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #ifdef VFP
@@ -162,6 +163,7 @@ static void
 cpu_startup(void *dummy)
 {
 
+   undef_init();
identify_cpu();
 
vm_ksubmap_init();

Modified: head/sys/arm64/arm64/trap.c
==
--- head/sys/arm64/arm64/trap.c Thu Sep 14 16:58:26 2017(r323592)
+++ head/sys/arm64/arm64/trap.c Thu Sep 14 17:29:51 2017(r323593)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #ifdef KDTRACE_HOOKS
 #include 
@@ -332,6 +333,10 @@ do_el1h_sync(struct thread *td, struct trapframe *fram
panic("No debugger in kernel.\n");
 #endif
break;
+   case EXCP_UNKNOWN:
+   if (undef_insn(1, frame))
+   break;
+   /* FALLTHROUGH */
default:
print_registers(frame);
panic("Unknown kernel exception %x esr_el1 %lx\n", exception,
@@ -341,20 +346,6 @@ do_el1h_sync(struct thread *td, struct trapframe *fram
td->td_frame = oframe;
 }
 
-/*
- * The attempted execution of an instruction bit pattern that has no allocated
- * instruction results in an exception with an unknown reason.
- */
-static void
-el0_excp_unknown(struct trapframe *frame, uint64_t far)
-{
-   struct thread *td;
-
-   td = curthread;
-   call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far);
-   userret(td, frame);
-}
-
 void
 do_el0_sync(struct thread *td, struct trapframe *frame)
 {
@@ -399,7 +390,9 @@ do_el0_sync(struct thread *td, struct trapframe *frame
data_abort(td, frame, esr, far, 1);
break;
case EXCP_UNKNOWN:
-   el0_excp_unknown(frame, far);
+   if (!undef_insn(0, frame))
+   call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far);
+   userret(td, frame);
break;
case EXCP_SP_ALIGN:
call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_sp);

Added: head/sys/arm64/arm64/undefined.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/arm64/undefined.cThu Sep 14 17:29:51 2017
(r323593)
@@ -0,0 +1,145 @@
+/*-
+ * Copyright (c) 2017 Andrew Turner
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the 

svn commit: r323592 - stable/10/release/doc/en_US.ISO8859-1/relnotes

2017-09-14 Thread Glen Barber
Author: gjb
Date: Thu Sep 14 16:58:26 2017
New Revision: 323592
URL: https://svnweb.freebsd.org/changeset/base/323592

Log:
  Fix an indentation mistake that snuck in with r323590.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Thu Sep 14 
16:54:05 2017(r323591)
+++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Thu Sep 14 
16:58:26 2017(r323592)
@@ -310,7 +310,7 @@
updated to be deferred cancel-safe, eliminating possible
lockups in multi-threaded applications using functions such
as , , and .
-   
+
 
 
   ABI Compatibility
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323591 - stable/10/release/doc/en_US.ISO8859-1/relnotes

2017-09-14 Thread Glen Barber
Author: gjb
Date: Thu Sep 14 16:54:05 2017
New Revision: 323591
URL: https://svnweb.freebsd.org/changeset/base/323591

Log:
  Document r320772, syslogd(8) logging retry after restarting
  unexpectedly.
  
  Submitted by: eugen
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Thu Sep 14 
16:49:43 2017(r323590)
+++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Thu Sep 14 
16:54:05 2017(r323591)
@@ -200,6 +200,10 @@
been marked as deprecated, and planned for removal in
12.0-RELEASE.
 
+  The  utility has been
+   updated to restart logging a subprocess that had restarted
+   unexpectedly.
+
   The  and 
utilities have been marked as deprecated, and planned for
removal from the base system in the future.  A newer version
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323590 - stable/10/release/doc/en_US.ISO8859-1/relnotes

2017-09-14 Thread Glen Barber
Author: gjb
Date: Thu Sep 14 16:49:43 2017
New Revision: 323590
URL: https://svnweb.freebsd.org/changeset/base/323590

Log:
  Document r320312 and r321074, cancel-safe support in stdio(3) and
  syslog(3).
  
  Submitted by: eugen
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Thu Sep 14 
16:42:29 2017(r323589)
+++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Thu Sep 14 
16:49:43 2017(r323590)
@@ -294,7 +294,19 @@
   The  function has been
updated to return the accumulated error from previous
 calls.
-
+
+  The  function has been
+   updated to be more resilent to thread cancellation occurring
+   in supported deferred mode, eliminating possible lockups in
+   multi-threaded applications that often create and cancel
+   threads using the function, such as net/mpd5.
+
+  The  function has been
+   updated to be deferred cancel-safe, eliminating possible
+   lockups in multi-threaded applications using functions such
+   as , , and .
+   
 
 
   ABI Compatibility
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323589 - head/sys/boot/i386/libi386

2017-09-14 Thread Toomas Soome
Author: tsoome
Date: Thu Sep 14 16:42:29 2017
New Revision: 323589
URL: https://svnweb.freebsd.org/changeset/base/323589

Log:
  loader: biosmem.c cstyle cleanup
  
  No functional changes, just cleanup.
  
  Reviewed by:  allanjude, imp
  Differential Revision:https://reviews.freebsd.org/D12370

Modified:
  head/sys/boot/i386/libi386/biosmem.c

Modified: head/sys/boot/i386/libi386/biosmem.c
==
--- head/sys/boot/i386/libi386/biosmem.cThu Sep 14 16:41:24 2017
(r323588)
+++ head/sys/boot/i386/libi386/biosmem.cThu Sep 14 16:42:29 2017
(r323589)
@@ -63,150 +63,157 @@ static uint8_t b_bios_probed;
  * memory correctly. You need both maker and product as
  * reported by smbios.
  */
-#define BQ_DISTRUST_E820_EXTMEM0x1 /* e820 might not return useful
-  extended memory */
+/* e820 might not return useful extended memory */
+#defineBQ_DISTRUST_E820_EXTMEM 0x1
 struct bios_getmem_quirks {
-const char* bios_vendor;
-const char*maker;
-const char*product;
-intquirk;
+   const char *bios_vendor;
+   const char *maker;
+   const char *product;
+   int quirk;
 };
 
 static struct bios_getmem_quirks quirks[] = {
-{"coreboot", "Acer", "Peppy", BQ_DISTRUST_E820_EXTMEM},
-{NULL, NULL, NULL, 0}
+   {"coreboot", "Acer", "Peppy", BQ_DISTRUST_E820_EXTMEM},
+   {NULL, NULL, NULL, 0}
 };
 
 static int
 bios_getquirks(void)
 {
-int i;
+   int i;
 
-for (i=0; quirks[i].quirk != 0; ++i)
-   if (smbios_match(quirks[i].bios_vendor, quirks[i].maker,
-   quirks[i].product))
-   return (quirks[i].quirk);
+   for (i = 0; quirks[i].quirk != 0; ++i) {
+   if (smbios_match(quirks[i].bios_vendor, quirks[i].maker,
+   quirks[i].product))
+   return (quirks[i].quirk);
+   }
 
-return (0);
+   return (0);
 }
 
 void
 bios_getmem(void)
 {
-uint64_t size;
+   uint64_t size;
 
-/* Parse system memory map */
-v86.ebx = 0;
-do {
-   v86.ctl = V86_FLAGS;
-   v86.addr = 0x15;/* int 0x15 function 0xe820*/
-   v86.eax = 0xe820;
-   v86.ecx = sizeof(struct bios_smap_xattr);
-   v86.edx = SMAP_SIG;
-   v86.es = VTOPSEG();
-   v86.edi = VTOPOFF();
-   v86int();
-   if ((V86_CY(v86.efl)) || (v86.eax != SMAP_SIG))
-   break;
-   /* look for a low-memory segment that's large enough */
-   if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) &&
-   (smap.length >= (512 * 1024))) {
-   bios_basemem = smap.length;
-   b_bios_probed |= B_BASEMEM_E820;
-   }
+   /* Parse system memory map */
+   v86.ebx = 0;
+   do {
+   v86.ctl = V86_FLAGS;
+   v86.addr = 0x15;/* int 0x15 function 0xe820 */
+   v86.eax = 0xe820;
+   v86.ecx = sizeof(struct bios_smap_xattr);
+   v86.edx = SMAP_SIG;
+   v86.es = VTOPSEG();
+   v86.edi = VTOPOFF();
+   v86int();
+   if ((V86_CY(v86.efl)) || (v86.eax != SMAP_SIG))
+   break;
+   /* look for a low-memory segment that's large enough */
+   if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) &&
+   (smap.length >= (512 * 1024))) {
+   bios_basemem = smap.length;
+   b_bios_probed |= B_BASEMEM_E820;
+   }
 
-   /* look for the first segment in 'extended' memory */
-   if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0x10) &&
-   !(bios_getquirks() & BQ_DISTRUST_E820_EXTMEM)) {
-   bios_extmem = smap.length;
-   b_bios_probed |= B_EXTMEM_E820;
-   }
+   /* look for the first segment in 'extended' memory */
+   if ((smap.type == SMAP_TYPE_MEMORY) &&
+   (smap.base == 0x10) &&
+   !(bios_getquirks() & BQ_DISTRUST_E820_EXTMEM)) {
+   bios_extmem = smap.length;
+   b_bios_probed |= B_EXTMEM_E820;
+   }
 
-   /*
-* Look for the largest segment in 'extended' memory beyond
-* 1MB but below 4GB.
-*/
-   if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base > 0x10) &&
-   (smap.base < 0x1ull)) {
-   size = smap.length;
+   /*
+* Look for the largest segment in 'extended' memory beyond
+* 1MB but below 4GB.
+*/
+   if ((smap.type == SMAP_TYPE_MEMORY) &&
+   (smap.base > 0x10) &&
+   (smap.base < 0x1ull)) {
+   size = smap.length;
 
-   /*
-* If this segment crosses the 4GB 

svn commit: r323587 - head/sys/contrib/octeon-sdk

2017-09-14 Thread Ed Maste
Author: emaste
Date: Thu Sep 14 16:41:22 2017
New Revision: 323587
URL: https://svnweb.freebsd.org/changeset/base/323587

Log:
  octeon sdk: initialize variable to quiet Clang warning
  
  Clang complains "variable 'dummy' is uninitialized when used here".
  
  Reported by:  Clang
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/contrib/octeon-sdk/cvmx-l2c.c

Modified: head/sys/contrib/octeon-sdk/cvmx-l2c.c
==
--- head/sys/contrib/octeon-sdk/cvmx-l2c.c  Thu Sep 14 15:34:45 2017
(r323586)
+++ head/sys/contrib/octeon-sdk/cvmx-l2c.c  Thu Sep 14 16:41:22 2017
(r323587)
@@ -339,7 +339,7 @@ uint64_t cvmx_l2c_read_perf(uint32_t counter)
 static void fault_in(uint64_t addr, int len)
 {
 volatile char *ptr;
-volatile char dummy;
+volatile char dummy = 0;
 /*
  * Adjust addr and length so we get all cache lines even for
  * small ranges spanning two cache lines.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323588 - head/contrib/elftoolchain/readelf

2017-09-14 Thread John Baldwin
Author: jhb
Date: Thu Sep 14 16:41:24 2017
New Revision: 323588
URL: https://svnweb.freebsd.org/changeset/base/323588

Log:
  Recognize NT_PTLWPINFO and NT_ARM_VFP in FreeBSD ELF cores.
  
  Reviewed by:  emaste
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D12371

Modified:
  head/contrib/elftoolchain/readelf/readelf.c

Modified: head/contrib/elftoolchain/readelf/readelf.c
==
--- head/contrib/elftoolchain/readelf/readelf.c Thu Sep 14 16:41:22 2017
(r323587)
+++ head/contrib/elftoolchain/readelf/readelf.c Thu Sep 14 16:41:24 2017
(r323588)
@@ -1141,7 +1141,9 @@ note_type_freebsd_core(unsigned int nt)
case 14: return "NT_PROCSTAT_OSREL";
case 15: return "NT_PROCSTAT_PSSTRINGS";
case 16: return "NT_PROCSTAT_AUXV";
+   case 17: return "NT_PTLWPINFO";
case 0x202: return "NT_X86_XSTATE (x86 XSAVE extended state)";
+   case 0x400: return "NT_ARM_VFP (arm VFP registers)";
default: return (note_type_unknown(nt));
}
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r323580 - in head/sys/arm: arm include

2017-09-14 Thread Andrew Turner

> On 14 Sep 2017, at 15:54, John Baldwin  wrote:
> 
> On Thursday, September 14, 2017 02:30:44 PM John Baldwin wrote:
>> Author: jhb
>> Date: Thu Sep 14 14:30:43 2017
>> New Revision: 323580
>> URL: https://svnweb.freebsd.org/changeset/base/323580
>> 
>> Log:
>>  Add AT_HWCAP flags for VFP settings for FreeBSD/arm.
>> 
>>  These flags match the meaning and value of flags in Linux, though
>>  Linux has many more flags.
>> 
>>  Reviewed by:stevek, Michal Meloun  (earlier 
>> version)
>>  MFC after:  1 month
>>  Differential Revision:  https://reviews.freebsd.org/D12291
> 
> It would probably be good to add HWCAP_NEON if someone knows the right things
> to check to detect it.

You’ll need to check the mvfr1 register for it. Linux checks the A_SIMD SPFP, 
A_SIMD integer, and A_SIMD load/store fields are all 1.

Andrew 

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

Re: svn commit: r323580 - in head/sys/arm: arm include

2017-09-14 Thread John Baldwin
On Thursday, September 14, 2017 02:30:44 PM John Baldwin wrote:
> Author: jhb
> Date: Thu Sep 14 14:30:43 2017
> New Revision: 323580
> URL: https://svnweb.freebsd.org/changeset/base/323580
> 
> Log:
>   Add AT_HWCAP flags for VFP settings for FreeBSD/arm.
>   
>   These flags match the meaning and value of flags in Linux, though
>   Linux has many more flags.
>   
>   Reviewed by:stevek, Michal Meloun  (earlier 
> version)
>   MFC after:  1 month
>   Differential Revision:  https://reviews.freebsd.org/D12291

It would probably be good to add HWCAP_NEON if someone knows the right things
to check to detect it.

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


svn commit: r323586 - in head/sys/dev: amdsmn amdtemp intpm ioat ntb/ntb_hw

2017-09-14 Thread Conrad Meyer
Author: cem
Date: Thu Sep 14 15:34:45 2017
New Revision: 323586
URL: https://svnweb.freebsd.org/changeset/base/323586

Log:
  Add PNP metadata to a few drivers
  
  An eventual devd(8) or other component should be able to scan buses and
  automatically load drivers that match device ids described in this metadata.
  
  Reviewed by:  imp
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D12364

Modified:
  head/sys/dev/amdsmn/amdsmn.c
  head/sys/dev/amdtemp/amdtemp.c
  head/sys/dev/intpm/intpm.c
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c

Modified: head/sys/dev/amdsmn/amdsmn.c
==
--- head/sys/dev/amdsmn/amdsmn.cThu Sep 14 15:34:29 2017
(r323585)
+++ head/sys/dev/amdsmn/amdsmn.cThu Sep 14 15:34:45 2017
(r323586)
@@ -89,6 +89,8 @@ static driver_t amdsmn_driver = {
 static devclass_t amdsmn_devclass;
 DRIVER_MODULE(amdsmn, hostb, amdsmn_driver, amdsmn_devclass, NULL, NULL);
 MODULE_VERSION(amdsmn, 1);
+MODULE_PNP_INFO("W32:vendor/device", pci, amdsmn, amdsmn_ids,
+sizeof(amdsmn_ids[0]), nitems(amdsmn_ids));
 
 static bool
 amdsmn_match(device_t parent)

Modified: head/sys/dev/amdtemp/amdtemp.c
==
--- head/sys/dev/amdtemp/amdtemp.c  Thu Sep 14 15:34:29 2017
(r323585)
+++ head/sys/dev/amdtemp/amdtemp.c  Thu Sep 14 15:34:45 2017
(r323586)
@@ -100,7 +100,6 @@ static struct amdtemp_product {
{ VENDORID_AMD, DEVICEID_AMD_MISC16_M30H },
{ VENDORID_AMD, DEVICEID_AMD_MISC17 },
{ VENDORID_AMD, DEVICEID_AMD_HOSTB17H },
-   { 0, 0 }
 };
 
 /*
@@ -165,6 +164,8 @@ static devclass_t amdtemp_devclass;
 DRIVER_MODULE(amdtemp, hostb, amdtemp_driver, amdtemp_devclass, NULL, NULL);
 MODULE_VERSION(amdtemp, 1);
 MODULE_DEPEND(amdtemp, amdsmn, 1, 1, 1);
+MODULE_PNP_INFO("U16:vendor;U16:device", pci, amdtemp, amdtemp_products,
+sizeof(amdtemp_products[0]), nitems(amdtemp_products));
 
 static int
 amdtemp_match(device_t dev)
@@ -175,7 +176,7 @@ amdtemp_match(device_t dev)
vendor = pci_get_vendor(dev);
devid = pci_get_device(dev);
 
-   for (i = 0; amdtemp_products[i].amdtemp_vendorid != 0; i++) {
+   for (i = 0; i < nitems(amdtemp_products); i++) {
if (vendor == amdtemp_products[i].amdtemp_vendorid &&
devid == amdtemp_products[i].amdtemp_deviceid)
return (1);

Modified: head/sys/dev/intpm/intpm.c
==
--- head/sys/dev/intpm/intpm.c  Thu Sep 14 15:34:29 2017(r323585)
+++ head/sys/dev/intpm/intpm.c  Thu Sep 14 15:34:45 2017(r323586)
@@ -88,34 +88,38 @@ static int intsmb_stop_poll(struct intsmb_softc *sc);
 static int intsmb_free(struct intsmb_softc *sc);
 static void intsmb_rawintr(void *arg);
 
+const struct intsmb_device {
+   uint32_t devid;
+   const char *description;
+} intsmb_products[] = {
+   { 0x71138086, "Intel PIIX4 SMBUS Interface" },
+   { 0x719b8086, "Intel PIIX4 SMBUS Interface" },
+#if 0
+   /* Not a good idea yet, this stops isab0 functioning */
+   { 0x02001166, "ServerWorks OSB4" },
+#endif
+   { 0x43721002, "ATI IXP400 SMBus Controller" },
+   { AMDSB_SMBUS_DEVID, "AMD SB600/7xx/8xx/9xx SMBus Controller" },
+   { AMDFCH_SMBUS_DEVID, "AMD FCH SMBus Controller" },
+   { AMDCZ_SMBUS_DEVID, "AMD FCH SMBus Controller" },
+};
+
 static int
 intsmb_probe(device_t dev)
 {
+   const struct intsmb_device *isd;
+   uint32_t devid;
+   size_t i;
 
-   switch (pci_get_devid(dev)) {
-   case 0x71138086:/* Intel 82371AB */
-   case 0x719b8086:/* Intel 82443MX */
-#if 0
-   /* Not a good idea yet, this stops isab0 functioning */
-   case 0x02001166:/* ServerWorks OSB4 */
-#endif
-   device_set_desc(dev, "Intel PIIX4 SMBUS Interface");
-   break;
-   case 0x43721002:
-   device_set_desc(dev, "ATI IXP400 SMBus Controller");
-   break;
-   case AMDSB_SMBUS_DEVID:
-   device_set_desc(dev, "AMD SB600/7xx/8xx/9xx SMBus Controller");
-   break;
-   case AMDFCH_SMBUS_DEVID:/* AMD FCH */
-   case AMDCZ_SMBUS_DEVID: /* AMD Carizzo FCH */
-   device_set_desc(dev, "AMD FCH SMBus Controller");
-   break;
-   default:
-   return (ENXIO);
+   devid = pci_get_devid(dev);
+   for (i = 0; i < nitems(intsmb_products); i++) {
+   isd = _products[i];
+   if (isd->devid == devid) {
+   device_set_desc(dev, isd->description);
+   return (BUS_PROBE_DEFAULT);
+   }
}
-
-   return (BUS_PROBE_DEFAULT);
+   return (ENXIO);
 }
 
 static uint8_t
@@ 

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

2017-09-14 Thread John Baldwin
Author: jhb
Date: Thu Sep 14 15:34:29 2017
New Revision: 323585
URL: https://svnweb.freebsd.org/changeset/base/323585

Log:
  Add AT_EHDRFLAGS and AT_HWCAP on amd64.
  
  x86 has two separate (but identical) list of AT_* constants and the
  earlier commit to add AT_HWCAP only updated the i386 list.

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

Modified: head/sys/x86/include/elf.h
==
--- head/sys/x86/include/elf.h  Thu Sep 14 15:07:48 2017(r323584)
+++ head/sys/x86/include/elf.h  Thu Sep 14 15:34:29 2017(r323585)
@@ -187,8 +187,10 @@ __ElfType(Auxinfo);
 #defineAT_PAGESIZESLEN 21  /* Number of pagesizes. */
 #defineAT_TIMEKEEP 22  /* Pointer to timehands. */
 #defineAT_STACKPROT23  /* Initial stack protection. */
+#defineAT_EHDRFLAGS24  /* e_flags field from elf hdr */
+#defineAT_HWCAP25  /* CPU feature flags. */
 
-#defineAT_COUNT24  /* Count of defined aux entry types. */
+#defineAT_COUNT26  /* Count of defined aux entry types. */
 
 /*
  * Relocation types.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323584 - in head: sys/arm/arm sys/sys usr.bin/gcore

2017-09-14 Thread John Baldwin
Author: jhb
Date: Thu Sep 14 15:07:48 2017
New Revision: 323584
URL: https://svnweb.freebsd.org/changeset/base/323584

Log:
  Add a NT_ARM_VFP ELF core note to hold VFP registers for each thread.
  
  The core note matches the format and layout of NT_ARM_VFP on Linux.
  Debuggers use the AT_HWCAP flags to determine how many VFP registers
  are actually used and their format.
  
  Reviewed by:  mmel (earlier version w/o gcore)
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D12293

Modified:
  head/sys/arm/arm/elf_machdep.c
  head/sys/sys/elf_common.h
  head/usr.bin/gcore/elfcore.c

Modified: head/sys/arm/arm/elf_machdep.c
==
--- head/sys/arm/arm/elf_machdep.c  Thu Sep 14 15:06:29 2017
(r323583)
+++ head/sys/arm/arm/elf_machdep.c  Thu Sep 14 15:07:48 2017
(r323584)
@@ -45,6 +45,9 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#ifdef VFP
+#include 
+#endif
 
 static boolean_t elf32_arm_abi_supported(struct image_params *);
 
@@ -127,9 +130,19 @@ elf32_arm_abi_supported(struct image_params *imgp)
 }
 
 void
-elf32_dump_thread(struct thread *td __unused, void *dst __unused,
-size_t *off __unused)
+elf32_dump_thread(struct thread *td, void *dst, size_t *off)
 {
+#ifdef VFP
+   mcontext_vfp_t vfp;
+
+   if (dst != NULL) {
+   get_vfpcontext(td, );
+   *off = elf32_populate_note(NT_ARM_VFP, , dst, sizeof(vfp),
+   NULL);
+   } else
+   *off = elf32_populate_note(NT_ARM_VFP, NULL, NULL, sizeof(vfp),
+   NULL);
+#endif
 }
 
 /*

Modified: head/sys/sys/elf_common.h
==
--- head/sys/sys/elf_common.h   Thu Sep 14 15:06:29 2017(r323583)
+++ head/sys/sys/elf_common.h   Thu Sep 14 15:07:48 2017(r323584)
@@ -757,6 +757,7 @@ typedef struct {
 #defineNT_PTLWPINFO17  /* Thread ptrace miscellaneous 
info. */
 #defineNT_PPC_VMX  0x100   /* PowerPC Altivec/VMX registers */
 #defineNT_X86_XSTATE   0x202   /* x86 XSAVE extended state. */
+#defineNT_ARM_VFP  0x400   /* ARM VFP registers */
 
 /* Symbol Binding - ELFNN_ST_BIND - st_info */
 #defineSTB_LOCAL   0   /* Local symbol */

Modified: head/usr.bin/gcore/elfcore.c
==
--- head/usr.bin/gcore/elfcore.cThu Sep 14 15:06:29 2017
(r323583)
+++ head/usr.bin/gcore/elfcore.cThu Sep 14 15:07:48 2017
(r323584)
@@ -109,6 +109,9 @@ static void *elf_note_prpsinfo(void *, size_t *);
 static void *elf_note_prstatus(void *, size_t *);
 static void *elf_note_thrmisc(void *, size_t *);
 static void *elf_note_ptlwpinfo(void *, size_t *);
+#if defined(__arm__)
+static void *elf_note_arm_vfp(void *, size_t *);
+#endif
 #if defined(__i386__) || defined(__amd64__)
 static void *elf_note_x86_xstate(void *, size_t *);
 #endif
@@ -368,6 +371,9 @@ elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep
elf_putnote(NT_FPREGSET, elf_note_fpregset, tids + i, sb);
elf_putnote(NT_THRMISC, elf_note_thrmisc, tids + i, sb);
elf_putnote(NT_PTLWPINFO, elf_note_ptlwpinfo, tids + i, sb);
+#if defined(__arm__)
+   elf_putnote(NT_ARM_VFP, elf_note_arm_vfp, tids + i, sb);
+#endif
 #if defined(__i386__) || defined(__amd64__)
elf_putnote(NT_X86_XSTATE, elf_note_x86_xstate, tids + i, sb);
 #endif
@@ -717,6 +723,31 @@ elf_note_ptlwpinfo(void *arg, size_t *sizep)
*sizep = sizeof(int) + sizeof(struct ptrace_lwpinfo);
return (p);
 }
+
+#if defined(__arm__)
+static void *
+elf_note_arm_vfp(void *arg, size_t *sizep)
+{
+   lwpid_t tid;
+   struct vfpreg *vfp;
+   static bool has_vfp = true;
+   struct vfpreg info;
+
+   tid = *(lwpid_t *)arg;
+   if (has_vfp) {
+   if (ptrace(PT_GETVFPREGS, tid, (void *), 0) != 0)
+   has_vfp = false;
+   }
+   if (!has_vfp) {
+   *sizep = 0;
+   return (NULL);
+   }
+   vfp = calloc(1, sizeof(*vfp));
+   memcpy(vfp, , sizeof(*vfp));
+   *sizep = sizeof(*vfp);
+   return (vfp);
+}
+#endif
 
 #if defined(__i386__) || defined(__amd64__)
 static void *
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323583 - in head/sys/arm: arm include

2017-09-14 Thread John Baldwin
Author: jhb
Date: Thu Sep 14 15:06:29 2017
New Revision: 323583
URL: https://svnweb.freebsd.org/changeset/base/323583

Log:
  Export get/set_vfpcontext from machdep.c.
  
  Should have been part of the previous commit to add ptrace operations
  for VFP registers.
  
  MFC after:1 month

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/include/vfp.h

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Thu Sep 14 15:03:43 2017(r323582)
+++ head/sys/arm/arm/machdep.c  Thu Sep 14 15:06:29 2017(r323583)
@@ -405,7 +405,7 @@ exec_setregs(struct thread *td, struct image_params *i
 /*
  * Get machine VFP context.
  */
-static void
+void
 get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp)
 {
struct pcb *pcb;
@@ -425,7 +425,7 @@ get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp)
 /*
  * Set machine VFP context.
  */
-static void
+void
 set_vfpcontext(struct thread *td, mcontext_vfp_t *vfp)
 {
struct pcb *pcb;

Modified: head/sys/arm/include/vfp.h
==
--- head/sys/arm/include/vfp.h  Thu Sep 14 15:03:43 2017(r323582)
+++ head/sys/arm/include/vfp.h  Thu Sep 14 15:06:29 2017(r323583)
@@ -142,6 +142,8 @@ struct vfp_state {
 };
 
 #ifdef _KERNEL
+void   get_vfpcontext(struct thread *, mcontext_vfp_t *);
+void   set_vfpcontext(struct thread *, mcontext_vfp_t *);
 voidvfp_init(void);
 voidvfp_store(struct vfp_state *, boolean_t);
 voidvfp_discard(struct thread *);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323582 - in head: lib/libc/sys sys/arm/arm sys/arm/include sys/conf

2017-09-14 Thread John Baldwin
Author: jhb
Date: Thu Sep 14 15:03:43 2017
New Revision: 323582
URL: https://svnweb.freebsd.org/changeset/base/323582

Log:
  Add ptrace operations to fetch and store VFP registers.
  
  Reviewed by:  mmel, kib
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D12294

Added:
  head/sys/arm/arm/ptrace_machdep.c   (contents, props changed)
Modified:
  head/lib/libc/sys/ptrace.2
  head/sys/arm/include/ptrace.h
  head/sys/conf/files.arm

Modified: head/lib/libc/sys/ptrace.2
==
--- head/lib/libc/sys/ptrace.2  Thu Sep 14 14:36:56 2017(r323581)
+++ head/lib/libc/sys/ptrace.2  Thu Sep 14 15:03:43 2017(r323582)
@@ -2,7 +2,7 @@
 .\"$NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
 .\"
 .\" This file is in the public domain.
-.Dd June 11, 2017
+.Dd September 14, 2017
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -762,6 +762,28 @@ The
 .Fa data
 argument is ignored.
 .El
+.Sh ARM MACHINE-SPECIFIC REQUESTS
+.Bl -tag -width "Dv PT_SETVFPREGS"
+.It Dv PT_GETVFPREGS
+Return the thread's
+.Dv VFP
+machine state in the buffer pointed to by
+.Fa addr .
+.Pp
+The
+.Fa data
+argument is ignored.
+.It Dv PT_SETVFPREGS
+Set the thread's
+.Dv VFP
+machine state from the buffer pointed to by
+.Fa addr .
+.Pp
+The
+.Fa data
+argument is ignored.
+.El
+.Pp
 .Sh x86 MACHINE-SPECIFIC REQUESTS
 .Bl -tag -width "Dv PT_GETXSTATE_INFO"
 .It Dv PT_GETXMMREGS

Added: head/sys/arm/arm/ptrace_machdep.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/arm/ptrace_machdep.c   Thu Sep 14 15:03:43 2017
(r323582)
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 2017 John Baldwin 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#ifdef VFP
+#include 
+#endif
+
+int
+cpu_ptrace(struct thread *td, int req, void *addr, int data)
+{
+#ifdef VFP
+   mcontext_vfp_t vfp;
+#endif
+   int error;
+
+   switch (req) {
+#ifdef VFP
+   case PT_GETVFPREGS:
+   get_vfpcontext(td, );
+   error = copyout(, addr, sizeof(vfp));
+   break;
+   case PT_SETVFPREGS:
+   error = copyin(addr, , sizeof(vfp));
+   if (error == 0)
+   set_vfpcontext(td, );
+   break;
+#endif
+   default:
+   error = EINVAL;
+   }
+
+   return (error);
+}

Modified: head/sys/arm/include/ptrace.h
==
--- head/sys/arm/include/ptrace.h   Thu Sep 14 14:36:56 2017
(r323581)
+++ head/sys/arm/include/ptrace.h   Thu Sep 14 15:03:43 2017
(r323582)
@@ -4,5 +4,20 @@
 #ifndef _MACHINE_PTRACE_H_
 #define _MACHINE_PTRACE_H_
 
+#define__HAVE_PTRACE_MACHDEP
+
+/*
+ * Must match mcontext_vfp_t.  Note that mcontext_vfp_t does not
+ * include explicit padding.
+ */
+struct vfpreg {
+   __uint64_t  vfp_reg[32];
+   __uint32_t  vfp_scr;
+   __uint32_t  vfp_pad0;
+};
+
+#definePT_GETVFPREGS   (PT_FIRSTMACH + 0)
+#definePT_SETVFPREGS   (PT_FIRSTMACH + 1)
+
 #endif /* !_MACHINE_PTRACE_H */
 

Modified: head/sys/conf/files.arm
==
--- head/sys/conf/files.arm Thu Sep 14 14:36:56 2017(r323581)
+++ head/sys/conf/files.arm Thu Sep 14 15:03:43 2017(r323582)
@@ -88,6 +88,7 @@ arm/arm/platform_pl310_if.m   optionalplatform pl310
 arm/arm/pmap-v4.c

svn commit: r323581 - head/sys/arm/arm

2017-09-14 Thread John Baldwin
Author: jhb
Date: Thu Sep 14 14:36:56 2017
New Revision: 323581
URL: https://svnweb.freebsd.org/changeset/base/323581

Log:
  Only mess with VFP state on the CPU for curthread for get/set_vfpcontext.
  
  Future changes will use these functions to fetch and store VFP state for
  threads other than curthread.
  
  Reviewed by:  andrew, stevek, Michal Meloun 
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D12292

Modified:
  head/sys/arm/arm/machdep.c

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Thu Sep 14 14:30:43 2017(r323580)
+++ head/sys/arm/arm/machdep.c  Thu Sep 14 14:36:56 2017(r323581)
@@ -408,17 +408,18 @@ exec_setregs(struct thread *td, struct image_params *i
 static void
 get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp)
 {
-   struct pcb *curpcb;
+   struct pcb *pcb;
 
-   curpcb = curthread->td_pcb;
-   critical_enter();
-
-   vfp_store(>pcb_vfpstate, false);
-   memcpy(vfp->mcv_reg, curpcb->pcb_vfpstate.reg,
+   pcb = td->td_pcb;
+   if (td == curthread) {
+   critical_enter();
+   vfp_store(>pcb_vfpstate, false);
+   critical_exit();
+   } else
+   MPASS(TD_IS_SUSPENDED(td));
+   memcpy(vfp->mcv_reg, pcb->pcb_vfpstate.reg,
sizeof(vfp->mcv_reg));
-   vfp->mcv_fpscr = curpcb->pcb_vfpstate.fpscr;
-
-   critical_exit();
+   vfp->mcv_fpscr = pcb->pcb_vfpstate.fpscr;
 }
 
 /*
@@ -427,17 +428,18 @@ get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp)
 static void
 set_vfpcontext(struct thread *td, mcontext_vfp_t *vfp)
 {
-   struct pcb *curpcb;
+   struct pcb *pcb;
 
-   curpcb = curthread->td_pcb;
-   critical_enter();
-
-   vfp_discard(td);
-   memcpy(curpcb->pcb_vfpstate.reg, vfp->mcv_reg,
-   sizeof(curpcb->pcb_vfpstate.reg));
-   curpcb->pcb_vfpstate.fpscr = vfp->mcv_fpscr;
-
-   critical_exit();
+   pcb = td->td_pcb;
+   if (td == curthread) {
+   critical_enter();
+   vfp_discard(td);
+   critical_exit();
+   } else
+   MPASS(TD_IS_SUSPENDED(td));
+   memcpy(pcb->pcb_vfpstate.reg, vfp->mcv_reg,
+   sizeof(pcb->pcb_vfpstate.reg));
+   pcb->pcb_vfpstate.fpscr = vfp->mcv_fpscr;
 }
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323580 - in head/sys/arm: arm include

2017-09-14 Thread John Baldwin
Author: jhb
Date: Thu Sep 14 14:30:43 2017
New Revision: 323580
URL: https://svnweb.freebsd.org/changeset/base/323580

Log:
  Add AT_HWCAP flags for VFP settings for FreeBSD/arm.
  
  These flags match the meaning and value of flags in Linux, though
  Linux has many more flags.
  
  Reviewed by:  stevek, Michal Meloun  (earlier version)
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D12291

Modified:
  head/sys/arm/arm/elf_machdep.c
  head/sys/arm/arm/vfp.c
  head/sys/arm/include/elf.h
  head/sys/arm/include/md_var.h

Modified: head/sys/arm/arm/elf_machdep.c
==
--- head/sys/arm/arm/elf_machdep.c  Thu Sep 14 14:26:55 2017
(r323579)
+++ head/sys/arm/arm/elf_machdep.c  Thu Sep 14 14:30:43 2017
(r323580)
@@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$");
 
 static boolean_t elf32_arm_abi_supported(struct image_params *);
 
+u_long elf_hwcap;
+
 struct sysentvec elf32_freebsd_sysvec = {
.sv_size= SYS_MAXSYSCALL,
.sv_table   = sysent,
@@ -86,6 +88,7 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_schedtail   = NULL,
.sv_thread_detach = NULL,
.sv_trap= NULL,
+   .sv_hwcap   = _hwcap,
 };
 INIT_SYSENTVEC(elf32_sysvec, _freebsd_sysvec);
 

Modified: head/sys/arm/arm/vfp.c
==
--- head/sys/arm/arm/vfp.c  Thu Sep 14 14:26:55 2017(r323579)
+++ head/sys/arm/arm/vfp.c  Thu Sep 14 14:30:43 2017(r323580)
@@ -33,9 +33,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -115,6 +117,7 @@ vfp_init(void)
vfp_exists = 1;
is_d32 = 0;
PCPU_SET(vfpsid, fpsid);/* save the fpsid */
+   elf_hwcap |= HWCAP_VFP;
 
vfp_arch =
(fpsid & VFPSID_SUBVERSION2_MASK) >> VFPSID_SUBVERSION_OFF;
@@ -122,9 +125,13 @@ vfp_init(void)
if (vfp_arch >= VFP_ARCH3) {
tmp = fmrx(mvfr0);
PCPU_SET(vfpmvfr0, tmp);
+   elf_hwcap |= HWCAP_VFPv3;
 
-   if ((tmp & VMVFR0_RB_MASK) == 2)
+   if ((tmp & VMVFR0_RB_MASK) == 2) {
+   elf_hwcap |= HWCAP_VFPD32;
is_d32 = 1;
+   } else
+   elf_hwcap |= HWCAP_VFPv3D16;
 
tmp = fmrx(mvfr1);
PCPU_SET(vfpmvfr1, tmp);

Modified: head/sys/arm/include/elf.h
==
--- head/sys/arm/include/elf.h  Thu Sep 14 14:26:55 2017(r323579)
+++ head/sys/arm/include/elf.h  Thu Sep 14 14:30:43 2017(r323580)
@@ -115,4 +115,10 @@ __ElfType(Auxinfo);
 
 #defineET_DYN_LOAD_ADDR0x12000
 
+/* Flags passed in AT_HWCAP. */
+#defineHWCAP_VFP   0x0040
+#defineHWCAP_VFPv3 0x0200
+#defineHWCAP_VFPv3D16  0x0400
+#defineHWCAP_VFPD320x0008
+
 #endif /* !_MACHINE_ELF_H_ */

Modified: head/sys/arm/include/md_var.h
==
--- head/sys/arm/include/md_var.h   Thu Sep 14 14:26:55 2017
(r323579)
+++ head/sys/arm/include/md_var.h   Thu Sep 14 14:30:43 2017
(r323580)
@@ -38,6 +38,7 @@ extern char sigcode[];
 extern int szsigcode;
 extern uint32_t *vm_page_dump;
 extern int vm_page_dump_size;
+extern u_long elf_hwcap;
 
 extern int (*_arm_memcpy)(void *, void *, int, int);
 extern int (*_arm_bzero)(void *, int, int);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323579 - in head/sys: arm/include arm64/include kern mips/include powerpc/include riscv/include sparc64/include sys x86/include

2017-09-14 Thread John Baldwin
Author: jhb
Date: Thu Sep 14 14:26:55 2017
New Revision: 323579
URL: https://svnweb.freebsd.org/changeset/base/323579

Log:
  Add AT_HWCAP and AT_EHDRFLAGS on all platforms.
  
  A new 'u_long *sv_hwcap' field is added to 'struct sysentvec'.  A
  process ABI can set this field to point to a value holding a mask of
  architecture-specific CPU feature flags.  If an ABI does not wish to
  supply AT_HWCAP to processes the field can be left as NULL.
  
  The support code for AT_EHDRFLAGS was already present on all systems,
  just the #define was not present.  This is a step towards unifying the
  AT_* constants across platforms.
  
  Reviewed by:  kib
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D12290

Modified:
  head/sys/arm/include/elf.h
  head/sys/arm64/include/elf.h
  head/sys/kern/imgact_elf.c
  head/sys/mips/include/elf.h
  head/sys/powerpc/include/elf.h
  head/sys/riscv/include/elf.h
  head/sys/sparc64/include/elf.h
  head/sys/sys/sysent.h
  head/sys/x86/include/elf.h

Modified: head/sys/arm/include/elf.h
==
--- head/sys/arm/include/elf.h  Thu Sep 14 08:47:06 2017(r323578)
+++ head/sys/arm/include/elf.h  Thu Sep 14 14:26:55 2017(r323579)
@@ -85,8 +85,9 @@ __ElfType(Auxinfo);
 #defineAT_TIMEKEEP 22  /* Pointer to timehands. */
 #defineAT_STACKPROT23  /* Initial stack protection. */
 #defineAT_EHDRFLAGS24  /* e_flags field from elf hdr */
+#defineAT_HWCAP25  /* CPU feature flags. */
 
-#defineAT_COUNT25  /* Count of defined aux entry types. */
+#defineAT_COUNT26  /* Count of defined aux entry types. */
 
 #defineR_ARM_COUNT 33  /* Count of defined relocation types. */
 

Modified: head/sys/arm64/include/elf.h
==
--- head/sys/arm64/include/elf.hThu Sep 14 08:47:06 2017
(r323578)
+++ head/sys/arm64/include/elf.hThu Sep 14 14:26:55 2017
(r323579)
@@ -90,8 +90,10 @@ __ElfType(Auxinfo);
 #defineAT_PAGESIZESLEN 21  /* Number of pagesizes. */
 #defineAT_TIMEKEEP 22  /* Pointer to timehands. */
 #defineAT_STACKPROT23  /* Initial stack protection. */
+#defineAT_EHDRFLAGS24  /* e_flags field from elf hdr */
+#defineAT_HWCAP25  /* CPU feature flags. */
 
-#defineAT_COUNT24  /* Count of defined aux entry types. */
+#defineAT_COUNT26  /* Count of defined aux entry types. */
 
 /* Define "machine" characteristics */
 #defineELF_TARG_CLASS  ELFCLASS64

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Thu Sep 14 08:47:06 2017(r323578)
+++ head/sys/kern/imgact_elf.c  Thu Sep 14 14:26:55 2017(r323579)
@@ -1110,9 +1110,7 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct 
AUXARGS_ENTRY(pos, AT_FLAGS, args->flags);
AUXARGS_ENTRY(pos, AT_ENTRY, args->entry);
AUXARGS_ENTRY(pos, AT_BASE, args->base);
-#ifdef AT_EHDRFLAGS
AUXARGS_ENTRY(pos, AT_EHDRFLAGS, args->hdr_eflags);
-#endif
if (imgp->execpathp != 0)
AUXARGS_ENTRY(pos, AT_EXECPATH, imgp->execpathp);
AUXARGS_ENTRY(pos, AT_OSRELDATE,
@@ -1133,6 +1131,8 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct 
AUXARGS_ENTRY(pos, AT_STACKPROT, imgp->sysent->sv_shared_page_obj
!= NULL && imgp->stack_prot != 0 ? imgp->stack_prot :
imgp->sysent->sv_stackprot);
+   if (imgp->sysent->sv_hwcap != NULL)
+   AUXARGS_ENTRY(pos, AT_HWCAP, *imgp->sysent->sv_hwcap);
AUXARGS_ENTRY(pos, AT_NULL, 0);
 
free(imgp->auxargs, M_TEMP);

Modified: head/sys/mips/include/elf.h
==
--- head/sys/mips/include/elf.h Thu Sep 14 08:47:06 2017(r323578)
+++ head/sys/mips/include/elf.h Thu Sep 14 14:26:55 2017(r323579)
@@ -144,8 +144,10 @@ __ElfType(Auxinfo);
 #defineAT_PAGESIZESLEN 21  /* Number of pagesizes. */
 #defineAT_TIMEKEEP 22  /* Pointer to timehands. */
 #defineAT_STACKPROT23  /* Initial stack protection. */
+#defineAT_EHDRFLAGS24  /* e_flags field from elf hdr */
+#defineAT_HWCAP25  /* CPU feature flags. */
 
-#defineAT_COUNT24  /* Count of defined aux entry types. */
+#defineAT_COUNT26  /* Count of defined aux entry types. */
 
 #defineET_DYN_LOAD_ADDR 0x012
 

Modified: head/sys/powerpc/include/elf.h
==
--- head/sys/powerpc/include/elf.h  Thu Sep 14 08:47:06 2017

svn commit: r323578 - in head/sys: cddl/compat/opensolaris/kern kern

2017-09-14 Thread Andriy Gapon
Author: avg
Date: Thu Sep 14 08:47:06 2017
New Revision: 323578
URL: https://svnweb.freebsd.org/changeset/base/323578

Log:
  dounmount: do not release the mount point's reference on the covered vnode
  
  As long as mnt_ref is not zero there can be a consumer that might try
  to access mnt_vnodecovered.  For this reason the covered vnode must not
  be freed until mnt_ref goes to zero.
  So, move the release of the covered vnode to vfs_mount_destroy.
  
  Reviewed by:  kib
  MFC after:3 weeks
  Differential Revision: https://reviews.freebsd.org/D12329

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
  head/sys/kern/vfs_mount.c

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Thu Sep 14 
05:48:23 2017(r323577)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Thu Sep 14 
08:47:06 2017(r323578)
@@ -209,6 +209,7 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const cha
vput(vp);
vfs_unbusy(mp);
vfs_freeopts(mp->mnt_optnew);
+   mp->mnt_vnodecovered = NULL;
vfs_mount_destroy(mp);
return (error);
}

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Thu Sep 14 05:48:23 2017(r323577)
+++ head/sys/kern/vfs_mount.c   Thu Sep 14 08:47:06 2017(r323578)
@@ -507,6 +507,8 @@ vfs_mount_destroy(struct mount *mp)
KASSERT(mp->mnt_ref == 0,
("%s: invalid refcount in the drain path @ %s:%d", __func__,
__FILE__, __LINE__));
+   if (mp->mnt_vnodecovered != NULL)
+   vrele(mp->mnt_vnodecovered);
if (mp->mnt_writeopcount != 0)
panic("vfs_mount_destroy: nonzero writeopcount");
if (mp->mnt_secondary_writes != 0)
@@ -819,6 +821,7 @@ vfs_domount_first(
error = VFS_MOUNT(mp);
if (error != 0) {
vfs_unbusy(mp);
+   mp->mnt_vnodecovered = NULL;
vfs_mount_destroy(mp);
VI_LOCK(vp);
vp->v_iflag &= ~VI_MOUNT;
@@ -1426,7 +1429,7 @@ dounmount(struct mount *mp, int flags, struct thread *
EVENTHANDLER_INVOKE(vfs_unmounted, mp, td);
if (coveredvp != NULL) {
coveredvp->v_mountedhere = NULL;
-   vput(coveredvp);
+   VOP_UNLOCK(coveredvp, 0);
}
vfs_event_signal(NULL, VQ_UNMOUNT, 0);
if (mp == rootdevmp)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-09-14 Thread Steven Hartland

Is this something that will be MFC'ed to 11 or is this 12 / CURRENT only?

On 13/09/2017 23:11, Gleb Smirnoff wrote:

Author: glebius
Date: Wed Sep 13 22:11:05 2017
New Revision: 323566
URL: https://svnweb.freebsd.org/changeset/base/323566

Log:
   Use soref() in sendfile(2) instead fhold() to reference a socket.
   
   The problem is that fdrop() requires syscall context, as it may

   enter sleep in some cases.  The reason to use it in the original
   non-blocking sendfile implementation, was to avoid use of global
   ACCEPT_LOCK() on every I/O completion. Now in head sorele() no
   longer requires this lock.

Modified:
   head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Wed Sep 13 21:56:49 2017
(r323565)
+++ head/sys/kern/kern_sendfile.c   Wed Sep 13 22:11:05 2017
(r323566)
@@ -80,7 +80,7 @@ struct sf_io {
volatile u_int  nios;
u_int   error;
int npages;
-   struct file *sock_fp;
+   struct socket   *so;
struct mbuf *m;
vm_page_t   pa[];
  };
@@ -255,7 +255,7 @@ static void
  sendfile_iodone(void *arg, vm_page_t *pg, int count, int error)
  {
struct sf_io *sfio = arg;
-   struct socket *so;
+   struct socket *so = sfio->so;
  
  	for (int i = 0; i < count; i++)

if (pg[i] != bogus_page)
@@ -267,8 +267,6 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i
if (!refcount_release(>nios))
return;
  
-	so = sfio->sock_fp->f_data;

-
if (sfio->error) {
struct mbuf *m;
  
@@ -296,8 +294,8 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i

CURVNET_RESTORE();
}
  
-	/* XXXGL: curthread */

-   fdrop(sfio->sock_fp, curthread);
+   SOCK_LOCK(so);
+   sorele(so);
free(sfio, M_TEMP);
  }
  
@@ -724,6 +722,7 @@ retry_space:

sfio = malloc(sizeof(struct sf_io) +
npages * sizeof(vm_page_t), M_TEMP, M_WAITOK);
refcount_init(>nios, 1);
+   sfio->so = so;
sfio->error = 0;
  
  		nios = sendfile_swapin(obj, sfio, off, space, npages, rhpages,

@@ -858,9 +857,8 @@ prepend_header:
error = (*so->so_proto->pr_usrreqs->pru_send)
(so, 0, m, NULL, NULL, td);
} else {
-   sfio->sock_fp = sock_fp;
sfio->npages = npages;
-   fhold(sock_fp);
+   soref(so);
error = (*so->so_proto->pr_usrreqs->pru_send)
(so, PRUS_NOTREADY, m, NULL, NULL, td);
sendfile_iodone(sfio, NULL, 0, 0);



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