<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body class="">
<div>On Thu, 2018-12-20 at 09:55 +0800, Jiang Liu wrote:</div>
<blockquote type="cite"><br class="">
<div><br class="">
<blockquote type="cite">
<div class="">On Dec 20, 2018, at 9:40 AM, Jiang Liu <<a href="mailto:liuj97@gmail.com">liuj97@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<br class="">
<div class=""><br class="">
<blockquote type="cite">
<div class="">On Dec 20, 2018, at 7:17 AM, Boeuf, Sebastien <<a href="mailto:sebastien.boeuf@intel.com">sebastien.boeuf@intel.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">On
Wed, 2018-12-19 at 15:02 -0800, Dylan Reid wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;">
On Wed, Dec 19, 2018 at 2:59 PM Steve Rutherford <srutherford@google.<br class="">
com> wrote:<br class="">
<blockquote type="cite"><br class="">
<br class="">
Hint received :)<br class="">
Getting userspace instruction emulation to work with nested has<br class="">
been a<br class="">
bit of a fight, and we've been waiting to push stuff upstream until<br class="">
we<br class="">
have it everywhere.<br class="">
</blockquote>
The crosvm team is currently investigating moving the PIT and APIC<br class="">
emulation to user space. If that works, instruction emulation will be<br class="">
next on the list, including helping to get the kernel side landed<br class="">
upstream.<br class="">
<br class="">
</blockquote>
<br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">That's
nice! Quick question, why do you want to emulate the PIT? If you</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">emulate
APIC feature X86_FEATURE_TSC_DEADLINE_TIMER, the legacy timer</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">emulation
should not be required, right?</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Oh
I guess that's because some other architectures might need the PIT.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Are
you planning to make this modular so that we could choose to pick</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">only
the APIC emulation?</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br class="">
</div>
</blockquote>
Yeah, APIC deadline timer could be used here so we could remove PIT, even</div>
<div class="">PIC and Local APIC. We have done a quick PoC by using NetBSD and uKVM.</div>
<div class="">I think it should work with Linux too. </div>
</div>
</div>
</blockquote>
<div>Sorry, “local APIC” should be “IO APIC”, we still use the in-kernel Local APIC</div>
<div>for MSI and IPI.</div>
</div>
</blockquote>
<div><br>
</div>
<div>Yes, if you don't expect any pin based interrupt, then removing the IOAPIC and the PIC should also work just fine and the APIC (local APIC) itself should be enough.</div>
<div>Talking about linux, if you take a look here: <a href="https://github.com/torvalds/linux/blob/master/arch/x86/kernel/apic/apic.c#L818">https://github.com/torvalds/linux/blob/master/arch/x86/kernel/apic/apic.c#L818</a>, you see that having the deadline
timer would skip the whole calibration of the APIC timer, hence this will prevent from falling back onto the legacy timers (<a href="https://github.com/torvalds/linux/blob/master/arch/x86/kernel/apic/apic.c#L840-L842">https://github.com/torvalds/linux/blob/master/arch/x86/kernel/apic/apic.c#L840-L842</a>)
which are specifically expected to be a PIT or a HPET.</div>
<div><br>
</div>
<blockquote type="cite">
<div><br class="">
<blockquote type="cite">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div class=""><br class="">
</div>
<div class=""><br class="">
<blockquote type="cite">
<div class="">
<blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;">
<blockquote type="cite"><br class="">
<br class="">
On Wed, Dec 19, 2018 at 1:13 PM Paolo Bonzini <<a href="mailto:pbonzini@redhat.com">pbonzini@redhat.com</a>><br class="">
wrote:<br class="">
<blockquote type="cite"><br class="">
<br class="">
On 18/12/18 00:30, Liguori, Anthony wrote:<br class="">
<blockquote type="cite"><br class="">
As a side note, I think having OS X hypervisor framework<br class="">
bindings<br class="">
and whatever the new Windows thing is would be pretty cool.<br class="">
</blockquote>
Yes, indeed. Hypervisor.framework however is much more complex<br class="">
than KVM<br class="">
or WHP because you deal manually with VMCSes and have to do<br class="">
instruction<br class="">
emulation in userspace. QEMU takes a stab at it, but it's not as<br class="">
stable<br class="">
as KVM.<br class="">
<br class="">
*However* Google does have patches for KVM to do instruction<br class="">
emulation<br class="">
in userspace, and I'd like to apply them upstream too now that<br class="">
KVM has<br class="">
an API test framework (and thus we can know they won't bitrot).<br class="">
(Steve, you are in Cc because hint, hint :)). Once that is in<br class="">
place, I<br class="">
guess a minimal x86 emulator written in Rust, porting the<br class="">
emulator code<br class="">
that QEMU has for Hypervisor.framework, would be a fun GSoC<br class="">
project for<br class="">
a very good student.<br class="">
<br class="">
<blockquote type="cite"><br class="">
2) The crosvm data_model crate. This one is super critical but<br class="">
easy to<br class="">
misunderstand as it allows for safe access to volatile<br class="">
memory. Somewhat<br class="">
related is the mmap() bits from sys_util. Not sure how the<br class="">
crosvm folks<br class="">
feel but I think there is some refactoring here that could be<br class="">
useful to<br class="">
build a memory crate.<br class="">
<br class="">
3) Some traits for device model implementations. It's easy to<br class="">
really<br class="">
bike shed here so I reckon it's best to start with a concrete<br class="">
device<br class="">
model like a UART, work through what is required for<br class="">
interfaces, and<br class="">
then iterate from there.<br class="">
<br class="">
4) Common device models with only a single implementation (i.e.<br class="">
16650A). Not sure about virtio, maybe.<br class="">
</blockquote>
virtio would be interesting. One initial target could be a demo<br class="">
vhost-user client, it has to set up a memory map, parse vrings,<br class="">
handle<br class="">
endianness, etc. It would be an interesting benchmark for a DMA<br class="">
API.<br class="">
<br class="">
The control plane (your item 3) by comparison is a bit less<br class="">
interesting.<br class="">
<br class="">
Paolo<br class="">
</blockquote>
_______________________________________________<br class="">
Rust-vmm mailing list<br class="">
<a href="mailto:Rust-vmm@lists.opendev.org">Rust-vmm@lists.opendev.org</a><br class="">
<a href="http://lists.opendev.org/cgi-bin/mailman/listinfo/rust-vmm">http://lists.opendev.org/cgi-bin/mailman/listinfo/rust-vmm</a><br class="">
</blockquote>
_______________________________________________<br class="">
Rust-vmm mailing list<br class="">
<a href="mailto:Rust-vmm@lists.opendev.org">Rust-vmm@lists.opendev.org</a><br class="">
<a href="http://lists.opendev.org/cgi-bin/mailman/listinfo/rust-vmm">http://lists.opendev.org/cgi-bin/mailman/listinfo/rust-vmm</a><br class="">
</blockquote>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Rust-vmm
mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="mailto:Rust-vmm@lists.opendev.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Rust-vmm@lists.opendev.org</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="http://lists.opendev.org/cgi-bin/mailman/listinfo/rust-vmm" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">http://lists.opendev.org/cgi-bin/mailman/listinfo/rust-vmm</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</blockquote>
</body>
</html>