[trustable-software] No hypervisor required...
Niall Dalton
niall.dalton at gmail.com
Sat Jun 16 22:36:44 BST 2018
> > If I had to approve ONE codebase for isolating safety related
> > and
>
> non safety related applications on one processor (and those
> > applications
>
> could be full operating system stacks) then I would use a hypervisor.
>
> > Why ? Because a hypervisor is fundamentally designed to serve this
> > purpose
> > and tested as such. Hypervisors are designed to absolutely prevent
> > guests
> > interacting with or effecting each other in any way, ever. Any other
> > operating system is not designed with that absolute intent at all.
In the spirit of lively debate, allow me to respectfully disagree. An
operating system and a hypervisor of equivalent capability are essentially
the same thing. And suffer from equivalent problems in these areas while
enabling consolidation (i.e. multi-tenancy on shared hardware).
Put it another way - a hypervisor is an operating system that can run at
least one other operating system. Just as there are small & simple
operating systems (just hundreds to thousands of lines), and grossly
complicated ones (hundreds of millions of lines), the same is true of
hypervisors. There are hypervisors that run the gamut of sizes too, to
provide different levels of functionality.
If my hyperkernel is a glorified boot loader, then on suitable hardware I
can launch several guest kernels on disjoint hardware, and declare victory
after several hundred lines. I could do the same on not-entirely-disjoint
hardware, but then the guests can and will interfere via buses, caches,
thermally, etc. In either case, I can do the same from an operating system
(e.g. use it as a fancy boot loader to run bare metal code or another os on
disjoint hardware).
If I need my hypervisor to implement (real-time) scheduling policies,
efficient context switches, deterministic hypervisor calls, interrupt
reinjection,.. then I'm building a kernel, hyper or otherwise. Once I've
gone beyond fancy-bootloader status, I'm potentially opening the door to
performance and determinism problems, and they need to be addressed either
way. Some hypervisors need to have device drivers and provide IO services
to guests. They can and are just as complex as 'full grown' operating
systems, and in fact some of them just reuse an existing OS kernel for
these purposes.
I can make exactly the same for/against arguments for an operating system.
So, l
et's
take a more general view.
1) can software be designed to absolutely prevent guests tasks (whether
process or kernel+process) interacting with or affecting each other in any
way, ever?
Not unless the hardware implements *hard* partitioning of all resources.
This can not otherwise be achieved by any solution that involves software.
Where guests are sharing hardware, software of any name will typically go
to great length to facilitate the orderly interaction, though all too
frequently we end up measuring costs of calls to the base layer of software
(whether system calls or hyper calls, or both).
Guest tasks may contend for cores, caches, interrupt controller, memory
controller, system bus and io buses, etc. For this very reason, hardware
often provides virtualized hardware (e.g. multiple contexts on a
controller). Hard-realtime oriented hardware supports, under various names,
mechanisms like "tightly coupled memory" for exclusive use by some core,
since otherwise it's impossible to guarantee deterministic access and
freedom from interference, no matter what software you do or do not use.
Hypervisors advertising hard separation require hardware that implements
hard separation to do the heavy lifting. If such hardware is available, it
can often be used by other software to provide hard separation too. E.g. if
you processor supports cache partitioning, some operating systems support
the use of it to further strengthen the walls between tasks.
2) can an operating system be designed to provide this separation
Yes, and some of them are. Often these are not used to the degree that
it's possible to do so, but that's a user choice not a constraint. As was
mentioned, applications can and do interfere by *opting* into OS facilities
that expose them to contention, and latency through the kernel. The more
"general purpose" the OS and configuration, the less deterministic these
latencies are. The usual reasoning being that higher utilization and
utilization warrants the trade-off.
Can an OS protect you from applications use such OS facilities and causing
interference? Yes, some operating systems allow you to selectively disable
functionality for certain tasks or groups of tasks. E.g. disallow use of
network system calls, or shared memory, or other system calls of your
choosing, no matter what the developer does.
I'd argue strongly that we can implement equivalent functionality, either
way. And that complexity rises in proportion, either way. We'd have to pick
a particular system architecture to discuss if we want to debate the merits
of using two pieces of software - in terms of separation or not, extra
overheads and complexity, etc. The only way to guarantee freedom from
interference is to hard partition on suitable hardware, so we might want to
pick an example there too.
> >
> Any
> other operating system is designed to allow applications to interact
> > with
>
> each other if you so desire.
Many but not all are - just as with hypervisors.
>
> i
> t is therefore up to the people developing
> > the applications to know what they are doing.
Not necessarily true; some operating systems allow you to constrain the
environment the application processes are running in such that you disallow
any/all interaction mechanisms. Where they cannot, you often have to solve
the same problem in a different way, were we using a hypervisor.
A hypervisor may possibly stop them interfering, but fundamentally that's
only true if the hardware enables it (as it is for any OS design).
> application bugs cause problems to other applications, via interaction
> > over
>
> the various network interconnects . . . that is better isolation than
> > any
>
> hypervisor can ever provide and certainly better than a badly used
> > (developer quality again) single operating system.
>
Yes; when sharing hardware, any software will struggle to mount a defense.
Having chosen a platform, real world systems will need to make careful
tradeoffs, as we all do all the time, about how to partition and provide
the necessary guarantees within budget (yes, $, but also other metrics as
usual). Hypervisors are one tool - thought neither necessary nor sufficient
- so as usual it comes back to the humans to wrestle with the trade-offs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.trustable.io/pipermail/trustable-software/attachments/20180616/6352fe05/attachment.html>
More information about the trustable-software
mailing list