28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

81<br />

<strong>The</strong> Benefit <strong>of</strong> a printf-like Hypercall<br />

<strong>The</strong> rumpuser_dprintf() call has <strong>the</strong> same calling convention as <strong>the</strong> NetBSD kernel<br />

printf() routine. It is used to write debug output onto <strong>the</strong> console, or elsewhere<br />

if <strong>the</strong> implementation so chooses. While <strong>the</strong> kernel printf() routine can be used<br />

to produce debug output via rumpuser_putchar(), <strong>the</strong> kernel printf routine inkernel<br />

locks to synchronize with o<strong>the</strong>r in-kernel consumers <strong>of</strong> <strong>the</strong> same interface.<br />

<strong>The</strong>se locking operations may cause <strong>the</strong> rump kernel virtual CPU context to be<br />

relinquished, which in turn may cause inaccuracies in debug prints especially when<br />

hunting racy bugs. Since <strong>the</strong> hypercall runs outside <strong>of</strong> <strong>the</strong> kernel, <strong>and</strong> will not unschedule<br />

<strong>the</strong> current rump kernel virtual CPU, we found that debugging information<br />

produced by it is much more accurate. Additionally, a hypercall can be executed<br />

without a rump kernel context. This property was invaluable when working on <strong>the</strong><br />

low levels <strong>of</strong> <strong>the</strong> rump kernel itself, such as thread management <strong>and</strong> CPU scheduling.<br />

3.3 <strong>Rump</strong> Kernel Entry <strong>and</strong> Exit<br />

As we discussed in Chapter 2, a client must possess an execution context before it<br />

can successfully operate in a rump kernel. <strong>The</strong>se resources consist <strong>of</strong> a rump kernel<br />

process/thread context <strong>and</strong> a virtual CPU context. <strong>The</strong> act <strong>of</strong> ensuring that <strong>the</strong>se<br />

resources have been created <strong>and</strong> selected is presented as pseudocode in Figure 3.4<br />

<strong>and</strong> available as real code in sys/rump/librump/rumpkern/scheduler.c. We will<br />

discuss obtaining <strong>the</strong> thread context first.<br />

Recall from Section 2.3 that <strong>the</strong>re are two types <strong>of</strong> thread contexts: an implicit one<br />

which is dynamically created when a rump kernel is entered <strong>and</strong> a bound one which<br />

<strong>the</strong> client thread has statically set. We assume that all clients which are critical<br />

about <strong>the</strong>ir performance use bound threads.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!