svn commit: r334074 - head/sys/sys
Author: mmacy Date: Wed May 23 06:15:55 2018 New Revision: 334074 URL: https://svnweb.freebsd.org/changeset/base/334074 Log: Bump FreeBSD_version after r333813 Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hWed May 23 04:09:01 2018(r334073) +++ head/sys/sys/param.hWed May 23 06:15:55 2018(r334074) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200063 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200064 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ 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: r334073 - head
Author: eadler Date: Wed May 23 04:09:01 2018 New Revision: 334073 URL: https://svnweb.freebsd.org/changeset/base/334073 Log: README: Reduce the textdump; describe the project Rework the README to make it a little easier for new users. This is the first file many will see when persuing the FreeBSD source code so - remove some of the text describes how to build. This is better covered in the linked documentation. - add a small blurb for what FreeBSD is. Some users might find this document through features such as github search so they may not even know what the project is generally, gear this file for the new, accidental, or casual user rather than towards someone seeking fuller documentation. Modified: head/README head/README.md Modified: head/README == --- head/README Wed May 23 03:41:22 2018(r334072) +++ head/README Wed May 23 04:09:01 2018(r334073) @@ -2,35 +2,25 @@ This is the top level of the FreeBSD source directory. was last revised on: $FreeBSD$ +FreeBSD is an operating system used to power modern servers, +desktops, and embedded platforms. A large community has +continually developed it for more than thirty years. Its +advanced networking, security, and storage features have +made FreeBSD the platform of choice for many of the +busiest web sites and most pervasive embedded networking +and storage devices. + For copyright information, please see the file COPYRIGHT in this -directory (additional copyright information also exists for some +directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for -more information). +more information. The Makefile in this directory supports a number of targets for -building components (or all) of the FreeBSD source tree. See build(7) -and https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html +building components (or all) of the FreeBSD source tree. See build(7), config(8), +https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html, and +https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html for more information, including setting make(1) variables. -The `buildkernel` and `installkernel` targets build and install -the kernel and the modules (see below). Please see the top of -the Makefile in this directory for more information on the -standard build targets and compile-time flags. - -Building a kernel is a somewhat more involved process. See build(7), config(8), -and https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html -for more information. - -Note: If you want to build and install the kernel with the -`buildkernel` and `installkernel` targets, you might need to build -world before. More information is available in the handbook. - -The kernel configuration files reside in the sys//conf -sub-directory. GENERIC is the default configuration used in release builds. -NOTES contains entries and documentation for all possible -devices, not just those commonly used. - - Source Roadmap: --- @@ -69,6 +59,8 @@ share Shared resources. stand Boot loader sources. sysKernel sources. + +sys//conf Kernel configuration file tests Regression tests which can be run by Kyua. See tests/README for additional information. Modified: head/README.md == --- head/README.md Wed May 23 03:41:22 2018(r334072) +++ head/README.md Wed May 23 04:09:01 2018(r334073) @@ -4,35 +4,25 @@ This is the top level of the FreeBSD source directory. was last revised on: $FreeBSD$ +FreeBSD is an operating system used to power modern servers, +desktops, and embedded platforms. A large community has +continually developed it for more than thirty years. Its +advanced networking, security, and storage features have +made FreeBSD the platform of choice for many of the +busiest web sites and most pervasive embedded networking +and storage devices. + For copyright information, please see the file COPYRIGHT in this -directory (additional copyright information also exists for some +directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for -more information). +more information. The Makefile in this directory supports a number of targets for -building components (or all) of the FreeBSD source tree. See build(7) -and https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html +building components (or all) of the FreeBSD source tree. See build(7), config(8), +https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html, and +https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html for more information, including se
svn commit: r334072 - in head: share/man/man5 tools/build/options
Author: eadler Date: Wed May 23 03:41:22 2018 New Revision: 334072 URL: https://svnweb.freebsd.org/changeset/base/334072 Log: Add the text '@generated' to src.conf.5 This is a cross-tool approach to identifying generated code. Some tools, notably phabricator, handle this marker specially. See https://reviews.freebsd.org/differential/diff/42870/ for such an example. Modified: head/share/man/man5/src.conf.5 head/tools/build/options/makeman Modified: head/share/man/man5/src.conf.5 == --- head/share/man/man5/src.conf.5 Wed May 23 02:54:28 2018 (r334071) +++ head/share/man/man5/src.conf.5 Wed May 23 03:41:22 2018 (r334072) @@ -1,6 +1,7 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd May 15, 2018 +.\" @generated +.Dd May 23, 2018 .Dt SRC.CONF 5 .Os .Sh NAME Modified: head/tools/build/options/makeman == --- head/tools/build/options/makemanWed May 23 02:54:28 2018 (r334071) +++ head/tools/build/options/makemanWed May 23 03:41:22 2018 (r334072) @@ -141,9 +141,11 @@ main() echo "building src.conf.5 man page from files in ${PWD}" >&2 fbsdid='$'FreeBSD'$' + generated='@'generated cat
svn commit: r334071 - head/usr.bin/getconf
Author: wollman Date: Wed May 23 02:54:28 2018 New Revision: 334071 URL: https://svnweb.freebsd.org/changeset/base/334071 Log: Whoops, forgot to add this file in r334070. PR: 164049 Added: head/usr.bin/getconf/unsigned_limits.gperf (contents, props changed) Added: head/usr.bin/getconf/unsigned_limits.gperf == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/getconf/unsigned_limits.gperf Wed May 23 02:54:28 2018 (r334071) @@ -0,0 +1,43 @@ +%{ +/* + * Copyright is disclaimed as to the contents of this file. + * + * $FreeBSD$ + */ + +#include + +#include +#include + +#include "getconf.h" + +/* + * Override gperf's built-in external scope. + */ +static const struct map *in_word_set(const char *str); + +%} +struct map { const char *name; uintmax_t value; int valid; }; +%% +UCHAR_MAX, UCHAR_MAX +UINT_MAX, UINT_MAX +ULLONG_MAX, ULLONG_MAX +ULONG_MAX, ULONG_MAX +USHRT_MAX, USHRT_MAX +%% +int +find_unsigned_limit(const char *name, uintmax_t *value) +{ + const struct map *rv; + + rv = in_word_set(name); + if (rv != NULL) { + if (rv->valid) { + *value = rv->value; + return 1; + } + return -1; + } + 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: r334070 - head/usr.bin/getconf
Author: wollman Date: Wed May 23 02:51:56 2018 New Revision: 334070 URL: https://svnweb.freebsd.org/changeset/base/334070 Log: Move unsigned limits to a separate table/recognizer and display them using the appropriate (unsigned) format specification. This prevents integer overflow when ULLONG_MAX and (on some architectures) ULONG_MAX are used to initialize an intmax_t and then displayed as the signed value -1. (A different approach was suggested in the bug report, which I did not use.) If other limits are defined to be unsigned, they could be moved here. PR: 164049 Reported by: Marcus Reid Modified: head/usr.bin/getconf/Makefile head/usr.bin/getconf/getconf.c head/usr.bin/getconf/getconf.h head/usr.bin/getconf/limits.gperf Modified: head/usr.bin/getconf/Makefile == --- head/usr.bin/getconf/Makefile Wed May 23 01:48:09 2018 (r334069) +++ head/usr.bin/getconf/Makefile Wed May 23 02:51:56 2018 (r334070) @@ -4,11 +4,12 @@ PROG= getconf -SRCS= confstr.c getconf.c limits.c pathconf.c progenv.c sysconf.c +SRCS= confstr.c getconf.c limits.c pathconf.c progenv.c sysconf.c \ + unsigned_limits.c CFLAGS+= -I${.CURDIR} CLEANFILES+= confstr.c limits.c pathconf.c progenv.c sysconf.c \ confstr.names limits.names pathconf.names sysconf.names \ - conflicting.names unique.names + conflicting.names unique.names unsigned_limits.names .SUFFIXES: .gperf .names .PHONY: conflicts Modified: head/usr.bin/getconf/getconf.c == --- head/usr.bin/getconf/getconf.c Wed May 23 01:48:09 2018 (r334069) +++ head/usr.bin/getconf/getconf.c Wed May 23 02:51:56 2018 (r334070) @@ -65,6 +65,7 @@ main(int argc, char **argv) int c, key, valid; const char *name, *vflag, *alt_path; intmax_t limitval; + uintmax_t ulimitval; aflag = false; vflag = NULL; @@ -115,6 +116,13 @@ main(int argc, char **argv) } if (argv[optind + 1] == NULL) { /* confstr or sysconf */ + if ((valid = find_unsigned_limit(name, &ulimitval)) != 0) { + if (valid > 0) + printf("%" PRIuMAX "\n", ulimitval); + else + printf("undefined\n"); + return 0; + } if ((valid = find_limit(name, &limitval)) != 0) { if (valid > 0) printf("%" PRIdMAX "\n", limitval); Modified: head/usr.bin/getconf/getconf.h == --- head/usr.bin/getconf/getconf.h Wed May 23 01:48:09 2018 (r334069) +++ head/usr.bin/getconf/getconf.h Wed May 23 02:51:56 2018 (r334070) @@ -37,6 +37,7 @@ typedef long long intmax_t; #endif intfind_confstr(const char *name, int *key); +intfind_unsigned_limit(const char *name, uintmax_t *value); intfind_limit(const char *name, intmax_t *value); intfind_pathconf(const char *name, int *key); intfind_progenv(const char *name, const char **alt_path); Modified: head/usr.bin/getconf/limits.gperf == --- head/usr.bin/getconf/limits.gperf Wed May 23 01:48:09 2018 (r334069) +++ head/usr.bin/getconf/limits.gperf Wed May 23 02:51:56 2018 (r334070) @@ -86,11 +86,6 @@ SCHAR_MIN, SCHAR_MIN SHRT_MAX, SHRT_MAX SHRT_MIN, SHRT_MIN SSIZE_MAX, SSIZE_MAX -UCHAR_MAX, UCHAR_MAX -UINT_MAX, UINT_MAX -ULLONG_MAX, ULLONG_MAX -ULONG_MAX, ULONG_MAX -USHRT_MAX, USHRT_MAX WORD_BIT, WORD_BIT CHARCLASS_NAME_MAX, CHARCLASS_NAME_MAX NL_ARGMAX, NL_ARGMAX ___ 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: r334069 - in head/sys: kern sys
Author: mmacy Date: Wed May 23 01:48:09 2018 New Revision: 334069 URL: https://svnweb.freebsd.org/changeset/base/334069 Log: kern_sendit: use pre-initialized rights Modified: head/sys/kern/subr_capability.c head/sys/kern/uipc_syscalls.c head/sys/sys/capsicum.h Modified: head/sys/kern/subr_capability.c == --- head/sys/kern/subr_capability.c Wed May 23 01:20:31 2018 (r334068) +++ head/sys/kern/subr_capability.c Wed May 23 01:48:09 2018 (r334069) @@ -92,6 +92,7 @@ __read_mostly cap_rights_t cap_renameat_source_rights; __read_mostly cap_rights_t cap_renameat_target_rights; __read_mostly cap_rights_t cap_seek_rights; __read_mostly cap_rights_t cap_send_rights; +__read_mostly cap_rights_t cap_send_connect_rights; __read_mostly cap_rights_t cap_setsockopt_rights; __read_mostly cap_rights_t cap_shutdown_rights; __read_mostly cap_rights_t cap_symlinkat_rights; @@ -140,6 +141,7 @@ __cap_rights_sysinit1(void *arg) cap_rights_init(&cap_renameat_target_rights, CAP_RENAMEAT_TARGET); cap_rights_init(&cap_seek_rights, CAP_SEEK); cap_rights_init(&cap_send_rights, CAP_SEND); + cap_rights_init(&cap_send_connect_rights, CAP_SEND, CAP_CONNECT); cap_rights_init(&cap_setsockopt_rights, CAP_SETSOCKOPT); cap_rights_init(&cap_shutdown_rights, CAP_SHUTDOWN); cap_rights_init(&cap_symlinkat_rights, CAP_SYMLINKAT); Modified: head/sys/kern/uipc_syscalls.c == --- head/sys/kern/uipc_syscalls.c Wed May 23 01:20:31 2018 (r334068) +++ head/sys/kern/uipc_syscalls.c Wed May 23 01:48:09 2018 (r334069) @@ -722,7 +722,7 @@ kern_sendit(struct thread *td, int s, struct msghdr *m struct uio auio; struct iovec *iov; struct socket *so; - cap_rights_t rights; + cap_rights_t *rights; #ifdef KTRACE struct uio *ktruio = NULL; #endif @@ -730,12 +730,12 @@ kern_sendit(struct thread *td, int s, struct msghdr *m int i, error; AUDIT_ARG_FD(s); - cap_rights_init(&rights, CAP_SEND); + rights = &cap_send_rights; if (mp->msg_name != NULL) { AUDIT_ARG_SOCKADDR(td, AT_FDCWD, mp->msg_name); - cap_rights_set(&rights, CAP_CONNECT); + rights = &cap_send_connect_rights; } - error = getsock_cap(td, s, &rights, &fp, NULL, NULL); + error = getsock_cap(td, s, rights, &fp, NULL, NULL); if (error != 0) { m_freem(control); return (error); Modified: head/sys/sys/capsicum.h == --- head/sys/sys/capsicum.h Wed May 23 01:20:31 2018(r334068) +++ head/sys/sys/capsicum.h Wed May 23 01:48:09 2018(r334069) @@ -441,6 +441,7 @@ extern cap_rights_t cap_renameat_source_rights; extern cap_rights_t cap_renameat_target_rights; extern cap_rights_t cap_seek_rights; extern cap_rights_t cap_send_rights; +extern cap_rights_t cap_send_connect_rights; extern cap_rights_t cap_setsockopt_rights; extern cap_rights_t cap_shutdown_rights; extern cap_rights_t cap_symlinkat_rights; ___ 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: r334068 - in head: contrib/libxo contrib/libxo/doc contrib/libxo/doc/_static contrib/libxo/doc/_templates contrib/libxo/libxo contrib/libxo/tests/core contrib/libxo/tests/core/saved con...
Author: phil Date: Wed May 23 01:20:31 2018 New Revision: 334068 URL: https://svnweb.freebsd.org/changeset/base/334068 Log: Import libxo-0.9.0: - Add xo_format_is_numeric() with improved logic to decide if format strings are numeric, so json output quotes them - Convert docs to sphinx/rst - update tests Includes fix for PR 221676: https://github.com/Juniper/libxo/commit/27d3021cc3cc8cfbe9ddee5930cd7a9afea8f68f#diff-5a0d468963477f7daedb8308c219dd80 PR:221676 MFC after:5 days Added: head/contrib/libxo/doc/_static/ - copied from r334067, vendor/Juniper/libxo/dist/doc/_static/ head/contrib/libxo/doc/_templates/ - copied from r334067, vendor/Juniper/libxo/dist/doc/_templates/ head/contrib/libxo/doc/api.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/api.rst head/contrib/libxo/doc/conf.py - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/conf.py head/contrib/libxo/doc/example.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/example.rst head/contrib/libxo/doc/faq.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/faq.rst head/contrib/libxo/doc/field-formatting.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/field-formatting.rst head/contrib/libxo/doc/field-modifiers.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/field-modifiers.rst head/contrib/libxo/doc/field-roles.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/field-roles.rst head/contrib/libxo/doc/format-strings.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/format-strings.rst head/contrib/libxo/doc/formatting.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/formatting.rst head/contrib/libxo/doc/getting.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/getting.rst head/contrib/libxo/doc/howto.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/howto.rst head/contrib/libxo/doc/index.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/index.rst head/contrib/libxo/doc/intro.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/intro.rst head/contrib/libxo/doc/options.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/options.rst head/contrib/libxo/doc/xo.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/xo.rst head/contrib/libxo/doc/xohtml.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/xohtml.rst head/contrib/libxo/doc/xolint.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/xolint.rst head/contrib/libxo/doc/xopo.rst - copied unchanged from r334067, vendor/Juniper/libxo/dist/doc/xopo.rst Modified: head/contrib/libxo/configure.ac head/contrib/libxo/doc/Makefile.am head/contrib/libxo/doc/libxo-manual.html head/contrib/libxo/libxo/libxo.c head/contrib/libxo/tests/core/saved/test_01.E.out head/contrib/libxo/tests/core/saved/test_01.H.out head/contrib/libxo/tests/core/saved/test_01.HIPx.out head/contrib/libxo/tests/core/saved/test_01.HP.out head/contrib/libxo/tests/core/saved/test_01.J.out head/contrib/libxo/tests/core/saved/test_01.JP.out head/contrib/libxo/tests/core/saved/test_01.T.out head/contrib/libxo/tests/core/saved/test_01.X.out head/contrib/libxo/tests/core/saved/test_01.XP.out head/contrib/libxo/tests/core/saved/test_12.J.out head/contrib/libxo/tests/core/saved/test_12.JP.out head/contrib/libxo/tests/core/test_01.c head/contrib/libxo/tests/gettext/saved/gt_01.J.out head/contrib/libxo/tests/gettext/saved/gt_01.JP.out head/lib/libxo/add.man head/lib/libxo/xo_config.h head/usr.bin/xohtml/xohtml.sh Directory Properties: head/contrib/libxo/ (props changed) Modified: head/contrib/libxo/configure.ac == --- head/contrib/libxo/configure.ac Wed May 23 01:12:39 2018 (r334067) +++ head/contrib/libxo/configure.ac Wed May 23 01:20:31 2018 (r334068) @@ -12,7 +12,7 @@ # AC_PREREQ(2.2) -AC_INIT([libxo], [0.8.4], [p...@juniper.net]) +AC_INIT([libxo], [0.9.0], [p...@juniper.net]) AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) # Support silent build rules. Requires at least automake-1.11. Modified: head/contrib/libxo/doc/Makefile.am == --- head/contrib/libxo/doc/Makefile.am Wed May 23 01:12:39 2018 (r334067) +++ head/contrib/libxo/doc/Makefile.am Wed May 23 01:20:31 2018 (r334068) @@ -68,3 +68,8 @@ else doc docs: @${ECHO} "The 'oxtradoc' tool is not installed; see libslax.org" endif + +SPHINX = python3.4 -msphinx + +html sphinx sphinx-html: + ${SPHINX} -M html ${srcdir} . Copied: head/contrib/libxo/doc/api.rst (from r334067, ve
Re: svn commit: r334008 - head/bin/sh
On 5/22/2018 1:22 PM, Jilles Tjoelker wrote: > On Tue, May 22, 2018 at 10:17:41AM +0200, O. Hartmann wrote: >> On Mon, 21 May 2018 21:45:53 -0700 >> Cy Schubert wrote: >>> In message <20180522061339.21497...@freyja.zeit4.iv.bundesimmobilien.de> >>> , "O. H >>> artmann" writes: On Mon, 21 May 2018 21:52:48 + (UTC) Jilles Tjoelker wrote: > > Author: jilles > Date: Mon May 21 21:52:48 2018 > New Revision: 334008 > URL: https://svnweb.freebsd.org/changeset/base/334008 > > Log: > sh: Split CNL syntax category to avoid a check on state[level].syntax > > No functional change is intended. > > Modified: > head/bin/sh/mksyntax.c > head/bin/sh/parser.c >> [snip] > Have this been tested? Doesn't compile for me: > [...] Building /usr/obj/usr/src/amd64.amd64/kerberos5/libexec/hprop/hprop --- all_subdir_rescue --- --- parser.o --- /usr/src/bin/sh/parser.c:1440:9: error: use of undeclared identifier 'CQNL' case CQNL: ^ --- all_subdir_gnu --- Building /usr/obj/usr/src/amd64.amd64/gnu/usr.bin/gdb/libgdb/amd64bsd-nat.o --- all_subdir_rescue --- 1 error generated. *** [parser.o] Error code 1 > make[6]: stopped in /usr/src/bin/sh > >>> CQNL is defined in /usr/obj/opt/src/svn-current/amd64.amd64/bin/sh/synta >>> x.h, generated by mksyntax. > >>> slippy$ ag -s CQNL /export/obj/opt/src/svn-current/amd64.amd64/bin/sh/*. >>> h >>> /export/obj/opt/src/svn-current/amd64.amd64/bin/sh/syntax.h >>> 11:#define CQNL 2 /* newline character in quotes */ >>> slippy$ > >>> Remove the file if it's not defined in your syntax.h. > >>> Just out of interest, do you use meta mode? > >> I think such a question is of common interest if errors/bugs like that occur: >> Yes, I use/compile world/kernel with META mode. > > The change itself is fine. It built for me and for Jenkins > (ci.freebsd.org). What is not fine is an incremental build with meta > mode. Apparently, the syntax.h: .NOMETA rule added in r301285 causes > bmake to build some files against the old syntax.h, even though syntax.c > and syntax.h will be rebuilt. > > To fix this, it may be possible to generate a meta file for syntax.h > based on the one for syntax.c. The same would be done for builtins.[ch] > and nodes.[ch]. > > Conceptually simpler is accepting what make would like: one command > generates one file only. This is not really new with meta mode since a Yeah bmake (both with and without meta mode) is lacking in properly handling 1 target generating multiple files. It's a big frustration of mine as every pattern I've seen does not do the right thing. I'll look into this case more. For now just remove the syntax.h file from the objdir or remove the bin/sh dir. > somewhat ugly .ORDER declaration had been necessary before. The .c > content can go inside a #ifdef in the .h file so the .c file need not be > autogenerated, or the tools can be run twice, once to generate the .c > file and once to generate the .h file. In both cases, the tools will be > somewhat uglier in order to simplify the build system. > -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
svn commit: r334065 - head/sys/cam/mmc
Author: kibab Date: Tue May 22 22:16:49 2018 New Revision: 334065 URL: https://svnweb.freebsd.org/changeset/base/334065 Log: Implement initial MMC partitions support for MMCCAM. For MMC cards, add partitions found on the card as separate disk(9) devices. Don't do anything with RPMB partition for now. Lots of code is copied almost 1:1 from the mmcsd.c in the old stack, credits Marius Strobl (mar...@freebsd.org) Reviewed by: marius Approved by: imp (mentor) Differential Revision:https://reviews.freebsd.org/D12762 Modified: head/sys/cam/mmc/mmc_da.c Modified: head/sys/cam/mmc/mmc_da.c == --- head/sys/cam/mmc/mmc_da.c Tue May 22 20:50:19 2018(r334064) +++ head/sys/cam/mmc/mmc_da.c Tue May 22 22:16:49 2018(r334065) @@ -88,35 +88,66 @@ typedef enum { } sdda_flags; typedef enum { -SDDA_STATE_INIT, -SDDA_STATE_INVALID, -SDDA_STATE_NORMAL + SDDA_STATE_INIT, + SDDA_STATE_INVALID, + SDDA_STATE_NORMAL, + SDDA_STATE_PART_SWITCH, } sdda_state; +#defineSDDA_FMT_BOOT "sdda%dboot" +#defineSDDA_FMT_GP "sdda%dgp" +#defineSDDA_FMT_RPMB "sdda%drpmb" +#defineSDDA_LABEL_ENH "enh" + +#defineSDDA_PART_NAMELEN (16 + 1) + +struct sdda_softc; + +struct sdda_part { + struct disk *disk; + struct bio_queue_head bio_queue; + sdda_flags flags; + struct sdda_softc *sc; + u_int cnt; + u_int type; + bool ro; + char name[SDDA_PART_NAMELEN]; +}; + struct sdda_softc { - struct bio_queue_head bio_queue; int outstanding_cmds; /* Number of active commands */ int refcount; /* Active xpt_action() calls */ sdda_state state; - sdda_flags flags; struct mmc_data *mmcdata; + struct cam_periph *periph; // sdda_quirks quirks; struct task start_init_task; - struct disk *disk; -uint32_t raw_csd[4]; + uint32_t raw_csd[4]; uint8_t raw_ext_csd[512]; /* MMC only? */ -struct mmc_csd csd; -struct mmc_cid cid; + struct mmc_csd csd; + struct mmc_cid cid; struct mmc_scr scr; -/* Calculated from CSD */ -uint64_t sector_count; -uint64_t mediasize; + /* Calculated from CSD */ + uint64_t sector_count; + uint64_t mediasize; -/* Calculated from CID */ + /* Calculated from CID */ char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */ char card_sn_string[16];/* Formatted serial # for disk->d_ident */ /* Determined from CSD + is highspeed card*/ uint32_t card_f_max; + + /* Generic switch timeout */ + uint32_t cmd6_time; + /* MMC partitions support */ + struct sdda_part *part[MMC_PART_MAX]; + uint8_t part_curr; /* Partition currently switched to */ + uint8_t part_requested; /* What partition we're currently switching to */ + uint32_t part_time; /* Partition switch timeout [us] */ + off_t enh_base; /* Enhanced user data area slice base ... */ + off_t enh_size; /* ... and size [bytes] */ + int log_count; + struct timeval log_time; }; #define ccb_bp ppriv_ptr1 @@ -135,10 +166,27 @@ static int sddaerror(union ccb *ccb, u_int32_t cam_f u_int32_t sense_flags); static uint16_t get_rca(struct cam_periph *periph); -static cam_status sdda_hook_into_geom(struct cam_periph *periph); static void sdda_start_init(void *context, union ccb *start_ccb); static void sdda_start_init_task(void *context, int pending); +static void sdda_process_mmc_partitions(struct cam_periph *periph, union ccb *start_ccb); +static uint32_t sdda_get_host_caps(struct cam_periph *periph, union ccb *ccb); +static void sdda_init_switch_part(struct cam_periph *periph, union ccb *start_ccb, u_int part); +static inline uint32_t mmc_get_sector_size(struct cam_periph *periph) {return MMC_SECTOR_SIZE;} + +/* TODO: actually issue GET_TRAN_SETTINGS to get R/O status */ +static inline bool sdda_get_read_only(struct cam_periph *periph, union ccb *start_ccb) +{ + + return (false); +} + +static uint32_t mmc_get_spec_vers(struct cam_periph *periph); +static uint64_t mmc_get_media_size(struct cam_periph *periph); +static uint32_t mmc_get_cmd6_timeout(struct cam_periph *periph); +static void sdda_add_part(struct cam_periph *periph, u_int type, +const char *name, u_int cnt, off_t media_size, bool ro); + static struct periph_driver sddadriver = { sddainit, "sdda", @@ -364,11 +412,14 @@ mmc_format_card_id_string(struct sdda_softc *sc, struc static int sddaopen(struct disk *dp) { + struct sdda_part *part; struct cam_periph *periph; struct sdda_softc *softc;
svn commit: r334064 - head/sys/x86/x86
Author: kib Date: Tue May 22 20:50:19 2018 New Revision: 334064 URL: https://svnweb.freebsd.org/changeset/base/334064 Log: Fix UP build. Reported by: jhb 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 May 22 20:00:56 2018 (r334063) +++ head/sys/x86/x86/cpu_machdep.c Tue May 22 20:50:19 2018 (r334064) @@ -69,9 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef SMP #include -#endif #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"
Re: svn commit: r334008 - head/bin/sh
On Tue, May 22, 2018 at 10:17:41AM +0200, O. Hartmann wrote: > On Mon, 21 May 2018 21:45:53 -0700 > Cy Schubert wrote: > > In message <20180522061339.21497...@freyja.zeit4.iv.bundesimmobilien.de> > > , "O. H > > artmann" writes: > > > On Mon, 21 May 2018 21:52:48 + (UTC) > > > Jilles Tjoelker wrote: > > > > Author: jilles > > > > Date: Mon May 21 21:52:48 2018 > > > > New Revision: 334008 > > > > URL: https://svnweb.freebsd.org/changeset/base/334008 > > > > Log: > > > > sh: Split CNL syntax category to avoid a check on state[level].syntax > > > > No functional change is intended. > > > > Modified: > > > > head/bin/sh/mksyntax.c > > > > head/bin/sh/parser.c > [snip] > > > Have this been tested? Doesn't compile for me: > > > [...] > > > Building /usr/obj/usr/src/amd64.amd64/kerberos5/libexec/hprop/hprop > > > --- all_subdir_rescue --- > > > --- parser.o --- > > > /usr/src/bin/sh/parser.c:1440:9: error: use of undeclared identifier > > > 'CQNL' > > > case CQNL: > > > ^ > > > --- all_subdir_gnu --- > > > Building > > > /usr/obj/usr/src/amd64.amd64/gnu/usr.bin/gdb/libgdb/amd64bsd-nat.o > > > --- all_subdir_rescue --- > > > 1 error generated. > > > *** [parser.o] Error code 1 > > > make[6]: stopped in /usr/src/bin/sh > > CQNL is defined in /usr/obj/opt/src/svn-current/amd64.amd64/bin/sh/synta > > x.h, generated by mksyntax. > > slippy$ ag -s CQNL /export/obj/opt/src/svn-current/amd64.amd64/bin/sh/*. > > h > > /export/obj/opt/src/svn-current/amd64.amd64/bin/sh/syntax.h > > 11:#define CQNL 2 /* newline character in quotes */ > > slippy$ > > Remove the file if it's not defined in your syntax.h. > > Just out of interest, do you use meta mode? > I think such a question is of common interest if errors/bugs like that occur: > Yes, I use/compile world/kernel with META mode. The change itself is fine. It built for me and for Jenkins (ci.freebsd.org). What is not fine is an incremental build with meta mode. Apparently, the syntax.h: .NOMETA rule added in r301285 causes bmake to build some files against the old syntax.h, even though syntax.c and syntax.h will be rebuilt. To fix this, it may be possible to generate a meta file for syntax.h based on the one for syntax.c. The same would be done for builtins.[ch] and nodes.[ch]. Conceptually simpler is accepting what make would like: one command generates one file only. This is not really new with meta mode since a somewhat ugly .ORDER declaration had been necessary before. The .c content can go inside a #ifdef in the .h file so the .c file need not be autogenerated, or the tools can be run twice, once to generate the .c file and once to generate the .h file. In both cases, the tools will be somewhat uglier in order to simplify the build system. -- Jilles Tjoelker ___ 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: r334063 - in head/sys/dev/usb: . net
Author: emaste Date: Tue May 22 20:00:56 2018 New Revision: 334063 URL: https://svnweb.freebsd.org/changeset/base/334063 Log: if_muge: only attach to LAN7800 Chip ID This driver was developed for the LAN7800 and the register-compatible LAN7515 (found on Raspberry Pi 3B+) and has only been tested on those devices. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/usb/net/if_muge.c head/sys/dev/usb/net/if_mugereg.h head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/net/if_muge.c == --- head/sys/dev/usb/net/if_muge.c Tue May 22 19:24:57 2018 (r334062) +++ head/sys/dev/usb/net/if_muge.c Tue May 22 20:00:56 2018 (r334063) @@ -168,7 +168,8 @@ struct muge_softc { /* Settings for the mac control (MAC_CSR) register. */ uint32_tsc_rfe_ctl; uint32_tsc_mdix_ctl; - uint32_tsc_rev_id; + uint16_tchipid; + uint16_tchiprev; uint32_tsc_mchash_table[ETH_DP_SEL_VHF_HASH_LEN]; uint32_tsc_pfilter_table[MUGE_NUM_PFILTER_ADDRS_][2]; @@ -974,15 +975,20 @@ lan78xx_chip_init(struct muge_softc *sc) } /* Read and display the revision register. */ - if ((err = lan78xx_read_reg(sc, ETH_ID_REV, &sc->sc_rev_id)) < 0) { + if ((err = lan78xx_read_reg(sc, ETH_ID_REV, &buf)) < 0) { muge_warn_printf(sc, "failed to read ETH_ID_REV (err = %d)\n", err); goto init_failed; } - - device_printf(sc->sc_ue.ue_dev, "chip 0x%04lx, rev. %04lx\n", - (sc->sc_rev_id & ETH_ID_REV_CHIP_ID_MASK_) >> 16, - (sc->sc_rev_id & ETH_ID_REV_CHIP_REV_MASK_)); + sc->chipid = (buf & ETH_ID_REV_CHIP_ID_MASK_) >> 16; + sc->chiprev = buf & ETH_ID_REV_CHIP_REV_MASK_; + if (sc->chipid != ETH_ID_REV_CHIP_ID_7800_) { + muge_warn_printf(sc, "Chip ID 0x%04x not yet supported\n", + sc->chipid); + goto init_failed; + } + device_printf(sc->sc_ue.ue_dev, "Chip ID 0x%04x rev %04x\n", sc->chipid, + sc->chiprev); /* Respond to BULK-IN tokens with a NAK when RX FIFO is empty. */ if ((err = lan78xx_read_reg(sc, ETH_USB_CFG0, &buf)) != 0) { Modified: head/sys/dev/usb/net/if_mugereg.h == --- head/sys/dev/usb/net/if_mugereg.h Tue May 22 19:24:57 2018 (r334062) +++ head/sys/dev/usb/net/if_mugereg.h Tue May 22 20:00:56 2018 (r334063) @@ -47,6 +47,9 @@ #define ETH_ID_REV 0x000 #define ETH_ID_REV_CHIP_ID_MASK_ 0xUL #define ETH_ID_REV_CHIP_REV_MASK_ 0xUL +#define ETH_ID_REV_CHIP_ID_7800_ 0x7800 +#define ETH_ID_REV_CHIP_ID_7801_ 0x7801 +#define ETH_ID_REV_CHIP_ID_7850_ 0x7850 /* Device interrupt status register. */ #define ETH_INT_STS0x00C Modified: head/sys/dev/usb/usbdevs == --- head/sys/dev/usb/usbdevsTue May 22 19:24:57 2018(r334062) +++ head/sys/dev/usb/usbdevsTue May 22 20:00:56 2018(r334063) @@ -4322,6 +4322,7 @@ product SMC2 2514HUB 0x2514 USB Hub product SMC3 2662WUSB 0xa002 2662W-AR Wireless product SMC2 LAN7800_ETH 0x7800 USB/Ethernet product SMC2 LAN7801_ETH 0x7801 USB/Ethernet +product SMC2 LAN7850_ETH 0x7850 USB/Ethernet product SMC2 LAN9500_ETH 0x9500 USB/Ethernet product SMC2 LAN9505_ETH 0x9505 USB/Ethernet product SMC2 LAN9530_ETH 0x9530 USB/Ethernet ___ 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: r334062 - head/sys/kern
Author: mjg Date: Tue May 22 19:24:57 2018 New Revision: 334062 URL: https://svnweb.freebsd.org/changeset/base/334062 Log: Move preemption handling out of critical_exit. In preperataion for making the enter/exit pair inline. Reviewed by: kib Modified: head/sys/kern/kern_switch.c Modified: head/sys/kern/kern_switch.c == --- head/sys/kern/kern_switch.c Tue May 22 19:11:06 2018(r334061) +++ head/sys/kern/kern_switch.c Tue May 22 19:24:57 2018(r334062) @@ -209,48 +209,49 @@ critical_enter(void) (long)td->td_proc->p_pid, td->td_name, td->td_critnest); } -void -critical_exit(void) +static void __noinline +critical_exit_preempt(void) { struct thread *td; int flags; td = curthread; - KASSERT(td->td_critnest != 0, - ("critical_exit: td_critnest == 0")); + KASSERT(td->td_owepreempt != 0, + ("critical_exit: td_owepreempt == 0")); + if (td->td_critnest != 0) + return; + if (kdb_active) + return; - if (td->td_critnest == 1) { - td->td_critnest = 0; + /* +* Microoptimization: we committed to switch, +* disable preemption in interrupt handlers +* while spinning for the thread lock. +*/ + td->td_critnest = 1; + thread_lock(td); + td->td_critnest--; + flags = SW_INVOL | SW_PREEMPT; + if (TD_IS_IDLETHREAD(td)) + flags |= SWT_IDLE; + else + flags |= SWT_OWEPREEMPT; + mi_switch(flags, NULL); + thread_unlock(td); +} - /* -* Interrupt handlers execute critical_exit() on -* leave, and td_owepreempt may be left set by an -* interrupt handler only when td_critnest > 0. If we -* are decrementing td_critnest from 1 to 0, read -* td_owepreempt after decrementing, to not miss the -* preempt. Disallow compiler to reorder operations. -*/ - __compiler_membar(); - if (td->td_owepreempt && !kdb_active) { - /* -* Microoptimization: we committed to switch, -* disable preemption in interrupt handlers -* while spinning for the thread lock. -*/ - td->td_critnest = 1; - thread_lock(td); - td->td_critnest--; - flags = SW_INVOL | SW_PREEMPT; - if (TD_IS_IDLETHREAD(td)) - flags |= SWT_IDLE; - else - flags |= SWT_OWEPREEMPT; - mi_switch(flags, NULL); - thread_unlock(td); - } - } else - td->td_critnest--; +void +critical_exit(void) +{ + struct thread *td; + td = curthread; + KASSERT(td->td_critnest != 0, + ("critical_exit: td_critnest == 0")); + td->td_critnest--; + __compiler_membar(); + if (__predict_false(td->td_owepreempt)) + critical_exit_preempt(); CTR4(KTR_CRITICAL, "critical_exit by thread %p (%ld, %s) to %d", td, (long)td->td_proc->p_pid, td->td_name, td->td_critnest); } ___ 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: r334061 - head/sys/dev/usb/template
Author: trasz Date: Tue May 22 19:11:06 2018 New Revision: 334061 URL: https://svnweb.freebsd.org/changeset/base/334061 Log: Add new PIDs for Audio, CDCE, MTP, and Mass Storage, from https://github.com/obdev/v-usb/blob/master/usbdrv/USB-IDs-for-free.txt. Big thanks to Christian Starkjohann for allocating those. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/usb/template/usb_template_audio.c head/sys/dev/usb/template/usb_template_cdce.c head/sys/dev/usb/template/usb_template_msc.c head/sys/dev/usb/template/usb_template_mtp.c Modified: head/sys/dev/usb/template/usb_template_audio.c == --- head/sys/dev/usb/template/usb_template_audio.c Tue May 22 16:33:09 2018(r334060) +++ head/sys/dev/usb/template/usb_template_audio.c Tue May 22 19:11:06 2018(r334061) @@ -79,7 +79,7 @@ enum { }; #defineAUDIO_DEFAULT_VENDOR_ID USB_TEMPLATE_VENDOR -#defineAUDIO_DEFAULT_PRODUCT_ID0x05dc +#defineAUDIO_DEFAULT_PRODUCT_ID0x27e0 #defineAUDIO_DEFAULT_MIXER "Mixer interface" #defineAUDIO_DEFAULT_RECORD"Record interface" #defineAUDIO_DEFAULT_PLAYBACK "Playback interface" Modified: head/sys/dev/usb/template/usb_template_cdce.c == --- head/sys/dev/usb/template/usb_template_cdce.c Tue May 22 16:33:09 2018(r334060) +++ head/sys/dev/usb/template/usb_template_cdce.c Tue May 22 19:11:06 2018(r334061) @@ -80,7 +80,7 @@ enum { }; #defineETH_DEFAULT_VENDOR_ID USB_TEMPLATE_VENDOR -#defineETH_DEFAULT_PRODUCT_ID 0x05dc +#defineETH_DEFAULT_PRODUCT_ID 0x27e1 #defineETH_DEFAULT_MAC "2A02030405060789AB" #defineETH_DEFAULT_CONTROL "USB Ethernet Comm Interface" #defineETH_DEFAULT_DATA"USB Ethernet Data Interface" Modified: head/sys/dev/usb/template/usb_template_msc.c == --- head/sys/dev/usb/template/usb_template_msc.cTue May 22 16:33:09 2018(r334060) +++ head/sys/dev/usb/template/usb_template_msc.cTue May 22 19:11:06 2018(r334061) @@ -77,7 +77,7 @@ enum { }; #defineMSC_DEFAULT_VENDOR_ID USB_TEMPLATE_VENDOR -#defineMSC_DEFAULT_PRODUCT_ID 0x05dc +#defineMSC_DEFAULT_PRODUCT_ID 0x27df #defineMSC_DEFAULT_INTERFACE "USB Mass Storage Interface" #defineMSC_DEFAULT_CONFIGURATION "Default Config" #defineMSC_DEFAULT_MANUFACTURERUSB_TEMPLATE_MANUFACTURER Modified: head/sys/dev/usb/template/usb_template_mtp.c == --- head/sys/dev/usb/template/usb_template_mtp.cTue May 22 16:33:09 2018(r334060) +++ head/sys/dev/usb/template/usb_template_mtp.cTue May 22 19:11:06 2018(r334061) @@ -86,7 +86,7 @@ enum { }; #defineMTP_DEFAULT_VENDOR_ID USB_TEMPLATE_VENDOR -#defineMTP_DEFAULT_PRODUCT_ID 0x05dc +#defineMTP_DEFAULT_PRODUCT_ID 0x27e2 #defineMTP_DEFAULT_INTERFACE "USB MTP Interface" #defineMTP_DEFAULT_CONFIGURATION "Default Config" #defineMTP_DEFAULT_MANUFACTURERUSB_TEMPLATE_MANUFACTURER ___ 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: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat
Can users control arbitrary key_allocsp() calls? If so, it seems concerning to expose hit/miss stats on cached security keys. On Tue, May 22, 2018 at 8:54 AM, Fabien Thomas wrote: > Author: fabient > Date: Tue May 22 15:54:25 2018 > New Revision: 334054 > URL: https://svnweb.freebsd.org/changeset/base/334054 > > Log: > Add a SPD cache to speed up lookups. > > When large SPDs are used, we face two problems: > > - too many CPU cycles are spent during the linear searches in the SPD > for each packet > - too much contention on multi socket systems, since we use a single > shared lock. > > Main changes: > > - added the sysctl tree 'net.key.spdcache' to control the SPD cache > (disabled by default). > - cache the sp indexes that are used to perform SP lookups. > - use a range of dedicated mutexes to protect the cache lines. > > Submitted by: Emeric Poupon > Reviewed by: ae > Sponsored by: Stormshield > Differential Revision: https://reviews.freebsd.org/D15050 > > Modified: > head/sys/kern/uipc_mbuf.c > head/sys/netipsec/ipsec.h > head/sys/netipsec/key.c > head/tools/tools/crypto/ipsecstats.c > head/usr.bin/netstat/ipsec.c > > Modified: head/sys/kern/uipc_mbuf.c > == > --- head/sys/kern/uipc_mbuf.c Tue May 22 15:52:22 2018(r334053) > +++ head/sys/kern/uipc_mbuf.c Tue May 22 15:54:25 2018(r334054) > @@ -1633,9 +1633,6 @@ m_unshare(struct mbuf *m0, int how) > mprev->m_len += m->m_len; > mprev->m_next = m->m_next; /* unlink > from chain */ > m_free(m); /* reclaim > mbuf */ > -#if 0 > - newipsecstat.ips_mbcoalesced++; > -#endif > } else { > mprev = m; > } > @@ -1665,9 +1662,6 @@ m_unshare(struct mbuf *m0, int how) > mprev->m_len += m->m_len; > mprev->m_next = m->m_next; /* unlink from chain > */ > m_free(m); /* reclaim mbuf */ > -#if 0 > - newipsecstat.ips_clcoalesced++; > -#endif > continue; > } > > > Modified: head/sys/netipsec/ipsec.h > == > --- head/sys/netipsec/ipsec.h Tue May 22 15:52:22 2018(r334053) > +++ head/sys/netipsec/ipsec.h Tue May 22 15:54:25 2018(r334054) > @@ -219,8 +219,9 @@ struct ipsecstat { > uint64_t ips_out_inval; /* output: generic error */ > uint64_t ips_out_bundlesa; /* output: bundled SA processed */ > > - uint64_t ips_mbcoalesced; /* mbufs coalesced during clone */ > - uint64_t ips_clcoalesced; /* clusters coalesced during clone */ > + uint64_t ips_spdcache_hits; /* SPD cache hits */ > + uint64_t ips_spdcache_misses; /* SPD cache misses */ > + > uint64_t ips_clcopied; /* clusters copied during clone */ > uint64_t ips_mbinserted;/* mbufs inserted during makespace */ > /* > > Modified: head/sys/netipsec/key.c > == > --- head/sys/netipsec/key.c Tue May 22 15:52:22 2018(r334053) > +++ head/sys/netipsec/key.c Tue May 22 15:54:25 2018(r334054) > @@ -173,6 +173,48 @@ static VNET_DEFINE(u_long, sphash_mask); > #defineSPHASH_HASHVAL(id) (key_u32hash(id) & V_sphash_mask) > #defineSPHASH_HASH(id) &V_sphashtbl[SPHASH_HASHVAL(id)] > > +/* SPD cache */ > +struct spdcache_entry { > + struct secpolicyindex spidx;/* secpolicyindex */ > + struct secpolicy *sp; /* cached policy to be used */ > + > + LIST_ENTRY(spdcache_entry) chain; > +}; > +LIST_HEAD(spdcache_entry_list, spdcache_entry); > + > +#defineSPDCACHE_MAX_ENTRIES_PER_HASH 8 > + > +static VNET_DEFINE(u_int, key_spdcache_maxentries) = 0; > +#defineV_key_spdcache_maxentries VNET(key_spdcache_maxentries) > +static VNET_DEFINE(u_int, key_spdcache_threshold) = 32; > +#defineV_key_spdcache_thresholdVNET(key_spdcache_threshold) > +static VNET_DEFINE(unsigned long, spd_size) = 0; > +#defineV_spd_size VNET(spd_size) > + > +#define SPDCACHE_ENABLED() (V_key_spdcache_maxentries != 0) > +#define SPDCACHE_ACTIVE() \ > + (SPDCACHE_ENABLED() && V_spd_size >= V_key_spdcache_threshold) > + > +static VNET_DEFINE(struct spdcache_entry_list *, spdcachehashtbl); > +static VNET_DEFINE(u_long, spdcachehash_mask); > +#defineV_spdcachehashtbl VNET(spdcachehashtbl) > +#defineV_spdcachehash_mask VNET(spdcachehash_mask) > + > +#defineSPDCACHE_HASHVAL(idx) \ > + (key_addrprotohash(&(id
Re: svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat
On Tue, May 22, 2018 at 5:54 PM, Fabien Thomas wrote: > Author: fabient > Date: Tue May 22 15:54:25 2018 > New Revision: 334054 > URL: https://svnweb.freebsd.org/changeset/base/334054 > > Log: > Add a SPD cache to speed up lookups. > > When large SPDs are used, we face two problems: > > - too many CPU cycles are spent during the linear searches in the SPD > for each packet > - too much contention on multi socket systems, since we use a single > shared lock. > > > void > +spdcache_init(void) > +{ > + int i; > + > + TUNABLE_INT_FETCH("net.key.spdcache.maxentries", > + &V_key_spdcache_maxentries); > + TUNABLE_INT_FETCH("net.key.spdcache.threshold", > + &V_key_spdcache_threshold); > + > + if (V_key_spdcache_maxentries) { > + V_key_spdcache_maxentries = MAX(V_key_spdcache_maxentries, > + SPDCACHE_MAX_ENTRIES_PER_HASH); > + V_spdcachehashtbl = hashinit(V_key_spdcache_maxentries / > + SPDCACHE_MAX_ENTRIES_PER_HASH, > + M_IPSEC_SPDCACHE, &V_spdcachehash_mask); > + V_key_spdcache_maxentries = (V_spdcachehash_mask + 1) > + * SPDCACHE_MAX_ENTRIES_PER_HASH; > + > + V_spdcache_lock = malloc(sizeof(struct mtx) * > + (V_spdcachehash_mask + 1), > + M_IPSEC_SPDCACHE, M_WAITOK|M_ZERO); > + > + for (i = 0; i < V_spdcachehash_mask + 1; ++i) > + SPDCACHE_LOCK_INIT(i); > + } > +} > + > This ends up putting two locks per cacheline and sharing bucket heads across other lines. Unless you got a good reason not to, you should define a struct a which has both the lock and the list. An example of this can be found in kern/kern_lockf.c -- 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: r334060 - head/sys/sys
Author: markj Date: Tue May 22 16:33:09 2018 New Revision: 334060 URL: https://svnweb.freebsd.org/changeset/base/334060 Log: Fix the definition of td_startzero after r333466. Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h == --- head/sys/sys/proc.h Tue May 22 16:32:34 2018(r334059) +++ head/sys/sys/proc.h Tue May 22 16:33:09 2018(r334060) @@ -254,8 +254,8 @@ struct thread { u_char td_lend_user_pri; /* (t) Lend user pri. */ /* Cleared during fork1() */ -#definetd_startzero td_flags - u_char td_epochnest; /* (k) Private thread epoch nest counter */ +#definetd_startzero td_epochnest + u_char td_epochnest; /* (k) Epoch nest counter. */ int td_flags; /* (t) TDF_* flags. */ int td_inhibitors; /* (t) Why can not run. */ int td_pflags; /* (k) Private thread (TDP_*) 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"
svn commit: r334059 - head/sys/cam/mmc
Author: kibab Date: Tue May 22 16:32:34 2018 New Revision: 334059 URL: https://svnweb.freebsd.org/changeset/base/334059 Log: Fix MMCCAM scanning for new cards. r326645 used an incorrect argument for xpt_path_inq(). Reviewed by: imp (mentor) Differential Revision:https://reviews.freebsd.org/D15521 Modified: head/sys/cam/mmc/mmc_xpt.c Modified: head/sys/cam/mmc/mmc_xpt.c == --- head/sys/cam/mmc/mmc_xpt.c Tue May 22 16:23:14 2018(r334058) +++ head/sys/cam/mmc/mmc_xpt.c Tue May 22 16:32:34 2018(r334059) @@ -241,7 +241,7 @@ mmc_scan_lun(struct cam_periph *periph, struct cam_pat CAM_DEBUG(path, CAM_DEBUG_TRACE, ("mmc_scan_lun\n")); - xpt_path_inq(&cpi, periph->path); + xpt_path_inq(&cpi, path); if (cpi.ccb_h.status != CAM_REQ_CMP) { if (request_ccb != NULL) { ___ 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: r334058 - head/sys/dev/cxgbe
Author: np Date: Tue May 22 16:23:14 2018 New Revision: 334058 URL: https://svnweb.freebsd.org/changeset/base/334058 Log: cxgbe(4): Only valid filters are expected to have a valid tid. Modified: head/sys/dev/cxgbe/t4_filter.c Modified: head/sys/dev/cxgbe/t4_filter.c == --- head/sys/dev/cxgbe/t4_filter.c Tue May 22 16:19:48 2018 (r334057) +++ head/sys/dev/cxgbe/t4_filter.c Tue May 22 16:23:14 2018 (r334058) @@ -316,9 +316,9 @@ get_filter(struct adapter *sc, struct t4_filter *t) mtx_lock(&sc->tids.ftid_lock); f = &sc->tids.ftid_tab[t->idx]; - MPASS(f->tid == sc->tids.ftid_base + t->idx); for (i = t->idx; i < nfilters; i++, f++) { if (f->valid) { + MPASS(f->tid == sc->tids.ftid_base + i); t->idx = i; t->l2tidx = f->l2te ? f->l2te->idx : 0; t->smtidx = f->smtidx; ___ 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: r334057 - head/sys/vm
Author: markj Date: Tue May 22 16:19:48 2018 New Revision: 334057 URL: https://svnweb.freebsd.org/changeset/base/334057 Log: Ensure that "m" is initialized in vm_page_alloc_freelist_domain(). While here, remove a superfluous comment. Coverity CID: 1383559 MFC after:3 days Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Tue May 22 16:03:41 2018(r334056) +++ head/sys/vm/vm_page.c Tue May 22 16:19:48 2018(r334057) @@ -2191,9 +2191,7 @@ vm_page_alloc_freelist_domain(int domain, int freelist vm_page_t m; u_int flags; - /* -* Do not allocate reserved pages unless the req has asked for it. -*/ + m = NULL; vmd = VM_DOMAIN(domain); again: if (vm_domain_allocate(vmd, req, 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"
Re: svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat
-Original Message- From: Fabien Thomas Date: 2018-05-22, Tuesday at 09:00 To: Fabien Thomas , , Ravi Pokala , , Subject: Re: svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat > Le 22 mai 2018 à 17:58:10, Ravi Pokala (rpok...@freebsd.org) a écrit: > >> -Original Message- >> From: on behalf of Fabien Thomas >> >> Date: 2018-05-22, Tuesday at 08:54 >> To: , , >> >> Subject: svn commit: r334054 - in head: sys/kern sys/netipsec >> tools/tools/crypto usr.bin/netstat >> >>> Author: fabient >>> Date: Tue May 22 15:54:25 2018 >>> New Revision: 334054 >>> URL: https://svnweb.freebsd.org/changeset/base/334054 >>> >>> Log: >>> Add a SPD cache to speed up lookups. >> >> What does "SPD" expand to in this context? I usually hack on platform stuff, >> and "Serial Presence Detect" doesn't seem applicable to this change. :-) > > Yes, that was not obvious after reading the comment again. :) > SPD is related to IPsec so Security Policy Database. Thank you! Ravi (rpokala@) ___ 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: r334056 - head/sys/dev/fdt
Author: andrew Date: Tue May 22 16:03:41 2018 New Revision: 334056 URL: https://svnweb.freebsd.org/changeset/base/334056 Log: Handle reserved memory with the no-map property. We shouldn't be mapping this memory, so we need to find it so it can be excluded from the phys_avail map. Reviewed by: manu Obtained from:ABT Systems Ltd Sponsored by: Turing Robotic Industries Differential Revision:https://reviews.freebsd.org/D15518 Modified: head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdt_common.h Modified: head/sys/dev/fdt/fdt_common.c == --- head/sys/dev/fdt/fdt_common.c Tue May 22 16:01:56 2018 (r334055) +++ head/sys/dev/fdt/fdt_common.c Tue May 22 16:03:41 2018 (r334056) @@ -500,6 +500,47 @@ out: } int +fdt_get_reserved_mem(struct mem_region *reserved, int *mreserved) +{ + pcell_t reg[FDT_REG_CELLS]; + phandle_t child, root; + int addr_cells, size_cells; + int i, rv; + + root = OF_finddevice("/reserved-memory"); + if (root == -1) { + return (ENXIO); + } + + if ((rv = fdt_addrsize_cells(root, &addr_cells, &size_cells)) != 0) + return (rv); + + if (addr_cells + size_cells > FDT_REG_CELLS) + panic("Too many address and size cells %d %d", addr_cells, + size_cells); + + i = 0; + for (child = OF_child(root); child != 0; child = OF_peer(child)) { + if (!OF_hasprop(child, "no-map")) + continue; + + rv = OF_getprop(child, "reg", reg, sizeof(reg)); + if (rv <= 0) + /* XXX: Does a no-map of a dynamic range make sense? */ + continue; + + fdt_data_to_res(reg, addr_cells, size_cells, + (u_long *)&reserved[i].mr_start, + (u_long *)&reserved[i].mr_size); + i++; + } + + *mreserved = i; + + return (0); +} + +int fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, uint64_t *memsize) { pcell_t reg[FDT_REG_CELLS * FDT_MEM_REGIONS]; Modified: head/sys/dev/fdt/fdt_common.h == --- head/sys/dev/fdt/fdt_common.h Tue May 22 16:01:56 2018 (r334055) +++ head/sys/dev/fdt/fdt_common.h Tue May 22 16:03:41 2018 (r334056) @@ -85,6 +85,7 @@ int fdt_data_to_res(pcell_t *, int, int, u_long *, u_l phandle_t fdt_find_compatible(phandle_t, const char *, int); phandle_t fdt_depth_search_compatible(phandle_t, const char *, int); int fdt_get_mem_regions(struct mem_region *, int *, uint64_t *); +int fdt_get_reserved_mem(struct mem_region *, int *); int fdt_get_reserved_regions(struct mem_region *, int *); int fdt_get_phyaddr(phandle_t, device_t, int *, void **); int fdt_get_range(phandle_t, int, u_long *, u_long *); ___ 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: r334055 - head/sys/netinet/netdump
Author: markj Date: Tue May 22 16:01:56 2018 New Revision: 334055 URL: https://svnweb.freebsd.org/changeset/base/334055 Log: Initialize the dumper struct before calling set_dumper(). Fields owned by the generic code were being left uninitialized, causing problems in clear_dumper() if an error occurred. Coverity CID: 1391200 X-MFC with: r333283 Modified: head/sys/netinet/netdump/netdump_client.c Modified: head/sys/netinet/netdump/netdump_client.c == --- head/sys/netinet/netdump/netdump_client.c Tue May 22 15:54:25 2018 (r334054) +++ head/sys/netinet/netdump/netdump_client.c Tue May 22 16:01:56 2018 (r334055) @@ -1204,6 +1204,7 @@ netdump_ioctl(struct cdev *dev __unused, u_long cmd, c } } + memset(&dumper, 0, sizeof(dumper)); dumper.dumper_start = netdump_start; dumper.dumper_hdr = netdump_write_headers; dumper.dumper = netdump_dumper; ___ 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: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat
Le 22 mai 2018 à 17:58:10, Ravi Pokala (rpok...@freebsd.org) a écrit: -Original Message- From: on behalf of Fabien Thomas Date: 2018-05-22, Tuesday at 08:54 To: , , Subject: svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat > Author: fabient > Date: Tue May 22 15:54:25 2018 > New Revision: 334054 > URL: https://svnweb.freebsd.org/changeset/base/334054 > > Log: > Add a SPD cache to speed up lookups. What does "SPD" expand to in this context? I usually hack on platform stuff, and "Serial Presence Detect" doesn't seem applicable to this change. :-) Yes, that was not obvious after reading the comment again. :) SPD is related to IPsec so Security Policy Database. Thanks, Ravi (rpokala@) ___ 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: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat
-Original Message- From: on behalf of Fabien Thomas Date: 2018-05-22, Tuesday at 08:54 To: , , Subject: svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat > Author: fabient > Date: Tue May 22 15:54:25 2018 > New Revision: 334054 > URL: https://svnweb.freebsd.org/changeset/base/334054 > > Log: > Add a SPD cache to speed up lookups. What does "SPD" expand to in this context? I usually hack on platform stuff, and "Serial Presence Detect" doesn't seem applicable to this change. :-) Thanks, Ravi (rpokala@) ___ 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: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat
Author: fabient Date: Tue May 22 15:54:25 2018 New Revision: 334054 URL: https://svnweb.freebsd.org/changeset/base/334054 Log: Add a SPD cache to speed up lookups. When large SPDs are used, we face two problems: - too many CPU cycles are spent during the linear searches in the SPD for each packet - too much contention on multi socket systems, since we use a single shared lock. Main changes: - added the sysctl tree 'net.key.spdcache' to control the SPD cache (disabled by default). - cache the sp indexes that are used to perform SP lookups. - use a range of dedicated mutexes to protect the cache lines. Submitted by: Emeric Poupon Reviewed by: ae Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D15050 Modified: head/sys/kern/uipc_mbuf.c head/sys/netipsec/ipsec.h head/sys/netipsec/key.c head/tools/tools/crypto/ipsecstats.c head/usr.bin/netstat/ipsec.c Modified: head/sys/kern/uipc_mbuf.c == --- head/sys/kern/uipc_mbuf.c Tue May 22 15:52:22 2018(r334053) +++ head/sys/kern/uipc_mbuf.c Tue May 22 15:54:25 2018(r334054) @@ -1633,9 +1633,6 @@ m_unshare(struct mbuf *m0, int how) mprev->m_len += m->m_len; mprev->m_next = m->m_next; /* unlink from chain */ m_free(m); /* reclaim mbuf */ -#if 0 - newipsecstat.ips_mbcoalesced++; -#endif } else { mprev = m; } @@ -1665,9 +1662,6 @@ m_unshare(struct mbuf *m0, int how) mprev->m_len += m->m_len; mprev->m_next = m->m_next; /* unlink from chain */ m_free(m); /* reclaim mbuf */ -#if 0 - newipsecstat.ips_clcoalesced++; -#endif continue; } Modified: head/sys/netipsec/ipsec.h == --- head/sys/netipsec/ipsec.h Tue May 22 15:52:22 2018(r334053) +++ head/sys/netipsec/ipsec.h Tue May 22 15:54:25 2018(r334054) @@ -219,8 +219,9 @@ struct ipsecstat { uint64_t ips_out_inval; /* output: generic error */ uint64_t ips_out_bundlesa; /* output: bundled SA processed */ - uint64_t ips_mbcoalesced; /* mbufs coalesced during clone */ - uint64_t ips_clcoalesced; /* clusters coalesced during clone */ + uint64_t ips_spdcache_hits; /* SPD cache hits */ + uint64_t ips_spdcache_misses; /* SPD cache misses */ + uint64_t ips_clcopied; /* clusters copied during clone */ uint64_t ips_mbinserted;/* mbufs inserted during makespace */ /* Modified: head/sys/netipsec/key.c == --- head/sys/netipsec/key.c Tue May 22 15:52:22 2018(r334053) +++ head/sys/netipsec/key.c Tue May 22 15:54:25 2018(r334054) @@ -173,6 +173,48 @@ static VNET_DEFINE(u_long, sphash_mask); #defineSPHASH_HASHVAL(id) (key_u32hash(id) & V_sphash_mask) #defineSPHASH_HASH(id) &V_sphashtbl[SPHASH_HASHVAL(id)] +/* SPD cache */ +struct spdcache_entry { + struct secpolicyindex spidx;/* secpolicyindex */ + struct secpolicy *sp; /* cached policy to be used */ + + LIST_ENTRY(spdcache_entry) chain; +}; +LIST_HEAD(spdcache_entry_list, spdcache_entry); + +#defineSPDCACHE_MAX_ENTRIES_PER_HASH 8 + +static VNET_DEFINE(u_int, key_spdcache_maxentries) = 0; +#defineV_key_spdcache_maxentries VNET(key_spdcache_maxentries) +static VNET_DEFINE(u_int, key_spdcache_threshold) = 32; +#defineV_key_spdcache_thresholdVNET(key_spdcache_threshold) +static VNET_DEFINE(unsigned long, spd_size) = 0; +#defineV_spd_size VNET(spd_size) + +#define SPDCACHE_ENABLED() (V_key_spdcache_maxentries != 0) +#define SPDCACHE_ACTIVE() \ + (SPDCACHE_ENABLED() && V_spd_size >= V_key_spdcache_threshold) + +static VNET_DEFINE(struct spdcache_entry_list *, spdcachehashtbl); +static VNET_DEFINE(u_long, spdcachehash_mask); +#defineV_spdcachehashtbl VNET(spdcachehashtbl) +#defineV_spdcachehash_mask VNET(spdcachehash_mask) + +#defineSPDCACHE_HASHVAL(idx) \ + (key_addrprotohash(&(idx)->src, &(idx)->dst, &(idx)->ul_proto) & \ + V_spdcachehash_mask) + +/* Each cache line is protected by a mutex */ +static VNET_DEFINE(struct mtx *, spdcache_lock); +#defineV_spdcache_lock VNET(spdcache_lock) + +#defineSPDCACHE_LOCK_INIT(a) \ + mtx_init(&V_spdcache_lock[a], "spdcache", \ + "fast ipsec SPD cache", MTX_DEF|MTX_DUPOK) +#d
Re: svn commit: r334052 - head/sys/arm64/arm64
> On 22 May 2018, at 16:52, Andrew Turner wrote: > > Author: andrew > Date: Tue May 22 15:52:11 2018 > New Revision: 334052 > URL: https://svnweb.freebsd.org/changeset/base/334052 > > Log: > Revert r334035 for now. It breaks the boot on some boards as er expect to > be able to read UEFI RuntimeData memory via the DMAP region. Reported by: tuexen Andrew ___ 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: r334053 - head/lib/libkvm
Author: jhb Date: Tue May 22 15:52:22 2018 New Revision: 334053 URL: https://svnweb.freebsd.org/changeset/base/334053 Log: Use __SCCSID for SCCS IDs in libkvm sources. Rather than using #ifdef's around a static char array, use the existing helper macro from for SCCS IDs. To preserve existing behavior, add -DNO__SCCSID to CFLAGS to not include SCCS IDs in the built library by default. Reviewed by: brooks, dab (older version) Reviewed by: rgrimes Differential Revision:https://reviews.freebsd.org/D15459 Modified: head/lib/libkvm/Makefile head/lib/libkvm/kvm.c head/lib/libkvm/kvm_amd64.c head/lib/libkvm/kvm_getloadavg.c head/lib/libkvm/kvm_i386.c head/lib/libkvm/kvm_proc.c head/lib/libkvm/kvm_sparc64.c Modified: head/lib/libkvm/Makefile == --- head/lib/libkvm/MakefileTue May 22 15:52:11 2018(r334052) +++ head/lib/libkvm/MakefileTue May 22 15:52:22 2018(r334053) @@ -6,7 +6,7 @@ LIB=kvm SHLIBDIR?= /lib SHLIB_MAJOR= 7 -CFLAGS+=-DLIBC_SCCS -I${.CURDIR} +CFLAGS+=-DNO__SCCSID -I${.CURDIR} WARNS?=6 Modified: head/lib/libkvm/kvm.c == --- head/lib/libkvm/kvm.c Tue May 22 15:52:11 2018(r334052) +++ head/lib/libkvm/kvm.c Tue May 22 15:52:22 2018(r334053) @@ -35,12 +35,7 @@ #include __FBSDID("$FreeBSD$"); - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/94"; -#endif -#endif /* LIBC_SCCS and not lint */ +__SCCSID("@(#)kvm.c8.2 (Berkeley) 2/13/94"); #include #include Modified: head/lib/libkvm/kvm_amd64.c == --- head/lib/libkvm/kvm_amd64.c Tue May 22 15:52:11 2018(r334052) +++ head/lib/libkvm/kvm_amd64.c Tue May 22 15:52:22 2018(r334053) @@ -35,12 +35,7 @@ #include __FBSDID("$FreeBSD$"); - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)kvm_hp300.c8.1 (Berkeley) 6/4/93"; -#endif -#endif /* LIBC_SCCS and not lint */ +__SCCSID("@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"); /* * AMD64 machine dependent routines for kvm. Hopefully, the forthcoming Modified: head/lib/libkvm/kvm_getloadavg.c == --- head/lib/libkvm/kvm_getloadavg.cTue May 22 15:52:11 2018 (r334052) +++ head/lib/libkvm/kvm_getloadavg.cTue May 22 15:52:22 2018 (r334053) @@ -31,12 +31,7 @@ #include __FBSDID("$FreeBSD$"); - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)kvm_getloadavg.c 8.1 (Berkeley) 6/4/93"; -#endif -#endif /* LIBC_SCCS and not lint */ +__SCCSID("@(#)kvm_getloadavg.c 8.1 (Berkeley) 6/4/93"); #include #include Modified: head/lib/libkvm/kvm_i386.c == --- head/lib/libkvm/kvm_i386.c Tue May 22 15:52:11 2018(r334052) +++ head/lib/libkvm/kvm_i386.c Tue May 22 15:52:22 2018(r334053) @@ -35,12 +35,7 @@ #include __FBSDID("$FreeBSD$"); - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)kvm_hp300.c8.1 (Berkeley) 6/4/93"; -#endif -#endif /* LIBC_SCCS and not lint */ +__SCCSID("@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"); /* * i386 machine dependent routines for kvm. Hopefully, the forthcoming Modified: head/lib/libkvm/kvm_proc.c == --- head/lib/libkvm/kvm_proc.c Tue May 22 15:52:11 2018(r334052) +++ head/lib/libkvm/kvm_proc.c Tue May 22 15:52:22 2018(r334053) @@ -33,14 +33,9 @@ * SUCH DAMAGE. */ -#if 0 -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93"; -#endif /* LIBC_SCCS and not lint */ -#endif - #include __FBSDID("$FreeBSD$"); +__SCCSID("@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93"); /* * Proc traversal interface for kvm. ps and w are (probably) the exclusive Modified: head/lib/libkvm/kvm_sparc64.c == --- head/lib/libkvm/kvm_sparc64.c Tue May 22 15:52:11 2018 (r334052) +++ head/lib/libkvm/kvm_sparc64.c Tue May 22 15:52:22 2018 (r334053) @@ -37,12 +37,7 @@ #include __FBSDID("$FreeBSD$"); - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)kvm_hp300.c8.1 (Berkeley) 6/4/93"; -#endif -#endif /* LIBC_SCCS and not lint */ +__SCCSID("@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"); /* * sparc64 machine dependent routines for kvm. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, s
svn commit: r334052 - head/sys/arm64/arm64
Author: andrew Date: Tue May 22 15:52:11 2018 New Revision: 334052 URL: https://svnweb.freebsd.org/changeset/base/334052 Log: Revert r334035 for now. It breaks the boot on some boards as er expect to be able to read UEFI RuntimeData memory via the DMAP region. Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Tue May 22 15:49:23 2018(r334051) +++ head/sys/arm64/arm64/pmap.c Tue May 22 15:52:11 2018(r334052) @@ -586,100 +586,33 @@ pmap_early_vtophys(vm_offset_t l1pt, vm_offset_t va) return ((l2[l2_slot] & ~ATTR_MASK) + (va & L2_OFFSET)); } -static vm_offset_t -pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, -vm_offset_t freemempos) +static void +pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, vm_paddr_t max_pa) { - pt_entry_t *l2; vm_offset_t va; - vm_paddr_t l2_pa, pa; - u_int l1_slot, l2_slot, prev_l1_slot; + vm_paddr_t pa; + u_int l1_slot; int i; dmap_phys_base = min_pa & ~L1_OFFSET; dmap_phys_max = 0; dmap_max_addr = 0; - l2 = NULL; - prev_l1_slot = -1; -#defineDMAP_TABLES ((DMAP_MAX_ADDRESS - DMAP_MIN_ADDRESS) >> L0_SHIFT) - memset(pagetable_dmap, 0, PAGE_SIZE * DMAP_TABLES); - for (i = 0; i < (physmap_idx * 2); i += 2) { - pa = physmap[i] & ~L2_OFFSET; + pa = physmap[i] & ~L1_OFFSET; va = pa - dmap_phys_base + DMAP_MIN_ADDRESS; - /* Create L2 mappings at the start of the region */ - if ((pa & L1_OFFSET) != 0) { - l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT); - if (l1_slot != prev_l1_slot) { - prev_l1_slot = l1_slot; - l2 = (pt_entry_t *)freemempos; - l2_pa = pmap_early_vtophys(kern_l1, - (vm_offset_t)l2); - freemempos += PAGE_SIZE; - - pmap_load_store(&pagetable_dmap[l1_slot], - (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE); - - memset(l2, 0, PAGE_SIZE); - } - KASSERT(l2 != NULL, - ("pmap_bootstrap_dmap: NULL l2 map")); - for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1]; - pa += L2_SIZE, va += L2_SIZE) { - /* -* We are on a boundary, stop to -* create a level 1 block -*/ - if ((pa & L1_OFFSET) == 0) - break; - - l2_slot = pmap_l2_index(va); - KASSERT(l2_slot != 0, ("...")); - pmap_load_store(&l2[l2_slot], - (pa & ~L2_OFFSET) | ATTR_DEFAULT | ATTR_XN | - ATTR_IDX(CACHED_MEMORY) | L2_BLOCK); - } - KASSERT(va == (pa - dmap_phys_base + DMAP_MIN_ADDRESS), - ("...")); - } - - for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1] && - (physmap[i + 1] - pa) >= L1_SIZE; + for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1]; pa += L1_SIZE, va += L1_SIZE) { l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT); + /* We already have an entry */ + if (pagetable_dmap[l1_slot] != 0) + continue; pmap_load_store(&pagetable_dmap[l1_slot], (pa & ~L1_OFFSET) | ATTR_DEFAULT | ATTR_XN | ATTR_IDX(CACHED_MEMORY) | L1_BLOCK); } - /* Create L2 mappings at the end of the region */ - if (pa < physmap[i + 1]) { - l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT); - if (l1_slot != prev_l1_slot) { - prev_l1_slot = l1_slot; - l2 = (pt_entry_t *)freemempos; - l2_pa = pmap_early_vtophys(kern_l1, - (vm_offset_t)l2); - freemempos += PAGE_SIZE; - - pmap_load_store(&pagetable_dmap[l1_slot], - (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE); - - memset(l2, 0, PAGE_SIZE); - } - KASSERT(l2 != NULL, - ("pmap_bootstr
svn commit: r334051 - head/sys/dev/cpuctl
Author: markj Date: Tue May 22 15:49:23 2018 New Revision: 334051 URL: https://svnweb.freebsd.org/changeset/base/334051 Log: Typo. Reported by: rgrimes, vangyzen X-MFC with: r334050 Modified: head/sys/dev/cpuctl/cpuctl.c Modified: head/sys/dev/cpuctl/cpuctl.c == --- head/sys/dev/cpuctl/cpuctl.cTue May 22 15:38:51 2018 (r334050) +++ head/sys/dev/cpuctl/cpuctl.cTue May 22 15:49:23 2018 (r334051) @@ -367,7 +367,7 @@ update_intel(int cpu, cpuctl_update_args_t *args, stru rdmsr_safe(MSR_BIOS_SIGN, &rev0); /* Get current microcode revision. */ /* -* Perform update. Flush caches first to work around seeingly +* Perform update. Flush caches first to work around seemingly * undocumented errata applying to some Broadwell CPUs. */ wbinvd(); ___ 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: r334050 - head/sys/dev/cpuctl
> Author: markj > Date: Tue May 22 15:38:51 2018 > New Revision: 334050 > URL: https://svnweb.freebsd.org/changeset/base/334050 > > Log: > Flush caches before initiating a microcode update on Intel CPUs. > > This apparently works around issues with updates of certain Broadwell > CPUs. > > Reviewed by:emaste, kib, sbruno > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D15520 > > Modified: > head/sys/dev/cpuctl/cpuctl.c > > Modified: head/sys/dev/cpuctl/cpuctl.c > == > --- head/sys/dev/cpuctl/cpuctl.c Tue May 22 15:35:38 2018 > (r334049) > +++ head/sys/dev/cpuctl/cpuctl.c Tue May 22 15:38:51 2018 > (r334050) > @@ -367,8 +367,10 @@ update_intel(int cpu, cpuctl_update_args_t *args, stru > rdmsr_safe(MSR_BIOS_SIGN, &rev0); /* Get current microcode revision. */ > > /* > - * Perform update. > + * Perform update. Flush caches first to work around seeingly Did you mean seemingly? > + * undocumented errata applying to some Broadwell CPUs. >*/ > + wbinvd(); > wrmsr_safe(MSR_BIOS_UPDT_TRIG, (uintptr_t)(ptr)); > wrmsr_safe(MSR_BIOS_SIGN, 0); > > > -- Rod Grimes rgri...@freebsd.org ___ 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: r334050 - head/sys/dev/cpuctl
Author: markj Date: Tue May 22 15:38:51 2018 New Revision: 334050 URL: https://svnweb.freebsd.org/changeset/base/334050 Log: Flush caches before initiating a microcode update on Intel CPUs. This apparently works around issues with updates of certain Broadwell CPUs. Reviewed by: emaste, kib, sbruno MFC after:3 days Differential Revision:https://reviews.freebsd.org/D15520 Modified: head/sys/dev/cpuctl/cpuctl.c Modified: head/sys/dev/cpuctl/cpuctl.c == --- head/sys/dev/cpuctl/cpuctl.cTue May 22 15:35:38 2018 (r334049) +++ head/sys/dev/cpuctl/cpuctl.cTue May 22 15:38:51 2018 (r334050) @@ -367,8 +367,10 @@ update_intel(int cpu, cpuctl_update_args_t *args, stru rdmsr_safe(MSR_BIOS_SIGN, &rev0); /* Get current microcode revision. */ /* -* Perform update. +* Perform update. Flush caches first to work around seeingly +* undocumented errata applying to some Broadwell CPUs. */ + wbinvd(); wrmsr_safe(MSR_BIOS_UPDT_TRIG, (uintptr_t)(ptr)); wrmsr_safe(MSR_BIOS_SIGN, 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: r334049 - head/sys/net
Author: markj Date: Tue May 22 15:35:38 2018 New Revision: 334049 URL: https://svnweb.freebsd.org/changeset/base/334049 Log: Simplify lagg_input(). No functional change intended. MFC after:2 weeks Modified: head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/net/if_lagg.c == --- head/sys/net/if_lagg.c Tue May 22 15:13:25 2018(r334048) +++ head/sys/net/if_lagg.c Tue May 22 15:35:38 2018(r334049) @@ -1680,7 +1680,7 @@ lagg_input(struct ifnet *ifp, struct mbuf *m) LAGG_RLOCK(); if ((scifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || - (lp->lp_flags & LAGG_PORT_DISABLED) || + lp->lp_detaching != 0 || sc->sc_proto == LAGG_PROTO_NONE) { LAGG_RUNLOCK(); m_freem(m); @@ -1689,17 +1689,10 @@ lagg_input(struct ifnet *ifp, struct mbuf *m) ETHER_BPF_MTAP(scifp, m); - if (lp->lp_detaching != 0) { + m = lagg_proto_input(sc, lp, m); + if (m != NULL && (scifp->if_flags & IFF_MONITOR) != 0) { m_freem(m); m = NULL; - } else - m = lagg_proto_input(sc, lp, m); - - if (m != NULL) { - if (scifp->if_flags & IFF_MONITOR) { - m_freem(m); - m = NULL; - } } LAGG_RUNLOCK(); Modified: head/sys/net/if_lagg.h == --- head/sys/net/if_lagg.h Tue May 22 15:13:25 2018(r334048) +++ head/sys/net/if_lagg.h Tue May 22 15:35:38 2018(r334049) @@ -42,9 +42,8 @@ #defineLAGG_PORT_ACTIVE0x0004 /* port is active */ #defineLAGG_PORT_COLLECTING0x0008 /* port is receiving frames */ #defineLAGG_PORT_DISTRIBUTING 0x0010 /* port is sending frames */ -#defineLAGG_PORT_DISABLED 0x0020 /* port is disabled */ #defineLAGG_PORT_BITS "\20\01MASTER\02STACK\03ACTIVE\04COLLECTING" \ - "\05DISTRIBUTING\06DISABLED" + "\05DISTRIBUTING" /* Supported lagg PROTOs */ typedef enum { ___ 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: r334048 - head/sys/kern
Author: mjg Date: Tue May 22 15:13:25 2018 New Revision: 334048 URL: https://svnweb.freebsd.org/changeset/base/334048 Log: sx: fixup a braino in r334024 If a thread waiting on sx dropped Giant it would not be properly reacquired on exit from the routine, later resulting in panics indicating Giant is not held (when it should be). The bug was not present in the original patch sent to pho, I wittingly added it just prior to the commit and only smoke-tested it. Reported by: pho Modified: head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_sx.c == --- head/sys/kern/kern_sx.c Tue May 22 14:36:46 2018(r334047) +++ head/sys/kern/kern_sx.c Tue May 22 15:13:25 2018(r334048) @@ -879,6 +879,7 @@ retry_sleepq: if (in_critical) critical_exit(); #endif + GIANT_RESTORE(); #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING) if (__predict_true(!doing_lockprof)) return (error); @@ -898,7 +899,6 @@ out_lockstat: if (!error) LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(sx__acquire, sx, contested, waittime, file, line, LOCKSTAT_WRITER); - GIANT_RESTORE(); 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: r334046 - head/tools/tools/intel-ucode-split
Author: emaste Date: Tue May 22 14:35:33 2018 New Revision: 334046 URL: https://svnweb.freebsd.org/changeset/base/334046 Log: intel-ucode-split: add -n flag to skip creating output files Sponsored by: The FreeBSD Foundation Modified: head/tools/tools/intel-ucode-split/intel-ucode-split.c Modified: head/tools/tools/intel-ucode-split/intel-ucode-split.c == --- head/tools/tools/intel-ucode-split/intel-ucode-split.c Tue May 22 14:26:58 2018(r334045) +++ head/tools/tools/intel-ucode-split/intel-ucode-split.c Tue May 22 14:35:33 2018(r334046) @@ -112,7 +112,7 @@ static void usage(void) { - printf("ucode-split [-v] microcode_file\n"); + printf("ucode-split [-nv] microcode_file\n"); exit(1); } @@ -124,11 +124,14 @@ main(int argc, char *argv[]) size_t len, resid; ssize_t rv; int c, ifd, ofd; - bool vflag; + bool nflag, vflag; - vflag = false; - while ((c = getopt(argc, argv, "v")) != -1) { + nflag = vflag = false; + while ((c = getopt(argc, argv, "nv")) != -1) { switch (c) { + case 'n': + nflag = true; + break; case 'v': vflag = true; break; @@ -166,40 +169,48 @@ main(int argc, char *argv[]) if (vflag) dump_header(&hdr); - sig_str = format_signature(hdr.processor_signature); - asprintf(&output_file, "%s.%02x", sig_str, - hdr.processor_flags & 0xff); - free(sig_str); - if (output_file == NULL) - err(1, "asprintf"); - ofd = open(output_file, O_WRONLY | O_CREAT | O_TRUNC, 0600); - if (ofd < 0) - err(1, "open"); - - /* Write header. */ - rv = write(ofd, &hdr, sizeof(hdr)); - if (rv < (ssize_t)sizeof(hdr)) - err(1, "write"); - - /* Copy data. */ resid = (hdr.total_size != 0 ? hdr.total_size : 2048) - sizeof(hdr); if (resid > 1 << 24) /* Arbitrary chosen maximum size. */ errx(1, "header total_size too large"); - while (resid > 0) { - len = resid < bufsize ? resid : bufsize; - rv = read(ifd, buf, len); - if (rv < 0) - err(1, "read"); - else if (rv < (ssize_t)len) - errx(1, "truncated microcode data"); - if (write(ofd, buf, len) < (ssize_t)len) + + if (nflag) { + if (lseek(ifd, resid, SEEK_CUR) == -1) + err(1, "lseek"); + printf("\n"); + } else { + sig_str = format_signature(hdr.processor_signature); + asprintf(&output_file, "%s.%02x", sig_str, + hdr.processor_flags & 0xff); + free(sig_str); + if (output_file == NULL) + err(1, "asprintf"); + ofd = open(output_file, O_WRONLY | O_CREAT | O_TRUNC, + 0600); + if (ofd < 0) + err(1, "open"); + + /* Write header. */ + rv = write(ofd, &hdr, sizeof(hdr)); + if (rv < (ssize_t)sizeof(hdr)) err(1, "write"); - resid -= len; + + /* Copy data. */ + while (resid > 0) { + len = resid < bufsize ? resid : bufsize; + rv = read(ifd, buf, len); + if (rv < 0) + err(1, "read"); + else if (rv < (ssize_t)len) + errx(1, "truncated microcode data"); + if (write(ofd, buf, len) < (ssize_t)len) + err(1, "write"); + resid -= len; + } + if (vflag) + printf("written to %s\n\n", output_file); + close(ofd); + free(output_file); } - if (vflag) - printf("written to %s\n\n", output_file); - close(ofd); - free(output_file); } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/
svn commit: r334045 - head/sys/arm/arm
Author: andrew Date: Tue May 22 14:26:58 2018 New Revision: 334045 URL: https://svnweb.freebsd.org/changeset/base/334045 Log: Pass the array length into regions_to_avail. On arm64 we will need to get the phys_avail array from before the kernel is excluded to create teh DMAP region. In preperation for this pass in the array length into regions_to_avail. Modified: head/sys/arm/arm/physmem.c Modified: head/sys/arm/arm/physmem.c == --- head/sys/arm/arm/physmem.c Tue May 22 14:25:40 2018(r334044) +++ head/sys/arm/arm/physmem.c Tue May 22 14:26:58 2018(r334045) @@ -168,8 +168,8 @@ arm_physmem_print_tables(void) * Returns the number of pages of non-excluded memory added to the avail list. */ static size_t -regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail, -long *prealmem) +regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail, +long *pavail, long *prealmem) { size_t acnt, exi, hwi; uint64_t end, start, xend, xstart; @@ -258,7 +258,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, } availmem += pm_btop((vm_offset_t)(end - start)); } - if (acnt >= MAX_AVAIL_ENTRIES) + if (acnt >= maxavail) panic("Not enough space in the dump/phys_avail arrays"); } @@ -389,9 +389,10 @@ arm_physmem_init_kernel_globals(void) { size_t nextidx; - regions_to_avail(dump_avail, EXFLAG_NODUMP, NULL, NULL); - nextidx = regions_to_avail(phys_avail, EXFLAG_NOALLOC, &physmem, - &realmem); + regions_to_avail(dump_avail, EXFLAG_NODUMP, MAX_AVAIL_ENTRIES, NULL, + NULL); + nextidx = regions_to_avail(phys_avail, EXFLAG_NOALLOC, + MAX_AVAIL_ENTRIES, &physmem, &realmem); if (nextidx == 0) panic("No memory entries in phys_avail"); Maxmem = atop(phys_avail[nextidx - 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: r334041 - head/share/man/man9
Author: manu Date: Tue May 22 13:45:24 2018 New Revision: 334041 URL: https://svnweb.freebsd.org/changeset/base/334041 Log: bus_dma(9): Correct arm64 BUS_DMA_COHERENT implementation note BUS_DMA_COHERENT isn't supported in bus_dmamap_create but bus_dma_tag_create. Document it properly. Submitted by: andrew Modified: head/share/man/man9/bus_dma.9 Modified: head/share/man/man9/bus_dma.9 == --- head/share/man/man9/bus_dma.9 Tue May 22 13:30:56 2018 (r334040) +++ head/share/man/man9/bus_dma.9 Tue May 22 13:45:24 2018 (r334041) @@ -446,6 +446,15 @@ allocated with Also, due to resource sharing with other tags, this flag does not guarantee that resources will be allocated or reserved exclusively for this tag. It should be treated only as a minor optimization. +.It Dv BUS_DMA_COHERENT +Indicate that the DMA engine and CPU are cache-coherent. +Cached memory may be used to back allocations created by +.Fn bus_dmamem_alloc . +For +.Fn bus_dma_tag_create , +the +.Dv BUS_DMA_COHERENT +flag is currently implemented on arm64. .El .It Fa lockfunc Optional lock manipulation function (may be @@ -504,7 +513,7 @@ For .Fn bus_dmamap_create , the .Dv BUS_DMA_COHERENT -flag is currently implemented on arm64 and sparc64. +flag is currently implemented on sparc64. .El .It Fa mapp Pointer to a ___ 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: r334042 - head/sys/i386/include
Author: kib Date: Tue May 22 13:45:40 2018 New Revision: 334042 URL: https://svnweb.freebsd.org/changeset/base/334042 Log: Use local unique labels inside most often used macros. Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/i386/include/asmacros.h Modified: head/sys/i386/include/asmacros.h == --- head/sys/i386/include/asmacros.hTue May 22 13:45:24 2018 (r334041) +++ head/sys/i386/include/asmacros.hTue May 22 13:45:40 2018 (r334042) @@ -189,9 +189,9 @@ movlPCPU(KESP0), %edx movl$TF_SZ, %ecx testl $PSL_VM, TF_EFLAGS(%esp) - jz 1001f + jz .L\@.1 addl$VM86_STACK_SPACE, %ecx -1001: subl%ecx, %edx +.L\@.1:subl%ecx, %edx movl%edx, %edi movl%esp, %esi rep; movsb @@ -199,9 +199,9 @@ .endm .macro LOAD_KCR3 - call1000f -1000: popl%eax - movl(tramp_idleptd - 1000b)(%eax), %eax + call.L\@.1 +.L\@.1:popl%eax + movl(tramp_idleptd - .L\@.1)(%eax), %eax movl%eax, %cr3 .endm @@ -212,17 +212,17 @@ .macro KENTER testl $PSL_VM, TF_EFLAGS(%esp) - jz 1f + jz .L\@.1 LOAD_KCR3 movlPCPU(CURPCB), %eax testl $PCB_VM86CALL, PCB_FLAGS(%eax) - jnz 3f + jnz .L\@.3 NMOVE_STACKS - jmp 3f -1: testb $SEL_RPL_MASK, TF_CS(%esp) - jz 3f -2: MOVE_STACKS -3: + jmp .L\@.3 +.L\@.1:testb $SEL_RPL_MASK, TF_CS(%esp) + jz .L\@.3 +.L\@.2:MOVE_STACKS +.L\@.3: .endm #endif /* LOCORE */ ___ 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: r333995 - head/sys/teken
On Tue, May 22, 2018 at 3:25 AM, Ed Schouten wrote: > Hi Bruce, > > 2018-05-22 3:18 GMT+02:00 Bruce Evans : > > DECSCUSR is a verbose yet cryptic abbreviation which is not even expanded > > its name. It is the only abbreviation longer than 7 characters. This > > messes up the souce formatting. > > Yeah, it's a bit silly, but that's simply how it's called: > > https://vt100.net/docs/vt510-rm/DECSCUSR.html > > I think the state machine generator doesn't mind if we added an extra > tab between all other entries to get it to line up again. Maybe that > does push us over 80 columns, though... Yea, back in the day, ANSI had official mnemonics for the escape sequences. And DEC's extensions to ANSI sequences had official mnemonics as well, but all started with DEC so you knew about them. These mnemonics were akin to the assembler at the time, where one had to keep track of the differences between HRLI and HRROS in assembler, SCUSR isn't so crazy. These days, it's a bit brief. Warner [*] These are MACRO-10 half word instructions that I've forgotten all meaning of other than they were half word instructions that did weird things depending on which letters... Half [LR src] [LR dst] . ___ 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: r334040 - head/sys/i386/include
Author: kib Date: Tue May 22 13:30:56 2018 New Revision: 334040 URL: https://svnweb.freebsd.org/changeset/base/334040 Log: Fix double-load of %cr3 and double-copy of the stack frame for the kernel entry from userspace vm86. Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/i386/include/asmacros.h Modified: head/sys/i386/include/asmacros.h == --- head/sys/i386/include/asmacros.hTue May 22 13:28:05 2018 (r334039) +++ head/sys/i386/include/asmacros.hTue May 22 13:30:56 2018 (r334040) @@ -218,7 +218,7 @@ testl $PCB_VM86CALL, PCB_FLAGS(%eax) jnz 3f NMOVE_STACKS - jmp 2f + jmp 3f 1: testb $SEL_RPL_MASK, TF_CS(%esp) jz 3f 2: MOVE_STACKS ___ 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: r334039 - head/sys/netpfil/ipfw
Author: ae Date: Tue May 22 13:28:05 2018 New Revision: 334039 URL: https://svnweb.freebsd.org/changeset/base/334039 Log: Restore the ability to keep states after parent rule deletion. This feature is disabled by default and was removed when dynamic states implementation changed to be lockless. Now it is reimplemented with small differences - when dyn_keep_states sysctl variable is enabled, dyn_match_ipv[46]_state() function doesn't match child states of deleted rule. And thus they are keept alive until expired. ipfw_dyn_lookup_state() function does check that state was not orphaned, and if so, it returns pointer to default_rule and its position in the rules map. The main visible difference is that orphaned states still have the same rule number that they have before parent rule deleted, because now a state has many fields related to rule and changing them all atomically to point to default_rule seems hard enough. Reported by: MFC after:2 days Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c == --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Tue May 22 13:25:15 2018 (r334038) +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Tue May 22 13:28:05 2018 (r334039) @@ -311,6 +311,9 @@ static VNET_DEFINE(struct callout, dyn_timeout); static VNET_DEFINE(uint32_t, curr_max_length); #defineV_curr_max_length VNET(curr_max_length) +static VNET_DEFINE(uint32_t, dyn_keep_states); +#defineV_dyn_keep_states VNET(dyn_keep_states) + static VNET_DEFINE(uma_zone_t, dyn_data_zone); static VNET_DEFINE(uma_zone_t, dyn_parent_zone); static VNET_DEFINE(uma_zone_t, dyn_ipv4_zone); @@ -361,6 +364,7 @@ static VNET_DEFINE(uint32_t, dyn_max); /* max # of dy static VNET_DEFINE(uint32_t, dyn_count); /* number of states */ static VNET_DEFINE(uint32_t, dyn_parent_max); /* max # of parent states */ static VNET_DEFINE(uint32_t, dyn_parent_count);/* number of parent states */ + #defineV_dyn_max VNET(dyn_max) #defineV_dyn_count VNET(dyn_count) #defineV_dyn_parent_maxVNET(dyn_parent_max) @@ -475,7 +479,11 @@ SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_short_lifeti SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_keepalive, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_keepalive), 0, "Enable keepalives for dynamic states."); +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_keep_states, +CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_keep_states), 0, +"Do not flush dynamic states on rule deletion"); + #ifdef IPFIREWALL_DYNDEBUG #defineDYN_DEBUG(fmt, ...) do {\ printf("%s: " fmt "\n", __func__, __VA_ARGS__); \ @@ -1387,18 +1395,32 @@ ipfw_dyn_lookup_state(const struct ip_fw_args *args, c * that will be added into head of this bucket. * And the state that we currently have matched * should be deleted by dyn_expire_states(). +* +* In case when dyn_keep_states is enabled, return +* pointer to default rule and corresponding f_pos +* value. +* XXX: In this case we lose the cache efficiency, +* since f_pos is not cached, because it seems +* there is no easy way to atomically switch +* all fields related to parent rule of given +* state. */ - if (V_layer3_chain.map[data->f_pos] == rule) + if (V_layer3_chain.map[data->f_pos] == rule) { data->chain_id = V_layer3_chain.id; - else { + info->f_pos = data->f_pos; + } else if (V_dyn_keep_states != 0) { + rule = V_layer3_chain.default_rule; + info->f_pos = V_layer3_chain.n_rules - 1; + } else { rule = NULL; info->direction = MATCH_NONE; DYN_DEBUG("rule %p [%u, %u] is considered " "invalid in data %p", rule, data->ruleid, data->rulenum, data); + /* info->f_pos doesn't matter here. */ } - } - info->f_pos = data->f_pos; + } else + info->f_pos = data->f_pos; } DYNSTATE_CRITICAL_EXIT(); #if 0 @@ -2099,7 +2121,8 @@ dyn_match_ipv4_state(struct dyn_ipv4_state *s, const i if
svn commit: r334038 - head/sys/amd64/include
Author: kib Date: Tue May 22 13:25:15 2018 New Revision: 334038 URL: https://svnweb.freebsd.org/changeset/base/334038 Log: Enable IBRS when entering an interrupt handler from usermode. Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/amd64/include/asmacros.h Modified: head/sys/amd64/include/asmacros.h == --- head/sys/amd64/include/asmacros.h Tue May 22 13:21:44 2018 (r334037) +++ head/sys/amd64/include/asmacros.h Tue May 22 13:25:15 2018 (r334038) @@ -260,6 +260,7 @@ X\vec_name: jz 1f /* yes, leave PCB_FULL_IRET alone */ movqPCPU(CURPCB),%r8 andl$~PCB_FULL_IRET,PCB_FLAGS(%r8) + callhandle_ibrs_entry 1: .endm ___ 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: r334037 - head/sys/arm/arm
Author: andrew Date: Tue May 22 13:21:44 2018 New Revision: 334037 URL: https://svnweb.freebsd.org/changeset/base/334037 Log: Only set realmem based on memory where the EXFLAG_NOALLOC is unset. This will allow us to query the maps at any time without disturbing this value. Obtained from:ABT Systems Ltd Sponsored by: Turing Robotic Industries Modified: head/sys/arm/arm/physmem.c Modified: head/sys/arm/arm/physmem.c == --- head/sys/arm/arm/physmem.c Tue May 22 11:57:10 2018(r334036) +++ head/sys/arm/arm/physmem.c Tue May 22 13:21:44 2018(r334037) @@ -168,20 +168,21 @@ arm_physmem_print_tables(void) * Returns the number of pages of non-excluded memory added to the avail list. */ static size_t -regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail) +regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail, +long *prealmem) { size_t acnt, exi, hwi; uint64_t end, start, xend, xstart; - long availmem; + long availmem, totalmem; const struct region *exp, *hwp; - realmem = 0; + totalmem = 0; availmem = 0; acnt = 0; for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) { start = hwp->addr; end = hwp->size + start; - realmem += pm_btop((vm_offset_t)(end - start)); + totalmem += pm_btop((vm_offset_t)(end - start)); for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) { /* * If the excluded region does not match given flags, @@ -261,8 +262,10 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, panic("Not enough space in the dump/phys_avail arrays"); } - if (pavail) + if (pavail != NULL) *pavail = availmem; + if (prealmem != NULL) + *prealmem = realmem; return (acnt); } @@ -386,8 +389,9 @@ arm_physmem_init_kernel_globals(void) { size_t nextidx; - regions_to_avail(dump_avail, EXFLAG_NODUMP, NULL); - nextidx = regions_to_avail(phys_avail, EXFLAG_NOALLOC, &physmem); + regions_to_avail(dump_avail, EXFLAG_NODUMP, NULL, NULL); + nextidx = regions_to_avail(phys_avail, EXFLAG_NOALLOC, &physmem, + &realmem); if (nextidx == 0) panic("No memory entries in phys_avail"); Maxmem = atop(phys_avail[nextidx - 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: r334035 - head/sys/arm64/arm64
Author: andrew Date: Tue May 22 11:26:41 2018 New Revision: 334035 URL: https://svnweb.freebsd.org/changeset/base/334035 Log: On ThunderX2 we need to be careful to only map the memory the firmware lists in the EFI memory map. As such we need to reduce the mappings to restrict them to not be the full 1G block. For now reduce this to a 2M block, however this may be further restricted to be 4k page aligned as other SoCs may require. This allows ThunderX2 to boot reliably to userspace without performing any speculative memory accesses to invalid physical memory. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Tue May 22 11:17:45 2018(r334034) +++ head/sys/arm64/arm64/pmap.c Tue May 22 11:26:41 2018(r334035) @@ -586,33 +586,100 @@ pmap_early_vtophys(vm_offset_t l1pt, vm_offset_t va) return ((l2[l2_slot] & ~ATTR_MASK) + (va & L2_OFFSET)); } -static void -pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, vm_paddr_t max_pa) +static vm_offset_t +pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, +vm_offset_t freemempos) { + pt_entry_t *l2; vm_offset_t va; - vm_paddr_t pa; - u_int l1_slot; + vm_paddr_t l2_pa, pa; + u_int l1_slot, l2_slot, prev_l1_slot; int i; dmap_phys_base = min_pa & ~L1_OFFSET; dmap_phys_max = 0; dmap_max_addr = 0; + l2 = NULL; + prev_l1_slot = -1; +#defineDMAP_TABLES ((DMAP_MAX_ADDRESS - DMAP_MIN_ADDRESS) >> L0_SHIFT) + memset(pagetable_dmap, 0, PAGE_SIZE * DMAP_TABLES); + for (i = 0; i < (physmap_idx * 2); i += 2) { - pa = physmap[i] & ~L1_OFFSET; + pa = physmap[i] & ~L2_OFFSET; va = pa - dmap_phys_base + DMAP_MIN_ADDRESS; - for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1]; + /* Create L2 mappings at the start of the region */ + if ((pa & L1_OFFSET) != 0) { + l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT); + if (l1_slot != prev_l1_slot) { + prev_l1_slot = l1_slot; + l2 = (pt_entry_t *)freemempos; + l2_pa = pmap_early_vtophys(kern_l1, + (vm_offset_t)l2); + freemempos += PAGE_SIZE; + + pmap_load_store(&pagetable_dmap[l1_slot], + (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE); + + memset(l2, 0, PAGE_SIZE); + } + KASSERT(l2 != NULL, + ("pmap_bootstrap_dmap: NULL l2 map")); + for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1]; + pa += L2_SIZE, va += L2_SIZE) { + /* +* We are on a boundary, stop to +* create a level 1 block +*/ + if ((pa & L1_OFFSET) == 0) + break; + + l2_slot = pmap_l2_index(va); + KASSERT(l2_slot != 0, ("...")); + pmap_load_store(&l2[l2_slot], + (pa & ~L2_OFFSET) | ATTR_DEFAULT | ATTR_XN | + ATTR_IDX(CACHED_MEMORY) | L2_BLOCK); + } + KASSERT(va == (pa - dmap_phys_base + DMAP_MIN_ADDRESS), + ("...")); + } + + for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1] && + (physmap[i + 1] - pa) >= L1_SIZE; pa += L1_SIZE, va += L1_SIZE) { l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT); - /* We already have an entry */ - if (pagetable_dmap[l1_slot] != 0) - continue; pmap_load_store(&pagetable_dmap[l1_slot], (pa & ~L1_OFFSET) | ATTR_DEFAULT | ATTR_XN | ATTR_IDX(CACHED_MEMORY) | L1_BLOCK); } + /* Create L2 mappings at the end of the region */ + if (pa < physmap[i + 1]) { + l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT); + if (l1_slot != prev_l1_slot) { + prev_l1_slot = l1_slot; + l2 = (pt_entry_t *)freemempos; + l2_pa = pmap_early_vtophys(kern_l1, + (vm_offset_t)l2); +
svn commit: r334034 - head/share/man/man9
Author: manu Date: Tue May 22 11:17:45 2018 New Revision: 334034 URL: https://svnweb.freebsd.org/changeset/base/334034 Log: bus_dma(9): arm64 implementation notes Indicate that BUS_DMA_COHERENT is supported for bus_dmamem_alloc and bus_dmamem_create in the arm64 implementation. Modified: head/share/man/man9/bus_dma.9 Modified: head/share/man/man9/bus_dma.9 == --- head/share/man/man9/bus_dma.9 Tue May 22 11:16:45 2018 (r334033) +++ head/share/man/man9/bus_dma.9 Tue May 22 11:17:45 2018 (r334034) @@ -504,7 +504,7 @@ For .Fn bus_dmamap_create , the .Dv BUS_DMA_COHERENT -flag is currently implemented on sparc64. +flag is currently implemented on arm64 and sparc64. .El .It Fa mapp Pointer to a @@ -834,7 +834,7 @@ For .Fn bus_dmamem_alloc , the .Dv BUS_DMA_COHERENT -flag is currently implemented on arm and sparc64. +flag is currently implemented on arm, arm64 and sparc64. .It Dv BUS_DMA_ZERO Causes the allocated memory to be set to all zeros. .It Dv BUS_DMA_NOCACHE ___ 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: r334033 - head/sys/arm64/arm64
Author: andrew Date: Tue May 22 11:16:45 2018 New Revision: 334033 URL: https://svnweb.freebsd.org/changeset/base/334033 Log: Stop using the DMAP region to map ACPI memory. On some arm64 boards we need to access memory in ACPI tables that is not mapped in the DMAP region. To handle this create the needed mappings in pmap_mapbios in the KVA space. Submitted by: Michal Stanek (m...@semihalf.com) Sponsored by: Cavium Differential Revision:https://reviews.freebsd.org/D15059 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Tue May 22 11:07:04 2018(r334032) +++ head/sys/arm64/arm64/pmap.c Tue May 22 11:16:45 2018(r334033) @@ -219,6 +219,23 @@ __FBSDID("$FreeBSD$"); struct pmap kernel_pmap_store; +/* Used for mapping ACPI memory before VM is initialized */ +#definePMAP_PREINIT_MAPPING_COUNT 32 +#definePMAP_PREINIT_MAPPING_SIZE (PMAP_PREINIT_MAPPING_COUNT * L2_SIZE) +static vm_offset_t preinit_map_va; /* Start VA of pre-init mapping space */ +static int vm_initialized = 0; /* No need to use pre-init maps when set */ + +/* + * Reserve a few L2 blocks starting from 'preinit_map_va' pointer. + * Always map entire L2 block for simplicity. + * VA of L2 block = preinit_map_va + i * L2_SIZE + */ +static struct pmap_preinit_mapping { + vm_paddr_t pa; + vm_offset_t va; + vm_size_t size; +} pmap_preinit_mapping[PMAP_PREINIT_MAPPING_COUNT]; + vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ vm_offset_t kernel_vm_end = 0; @@ -761,7 +778,11 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ alloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); msgbufp = (void *)msgbufpv; - virtual_avail = roundup2(freemempos, L1_SIZE); + /* Reserve some VA space for early BIOS/ACPI mapping */ + preinit_map_va = roundup2(freemempos, L2_SIZE); + + virtual_avail = preinit_map_va + PMAP_PREINIT_MAPPING_SIZE; + virtual_avail = roundup2(virtual_avail, L1_SIZE); virtual_end = VM_MAX_KERNEL_ADDRESS - L2_SIZE; kernel_vm_end = virtual_avail; @@ -825,6 +846,8 @@ pmap_init(void) for (i = 0; i < pv_npg; i++) TAILQ_INIT(&pv_table[i].pv_list); TAILQ_INIT(&pv_dummy.pv_list); + + vm_initialized = 1; } static SYSCTL_NODE(_vm_pmap, OID_AUTO, l2, CTLFLAG_RD, 0, @@ -4192,13 +4215,162 @@ pmap_clear_modify(vm_page_t m) void * pmap_mapbios(vm_paddr_t pa, vm_size_t size) { + struct pmap_preinit_mapping *ppim; + vm_offset_t va, offset; + pd_entry_t *pde; + pt_entry_t *l2; + int i, lvl, l2_blocks, free_l2_count, start_idx; -return ((void *)PHYS_TO_DMAP(pa)); + if (!vm_initialized) { + /* +* No L3 ptables so map entire L2 blocks where start VA is: +* preinit_map_va + start_idx * L2_SIZE +* There may be duplicate mappings (multiple VA -> same PA) but +* ARM64 dcache is always PIPT so that's acceptable. +*/ +if (size == 0) +return (NULL); + +/* Calculate how many full L2 blocks are needed for the mapping */ + l2_blocks = (roundup2(pa + size, L2_SIZE) - rounddown2(pa, L2_SIZE)) >> L2_SHIFT; + + offset = pa & L2_OFFSET; + + if (preinit_map_va == 0) + return (NULL); + + /* Map 2MiB L2 blocks from reserved VA space */ + + free_l2_count = 0; + start_idx = -1; + /* Find enough free contiguous VA space */ + for (i = 0; i < PMAP_PREINIT_MAPPING_COUNT; i++) { + ppim = pmap_preinit_mapping + i; + if (free_l2_count > 0 && ppim->pa != 0) { + /* Not enough space here */ + free_l2_count = 0; + start_idx = -1; + continue; + } + + if (ppim->pa == 0) { + /* Free L2 block */ + if (start_idx == -1) + start_idx = i; + free_l2_count++; + if (free_l2_count == l2_blocks) + break; + } + } + if (free_l2_count != l2_blocks) + panic("%s: too many preinit mappings", __func__); + + va = preinit_map_va + (start_idx * L2_SIZE); + for (i = start_idx; i < start_idx + l2_blocks; i++) { +
svn commit: r334032 - in head/sys: arm64/arm64 conf
Author: andrew Date: Tue May 22 11:07:04 2018 New Revision: 334032 URL: https://svnweb.freebsd.org/changeset/base/334032 Log: Switch arm64 to use the same physmem code as 32-bit arm. The main advantage of this is to allow us to exclude memory from being used by the kernel. This may be from the memreserve property, or ranges marked as no-map under the reserved-memory node. More work is still needed to remove the physmap array. This is still used for creating the DMAP region, however other patches need to be committed before we can remove this. Obtained from:ABT Systems Ltd Sponsored by: Turing Robotic Industries Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/pmap.c head/sys/conf/files.arm64 Modified: head/sys/arm64/arm64/machdep.c == --- head/sys/arm64/arm64/machdep.c Tue May 22 11:05:40 2018 (r334031) +++ head/sys/arm64/arm64/machdep.c Tue May 22 11:07:04 2018 (r334032) @@ -80,6 +80,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #ifdef VFP #include #endif @@ -101,13 +103,8 @@ struct pcpu __pcpu[MAXCPU]; static struct trapframe proc0_tf; -vm_paddr_t phys_avail[PHYS_AVAIL_SIZE + 2]; -vm_paddr_t dump_avail[PHYS_AVAIL_SIZE + 2]; - int early_boot = 1; int cold = 1; -long realmem = 0; -long Maxmem = 0; #definePHYSMAP_SIZE(2 * (VM_PHYSSEG_MAX - 1)) vm_paddr_t physmap[PHYSMAP_SIZE]; @@ -898,6 +895,8 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_ continue; } + arm_physmem_hardware_region(p->md_phys, + p->md_pages * PAGE_SIZE); if (!add_physmap_entry(p->md_phys, (p->md_pages * PAGE_SIZE), physmap, physmap_idxp)) break; @@ -1026,9 +1025,7 @@ initarm(struct arm64_bootparams *abp) #endif vm_offset_t lastaddr; caddr_t kmdp; - vm_paddr_t mem_len; bool valid; - int i; /* Set the module data location */ preload_metadata = (caddr_t)(uintptr_t)(abp->modulep); @@ -1064,19 +1061,10 @@ initarm(struct arm64_bootparams *abp) panic("Cannot get physical memory regions"); add_fdt_mem_regions(mem_regions, mem_regions_sz, physmap, &physmap_idx); + arm_physmem_hardware_regions(mem_regions, mem_regions_sz); } #endif - /* Print the memory map */ - mem_len = 0; - for (i = 0; i < physmap_idx; i += 2) { - dump_avail[i] = physmap[i]; - dump_avail[i + 1] = physmap[i + 1]; - mem_len += physmap[i + 1] - physmap[i]; - } - dump_avail[i] = 0; - dump_avail[i + 1] = 0; - /* Set the pcpu data, this is needed by pmap_bootstrap */ pcpup = &__pcpu[0]; pcpu_init(pcpup, 0, sizeof(struct pcpu)); @@ -1100,6 +1088,7 @@ initarm(struct arm64_bootparams *abp) /* Bootstrap enough of pmap to enter the kernel proper */ pmap_bootstrap(abp->kern_l0pt, abp->kern_l1pt, KERNBASE - abp->kern_delta, lastaddr - KERNBASE); + arm_physmem_init_kernel_globals(); devmap_bootstrap(0, NULL); Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Tue May 22 11:05:40 2018(r334031) +++ head/sys/arm64/arm64/pmap.c Tue May 22 11:07:04 2018(r334032) @@ -146,6 +146,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #defineNL0PG (PAGE_SIZE/(sizeof (pd_entry_t))) #defineNL1PG (PAGE_SIZE/(sizeof (pd_entry_t))) #defineNL2PG (PAGE_SIZE/(sizeof (pd_entry_t))) @@ -669,16 +671,15 @@ void pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, vm_size_t kernlen) { - u_int l1_slot, l2_slot, avail_slot, map_slot, used_map_slot; + u_int l1_slot, l2_slot; uint64_t kern_delta; pt_entry_t *l2; vm_offset_t va, freemempos; vm_offset_t dpcpu, msgbufpv; - vm_paddr_t pa, max_pa, min_pa; + vm_paddr_t start_pa, pa, max_pa, min_pa; int i; kern_delta = KERNBASE - kernstart; - physmem = 0; printf("pmap_bootstrap %lx %lx %lx\n", l1pt, kernstart, kernlen); printf("%lx\n", l1pt); @@ -708,40 +709,9 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ pmap_bootstrap_dmap(l1pt, min_pa, max_pa); va = KERNBASE; - pa = KERNBASE - kern_delta; + start_pa = pa = KERNBASE - kern_delta; /* -* Start to initialise phys_avail by copying from physmap -* up to the physical address KERNBASE points at. -*/ - map_slot = avail_slot = 0; - for (; map_slot < (physmap_idx * 2) && - avail_slot < (PHYS_AVAIL_SIZE - 2); map
svn commit: r334031 - head/lib/libc/stdio
Author: kib Date: Tue May 22 11:05:40 2018 New Revision: 334031 URL: https://svnweb.freebsd.org/changeset/base/334031 Log: Implement printf(3) family %m format string extension. Reviewed by: ed, dim (code only) Sponsored by: Mellanox Technologies MFC after:1 week Modified: head/lib/libc/stdio/printf.3 head/lib/libc/stdio/vfprintf.c Modified: head/lib/libc/stdio/printf.3 == --- head/lib/libc/stdio/printf.3Tue May 22 10:31:06 2018 (r334030) +++ head/lib/libc/stdio/printf.3Tue May 22 11:05:40 2018 (r334031) @@ -32,7 +32,7 @@ .\" @(#)printf.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 30, 2016 +.Dd May 22, 2018 .Dt PRINTF 3 .Os .Sh NAME @@ -651,6 +651,12 @@ integer indicated by the .Vt "int *" (or variant) pointer argument. No argument is converted. +.It Cm m +Print the string representation of the error code stored in the +.Dv errno +variable at the beginning of the call, as returned by +.Xr strerror 3 . +No argument is taken. .It Cm % A .Ql % @@ -730,6 +736,12 @@ and .Cm \&%U are not standard and are provided only for backward compatibility. +The conversion format +.Cm \&%m +is also not standard and provides the popular extension from the +.Tn GNU C +library. +.Pp The effect of padding the .Cm %p format with zeros (either by the @@ -767,9 +779,11 @@ or the return value would be too large to be represent .El .Sh SEE ALSO .Xr printf 1 , +.Xr errno 2 , .Xr fmtcheck 3 , .Xr scanf 3 , .Xr setlocale 3 , +.Xr strerror 3 , .Xr wprintf 3 .Sh STANDARDS Subject to the caveats noted in the @@ -822,6 +836,12 @@ and .Fn vdprintf functions were added in .Fx 8.0 . +The +.Cm \&%m +format extension first appeared in the +.Tn GNU C +library, and was implemented in +.Fx 12.0 . .Sh BUGS The .Nm Modified: head/lib/libc/stdio/vfprintf.c == --- head/lib/libc/stdio/vfprintf.c Tue May 22 10:31:06 2018 (r334030) +++ head/lib/libc/stdio/vfprintf.c Tue May 22 11:05:40 2018 (r334031) @@ -317,6 +317,7 @@ __vfprintf(FILE *fp, locale_t locale, const char *fmt0 int ret;/* return value accumulator */ int width; /* width from format (%8d), or 0 */ int prec; /* precision from format; <0 for N/A */ + int saved_errno; char sign; /* sign prefix (' ', '+', '-', or \0) */ struct grouping_state gs; /* thousands' grouping info */ @@ -466,6 +467,7 @@ __vfprintf(FILE *fp, locale_t locale, const char *fmt0 savserr = fp->_flags & __SERR; fp->_flags &= ~__SERR; + saved_errno = errno; convbuf = NULL; fmt = (char *)fmt0; argtable = NULL; @@ -776,6 +778,11 @@ fp_common: } break; #endif /* !NO_FLOATING_POINT */ + case 'm': + cp = strerror(saved_errno); + size = (prec >= 0) ? strnlen(cp, prec) : strlen(cp); + sign = '\0'; + break; case 'n': /* * Assignment-like behavior is specified if the ___ 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: r334030 - head/sys/arm/arm
Author: andrew Date: Tue May 22 10:31:06 2018 New Revision: 334030 URL: https://svnweb.freebsd.org/changeset/base/334030 Log: Allow the 32-bit arm physmem code to work on arm64. This will help simplify the arm64 code and allow us to properly exclude memory that should never be mapped. Obtained from:ABT Systems Ltd Sponsored by: Turing Robotic Industries Modified: head/sys/arm/arm/physmem.c Modified: head/sys/arm/arm/physmem.c == --- head/sys/arm/arm/physmem.c Tue May 22 10:23:12 2018(r334029) +++ head/sys/arm/arm/physmem.c Tue May 22 10:31:06 2018(r334030) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include /* * These structures are used internally to keep track of regions of physical @@ -51,7 +51,13 @@ __FBSDID("$FreeBSD$"); #defineMAX_HWCNT 10 #defineMAX_EXCNT 10 +#if defined(__arm__) #defineMAX_PHYS_ADDR 0xull +#definepm_btop(x) arm32_btop(x) +#elif defined(__aarch64__) +#defineMAX_PHYS_ADDR 0xull +#definepm_btop(x) arm64_btop(x) +#endif struct region { vm_paddr_t addr; @@ -175,7 +181,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) { start = hwp->addr; end = hwp->size + start; - realmem += arm32_btop((vm_offset_t)(end - start)); + realmem += pm_btop((vm_offset_t)(end - start)); for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) { /* * If the excluded region does not match given flags, @@ -223,8 +229,8 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, avail[acnt++] = (vm_paddr_t)start; avail[acnt++] = (vm_paddr_t)xstart; } - availmem += - arm32_btop((vm_offset_t)(xstart - start)); + availmem += + pm_btop((vm_offset_t)(xstart - start)); start = xend; continue; } @@ -249,7 +255,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, avail[acnt++] = (vm_paddr_t)start; avail[acnt++] = (vm_paddr_t)end; } - availmem += arm32_btop((vm_offset_t)(end - start)); + availmem += pm_btop((vm_offset_t)(end - start)); } if (acnt >= MAX_AVAIL_ENTRIES) panic("Not enough space in the dump/phys_avail arrays"); ___ 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: r334028 - head/sys/arm/arm
Author: andrew Date: Tue May 22 10:14:20 2018 New Revision: 334028 URL: https://svnweb.freebsd.org/changeset/base/334028 Log: Coalesce adjacent physical mappings. This reduces the overhead when we have many small mappings, e.g. on some EFI systems. This is to help use this code on arm64 where we may have a large number of entries from the EFI firmware. Obtained from:ABT Systems Ltd Sponsored by: Turing Robotic Industries Differential Revision:https://reviews.freebsd.org/D15477 Modified: head/sys/arm/arm/physmem.c Modified: head/sys/arm/arm/physmem.c == --- head/sys/arm/arm/physmem.c Tue May 22 08:51:16 2018(r334027) +++ head/sys/arm/arm/physmem.c Tue May 22 10:14:20 2018(r334028) @@ -216,8 +216,13 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, * could affect the remainder of this hw region. */ if ((xstart > start) && (xend < end)) { - avail[acnt++] = (vm_paddr_t)start; - avail[acnt++] = (vm_paddr_t)xstart; + if (acnt > 0 && + avail[acnt - 1] == (vm_paddr_t)start) { + avail[acnt - 1] = (vm_paddr_t)xstart; + } else { + avail[acnt++] = (vm_paddr_t)start; + avail[acnt++] = (vm_paddr_t)xstart; + } availmem += arm32_btop((vm_offset_t)(xstart - start)); start = xend; @@ -238,8 +243,12 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, * available entry for it. */ if (end > start) { - avail[acnt++] = (vm_paddr_t)start; - avail[acnt++] = (vm_paddr_t)end; + if (acnt > 0 && avail[acnt - 1] == (vm_paddr_t)start) { + avail[acnt - 1] = (vm_paddr_t)end; + } else { + avail[acnt++] = (vm_paddr_t)start; + avail[acnt++] = (vm_paddr_t)end; + } availmem += arm32_btop((vm_offset_t)(end - start)); } if (acnt >= MAX_AVAIL_ENTRIES) @@ -254,7 +263,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, /* * Insertion-sort a new entry into a regions list; sorted by start address. */ -static void +static size_t insert_region(struct region *regions, size_t rcnt, vm_paddr_t addr, vm_size_t size, uint32_t flags) { @@ -263,6 +272,16 @@ insert_region(struct region *regions, size_t rcnt, vm_ ep = regions + rcnt; for (i = 0, rp = regions; i < rcnt; ++i, ++rp) { + if (flags == rp->flags) { + if (addr + size == rp->addr) { + rp->addr = addr; + rp->size += size; + return (rcnt); + } else if (rp->addr + rp->size == addr) { + rp->size += size; + return (rcnt); + } + } if (addr < rp->addr) { bcopy(rp, rp + 1, (ep - rp) * sizeof(*rp)); break; @@ -271,6 +290,9 @@ insert_region(struct region *regions, size_t rcnt, vm_ rp->addr = addr; rp->size = size; rp->flags = flags; + rcnt++; + + return (rcnt); } /* @@ -322,7 +344,7 @@ arm_physmem_hardware_region(uint64_t pa, uint64_t sz) sz = trunc_page(sz - adj); if (sz > 0 && hwcnt < nitems(hwregions)) - insert_region(hwregions, hwcnt++, pa, sz, 0); + hwcnt = insert_region(hwregions, hwcnt, pa, sz, 0); } /* @@ -341,7 +363,7 @@ void arm_physmem_exclude_region(vm_paddr_t pa, vm_size sz = round_page(sz + adj); if (excnt < nitems(exregions)) - insert_region(exregions, excnt++, pa, sz, exflags); + excnt = insert_region(exregions, excnt, pa, sz, exflags); } /* ___ 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: r333919 - in head/contrib/file: . doc magic magic/Magdir python src tests
On Mon, 21 May 2018 00:10:23 +0200 Antoine Brodin wrote: > On Sun, May 20, 2018 at 10:39 PM, Antoine Brodin wrote: >> On Sun, May 20, 2018 at 10:30 PM, Antoine Brodin >> wrote: >>> On Sun, May 20, 2018 at 7:06 AM, Eitan Adler wrote: Author: eadler Date: Sun May 20 05:06:42 2018 New Revision: 333919 URL: https://svnweb.freebsd.org/changeset/base/333919 Log: MFV: file 5.33 Merge the latest file(1) in. Relevent Changelog: - extend the support for ${x?:} expansions for magic descriptions - add support for ${x?:} in mime types to handle pie binaries. - add support for negative offsets (offsets from the end of file) - close the file on error when writing magic Relnotes: yes >>> >>> This breaks the ports tree, please revert and request an exp-run. >> >> At least revert the changes to contrib/file/magic/Magdir/elf > > The problematic part was reverted in r333944 Seems to affect libraries that are installed +x. ___ 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: r333995 - head/sys/teken
Hi Bruce, 2018-05-22 3:18 GMT+02:00 Bruce Evans : > DECSCUSR is a verbose yet cryptic abbreviation which is not even expanded > its name. It is the only abbreviation longer than 7 characters. This > messes up the souce formatting. Yeah, it's a bit silly, but that's simply how it's called: https://vt100.net/docs/vt510-rm/DECSCUSR.html I think the state machine generator doesn't mind if we added an extra tab between all other entries to get it to line up again. Maybe that does push us over 80 columns, though... -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands ___ 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: r334027 - head/sys/dev/xen/blkback
Author: royger Date: Tue May 22 08:51:16 2018 New Revision: 334027 URL: https://svnweb.freebsd.org/changeset/base/334027 Log: xen-blkback: do not use state 3 (XenbusStateInitialised) Linux will not connect to a backend that's in state 3 (XenbusStateInitialised), it needs to be in state 2 (XenbusStateInitWait) for Linux to attempt to connect to the backend. The protocol seems to suggest that the backend should indeed wait in state 2 for the frontend to connect, which makes state 3 unusable for disk backends. Also make sure blkback will connect to the frontend if the frontend reaches state 3 (XenbusStateInitialised) before blkback has processed the results from the hotplug script (Submitted by Nathan Friess). MFC after:1 week Modified: head/sys/dev/xen/blkback/blkback.c Modified: head/sys/dev/xen/blkback/blkback.c == --- head/sys/dev/xen/blkback/blkback.c Tue May 22 08:27:33 2018 (r334026) +++ head/sys/dev/xen/blkback/blkback.c Tue May 22 08:51:16 2018 (r334027) @@ -806,6 +806,9 @@ struct xbb_softc { /** Watch to wait for hotplug script execution */ struct xs_watch hotplug_watch; + + /** Got the needed data from hotplug scripts? */ + bool hotplug_done; }; /* Request Processing */ @@ -3310,12 +3313,11 @@ xbb_connect(struct xbb_softc *xbb) { int error; - if (xenbus_get_state(xbb->dev) != XenbusStateInitialised) + if (!xbb->hotplug_done || + (xenbus_get_state(xbb->dev) != XenbusStateInitWait) || + (xbb_collect_frontend_info(xbb) != 0)) return; - if (xbb_collect_frontend_info(xbb) != 0) - return; - xbb->flags &= ~XBBF_SHUTDOWN; /* @@ -3412,6 +3414,7 @@ xbb_shutdown(struct xbb_softc *xbb) free(xbb->hotplug_watch.node, M_XENBLOCKBACK); xbb->hotplug_watch.node = NULL; } + xbb->hotplug_done = false; if (xenbus_get_state(xbb->dev) < XenbusStateClosing) xenbus_set_state(xbb->dev, XenbusStateClosing); @@ -3692,8 +3695,11 @@ xbb_attach_disk(struct xs_watch *watch, const char **v return; } - /* Tell the front end that we are ready to connect. */ - xenbus_set_state(dev, XenbusStateInitialised); + xbb->hotplug_done = true; + + /* The front end might be waiting for the backend, attach if so. */ + if (xenbus_get_otherend_state(xbb->dev) == XenbusStateInitialised) + xbb_connect(xbb); } /** @@ -3757,6 +3763,7 @@ xbb_attach(device_t dev) * We need to wait for hotplug script execution before * moving forward. */ + KASSERT(!xbb->hotplug_done, ("Hotplug scripts already executed")); watch_path = xs_join(xenbus_get_node(xbb->dev), "physical-device-path"); xbb->hotplug_watch.callback_data = (uintptr_t)dev; xbb->hotplug_watch.callback = xbb_attach_disk; ___ 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: r334026 - head/sys/kern
Author: mjg Date: Tue May 22 08:27:33 2018 New Revision: 334026 URL: https://svnweb.freebsd.org/changeset/base/334026 Log: Reduce sdt-related branch-fest in mi_switch. The code was evaluating flags before resorting to checking if dtrace is enabled. This was inducing forward jumps in the common case. Modified: head/sys/kern/kern_synch.c Modified: head/sys/kern/kern_synch.c == --- head/sys/kern/kern_synch.c Tue May 22 07:56:58 2018(r334025) +++ head/sys/kern/kern_synch.c Tue May 22 08:27:33 2018(r334026) @@ -431,8 +431,9 @@ mi_switch(int flags, struct thread *newtd) CTR4(KTR_PROC, "mi_switch: old thread %ld (td_sched %p, pid %ld, %s)", td->td_tid, td_get_sched(td), td->td_proc->p_pid, td->td_name); #ifdef KDTRACE_HOOKS - if ((flags & SW_PREEMPT) != 0 || ((flags & SW_INVOL) != 0 && - (flags & SW_TYPE_MASK) == SWT_NEEDRESCHED)) + if (__predict_false(sdt_probes_enabled) && + ((flags & SW_PREEMPT) != 0 || ((flags & SW_INVOL) != 0 && + (flags & SW_TYPE_MASK) == SWT_NEEDRESCHED))) SDT_PROBE0(sched, , , preempt); #endif sched_switch(td, newtd, 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"
Re: svn commit: r333995 - head/sys/teken
Am 22.05.18 um 03:18 schrieb Bruce Evans: > On Mon, 21 May 2018, [UTF-8] Jean-Sébastien Pédron wrote: >> -CS Cursor style ^[ [ SP q r >> +DECSCUSR Set Cursor Style ^[ [ SP q r >> DA1 Primary Device Attributes ^[ [ c r >> DA2 Secondary Device Attributes ^[ [ > c r >> DC Delete character ^[ [ P n > > Any chance of keeping this file sorted? > > DECSCUSR is a verbose yet cryptic abbreviation which is not even expanded > its name. It is the only abbreviation longer than 7 characters. This messes > up the souce formatting. > > Not expanding DEC in the name is normal, but other letters are normally > expanded. I don't know what USR is. It looks like a bad abbreviation > for "user". 'S' in it might mean style. DECSCUSR = DEC SetCUrSoR ... (not quite so) obviously ;-) Regards, STefan ___ 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: r334008 - head/bin/sh
On Mon, 21 May 2018 21:45:53 -0700 Cy Schubert wrote: > In message <20180522061339.21497...@freyja.zeit4.iv.bundesimmobilien.de> > , "O. H > artmann" writes: > > On Mon, 21 May 2018 21:52:48 + (UTC) > > Jilles Tjoelker wrote: > > > > > Author: jilles > > > Date: Mon May 21 21:52:48 2018 > > > New Revision: 334008 > > > URL: https://svnweb.freebsd.org/changeset/base/334008 > > > > > > Log: > > > sh: Split CNL syntax category to avoid a check on state[level].syntax > > > > > > No functional change is intended. > > > > > > Modified: > > > head/bin/sh/mksyntax.c > > > head/bin/sh/parser.c > > > > > > Modified: head/bin/sh/mksyntax.c > > > === > > > > > === > > > --- head/bin/sh/mksyntax.cMon May 21 21:44:47 2018 > > > (r334007) +++ head/bin/sh/mksyntax.c Mon May 21 21:52:48 > > > 2018 (r334008) @@ -65,6 +65,7 @@ struct synclass { > > > static const struct synclass synclass[] = { > > > { "CWORD", "character is nothing special" }, > > > { "CNL","newline character" }, > > > + { "CQNL", "newline character in quotes" }, > > > { "CBACK", "a backslash character" }, > > > { "CSBACK", "a backslash character in single quotes" }, > > > { "CSQUOTE","single quote" }, > > > @@ -185,7 +186,7 @@ main(int argc __unused, char **argv __unused) > > > fputs("\n/* syntax table used when in double quotes */\n", > > > cfile); init("dqsyntax"); > > > add_default(); > > > - add("\n", "CNL"); > > > + add("\n", "CQNL"); > > > add("\\", "CBACK"); > > > add("\"", "CENDQUOTE"); > > > add("`", "CBQUOTE"); > > > @@ -198,7 +199,7 @@ main(int argc __unused, char **argv __unused) > > > fputs("\n/* syntax table used when in single quotes */\n", > > > cfile); init("sqsyntax"); > > > add_default(); > > > - add("\n", "CNL"); > > > + add("\n", "CQNL"); > > > add("\\", "CSBACK"); > > > add("'", "CENDQUOTE"); > > > /* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */ > > > @@ -208,7 +209,7 @@ main(int argc __unused, char **argv __unused) > > > fputs("\n/* syntax table used when in arithmetic */\n", cfile); > > > init("arisyntax"); > > > add_default(); > > > - add("\n", "CNL"); > > > + add("\n", "CQNL"); > > > add("\\", "CBACK"); > > > add("`", "CBQUOTE"); > > > add("\"", "CIGN"); > > > > > > Modified: head/bin/sh/parser.c > > > === > > > > > === > > > --- head/bin/sh/parser.c Mon May 21 21:44:47 2018(r334007) > > > +++ head/bin/sh/parser.c Mon May 21 21:52:48 2018(r334008) > > > @@ -1434,9 +1434,10 @@ readtoken1(int firstc, char const *initialsyntax, > > > co > > ns > > > > > > switch(synentry) { > > > case CNL: /* '\n' */ > > > - if (level == 0 && > > > - state[level].syntax == BASESYNTAX) > > > + if (level == 0) > > > goto endword; /* exit > > > outer loop */ > > > + /* FALLTHROUGH */ > > > + case CQNL: > > > USTPUTC(c, out); > > > plinno++; > > > if (doprompt) > > > ___ > > > 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" > > > > > > Have this been tested? Doesn't compile for me: > > > > [...] > > Building /usr/obj/usr/src/amd64.amd64/kerberos5/libexec/hprop/hprop > > --- all_subdir_rescue --- > > --- parser.o --- > > /usr/src/bin/sh/parser.c:1440:9: error: use of undeclared identifier 'CQNL' > > case CQNL: > > ^ > > --- all_subdir_gnu --- > > Building /usr/obj/usr/src/amd64.amd64/gnu/usr.bin/gdb/libgdb/amd64bsd-nat.o > > --- all_subdir_rescue --- > > 1 error generated. > > *** [parser.o] Error code 1 > > > > make[6]: stopped in /usr/src/bin/sh > > > > CQNL is defined in /usr/obj/opt/src/svn-current/amd64.amd64/bin/sh/synta > x.h, generated by mksyntax. > > slippy$ ag -s CQNL /export/obj/opt/src/svn-current/amd64.amd64/bin/sh/*. > h > /export/obj/opt/src/svn-current/amd64.amd64/bin/sh/syntax.h > 11:#define CQNL 2 /* newline character in quotes */ > slippy$ > > Remove the file if it's not defined in your syntax.h. > > Just out of interest, do you use meta mode? I think such a question is of common interest if errors/bugs like that occur: Yes, I use/compile world/kernel with META mode. > > Thanks, kind regards, oh ___ 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: r334025 - head/usr.bin/top
Author: eadler Date: Tue May 22 07:56:58 2018 New Revision: 334025 URL: https://svnweb.freebsd.org/changeset/base/334025 Log: top(1): increase size of 'status' buffer This corrects a warning issues by gcc9: /srv/src/freebsd/head/usr.bin/top/machine.c:988:22: warning: '%5zu' directive writing between 5 and 20 bytes into a region of size 15 [-Wformat-overflow=] sprintf(status, "?%5zu", state); Modified: head/usr.bin/top/machine.c Modified: head/usr.bin/top/machine.c == --- head/usr.bin/top/machine.c Tue May 22 07:20:22 2018(r334024) +++ head/usr.bin/top/machine.c Tue May 22 07:56:58 2018(r334025) @@ -920,7 +920,7 @@ format_next_process(caddr_t xhandle, char *(*get_useri long cputime; double pct; struct handle *hp; - char status[16]; + char status[22]; int cpu; size_t state; struct rusage ru, *rup; ___ 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: r333968 - in head/sys: netinet netinet6
On Tue, May 22, 2018 at 00:33 Eitan Adler wrote: > On 21 May 2018 at 01:34, Matt Macy wrote: > > Author: mmacy > > Date: Mon May 21 08:34:10 2018 > > New Revision: 333968 > > URL: https://svnweb.freebsd.org/changeset/base/333968 > > > > Log: > > in(6)_mcast: Expand out vnet set / restore macro so that they work in > a conditional block > > Why not simply add missing {} s or modifying the macro to use "do { } > while(false)" ? > It declares variables which would go out of scope. > -- > Eitan Adler > ___ 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: r333968 - in head/sys: netinet netinet6
On 21 May 2018 at 01:34, Matt Macy wrote: > Author: mmacy > Date: Mon May 21 08:34:10 2018 > New Revision: 333968 > URL: https://svnweb.freebsd.org/changeset/base/333968 > > Log: > in(6)_mcast: Expand out vnet set / restore macro so that they work in a > conditional block Why not simply add missing {} s or modifying the macro to use "do { } while(false)" ? -- Eitan Adler ___ 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: r333994 - in head/sys: dev/acpica kern sys
On Mon, May 21, 2018 at 08:23:04PM +, Andriy Gapon wrote: > New Revision: 333994 > URL: https://svnweb.freebsd.org/changeset/base/333994 > > Log: > stop and restart kernel event timers in the suspend / resume cycle > > I have a system that is very unstable after resuming from suspend-to-RAM > but only if HPET is used as the event timer. [...] I'm super-excited to see suspend/resume fixes coming from you Andriy, thanks for doing that. Let's see less macOS and more FreeBSD on laptops at conferences! :-P ./danfe ___ 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: r334024 - in head/sys: kern sys
Author: mjg Date: Tue May 22 07:20:22 2018 New Revision: 334024 URL: https://svnweb.freebsd.org/changeset/base/334024 Log: sx: port over writer starvation prevention measures from rwlock A constant stream of readers could completely starve writers and this is not a hypothetical scenario. The 'poll2_threads' test from the will-it-scale suite reliably starves writers even with concurrency < 10 threads. The problem was run into and diagnosed by dil...@backplane.com There was next to no change in lock contention profile during -j 128 pkg build, despite an sx lock being at the top. Tested by:pho Modified: head/sys/kern/kern_sx.c head/sys/kern/subr_trap.c head/sys/sys/proc.h head/sys/sys/sx.h Modified: head/sys/kern/kern_sx.c == --- head/sys/kern/kern_sx.c Tue May 22 07:16:39 2018(r334023) +++ head/sys/kern/kern_sx.c Tue May 22 07:20:22 2018(r334024) @@ -292,6 +292,7 @@ sx_try_slock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF) LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(sx__acquire, sx, 0, 0, file, line, LOCKSTAT_READER); TD_LOCKS_INC(curthread); + curthread->td_sx_slocks++; return (1); } } @@ -441,7 +442,7 @@ sx_try_upgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DE for (;;) { if (SX_SHARERS(x) > 1) break; - waiters = (x & SX_LOCK_EXCLUSIVE_WAITERS); + waiters = (x & SX_LOCK_WAITERS); if (atomic_fcmpset_acq_ptr(&sx->sx_lock, &x, (uintptr_t)curthread | waiters)) { success = 1; @@ -450,6 +451,7 @@ sx_try_upgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DE } LOCK_LOG_TRY("XUPGRADE", &sx->lock_object, 0, success, file, line); if (success) { + curthread->td_sx_slocks--; WITNESS_UPGRADE(&sx->lock_object, LOP_EXCLUSIVE | LOP_TRYLOCK, file, line); LOCKSTAT_RECORD0(sx__upgrade, sx); @@ -526,6 +528,7 @@ sx_downgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF) kick_proc0(); out: + curthread->td_sx_slocks++; LOCK_LOG_LOCK("XDOWNGRADE", &sx->lock_object, 0, 0, file, line); LOCKSTAT_RECORD0(sx__downgrade, sx); } @@ -537,6 +540,23 @@ sx_downgrade_(struct sx *sx, const char *file, int lin sx_downgrade_int(sx LOCK_FILE_LINE_ARG); } +#ifdef ADAPTIVE_SX +static inline void +sx_drop_critical(uintptr_t x, bool *in_critical, int *extra_work) +{ + + if (x & SX_LOCK_WRITE_SPINNER) + return; + if (*in_critical) { + critical_exit(); + *in_critical = false; + (*extra_work)--; + } +} +#else +#define sx_drop_critical(x, in_critical, extra_work) do { } while(0) +#endif + /* * This function represents the so-called 'hard case' for sx_xlock * operation. All 'easy case' failures are redirected to this. Note @@ -547,12 +567,13 @@ int _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LOCK_FILE_LINE_ARG_DEF) { GIANT_DECLARE; - uintptr_t tid; + uintptr_t tid, setx; #ifdef ADAPTIVE_SX volatile struct thread *owner; u_int i, n, spintries = 0; enum { READERS, WRITER } sleep_reason = READERS; bool adaptive; + bool in_critical = false; #endif #ifdef LOCK_PROFILING uint64_t waittime = 0; @@ -569,6 +590,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO #endif #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING) uintptr_t state = 0; + int doing_lockprof = 0; #endif int extra_work = 0; @@ -581,12 +603,14 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO goto out_lockstat; } extra_work = 1; + doing_lockprof = 1; all_time -= lockstat_nsecs(&sx->lock_object); state = x; } #endif #ifdef LOCK_PROFILING extra_work = 1; + doing_lockprof = 1; state = x; #endif @@ -653,6 +677,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO * running or the state of the lock changes. */ if ((x & SX_LOCK_SHARED) == 0) { + sx_drop_critical(x, &in_critical, &extra_work); sleep_reason = WRITER; owner = lv_sx_owner(x); if (!TD_IS_RUNNING(owner)) @@ -675,17 +700,35 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO sleep_reason = READERS; if (spintries == asx_retries) goto sleepq; + if (!(x & SX_LOCK_WRITE_SPINNER)) { +
svn commit: r334023 - head/sys/kern
Author: mjg Date: Tue May 22 07:16:39 2018 New Revision: 334023 URL: https://svnweb.freebsd.org/changeset/base/334023 Log: rw: decrease writer starvation Writers waiting on readers to finish can set the RW_LOCK_WRITE_SPINNER bit. This prevents most new readers from coming on. However, the last reader to unlock also clears the bit which means new readers can sneak in and the cycle starts over. Change the code to keep the bit after last unlock. Note that starvation potential is still there: no matter how many write spinners are there, there is one bit. After the writer unlocks, the lock is free to get raided by readers again. It is good enough for the time being. The real fix would include counting writers. This runs into a caveat: the writer which set the bit may now be preempted. In order to get rid of the problem all attempts to set the bit are preceeded with critical_enter. The bit gets cleared when the thread which set it goes to sleep. This way an invariant holds that if the bit is set, someone is actively spinning and will grab the lock soon. In particular this means that readers which find the lock in this transient state can safely spin until the lock finds itself an owner (i.e. they don't need to block nor speculate how long to spin speculatively). Tested by:pho Modified: head/sys/kern/kern_rwlock.c Modified: head/sys/kern/kern_rwlock.c == --- head/sys/kern/kern_rwlock.c Tue May 22 06:22:58 2018(r334022) +++ head/sys/kern/kern_rwlock.c Tue May 22 07:16:39 2018(r334023) @@ -510,25 +510,38 @@ __rw_rlock_hard(struct rwlock *rw, struct thread *td, sched_tdname(curthread), "running"); continue; } - } else if (spintries < rowner_retries) { - spintries++; - KTR_STATE1(KTR_SCHED, "thread", sched_tdname(curthread), - "spinning", "lockname:\"%s\"", - rw->lock_object.lo_name); - for (i = 0; i < rowner_loops; i += n) { - n = RW_READERS(v); - lock_delay_spin(n); + } else { + if ((v & RW_LOCK_WRITE_SPINNER) && RW_READERS(v) == 0) { + MPASS(!__rw_can_read(td, v, false)); + lock_delay_spin(2); v = RW_READ_VALUE(rw); - if ((v & RW_LOCK_READ) == 0 || __rw_can_read(td, v, false)) - break; + continue; } + if (spintries < rowner_retries) { + spintries++; + KTR_STATE1(KTR_SCHED, "thread", sched_tdname(curthread), + "spinning", "lockname:\"%s\"", + rw->lock_object.lo_name); + n = RW_READERS(v); + for (i = 0; i < rowner_loops; i += n) { + lock_delay_spin(n); + v = RW_READ_VALUE(rw); + if (!(v & RW_LOCK_READ)) + break; + n = RW_READERS(v); + if (n == 0) + break; + if (__rw_can_read(td, v, false)) + break; + } #ifdef KDTRACE_HOOKS - lda.spin_cnt += rowner_loops - i; + lda.spin_cnt += rowner_loops - i; #endif - KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), - "running"); - if (i < rowner_loops) - continue; + KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), + "running"); + if (i < rowner_loops) + continue; + } } #endif @@ -546,7 +559,8 @@ __rw_rlock_hard(struct rwlock *rw, struct thread *td, */ v = RW_READ_VALUE(rw); retry_ts: - if (__rw_can_read(td, v, false)) { + if (((v & RW_LOCK_WRITE_SPINNER) && RW_READERS(v) == 0) || + __rw_can_read(td, v, false)) { turnstile_cancel(ts); continue; } @@ -726,11 +740,7 @@ __rw_runlock_try(struct rwlock *rw, struct thread *td,