Commit Graph

240738 Commits

Author SHA1 Message Date
skrll 19b4c45621 Actually, descsz should not contain the padding. The note still needs to
be padded out.
2016-02-09 10:20:03 +00:00
ozaki-r 9c4cd06355 Introduce softint-based if_input
This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
2016-02-09 08:32:07 +00:00
skrll b0bef51c1f Preserve the .text section alignment 2016-02-08 21:08:03 +00:00
pooka 09c0762f99 Allocate struct cpu_info dynamically. Saves quite a lot of BSS in the
common case and reduces rump kernel memory requirements by 10% or more
in really tiny deployments.
2016-02-08 18:18:19 +00:00
christos 6b42622b31 UTF-8 fixes from Ingo Schwarze:
1. Assume that errno is non-zero when entering read_char()
    and that read(2) returns 0 (indicating end of file).
    Then, the code will clear errno before returning.
    (Obviously, the statement "errno = 0" is almost always
     a bug unless there is save_errno = errno right before it
     and the previous value is properly restored later,
     in all reachable code paths.)

 2. When encountering an invalid byte sequence, the code discards
    all following bytes until MB_LEN_MAX overflows; consider, for
    example, 0xc2 immediately followed by a few valid ASCII bytes.
    Three of those ASCII bytes will be discarded.

 3. On a POSIX system, EILSEQ will always be set after reading a
    valid (yes, valid, not invalid!) UTF-8 character.  The reason
    is that mbtowc(3) will first be called with a length limit
    (third argument) of 1, which will fail, return -1, and - on
    a POSIX system - set errno to EILSEQ.
    This third bug is mitigated a bit because i couldn't find any
    system that actually conforms to POSIX in this respect:  None
    of OpenBSD, NetBSD, FreeBSD, Solaris 11, and glibc set errno
    when an incomplete character is passed to mbtowc(3), even though
    that is required by POSIX.
    Anyway, that mbtowc(3) bug will be fixed at least in OpenBSD
    after release unlock, so it would be good to fix this bug in
    libedit before fixing the bug in mbtowc(3).

How can these three bugs be fixed?

 1. As far as i understand it, the intention of the bogus errno = 0
    is to undo the effects of failing system calls in el_wset(),
    sig_set(), and read__fixio() if the subsequent read(2) indicates
    end of file.  So, restoring errno has to be moved right after
    read__fixio().  Of course, neither 0 nor e is the right value
    to restore: 0 is wrong if errno happened to be set on entry, e
    would be wrong because if one read(2) fails but a second attempt
    succeeds after read__fixio(), errno should not be touched.  So,
    the errno to be restored in this case has to be saved before
    calling read(2) for the first time.

 2. Solving the second issue requires distinguishing invalid and
    incomplete characters, but that is impossible with the function
    mbtowc(3) because it returns -1 in both cases and sets errno
    to EILSEQ in both cases (once properly implemented).

    It is vital that each input character is processed right away.
    It is not acceptable to wait for the next input character before
    processing the previous one because this is an interactive
    library, not a batch system.  Consequently, the only situation
    where it is acceptable to wait for the next byte without first
    processing the previous one(s) is when the previous one(s) form
    an incomplete sequence that can be continued to form a valid
    character.

    Consequently, short of reimplementing a full UTF-8 state machine
    by hand, the only correct way forward is to use mbrtowc(3).
    Even then, care is needed to always have the state object
    properly initialized before using it, and to not discard a valid
    ASCII or UTF-8 lead byte if it happens to follow an invalid
    sequence.

 3. Fortunately, solution 2. also solves issue 3. as a side effect,
    by no longer using mbtowc(3) in the first place.
2016-02-08 17:18:43 +00:00
christos 451f7eb546 PR/50783: David Binderman: Indent switch properly, add missing break. 2016-02-08 16:44:45 +00:00
christos 07013d3bf0 PR/50784: David Binderman: Add missing braces, this is not python. 2016-02-08 16:42:04 +00:00
christos f171510204 PR/50785: David Binderman: Remove dead code. 2016-02-08 16:27:51 +00:00
skrll a5b645efc7 Fix .note.netbsd.march by ensuring correct padding 2016-02-08 11:59:39 +00:00
skrll d0d6f47d6b Remove the .SUNW_ctf sections when converting form ELF -> a.out by
updating OBJCOPY_ELF2AOUT_FLAGS
2016-02-08 10:39:09 +00:00
dholland 7fd2abea9a whitespace 2016-02-08 05:27:24 +00:00
christos 321e8935a4 don't re-define _KERNTYPES 2016-02-07 21:03:49 +00:00
riastradh 16f79cd0ea Use IPL_NONE for pserialized lock. Assert sleepable. (OOPS.) 2016-02-07 18:41:25 +00:00
christos 180d9e44e1 fix pasto 2016-02-07 14:31:21 +00:00
wiz bfbface83a New sentence, new line. 2016-02-07 14:06:04 +00:00
jandberg c74496ca0f Add the copyright notice which was missing from my initial version. 2016-02-07 10:46:08 +00:00
agc 9723718822 Fix signing of in-memory data with SSH keys 2016-02-07 05:03:36 +00:00
pgoyette c1df4ef16b In module_do_load(), consolidate checking for a pre-existing module,
and return a single error value EEXIST.  When making a recursive
call (to load required modules), treat a pre-existing module as
success.

