]> xenbits.xensource.com Git - xen.git/commitdiff
tools/[lib]xl: Add vmtrace_buf_size parameter
authorMichał Leszczyński <michal.leszczynski@cert.pl>
Thu, 18 Jun 2020 22:31:24 +0000 (00:31 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 5 Feb 2021 17:37:27 +0000 (17:37 +0000)
Allow to specify the size of per-vCPU trace buffer upon
domain creation. This is zero by default (meaning: not enabled).

Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
docs/man/xl.cfg.5.pod.in
tools/golang/xenlight/helpers.gen.go
tools/golang/xenlight/types.gen.go
tools/include/libxl.h
tools/libs/light/libxl_create.c
tools/libs/light/libxl_types.idl
tools/xl/xl_parse.c

index 7cdb8595d32830c7f68cd9582e8a1dbd15bb3b30..040374dcd6ffb291435e9dbd260e3c90fd4844f2 100644 (file)
@@ -681,6 +681,15 @@ Windows).
 
 If this option is not specified then it will default to B<false>.
 
+=item B<vmtrace_buf_kb=KBYTES>
+
+Specifies the size of vmtrace buffer that would be allocated for each
+vCPU belonging to this domain.  Disabled (i.e.  B<vmtrace_buf_kb=0>) by
+default.
+
+B<NOTE>: Acceptable values are platform specific.  For Intel Processor
+Trace, this value must be a power of 2 between 4k and 16M.
+
 =back
 
 =head2 Devices
index 63e287646387b7b02b0ec6d7153672ef35cd4398..4c60d27a9c53e49b746e593abbc8afa2ba00c263 100644 (file)
@@ -1114,6 +1114,7 @@ return fmt.Errorf("invalid union key '%v'", x.Type)}
 x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
 x.ArchArm.Vuart = VuartType(xc.arch_arm.vuart)
 x.Altp2M = Altp2MMode(xc.altp2m)
+x.VmtraceBufKb = int(xc.vmtrace_buf_kb)
 
  return nil}
 
@@ -1589,6 +1590,7 @@ return fmt.Errorf("invalid union key '%v'", x.Type)}
 xc.arch_arm.gic_version = C.libxl_gic_version(x.ArchArm.GicVersion)
 xc.arch_arm.vuart = C.libxl_vuart_type(x.ArchArm.Vuart)
 xc.altp2m = C.libxl_altp2m_mode(x.Altp2M)
+xc.vmtrace_buf_kb = C.int(x.VmtraceBufKb)
 
  return nil
  }
index 5851c380577ee8aedb660cdfefd30a4a10f2eff5..cb13002fdb6553da5aea3c4e629eba4d8290930d 100644 (file)
@@ -514,6 +514,7 @@ GicVersion GicVersion
 Vuart VuartType
 }
 Altp2M Altp2MMode
+VmtraceBufKb int
 }
 
 type domainBuildInfoTypeUnion interface {
index f48d0c5e8a7098e3f1bd7e27a68c84008186af15..a7b673e89d80bb6d172a6368d8bc09782cae1e63 100644 (file)
  */
 #define LIBXL_HAVE_PHYSINFO_CAP_VMTRACE 1
 
+/*
+ * LIBXL_HAVE_VMTRACE_BUF_KB indicates that libxl_domain_create_info has a
+ * vmtrace_buf_kb parameter, which allows to enable pre-allocation of
+ * processor tracing buffers of given size.
+ */
+#define LIBXL_HAVE_VMTRACE_BUF_KB 1
+
 /*
  * libxl ABI compatibility
  *
index 9848d65f3616f1f410f03851d1ee82cb30a430ae..46f68da697da9118c095fb81a04311e4ea99d52a 100644 (file)
@@ -607,6 +607,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
             .max_evtchn_port = b_info->event_channels,
             .max_grant_frames = b_info->max_grant_frames,
             .max_maptrack_frames = b_info->max_maptrack_frames,
+            .vmtrace_size = ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAGE_SHIFT),
         };
 
         if (info->type != LIBXL_DOMAIN_TYPE_PV) {
index dacb7df6b7aa76414ddcfd6b22ddd0dcb648cc77..5b85a7419f0fffce8a90c8775c8f1716015d0af6 100644 (file)
@@ -648,6 +648,10 @@ libxl_domain_build_info = Struct("domain_build_info",[
     # supported by x86 HVM and ARM support is planned.
     ("altp2m", libxl_altp2m_mode),
 
+    # Size of preallocated vmtrace trace buffers (in KBYTES).
+    # Use zero value to disable this feature.
+    ("vmtrace_buf_kb", integer),
+
     ], dir=DIR_IN,
        copy_deprecated_fn="libxl__domain_build_info_copy_deprecated",
 )
index 867e4d068a596fb2efd67f5063c35b304d3480c9..1893cfc08660e2dc744b017b1e5699c38682f25b 100644 (file)
@@ -1863,6 +1863,10 @@ void parse_config_data(const char *config_source,
         }
     }
 
+    if (!xlu_cfg_get_long(config, "vmtrace_buf_kb", &l, 1) && l) {
+        b_info->vmtrace_buf_kb = l;
+    }
+
     if (!xlu_cfg_get_list(config, "ioports", &ioports, &num_ioports, 0)) {
         b_info->num_ioports = num_ioports;
         b_info->ioports = calloc(num_ioports, sizeof(*b_info->ioports));