<div dir="ltr"><div dir="ltr">Hi Jan,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 28, 2020 at 4:12 AM Jan Kiszka <<a href="mailto:jan.kiszka@web.de">jan.kiszka@web.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On 28.03.20 08:47, PRAKHAR BANSAL wrote:<br>
> Hi Jan,<br>
><br>
> Thanks for the reply!<br>
><br>
> I was only considering the command-line tool "code" for reference to the<br>
> Jailhouse kernel API(ioctl calls) because I didn't find a documentation<br>
> of the Jailhouse kernel APIs.<br>
<br>
Right, the IOCTL API is not documented so far. It is currently only used<br>
inside the Jailhouse project. This needs to be formalized when there<br>
shall be external users like a libvirt driver.<br>
<br>
That might be a nice small contribution task: Create some<br>
Documentation/driver-interfaces.md that describes the IOCTLs along with<br>
their parameter structures and that also includes the current<br>
sysfs-entries.txt as a section. Then send this as patch here. I'll help<br>
out when details are not clear from reading the code.<br>
<br></blockquote><div>  <font color="#a64d79">Sure. I will do that. </font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
><br>
> For the second part as you mentioned that Jailhouse can only create<br>
> cells with the constraints defined in the root cell configuration. I<br>
> have a few questions regarding that.<br>
><br>
> 1. Is there a way to know if Jailhouse is enabled on the host and get<br>
> the root cell configuration(s) from Jailhouse through an API? This can<br>
> be used while binding the libvirt to the Jailhouse hypervisor.<br>
<br>
Look at<br>
<a href="https://github.com/siemens/jailhouse/blob/master/Documentation/sysfs-entries.txt" rel="noreferrer" target="_blank">https://github.com/siemens/jailhouse/blob/master/Documentation/sysfs-entries.txt</a><br>
for what is reported as runtime information. Full configurations can't<br>
be read back at this point. This might be reconsidered in the light of<br>
[1], but I wouldn't plat for that yet.<br></blockquote><div><br></div><div> <font color="#c27ba0"> </font><font color="#a64d79">Ok, sure. I am looking into it. </font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
><br>
> 2. If Jailhouse is not enabled(again can we know this using some API)<br>
> then, can libvirt enable/disable Jailhouse during the libvirt binding of<br>
> the Jailhouse driver with a given set of Jailhouse cell configurations<br>
> describing a complete partitioned system?<br>
<br>
With the API above and a given configuration set, yes. The config set<br>
would have to be provided to the libvirt driver in some to-be-defined<br>
way (e.g. /etc/libvirt/jailhouse.conf -> /etc/libvirt/jailhouse/*.cell).<br>
<br></blockquote><div> <font color="#a64d79">Cool, got it. Thanks!</font></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
><br>
> 3. I was wondering, as you mentioned that libvirt driver should check<br>
> for mismatch of the cell configuration with the root cell configuration,<br>
> the question is, isn't that done by Jailhouse itself? If yes, then<br>
> libvirt can just pass on the cell creation requests to Jailhouse and<br>
> return the response to the user as it is, rather than driver doing any<br>
> such mismatch check.<br>
<br>
With matching I'm referring to a libvirt user request like "create a<br>
domain with 2 CPUs", while there are no cells left that have more than<br>
one CPU. Or "give the domain 1G RAM", and you need to find an available<br>
cell with that much memory. Those are simple examples. A request that<br>
states "connect the domain to the host network A" implies that a cell<br>
has a shared-memory link to, say, the root cell that can be configured<br>
to bridge this. But let's keep that for later and start as simple as<br>
possible.<br></blockquote><div><br></div><div>  <font color="#a64d79">Do I need to match the libvirt user-requested cell config with only root cells or with all cells present at that time?</font></div><div><font color="#a64d79"><br></font></div><div><font color="#a64d79"><span style="caret-color: rgb(166, 77, 121);">I wanted to request you for a favor for the proposal as the deadline is approaching. Could I prepare a proposal for this project based on our discussion here and improve it later based on feedback comments after the deadline? I understand that I got late in starting on the project search and selection.</span></font></div><div><font color="#a64d79"><span style="caret-color: rgb(166, 77, 121);"><br></span></font></div><div><span style="caret-color: rgb(166, 77, 121);"><font color="#000000">Thanks,</font></span></div><div><span style="caret-color: rgb(166, 77, 121);"><font color="#000000">Prakhar</font></span></div><div><font color="#a64d79">  </font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
Jan<br>
<br>
[1]<br>
<a href="https://groups.google.com/d/msgid/jailhouse-dev/CADiTV-1QiRhSWZnw%2BkHhJMO-BoA4sAcOmTkQE7ZWbHkGh3Jexw%40mail.gmail.com" rel="noreferrer" target="_blank">https://groups.google.com/d/msgid/jailhouse-dev/CADiTV-1QiRhSWZnw%2BkHhJMO-BoA4sAcOmTkQE7ZWbHkGh3Jexw%40mail.gmail.com</a><br>
<br>
><br>
> -Prakhar<br>
><br>
> On Thu, Mar 26, 2020 at 1:49 AM Jan Kiszka <<a href="mailto:jan.kiszka@web.de" target="_blank">jan.kiszka@web.de</a><br>
> <mailto:<a href="mailto:jan.kiszka@web.de" target="_blank">jan.kiszka@web.de</a>>> wrote:<br>
><br>
>     Hi Prakhar,<br>
><br>
>     On 25.03.20 05:36, PRAKHAR BANSAL wrote:<br>
>      > Hi Jan,<br>
>      ><br>
>      > Thanks for the reply. I looked deeper into the libvirt and Jailhouse<br>
>      > source code and found following two things that seem relevant to the<br>
>      > project I am interested in.<br>
>      ><br>
>      > - Libvirt driver interface at [libvirt.git]<br>
>      > <<a href="https://libvirt.org/git/?p=libvirt.git;a=tree;hb=HEAD" rel="noreferrer" target="_blank">https://libvirt.org/git/?p=libvirt.git;a=tree;hb=HEAD</a>> / src<br>
>      > <<a href="https://libvirt.org/git/?p=libvirt.git;a=tree;f=src;hb=HEAD" rel="noreferrer" target="_blank">https://libvirt.org/git/?p=libvirt.git;a=tree;f=src;hb=HEAD</a>> /<br>
>     driver.h<br>
>      ><br>
>     <<a href="https://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=src/driver.h;hb=HEAD" rel="noreferrer" target="_blank">https://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=src/driver.h;hb=HEAD</a>><br>
>      > - Jailhouse tool, which is using the ioctl API of the Jailhouse,<br>
>      > available at<br>
>      > <a href="https://github.com/siemens/jailhouse/blob/master/tools/jailhouse.c" rel="noreferrer" target="_blank">https://github.com/siemens/jailhouse/blob/master/tools/jailhouse.c</a>.<br>
>      ><br>
>      > With the help of the above two, it looks like, a libvirt driver<br>
>     for the<br>
>      > Jailhouse can be implemented. Let me know if I am moving in the right<br>
>      > direction so far.<br>
><br>
>       From the Jailhouse perspective, it is important to not consider the<br>
>     command line tool an interface anymore (like in the first prototype) but<br>
>     build on top of the Linux driver API (ioctls, sysfs). There is already a<br>
>     Python library which started to abstract this interface for<br>
>     Jailhouse-internal use cases. However, I strongly suspect libvirt will<br>
>     rather want a native binding.<br>
><br>
>      ><br>
>      > I have been looking at the other libvirt driver implementations for<br>
>      > hypervisors like HyperV and VMware to understand their implementation<br>
>      > and learn from there.<br>
><br>
>     As Jailhouse is a static partitioning hypervisor without abstraction of<br>
>     the underlying hardware, your starting point for the libvirt binding<br>
>     should be a given set of Jailhouse cell configurations describing a<br>
>     complete partitioned system. So rather than instantiating on demand a<br>
>     domain (Jailhouse cell) with, say, a network adapter, the driver should<br>
>     match a user request for a domain against the configuration set and use<br>
>     what is there - or report the mismatch. What it could organize, though,<br>
>     is interconnecting cells that have a (preconfigured) virtual network<br>
>     link to the root cell.<br>
><br>
>     Due to this different concept, there will be no 1:1 mapping for<br>
>     commodity hypervisor drivers to the Jailhouse scenario. Still, studying<br>
>     what they do is useful and needed in order to understand what "normally"<br>
>     happens and find a reasonable translation. This is probably the most<br>
>     challenging part of the project.<br>
><br>
>     Jan<br>
><br>
<br>
</blockquote></div></div>