Without this change, when a module was loaded by specific request
(as opposed to being loaded as a requirement of some other module),
we would always load the module from the file-system, and then
after making various sanity/compatability checks we would destroy
the new copy if there was a pre-existing copy.

Fixes PR kern/40764

XXX Note that if the module exists, we bypass all of the various
XXX "compatability" checks, including whether or not the existing
XXX module is of any particular class!  (In the previous code, we
XXX checked to see if the newly-loaded copy had the correct class,
XXX but not the pre-existing copy, which could have been loaded
XXX from a different path/filename.)
2016-02-06 22:48:07 +00:00
christos 54835745af use sizeof() and array notation. 2016-02-06 21:23:09 +00:00
riastradh 1b08af128c No <immintrin.h> for pcc even on x86. 2016-02-06 20:23:39 +00:00
joerg bb694db2f5 METEORGSIGNAL and METEORSFMT overlap with dtrace, prefer the latter. 2016-02-06 20:21:56 +00:00
jandberg e09dd753e1 Fix some awkward language in manpage and code comments. 2016-02-06 20:20:18 +00:00
riastradh 5e51ceb9a4 Add $NetBSD$ tag. 2016-02-06 20:19:28 +00:00
riastradh 5f6d9a7f5f Avoid shadowing global. 2016-02-06 19:33:07 +00:00
joerg 1903f8c159 Override default LIB_PATH for i386 emulation. Unlike older binutils, we
now have to check the emulation and not that the target as the change
otherwise leaks into the native 64bit linker scripts as well.
2016-02-06 19:22:00 +00:00
joerg 6068ebb4ad We don't want to target-specific search directories on NetBSD in the
linker scripts, they just add noise.
2016-02-06 19:20:49 +00:00
joerg 9ba8249836 Avoid empty loop. 2016-02-06 18:23:26 +00:00
joerg 66313330f0 SDT is not a disease. Use const consistently. 2016-02-06 18:19:59 +00:00
riz 91a33a8e4a Back out unintended changes committed with last. 2016-02-06 16:58:31 +00:00
riz 50bf67899c Don't test dtrace-related variables until after they've been set. 2016-02-06 16:56:23 +00:00
riastradh 2159786ee7 Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.
This file is used in tools, where _BSD_SIZE_T_ is unreliable.  In the
kernel, <sys/types.h> will define size_t anyway.  Outside the kernel,
<stddef.h> is the standard way to get size_t.
2016-02-06 15:36:36 +00:00
joerg 9cb0d31c43 Toolify. 2016-02-06 14:11:58 +00:00
mlelstv bbd8666d0f Split case folding table into separate source file and add full
copyright and permission notice from http://www.unicode.org/copyright.html
2016-02-06 10:40:58 +00:00
mlelstv c153503310 fix usage message 2016-02-06 10:35:58 +00:00
riastradh 3b7052de65 Avoid shadowing global `min'. 2016-02-06 02:40:49 +00:00
riastradh 98b6c9f000 Convert bool to target type before shift. 2016-02-06 02:39:51 +00:00
riastradh e3e7bedb8f Avoid shadowing global `min'. 2016-02-06 02:39:18 +00:00
riastradh 843556aa56 Missed a spot. 2016-02-06 01:59:55 +00:00
riastradh cd82f6357a Avoid shadowing global `max' from libkern. 2016-02-06 01:51:39 +00:00
riastradh ef3b32b25e Don't return void.
Caught by pcc.  Thanks, pcc!
2016-02-06 00:31:58 +00:00
riastradh ae6fa52c2a More useful array bounds check for enum values. 2016-02-05 23:49:26 +00:00
riastradh c16e1a78e3 Omit unused definition of readw. 2016-02-05 23:46:40 +00:00
riastradh 74d7cf9b83 Don't ask `size < 0' when size is unsigned. 2016-02-05 23:45:44 +00:00
riastradh 8e1ee72c35 Need nbtool_config.h for __dead in tools. 2016-02-05 20:39:50 +00:00
riastradh 32e3d5d381 Need nbtools_config.h for __unused.
Fixes

.../src/tools/ctfmerge/../../external/cddl/osnet/dist/tools/ctf/common/list.c:73:47: error: expected ';', ',' or ')' before '__unused'
 list_defcmp(void *d1, void *d2, void *private __unused)
                                               ^~~~~~~~

on non-NetBSD systems, where <assert.h>, <stdlib.h>, <stdio.h>, and
<sys/types.h> don't define __unused.
2016-02-05 19:56:00 +00:00
roy e0e130b7f2 World+dog want to treat rdl_path as char, so make it so. 2016-02-05 17:20:54 +00:00
skrll 178de58605 Use the port status straight after the reset and not after the
usbd_clear_port_feature(dev, port, UHF_C_PORT_RESET)

The Gadget USB HUB in the IBM x3250 sborrill sent me returns the wrong
status and this would appear to leave the attached cdce(4) in the default
state.  The next device probed fails as a result.
2016-02-05 15:41:49 +00:00
roy 51cc62e4dc Fix is defined in wpa_common.h which the driver already pulls in. 2016-02-05 15:05:29 +00:00
msaitoh 0fce7fa801 s/max/ralmax/. No functional change. 2016-02-05 13:06:24 +00:00
roy af0a4ca738 Only build tests if MKATF != no 2016-02-05 10:16:12 +00:00