Skip to content

Commit

Permalink
tests/qemu: boot-analysis: Port this program to aarch64 (using UEFI).
Browse files Browse the repository at this point in the history
  • Loading branch information
rwmjones committed Apr 30, 2016
1 parent 606f158 commit d5c4026
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
31 changes: 23 additions & 8 deletions tests/qemu/boot-analysis-timeline.c
Expand Up @@ -216,71 +216,85 @@ construct_timeline (void)
data->events[k].source == GUESTFS_EVENT_LIBRARY &&
strstr (data->events[k].message, "libvirt XML:"));

#if defined(__aarch64__)
#define FIRST_KERNEL_MESSAGE "Booting Linux on physical CPU"
#define FIRST_FIRMWARE_MESSAGE "UEFI firmware starting"
#else
#define SGABIOS_STRING "\033[1;256r\033[256;256H\033[6n"
#define FIRST_KERNEL_MESSAGE "Probing EDD"
#define FIRST_FIRMWARE_MESSAGE SGABIOS_STRING
#endif

/* For the libvirt backend, find the overhead of libvirt. */
FIND_OPTIONAL ("libvirt:overhead", 0,
data->events[j].source == GUESTFS_EVENT_LIBRARY &&
strstr (data->events[j].message, "launch libvirt guest"),
data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[k].message, SGABIOS_STRING));
strstr (data->events[k].message, FIRST_FIRMWARE_MESSAGE));

/* From starting qemu up to entering the BIOS is the qemu overhead. */
FIND_OPTIONAL ("qemu:overhead", 0,
data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[j].message, "-nodefconfig"),
data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[k].message, SGABIOS_STRING));
strstr (data->events[k].message, FIRST_FIRMWARE_MESSAGE));

/* From entering the BIOS to starting the kernel is the BIOS overhead. */
FIND_OPTIONAL ("bios:overhead", 0,
data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[j].message, SGABIOS_STRING),
strstr (data->events[j].message, FIRST_FIRMWARE_MESSAGE),
data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[k].message, "Probing EDD"));
strstr (data->events[k].message, FIRST_KERNEL_MESSAGE));

#if defined(__i386__) || defined(__x86_64__)
/* SGABIOS (option ROM). */
FIND_OPTIONAL ("sgabios", 0,
data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[j].message, SGABIOS_STRING),
data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[k].message, "SeaBIOS (version"));
#endif

#if defined(__i386__) || defined(__x86_64__)
/* SeaBIOS. */
FIND ("seabios", 0,
data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[j].message, "SeaBIOS (version"),
data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[k].message, "Probing EDD"));
strstr (data->events[k].message, FIRST_KERNEL_MESSAGE));
#endif

#if defined(__i386__) || defined(__x86_64__)
/* SeaBIOS - only available when using debug messages. */
FIND_OPTIONAL ("seabios:pci-probe", 0,
data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[j].message, "Searching bootorder for: /pci@"),
data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[k].message, "Scan for option roms"));
#endif

/* Find where we run the guest kernel. */
FIND ("kernel", LONG_ACTIVITY,
data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[j].message, "Probing EDD"),
strstr (data->events[j].message, FIRST_KERNEL_MESSAGE),
data->events[k].source == GUESTFS_EVENT_CLOSE);

/* Kernel startup to userspace. */
FIND ("kernel:overhead", 0,
data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[j].message, "Probing EDD"),
strstr (data->events[j].message, FIRST_KERNEL_MESSAGE),
data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[k].message, "supermin:") &&
strstr (data->events[k].message, "starting up"));

/* The time taken to get into start_kernel function. */
FIND ("kernel:entry", 0,
data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[j].message, "Probing EDD"),
strstr (data->events[j].message, FIRST_KERNEL_MESSAGE),
data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[k].message, "Linux version"));

#if defined(__i386__) || defined(__x86_64__)
/* Alternatives patching instructions (XXX not very accurate we
* really need some debug messages inserted into the code).
*/
Expand All @@ -289,6 +303,7 @@ construct_timeline (void)
strstr (data->events[j].message, "Last level dTLB entries"),
data->events[k].source == GUESTFS_EVENT_APPLIANCE &&
strstr (data->events[k].message, "Freeing SMP alternatives"));
#endif

/* ftrace patching instructions. */
FIND ("kernel:ftrace", 0,
Expand Down
4 changes: 2 additions & 2 deletions tests/qemu/boot-analysis.c
Expand Up @@ -235,8 +235,8 @@ main (int argc, char *argv[])

libvirt_log_hack (argc, argv);

if (STRNEQ (host_cpu, "x86_64"))
fprintf (stderr, "WARNING: host_cpu != x86_64: This program may not work or give bogus results.\n");
if (STRNEQ (host_cpu, "x86_64") && STRNEQ (host_cpu, "aarch64"))
fprintf (stderr, "WARNING: host_cpu != x86_64|aarch64: This program may not work or give bogus results.\n");

run_test ();
}
Expand Down

0 comments on commit d5c4026

Please sign in to comment.