- Aug 13, 2013
-
-
Glauber Costa authored
This file implements the pv and pv-on-hvm event channel mechanism. Verbatim copy from BSD.
-
Glauber Costa authored
The BSD pv event channel will expect the underlying OS to be able to register a PIC. For now we will just allow that for xen, and provide the expected translation functions to allow xen to work. The design I have chosen is to let the xen event handler run in interrupt context. We can do threaded if it really becomes a problem, but right now it should do. The handlers themselves, though, will be threaded. So the intr_execute_handlers() function will do nothing more than to wake the respective threads. BSD will provide us functions, not threads. So we have a common thread that executes the function that we were given. One exception for this is the xenstore. The xenstore is already threaded, and its interrupt handler will also just wake up a thread. So for that we could do better in the future.
-
Glauber Costa authored
This contains interrupts, devices and bus definitions. Most of them are is bus files in BSD anyway.
-
Glauber Costa authored
With this patch, the grant table code is compiled into osv. The edits in the file reflect the fact that we don't need to go through PCI memory for the Xen special device even for HVM. We have mappings that are way simpler, so we can just use them. All the rest is kept as unchanged as I could.
-
Glauber Costa authored
-
Glauber Costa authored
Xen files in BSD (and Linux for that matter) expect a variable called HYPERVISOR_shared_info that points to the hypercall page - that in our case is statically defined. So we just need to point it with the correct name to our shared info page. Note the type mismatch: we are defining our own xen_shared_info to be able to access some parts of the structure, like the wallclock, more conveniently. Because of that, we need a type cast.
-
Glauber Costa authored
Xen does not need to EOI. At least not with the APIC anywyay: it signals end of interrupt by flipping vcpu_info->evtchn_upcall_pending to 0, but that is already done by the BSD handler, so we might as well do nothing. Avi generalized the irq handler to have a pre_eoi and a handler, and in this patch I am taking the extra step of adding an EOI indirection as well.
-
Glauber Costa authored
This is for the lack of a better place.
-
Glauber Costa authored
-
Glauber Costa authored
-
Avi Kivity authored
Already specified elsewhere. Noted by Nadav.
-
Avi Kivity authored
The release build optimizes away references to this object, but the debug build does not. Define it.
-
Avi Kivity authored
We don't initialize the dhcp packets, so some of them get the relay agent IP set, and the DHCP DISCOVER packets get sent to a random address on the Internet. Usually it doesn't have a DHCP server installed, so the guest does not get configured. Fix by zero-initializing the packet.
-
Pekka Enberg authored
Currently, looking up a non-existing tracepoint kills the guest: sun.org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Cannot find tracepoint (/console/perf.js#91) at sun.org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1786) at sun.org.mozilla.javascript.MemberBox.newInstance(MemberBox.java:202) at sun.org.mozilla.javascript.NativeJavaClass.constructSpecific(NativeJavaClass.java:284) at sun.org.mozilla.javascript.NativeJavaClass.construct(NativeJavaClass.java:202) at sun.org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2440) at sun.org.mozilla.javascript.gen._console_perf_js_17._c_anonymous_7(/console/perf.js:91) at sun.org.mozilla.javascript.gen._console_perf_js_17.call(/console/perf.js) at sun.org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66) at sun.org.mozilla.javascript.gen._console_perf_js_17._c_anonymous_10(/console/perf.js:114) at sun.org.mozilla.javascript.gen._console_perf_js_17.call(/console/perf.js) at sun.org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66) at sun.org.mozilla.javascript.gen._console_perf_js_17._c_anonymous_1(/console/perf.js:8) at sun.org.mozilla.javascript.gen._console_perf_js_17.call(/console/perf.js) at sun.org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66) at sun.org.mozilla.javascript.gen.cli_js_21._c_run_sync_15(cli.js:202) at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js) at sun.org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76) at sun.org.mozilla.javascript.gen.cli_js_21._c_invoke_18(cli.js:223) at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js) at sun.org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97) at sun.org.mozilla.javascript.gen.cli_js_21._c_command_19(cli.js:237) at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js) at sun.org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108) at sun.org.mozilla.javascript.gen.cli_js_21._c_main_loop_21(cli.js:290) at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js) at sun.org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108) at sun.org.mozilla.javascript.gen.cli_js_21._c_script_0(cli.js:323) at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js) at sun.org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426) at sun.org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3178) at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js) at sun.org.mozilla.javascript.gen.cli_js_21.exec(cli.js) at sun.org.mozilla.javascript.Context.evaluateReader(Context.java:1142) at com.cloudius.cli.main.RhinoCLI.run(Unknown Source) at com.cloudius.cli.util.TelnetCLI.handleConnection(Unknown Source) at com.cloudius.cli.util.TelnetD$1.run(Unknown Source) Caused by: java.lang.RuntimeException: Cannot find tracepoint at com.cloudius.trace.Tracepoint.findByName(Native Method) at com.cloudius.trace.Tracepoint.<init>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at sun.org.mozilla.javascript.MemberBox.newInstance(MemberBox.java:194) ... 34 more Fix that by catching errors like "perf stat" does.
-
- Aug 12, 2013
-
-
Avi Kivity authored
Currently we statically link to libstdc++ and libgcc_s, and also dynamically link to the same libraries (since the payload requires them). This causes some symbols to be available from both the static and dynamic version. With the resolution order change introduced by 82513d41, we can resolve the same symbol to different addresses at different times. This violates the One Definition Rule, and in fact breaks std::string's destructor. Fix by only linking in the libraries statically. We use ld's --whole-archive flag to bring in all symbols, including those that may be used by the payload but not by the kernel. Some symbols now become duplicates; we drop our version.
-
Avi Kivity authored
Needed to link the entirety of libstdc++.a.
-
Avi Kivity authored
Needed for statically linking the entirety of libgcc_eh.a.
-
Avi Kivity authored
Reduce memory consumption so we can test in a 1GB guest.
-
Avi Kivity authored
msleep() will fault if mtx is NULL.
-
Avi Kivity authored
The test tries to acquire the write lock while the read lock is taken in the same thread, which deadlocks. Remove the deadlocking construct.
-
Avi Kivity authored
taskqueue_thread_enqueue expects a pointer to a pointer to the taskqueue as context, give it that.
-
Avi Kivity authored
-
Avi Kivity authored
Currently, we perform the final fdrop() in an rcu callback, which means it can have considerable latency. This in turn places restrictions on further optimizations we can do to rcu, as we need prompt close() execution. Relax this by performing the fdrop() immediately, and only deferring the final free(). To do this, we harden fget() so it now expects files with positive refcounts, and make sure that after the final fdrop() refcounts are either zero or negative. This also makes close() take effect immediately, which fixes tst-pipe.so.
-
Glauber Costa authored
There are two spaces for event channel fields in the xen vcpu data. They were so far just a pad because we were not using event channels. Name them, so we can use it. I am also taking the opportunity to fix the tabs/spaces in the structure.
-
Avi Kivity authored
-
Avi Kivity authored
Without this, the networking stack will ignore TSO. Improves Java Echo test from ~2Gbps to ~5Gbps. With Dor Laor.
-
- Aug 11, 2013
-
-
Avi Kivity authored
Basic rcu implementation and initial user.
-
Avi Kivity authored
This patch changes fget() to no longer take gfdt_lock, using rcu instead.
-
Avi Kivity authored
-
Avi Kivity authored
-
Avi Kivity authored
For rcu.
-
Avi Kivity authored
This adds fairly basic support for rcu. Declaring: mutex mtx; rcu_ptr<my_object> my_ptr; Read-side: WITH_LOCK(rcu_read_lock) { const my_object* p = my_ptr.read(); // do things with *p // but don't block! } Write-side: WITH_LOCK(mtx) { my_object* old = my_ptr.read_by_owner(); my_object* p = new my_object; // ... my_ptr.assign(p); rcu_dispose(old); // or rcu_defer(some_func, old); }
-
- Aug 08, 2013
-
-
Nadav Har'El authored
This patch fixes the following bug, of CLI & memcached on two vcpus crashing on startup. The cause of the crash is this: Java is running two threads. One loads a new shared library (in this example, libnio.so), and the second thread just running normally and runs some function it hasn't run before (pthread_cond_destroy()). When our on-demand resolver code tries to resolve this function name, it iterates over the module list, and sees libnio.so, but this object hasn't been completely set up yet (we put it in the list first - see program::add_object()), so looking up a symbol in it crashes. Why hasn't this problem been noticed before the recent link-order change? Because before that change, the half-loaded library was always last in the list (OSV itself was the first), so existing symbols were always found before reaching the partially-set-up object. Now OSV, with many symbols, is last, and the half-set-up object is in the middle, so the problem is common. But it also could happen previously, if we had unresolved symbols (e.g., weak symbols), but these were probably rare enough for the bug not to happen in practice. The fix in this patch is "hacky", because I wanted to avoid restructuring the whole code. The problem is that the functions called in add_object() (including relocate_rela(), nested add_object(), etc.) all assume that they can look up symbols in the being-set-up object, while we don't want these objects to be visible for other threads. So we do exactly this - each object gets a "visiblity" field. If "visibility" is 0, all threads can use this object, but if visibility is a thread pointer, only this thread searches in this object. So add_object() starts the object with visibility set to its thread, and only when add_object() is done, it sets the visibility to 0 so all threads can see it. While this solves the common bug, not that this patch still leaves a small room for SMP bugs, because it doesn't add locking to _modules, so a lookup during an add_object() can see a broken vector for a short duration. We should fix this remaining problem later, using RCU.
-
Nadav Har'El authored
This patch fixes the exception handling bug seen in tst-except.so. The callback given dl_iterate_phdr (such as _Unwind_IteratePhdrCallback in libgcc_eh.a used to implement exceptions) may decide to cache previous information we gave it, as long as the "adds" and "subs" fields are unchanged. The bug was that we passed to the callback a on-stack *copy* of the obj->_phdrs vector, and if the callback saved pointers to that in its cache, they became invalid on the next call. We need the pointers to remain valid as long as adds/subs do not change. So we need to pass the actual obj->_phdrs (which doesn't change after the object's load), NOT a copy. Note there's a locking issue remaining here - if someone dlclose()s an object while the callback is running (and already checked adds/subs) it can use a stale pointer. This should be fixed separately, probably by using reference counting on objects.
-
Nadav Har'El authored
The callback function passed to dl_iterate_phdr, such as _UnWind_IteratePhdrCallback (used in libgcc_eh.a to implement exceptions), may want to cache previous lookups, and wants to know when the list of iterated modules hasn't changed since the last call to dl_iterate_phdr. For this, dl_iterate_phdr() is supposed to fill two fields, dlpi_adds and dlpi_subs, counting the number of times objects were loaded or unloaded from the program. If both dlpi_subs and dlpi_adds are unchanged, the callback is guaranteed the list of objects is unchanged. In the existing code, we forgot to set these two fields, so they got random values which caused the exception unwinding code to sometimes cache, and sometime not cache, depending on the phase of the moon. This patch adds the counting of the correct "subs" and "adds" counters, and after it exception unwinding will always use its cache (as long as the list of objects doesn't change). Note that this does NOT fix the crash in tst-except.so. That is a bug which appears when caching is enabled (which before this patch happend randomly), and will be fixed by the next patch.
-
Christoph Hellwig authored
-
Christoph Hellwig authored
-
Christoph Hellwig authored
-
Glauber Costa authored
Our console works well with KVM, that redirects the serial to stdio. In Xen, this seems not to work very well (some documentation sources - not all - lists 'serial="stdio"' as a valid option, but it doesn't really work). In that case, LFs are not automatically translated into CRLF and the terminal output is totally borked. This is obviously not exclusive to Xen: by changing our qemu command line to run a pts instead of stdio, and then connecting to that pts, the same thing happens. This patch modifies our console's write() function to respect the termios ONLCR flag, which is now set by default. When write() sees a newline character and this flag is set we output a CF before any LF. The termios structure is left outside the specific console, and we pass a pointer down to it. Our pre-console implementation of simple_write outputs CRs unconditionally. The normal stdio serial still works. Telnet still works.
-
Glauber Costa authored
When we call render, we are still in raw mode. So we need to insert the carriage return ourselves.
-