Alexander Jung [Mon, 23 Aug 2021 12:58:18 +0000 (14:58 +0200)]
lib/uktest: Add methods for retrieving stats about tests
This commit introduces minimal statistic retrieval within
`uktest` such that we can count the number of failed assertions,
cases and suites. This commit also introduces a mechanism to
print these statistics at the last possible moment from the
`inittab` and thus the last possible moment a suite can be
registered.
Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk>
Alexander Jung [Thu, 27 May 2021 19:59:49 +0000 (21:59 +0200)]
lib/uktest: Provide multi boot-level registration of test suites
This commit introduces a minimal implementation testing
infastructure into Unikraft. The primary contents includes the
definition of a test (or suite of tests) and the mechanism by
which one can use to register the suite to be run.
In `uktest`, tests are organised hierarchically powered by the
the lowest common denominator: the assertion. This organisation
is inspired by KUnit[0], the Linux Kernel's in-house testing
system. For licensing reasons the Unikraft project cannot use
this source code. However, by inspiration, we can organise the
`uktest` library following a similar pattern:
1. The assertion: repersents the lowest common denominator of a
test: some boolean operation which, when true, a single test
passes. Assertions are often used in-line and their usage
should be no different to the traditional use of the `ASSERT`
macro. In this commit, we introduce a new definition:
`UK_TEST_ASSERT` which has two parameters: a reference to the
test case (see 2.) and the boolean opeation which is
true-to-form of the traditional `ASSERT` macro: some boolean
expresson. This commit extends this functionality to simply
note when this assertion has failed and to print
contextualised information about it.
2. The test case: often, assertions are not alone in their means
to check the legitimacy of operation in some function. We
find that a "case" is best way to organise a group of
assertions in which one particular function of some system is
under-going testing. A case is independent of other cases,
but related in the same sub-system. For this reason we
register them together.
3. The test suite: represents a group of test cases. This is
the final and upper-most heirarchical repesentation of tests
and their groupings. With assertions grouped into test cases
and test cases grouped into a test suite, we end this
organisation in a fashion which allows us to follow a common
design pattern within Unikraft: the registration model. The
syntax follows similar to other registation models within
Unikraft, e.g. `ukbus`. However, `uktest`'s registation
model is more powerful (see Test Execution).
To register a test suite with `uktest`, we simply invoke
`uk_testsuite_register` with an initialized `struct uk_testsuite`
variable. This structure contains an initialized list of `struct
uk_testcase`s. Each test case has only one input parameter: a
reference to the current case which each assertion handles during
its conditional check:
```c
UK_TESTCASE(testsuite1, some_test_case)
{
int x = 1;
UK_TEST_ASSERT(x > 0);
}
uk_testsuite_register(testsuite1, NULL);
```
The above snippet can be organised within a library in a number
of ways such as in-line or as an individual file representing the
suite. There are a number of test suite registration handles
which are elaborated on in next section. It should be noted that
multiple test suites can exist within a library in order to test
multiple features or components of said library.
In order to achieve consistency in the use of `uktest` across the
Unikraft code base, the following recommendation is made
regarding the registration of test suites:
1. A single test suite should be organised into its own file,
prefixed with `test_`, e.g. `test_feature.c`. All tests
suites of some library within Unikraft should be stored
within a new folder located at the root of the library named
`tests/`.
2. All tests suites should have a corresponding KConfig option,
prefixed with the library name and then the word "TEST", e.g.
`LIBNAME_TEST_`.
3. Every library implementing one or more suite of tests must
have a new menuconfig housing all test suite options under
the name `LIBNAME_TEST`. This menuconfig option must invoke
all the suites if `LIBUKTEST_ALL` is set to true.
`uktest`'s registation model allows for the execution of tests
at different levels of the boot process. All tests occur before
the invocation of the application's `main` method. This is done
such that the validity of the kernel-space functions can be
legitimised before actual application code is invoked. A fail-
fast option is provided in order to crash the kernel in case of
failures for earlier error diagnosis.
When registering a test suite, one can hook into either the
constructor "`ctor`" table or initialisation table "`inittab`".
This allows for running tests before or after certain libraries
or sub-systems are invoked during the boot process.
The following registation methods are available from this commit:
Alexander Jung [Thu, 27 May 2021 18:31:17 +0000 (20:31 +0200)]
lib/uktest: Introduce library skeleton
The `uktest` library has a dependency to `nolib`/`newlib` and to
`ukdebug` in order to function and to output test information,
respectively. The symbols exported will be provided by the `test.c`.
Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk>
This patch adds embedded rust support. Only the core crate
is available. Internal libraies may be written in rust now.
We're using rustc as a rust compiler. The compilation flags
are different from GCC and thus we introduce new flags for
rust sources such as as a -Copt_lvl="2". LTO is available
only when using the clang toolchain for C/C++ sources.
DCE is available and done at linking.
The sources should have #![no_std] and a panic handler, e.g:
```
use core::panic::PanicInfo;
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
```
Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #241
Rustc uses the LLVM format for specifying the cross
compiler target: <arch><sub>-<vendor>-<sys>-<abi>.
This is different from GCC, in order to not have
to mantain a translation script, we provide the user
with an option to specify himself the target via
LLVM_TARGET_ARCH which is similar to CROSS_COMPILE.
Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #241
Marc Rittinghaus [Thu, 17 Jun 2021 17:07:13 +0000 (19:07 +0200)]
lib/ukdebug: Fix overrun in outf for OUTDEV_BUFFER
This patch fixes two bugs:
1) The return value of vsnprintf does not include the null-terminator.
Subtracting one is thus not necessary.
2) In case the buffer is too small, vsnprintf returns the number of
characters that would have been written if the buffer had
enough space. The return value must therefore be tested against
the remaining buffer space.
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu> Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #232
Since we cannot add GO sources without the libgo external library,
we move the buildrules_go to the libgo library, in a library specific
Makefile.rules
Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #258
Marc Rittinghaus [Wed, 14 Jul 2021 15:32:11 +0000 (17:32 +0200)]
plat/kvm/x86: Fix lost IRQs
There is a race condition in `ukplat_lcpu_halt_irq()`, where an IRQ
may fire in between the short window after which interrupts are
enabled and before the halt is done. This may halt the caller
forever (or much longer until the next interrupt).
As this issue is platform and architecture specific, this commit
moves `ukplat_lcpu_halt_irq()` from the common code to the
plat/arch-specific implementation. For x86 the race condition
is avoided by ensuring that there are no instructions between
`STI` and `HLT`.
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #257
Alexander Jung [Wed, 14 Jul 2021 17:43:19 +0000 (19:43 +0200)]
.github: Add issue template configuration
This file configures the issue template page on Github, providing
additional contact information as well as disabling the ability to
open a blank template.
Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk> Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #256
Alexander Jung [Wed, 14 Jul 2021 17:12:06 +0000 (19:12 +0200)]
.github: Introduce pull request template
This commit introduces a new Github-centric configuration file which
provides a template during the Pull Request process. When a new PR
is opened, this template will appear in the PR text body. More
information can be found on this template at [0].
This commit introduces a Github-centric configuration file which
provides a template during the creation of a new issue. This file
is used to help with defining a feature request or "project
backlog" issue submitted to the Unikraft core repository. More
information about issue templates can be found at [0].
Alexander Jung [Wed, 14 Jul 2021 11:19:48 +0000 (13:19 +0200)]
.github: Introduce 'bug report' issue template
This commit introduces a Github-centric configuration file which
provides a template during the creation of a new issue. This file
is used to help with defining a bug report submitted to the Unikraft
core repository. More information about issue templates can be found
at [0].
Alexander Jung [Wed, 14 Jul 2021 10:44:57 +0000 (12:44 +0200)]
.github: Introduce CODEOWNERS and drop MAINTAINERS.md
This commit introduces a new file, `CODEOWNERS`, which acts as a
replacement for `MAINTAINERS.md`. This file is used by Github to
protect directories and files as well as help with automatic
assignments for incoming PRs. More information on the
`CODEOWNERS` file can be found here[0].
Hugo Lefeuvre [Wed, 14 Jul 2021 09:48:53 +0000 (11:48 +0200)]
build: Extra compile flags from command line
Additional flags can now be passed to the compiler via environment
variables, e.g., CFLAGS_EXTRA in the case of C:
make CFLAGS_EXTRA="-DSOME_MACRO=0"
Update the documentation as well.
Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #255
Simon Kuenzer [Thu, 15 Apr 2021 21:40:59 +0000 (23:40 +0200)]
build: fetch: Support checksum checks
This commit introduces the support for comparing the checksum of a
downloaded archive with `fetch`, `fetch2`, `fetchas`, and `fetchas2`.
It computes and compares the checksum with the library-local variables
within a `Makefile.uk` when given:
LIBNAME_ORIGIN_[MD5|SHA1|...].
Please note that this variable needs to be defined
before calling `fetch`, `fetch2`, `fetchas`, or `fetchas2`.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #181
Simon Kuenzer [Fri, 9 Apr 2021 09:58:38 +0000 (11:58 +0200)]
build: fetch: Support second URL as download source
Introduces `fetch2` and `fetchas2`, two build system commands that
work like `fetch` and `fetchas` but support a secondary URL to download
archives from. The secondary URL is used when the download failed
with the primary URL.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #181
Simon Kuenzer [Mon, 5 Jul 2021 10:43:28 +0000 (12:43 +0200)]
lib/ukallocpool: Use Unikraft internal types
Use Unikraft-internal types in order to avoid any conflict with
libc definitions. This was originally done with commit ed1ef9aef but `lib/ukallocpool` was forgotten.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #248
Alexander Jung [Mon, 12 Apr 2021 10:39:59 +0000 (12:39 +0200)]
plat/linuxu: Add fstat, open and close host system calls
* Add system call number for arm_32 and x86_64 for the `fstat`
system call;
* Implement system call wrapper function for `open`, `close` and
`fstat`;
* Add `MAP_PRIVATE` constant for use with `mmap`.
Signed-off-by: Robert Hrusecky <roberth@cs.utexas.edu> Signed-off-by: Omar Jamil <omarj2898@gmail.com> Signed-off-by: Sachin Beldona <sachinbeldona@utexas.edu> Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com> Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #179
Jia He [Fri, 14 May 2021 01:21:12 +0000 (09:21 +0800)]
plat/arm64: Fix extregs allocation on Arm
Implement the extregs (currently only fpsimd registers) allocation
related helpers. Otherwise, Unikraft can't be built on Arm kvm plat
due to the missing of several helpers.
Signed-off-by: Jia He <justin.he@arm.com> Reviewed-by: Răzvan Vîrtan <virtanrazvan@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #206
Michalis Pappas [Wed, 17 Feb 2021 10:52:04 +0000 (11:52 +0100)]
plat/common: Add invalidate_dcache_range for arm64
Introduces an additional cache maintenance function that invalidates
cache without cleaning. This is useful when reading memory updated
from a different core, after turning on the caches.
cristian-vijelie [Wed, 30 Jun 2021 16:22:30 +0000 (19:22 +0300)]
plat/kvm: Provide udelay and mdelay implementations
The delay functions are required by the SMP module and can be used in
places where setting up a timer in not worth the effort or cannot be
safely done (e.g., early boot code, drivers).
Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com> Reviewed-by: Marc Rittinghaus <marc.rittinghaus@kit.edu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #184
Hugo Lefeuvre [Fri, 25 Jun 2021 11:17:23 +0000 (13:17 +0200)]
lib/ukboot: add bindings for tinyalloc allocator
This commits allows users to select tinyalloc as default system
allocator. Previously users had to patch the main tree to achieve this.
This is the tinyalloc counter part of 4b31168 (Mimalloc).
Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #238
Hugo Lefeuvre [Fri, 25 Jun 2021 08:28:28 +0000 (10:28 +0200)]
lib/ukboot: add bindings for Mimalloc allocator
This commits allows users to select Mimalloc as default system
allocator. Previously users had to patch the main tree to achieve this.
While adding more an more "hardcoded" allocators like this is certainly
not a long term solution, this is the only one we have for now.
Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #237
Simon Kuenzer [Mon, 23 Nov 2020 12:10:58 +0000 (13:10 +0100)]
lib/ukalloc: per-library stats: Return ENOMEM
THe per-library wrapper returns ENOMEM instead of failing in an assertions
when the default allocator is not yet initialized.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Instruments <stdlib.h> so that per-library allocator statistics are
possible. We make sure that libraries using `malloc()`, `free()`, and
company will resolve `uk_alloc_get_default()` within their scope so that
the individual wrapper allocators can be used.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Tue, 17 Nov 2020 16:27:19 +0000 (17:27 +0100)]
lib/ukalloc: Use Unikraft internal types
Use Unikraft-internal types for the API headers in order to have minimal
dependency to libc definitions. This is done so that libcs can integrate
`<uk/alloc.h> directly with their header files without breaking the
declaration set of libc headers.
This is done towards receiving per-library statistics
(see the following commit).
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Tue, 17 Nov 2020 15:48:24 +0000 (16:48 +0100)]
lib/ukalloc: Iterator for per-library statistics
Provides the `uk_alloc_foreach_libstats()` helper macro that can be used
to iterate over the available library allocator statistics.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 23:20:12 +0000 (00:20 +0100)]
lib/ukalloc: Per-library allocation statistics
Per-library allocation statistics is achieved by replacing the default
allocator for each library with a wrapper. This wrapper forwards operations
to the actual default allocator while recording changes of the statistics
caused by the operations.
Some statistic counters are updated to support signed values (e.g.,
current memory usage or current number of allocations). This is
needed to cover cases where, for instance, a library A is allocating while
a library B is freeing.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Tue, 22 Dec 2020 12:56:32 +0000 (13:56 +0100)]
lib/ukallocpool: Instrumentation for statistics
Instruments the allocator to record allocation statistics.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 23:17:37 +0000 (00:17 +0100)]
lib/ukallocregion: Instrumentation for statistics
Instruments the allocator to record allocation statistics.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 15:54:50 +0000 (16:54 +0100)]
lib/ukallocregion: Internal functions as `static`
Declares internal functions as static in order to enable potentially
more aggressive optimizations by the compiler.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 23:16:37 +0000 (00:16 +0100)]
lib/ukallocbbuddy: Instrumentation for statistics
Instruments the allocator to record allocation statistics.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 23:12:15 +0000 (00:12 +0100)]
lib/ukalloc: Global statistics
Provides a configuration option that collects a consolidated global
statistic over all allocators.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 16:24:30 +0000 (17:24 +0100)]
lib/ukalloc: Allocator statistics
This commit introduces an implementation for the configuration option
`LIBUKALLOC_IFSTATS`. When enabled, allocators keep allocation statistics,
like number of current allocations, maximum memory usage due to
allocations, or how often ENOMEM was returned.
The statistics are kept on the `uk_alloc` struct while the instrumentation
of an allocator is minimal: An allocator has only to be modified with
the following macros:
- `uk_alloc_stats_count_alloc()`, `uk_alloc_stats_count_palloc()`
- `uk_alloc_stats_count_free()`, `uk_alloc_stats_count_pfree()`
- `uk_alloc_stats_count_enomem()`, `uk_alloc_stats_count_penomem()`
Current statistics can be queried with `uk_alloc_stats()`.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
This commit introduces helper functions to retrieve the total available
memory of all registered allocators. In case an allocator does not support
querying the amount of free memory, it is considered as 0 bytes free for
this particular allocator.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 16:11:00 +0000 (17:11 +0100)]
lib/ukalloc: Iterator helper for allocators
This commit provides `uk_alloc_foreach()`, a helper macro for
iterating over all registered allocators.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 16:10:03 +0000 (17:10 +0100)]
lib/ukalloc: Cross-compatibility wrappers for "free memory" APIs
This commit provides cross compatibility wrappers between page and non-page
allocators: `uk_alloc_availmem()`, `uk_alloc_maxalloc()`,
`uk_alloc_pavailmem()`, and `uk_alloc_pmaxalloc()`.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
This commit introduces
- `uk_alloc_pavailmem()` as an equivalent for `uk_alloc_availmem()`
for page allocators.
- `uk_alloc_pmaxalloc()` as an equivalent for `uk_alloc_maxalloc()`
for page allocators.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 15:52:53 +0000 (16:52 +0100)]
lib/ukalloc: Introduce `uk_alloc_maxalloc()` and make `uk_alloc_availmem()` available
The purpose of this commit is to make `uk_alloc_availmem()` always
available because it is currently the only way to figure out how much heap
memory is still available. We also introduce `uk_alloc_maxalloc()` that
returns the biggest possible allocation that an allocator can currently
satisfy. The configuration option `CONFIG_IFSTAT` is removed because it
raises the expectation of an interface that returns detailed allocator
statistics.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 15:27:03 +0000 (16:27 +0100)]
lib/ukalloc: Move `uk_zalloc()` after `uk_calloc()`
Moves `uk_zalloc()` to a more appropriate location within the
`<uk/alloc.h> header.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 15:26:04 +0000 (16:26 +0100)]
lib/ukalloc: `extern C {}` at the beginning of <uk/alloc.h>
`<uk/alloc.h>`: Move the type `struct uk_alloc` declaration into the
C code block.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Simon Kuenzer [Thu, 12 Nov 2020 15:24:41 +0000 (16:24 +0100)]
lib/ukalloc: Move ifpages comment
Moves the comment about the ifpages implementation within `alloc.c`
to the correct place.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229
Marc Rittinghaus [Mon, 14 Jun 2021 09:47:16 +0000 (11:47 +0200)]
plat/common/x86: Fix control protection trap
The current trap number for the control protection exception (in
Unikraft called security trap) is wrong and the asm trap is missing. This
patch fixes these issues.
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #228
Simon Kuenzer [Thu, 20 May 2021 22:34:16 +0000 (00:34 +0200)]
docs: Update version to 0.5.0
Bump the version number within the documentation to 0.5.0:
`docs/` and `README.md`
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #214
Simon Kuenzer [Thu, 6 May 2021 13:03:11 +0000 (15:03 +0200)]
lib/uksched: Enable multiple `UK_THREAD_INIT()` in one source
In order to enable multiple UK_THREAD_INIT(_PRIO) definitions within
one source file, we generate file-unique symbol names for each entry
by using the priority level, init function name, and fini function name.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #201
Simon Kuenzer [Thu, 6 May 2021 13:02:35 +0000 (15:02 +0200)]
lib/uksched: Remove unnecessary alignment for thread inittab
The align parameter within `extra.ld` for the `uk_thread_inttab` was
causing some alignment issues for the `text` section. Some builds
were not able to be executed. It turns out that this extra alignment
statement is not needed for the table.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #201
Costin Lupu [Tue, 17 Nov 2020 08:38:48 +0000 (10:38 +0200)]
plat/xen/drivers/net: Add receive operation
Incoming packets are written in pages allocated by the netfront. Such pages are
allocated and registered to the shared ring after completion of receiving
operations.
Costin Lupu [Tue, 17 Nov 2020 08:38:47 +0000 (10:38 +0200)]
plat/xen/drivers/net: Add transmit operation
Whenever a packet is transmitted, the request describing it is written in the
shared ring. The packet itself is written in a page referenced by the request
and shared, as well, with the backend. At the end of each transmit operation, a
cleanup operation is performed free'ing the resources allocated for the
previously transmitted packets.
Costin Lupu [Tue, 17 Nov 2020 08:38:46 +0000 (10:38 +0200)]
plat/xen/drivers/net: Start netfront device
Starting the device implies establishing the connection between netfront and
netback. The connection is set up after a negociation between the two end
points. After configuring the device queues, the netfront publishes via
Xenstore the information associated with the queues which will be used by the
backend to connect.
Costin Lupu [Tue, 17 Nov 2020 08:38:45 +0000 (10:38 +0200)]
plat/xen/drivers/net: Enable/disable interrupts for rx queues
The user can enable/disable interrupts for devices according with the operation
mode he or she chooses for the device. This patch follows closely the logic
implemented in the virtio net driver.
Costin Lupu [Tue, 17 Nov 2020 08:38:44 +0000 (10:38 +0200)]
plat/xen/drivers/net: Configure netfront rx queue
Incoming packets are saved in buffers allocated with user-provided callbacks.
Whenever such packet is available, the driver is notified via event channels.
This patch introduces the configuration logic for rx queues and the handler
used in dealing with the notifications.
Costin Lupu [Tue, 17 Nov 2020 08:38:43 +0000 (10:38 +0200)]
plat/xen/drivers/net: Configure netfront tx queue
For each queue, either rx or tx, the packets references are kept in a Xen
shared ring. This patch introduces the initialization of tx shared ring. Each
time the driver will send a packet it will add a request on the tx shared ring
which will be serviced by the backend. Therefore we need to keep track of the
requests by keeping track of their IDs. Because our resources are limited, we
will maintain a pool of IDs (see `freelist` array) for this purpose.
Costin Lupu [Tue, 17 Nov 2020 08:38:42 +0000 (10:38 +0200)]
plat/xen/drivers/net: Create netfront queues
We continue with the device configuration by retrieving the Xenstore
information regarding the number of queues and their associated event channels.
Netfront devices operate pairs of Rx/Tx queues and for notifications we can
either use a single event channel per pair or split event channels.
Costin Lupu [Tue, 17 Nov 2020 08:38:41 +0000 (10:38 +0200)]
plat/xen/drivers/net: Configure netfront device
The information needed for configuring netfront devices is in the Xenstore. For
now, we only retrieve the MAC and IP addresses from there in order to
initialize the device.
This patch introduces the `netfront_dev` structure which integrates both netdev
and Xenbus device information and also keeps the configuration parameters.
Jia He [Thu, 13 May 2021 08:28:33 +0000 (16:28 +0800)]
lib/vfscore: Correct the macro name of UK_LIBC_SYSCALLS
Correct the name from UK_LIBC_SYSCALL to UK_LIBC_SYSCALLS
Otherwise the linking will report:
libs/newlib/musl-imported/src/termios/tcsetattr.c:35:
undefined reference to `ioctl'
/bin/ld:
apps/sqlite/build/sqlite_kvm-x86_64.o: in
function `tcgetattr':
libs/newlib/musl-imported/src/termios/tcgetattr.c:30:
undefined reference to `ioctl'
Reported-by: Alexander Jung <a.jung@lancs.ac.uk> Signed-off-by: Jia He <justin.he@arm.com> Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #204
Simon Kuenzer [Mon, 26 Apr 2021 14:28:29 +0000 (16:28 +0200)]
build: Introduce `mk_sub_libbuild_dir`
Inline with `mk_sub_build_dir`, this commit introduces
`mk_sub_libbuild_dir` that enables creating a sub build
directory for a library. This new Makefile command has
two parameters: (1) library name, (2) sub directory
structure.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #194
Simon Kuenzer [Mon, 25 May 2020 01:44:01 +0000 (03:44 +0200)]
lib/ukdebug: Provide `uk_printd_once()`, `uk_printk_once()`
This commit introduces debug and kernel print helpers that print a
message just once. Any successive call of the same location of a
message will produce no output: `uk_printd_once()` and
`uk_printk_once()`, as well as `uk_pr_crit_once()`, `uk_pr_err_once()`,
`uk_pr_warn_once()`, and `uk_pr_info_once()`.
This can be used to limit the amount of shown messages.
This commit updates the macro `WARN_STUBBED()`. Since the
functionality of printing once is made generally available, the macro
is based on `uk_pr_warn_once()`. In order to be inline with the
Unikraft naming scheme and reducing the risk of naming conflicts,
the macro is also introduced under the name `UK_WARN_STUBBED()`.
`WARN_STUBBED()` should be considered as deprecated.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #172