machine check exception panic trying to read root cell memory regions (motherboard, rom, video mem)

26 views
Skip to first unread message

Claudio Fontana

unread,
Mar 24, 2015, 5:27:24 AM3/24/15
to jailho...@googlegroups.com
Hello,

maybe it is normal, but I am not able to access to motherboard and video memory/ROM from the root cell after jailhouse enable,
while I can do it before enabling jailhouse.

I tested via

xxd /dev/mem | less

and I panic around 0x9bb20.

I tried also to xxd -s 0xa0000 and -s 0xb8000
with similar results.

The panic mentions

system_call_fastpath
SyS_read
vfs_read
__vfs_read
<<EOE>>? read_mem
?copy_user_generic_string
machine check
?copy_user_generic_string
do_machine_check
mce_panic

I would attach my-machine.c but the "attach a file" functionality in google groups does not work for me today.

I am running with iommu disabled (using amd's iommu skeleton implementations).

So here it is inline:

/*
* Jailhouse, a Linux-based partitioning hypervisor
*
* Copyright (c) Siemens AG, 2014
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
* Configuration for
* created with '/usr/local/libexec/jailhouse/jailhouse config create --no-iommu my-machine.c'
*
* NOTE: This config expects the following to be appended to your kernel cmdline
* "memmap=0x4200000$0x3b000000"
*/

#include <linux/types.h>
#include <jailhouse/cell-config.h>

#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))

struct {
struct jailhouse_system header;
__u64 cpus[1];
struct jailhouse_memory mem_regions[34];
struct jailhouse_irqchip irqchips[1];
__u8 pio_bitmap[0x2000];
struct jailhouse_pci_device pci_devices[14];
struct jailhouse_pci_capability pci_caps[29];
} __attribute__((packed)) config = {
.header = {
.hypervisor_memory = {
.phys_start = 0x3b000000,
.size = 0x4000000,
},
.platform_info.x86 = {
.mmconfig_base = 0xf8000000,
.mmconfig_end_bus = 0x3f,
.pm_timer_address = 0x408,
},
.device_limit = 128,
.interrupt_limit = 256,
.root_cell = {
.name = "RootCell",
.cpu_set_size = sizeof(config.cpus),
.num_memory_regions = ARRAY_SIZE(config.mem_regions),
.num_irqchips = ARRAY_SIZE(config.irqchips),
.pio_bitmap_size = ARRAY_SIZE(config.pio_bitmap),
.num_pci_devices = ARRAY_SIZE(config.pci_devices),
.num_pci_caps = ARRAY_SIZE(config.pci_caps),
},
},

.cpus = {
0x000000000000000f,
},

.mem_regions = {
/* MemRegion: 00000000-0009d7ff : System RAM */
{
.phys_start = 0x0,
.virt_start = 0x0,
.size = 0x9e000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: 000a0000-000bffff : PCI Bus 0000:00 */
{
.phys_start = 0xa0000,
.virt_start = 0xa0000,
.size = 0x20000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: 00100000-00ffffff : System RAM */
{
.phys_start = 0x100000,
.virt_start = 0x100000,
.size = 0xf00000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: 01000000-01ffffff : Kernel */
{
.phys_start = 0x1000000,
.virt_start = 0x1000000,
.size = 0x1000000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: 02000000-1fffffff : System RAM */
{
.phys_start = 0x2000000,
.virt_start = 0x2000000,
.size = 0x1e000000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: 20200000-3affffff : System RAM */
{
.phys_start = 0x20200000,
.virt_start = 0x20200000,
.size = 0x1ae00000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: 3f200000-3fffffff : System RAM */
{
.phys_start = 0x3f200000,
.virt_start = 0x3f200000,
.size = 0xe00000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: 40200000-da858fff : System RAM */
{
.phys_start = 0x40200000,
.virt_start = 0x40200000,
.size = 0x9a659000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: da859000-da8a3fff : ACPI Non-volatile Storage */
{
.phys_start = 0xda859000,
.virt_start = 0xda859000,
.size = 0x4b000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: da8a4000-da8abfff : ACPI Tables */
{
.phys_start = 0xda8a4000,
.virt_start = 0xda8a4000,
.size = 0x8000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: dabda000-dabe7fff : ACPI Non-volatile Storage */
{
.phys_start = 0xdabda000,
.virt_start = 0xdabda000,
.size = 0xe000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: dac10000-dac52fff : ACPI Non-volatile Storage */
{
.phys_start = 0xdac10000,
.virt_start = 0xdac10000,
.size = 0x43000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: dae8e000-daffffff : System RAM */
{
.phys_start = 0xdae8e000,
.virt_start = 0xdae8e000,
.size = 0x172000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: db000000-db7fffff : RAM buffer */
{
.phys_start = 0xdb000000,
.virt_start = 0xdb000000,
.size = 0x800000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: e0000000-efffffff : 0000:00:02.0 */
{
.phys_start = 0xe0000000,
.virt_start = 0xe0000000,
.size = 0x10000000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fe000000-fe3fffff : 0000:00:02.0 */
{
.phys_start = 0xfe000000,
.virt_start = 0xfe000000,
.size = 0x400000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fe400000-fe400fff : xhci-hcd */
{
.phys_start = 0xfe400000,
.virt_start = 0xfe400000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fe500000-fe51ffff : e1000e */
{
.phys_start = 0xfe500000,
.virt_start = 0xfe500000,
.size = 0x20000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fe520000-fe523fff : ICH HD audio */
{
.phys_start = 0xfe520000,
.virt_start = 0xfe520000,
.size = 0x4000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fe524000-fe5240ff : 0000:00:1f.3 */
{
.phys_start = 0xfe524000,
.virt_start = 0xfe524000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fe525000-fe5257ff : ahci */
{
.phys_start = 0xfe525000,
.virt_start = 0xfe525000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fe526000-fe5263ff : ehci_hcd */
{
.phys_start = 0xfe526000,
.virt_start = 0xfe526000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fe527000-fe5273ff : ehci_hcd */
{
.phys_start = 0xfe527000,
.virt_start = 0xfe527000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fe528000-fe528fff : e1000e */
{
.phys_start = 0xfe528000,
.virt_start = 0xfe528000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fe529000-fe52900f : 0000:00:16.0 */
{
.phys_start = 0xfe529000,
.virt_start = 0xfe529000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fed00000-fed003ff : PNP0103:00 */
{
.phys_start = 0xfed00000,
.virt_start = 0xfed00000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fed08000-fed08fff : pnp 00:04 */
{
.phys_start = 0xfed08000,
.virt_start = 0xfed08000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fed10000-fed19fff : pnp 00:00 */
{
.phys_start = 0xfed10000,
.virt_start = 0xfed10000,
.size = 0xa000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fed20000-fed3ffff : pnp 00:00 */
{
.phys_start = 0xfed20000,
.virt_start = 0xfed20000,
.size = 0x20000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: fed90000-fed93fff : pnp 00:00 */
{
.phys_start = 0xfed90000,
.virt_start = 0xfed90000,
.size = 0x4000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: 100000000-21f5fffff : System RAM */
{
.phys_start = 0x100000000,
.virt_start = 0x100000000,
.size = 0x11f600000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: 21f600000-21fffffff : RAM buffer */
{
.phys_start = 0x21f600000,
.virt_start = 0x21f600000,
.size = 0xa00000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
/* MemRegion: 000c0000-000dffff : ROMs */
{
.phys_start = 0xc0000,
.virt_start = 0xc0000,
.size = 0x20000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
/* MemRegion: 3f000000-3f1fffff : JAILHOUSE Inmate Memory */
{
.phys_start = 0x3f000000,
.virt_start = 0x3f000000,
.size = 0x200000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
},

.irqchips = {
/* IOAPIC 0, GSI base 0 */
{
.address = 0xfec00000,
.id = 0x0,
.pin_bitmap = 0xffffff,
},
},

.pio_bitmap = {
[ 0/8 ... 0x3f/8] = -1,
[ 0x40/8 ... 0x47/8] = 0xf0, /* PIT */
[ 0x48/8 ... 0x5f/8] = -1,
[ 0x60/8 ... 0x67/8] = 0xec, /* HACK: NMI status/control */
[ 0x68/8 ... 0x6f/8] = -1,
[ 0x70/8 ... 0x77/8] = 0xfc, /* RTC */
[ 0x78/8 ... 0x3af/8] = -1,
[ 0x3b0/8 ... 0x3df/8] = 0x00, /* VGA */
[ 0x3e0/8 ... 0xcff/8] = -1,
[ 0xd00/8 ... 0xffff/8] = 0, /* HACK: PCI bus */
},

.pci_devices = {
/* PCIDevice: 00:00.0 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0x0,
.caps_start = 0,
.num_caps = 1,
.num_msi_vectors = 0,
.msi_64bits = 0,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:02.0 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0x10,
.caps_start = 1,
.num_caps = 3,
.num_msi_vectors = 1,
.msi_64bits = 0,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:16.0 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0xb0,
.caps_start = 4,
.num_caps = 2,
.num_msi_vectors = 1,
.msi_64bits = 1,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:19.0 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0xc8,
.caps_start = 6,
.num_caps = 3,
.num_msi_vectors = 1,
.msi_64bits = 1,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:1a.0 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0xd0,
.caps_start = 9,
.num_caps = 3,
.num_msi_vectors = 0,
.msi_64bits = 0,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:1b.0 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0xd8,
.caps_start = 12,
.num_caps = 3,
.num_msi_vectors = 1,
.msi_64bits = 1,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:1c.0 */
{
.type = JAILHOUSE_PCI_TYPE_BRIDGE,
.iommu = 0,
.domain = 0x0,
.bdf = 0xe0,
.caps_start = 15,
.num_caps = 4,
.num_msi_vectors = 1,
.msi_64bits = 0,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:1c.3 */
{
.type = JAILHOUSE_PCI_TYPE_BRIDGE,
.iommu = 0,
.domain = 0x0,
.bdf = 0xe3,
.caps_start = 15,
.num_caps = 4,
.num_msi_vectors = 1,
.msi_64bits = 0,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:1d.0 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0xe8,
.caps_start = 9,
.num_caps = 3,
.num_msi_vectors = 0,
.msi_64bits = 0,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:1f.0 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0xf8,
.caps_start = 0,
.num_caps = 1,
.num_msi_vectors = 0,
.msi_64bits = 0,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:1f.2 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0xfa,
.caps_start = 19,
.num_caps = 4,
.num_msi_vectors = 1,
.msi_64bits = 0,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 00:1f.3 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0xfb,
.caps_start = 0,
.num_caps = 0,
.num_msi_vectors = 0,
.msi_64bits = 0,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 01:00.0 */
{
.type = JAILHOUSE_PCI_TYPE_BRIDGE,
.iommu = 0,
.domain = 0x0,
.bdf = 0x100,
.caps_start = 23,
.num_caps = 2,
.num_msi_vectors = 0,
.msi_64bits = 0,
.num_msix_vectors = 0,
.msix_region_size = 0x0,
.msix_address = 0x0,
},
/* PCIDevice: 03:00.0 */
{
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.iommu = 0,
.domain = 0x0,
.bdf = 0x300,
.caps_start = 25,
.num_caps = 4,
.num_msi_vectors = 8,
.msi_64bits = 1,
.num_msix_vectors = 8,
.msix_region_size = 0x1000,
.msix_address = 0xfe401000,
},
},

.pci_caps = {
/* PCIDevice: 00:00.0 */
/* PCIDevice: 00:1f.0 */
{
.id = 0x9,
.start = 0xe0,
.len = 2,
.flags = 0,
},
/* PCIDevice: 00:02.0 */
{
.id = 0x5,
.start = 0x90,
.len = 10,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x1,
.start = 0xd0,
.len = 8,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x13,
.start = 0xa4,
.len = 2,
.flags = 0,
},
/* PCIDevice: 00:16.0 */
{
.id = 0x1,
.start = 0x50,
.len = 8,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x5,
.start = 0x8c,
.len = 14,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
/* PCIDevice: 00:19.0 */
{
.id = 0x1,
.start = 0xc8,
.len = 8,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x5,
.start = 0xd0,
.len = 14,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x13,
.start = 0xe0,
.len = 2,
.flags = 0,
},
/* PCIDevice: 00:1a.0 */
/* PCIDevice: 00:1d.0 */
{
.id = 0x1,
.start = 0x50,
.len = 8,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0xa,
.start = 0x58,
.len = 2,
.flags = 0,
},
{
.id = 0x13,
.start = 0x98,
.len = 2,
.flags = 0,
},
/* PCIDevice: 00:1b.0 */
{
.id = 0x1,
.start = 0x50,
.len = 8,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x5,
.start = 0x60,
.len = 14,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x10,
.start = 0x70,
.len = 2,
.flags = 0,
},
/* PCIDevice: 00:1c.0 */
/* PCIDevice: 00:1c.3 */
{
.id = 0x10,
.start = 0x40,
.len = 2,
.flags = 0,
},
{
.id = 0x5,
.start = 0x80,
.len = 10,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0xd,
.start = 0x90,
.len = 2,
.flags = 0,
},
{
.id = 0x1,
.start = 0xa0,
.len = 8,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
/* PCIDevice: 00:1f.2 */
{
.id = 0x5,
.start = 0x80,
.len = 10,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x1,
.start = 0x70,
.len = 8,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x12,
.start = 0xa8,
.len = 2,
.flags = 0,
},
{
.id = 0x13,
.start = 0xb0,
.len = 2,
.flags = 0,
},
/* PCIDevice: 01:00.0 */
{
.id = 0x1,
.start = 0x90,
.len = 8,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0xd,
.start = 0xa0,
.len = 2,
.flags = 0,
},
/* PCIDevice: 03:00.0 */
{
.id = 0x1,
.start = 0x50,
.len = 8,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x5,
.start = 0x70,
.len = 14,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x11,
.start = 0x90,
.len = 12,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{
.id = 0x10,
.start = 0xa0,
.len = 2,
.flags = 0,
},
},
};

Jan Kiszka

unread,
Mar 24, 2015, 7:17:50 AM3/24/15
to Claudio Fontana, jailho...@googlegroups.com
On 2015-03-24 10:27, Claudio Fontana wrote:
> Hello,
>
> maybe it is normal, but I am not able to access to motherboard and video memory/ROM from the root cell after jailhouse enable,
> while I can do it before enabling jailhouse.
>
> I tested via
>
> xxd /dev/mem | less
>
> and I panic around 0x9bb20.
>
> I tried also to xxd -s 0xa0000 and -s 0xb8000
> with similar results.
>
> The panic mentions
>
> system_call_fastpath
> SyS_read
> vfs_read
> __vfs_read
> <<EOE>>? read_mem
> ?copy_user_generic_string
> machine check
> ?copy_user_generic_string
> do_machine_check
> mce_panic

Can you capture the full error trace on the serial console or wherever
you get hold of the text?

Note that MCEs, if they actually trigger, can cause troubles because
Jailhouse is not yet prepared for them.

Jan

Claudio Fontana

unread,
Mar 24, 2015, 7:32:25 AM3/24/15
to Jan Kiszka, jailho...@googlegroups.com
Ok, I'll try to capture this. It's very reproducible and always
mention machine check exceptions.

Claudio Fontana

unread,
Mar 30, 2015, 10:24:43 AM3/30/15
to Jan Kiszka, jailho...@googlegroups.com
On 24 March 2015 at 12:32, Claudio Fontana <hw.cl...@gmail.com> wrote:
> On 24 March 2015 at 12:17, Jan Kiszka <jan.k...@web.de> wrote:
>> On 2015-03-24 10:27, Claudio Fontana wrote:
>>> Hello,
>>>
>>> maybe it is normal, but I am not able to access to motherboard and video memory/ROM from the root cell after jailhouse enable,
>>> while I can do it before enabling jailhouse.
>>>
>>> I tested via
>>>
>>> xxd /dev/mem | less
>>>
>>> and I panic around 0x9bb20.
>>>
>>> I tried also to xxd -s 0xa0000 and -s 0xb8000
>>> with similar results.

Actually there are two separate manifestations of the problem.

With xxd /dev/mem | less around /after 0x9d000, for example, right now
I got that
the process locks forever, but the machine does not crash / panic.

This is the xxd output at that time (not useful, just for context):

009d720: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d730: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d740: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d750: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d760: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d770: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d780: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d790: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d7a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d7b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d7c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d7d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d7e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d7f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d800: 0a00 0000 0000 0000 0000 0000 0000 0000 ................
009d810: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d820: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d830: 0000 0000 0000 0000 0000 0000 0013 0fff ................
009d840: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d850: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d860: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d870: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d880: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d890: 0100 0000 0000 0000 0000 0000 0000 0000 ................
009d8a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d8b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d8c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d8d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d8e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d8f0: 0000 0000 0000 0000 0100 0000 0000 0000 ................
009d900: 0000 0000 a847 0000 0000 0000 0000 0000 .....G..........
009d910: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d920: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d930: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d940: 0000 0000 0000 0000 0000 0000 0000 0000 ................
009d950: 0000 0000 0000 0000 0000 0000 0000 0000 ................

This is top showing xxd consuming a whole cpu (99%):

Tasks: 125 total, 2 running, 123 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.3%us, 0.3%sy, 0.0%ni, 96.8%id, 1.5%wa, 0.0%hi, 0.0%s
Mem: 8013456k total, 453356k used, 7560100k free, 59924k buf
Swap: 8000332k total, 0k used, 8000332k free, 263424k cac

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1030 root 20 0 4360 620 548 R 99 0.0 0:15.44 xxd
1 root 20 0 4364 1420 1320 S 0 0.0 0:00.14 init
2 root 20 0 0 0 0 S 0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0 0.0 0:00.00 ksoftirq
5 root 0 -20 0 0 0 S 0 0.0 0:00.00 kworker/
7 root 20 0 0 0 0 S 0 0.0 0:00.10 rcu_sche
8 root 20 0 0 0 0 S 0 0.0 0:00.00 rcu_bh
9 root RT 0 0 0 0 S 0 0.0 0:00.00 migratio
10 root RT 0 0 0 0 S 0 0.0 0:00.00 migratio
11 root 20 0 0 0 0 S 0 0.0 0:00.00 ksoftirq
12 root 20 0 0 0 0 S 0 0.0 0:00.00 kworker/
13 root 0 -20 0 0 0 S 0 0.0 0:00.00 kworker/
14 root RT 0 0 0 0 S 0 0.0 0:00.00 migratio
15 root 20 0 0 0 0 S 0 0.0 0:00.00 ksoftirq
17 root 0 -20 0 0 0 S 0 0.0 0:00.00 kworker/
18 root RT 0 0 0 0 S 0 0.0 0:00.00 migratio
19 root 20 0 0 0 0 S 0 0.0 0:00.00 ksoftirq
21 root 0 -20 0 0 0 S 0 0.0 0:00.00 kworker/
22 root 0 -20 0 0 0 S 0 0.0 0:00.00 khelper
23 root 20 0 0 0 0 S 0 0.0 0:00.00 kdevtmpf
24 root 0 -20 0 0 0 S 0 0.0 0:00.00 netns
25 root 0 -20 0 0 0 S 0 0.0 0:00.00 perf
26 root 20 0 0 0 0 S 0 0.0 0:00.00 khungtas
27 root 0 -20 0 0 0 S 0 0.0 0:00.00 writebac
29 root 25 5 0 0 0 S 0 0.0 0:00.00 ksmd
30 root 39 19 0 0 0 S 0 0.0 0:00.08 khugepag
31 root 0 -20 0 0 0 S 0 0.0 0:00.00 crypto
32 root 0 -20 0 0 0 S 0 0.0 0:00.00 kintegri
33 root 0 -20 0 0 0 S 0 0.0 0:00.00 bioset
34 root 0 -20 0 0 0 S 0 0.0 0:00.00 kblockd

In dmesg I got:
[ 507.001176] The Jailhouse is opening.
[ 628.075244] INFO: rcu_sched detected stalls on CPUs/tasks: { 3}
(detected by 0, t=18002 jiffies, g=5908, c=5907, q=5629)
[ 628.075249] Task dump for CPU 3:
[ 628.075251] xxd R running task 0 1030 1028 0x00000008
[ 628.075253] 000000000009e000 000000000009efff ffff88021614fe80
0000000080000200
[ 628.075255] 0000000000000001 0000000000002000 ffffc90000000000
000000000009e000
[ 628.075266] 0000000000000000 ffffc9000439afff ffffc9000439afff
ffff8800d5c23dc8
[ 628.075268] Call Trace:
[ 628.075283] [<ffffffff8106f9cf>] ? iomem_map_sanity_check+0x96/0xba
[ 628.075286] [<ffffffff8102e844>] ? __ioremap_caller+0x26b/0x2e9
[ 628.075288] [<ffffffff8102e909>] ? ioremap_cache+0xf/0x11
[ 628.075290] [<ffffffff8102ea42>] ? xlate_dev_mem_ptr+0x40/0x5d
[ 628.075293] [<ffffffff81322a1a>] ? read_mem+0xfd/0x16a
[ 628.075299] [<ffffffff81106343>] ? SyS_read+0x42/0x86
[ 628.075302] [<ffffffff814a0676>] ? system_call_fastpath+0x16/0x1b
[ 709.542630] IN=eth0 OUT=
MAC=01:00:5e:00:00:01:00:1c:4a:7a:40:b0:08:00 SRC=192.168.2.1
DST=224.0.0.1 LEN=36 TOS=0x00 PREC=0x80 TTL=1 ID=22864 DF PROTO=2
[ 808.174895] INFO: rcu_sched detected stalls on CPUs/tasks: { 3}
(detected by 0, t=72007 jiffies, g=5908, c=5907, q=8349)
[ 808.174902] Task dump for CPU 3:
[ 808.174904] xxd R running task 0 1030 1028 0x00000008
[ 808.174907] 000000000009e000 000000000009efff ffff88021614fe80
0000000080000200
[ 808.174910] 0000000000000001 0000000000002000 ffffc90000000000
000000000009e000
[ 808.174912] 0000000000000000 ffffc9000439afff ffffc9000439afff
ffff8800d5c23dc8
[ 808.174915] Call Trace:
[ 808.174923] [<ffffffff8106f9cf>] ? iomem_map_sanity_check+0x96/0xba
[ 808.174927] [<ffffffff8102e844>] ? __ioremap_caller+0x26b/0x2e9
[ 808.174930] [<ffffffff8102e909>] ? ioremap_cache+0xf/0x11
[ 808.174933] [<ffffffff8102ea42>] ? xlate_dev_mem_ptr+0x40/0x5d
[ 808.174936] [<ffffffff81322a1a>] ? read_mem+0xfd/0x16a
[ 808.174941] [<ffffffff811061bc>] ? __vfs_read+0x14/0x3b
[ 808.174943] [<ffffffff81106267>] ? vfs_read+0x84/0x11e
[ 808.174946] [<ffffffff81106343>] ? SyS_read+0x42/0x86
[ 808.174950] [<ffffffff814a0676>] ? system_call_fastpath+0x16/0x1b

The system is still functional (I am writing from it!) if I don't try
to play with jailhouse too much.
I tried jailhouse disable and that locks the machine up for good.

Hope this helps..

Thanks,

Claudio

Henning Schild

unread,
Mar 30, 2015, 11:07:57 AM3/30/15
to Claudio Fontana, Jan Kiszka, jailho...@googlegroups.com
On Mon, 30 Mar 2015 16:24:42 +0200
Claudio Fontana <hw.cl...@gmail.com> wrote:

> I tried jailhouse disable and that locks the machine up for good.

Jailhouse is probably just shutting down the Linux cell. With this
being your only workload it looks like a crash.

> Hope this helps..

Again, the serial console output would be very helpful. If your
current test machine does not have one, please keep in mind that the
next one should definitely have one! On desktop boards these ports seem
to be dying out, but you can still find them.

Henning


Jan Kiszka

unread,
Mar 30, 2015, 12:00:22 PM3/30/15
to Henning Schild, Claudio Fontana, jailho...@googlegroups.com
...or plug in a PCIe UART card. That may require some tweaking to get
Jailhouse print over that channel, but usually it's not very tricky.

Jan

Claudio Fontana

unread,
Mar 31, 2015, 8:03:01 AM3/31/15
to Jan Kiszka, Henning Schild, jailho...@googlegroups.com
I'll try this option, as I don't have serial console on my current
machine and it takes time to get a different one.
Which kind of tweaking do you think is necessary to get it to work?

I see that arch_dbg_write is used for the output,
and I see predefined values for some UARTs, is there a particular card
that you'd suggest?
Do you think the modifications will be limited to that particular
file, or is anything else involved?

Thanks,

Claudio

>
> Jan
>

Henning Schild

unread,
Mar 31, 2015, 9:06:18 AM3/31/15
to Claudio Fontana, Jan Kiszka, jailho...@googlegroups.com
On Tue, 31 Mar 2015 14:03:00 +0200
Claudio Fontana <hw.cl...@gmail.com> wrote:

> I'll try this option, as I don't have serial console on my current
> machine and it takes time to get a different one.
> Which kind of tweaking do you think is necessary to get it to work?

It will basically mean having to adjust the IO port numbers in a few
places, not difficult at all.

> I see that arch_dbg_write is used for the output,
> and I see predefined values for some UARTs, is there a particular card
> that you'd suggest?

I do not have a lot of experience with those PCI cards, the few times i
have used them they just worked. I do not even recall names/brands.
Once you buy one go for at least two ports, the remaining ports can be
assigned to cells. You might need USB-serial converters for the other
end of the line. Some of these guys do not work properly under Linux,
if you buy two or more it might be worth getting different ones.

> Do you think the modifications will be limited to that particular
> file, or is anything else involved?

The places i can think of right now are: the hypervisor-code, the
cell-code, and the cell configs. Optionally the boot-loader config of
the machine.

Henning

Claudio Fontana

unread,
Apr 1, 2015, 8:52:57 AM4/1/15
to Henning Schild, Jan Kiszka, jailho...@googlegroups.com
One thing that comes to mind to capture the inmate output is to share
a memory region between inmate and root cell,
and write the printk output from the inmate there.
I tried this and it seems to work well.

As for the hypervisor output, isn't it supposed to land in dmesg?
As long as I can keep the root cell running, which output am I missing
here, that is sent only to the serial?

Thanks,

Claudio

Jan Kiszka

unread,
Apr 1, 2015, 8:59:04 AM4/1/15
to Claudio Fontana, Henning Schild, jailho...@googlegroups.com
Yes, that shall once be done (additionally and optionally) via the
inter-cell communication mechanism - once we have a console binding on
the Linux side. It has the downside that you will only get outputs if
Linux survives what the hypervisor reported.

>
> As for the hypervisor output, isn't it supposed to land in dmesg?

No, see above why that is not default.

> As long as I can keep the root cell running, which output am I missing
> here, that is sent only to the serial?

All hypervisor messages go to serial only. Only the few messages that
the management driver reports go to the kernel console. Most errors are
reported only by the hypervisor, any many of them may actually be
followed by the suspension of a cell CPU. If that is the Linux core that
would pick up the hypervisor messages from a shared memory page or so,
you will never see them.

Jan

--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux

Claudio Fontana

unread,
Apr 1, 2015, 9:28:57 AM4/1/15
to Jan Kiszka, Henning Schild, jailho...@googlegroups.com
Thanks for the clarification. Now I have to capture this serial output..

Henning Schild

unread,
Apr 2, 2015, 8:07:05 AM4/2/15
to Claudio Fontana, jailho...@googlegroups.com
On Wed, 1 Apr 2015 14:52:57 +0200
Claudio Fontana <hw.cl...@gmail.com> wrote:

> One thing that comes to mind to capture the inmate output is to share
> a memory region between inmate and root cell,
> and write the printk output from the inmate there.
> I tried this and it seems to work well.

For such a memory region make sure you add the JAILHOUSE_MEM_ROOTSHARED
flag.
The prefered way of doing such communication is the inter-cell
communication mechanism. The shared memory and signaling are part of
jailhouse already, a higher level protocol is not defined yet. But if
you are going to roll your own you might want to base it on the
existing stuff.

see Documentation/inter-cell-communication.txt

As Jan already mentioned, if you redirect your prints to another cell
you rely on that cell to be available.

Henning

Zhangjun (V)

unread,
Apr 2, 2015, 8:16:28 AM4/2/15
to Henning Schild, Claudio Fontana, jailho...@googlegroups.com, Gongbinyang
>> One thing that comes to mind to capture the inmate output is to share
>> a memory region between inmate and root cell, and write the printk
>> output from the inmate there.
>> I tried this and it seems to work well.

>For such a memory region make sure you add the JAILHOUSE_MEM_ROOTSHARED flag.
>The prefered way of doing such communication is the inter-cell communication mechanism. The shared memory and signaling are part of jailhouse already, a higher >level protocol is not defined yet. But if you are going to roll your own you might want to base it on the existing stuff.

>see Documentation/inter-cell-communication.txt

>As Jan already mentioned, if you redirect your prints to another cell you rely on that cell to be available.

This method mentioned above is a way to solve the problem, but it's not the best way. I preferred to buy a serial port card. It is more easier:)


Henning Schild

unread,
Apr 2, 2015, 8:23:50 AM4/2/15
to Zhangjun (V), Claudio Fontana, jailho...@googlegroups.com
On Thu, 2 Apr 2015 12:12:59 +0000
"Zhangjun (V)" <BIOS.z...@huawei.com> wrote:

> This method mentioned above is a way to solve the problem, but it's
> not the best way. I preferred to buy a serial port card. It is more
> easier:)

For the hypervisor output you will need the serial port for sure.

Henning

Reply all
Reply to author
Forward
0 new messages