Home | History | Annotate | Download | only in rumpvfs
History log of /src/sys/rump/librump/rumpvfs/rumpblk.c
RevisionDateAuthorComments
 1.64  07-Jul-2016  msaitoh branches: 1.64.2; 1.64.8;
KNF. Remove extra spaces. No functional change.
 1.63  26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.62  08-Dec-2015  christos fix struct name
 1.61  08-Dec-2015  christos Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.60  26-May-2015  pooka implement DIOCGMEDIASIZE, from Martin Lucina
 1.59  02-Jan-2015  christos 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.
 1.58  17-Nov-2014  pooka branches: 1.58.2;
Release all hypervisor-level resources for rump_etfs paths when the
rump kernel is halted.

Allows a Xen domU to not complain after it was shut down, or something
like that. Requested by Martin Lucina.
 1.57  25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.56  25-Jul-2014  dholland 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.
 1.55  16-Mar-2014  dholland branches: 1.55.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.54  30-Apr-2013  pooka branches: 1.54.4;
Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.53  29-Apr-2013  pooka g/c unused
 1.52  29-Apr-2013  pooka Replace the various "get info from hypervisor" interfaces with one
unified rumpuser_getparam(), and make it return a plist. The
contents can come e.g. from the env or a config file. Make
identifiers starting with an underscore denote system identifiers
which must be implemented by hypervisor. (yea, j/k about the plist bit)
 1.51  29-Apr-2013  pooka The fsync hypercall is now used only with close, so get rid of it.
rumpuser_bio() should do the necessary syncing.
 1.50  29-Apr-2013  pooka rework bio hypercalls, part 2:

Nuke all the policy hacks (r/w, mmap, directio) from the paravirtualized
block driver and let the hypervisor decide how it wants to optimize
the I/O. It can prepare for this based on if a file is opened with
the RUMPUSER_OPEN_BIO flag.

mmap was not faster than r/w except in a niche case (yes, it made a
good measurement), and directio was never on by default since
it was tricky at best to decide on the kernel side of things if
directio will do the right thing.
 1.49  29-Apr-2013  pooka Rework how the bio hypercalls work, part 1/n:

Reduce the set of hypercalls to one: "do block i/o". This not only
eliminates a lot of pseudo-duplicate code, it also gives the
hypervisor a lot more freedom on how to optimize the i/o.
 1.48  14-Sep-2012  pooka Do not assume that O_FOO flags have matching values in the rump kernel
and hypervisor.
 1.47  19-Nov-2011  tls branches: 1.47.8;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.46  03-Feb-2011  pooka branches: 1.46.4;
fix KASSERT snafu. spotted by tests, as usual.
 1.45  03-Feb-2011  pooka * open backend device once when the rumpblk is registered instead of
every time the virtual device is opened. this takes care of e.g.
a midlife chmod crisis
* when mapping initial windows, consistently look at host size and
host offset. otherwise we might end up in a situation with 0
initial windows mapped, and that will cause a crash later.
 1.44  03-Feb-2011  pooka * fix blkno->offset calculation for simulated non-512 devices
* allows transfers only in multiples of block size
* g/c unused struct member
 1.43  02-Feb-2011  pooka never open rumpblk backend with O_TRUNC
XXX: the rumpuser_open interface needs a beating
 1.42  06-Sep-2010  pooka branches: 1.42.2; 1.42.4;
Broadcast instead of signal since the condition is a boolean.
 1.41  21-Jun-2010  pooka Calculate memory mapping size based on underlying file size, not
our window to it. This fixes cases like opening a window at offsets
[8,32] to a file, which would cause host file offset [0,32-8] to
be mapped, i.e. [0,16] inside the window. Obviously, access to
the entire in-window [0,24] range should have been mapped (and
after this fix it is).
 1.40  15-Jun-2010  pooka Implement rumpblk_deregister, for unregistering fake block devices
(from etfs_deregister). Prompted by use case from njoly.
 1.39  01-May-2010  pooka Adjust event counter names to be less redundant.
 1.38  14-Apr-2010  pooka Use reserved major for rumpblk instead of picking something which
may conflict.
 1.37  31-Jan-2010  pooka branches: 1.37.2; 1.37.4;
