diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:17:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:17:27 +0000 |
commit | f215e02bf85f68d3a6106c2a1f4f7f063f819064 (patch) | |
tree | 6bb5b92c046312c4e95ac2620b10ddf482d3fa8b /src/VBox/VMM/dtrace | |
parent | Initial commit. (diff) | |
download | virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.tar.xz virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.zip |
Adding upstream version 7.0.14-dfsg.upstream/7.0.14-dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/VMM/dtrace')
-rw-r--r-- | src/VBox/VMM/dtrace/int-1.d | 135 | ||||
-rw-r--r-- | src/VBox/VMM/dtrace/lib/amd64/vbox-arch-types.d | 49 | ||||
-rw-r--r-- | src/VBox/VMM/dtrace/lib/vbox-types.d | 68 | ||||
-rw-r--r-- | src/VBox/VMM/dtrace/lib/x86/vbox-arch-types.d | 32 | ||||
-rw-r--r-- | src/VBox/VMM/dtrace/return-to-ring-3-aggregation-1.d | 46 | ||||
-rw-r--r-- | src/VBox/VMM/dtrace/vmexit-reason-aggregation-1.d | 46 | ||||
-rw-r--r-- | src/VBox/VMM/dtrace/vmexit-rip-aggregation-1.d | 42 |
7 files changed, 418 insertions, 0 deletions
diff --git a/src/VBox/VMM/dtrace/int-1.d b/src/VBox/VMM/dtrace/int-1.d new file mode 100644 index 00000000..0aa3a1e8 --- /dev/null +++ b/src/VBox/VMM/dtrace/int-1.d @@ -0,0 +1,135 @@ +/* $Id: int-1.d $ */ +/** @file + * DTracing VBox - Interrupt Experiment #1. + */ + +/* + * Copyright (C) 2012-2023 Oracle and/or its affiliates. + * + * This file is part of VirtualBox base platform packages, as + * available from https://www.virtualbox.org. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, in version 3 of the + * License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses>. + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#pragma D option quiet + +uint64_t g_aStarts[uint32_t]; +uint64_t g_cUntaggedHighs; +uint64_t g_cUntaggedGets; +uint64_t g_cMissedHighs; + +inline uint32_t kfDevIdMask = 0x3ff; + + +/* + * Timestamp the when the device raises the IRQ. + */ +vboxvmm*:::pdm-irq-high,vboxvmm*:::pdm-irq-hilo +/args[1] != 0/ +{ + /*printf("high: tag=%#x src=%d %llx -> %llx\n", args[1], args[2], g_aStarts[args[1]], timestamp);*/ + g_aStarts[args[1]] = timestamp; +} + +vboxvmm*:::pdm-irq-high,vboxvmm*:::pdm-irq-hilo +/args[1] == 0/ +{ + g_cUntaggedHighs++; +} + +/* + * Catch the CPU getting the IRQ from the (A)PIC and preparing for injection. + */ +vboxvmm*:::pdm-irq-get +/g_aStarts[args[1]] == 0 && args[1] != 0/ +{ + printf("get: tag=%#x src=%d %llx - %llx = %llx\n", args[1], args[2], timestamp, g_aStarts[args[1]], timestamp - g_aStarts[args[1]]); + @g_MissedHighs[args[3], args[2] & kfDevIdMask] = count(); + g_cMissedHighs++; +} + +vboxvmm*:::pdm-irq-get +/g_aStarts[args[1]] > 0 && args[1] != 0/ +{ + /*printf("get: tag=%#x src=%d %llx - %llx = %llx\n", args[1], args[2], timestamp, g_aStarts[args[1]], timestamp - g_aStarts[args[1]]);*/ + @g_Interrupts[args[3], args[2] & kfDevIdMask] = count(); + @g_DispAvg[ args[3], args[2] & kfDevIdMask] = avg(timestamp - g_aStarts[args[1]]); + @g_DispMax[ args[3], args[2] & kfDevIdMask] = max(timestamp - g_aStarts[args[1]]); + @g_DispMin[ args[3], args[2] & kfDevIdMask] = min(timestamp - g_aStarts[args[1]]); + g_aStarts[args[1]] = 0; + g_cHits++; +} + +vboxvmm*:::pdm-irq-get +/args[1] == 0/ +{ + @g_UntaggedGets[args[3]] = count(); + g_cUntaggedGets++; +} + +vboxvmm*:::pdm-irq-get +/args[2] > kfDevIdMask/ +{ + @g_Shared[args[3], args[2] & kfDevIdMask] = count(); +} + +/* For the time being, quit after 256 interrupts. */ +vboxvmm*:::pdm-irq-get +/g_cHits >= 256/ +{ + exit(0); +} + +/* + * Catch the device clearing the IRQ. + */ + + +/* + * Report. + */ +END +{ + printf("\nInterrupt distribution:\n"); + printa(" irq %3d dev %2d %@12u\n", @g_Interrupts); + printf("Interrupt sharing (devices detect pushing a line high at the same time):\n"); + printa(" irq %3d dev %2d %@12u\n", @g_Shared); + printf("Minimum dispatch latency:\n"); + printa(" irq %3d dev %2d %@12u ns\n", @g_DispMin); + printf("Average dispatch latency:\n"); + printa(" irq %3d dev %2d %@12u ns\n", @g_DispAvg); + printf("Maximum dispatch latency:\n"); + printa(" irq %3d dev %2d %@12u ns\n", @g_DispMax); +} +END +/g_cUntaggedHighs > 0/ +{ + printf("Untagged highs: %u\n", g_cUntaggedHighs); +} +END +/g_cUntaggedGets > 0/ +{ + printf("Untagged gets: %u\n", g_cUntaggedGets); + printa(" irq %3d %@12u\n", @g_UntaggedGets); +} +END +/g_cMissedHighs > 0/ +{ + printf("Missed (or shared?) highs: %u\n", g_cMissedHighs); + printa(" irq %3d dev %2d %@12u\n", @g_MissedHighs); +} + diff --git a/src/VBox/VMM/dtrace/lib/amd64/vbox-arch-types.d b/src/VBox/VMM/dtrace/lib/amd64/vbox-arch-types.d new file mode 100644 index 00000000..6d1b3442 --- /dev/null +++ b/src/VBox/VMM/dtrace/lib/amd64/vbox-arch-types.d @@ -0,0 +1,49 @@ +/** @file + * VBox & DTrace - Types and Constants for AMD64. + */ + +/* + * Copyright (C) 2012-2023 Oracle and/or its affiliates. + * + * This file is part of VirtualBox base platform packages, as + * available from https://www.virtualbox.org. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, in version 3 of the + * License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses>. + * + * SPDX-License-Identifier: GPL-3.0-only + */ + + +inline unsigned HC_ARCH_BITS = 64; +typedef uint64_t RTR3PTR; +typedef void *RTR0PTR; +typedef uint64_t RTHCPTR; + + + +typedef union RTFLOAT80U +{ + uint16_t au16[5]; +} RTFLOAT80U; + +typedef union RTFLOAT80U2 +{ + uint16_t au16[5]; +} RTFLOAT80U2; + +typedef struct uint128_t +{ + uint64_t au64[2]; +} uint128_t; + diff --git a/src/VBox/VMM/dtrace/lib/vbox-types.d b/src/VBox/VMM/dtrace/lib/vbox-types.d new file mode 100644 index 00000000..8fcf4915 --- /dev/null +++ b/src/VBox/VMM/dtrace/lib/vbox-types.d @@ -0,0 +1,68 @@ +/** @file + * VBox & DTrace - Types and Constants. + */ + +/* + * Copyright (C) 2012-2023 Oracle and/or its affiliates. + * + * This file is part of VirtualBox base platform packages, as + * available from https://www.virtualbox.org. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, in version 3 of the + * License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses>. + * + * SPDX-License-Identifier: GPL-3.0-only + */ + + +/* + * Types used by the other D structure and type definitions. + * + * These are taken from a variation of VBox and IPRT headers. + */ +#pragma D depends_on library vbox-arch-types.d + +typedef uint64_t RTGCPHYS; +typedef uint64_t RTHCPHYS; +typedef uint16_t RTSEL; +typedef uint32_t RTRCPTR; +typedef uintptr_t RTNATIVETHREAD; +typedef struct RTTHREADINT *RTTHREAD; +typedef struct RTTRACEBUFINT *RTTRACEBUF; + + +typedef uint32_t VMSTATE; +typedef uint32_t VMCPUID; +typedef uint32_t RTCPUID; +typedef struct UVMCPU *PUVMCPU; +typedef uintptr_t PVMR3; +typedef uint32_t PVMRC; +typedef struct VM *PVMR0; +typedef struct SUPDRVSESSION *PSUPDRVSESSION; +typedef struct UVM *PUVM; +typedef struct CPUMCTX *PCPUMCTX; +typedef struct SVMVMCB *PSVMVMCB; +typedef uint32_t VMXVDIAG; +typedef struct VMXVVMCS *PVMXVVMCS; + +typedef struct VBOXGDTR +{ + uint16_t cb; + uint16_t au16Addr[4]; +} VBOXGDTR, VBOXIDTR; + +typedef struct STAMPROFILEADV +{ + uint64_t au64[5]; +} STAMPROFILEADV; + diff --git a/src/VBox/VMM/dtrace/lib/x86/vbox-arch-types.d b/src/VBox/VMM/dtrace/lib/x86/vbox-arch-types.d new file mode 100644 index 00000000..7b2ef977 --- /dev/null +++ b/src/VBox/VMM/dtrace/lib/x86/vbox-arch-types.d @@ -0,0 +1,32 @@ +/** @file + * VBox & DTrace - Types and Constants for X86. + */ + +/* + * Copyright (C) 2012-2023 Oracle and/or its affiliates. + * + * This file is part of VirtualBox base platform packages, as + * available from https://www.virtualbox.org. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, in version 3 of the + * License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses>. + * + * SPDX-License-Identifier: GPL-3.0-only + */ + + +inline unsigned HC_ARCH_BITS = 32; +typedef uint32_t RTR3PTR; +typedef uint32_t RTHCPTR; +typedef void *RTR0PTR; + diff --git a/src/VBox/VMM/dtrace/return-to-ring-3-aggregation-1.d b/src/VBox/VMM/dtrace/return-to-ring-3-aggregation-1.d new file mode 100644 index 00000000..4f65599f --- /dev/null +++ b/src/VBox/VMM/dtrace/return-to-ring-3-aggregation-1.d @@ -0,0 +1,46 @@ +/* $Id: return-to-ring-3-aggregation-1.d $ */ +/** @file + * DTracing VBox - return to ring-3 aggregation test \#1. + */ + +/* + * Copyright (C) 2012-2023 Oracle and/or its affiliates. + * + * This file is part of VirtualBox base platform packages, as + * available from https://www.virtualbox.org. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, in version 3 of the + * License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses>. + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#pragma D option quiet + + +vboxvmm:::r0-vmm-return-to-ring3-hm +{ + @g_aHmRcs[args[2]] = count(); +} + +vboxvmm:::r0-vmm-return-to-ring3-rc +{ + @g_aRawRcs[args[2]] = count(); +} + +END +{ + printa(" rcHm=%04d %@8u times\n", @g_aHmRcs); + printa(" rcRaw=%04d %@8u times\n", @g_aRawRcs); +} + diff --git a/src/VBox/VMM/dtrace/vmexit-reason-aggregation-1.d b/src/VBox/VMM/dtrace/vmexit-reason-aggregation-1.d new file mode 100644 index 00000000..54d77977 --- /dev/null +++ b/src/VBox/VMM/dtrace/vmexit-reason-aggregation-1.d @@ -0,0 +1,46 @@ +/* $Id: vmexit-reason-aggregation-1.d $ */ +/** @file + * DTracing VBox - vmexit reason aggregation test \#1. + */ + +/* + * Copyright (C) 2012-2023 Oracle and/or its affiliates. + * + * This file is part of VirtualBox base platform packages, as + * available from https://www.virtualbox.org. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, in version 3 of the + * License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses>. + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#pragma D option quiet + + +vboxvmm:::r0-hmsvm-vmexit +{ + @g_aSvmExits[args[2]] = count(); +} + +vboxvmm:::r0-hmvmx-vmexit-noctx +{ + @g_aVmxExits[args[2]] = count(); +} + +END +{ + printa(" svmexit=%#04llx %@10u times\n", @g_aSvmExits); + printa(" vmxexit=%#04llx %@10u times\n", @g_aVmxExits); +} + diff --git a/src/VBox/VMM/dtrace/vmexit-rip-aggregation-1.d b/src/VBox/VMM/dtrace/vmexit-rip-aggregation-1.d new file mode 100644 index 00000000..0a6b975c --- /dev/null +++ b/src/VBox/VMM/dtrace/vmexit-rip-aggregation-1.d @@ -0,0 +1,42 @@ +/* $Id: vmexit-rip-aggregation-1.d $ */ +/** @file + * DTracing VBox - vmexit rip aggregation test \#1. + */ + +/* + * Copyright (C) 2012-2023 Oracle and/or its affiliates. + * + * This file is part of VirtualBox base platform packages, as + * available from https://www.virtualbox.org. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, in version 3 of the + * License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses>. + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#pragma D option quiet + + +vboxvmm:::r0-hmsvm-vmexit,vboxvmm:::r0-hmvmx-vmexit +{ + /*printf("cs:rip=%02x:%08llx", args[1]->cs.Sel, args[1]->rip.rip);*/ + @g_aRips[args[1]->rip.rip] = count(); + /*@g_aRips[args[0]->cpum.s.Guest.rip.rip] = count(); - alternative access route */ +} + +END +{ + printa(" rip=%#018llx %@4u times\n", @g_aRips); +} + |