diff --git a/.bintray_descriptor.json b/.bintray_descriptor.json index d97dfb644..8b00534c0 100644 --- a/.bintray_descriptor.json +++ b/.bintray_descriptor.json @@ -13,7 +13,7 @@ }, "version": { - "name": "0.2.9", + "name": "0.2.10", "desc": "HermitCore's kernel as libOS", "gpgSign": false }, diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..40c2b6afe --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,63 @@ +variables: + IMAGE: ubuntu:with-hermitcore + GIT_SUBMODULE_STRATEGY: normal + +stages: + - prepare + - build + - test + +# Stage: prepare +############################################################################## + +docker: + stage: prepare + script: + - docker build -t ${IMAGE} . + tags: + - shell + - linux + +# Stage: build +############################################################################## + +build: + stage: build + script: + - mkdir -p build + - cd build + - cmake -DTOOLCHAIN_BIN_DIR=/opt/hermit/bin -DCMAKE_INSTALL_PREFIX=/opt/hermit .. + - make + image: ${IMAGE} + tags: + - docker + artifacts: + untracked: true + expire_in: 1 week + paths: + - ./build + +# Stage: test +############################################################################## +test: + stage: test + script: + - lscpu + - cd build + - export TDIR=./local_prefix/opt/hermit/x86_64-hermit/extra + - export FILES="$TDIR/tests/hello $TDIR/tests/hellof $TDIR/tests/hello++ $TDIR/tests/thr_hello $TDIR/tests/pi $TDIR/benchmarks/stream $TDIR/benchmarks/basic $TDIR/tests/signals $TDIR/tests/test-malloc $TDIR/tests/test-malloc-mt $TDIR/tests/argv_envp" + - export PROXY=./local_prefix/opt/hermit/bin/proxy + - for f in $FILES; do echo "check $f..."; HERMIT_ISLE=qemu HERMIT_CPUS=1 HERMIT_KVM=0 HERMIT_VERBOSE=1 timeout --kill-after=5m 5m $PROXY $f || exit 1; done + - for f in $FILES; do echo "check $f..."; HERMIT_ISLE=qemu HERMIT_CPUS=2 HERMIT_KVM=0 HERMIT_VERBOSE=1 timeout --kill-after=5m 5m $PROXY $f || exit 1; done + - HERMIT_ISLE=qemu HERMIT_CPUS=1 HERMIT_KVM=0 HERMIT_VERBOSE=1 HERMIT_APP_PORT=8000 $PROXY $TDIR/tests/server & + - sleep 10 + - curl http://127.0.0.1:8000/help + - sleep 1 + - curl http://127.0.0.1:8000/hello + - sleep 1 + - kill $! + image: ${IMAGE} + tags: + - docker + dependencies: + - build diff --git a/.travis.yml b/.travis.yml index 186a27279..2da31d31d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ script: -c "cd /work; ./tests.sh ${OS_TYPE} ${OS_NAME}" before_deploy: - cd ${TRAVIS_BUILD_DIR} -- dpkg-deb -b tmp libhermit-0.2.9-all.deb +- dpkg-deb -b tmp libhermit-0.2.10-all.deb - sed -i "s/REPLACE_REPO/$OS_TYPE/" .bintray_descriptor.json - sed -i "s/REPLACE_OS/$OS_NAME/" .bintray_descriptor.json deploy: diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ff8bb9d6..b2fab232b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,7 +217,7 @@ set(CPACK_SYSTEM_NAME all) set(CPACK_PACKAGE_VERSION_MAJOR 0) set(CPACK_PACKAGE_VERSION_MINOR 2) -set(CPACK_PACKAGE_VERSION_PATCH 9) +set(CPACK_PACKAGE_VERSION_PATCH 10) set(CPACK_PACKAGE_CONTACT "Stefan Lankes ") diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..039ff21ee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Download base image ubuntu 18.04 +FROM ubuntu:18.04 + +ENV DEBIAN_FRONTEND=noninteractive + +# Update Software repository +RUN apt-get -qq update + +# Install required packets from ubuntu repository +RUN apt-get install -y apt-transport-https curl wget vim nano git binutils autoconf automake make cmake qemu-kvm qemu-system-x86 nasm gcc g++ build-essential libtool bsdmainutils + +# add path to hermitcore packets +RUN echo "deb [trusted=yes] https://dl.bintray.com/hermitcore/ubuntu bionic main" | tee -a /etc/apt/sources.list + +# Update Software repository +RUN apt-get -qq update + +# Install required packets from ubuntu repository +RUN apt-get install -y --allow-unauthenticated binutils-hermit newlib-hermit pte-hermit gcc-hermit libhermit libomp-hermit + +ENV PATH="/opt/hermit/bin:${PATH}" +ENV EDITOR=vim diff --git a/README.md b/README.md index d803d444f..58d7a530e 100644 --- a/README.md +++ b/README.md @@ -47,16 +47,26 @@ the HermitCore kernel and applications you need: ### HermitCore cross-toolchain -We provide prebuilt packages (currently Ubuntu 18.04 only) of the HermitCore +We provide prebuilt packages for Ubuntu 18.04 and Debian 9 of the HermitCore toolchain, which can be installed as follows: +**Ubuntu 18.04** + ```bash $ echo "deb [trusted=yes] https://dl.bintray.com/hermitcore/ubuntu bionic main" | sudo tee -a /etc/apt/sources.list $ sudo apt-get -qq update $ sudo apt-get install binutils-hermit newlib-hermit pte-hermit gcc-hermit libomp-hermit libhermit ``` -For non-Debian based systems, a docker image with the complete toolchain is provided and can be installed as follows: +**Debian 9** + +```bash +$ echo "deb [trusted=yes] https://dl.bintray.com/hermitcore/debian stretch main" | sudo tee -a /etc/apt/sources.list +$ sudo apt-get -qq update +$ sudo apt-get install binutils-hermit newlib-hermit pte-hermit gcc-hermit libomp-hermit libhermit +``` + +For unsupported systems, a docker image with the complete toolchain is provided and can be installed as follows: ```bash $ docker pull rwthos/hermitcore diff --git a/arch/aarch64/mm/memory.c b/arch/aarch64/mm/memory.c index 9649d1643..a9c5d5a15 100644 --- a/arch/aarch64/mm/memory.c +++ b/arch/aarch64/mm/memory.c @@ -64,6 +64,11 @@ atomic_int64_t total_pages = ATOMIC_INIT(0); atomic_int64_t total_allocated_pages = ATOMIC_INIT(0); atomic_int64_t total_available_pages = ATOMIC_INIT(0); +free_list_t *get_free_list(void) +{ + return free_start; +} + size_t get_pages(size_t npages) { size_t i, ret = 0; diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c index de109c989..3d05d8b1c 100644 --- a/arch/x86_64/kernel/irq.c +++ b/arch/x86_64/kernel/irq.c @@ -310,6 +310,10 @@ size_t** irq_handler(struct state *s) // Check if timers have expired that would unblock tasks check_workqueues_in_irqhandler((int) s->int_no); + if (s->int_no >= 32) { + apic_eoi(s->int_no); + } + if ((s->int_no == 32) || (s->int_no == 123)) { // a timer interrupt may have caused unblocking of tasks ret = scheduler(); @@ -318,8 +322,6 @@ size_t** irq_handler(struct state *s) ret = scheduler(); } - apic_eoi(s->int_no); - #ifdef MEASURE_IRQ if (go) { diff = rdtsc() - diff; diff --git a/arch/x86_64/mm/memory.c b/arch/x86_64/mm/memory.c index 0786057f9..9d997acc6 100644 --- a/arch/x86_64/mm/memory.c +++ b/arch/x86_64/mm/memory.c @@ -134,6 +134,11 @@ out: return ret; } +free_list_t *get_free_list(void) +{ + return free_start; +} + size_t get_pages(size_t npages) { return __get_pages(npages, PAGE_SIZE); diff --git a/arch/x86_64/mm/page.c b/arch/x86_64/mm/page.c index be0f34830..c6bf87a51 100644 --- a/arch/x86_64/mm/page.c +++ b/arch/x86_64/mm/page.c @@ -310,7 +310,6 @@ default_handler: // clear cr2 to signalize that the pagefault is solved by the pagefault handler write_cr2(0); - apic_eoi(s->int_no); //do_abort(); sys_exit(-EFAULT); } diff --git a/caves b/caves index 9f19fde7b..30a805155 160000 --- a/caves +++ b/caves @@ -1 +1 @@ -Subproject commit 9f19fde7b78ea85d3f7ff06252316f75579df617 +Subproject commit 30a805155ceece0ac744675defff4f6e02bd5d62 diff --git a/cmake/HermitCore-Configuration.cmake b/cmake/HermitCore-Configuration.cmake index e2d85c08f..f93a2e5c7 100644 --- a/cmake/HermitCore-Configuration.cmake +++ b/cmake/HermitCore-Configuration.cmake @@ -1,4 +1,4 @@ -set(PACKAGE_VERSION "0.2.9" CACHE STRING +set(PACKAGE_VERSION "0.2.10" CACHE STRING "HermitCore current version") set(MAX_CORES "512" CACHE STRING diff --git a/drivers/net/mmnif.c b/drivers/net/mmnif.c index cecf5c773..0dd907fe7 100644 --- a/drivers/net/mmnif.c +++ b/drivers/net/mmnif.c @@ -583,7 +583,7 @@ err_t mmnif_init(struct netif *netif) } LOG_INFO("mmnif_init() : size of mm_rx_buffer_t : %d\n", sizeof(mm_rx_buffer_t)); - if (BUILTIN_EXPECT(!header_phy_start_address || !header_phy_start_address || !phy_isle_locks, 0)) + if (BUILTIN_EXPECT(!header_phy_start_address || !phy_isle_locks, 0)) { LOG_ERROR("mmnif init(): invalid heap or header address\n"); goto out; diff --git a/drivers/net/uhyve-net.c b/drivers/net/uhyve-net.c index d77760eed..108789eb1 100755 --- a/drivers/net/uhyve-net.c +++ b/drivers/net/uhyve-net.c @@ -58,7 +58,7 @@ #include "uhyve-net.h" -#define UHYVE_IRQ 11 +#define UHYVE_IRQ_NET 11 static int8_t uhyve_net_init_ok = 0; static struct netif* mynetif = NULL; @@ -257,8 +257,8 @@ err_t uhyve_netif_init (struct netif* netif) LWIP_DEBUGF(NETIF_DEBUG, ("\n")); uhyve_netif->ethaddr = (struct eth_addr *)netif->hwaddr; - LOG_INFO("uhye_netif uses irq %d\n", UHYVE_IRQ); - irq_install_handler(32+UHYVE_IRQ, uhyve_irqhandler); + LOG_INFO("uhye_netif uses irq %d\n", UHYVE_IRQ_NET); + irq_install_handler(32+UHYVE_IRQ_NET, uhyve_irqhandler); /* * Initialize the snmp variables and counters inside the struct netif. diff --git a/drivers/net/vioif.c b/drivers/net/vioif.c index 68c6a345f..5225d575a 100644 --- a/drivers/net/vioif.c +++ b/drivers/net/vioif.c @@ -365,7 +365,7 @@ err_t vioif_init(struct netif* netif) uint32_t required = (1UL << VIRTIO_NET_F_MAC) | (1UL << VIRTIO_NET_F_STATUS); if ((features & required) != required) { - LOG_ERROR("Host isn't able to fulfill HermireCore's requirements\n"); + LOG_ERROR("Host isn't able to fulfill HermitCore's requirements\n"); outportb(vioif->iobase + VIRTIO_PCI_STATUS, VIRTIO_CONFIG_S_FAILED); kfree(vioif); return ERR_ARG; @@ -373,11 +373,11 @@ err_t vioif_init(struct netif* netif) required = features; required &= ~(1UL << VIRTIO_NET_F_CTRL_VQ); - required &= ~(1UL << VIRTIO_NET_F_GUEST_TSO4); - required &= ~(1UL << VIRTIO_NET_F_GUEST_TSO6); - required &= ~(1UL << VIRTIO_NET_F_GUEST_UFO); - required &= ~(1UL << VIRTIO_RING_F_EVENT_IDX); - required &= ~(1UL << VIRTIO_NET_F_MRG_RXBUF); + required &= ~(1UL << VIRTIO_NET_F_GUEST_TSO4); + required &= ~(1UL << VIRTIO_NET_F_GUEST_TSO6); + required &= ~(1UL << VIRTIO_NET_F_GUEST_UFO); + required &= ~(1UL << VIRTIO_RING_F_EVENT_IDX); + required &= ~(1UL << VIRTIO_NET_F_MRG_RXBUF); required &= ~(1UL << VIRTIO_NET_F_MQ); LOG_INFO("wanted guest features 0x%x\n", required); diff --git a/include/hermit/memory.h b/include/hermit/memory.h index 7a3a828a5..cd0fd95e6 100644 --- a/include/hermit/memory.h +++ b/include/hermit/memory.h @@ -36,12 +36,17 @@ #ifndef __MEMORY_H__ #define __MEMORY_H__ +typedef struct free_list free_list_t; + /** @brief Initialize the memory subsystem */ int memory_init(void); /** @brief Request physical page frames */ size_t get_pages(size_t npages); +/** @brief Returns a pointer to the free_list */ +free_list_t *get_free_list(void); + /** @brief Get a single page * * Convenience function: uses get_pages(1); diff --git a/include/hermit/stddef.h b/include/hermit/stddef.h index 11166ed2b..4681baec0 100644 --- a/include/hermit/stddef.h +++ b/include/hermit/stddef.h @@ -74,6 +74,8 @@ extern size_t image_size; #define UHYVE_PORT_NETREAD 0x680 #define UHYVE_PORT_NETSTAT 0x700 +#define UHYVE_PORT_FREELIST 0x720 + /* Ports and data structures for uhyve command line arguments and envp * forwarding */ #define UHYVE_PORT_CMDSIZE 0x740 diff --git a/include/hermit/vma.h b/include/hermit/vma.h index 5e465112b..5d9a0d458 100644 --- a/include/hermit/vma.h +++ b/include/hermit/vma.h @@ -37,6 +37,7 @@ #define __VMA_H__ #include +#include #include #ifdef __cplusplus diff --git a/lwip b/lwip index e99a84c18..d4d77f78a 160000 --- a/lwip +++ b/lwip @@ -1 +1 @@ -Subproject commit e99a84c1814ae85c7d2826000a0a823fc11167d0 +Subproject commit d4d77f78a667d9773a235b010027ce1ec7973daf diff --git a/mm/vma.c b/mm/vma.c index fd388222c..ad0f84d37 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -32,7 +32,10 @@ #include #include #include +#include +#include +#define UHYVE_IRQ_FREELIST 12 /* * Note that linker symbols are not variables, they have no memory allocated for * maintaining a value, rather their address is their value. @@ -49,6 +52,13 @@ static vma_t vma_boot = { VMA_MIN, VMA_MIN, VMA_HEAP }; static vma_t* vma_list = &vma_boot; spinlock_irqsave_t hermit_mm_lock = SPINLOCK_IRQSAVE_INIT; +typedef struct free_list free_list_t; + +static void uhyve_irq_freelist_handler(struct state* s) +{ + outportl(UHYVE_PORT_FREELIST, (unsigned)virt_to_phys((size_t)get_free_list())); +} + int vma_init(void) { int ret; @@ -68,7 +78,11 @@ int vma_init(void) ret = vma_add(HEAP_START, HEAP_START+HEAP_SIZE, VMA_NO_ACCESS); if (BUILTIN_EXPECT(ret, 0)) goto out; - LOG_INFO("Reserve space for the heap: 0x%llx - 0x%llx\n", HEAP_START, HEAP_START+HEAP_SIZE-1); + LOG_INFO("Reserve space for the heap: 0x%llx - 0x%llx\n", HEAP_START, HEAP_START+HEAP_SIZE-1); + + // install IRQ handler for the migration interface + LOG_INFO("freelist channel uses irq %d\n", UHYVE_IRQ_FREELIST); + irq_install_handler(32+UHYVE_IRQ_FREELIST, uhyve_irq_freelist_handler); // we might move the architecture specific VMA regions to a // seperate function vma_arch_init() diff --git a/tests.sh b/tests.sh index 066ecf54d..a6804e771 100755 --- a/tests.sh +++ b/tests.sh @@ -44,7 +44,7 @@ mkdir -p build cd build cmake -DTOOLCHAIN_BIN_DIR=/opt/hermit/bin -DCMAKE_INSTALL_PREFIX=/opt/hermit -DBOOTSTRAP=true .. make hermit-bootstrap -#checkinstall -D -y --exclude=build --pkggroup=main --maintainer=stefan@eonerc.rwth-aachen.de --pkgsource=https://hermitcore.org --pkgname=libhermit --pkgversion=0.2.9 --pkglicense=BSD make hermit-bootstrap-install +#checkinstall -D -y --exclude=build --pkggroup=main --maintainer=stefan@eonerc.rwth-aachen.de --pkgsource=https://hermitcore.org --pkgname=libhermit --pkgversion=0.2.10 --pkglicense=BSD make hermit-bootstrap-install make hermit-bootstrap-install rm -rf * cmake -DTOOLCHAIN_BIN_DIR=/opt/hermit/bin -DCMAKE_INSTALL_PREFIX=/opt/hermit .. @@ -52,8 +52,8 @@ make -j1 package cd .. mkdir -p tmp -dpkg-deb -R build/libhermit-0.2.9-all.deb tmp -#dpkg-deb -R build/libhermit_0.2.9-1_amd64.deb tmp +dpkg-deb -R build/libhermit-0.2.10-all.deb tmp +#dpkg-deb -R build/libhermit_0.2.10-1_amd64.deb tmp rm -rf build/*.deb build/_CPack_Packages #exit 0