If RUMP_BLKSECTSHIFT is set in the environment, use that as
device sector size instead of DEV_BSHIFT.
 1.36  27-Jan-2010  pooka Typecast memwinsize to off_t before taking the complement to be
&'ed with an off_t. Otherwise things go a bit wrong with >4GB
images ...
 1.35  22-Dec-2009  pooka Fix block device open for non-REG backends.
 1.34  03-Dec-2009  pooka Do bounds-checking before adding host offset. Otherwise the host
offset would be counted in with "size" and incorrect operation
would ensue.
 1.33  02-Dec-2009  pooka fix inverted comparison
 1.32  25-Nov-2009  pooka * report partition size in blocks instead of bytes
* "support" DIOCCACHESYNC.
 1.31  20-Nov-2009  pooka Generate fictional disklabel and return that from ioctl() instead
of the halfwitted semi-host semi-virtual ioctl nonsense that was
here previously.
 1.30  19-Nov-2009  pooka * don't open device when calling getfileinfo(), it might need to open
the device and will f-a-i-l if it's a block device
* use rumpuser_ioctl() as little as possible (going away completely
wewy wewy soon)
* improve some variable scoping
 1.29  07-Oct-2009  pooka * set winsize to memwinsize in initial getwindow(). makes no functional
difference, but looks less like a debug hack leftover.
* explain memory windows vs. directio a little better in comment
 1.28  07-Oct-2009  pooka do initial window allocation test at proper offsets
 1.27  07-Oct-2009  pooka Allow to set size and host file offset for etfs files and rumpblk.
 1.26  06-Oct-2009  pooka Use uint64_t instead of size_t for block device partition size.

from jak
 1.25  03-Aug-2009  pooka Support read/write in rumpblk via physio()
 1.24  03-Aug-2009  pooka * get rid of the old fakeblk registration interface. Instead,
introduce a new and improved "etfs" interface, which can be used
to register host files accessible from rump fs namespace. This
new interface is not restriced to block devices, and neither does
it require the same pathname in host namespace and rump namespace.
Therefore, the same host file can be represented both as a char
and block device in rump namespace.

* adjust rumpblk to make the above possible

* improve rumpfs: nodes are now created properly and not implicitly
tied to the vnode lifecycle
 1.23  30-Apr-2009  pooka branches: 1.23.2;
remove outdated comment
 1.22  30-Apr-2009  pooka print succinctly
 1.21  27-Apr-2009  pooka initialize async before use
 1.20  27-Apr-2009  pooka * expand syncing logic into rumpuser, since it has more freedom on
how to do it (e.g. fsync_range)
* hash out O_DIRECT support. it's the fastest method of safely operating
on a file, but we can't currently autodetect support, so it's not
enabled by default
* sprinkle more event counters
 1.19  17-Apr-2009  pooka Allow bootstrap time specification of memory window size and count.
 1.18  16-Apr-2009  pooka evcnt mmio window statistics
 1.17  07-Apr-2009  pooka Fix typo that slipped in a while ago. Fixes non-file mounts.
 1.16  06-Apr-2009  pooka In case using mmio, use windowing instead of trying to map the
entire image.

Benefits:
* the whole image does not need to fit into VA
* a core dump is not of gargantuan proportions

Performance is pretty close to one whopping mmap. I'll finetune
the parameters later, although the current ones seem pretty good
in initial testing.
 1.15  01-Apr-2009  pooka Be less verbose. (something like rump_dmesg with optional QUIET
would be nice, but needs work)
 1.14  23-Mar-2009  pooka massage comment. no functional change.
 1.13  23-Mar-2009  pooka Support async writes, can benefit mmio case.
 1.12  23-Mar-2009  pooka fix recent bug: writable images were not mapped with MAP_SHARED
 1.11  22-Mar-2009  pooka Bounds-check requests in case we are operating directly on a regular file.
 1.10  19-Mar-2009  uebayasi Fix build on LP64. While here KNF around.
 1.9  18-Mar-2009  pooka When doing I/O to a regular file, try to use mmio instead of
read/write. This makes a rump_fs file server around 5% faster.
 1.8  18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.7  26-Feb-2009  pooka g/c debug printf
 1.6  26-Feb-2009  pooka When using an array as a ringbuffer, need to perform modulo arithmetic
