Commit Graph

1216 Commits

Author SHA1 Message Date
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
bouyer
13ee92e7ec Apply patch from xsa155: make sure that the backend won't read parts of the
request again (possibly because of compiler optimisations), by using
copies and barrier.
From XSA155:
The compiler can emit optimizations in the PV backend drivers which
can lead to double fetch vulnerabilities. Specifically the shared
memory between the frontend and backend can be fetched twice (during
which time the frontend can alter the contents) possibly leading to
arbitrary code execution in backend.
2016-01-06 15:28:40 +00:00
christos
19d921e536 need definition 2015-12-13 16:11:14 +00:00
christos
07d3d8c47c fix the build. 2015-12-13 15:22:31 +00:00
christos
2b793cea0d Enable the VLAN mtu capability and check for the adjusted packet size
(Jean-Jacques.Puig at espci.fr).
Factor out the packet-size checking function for clarity.
2015-11-19 17:01:40 +00:00
bouyer
d4845d0072 Fix typo which caused the kenrel thread to be created with a 0 priority.
This would cause the thread to be almost never scheduled when a userland
process could use all CPU.
Should fix the problem reported by Torbjörn Granlund on port-xen@
2015-11-15 14:42:03 +00:00
skrll
0eca66f9fd Fix XEN build - does XEN really want/need pmap_pv_track? 2015-11-11 08:51:33 +00:00
maxv
ed3dce22b5 Uninitialized variable. Found by Brainy.
ok pgoyette@
2015-10-25 07:51:16 +00:00
dholland
25d3b9e7cb Final bit of PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers most if not all of the MD headers.

XXX: a lot of the ioctl definitions in some of these files are cutpasted.
2015-09-07 03:49:44 +00:00
mlelstv
5f6641165b move entropy gathering into dksubr. 2015-08-28 17:41:49 +00:00
mlelstv
7874349bce Make dksubr use a spin-mutex again, since some drivers still call dk_done
from hardware interrupt. Instead, release mutex while calling start routine.

The buffer peek/use/get sequence which can no longer be atomic. So consume
the buffer directly and on error privately save and retry the buffer later.
The dk_drain function is used to flush such a deferred buffer together with
the buffer queue.
Adjust drivers to use dk_drain.

Fix an error path where dk_done was called while the lock was already held.
2015-08-27 05:51:50 +00:00
uebayasi
db0ac56ebf Define ${LINKSCRIPT} in one place. 2015-08-24 14:04:24 +00:00
christos
e7ae23fd9e include "ioconf.h" to get the 'void <driver>attach(int count);' prototype. 2015-08-20 14:40:16 +00:00
uebayasi
774506b607 ${KERN_LDSCRIPT} -> ${KERNLDSCRIPT} 2015-08-18 10:18:20 +00:00
mlelstv
28e124faa7 Two changes to the dksubr interface.
- d_diskstart callback now processes a single buffer only.
  The new wrapper function dk_start processes the queue,
  performs other buffer handling and also provides locking
  for the the data structures.

- add d_discard callback to handle device specific function inside
  the new dk_discard helper function.

Replace splbio with mutex to protect queue and disk structure.
Refactor common code in dk_strategy and dk_discard into dk_translate.

Adjust and simplify ld(4), cgd(4) and xbd(4) drivers accordingly.

ld(4) now becomes MP_SAFE.

Bump kernel version.
2015-08-16 18:00:03 +00:00
joerg
adac2d746a Improve wording. 2015-05-30 19:14:46 +00:00
bouyer
c0b49688f8 Fix off by one error, pointed out by Wei Liu in port-xen/49919 2015-05-22 10:34:13 +00:00
mlelstv
5f99165065 Merge dk_intf and dkdriver interfaces.
Merge common disk driver functionality in ld.c with dksubr.c.
Adjust the two previous users of dk_intf (cgd and xbd) to
the changes.

bump kernel version to 7.99.14
2015-05-02 08:00:08 +00:00
knakahara
8ec1d9400a add x86 MD MSI/MSI-X support code. 2015-04-27 07:03:57 +00:00
riastradh
56d3242969 Include <sys/rndsource.h> where it is actually used.
I had removed <sys/rnd.h> from files that didn't mention anything of
the rnd(9) API.  But they included other files which assumed
<sys/rnd.h> had already been included.
2015-04-14 20:32:35 +00:00
riastradh
445478ce67 MD rnd.h cleanups. Please let me know if I broke anything! 2015-04-13 21:18:40 +00:00
bouyer
916e2df623 Properly implemement pci_intr_disestablish(9), so that interrupt
handlers stop being called when the device has been detached.
Should fix PR port-xen/47720 (which turns out to not be related to raidframe).
While there fix possible races in event_remove_handler() and pirq_establish().
2015-03-14 10:49:36 +00:00
joerg
2c045a6b19 valid_ipimask is only used under DIAGNOSTIC, so only define it then. 2015-02-07 20:01:48 +00:00
ozaki-r
3cde4cbc35 Pass a correct firmware size (instead of 0) to firmware_free
firmware_free now uses kmem_free(9) instead of free(9),
so we need to pass a correct size to it.
2015-01-07 07:05:48 +00:00
uebayasi
c455480f99 Include files.sljit as i386/amd64 do. 2015-01-04 07:34:14 +00:00
christos
c182898b0d We have three sets of DTYPE_ constants in the kernel:
altq		Drop 		Type
	disklabel	Disk 		Type
	file		Descriptor	Type
