Linux: trigger deadlock in rm_session_mmap.cc in core

Related to #579.
This commit is contained in:
Christian Helmuth 2012-12-19 09:05:50 +01:00 committed by Norman Feske
parent 522a86e54a
commit d50996863b
3 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,40 @@
build "core init test/rm_session_mmap drivers/timer test/signal"
create_boot_directory
install_config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="RAM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="CAP"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="SIGNAL"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<start name="test-rm_session_mmap">
<resource name="RAM" quantum="2M"/>
</start>
<!-- add signal test for concurrency -->
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="test-signal">
<resource name="RAM" quantum="1M"/>
</start>
</config>}
build_boot_image "core init test-rm_session_mmap timer test-signal"
run_genode_until forever

View File

@ -0,0 +1,53 @@
/*
* \brief Linux: Test bug in rm_session_mmap.cc
* \author Christian Helmuth
* \date 2012-12-19
*/
/*
* Copyright (C) 2012 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#include <base/env.h>
#include <base/printf.h>
#include <ram_session/connection.h>
#include <timer_session/connection.h>
static void test_linux_rmmap_bug()
{
enum { QUOTA = 1*1024*1024, CHUNK = 0x1000, ROUNDS = 0x10 };
using namespace Genode;
PLOG("line: %d", __LINE__);
Ram_connection ram;
#if 1 /* transfer quota */
PLOG("line: %d", __LINE__);
ram.ref_account(env()->ram_session_cap());
env()->ram_session()->transfer_quota(ram.cap(), QUOTA);
#endif
PLOG("line: %d", __LINE__);
for (unsigned i = 0; i < ROUNDS; ++i) {
Ram_dataspace_capability ds(ram.alloc(CHUNK));
PLOG("%d of %d pages allocated", (i + 1), ROUNDS);
}
PLOG("Done.");
}
int main()
{
Genode::printf("--- test-rm_session_mmap started ---\n");
// Timer::Connection timer;
// timer.msleep(1000);
test_linux_rmmap_bug();
}

View File

@ -0,0 +1,3 @@
TARGET = test-rm_session_mmap
LIBS = cxx env
SRC_CC = main.cc