with arraysize instead of arraysize-1. Previously there was one
inconsistency in the code. This might fix a crash reported by apb.

Also, g/c outdated comment.
 1.5  26-Feb-2009  pooka Make rumpuser stat and nanosleep independent of the host system
stat and timespec definitions.
 1.4  10-Feb-2009  pooka Explain in comment why the RNG is private (no, not the Random Nethack God)
 1.3  10-Feb-2009  pooka Introduce simple random fault injection. It is currently controlled
by setting RUMP_BLKFAIL to control the frequency and optionally
RUMP_BLKFAIL_SEED, which seeds the "random" number generator. Feel
free to extend the code if you want something "a little more" for
your purposes.
 1.2  27-Jan-2009  pooka branches: 1.2.2;
Instead of dynamically allocating and freeing the rumpuser async
io descriptors, just allocate an array statically and be happy.

Fixes a problem found by Arnaud Ysmal where a descriptor would be
allocated using kmem_alloc(9) and free'd using free(3).
 1.1  13-Jan-2009  pooka branches: 1.1.2; 1.1.4;
Implement block I/O as a real block driver instead of a hacked copy
of specfs. That was easier years ago when rump didn't support
devices, but brings no gain now. This allows us to include the
real specfs in rump.
 1.1.4.4  28-Apr-2009  skrll Sync with HEAD.
 1.1.4.3  03-Mar-2009  skrll Sync with HEAD.
 1.1.4.2  19-Jan-2009  skrll Sync with HEAD.
 1.1.4.1  13-Jan-2009  skrll file rumpblk.c was added on branch nick-hppapmap on 2009-01-19 13:20:27 +0000
 1.1.2.2  17-Jan-2009  mjf Sync with HEAD.
 1.1.2.1  13-Jan-2009  mjf file rumpblk.c was added on branch mjf-devfs2 on 2009-01-17 13:29:38 +0000
 1.2.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.2.6  09-Oct-2010  yamt sync with head
 1.23.2.5  11-Aug-2010  yamt sync with head.
 1.23.2.4  11-Mar-2010  yamt sync with head
 1.23.2.3  19-Aug-2009  yamt sync with head.
 1.23.2.2  04-May-2009  yamt sync with head.
 1.23.2.1  30-Apr-2009  yamt file rumpblk.c was added on branch yamt-nfs-mp on 2009-05-04 08:14:31 +0000
 1.37.4.3  05-Mar-2011  rmind sync with head
 1.37.4.2  03-Jul-2010  rmind sync with head
 1.37.4.1  30-May-2010  rmind sync with head
 1.37.2.3  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.37.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.37.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.42.4.1  08-Feb-2011  bouyer Sync with HEAD
 1.42.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.46.4.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.4.2  30-Oct-2012  yamt sync with head
 1.46.4.1  17-Apr-2012  yamt sync with head
 1.47.8.4  03-Dec-2017  jdolecek update from HEAD
 1.47.8.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.47.8.2  23-Jun-2013  tls resync from head
 1.47.8.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.54.4.1  18-May-2014  rmind sync with head
 1.55.2.1  10-Aug-2014  tls Rebase.
 1.58.2.4  19-Mar-2016  skrll Sync with HEAD
 1.58.2.3  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.58.2.2  06-Jun-2015  skrll Sync with HEAD
 1.58.2.1  06-Apr-2015  skrll Sync with HEAD
 1.64.8.2  29-Apr-2017  pgoyette Remove more unnecessary #include for sys/localcount.h
 1.64.8.1  27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.64.2.3  26-Jul-2016  pgoyette Rename LOCALCOUNT_INITIALIZER to DEVSW_MODULE_INIT. This better describes
what we're doing, and why.
 1.64.2.2  19-Jul-2016  pgoyette Instead of repeatedly typing the conditional initialization of the
.d_localcount members in the various {b,c}devsw, define an initializer
macro and use it. This also removes the need for defining new symbols
for each 'struct localcount'.

As suggested by riastradh@
 1.64.2.1  18-Jul-2016  pgoyette Rump drivers are always installed via devsw_attach() so we need to
always allocate a 'struct localcount' for these drivers whenever they
are built as modules.

RSS XML Feed