(not to mention constants that contain the string DTYPE).
Let's make them two, by changing the disklabel one to be DisK TYPE since the
other disklabel constants seem to do that. Not many userland programs use
these constants (and the ones that they do are mostly in ifdefs). They will
be fixed shortly.
2015-01-02 19:42:05 +00:00
christos
429dd9f14e these call dk_ioctl, no need to call disk_ioctl anymore. 2015-01-02 01:13:00 +00:00
christos
51cd9004b7 pass dev to disk_ioctl 2014-12-31 20:39:07 +00:00
christos
03a0e9092a there is no ibcs2 in amd64 [yet?] 2014-12-15 13:48:51 +00:00
ozaki-r
a83e862961 Add two new compat files for Xen on amd64 2014-12-15 07:35:09 +00:00
msaitoh
2fb8c49793 Modify around cpu_identify() to not to break the dmesg of cpus with AB_VERBOSE
or AB_DEBUG.
2014-12-08 15:22:47 +00:00
bouyer
4ae5e12ef4 Revert sys/arch/x86/x86/pmap.c 1.185; a CPU needs to get pmap updates,
especially for pmap_kernel(), as soon as it is up.
Instead move all pmap-related cpu_info initialisations, including
initializing ci_kpm_mtx, in cpu_attach_common() from cpu_init()
(ci_pmap and ci_tlbstate as already initialized in cpu_attach_common()).
2014-11-27 16:29:44 +00:00
uebayasi
104daad189 Use LINKSCRIPT. 2014-11-15 12:36:42 +00:00
snj
f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
christos
3814d4cb39 now that privcmd_map_obj cleans up correctly, don't double free... 2014-10-17 16:37:02 +00:00
uebayasi
2757cc55ca Mark machdep files. 2014-10-11 06:07:48 +00:00
christos
58f906ec2f correct error paths; still need to verify that the "didn't give us back..."
case is correct.
2014-10-03 20:56:24 +00:00
christos
486adf8389 fix leak. 2014-09-21 16:56:44 +00:00
christos
a9ba82b09e fix leak. 2014-09-21 16:53:38 +00:00
bouyer
bb4d9fb08c Make Xen kernels compile without DIAGNOSTIC 2014-09-21 12:46:15 +00:00
tls
ea6af427bd Merge tls-earlyentropy branch into HEAD. 2014-08-10 16:44:32 +00:00
wiz
87561671c1 defintion -> definition 2014-08-03 19:14:24 +00:00
dholland
f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland
8c70ef39af Add d_discard to all struct bdevsw instances I could find.
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
2014-07-25 08:02:18 +00:00
joerg
cb03441189 Restrict -mno-fp-ret-in-387 to GCC. 2014-07-20 16:51:29 +00:00
bouyer
af396dde5a Sync DEFCOPTS and CFLAGS with i386 and amd64 counterparts.
Especially -fno-omit-frame-pointer
2014-07-17 10:49:45 +00:00
pgoyette
3b2f43a7dd Define a macro to check hypervisor version. OK cherry@ 2014-06-14 02:53:02 +00:00
bouyer
2745b95e5c As proposed in
https://mail-index.netbsd.org/tech-kern/2014/05/21/msg017098.html
remove dk_start() and dk_iodone() from dksubr.c and move the related code
to the underlying driver.
This increase complexity only marginally: the underlying drivers have
to do the while() loop themselves, but this can now be done properly with
bufq_peek()/bufq_get(), removing the buffer from the queue at the right time.
This handle both the recursion and reordering issues (the reordering
issue is described here:
https://mail-index.netbsd.org/tech-kern/2014/05/19/msg017089.html
the recursion isssue is PR #25240).

Difference with the patch posted to tech-kern@: KASSERT() that the
buffer we remove with bufq_get() is the same as the one we bufq_peek()'d
just before.
Hopefully this will allow more disk drivers to use dksubr.c
2014-05-25 19:23:49 +00:00
rmind
8011b285c0 Implement MI IPI interface with cross-call support. 2014-05-19 22:47:53 +00:00
cherry
b3b58e3b56 Use the hypervisor to copy/zero pages. This saves us the extra overheads
of setting up temporary kernel mapping/unmapping.

riz@ reports savings of about 2s on a 120s kernel build.
2014-05-06 04:26:23 +00:00