From: Lars Kurth Subject: Re: Enhancing Xen's Kconfig infrastructure to support tailored solutions Date: Thu, 14 Feb 2019 21:03:24 +0000 Message-ID: References: <20190213182544.2tguperv3yliejch@zion.uk.xensource.com> <5C653AB10200007800216997@prv1-mh.provo.novell.com> Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Content-Type: multipart/mixed; boundary="===============8338038163610917132==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" To: Stefano Stabellini Cc: James McKenzie , robin.randhawa@arm.com, Wei Liu , 'Jan Beulich' , Daniel Smith , Doug Goldstein , Christopher Clark , Marek Marczykowski , "Daniel P.Smith" , Paul Durrant , committers@xenproject.org, Suravee Suthikulpanit , Jun Nakajima , Stewart Hildebrand , xen-devel List-Id: xen-devel@lists.xenproject.org --===============8338038163610917132== Content-Type: multipart/alternative; boundary="Apple-Mail=_A8EE0A2F-66F4-4E9D-8DE6-9604584B1EC8" --Apple-Mail=_A8EE0A2F-66F4-4E9D-8DE6-9604584B1EC8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 14 Feb 2019, at 18:32, Stefano Stabellini = wrote: >=20 > On Thu, 14 Feb 2019, Jan Beulich wrote: >>>>> On 13.02.19 at 20:11, wrote: >>> On Wed, 13 Feb 2019, Wei Liu wrote: >>>> On Tue, Feb 12, 2019 at 09:34:25PM -0500, Daniel P. Smith wrote: >>>>> Greetings, >>>>>=20 >>>>> On the 11/14/18 Xen x86 community call a discussion was initiated = about >>>>> using Kconfig to build minimized versions of Xen for security, = safety >>>>> and other certification requirements. After some offline = discussions >>>>> with Xen contributors I realized that a variety of efforts each = with >>>>> their own respective goals are underway, >>>>>=20 >>>>> - nested virtualization >>>>> - mixed criticality architectures >>>>> - reducing trusted componentary >>>>> - combining hardware protection of virtualization with performance = and >>>>> ease-of-use of containers >>>>>=20 >>>>> These efforts use hypervisors in different roles, all which Xen is >>>>> capable of meeting. Today Xen's utility comes at the expense of = carrying >>>>> features necessary for one role to be present in another role = where it >>>>> is not required, e.g. PV interfaces that may not be essential in = an ARM >>>>> mixed criticality deployment. >>>>>=20 >>>>> The initial focus will be to explore and document the range of = possible >>>>> use cases that are of interest to the Xen community. This will be = the >>>>> input to a design document that is crafted in conjunction with the = Xen >>>>> maintainers, to identify possible approaches to extend the = existing >>>>> Kconfig infrastructure to produce tailored instances of Xen. >>>>>=20 >>>>> If you are interested in participating in this effort, please = reply to >>>>> this thread to outline possible use cases, design constraints and = other >>>>> considerations for improving Xen's Kconfig infrastructure to = support >>>>> tailoring for specific use cases. >>>>>=20 >>>>=20 >>>> My impression from the community call is that you want to provide >>>> smallish configurations for different use cases. >>>>=20 >>>> The Kconfig infrastructure is already able to do what you want as = far as >>>> I can tell. You can easily feed it a base config file -- see files >>>> under automation/configs/x86/. What sort of extension is needed in = your >>>> opinion? >>>>=20 >>>> As use case goes, it would be a good start if you just submit = something >>>> you care about. >>>=20 >>> I mentioned on the call that a good first start could be a kconfig = that >>> allows to build an hypervisor binary with only support for PVH and = only >>> support for recent Intel machines, with the goal of minimizing the = code >>> base to less than 100K LOC. >>=20 >> "With only support for PVH" (which really means HVM) we already have. >> "With only support for recent Intel machines" would require adding = new >> Kconfig options first, to control Intel, AMD, etc separately, and to = then >> further somehow separate "old" from "new" (which may turn out not >> very easy to do without a lot of #ifdef-ary or other code churn). I'm >> not aware of something like this existing on Linux either - all I'm = aware >> of there is a means to control what -m option might be passed >> to the compiler, but without disabling any source code from getting >> compiled. >=20 > I was thinking along the lines of having options to disable drivers = for > older timers and older interrupt controllers that are not needed on > recent machines. >=20 >=20 >> And then "with only support for recent Intel machines" could also = imply >> HAP-only; disabling shadow code (which also is already possible) will >> alone save almost 10k LOC (counting .c files only). >=20 > I have just run `make cloc' on x86 with the smallest possible > configuration (HVM only): >=20 >=20 > http://cloc.sourceforge.net v 1.60 = T=3D0.87 s (370.3 files/s, 255808.4 lines/s) > = --------------------------------------------------------------------------= ----- > Language files blank comment = code > = --------------------------------------------------------------------------= ----- > C 309 33238 29432 = 157001 > Assembly 14 466 531 = 2435 > = --------------------------------------------------------------------------= ----- > SUM: 323 33704 29963 = 159436 > = --------------------------------------------------------------------------= ----- >=20 > This is great! The last time I did the count it was above 220K LOC. = We > should make more noise about this -- it is a major. @Wei: the binary size data is not that impressive. Would it be possible = to do the make cloc on HVM, PV and mixed? I can include this into the PR for 4.12. Sorry for slightly hi-jacking = the thread. Lars= --Apple-Mail=_A8EE0A2F-66F4-4E9D-8DE6-9604584B1EC8 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On 14 Feb 2019, at 18:32, Stefano Stabellini <sstabellini@kernel.org> wrote:

