From nobody Mon Feb 9 11:32:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1611264483; cv=none; d=zohomail.com; s=zohoarc; b=d0WWU24fFDk+XXAqMuq6eNL4V6PIPv8xLUSt4vvNJHzksLWFenD5rc2Y4AbOGcoy7FkUSR3c2H9HT99BpVSrIEbtVO2PYC4wfO3X4sQqYCRNphYn3PbLdhyf/cayPFi9HIgf/BLf3dTcuizqqre2a7HQRsy9xZBjvmR2Ghy9AgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611264483; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rX+qpOzKAsRim3WpWNRoe5GS+Cg4IGOMEVnKUiCkLkA=; b=G7BGMXNwFUKeCq1KxWWvNR3kIWiWczFtgUavKfc2ZmzKv/Em4+hz3ujhaZkfJ5+nwDC1nU4jpyne3On7DdLjU7QtD1Rrm/M9CS0esUHrudip34Vs81pqVsbK/BkN1ffQMmbZ4qQcNgepmIVD4VHWkYNMd6IjQVP90zfsBkaK1FM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1611264483299909.4194514377579; Thu, 21 Jan 2021 13:28:03 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.72424.130400 (Exim 4.92) (envelope-from ) id 1l2hUX-00053C-Pe; Thu, 21 Jan 2021 21:27:45 +0000 Received: by outflank-mailman (output) from mailman id 72424.130400; Thu, 21 Jan 2021 21:27:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l2hUX-000535-KU; Thu, 21 Jan 2021 21:27:45 +0000 Received: by outflank-mailman (input) for mailman id 72424; Thu, 21 Jan 2021 21:27:44 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l2hUW-0004xj-DL for xen-devel@lists.xenproject.org; Thu, 21 Jan 2021 21:27:44 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d58a849e-48fc-4e36-afb6-4038de5a7806; Thu, 21 Jan 2021 21:27:37 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d58a849e-48fc-4e36-afb6-4038de5a7806 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1611264457; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qqMUUvIGHfWHo68RiFDlQlo29XS58mcICccVrvN4uCc=; b=S4lC9XrK9Xpk91ar8G9UPMLyUUB+HPAu2eGYKjGPXC2l4ZNh+FA4MF4V AGHQut8iCsHpcE1wMMVUMiOb11VZOmNy0qLOtQvwHnv2OQY+JVxXVaRta BZVmxcKmdqzPtCCtuT+k/Ali8sJGZEOrr/8ZvleEiF2I8Wk3KRTmRyDhM o=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: FahN9JCqGqamlM+Omlb8VQ65ePzW1gAXmKRskkiqzmUomKyC8VKfiNb5H7f1fzmUJi3XwVTtqy xgmy0iVVxyXGHOaBHd3pjVAXMCiODNOWJbCpZ567Us/hRJ3TzKFQfKUSC4Gm39UpxcWMWVDOCl 1nBZNDgkDZOiPJ0UlwxOm5a0t2og/pnT/VBvGmkH21JS8c4canrG/LyAVKywrEN7NPIqe4m+yY Kz3yrCcKfvDIOTp7lB/KuWhXXL1mNWwZrh6ex48/bXvkJFh5S6fsuX3JwJEuiawMvfRMkZIXgV tCc= X-SBRS: 5.1 X-MesageID: 35977339 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.79,365,1602561600"; d="scan'208";a="35977339" From: Andrew Cooper To: Xen-devel CC: =?UTF-8?q?Micha=C5=82=20Leszczy=C5=84ski?= , Andrew Cooper , Ian Jackson , Wei Liu , Anthony PERARD , "Tamas K Lengyel" Subject: [PATCH v7 03/10] tools/[lib]xl: Add vmtrace_buf_size parameter Date: Thu, 21 Jan 2021 21:27:11 +0000 Message-ID: <20210121212718.2441-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210121212718.2441-1-andrew.cooper3@citrix.com> References: <20210121212718.2441-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) From: Micha=C5=82 Leszczy=C5=84ski 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=C5=82 Leszczy=C5=84ski Signed-off-by: Andrew Cooper Acked-by: Ian Jackson --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD CC: Micha=C5=82 Leszczy=C5=84ski CC: Tamas K Lengyel v7: * Use the name 'vmtrace' consistently. --- docs/man/xl.cfg.5.pod.in | 9 +++++++++ tools/golang/xenlight/helpers.gen.go | 2 ++ tools/golang/xenlight/types.gen.go | 1 + tools/include/libxl.h | 7 +++++++ tools/libs/light/libxl_create.c | 2 ++ tools/libs/light/libxl_types.idl | 4 ++++ tools/xl/xl_parse.c | 4 ++++ 7 files changed, 29 insertions(+) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index c8e017f950..86963298a3 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -681,6 +681,15 @@ Windows). =20 If this option is not specified then it will default to B. =20 +=3Ditem B + +Specifies the size of vmtrace buffer that would be allocated for each +vCPU belonging to this domain. Disabled (i.e. B) by +default. + +B: Acceptable values are platform specific. For Intel Processor +Trace, this value must be a power of 2 between 4k and 16M. + =3Dback =20 =3Dhead2 Devices diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/h= elpers.gen.go index 62fb98ba30..1e22a407bf 100644 --- a/tools/golang/xenlight/helpers.gen.go +++ b/tools/golang/xenlight/helpers.gen.go @@ -1114,6 +1114,7 @@ return fmt.Errorf("invalid union key '%v'", x.Type)} x.ArchArm.GicVersion =3D GicVersion(xc.arch_arm.gic_version) x.ArchArm.Vuart =3D VuartType(xc.arch_arm.vuart) x.Altp2M =3D Altp2MMode(xc.altp2m) +x.VmtraceBufKb =3D int(xc.vmtrace_buf_kb) =20 return nil} =20 @@ -1589,6 +1590,7 @@ return fmt.Errorf("invalid union key '%v'", x.Type)} xc.arch_arm.gic_version =3D C.libxl_gic_version(x.ArchArm.GicVersion) xc.arch_arm.vuart =3D C.libxl_vuart_type(x.ArchArm.Vuart) xc.altp2m =3D C.libxl_altp2m_mode(x.Altp2M) +xc.vmtrace_buf_kb =3D C.int(x.VmtraceBufKb) =20 return nil } diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/typ= es.gen.go index 369da6dd1e..130524dce9 100644 --- a/tools/golang/xenlight/types.gen.go +++ b/tools/golang/xenlight/types.gen.go @@ -513,6 +513,7 @@ GicVersion GicVersion Vuart VuartType } Altp2M Altp2MMode +VmtraceBufKb int } =20 type domainBuildInfoTypeUnion interface { diff --git a/tools/include/libxl.h b/tools/include/libxl.h index c4d920f1e5..7606a21219 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -471,6 +471,13 @@ #define LIBXL_HAVE_PHYSINFO_CAP_VMTRACE 1 =20 /* + * 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 * * The only guarantee which libxl makes regarding ABI compatibility diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_creat= e.c index 86f4a8369d..d4a9380357 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -607,6 +607,8 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_conf= ig *d_config, .max_evtchn_port =3D b_info->event_channels, .max_grant_frames =3D b_info->max_grant_frames, .max_maptrack_frames =3D b_info->max_maptrack_frames, + .vmtrace_frames =3D DIV_ROUNDUP(b_info->vmtrace_buf_kb, + XC_PAGE_SIZE >> 10), }; =20 if (info->type !=3D LIBXL_DOMAIN_TYPE_PV) { diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_type= s.idl index b43d5f1265..c092c31b5e 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -646,6 +646,10 @@ libxl_domain_build_info =3D Struct("domain_build_info"= ,[ # supported by x86 HVM and ARM support is planned. ("altp2m", libxl_altp2m_mode), =20 + # Size of preallocated vmtrace trace buffers (in KBYTES). + # Use zero value to disable this feature. + ("vmtrace_buf_kb", integer), + ], dir=3DDIR_IN, copy_deprecated_fn=3D"libxl__domain_build_info_copy_deprecated", ) diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 4ebf39620a..ca99af8d1b 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1863,6 +1863,10 @@ void parse_config_data(const char *config_source, } } =20 + if (!xlu_cfg_get_long(config, "vmtrace_buf_kb", &l, 1) && l) { + b_info->vmtrace_buf_kb =3D l; + } + if (!xlu_cfg_get_list(config, "ioports", &ioports, &num_ioports, 0)) { b_info->num_ioports =3D num_ioports; b_info->ioports =3D calloc(num_ioports, sizeof(*b_info->ioports)); --=20 2.11.0