All of lore.kernel.org
 help / color / mirror / Atom feed
* Hyperlaunch/dom0less code sharing
@ 2025-05-21 14:35 Alejandro Vallejo
  2025-05-21 14:42 ` Jan Beulich
                   ` (2 more replies)
  0 siblings, 3 replies; 88+ messages in thread
From: Alejandro Vallejo @ 2025-05-21 14:35 UTC (permalink / raw)
  To: xen-devel
  Cc: Andrew Cooper, Daniel P. Smith, Michal Orzel, Jan Beulich,
	Jason Andryuk, Roger Pau Monné, Stefano Stabellini,
	Xenia Ragiadakou

Hi,

(There's a TL;DR at the end)

While working on preparing and reworking the hyperlaunch series for
upstreaming it's slowly becoming apparent the degree of duplication with
dom0less.

Oleksii's latest effort to move all that code into common[*] (see
ad03faa942b9("xen/common: dom0less: make some...) makes this even clearer.
There are 1:1 relationships for every key data strucutre, and by deviating
we're overcomplicating the ability to share code.

  [*] https://lore.kernel.org/xen-devel/cover.1746468003.git.oleksii.kurochko@gmail.com/

    dom0less           Hyperlaunch
    ------------------------------
    kernel_info        boot_domain
    bootmodule         boot_module
    bootmodule_kind   bootmod_type
    membanks                memmap
    bootinfo             boot_info

The difficulty in code sharing is not just unfortunate from a vague sense of
elegance or neatness. Having different code paths parsing the same DT bindings
means it's a matter of time before x86 and all other Xen ports have different
bindings, which would would only worsen the situation wrt code sharing and user
confusion.
 
I've been trying to get _somewhere_ in using parts of dom0less on x86
and develop a credible PoC that highlights the use of dom0less parsing
code paths. The results are interesting.

While I didn't get to a full integration in the hyperlaunch series as I hoped
due to time constraints I did get far enough to:

  1. Replace boot_module, boot_domain and bootmod_type with their dom0less
     counterparts (pending some cleanup).
  2. Isolate binding parsing code in common/device-tree so it's dettached from
     the not-so-common dom0less domain building logic in dom0less-build.c
  3. Do early module kind detection from x86 using code in (2).
  4. Do late binding parsing also using code in (2) after unflattening the DTB.

And it works well enough under QEMU to populate boot_info to a first
approximation. It's missing hyperlaunch-specific bindings (like "domid"
or "mode"), but that's just a matter of adding them to the already
existing per-arch binding parser ("mode", maybe, would be a candidate
for this) or retrofit them in dom0less ("domid" is a very clear
candidate for this) and integrating in the larger series to be able to
actually boot domains.

The PoC does not go all the way due to time constraints, as I said, but
I think it goes far enough to convince me it's both feasible and
beneficial to go in this direction rather than that of a full
reimplementation on x86, specially seeing how Oleksii already aims to
have full code reuse on riscv.

A brave new world would reuse all data (including bootinfo) and code
(bootfdt.c/bootinfo.c), but I couldn't get that far, and I don't think
I'll be able to in a timely manner. IOW: I compiled-in device-tree.c,
but NOT bootfdt.c or bootinfo.c, or any of the others. I merely
extracted from those files the binding parsing bits of interest.

It'd be nice to use them, but the domain construction logic is just too
different at present. As for the code I tested with,  I need to do some serious
cleanup before it's ready for sharing, and even moreso for review, but before I
go through that I'd like to reach consensus on the following points before
investing any more of my time working on the side.

TL;DR:

I think we should aim to share binding code wherever possible, using common
datastructures (kernel_info and bootmodule) as dumping ground for the results
of the binding parsing functions. I seek agreement on the following 3 points
for the end goal of DTB multidomain boots on x86 before I start slicing
my hacks into reasonable chunks.

  1. We want common data structures, with arch-specific fields to hold
     information from xen,domain DT nodes
  2. We want to have a single collection of DTB parsers in the code.
  3. We want to operate on the unflattened DTB for the majority of parsing.
    (plus a minimal version on the FDT in order to bootstrap, also common)

(2) and (3) are tightly related. There's many reasons for wanting to use the
unflattened blobs as much as possible. They range from quirks in specific "dtc"
versions, to complexities parsing phandles, to corner cases involving duplicate
properties (i.e: due to .dtsi files), etc. Unflattening an FDT brings a
lots of "maybe-ok-after-sanitising" FDTs back into canonically correct DTs.

I'll share the PoC code as soon as as it's in a presentable state.
Hopefully by the end of the week. But I'm sending this ahead of time to
start collecting thoughts right away.

So. Thoughts?

Cheers,
Alejandro


^ permalink raw reply	[flat|nested] 88+ messages in thread

end of thread, other threads:[~2025-06-17  1:32 UTC | newest]

Thread overview: 88+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 14:35 Hyperlaunch/dom0less code sharing Alejandro Vallejo
2025-05-21 14:42 ` Jan Beulich
2025-05-21 21:07   ` Stefano Stabellini
2025-05-21 15:31 ` Daniel P. Smith
2025-05-21 17:32   ` Daniel P. Smith
2025-05-22 12:02   ` Alejandro Vallejo
2025-05-30 12:02 ` [PATCH 00/19] Allow x86 to unflatten DTs Alejandro Vallejo
2025-05-30 12:02   ` [PATCH 01/19] licence: Add missing SPDX line to bootfdt.h Alejandro Vallejo
2025-05-30 12:41     ` Orzel, Michal
2025-05-30 12:02   ` [PATCH 02/19] x86: Add missing pci_dev forward declaration in asm/pci.h Alejandro Vallejo
2025-05-30 21:04     ` Jason Andryuk
2025-06-02 13:45       ` Alejandro Vallejo
2025-06-02 16:40         ` Jason Andryuk
2025-05-31  0:42     ` Stefano Stabellini
2025-06-02  7:48     ` Jan Beulich
2025-06-02 14:01       ` Alejandro Vallejo
2025-06-02 14:19         ` Jan Beulich
2025-05-30 12:02   ` [PATCH 03/19] riscv: Add missing forward declaration to intc.h Alejandro Vallejo
2025-05-31  0:43     ` Stefano Stabellini
2025-05-30 12:02   ` [PATCH 04/19] xen: Add missing forward declaration to btcpupools_get_domain_pool_id Alejandro Vallejo
2025-05-31  0:46     ` Stefano Stabellini
2025-06-02 14:05       ` Alejandro Vallejo
2025-05-30 12:02   ` [PATCH 05/19] arm: Remove dependencies with membank(s) definitions from setup.h Alejandro Vallejo
2025-05-31  0:51     ` Stefano Stabellini
2025-06-02 14:07       ` Alejandro Vallejo
2025-06-05 13:28       ` Alejandro Vallejo
2025-05-30 12:02   ` [PATCH 06/19] xen: Clean up asm-generic/device.h Alejandro Vallejo
2025-05-31  0:55     ` Stefano Stabellini
2025-06-02  7:51     ` Jan Beulich
2025-06-02 14:19       ` Alejandro Vallejo
2025-06-02 14:24         ` Jan Beulich
2025-06-05 14:15           ` Alejandro Vallejo
2025-06-05 14:20             ` Jan Beulich
2025-06-05 16:48               ` Alejandro Vallejo
2025-06-06  6:24                 ` Jan Beulich
2025-05-30 12:02   ` [PATCH 07/19] arm/gnttab: Break cycle between asm/grant_table.h and xen/grant_table.h Alejandro Vallejo
2025-05-30 21:04     ` Jason Andryuk
2025-05-31  0:57       ` Stefano Stabellini
2025-06-02 14:20       ` Alejandro Vallejo
2025-06-02  7:53     ` Jan Beulich
2025-06-02 14:30       ` Alejandro Vallejo
2025-06-02 14:51         ` Jan Beulich
2025-06-02 16:39           ` Alejandro Vallejo
2025-06-03  7:04             ` Jan Beulich
2025-06-05 17:22               ` Alejandro Vallejo
2025-05-30 12:02   ` [PATCH 08/19] xen/dt: Add BOOTMOD_MICROCODE Alejandro Vallejo
2025-05-31  0:59     ` Stefano Stabellini
2025-06-05 17:24       ` Alejandro Vallejo
2025-05-30 12:02   ` [PATCH 09/19] x86: Preinitialise all modules to be of kind BOOTMOD_UNKNOWN Alejandro Vallejo
2025-05-31  1:07     ` Stefano Stabellini
2025-06-02  7:55     ` Jan Beulich
2025-06-05 17:24       ` Alejandro Vallejo
2025-05-30 12:02   ` [PATCH 10/19] x86: Replace boot_module with bootmodule Alejandro Vallejo
2025-05-31  1:15     ` Stefano Stabellini
2025-06-02 16:31       ` Alejandro Vallejo
2025-06-02 17:00     ` Andrew Cooper
2025-06-05 17:28       ` Alejandro Vallejo
2025-06-05 17:40         ` Alejandro Vallejo
2025-06-06  6:56           ` Jan Beulich
2025-06-06 20:14             ` Stefano Stabellini
2025-05-30 12:02   ` [PATCH 11/19] x86: Replace boot_domain with kernel_info Alejandro Vallejo
2025-05-30 12:02   ` [PATCH 12/19] xen/dt: Move bootfdt functions to xen/bootfdt.h Alejandro Vallejo
2025-05-31  0:35     ` dmkhn
2025-06-02  7:29       ` Orzel, Michal
2025-06-03  0:38         ` dmkhn
2025-06-02 16:41       ` Alejandro Vallejo
2025-06-03  0:42         ` dmkhn
2025-05-31  1:31     ` Stefano Stabellini
2025-05-31  1:40     ` Stefano Stabellini
2025-06-02 20:25     ` Daniel P. Smith
2025-06-05 18:03       ` Alejandro Vallejo
2025-06-05 23:19         ` Stefano Stabellini
2025-06-17  1:32         ` Daniel P. Smith
2025-05-30 12:02   ` [PATCH 13/19] xen/dt: Move bootinfo functions to a new bootinfo.h Alejandro Vallejo
2025-05-31  1:42     ` Stefano Stabellini
2025-06-05 18:04       ` Alejandro Vallejo
2025-05-30 12:02   ` [PATCH 14/19] xen/dt: Rename bootfdt.c -> bootinfo-fdt.c Alejandro Vallejo
2025-05-31  1:44     ` Stefano Stabellini
2025-05-30 12:02   ` [PATCH 15/19] xen/dt: Move bootinfo-independent helpers out of bootinfo-fdt.c Alejandro Vallejo
2025-05-31  0:39     ` dmkhn
2025-06-05 18:11       ` Alejandro Vallejo
2025-05-31  1:47     ` Stefano Stabellini
2025-06-02  8:00       ` Jan Beulich
2025-05-30 12:02   ` [PATCH 16/19] xen/dt: Extract helper to map nodes to module kinds Alejandro Vallejo
2025-05-31  1:48     ` Stefano Stabellini
2025-05-30 12:02   ` [PATCH 17/19] xen/dt: ifdef out DEV_DT-related bits from device_tree.{c,h} Alejandro Vallejo
2025-05-30 12:02   ` [PATCH 18/19] xen/dt: Allow CONFIG_DOM0LESS_BOOT to include device-tree/ Alejandro Vallejo
2025-05-30 12:05   ` [PATCH 19/19] kconfig: Allow x86 to pick CONFIG_DOM0LESS_BOOT Alejandro Vallejo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.