Hi Jan,

Here a proof of concept for the cache-coloring with/without driver approach 
(works, but hasn't been tested as much as the old version, and we have seen at 
least one crash in our tests, but it should be sufficient to have a discussion 
about the direction).

The patches until 0018-configs-arm64-add-coloring-example-for-qemu-arm64.patch 
implement the previous coloring approach (+ bugfixing + qemu-arm64 
integration). The patches from 
0019-config-always-rely-on-the-availability-of-way_size.patch are the proof of 
concept to realize a colored jailhouse ioremap in the driver, keeping the same 
logic between the hypervisor and the driver.

The "get_bit_range()" is refactored in a single place already 
(0020-coloring-extract-get_bit_range-logic-and-remove-offs.patch), but the main 
logic needs to be replicated between hypervisor and driver [*], coloring.c 
doesn't get considerably shorter, and control.c gets more complicated because 
we need to distinguish when the remapping is colored and when it's not.

Most of the code reduction comes from the removal of the cache_layout 
autodetection, which is "debug only" (and could have been removed in the 
previous version as well).

Overall I count for the previous approach (patches 01 - 18):
 42 files changed, 1337 insertions(+), 121 deletions(-)
For the new one (patches 01 - 23):
 41 files changed, 1233 insertions(+), 127 deletions(-)

I've also pushed both versions here (if it's easier for you to take a look):
old: https://gitlab.com/bastoni/jailhouse/-/commits/for_upstream/202101_coloring
new: 
https://gitlab.com/bastoni/jailhouse/-/commits/for_upstream/202101_coloring_driver

Thanks,
Andrea

[*]: There's the possibility to consolidate the double loop preserving the 
logic and taking a pointer to the function + arguments to call, but we wanted 
first to show the full logic.

Andrea Bastoni (20):
  arm-common: bitops: add most-significant-bit operation
  hypervisor, driver, archs: add basic empty infrastructure for coloring
  hypervisor: arm64: add cache coloring implementation
  hypervisor configuration: hook autodetection for coloring_way_size
  configs: arm64: add example configuration for colored ZCU102 inmate
  hypervisor: protect inclusion of control.h
  hypervisor, driver: add platform information to configure coloring
    params
  configs: arm64: hook-in coloring parameters for ZCU102
  hypervisor: provide runtime assert() helper for DEBUG only
  hypervisor: provide implementation for __assert_fail() and group
    panic-related functions
  hypervisor: coloring: use assert instead of "BUG"
  hypervisor: coloring: make cache autodetection debug-only
  arm64: coloring: panic if a coloring operation is requested but
    way_size is not configured
  coloring: config: use u64 for the color bitmask
  configs: arm64: add coloring example for qemu-arm64
  config: always rely on the availability of way_size
  coloring: extract get_bit_range() logic and remove offset dependency
  configs: remove color offsets for remapping
  driver: coloring: add colored version of ioremapping
  hypervisors: identify when using colored/non-colored (re/un)map for
    root cell

Luca Miccio (3):
  Documentation: add description and usage of cache coloring support
  pyjailhouse: add support for colored regions
  coloring: fix physical start address computation

 Documentation/cache-coloring.md               | 198 ++++++++++++++++++
 configs/arm64/qemu-arm64-inmate-demo-col.c    | 134 ++++++++++++
 configs/arm64/qemu-arm64.c                    |   3 +
 configs/arm64/zynqmp-zcu102-inmate-demo-col.c |  75 +++++++
 configs/arm64/zynqmp-zcu102.c                 |   3 +
 driver/cell.c                                 |  16 +-
 driver/main.c                                 |  75 +++++++
 driver/main.h                                 |   4 +
 hypervisor/Makefile                           |   2 +-
 hypervisor/arch/arm-common/control.c          |   1 +
 .../arch/arm-common/include/asm/bitops.h      |  10 +
 .../arch/arm-common/include/asm/dcaches.h     |   8 +
 hypervisor/arch/arm-common/mmu_cell.c         |  52 +++--
 hypervisor/arch/arm/control.c                 |   1 +
 hypervisor/arch/arm/include/asm/coloring.h    |  59 ++++++
 hypervisor/arch/arm/traps.c                   |   1 +
 hypervisor/arch/arm64/Kbuild                  |   1 +
 hypervisor/arch/arm64/coloring.c              | 144 +++++++++++++
 hypervisor/arch/arm64/control.c               |   1 +
 hypervisor/arch/arm64/include/asm/coloring.h  | 120 +++++++++++
 hypervisor/arch/arm64/setup.c                 |   3 +
 hypervisor/arch/arm64/traps.c                 |   1 +
 hypervisor/arch/x86/amd_iommu.c               |   1 +
 hypervisor/arch/x86/control.c                 |   1 +
 hypervisor/arch/x86/efifb.c                   |   1 +
 hypervisor/arch/x86/include/asm/coloring.h    |  45 ++++
 hypervisor/arch/x86/ioapic.c                  |   1 +
 hypervisor/arch/x86/svm.c                     |   1 +
 hypervisor/arch/x86/vmx.c                     |   1 +
 hypervisor/control.c                          | 129 +++++-------
 hypervisor/include/jailhouse/assert.h         |  37 ++++
 hypervisor/include/jailhouse/control.h        |  34 +--
 hypervisor/include/jailhouse/panic.h          |  40 ++++
 hypervisor/include/jailhouse/printk.h         |   4 +
 hypervisor/panic.c                            |  86 ++++++++
 hypervisor/pci.c                              |   1 +
 hypervisor/printk.c                           |   1 +
 hypervisor/uart.c                             |   1 +
 include/jailhouse/cell-config.h               |   9 +
 include/jailhouse/coloring.h                  |  46 ++++
 pyjailhouse/config_parser.py                  |   9 +-
 41 files changed, 1233 insertions(+), 127 deletions(-)
 create mode 100644 Documentation/cache-coloring.md
 create mode 100644 configs/arm64/qemu-arm64-inmate-demo-col.c
 create mode 100644 configs/arm64/zynqmp-zcu102-inmate-demo-col.c
 create mode 100644 hypervisor/arch/arm/include/asm/coloring.h
 create mode 100644 hypervisor/arch/arm64/coloring.c
 create mode 100644 hypervisor/arch/arm64/include/asm/coloring.h
 create mode 100644 hypervisor/arch/x86/include/asm/coloring.h
 create mode 100644 hypervisor/include/jailhouse/assert.h
 create mode 100644 hypervisor/include/jailhouse/panic.h
 create mode 100644 hypervisor/panic.c
 create mode 100644 include/jailhouse/coloring.h

-- 
2.29.2

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20210125120044.56794-1-andrea.bastoni%40tum.de.

Reply via email to