On Thu, 14 = Feb 2019, Jan Beulich wrote:
On 13.02.19 at 20:11, <sstabellini@kernel.org> wrote:
On Wed, 13 Feb 2019, Wei Liu = wrote:
On Tue, Feb = 12, 2019 at 09:34:25PM -0500, Daniel P. Smith wrote:
Greetings,

On the 11/14/18 Xen x86 community call a = discussion was initiated about
using Kconfig to build = minimized versions of Xen for security, safety
and other = certification requirements. After some offline discussions
with Xen contributors I realized that a variety of efforts = each with
their own respective goals are underway,

- nested virtualization
- mixed = criticality architectures
- reducing trusted = componentary
- combining hardware protection of = virtualization with performance and
ease-of-use of = containers

These efforts use hypervisors in = different roles, all which Xen is
capable of meeting. = Today Xen's utility comes at the expense of carrying
features necessary for one role to be present in another role = where it
is not required, e.g. PV interfaces that may not = be essential in an ARM
mixed criticality deployment.

The initial focus will be to explore and = document the range of possible
use cases that are of = interest to the Xen community. This will be the
input to a = design document that is crafted in conjunction with the Xen
maintainers, to identify possible approaches to extend the = existing
Kconfig infrastructure to produce tailored = instances of Xen.

If you are interested in = participating in this effort, please reply to
this thread = to outline possible use cases, design constraints and other
considerations for improving Xen's Kconfig infrastructure to = support
tailoring for specific use cases.


My impression from the community = call is that you want to provide
smallish configurations = for different use cases.

The Kconfig = infrastructure is already able to do what you want as far as
I can tell.  You can easily feed it a base config file = -- see files
under automation/configs/x86/.  What = sort of extension is needed in your
opinion?

As use case goes, it would be a good start if = you just submit something
you care about.

I mentioned on the call that a = good first start could be a kconfig that
allows to build = an hypervisor binary with only support for PVH and only
support for recent Intel machines, with the goal of = minimizing the code
base to less than 100K LOC.

"With only support for PVH" = (which really means HVM) we already have.
"With only = support for recent Intel machines" would require adding new
Kconfig options first, to control Intel, AMD, etc separately, = and to then
further somehow separate "old" from "new" = (which may turn out not
very easy to do without a lot of = #ifdef-ary or other code churn). I'm
not aware of = something like this existing on Linux either - all I'm aware
of there is a means to control what -m<arch> option = might be passed
to the compiler, but without disabling any = source code from getting
compiled.

I was thinking along the lines of having options to disable = drivers for
older timers = and older interrupt controllers that are not needed on
recent = machines.


And = then "with only support for recent Intel machines" could also imply
HAP-only; disabling shadow code (which also is already = possible) will
alone save almost 10k LOC (counting .c = files only).

I have just run `make cloc' on x86 with the smallest = possible
configuration = (HVM only):


http://cloc.sourceforge.net v 1.60 =  T=3D0.87 s (370.3 files/s, 255808.4 lines/s)
---------------------------------------------------------------= ----------------
Language =             &n= bsp;       files =          blank =        comment =           code---------------------------------------------------------------= ----------------
C =             &n= bsp;           &nbs= p;    309 =          33238 =          29432 =         157001
Assembly =             &n= bsp;          14 =            466 =            531 =           2435---------------------------------------------------------------= ----------------
SUM: =             &n= bsp;           &nbs= p; 323          33704 =          29963 =         159436
---------------------------------------------------------------= ----------------

This is great! The last time I did the count it was above = 220K LOC.  We
should make more noise about this -- it is a major.

@Wei: the binary size data is not that impressive. Would it = be possible to do the make cloc on HVM, PV and mixed?
I can include this into the PR for 4.12. Sorry for slightly = hi-jacking the thread.
Lars
= --Apple-Mail=_A8EE0A2F-66F4-4E9D-8DE6-9604584B1EC8-- --===============8338038163610917132== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcKaHR0cHM6Ly9saXN0 cy54ZW5wcm9qZWN0Lm9yZy9tYWlsbWFuL2xpc3RpbmZvL3hlbi1kZXZlbA== --===============8338038163610917132==--