From patchwork Mon Sep 20 17:25:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506005 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E91EC433F5 for ; Mon, 20 Sep 2021 17:25:49 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A2166134F for ; Mon, 20 Sep 2021 17:25:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0A2166134F Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191047.340902 (Exim 4.92) (envelope-from ) id 1mSN2z-0003gR-Cv; Mon, 20 Sep 2021 17:25:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191047.340902; Mon, 20 Sep 2021 17:25:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN2z-0003fd-5o; Mon, 20 Sep 2021 17:25:41 +0000 Received: by outflank-mailman (input) for mailman id 191047; Mon, 20 Sep 2021 17:25:40 +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 1mSN2y-0003cq-Dt for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:25:40 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c5b8efdf-1a37-11ec-b87a-12813bfff9fa; Mon, 20 Sep 2021 17:25:39 +0000 (UTC) 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: c5b8efdf-1a37-11ec-b87a-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632158739; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=B3S41rd9NvRv/dJsqHom9/Nn++paIgMCBBiyWnP7azs=; b=HHnSgUOBv1+n+vifGJTe2DMx8CmQv/WEjcJ2Yug2gjvmjG8hSRHYmLVO IIIuwCj854TSRWl/8scXkRXtovkCY8u158cv76ZcZCdiDh4PhRptktp2y 8XGBBSNp46pNlQ6QJaonhF7jtOCdccEdFghda6g2GQeQjKFCt2ChJqOWe c=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: cQzWNDkh5IkZR9+XiUtaYKn0iozqNVqpiYTOvyeehkAvNB1ho6SRQBju2AtSst2FFLFy6pTKQR V8q4pPYNb0gH/IgEglB/HkfNo3/0uG/j/W39KA8YQXKpKAefWH90Cg4XntakCo6uzbT/fCCYCl 4lAeApubmgR3UQXuaWR+G0YC1IUxJBNDBAls5rhHlreXhFbfl+dX4HqrZyDJnrb+jpjSCGMPzm p7EaNLvPoodbgbBRM/pnwtCdv3Rn9sALk9T0QXQcqbMijcDC5z0faf6X8IiDEQBr3FivxySrEB TrNgEepkUtGaF4WkEQHoFBSA X-SBRS: 5.1 X-MesageID: 52741153 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:kbRaLKlkvZaovmL7isg4Zh/o5gwHIURdPkR7XQ2eYbSJt1+Wr1Gzt xIcXGrTMvyCNmf3KdEjbYu3pxwOu5fWmoQwHQNr/HgwFiMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BClVlxJVF/fngqoDUUYYoAQgsA185IMsdoUg7wbdh09Qw2YLR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 M4Ult+ydSgNAu7vpuI0ahNaKhA5JJQTrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ignBODtMJkSpTdLyjbBAOx9aZvCX7/L9ZlT2zJYasVmQKyBO 5NANGEHgBLoJEMREVYUNaAHpNzvqWbyYiVftUnJjP9ii4TU5FMoi+W8WDbPQfSob8hImkeTp krd4n/0RBodMbS3yyeB83+qrv/Cm2X8Qo16PLi18PF6nXWYx3dVFQUbU139rPWk4mayVdtQJ E0T/isGtrUp+QqgSdyVdxynolaUsxgEQd1SHuYmrgaXxcL88wufQ2QJUDNFQNgnr9MtAywn0 EeTmNHkDiApt6eaIVqC8p+EoDX0PjIaRUcZfjMNRwYB59jloakwgwjJQ9IlF7S65uAZAhmpn WrM9nJnwexO04hbjM1X4GwrnRq3/7uKTDIawjmUfVyjxzpzZreUIJWRvA2zAel7EGqJcrWQl CFawJHOt7FfVcvleD+lG7pWTerwjxqRGHiF2wc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'208";a="52741153" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Stefano Stabellini , Wei Liu , Julien Grall , Dario Faggioli , Meng Xu Subject: [PATCH v2 01/12] xen/trace: Don't over-read trace objects Date: Mon, 20 Sep 2021 18:25:18 +0100 Message-ID: <20210920172529.24932-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 In the case that 'extra' isn't a multiple of uint32_t, the calculation rounds the number of bytes up, causing later logic to read unrelated bytes beyond the end of the object. Also, asserting that the object is within TRACE_EXTRA_MAX, but truncating it in release builds is rude. Instead, reject any out-of-spec records, leaving enough of a message to identify the faulty caller. There is one buggy race record, TRC_RTDS_BUDGET_BURN. As it must remain __packed (as cur_budget is misaligned), change bool has_extratime to uint32_t to compensate. The new printk() can also be hit by HVMOP_xentrace, although no over-read is possible. This has no business being a hypercall in the first place, as it can't be used outside of custom local debugging, so extend the uint32_t requirement to HVMOP_xentrace too. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall CC: Dario Faggioli CC: Meng Xu v2: * Adjust HVMOP_xentrace to avoid hitting the printk() * Fix TRC_RTDS_BUDGET_BURN * Adjust wording in __trace_var() --- xen/arch/x86/hvm/hvm.c | 5 +++-- xen/common/sched/rt.c | 24 +++++++++++++----------- xen/common/trace.c | 21 ++++++++++----------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 7b48a1b925bb..09cf6330ad26 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -5063,8 +5063,9 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) if ( copy_from_guest(&tr, arg, 1 ) ) return -EFAULT; - if ( tr.extra_bytes > sizeof(tr.extra) - || (tr.event & ~((1u< sizeof(tr.extra) || + tr.event >> TRC_SUBCLS_SHIFT ) return -EINVAL; /* Cycles will be taken at the vmexit and vmenter */ diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c index c24cd2ac3200..c58edca0de84 100644 --- a/xen/common/sched/rt.c +++ b/xen/common/sched/rt.c @@ -968,18 +968,20 @@ burn_budget(const struct scheduler *ops, struct rt_unit *svc, s_time_t now) /* TRACE */ { struct __packed { - unsigned unit:16, dom:16; + uint16_t unit, dom; uint64_t cur_budget; - int delta; - unsigned priority_level; - bool has_extratime; - } d; - d.dom = svc->unit->domain->domain_id; - d.unit = svc->unit->unit_id; - d.cur_budget = (uint64_t) svc->cur_budget; - d.delta = delta; - d.priority_level = svc->priority_level; - d.has_extratime = svc->flags & RTDS_extratime; + uint32_t delta; + uint32_t priority_level; + uint32_t has_extratime; + } d = { + .unit = svc->unit->unit_id, + .dom = svc->unit->domain->domain_id, + .cur_budget = svc->cur_budget, + .delta = delta, + .priority_level = svc->priority_level, + .has_extratime = !!(svc->flags & RTDS_extratime), + }; + trace_var(TRC_RTDS_BUDGET_BURN, 1, sizeof(d), (unsigned char *) &d); diff --git a/xen/common/trace.c b/xen/common/trace.c index a2a389a1c7c3..4297ff505fb9 100644 --- a/xen/common/trace.c +++ b/xen/common/trace.c @@ -686,22 +686,21 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra, unsigned long flags; u32 bytes_to_tail, bytes_to_wrap; unsigned int rec_size, total_size; - unsigned int extra_word; bool_t started_below_highwater; if( !tb_init_done ) return; - /* Convert byte count into word count, rounding up */ - extra_word = (extra / sizeof(u32)); - if ( (extra % sizeof(u32)) != 0 ) - extra_word++; - - ASSERT(extra_word <= TRACE_EXTRA_MAX); - extra_word = min_t(int, extra_word, TRACE_EXTRA_MAX); - - /* Round size up to nearest word */ - extra = extra_word * sizeof(u32); + /* + * extra data needs to be an exact multiple of uint32_t to prevent the + * later logic over-reading the object. Reject out-of-spec records. Any + * failure here is an error in the caller. + */ + if ( extra % sizeof(uint32_t) || + extra / sizeof(uint32_t) > TRACE_EXTRA_MAX ) + return printk_once(XENLOG_WARNING + "Trace event %#x bad size %u, discarding\n", + event, extra); if ( (tb_event_mask & event) == 0 ) return; From patchwork Mon Sep 20 17:25:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506007 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89D27C433EF for ; Mon, 20 Sep 2021 17:25:49 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E41E61244 for ; Mon, 20 Sep 2021 17:25:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3E41E61244 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191046.340897 (Exim 4.92) (envelope-from ) id 1mSN2y-0003d3-WA; Mon, 20 Sep 2021 17:25:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191046.340897; Mon, 20 Sep 2021 17:25:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN2y-0003cw-T1; Mon, 20 Sep 2021 17:25:40 +0000 Received: by outflank-mailman (input) for mailman id 191046; Mon, 20 Sep 2021 17:25:39 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN2x-0003ck-Jm for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:25:39 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 288e7a11-764c-4528-9450-fb71bdffc74f; Mon, 20 Sep 2021 17:25:38 +0000 (UTC) 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: 288e7a11-764c-4528-9450-fb71bdffc74f DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632158738; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=X2OvFsDnk6zSkjs6xUlTPuHsZnVpWG/gEpynVHga6Vg=; b=HxexOTzyLOX5K81+NCiRuygkWPboy0+HBqlTKAmC6a0Mtfzbwfa9hqWp eFgUH/EhCXGANHs7Cd3xItLubgAoeH93MPmTk6dfsPLZ9ZHuFobXllSpv sCX760ethuFjHr1O/eE/U1jaTv2S9PYWET+Hob/PDYAIUv8tliRNnsuvD 8=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: ggiTRXzvxA+1hkc/Vsc3ofkjT/EEw0m8NFIkyDG7SWNufK8rejv13u076MXQ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S+D2njbL+od X-IronPort-AV: E=Sophos;i="5.85,308,1624334400"; d="scan'208";a="54938583" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Stefano Stabellini , Wei Liu , Julien Grall , Dario Faggioli Subject: [PATCH v2 02/12] xen/memory: Remove tail padding from TRC_MEM_* records Date: Mon, 20 Sep 2021 18:25:19 +0100 Message-ID: <20210920172529.24932-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Four TRC_MEM_* records supply custom structures with tail padding, leaking stack rubble into the trace buffer. Three of the records were fine in 32-bit builds of Xen, due to the relaxed alignment of 64-bit integers, but POD_SUPERPAGE_SPLITER was broken right from the outset. We could pack the datastructures to remove the padding, but xentrace_format has no way of rendering the upper half of a 16-bit field. Instead, expand all 16-bit fields to 32-bit. For POD_SUPERPAGE_SPLINTER, introduce an order field as it is relevant information, and to match DECREASE_RESERVATION, and so it doesn't require a __packed attribute to drop tail padding. Update xenalyze's structures to match, and introduce xentrace_format rendering which was absent previously. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Dario Faggioli --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall CC: Dario Faggioli The xentrace_format script isn't remotely Py3 compatible, and was another script missed by our previous efforts. --- tools/xentrace/formats | 4 ++++ tools/xentrace/xenalyze.c | 12 ++++++------ xen/arch/x86/mm/p2m-pod.c | 17 +++++++++-------- xen/common/memory.c | 4 ++-- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/tools/xentrace/formats b/tools/xentrace/formats index deac4d8598b0..0fcc327a4078 100644 --- a/tools/xentrace/formats +++ b/tools/xentrace/formats @@ -136,6 +136,10 @@ 0x0010f001 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) page_grant_map [ domid = %(1)d ] 0x0010f002 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) page_grant_unmap [ domid = %(1)d ] 0x0010f003 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) page_grant_transfer [ domid = %(1)d ] +0x0010f005 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) decrease_reservation [ d%(3)d gfn 0x%(2)08x%(1)08x, order %(4)u ] +0x0010f010 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) pod_populate [ d%(5)d gfn 0x%(2)08x%(1)08x => mfn 0x%(4)08x%(3)08x, order %(6)u ] +0x0010f011 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) pod_zero_reclaim [ d%(5)d gfn 0x%(2)08x%(1)08x => mfn 0x%(4)08x%(3)08x, order %(6)u ] +0x0010f012 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) pod_superpage_splinter [ d%(3)d gfn 0x%(2)08x%(1)08x, order %(4)u ] 0x00201001 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) hypercall [ eip = 0x%(1)08x, eax = 0x%(2)08x ] 0x00201101 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) hypercall [ rip = 0x%(2)08x%(1)08x, eax = 0x%(3)08x ] diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c index 5de167031e01..12dcca964645 100644 --- a/tools/xentrace/xenalyze.c +++ b/tools/xentrace/xenalyze.c @@ -8121,7 +8121,7 @@ void mem_pod_zero_reclaim_process(struct pcpu_info *p) struct { uint64_t gfn, mfn; - int d:16,order:16; + uint32_t d, order; } *r = (typeof(r))ri->d; if ( v && v->hvm.vmexit_valid ) @@ -8171,7 +8171,7 @@ void mem_pod_populate_process(struct pcpu_info *p) struct { uint64_t gfn, mfn; - int d:16,order:16; + uint32_t d, order; } *r = (typeof(r))ri->d; if ( opt.dump_all ) @@ -8204,14 +8204,14 @@ void mem_pod_superpage_splinter_process(struct pcpu_info *p) struct { uint64_t gfn; - int d:16; + uint32_t d, order; } *r = (typeof(r))ri->d; if ( opt.dump_all ) { - printf(" %s pod_spage_splinter d%d g %llx\n", + printf(" %s pod_spage_splinter d%d o%d g %"PRIx64"\n", ri->dump_header, - r->d, (unsigned long long)r->gfn); + r->d, r->order, r->gfn); } } @@ -8255,7 +8255,7 @@ void mem_decrease_reservation_process(struct pcpu_info *p) struct { uint64_t gfn; - int d:16,order:16; + uint32_t d, order; } *r = (typeof(r))ri->d; if ( opt.dump_all ) diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index 8abc57265c10..90f02ae765f6 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -819,8 +819,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn) if ( tb_init_done ) { struct { - u64 gfn, mfn; - int d:16,order:16; + uint64_t gfn, mfn; + uint32_t d, order; } t; t.gfn = gfn_x(gfn); @@ -987,8 +987,8 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count if ( tb_init_done ) { struct { - u64 gfn, mfn; - int d:16,order:16; + uint64_t gfn, mfn; + uint32_t d, order; } t; t.gfn = gfn_x(gfns[i]); @@ -1217,8 +1217,8 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn, if ( tb_init_done ) { struct { - u64 gfn, mfn; - int d:16,order:16; + uint64_t gfn, mfn; + uint32_t d, order; } t; t.gfn = gfn_x(gfn); @@ -1260,12 +1260,13 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn, if ( tb_init_done ) { struct { - u64 gfn; - int d:16; + uint64_t gfn; + uint32_t d, order; } t; t.gfn = gfn_x(gfn); t.d = d->domain_id; + t.order = order; __trace_var(TRC_MEM_POD_SUPERPAGE_SPLINTER, 0, sizeof(t), &t); } diff --git a/xen/common/memory.c b/xen/common/memory.c index 63642278fda9..8fd88ccb70bf 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -450,8 +450,8 @@ static void decrease_reservation(struct memop_args *a) if ( tb_init_done ) { struct { - u64 gfn; - int d:16,order:16; + uint64_t gfn; + uint32_t d, order; } t; t.gfn = gmfn; From patchwork Mon Sep 20 17:25:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506017 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FF10C433F5 for ; Mon, 20 Sep 2021 17:26:04 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDFE8632DE for ; Mon, 20 Sep 2021 17:26:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DDFE8632DE Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191053.340968 (Exim 4.92) (envelope-from ) id 1mSN3E-0005xc-TT; Mon, 20 Sep 2021 17:25:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191053.340968; Mon, 20 Sep 2021 17:25:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN3E-0005vR-NX; Mon, 20 Sep 2021 17:25:56 +0000 Received: by outflank-mailman (input) for mailman id 191053; Mon, 20 Sep 2021 17:25:55 +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 1mSN3D-0003cq-D3 for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:25:55 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c7499935-1a37-11ec-b87a-12813bfff9fa; Mon, 20 Sep 2021 17:25:41 +0000 (UTC) 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: c7499935-1a37-11ec-b87a-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632158741; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=kRgS+FI6cDfW+xtWOVJXQyBa4B8IEHbmPbHmbF/E9Yc=; b=goB6YPScwF17n/KBWnnCeAhyLpaWQr0oIcaoT0mpQnWQOXGQNz6ifBsS dmNKUEgYxK/VtTgE4wc81skxqocZj2oBp83TUX8Oa9olACGILUytbzva5 mnkiUMQ4zrCz9lfY1HAr80ppczjdJLb+3NSwv4OdRrViIRHl7TXdoYO7J Q=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 2aliCzhyOh0fDvZKu3MysIljbnxpZikxNlp9VbAgcwK44GiRR5MeWVrVLox707BH4fnTulyh8/ JSK7rvRSftpOVrrVXRjqRZEnjgZN4X0GyzaO2aKiy1sAiYBbf2tBRglWrhYmorWnLIU77L407n 5h7PUo0cLpAhZfFuKe9Psq3dwaNr3wAIujY4FxWMmpIE+5pHIEMTEd+eHlwNasE5E1y2VtWg6y otcHW0jFmKCrr1VQLkkTr8SoU5zjF13jCx6B9n893QksObBgkG6fQ7rZ+k/bODaCwlyK3E5kXo W7MCoiG+qFuZnboTg41p3mle X-SBRS: 5.1 X-MesageID: 53560996 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:KkDS6aBM/cbTDRVW/8Hkw5YqxClBgxIJ4kV8jS/XYbTApGxw32MBx 2YWUDuDP/yCNjSnKt5yPIy3oUhQ6MSBzYJrQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMo/u1Si6FatANl1ElvU2zbue6WLOs1hxZH1c+EX9w00o7wYbVv6Yz6TSHK1LV0 T/Ni5W31G+Ng1aY5UpNtspvADs21BjDkGtwUm4WPJinj3eH/5UhN7oNJLnZEpfNatI88thW5 Qr05OrREmvxp3/BAz4++1rxWhVirrX6ZWBihpfKMkQLb9crSiEai84G2PQghUh/izGNtPF9z 493hbutalpzEoHzw/YjTEwNe81+FfUuFL7vJHG+tYqYzlHccmuqyPJrZK00FdRGoKAtWzgIr KFGbmBWBvyAr7veLLaTY+9gnMk8auLsO5sSoCpIxjDFF/c2B5vERs0m4PcFh2pu3pEfQ54yY eIDU2R0N0zMfyRBYAknOdV5tbuPuHzwJmgwRFW9+vNsvjm7IBZK+LrwNNvYfPSaSMMTmVyXz krk1WnkBhARNPSE1CGItHmrg4fnkS3yV40TE7m53uV3m1DVzWsWYDUJUXOrrP//jVSxM/pPJ kpR9icwoKwa8E2wUsK7TxC+uGSDvBMXR5xXCeJSwACSyILE7gCBHG8GQzVdLts8u6ceXic23 1WEm9foAz1Hs7CPT3+ZsLCOoluP1TM9dDFYI3VeFE1cvoel8NpbYg/zoshLEKqxpfz5HmvK8 xeXj3Vkq5ks1tw1yPDulbzYuA5AtqQlXyZsuF6ODjn0v1sjDGK2T9f3sgmAtJ6sOK7cFwPY7 SZew6By+chTVcnlqcCbfAka8FhFDd6+OTvAiBZEG5A7/lxBEFbyINgNvFmSyKpvW/vomAMFg meI4mu9B7cJZRNGiJObhKrrUKwXIVDIT4iNaxwtRoMmjmJNmOq7EMZGPhT44owQuBJ0zfFX1 WmzKJ7xZZrlNUiX5GXvHLpMuVPa7gs/2XnSVfjGI+ePiOHFDEN5vYwtaQPUBshgtfvsiFyMr 753apvboz0CAbaWSnSGruYuwaUicCFT6Wbe8JcMKIZu42NORQkcNhMm6elwI9A6x/sFyLigE 7PUchYw9WcTTEbvcW2iAk2Popu2NXqmhX5kbyEqI3iy3H0vPdSm4KsFLsNldrg77u1zi/VzS qBdKcmHB/1OTBXB+igcMsah/NAzKkzziFLcJTehbRg+Y4VkG17D9Oj7c1a97yIJFCe265cz+ uXyygPBTJMfbA1+F8KKOum3xla8sCFFyuJ/VkfFOPdJf0Do/NQ4IiD9lKZvccoNNQ/C1n2R0 APPWUUUouzEookU9tjVhP/b89f1QrUmRkcDRjvV97e7MyXe71GP+44YXbbaZy3ZWUP15L6mO bdfwcbjPaBVh11NqYd9TepmlPps+9v1qrZG5Q14B3GXPU+zA7ZtL3Taj8lCsqpBmu1QtQesA x/d/9BbPfOCOd//EU5XLw0gN7zR2fYRkzjUzPI0PESlu3MnoOvZCR1fb0uWlShQDLppK4d0k +4utfkf5xG7lhd3YM2NiTpZ9jjUI3ENO0n9Wkr23GM/ZtIX92x/ IronPort-HdrOrdr: A9a23:d53ceKqbkf5TLc2PlQ0NeR0aV5oXeYIsimQD101hICG9Ffbo8/ xG/c5rsCMc5wxhO03I9ergBEDiex3hHPxOkO4s1N6ZNWGN1VdARLsSi7cKqAeQeREWmNQ86U 5ISdkGNDWuZmIQsS+B2maF+nwbsaG6GduT6dvj8w== X-IronPort-AV: E=Sophos;i="5.85,308,1624334400"; d="scan'208";a="53560996" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Stefano Stabellini , Wei Liu , Julien Grall , Dario Faggioli Subject: [PATCH v2 03/12] xen/credit2: Remove tail padding from TRC_CSCHED2_* records Date: Mon, 20 Sep 2021 18:25:20 +0100 Message-ID: <20210920172529.24932-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 All three of these records have tail padding, leaking stack rubble into the trace buffer. Introduce an explicit _pad field and have the compiler zero the padding automatically. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Dario Faggioli --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall CC: Dario Faggioli --- xen/common/sched/credit2.c | 47 +++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index 6396b38e044c..41312158ec63 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -1106,12 +1106,14 @@ _runq_assign(struct csched2_unit *svc, struct csched2_runqueue_data *rqd) if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - unsigned rqi:16; - } d; - d.dom = svc->unit->domain->domain_id; - d.unit = svc->unit->unit_id; - d.rqi=rqd->id; + uint16_t unit, dom; + uint16_t rqi, _pad; + } d = { + .unit = svc->unit->unit_id, + .dom = svc->unit->domain->domain_id, + .rqi = rqd->id, + }; + __trace_var(TRC_CSCHED2_RUNQ_ASSIGN, 1, sizeof(d), (unsigned char *)&d); @@ -1336,13 +1338,17 @@ update_runq_load(const struct scheduler *ops, { struct { uint64_t rq_avgload, b_avgload; - unsigned rq_load:16, rq_id:8, shift:8; - } d; - d.rq_id = rqd->id; - d.rq_load = rqd->load; - d.rq_avgload = rqd->avgload; - d.b_avgload = rqd->b_avgload; - d.shift = P; + uint16_t rq_load; + uint8_t rq_id, shift; + uint32_t _pad; + } d = { + .rq_avgload = rqd->avgload, + .b_avgload = rqd->b_avgload, + .rq_load = rqd->load, + .rq_id = rqd->id, + .shift = P, + }; + __trace_var(TRC_CSCHED2_UPDATE_RUNQ_LOAD, 1, sizeof(d), (unsigned char *)&d); @@ -2799,12 +2805,15 @@ static void balance_load(const struct scheduler *ops, int cpu, s_time_t now) { struct { uint64_t lb_avgload, ob_avgload; - unsigned lrq_id:16, orq_id:16; - } d; - d.lrq_id = st.lrqd->id; - d.lb_avgload = st.lrqd->b_avgload; - d.orq_id = st.orqd->id; - d.ob_avgload = st.orqd->b_avgload; + uint16_t lrq_id, orq_id; + uint32_t _pad; + } d = { + .lb_avgload = st.lrqd->b_avgload, + .ob_avgload = st.orqd->b_avgload, + .lrq_id = st.lrqd->id, + .orq_id = st.orqd->id, + }; + __trace_var(TRC_CSCHED2_LOAD_BALANCE, 1, sizeof(d), (unsigned char *)&d); From patchwork Mon Sep 20 17:25:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506021 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F428C433FE for ; Mon, 20 Sep 2021 17:26:10 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA891632DE for ; Mon, 20 Sep 2021 17:26:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CA891632DE Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191055.340985 (Exim 4.92) (envelope-from ) id 1mSN3J-0006na-G7; Mon, 20 Sep 2021 17:26:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191055.340985; Mon, 20 Sep 2021 17:26:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN3J-0006nF-9r; Mon, 20 Sep 2021 17:26:01 +0000 Received: by outflank-mailman (input) for mailman id 191055; Mon, 20 Sep 2021 17:25:59 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN3H-0003ck-Jq for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:25:59 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 498bb826-dae4-419f-ac12-f9a647422097; Mon, 20 Sep 2021 17:25:41 +0000 (UTC) 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: 498bb826-dae4-419f-ac12-f9a647422097 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632158741; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J0c0EKnncyso937b/nTJN9IuK7CtJgbwEqGNFEbbFdw=; b=XMLZZqrr0xpZvQ+ZtRLizLDBiFLs1uqWKFDjte7izRhO7XyvgvfOV8gt RXXqAjjkR3BC1Qx+nsqU6qszje/xmB0iBgLsrNw47ntghRlzS0VWNnv43 +KHofx5kvA9NgLHv6cFBX1xuMy45H2l5SGAbUsB8JXbD6sQctCjBuNXe7 k=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: QB/yb4BU8YtWfEDbbD4DxptDgnCuvdzoDh+lOslCjvNzO4tKfOWSn+1prs7uogfJ6ihuV5Ue7n cVTlTdvqGC0rqqfOyb/D3PSWb/h/vwShtTZwcQwimY0kS90tOPM9mUt80vZzkUOmn7rwb7N+aG Bvhpy1R5//SFzhQa2H6/XCsl/Q1Ngpxk9euAg+ReM8896N6Cjkt1p/LPZJZeX3R0bd8MpU7qwa np9qMPUp8QBV0usth7HbOPa0fDTNw6zsIOKIjouzDm3NLNupZOp6TMQxAD5h87tAxRmARwKTQi 5Kex866Cmmg2MLCEGmo1oM+s X-SBRS: 5.1 X-MesageID: 54938587 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:4OdDPKMtBZYO/N/vrR29kMFynXyQoLVcMsEvi/4bfWQNrUoj3zAGn TBNUGGGbvmKazehLt0jbN/ioR8O6JDczdBgSQto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdpJYz/uUGuCJQUNUjMlkfZKhTr6ZUsxNbVU8En552Eg7w7RRbrNA2rBVPSvc4 bsenOWHULOV82Yc3rU8sv/rRLtH5ZweiRtA1rAMTakjUGz2zhH5OKk3N6CpR0YUd6EPdgKMq 0Qv+5nilo/R109F5tpICd8XeGVSKlLZFVDmZna7x8FOK/WNz8A/+v9TCRYSVatYoy+MgPBI5 txPjpDqUgg5AL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rZ ON0yfDgMaJYwAYW4tQkS7s7n7gj49bPpqNBylU2FXrGWF2nF7d8LyTUxsJIrKBMmudUtAbet phjITWG1WFl4P/YLWM= IronPort-HdrOrdr: A9a23:N/op3a9jBN2bb8cCXCVuk+DgI+orL9Y04lQ7vn2YSXRuHPBw8P re5cjztCWE7gr5N0tBpTntAsW9qDbnhPtICOoqTNCftWvdyQiVxehZhOOIqVDd8m/Fh4pgPM 9bAtBD4bbLbGSS4/yU3ODBKadD/OW6 X-IronPort-AV: E=Sophos;i="5.85,308,1624334400"; d="scan'208";a="54938587" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH v2 04/12] x86/hvm: Reduce stack usage from HVMTRACE_ND() Date: Mon, 20 Sep 2021 18:25:21 +0100 Message-ID: <20210920172529.24932-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 It is pointless to write all 6 entries and only consume the useful subset. bloat-o-meter shows quite how obscene the overhead is in vmx_vmexit_handler(), weighing in at 12% of the function arranging unread zeroes on the stack, and 8% for svm_vmexit_handler(). add/remove: 0/0 grow/shrink: 0/20 up/down: 0/-1929 (-1929) Function old new delta hvm_msr_write_intercept 1049 1033 -16 vmx_enable_intr_window 238 214 -24 svm_enable_intr_window 337 313 -24 hvmemul_write_xcr 115 91 -24 hvmemul_write_cr 350 326 -24 hvmemul_read_xcr 115 91 -24 hvmemul_read_cr 146 122 -24 hvm_mov_to_cr 438 414 -24 hvm_mov_from_cr 253 229 -24 vmx_intr_assist 1150 1118 -32 svm_intr_assist 459 427 -32 hvm_rdtsc_intercept 138 106 -32 hvm_msr_read_intercept 898 866 -32 vmx_vmenter_helper 1142 1094 -48 vmx_inject_event 813 765 -48 svm_vmenter_helper 238 187 -51 hvm_hlt 197 146 -51 svm_inject_event 1678 1614 -64 svm_vmexit_handler 5880 5392 -488 vmx_vmexit_handler 7281 6438 -843 Total: Before=3644277, After=3642348, chg -0.05% Adjust all users of HVMTRACE_ND(), using TRC_PAR_LONG() where appropriate instead of opencoding it. The 0 case needs a little help. All object in C must have a unique address and _d is passed by pointer. Explicitly permit the optimiser to drop the array. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu v2: * Adjust callers of HVMTRACE_ND() too * Drop _d[] for the 0 case. Normally I wouldn't recommend patches like this for backport, but {vmx,svm}_vmexit_handler() are fastpaths and this is a *lot* of I-cache lines dropped... --- xen/arch/x86/hvm/svm/svm.c | 8 +++----- xen/arch/x86/hvm/vmx/vmx.c | 9 ++++----- xen/include/asm-x86/hvm/trace.h | 28 ++++++++++------------------ 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index afb1ccb342c2..f0e10dec046e 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1052,7 +1052,7 @@ void svm_vmenter_helper(const struct cpu_user_regs *regs) if ( unlikely(tb_init_done) ) HVMTRACE_ND(VMENTRY, nestedhvm_vcpu_in_guestmode(curr) ? TRC_HVM_NESTEDFLAG : 0, - 1/*cycles*/, 0, 0, 0, 0, 0, 0, 0); + 1/*cycles*/); svm_sync_vmcb(curr, vmcb_needs_vmsave); @@ -2565,12 +2565,10 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) if ( hvm_long_mode_active(v) ) HVMTRACE_ND(VMEXIT64, vcpu_guestmode ? TRC_HVM_NESTEDFLAG : 0, - 1/*cycles*/, 3, exit_reason, - regs->eip, regs->rip >> 32, 0, 0, 0); + 1/*cycles*/, exit_reason, TRC_PAR_LONG(regs->rip)); else HVMTRACE_ND(VMEXIT, vcpu_guestmode ? TRC_HVM_NESTEDFLAG : 0, - 1/*cycles*/, 2, exit_reason, - regs->eip, 0, 0, 0, 0); + 1/*cycles*/, exit_reason, regs->eip); if ( vcpu_guestmode ) { diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index b0a42d05f86a..d403e2d8060a 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -3864,11 +3864,10 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) __vmread(VM_EXIT_REASON, &exit_reason); if ( hvm_long_mode_active(v) ) - HVMTRACE_ND(VMEXIT64, 0, 1/*cycles*/, 3, exit_reason, - regs->eip, regs->rip >> 32, 0, 0, 0); + HVMTRACE_ND(VMEXIT64, 0, 1/*cycles*/, exit_reason, + TRC_PAR_LONG(regs->rip)); else - HVMTRACE_ND(VMEXIT, 0, 1/*cycles*/, 2, exit_reason, - regs->eip, 0, 0, 0, 0); + HVMTRACE_ND(VMEXIT, 0, 1/*cycles*/, exit_reason, regs->eip); perfc_incra(vmexits, exit_reason); @@ -4645,7 +4644,7 @@ bool vmx_vmenter_helper(const struct cpu_user_regs *regs) if ( unlikely(curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_MASK) ) lbr_fixup(); - HVMTRACE_ND(VMENTRY, 0, 1/*cycles*/, 0, 0, 0, 0, 0, 0, 0); + HVMTRACE_ND(VMENTRY, 0, 1/*cycles*/); __vmwrite(GUEST_RIP, regs->rip); __vmwrite(GUEST_RSP, regs->rsp); diff --git a/xen/include/asm-x86/hvm/trace.h b/xen/include/asm-x86/hvm/trace.h index 5cd459b855b7..145b59f6ac65 100644 --- a/xen/include/asm-x86/hvm/trace.h +++ b/xen/include/asm-x86/hvm/trace.h @@ -67,38 +67,30 @@ #define TRACE_2_LONG_4D(_e, d1, d2, d3, d4, ...) \ TRACE_6D(_e, d1, d2, d3, d4) -#define HVMTRACE_ND(evt, modifier, cycles, count, d1, d2, d3, d4, d5, d6) \ +#define HVMTRACE_ND(evt, modifier, cycles, ...) \ do { \ if ( unlikely(tb_init_done) && DO_TRC_HVM_ ## evt ) \ { \ - struct { \ - u32 d[6]; \ - } _d; \ - _d.d[0]=(d1); \ - _d.d[1]=(d2); \ - _d.d[2]=(d3); \ - _d.d[3]=(d4); \ - _d.d[4]=(d5); \ - _d.d[5]=(d6); \ + uint32_t _d[] = { __VA_ARGS__ }; \ __trace_var(TRC_HVM_ ## evt | (modifier), cycles, \ - sizeof(*_d.d) * count, &_d); \ + sizeof(_d), sizeof(_d) ? _d : NULL); \ } \ } while(0) #define HVMTRACE_6D(evt, d1, d2, d3, d4, d5, d6) \ - HVMTRACE_ND(evt, 0, 0, 6, d1, d2, d3, d4, d5, d6) + HVMTRACE_ND(evt, 0, 0, d1, d2, d3, d4, d5, d6) #define HVMTRACE_5D(evt, d1, d2, d3, d4, d5) \ - HVMTRACE_ND(evt, 0, 0, 5, d1, d2, d3, d4, d5, 0) + HVMTRACE_ND(evt, 0, 0, d1, d2, d3, d4, d5) #define HVMTRACE_4D(evt, d1, d2, d3, d4) \ - HVMTRACE_ND(evt, 0, 0, 4, d1, d2, d3, d4, 0, 0) + HVMTRACE_ND(evt, 0, 0, d1, d2, d3, d4) #define HVMTRACE_3D(evt, d1, d2, d3) \ - HVMTRACE_ND(evt, 0, 0, 3, d1, d2, d3, 0, 0, 0) + HVMTRACE_ND(evt, 0, 0, d1, d2, d3) #define HVMTRACE_2D(evt, d1, d2) \ - HVMTRACE_ND(evt, 0, 0, 2, d1, d2, 0, 0, 0, 0) + HVMTRACE_ND(evt, 0, 0, d1, d2) #define HVMTRACE_1D(evt, d1) \ - HVMTRACE_ND(evt, 0, 0, 1, d1, 0, 0, 0, 0, 0) + HVMTRACE_ND(evt, 0, 0, d1) #define HVMTRACE_0D(evt) \ - HVMTRACE_ND(evt, 0, 0, 0, 0, 0, 0, 0, 0, 0) + HVMTRACE_ND(evt, 0, 0) #define HVMTRACE_LONG_1D(evt, d1) \ HVMTRACE_2D(evt ## 64, (d1) & 0xFFFFFFFF, (d1) >> 32) From patchwork Mon Sep 20 17:25:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506011 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19DBFC433F5 for ; Mon, 20 Sep 2021 17:25:54 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C96C86135D for ; Mon, 20 Sep 2021 17:25:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C96C86135D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191049.340930 (Exim 4.92) (envelope-from ) id 1mSN34-0004VK-Qe; Mon, 20 Sep 2021 17:25:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191049.340930; Mon, 20 Sep 2021 17:25:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN34-0004V7-Mz; Mon, 20 Sep 2021 17:25:46 +0000 Received: by outflank-mailman (input) for mailman id 191049; Mon, 20 Sep 2021 17:25:45 +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 1mSN33-0003cq-CU for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:25:45 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c5b8efe2-1a37-11ec-b87a-12813bfff9fa; Mon, 20 Sep 2021 17:25:39 +0000 (UTC) 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: c5b8efe2-1a37-11ec-b87a-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632158739; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZTBK/i8V2Aw3dyyoK4GveFgWRMnudCEdHrs7LHz7jJM=; b=ffYKYLXmdMK4xnNfiLN16nCAdivYhR1M2GMqA92dDa4xyr1Eftfc+gMz j6xK8dGyzxoFh0ePGYQPKV4w4MEE3zzU/zR7MPCVepPIpBm/++bYHYwmF AQVGQzX9CZNBoKSqrOGVarnblQKtMxzObKf+L3XLF5iEE5XVsfm4iAm2g 0=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: mo97rJIQ3QkUuROXYXDlf11JLR7AbsVApbznlGFG92hVQq+caeExaYNCld71797jQ2A0Hiw0nW DppHwsPdEVUzc3IQuxza5RGnaSDXsUO6nRDCg0PRHvVSFb4Nq9PsbwYgRc5PGAg3UoecSBZlCa LgP8AY4AhT5k3f5Td9/U2HDgQShZrk8pEmiGHD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ABbvzt68owGOlor6p5 iNspiRmxLpSZaxhbQTUKAn3IF1M2xpiGGaG6WOD4rF7r2j9k5JdVdkIvVmS23uFwu5bIGS0M Sc/SCt65YNJPWvCUEOES9vqUKwXIVzbPY29DJj8N4MWCrAoLVPv1Hw+NCa4gjG2+GBxwP5XB HtuWZv1ZZrsIf88l2TeqiZ0+eJD+x3SMkuJFMinkEz4geTBDJNXIJ9cWGazgikCxPvsiG3oH xx3bqNmEj1TD7/zZDf564kWIQxYJHQ3H8mu+cdWavSCMkxtH2R4U63dxrYoeopEmaVJl7iXo iHhCxEAkFev12faLQiqa2x4bO+9V5hIsn9mbzcnOkyl2iZ/bN/3vrsfbZY+YZIu6PdnkaxvV /AAdsjZWqZPRz3L9i4zd574qIA+Jh2niRjXZ3iuYSQlfo4mTAvMo4e2cgzq/SgILyy2qcph/ OHwilKFGcIOHl0wAtzXZfSjy0KKkUIcwO8iDVHVJtRzeVn39NQ4ISLGkfJqcdoHLg/Ox2XG2 l/OUwsYv+TEv6Q87MLN2fKft46sHuZzQhhaEm3c4erkPCXW5DP+k4pJUeLOdjHBTmLkvq6lY LwNnf37NfQGmndMspZ9TOk3nf5vuYO3qu8I1BlgEVXKc0+vW+FpLXSx1MVSsrFAm+1CsgysV 0PTotRXNN1l4i8+/IL98Ob9Utm+6A== IronPort-HdrOrdr: A9a23:pGiDi6kiQF6IEeU6vajOw+xg70npDfLc3DAbv31ZSRFFG/Fw9/ rCoB17726StN91YhsdcL+7V5VoLUmzyXcx2/hzAV7AZniDhILLFuFfBOLZqlWNJ8S9zJ8+6U 4JScND4bbLfD1HZKjBgTVRE7wbsaW6GKLDv5ag85+6JzsaFZ2J7G1Ce3em+lUdfnghOXKgfq DsnPauoVCbCA0qR/X+PFYpdc7ZqebGkZr3CCR2eiLOuGG1/EuVAKeRKWni4isj X-IronPort-AV: E=Sophos;i="5.85,308,1624334400"; d="scan'208";a="53560992" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH v2 05/12] x86/hvm: Remove duplicate calls caused by tracing Date: Mon, 20 Sep 2021 18:25:22 +0100 Message-ID: <20210920172529.24932-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 1) vpic_ack_pending_irq() calls vlapic_accept_pic_intr() twice, once in the TRACE_2D() instantiation and once "for real". Make the call only once. 2) vlapic_accept_pic_intr() similarly calls __vlapic_accept_pic_intr() twice, although this is more complicated to disentangle. v cannot be NULL because it has already been dereferenced in the function, causing the ternary expression to always call __vlapic_accept_pic_intr(). However, the return expression of the function takes care to skip the call if this vCPU isn't the PIC target. As __vlapic_accept_pic_intr() is far from trivial, make the TRACE_2D() semantics match the return semantics by only calling __vlapic_accept_pic_intr() when the vCPU is the PIC target. 3) hpet_set_timer() duplicates calls to hpet_tick_to_ns(). Pull the logic out which simplifies both the TRACE and create_periodic_time() calls. 4) lapic_rearm() makes multiple calls to vlapic_lvtt_period(). Pull it out into a local variable. vlapic_accept_pic_intr() is called on every VMEntry, so this is a reduction in VMEntry complexity across the board. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu v2: * New --- xen/arch/x86/hvm/hpet.c | 15 +++++++++------ xen/arch/x86/hvm/vlapic.c | 23 +++++++++++++++-------- xen/arch/x86/hvm/vpic.c | 9 +++++---- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c index ee756abb824d..475c3f8bf471 100644 --- a/xen/arch/x86/hvm/hpet.c +++ b/xen/arch/x86/hvm/hpet.c @@ -240,6 +240,7 @@ static void hpet_set_timer(HPETState *h, unsigned int tn, uint64_t tn_cmp, cur_tick, diff; unsigned int irq; unsigned int oneshot; + s_time_t diff_ns, period_ns = 0; ASSERT(tn < HPET_TIMER_NUM); ASSERT(rw_is_write_locked(&h->lock)); @@ -311,13 +312,15 @@ static void hpet_set_timer(HPETState *h, unsigned int tn, * status register) before another interrupt can be delivered. */ oneshot = !timer_is_periodic(h, tn) || timer_level(h, tn); + diff_ns = hpet_tick_to_ns(h, diff); + if ( !oneshot ) + period_ns = hpet_tick_to_ns(h, h->hpet.period[tn]); + TRACE_2_LONG_4D(TRC_HVM_EMUL_HPET_START_TIMER, tn, irq, - TRC_PAR_LONG(hpet_tick_to_ns(h, diff)), - TRC_PAR_LONG(oneshot ? 0LL : - hpet_tick_to_ns(h, h->hpet.period[tn]))); - create_periodic_time(vhpet_vcpu(h), &h->pt[tn], - hpet_tick_to_ns(h, diff), - oneshot ? 0 : hpet_tick_to_ns(h, h->hpet.period[tn]), + TRC_PAR_LONG(diff_ns), + TRC_PAR_LONG(period_ns)); + + create_periodic_time(vhpet_vcpu(h), &h->pt[tn], diff_ns, period_ns, irq, timer_level(h, tn) ? hpet_timer_fired : NULL, timer_level(h, tn) ? (void *)(unsigned long)tn : NULL, timer_level(h, tn)); diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index 5e21fb4937d9..b8c84458ffdc 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -1267,15 +1267,18 @@ static int __vlapic_accept_pic_intr(struct vcpu *v) int vlapic_accept_pic_intr(struct vcpu *v) { + bool target, accept = false; + if ( vlapic_hw_disabled(vcpu_vlapic(v)) || !has_vpic(v->domain) ) return 0; - TRACE_2D(TRC_HVM_EMUL_LAPIC_PIC_INTR, - (v == v->domain->arch.hvm.i8259_target), - v ? __vlapic_accept_pic_intr(v) : -1); + target = v == v->domain->arch.hvm.i8259_target; + if ( target ) + accept = __vlapic_accept_pic_intr(v); + + TRACE_2D(TRC_HVM_EMUL_LAPIC_PIC_INTR, target, accept); - return ((v == v->domain->arch.hvm.i8259_target) && - __vlapic_accept_pic_intr(v)); + return target && accept; } void vlapic_adjust_i8259_target(struct domain *d) @@ -1449,6 +1452,7 @@ static void lapic_rearm(struct vlapic *s) { unsigned long tmict; uint64_t period, tdt_msr; + bool is_periodic; s->pt.irq = vlapic_get_reg(s, APIC_LVTT) & APIC_VECTOR_MASK; @@ -1464,12 +1468,15 @@ static void lapic_rearm(struct vlapic *s) period = ((uint64_t)APIC_BUS_CYCLE_NS * (uint32_t)tmict * s->hw.timer_divisor); + is_periodic = vlapic_lvtt_period(s); + TRACE_2_LONG_3D(TRC_HVM_EMUL_LAPIC_START_TIMER, TRC_PAR_LONG(period), - TRC_PAR_LONG(vlapic_lvtt_period(s) ? period : 0LL), s->pt.irq); + TRC_PAR_LONG(is_periodic ? period : 0LL), s->pt.irq); + create_periodic_time(vlapic_vcpu(s), &s->pt, period, - vlapic_lvtt_period(s) ? period : 0, + is_periodic ? period : 0, s->pt.irq, - vlapic_lvtt_period(s) ? vlapic_pt_cb : NULL, + is_periodic ? vlapic_pt_cb : NULL, &s->timer_last_update, false); s->timer_last_update = s->pt.last_plt_gtime; } diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c index af988a868c8a..91c2c6983393 100644 --- a/xen/arch/x86/hvm/vpic.c +++ b/xen/arch/x86/hvm/vpic.c @@ -512,14 +512,15 @@ void vpic_irq_negative_edge(struct domain *d, int irq) int vpic_ack_pending_irq(struct vcpu *v) { - int irq; + int irq, accept; struct hvm_hw_vpic *vpic = &v->domain->arch.hvm.vpic[0]; ASSERT(has_vpic(v->domain)); - TRACE_2D(TRC_HVM_EMUL_PIC_PEND_IRQ_CALL, vlapic_accept_pic_intr(v), - vpic->int_output); - if ( !vlapic_accept_pic_intr(v) || !vpic->int_output ) + accept = vlapic_accept_pic_intr(v); + + TRACE_2D(TRC_HVM_EMUL_PIC_PEND_IRQ_CALL, accept, vpic->int_output); + if ( !accept || !vpic->int_output ) return -1; irq = vpic_intack(vpic); From patchwork Mon Sep 20 17:25:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506019 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B35FC4332F for ; Mon, 20 Sep 2021 17:26:04 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2927E632E2 for ; Mon, 20 Sep 2021 17:26:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2927E632E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191052.340963 (Exim 4.92) (envelope-from ) id 1mSN3E-0005og-4m; Mon, 20 Sep 2021 17:25:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191052.340963; Mon, 20 Sep 2021 17:25:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN3E-0005ni-08; Mon, 20 Sep 2021 17:25:56 +0000 Received: by outflank-mailman (input) for mailman id 191052; Mon, 20 Sep 2021 17:25:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN3C-0003ck-JO for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:25:54 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 860d3042-ecd5-46c3-b376-ddfe26a9aaff; Mon, 20 Sep 2021 17:25:40 +0000 (UTC) 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: 860d3042-ecd5-46c3-b376-ddfe26a9aaff DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632158740; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=z2fpwHvRQ55rgQU2q9tyaPf+/02t7tCkN4LhCvt/vE0=; b=IxZRA/1El0MKEngsfLYz7Y25wmVxkSdGuXwnZ1zQ+TVAxKcBiQDAGNQm ZzxCd+1f0GYsO1/tqB3UljIlRqocDLQCH1GGgG/qWA2SUJTLh7pvS/CHz S7MfMPmOtDFdQ4utec3eczA14ff/V0T6nGD1ytsl9m6d9+b6Y/87VHzZb I=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: dG2VgwG7HkkRDOBtHJ9Dj0/LE8KAeXmD9IpTllINph2ZL2Oif/r6rHLNMCruAfRUaV1kV/Utna DiuomtbjEwIguLXGxeiog8HomkXP5uMeEU3skfEdmFcpUcXutLuxsG6+mIfgglnYUn0yKT67if btp9pm5KtW7cqH74OTfV/0ebtSe9jM9ZI5qrTvrT5boIRQYzsmmuh40Z8vhAnUh89aht/GULlF eWhQMppWI6kOuknXzZYo4aSyTXYjzypAN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pWdRoxb5psldMEZ ibuVeJtCH17ZyDCgUxfOdvZ5yEWIU/IT4+NaxwsRoASCqWdjSfelM2UWaJ144wKuBN2+ZzTx L/BKZr8ZZrkIf0/kVJauNvxIZd0n3tjlAs/tLjQzgi90Kr2WZJmYe5eazOzghQCxPrc+m39q o8HX+PTkkk3eLCuM0H/rN9IRXhXfCdTOHwDg5EOHgJ1ClE9Qz9J5j646e5JRrGJaIwPx7+Uo SniChEHoLc97FWeQTi3hrlYQOuHdf5CQbgTZETA5H6khCouZ5iB9qAae8dldLUr7rU7n/V1U +MEa4OLBfEWEmbL/DEUbJ/cqo1+dUv02VLSbnT9ODVvLYR9QwHp+8P/ele9/ic5ESfq59A1p Ket112HTMNbFRhiFsvfdNmm00i14SoGgOt3UkaReotTdUzg/ZJEMSv0ivNrccgAJQ+anmmR1 hqMAAderu7I+tdn/N7MjKGCjoGoD+ohQRYKQziFte67bHCI8HCizIlMVPezUQrcDG6kqr+/Y eh1zu3nNKFVllh9rIchQa1gyrgz5oWzquYCnBhkBnjCc3+iFqhkfiudxcBKu6BAmu1ZtA+xV h7d89VWI+zUasbsEVpXLws5dOWTk/oTn2CKv/gyJUz74g5x/aaGDhoOb0Xd1nQFIesnKp4hz McgpNUSul62hRcdO9qbijxZqjaXJXsaXqR77pwXDecHUObwJo2utXAENhLL3Q== IronPort-HdrOrdr: A9a23:yDiwv68g32XHn8dvub1uk+DkI+orL9Y04lQ7vn2ZLiYlFvBw9v re+cjzuiWE6wr5NEtApTniAse9qBHnhPlICOAqVN/JMTUO0FHYSr2KhrGSoQEIdRefygd179 YYT0AgY+eaMbEBt6nHCaODYq4dKaK8nJyVuQ== X-IronPort-AV: E=Sophos;i="5.85,308,1624334400"; d="scan'208";a="53560995" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Stefano Stabellini , Wei Liu , Julien Grall , Dario Faggioli Subject: [PATCH v2 06/12] xen/credit2: Clean up trace handling Date: Mon, 20 Sep 2021 18:25:23 +0100 Message-ID: <20210920172529.24932-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 There is no need for bitfields anywhere - use more sensible types. There is also no need to cast 'd' to (unsigned char *) before passing it to a function taking void *. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Dario Faggioli --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall CC: Dario Faggioli v2: * Fix whitespace. --- xen/common/sched/credit2.c | 315 ++++++++++++++++++++++----------------------- 1 file changed, 153 insertions(+), 162 deletions(-) diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index 41312158ec63..9b943e5168f0 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -1080,13 +1080,13 @@ static void update_max_weight(struct csched2_runqueue_data *rqd, int new_weight, if ( unlikely(tb_init_done) ) { struct { - unsigned rqi:16, max_weight:16; - } d; - d.rqi = rqd->id; - d.max_weight = rqd->max_weight; - __trace_var(TRC_CSCHED2_RUNQ_MAX_WEIGHT, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t rqi, max_weight; + } d = { + .rqi = rqd->id, + .max_weight = rqd->max_weight, + }; + + __trace_var(TRC_CSCHED2_RUNQ_MAX_WEIGHT, 1, sizeof(d), &d); } } @@ -1114,9 +1114,7 @@ _runq_assign(struct csched2_unit *svc, struct csched2_runqueue_data *rqd) .rqi = rqd->id, }; - __trace_var(TRC_CSCHED2_RUNQ_ASSIGN, 1, - sizeof(d), - (unsigned char *)&d); + __trace_var(TRC_CSCHED2_RUNQ_ASSIGN, 1, sizeof(d), &d); } } @@ -1342,16 +1340,14 @@ update_runq_load(const struct scheduler *ops, uint8_t rq_id, shift; uint32_t _pad; } d = { - .rq_avgload = rqd->avgload, - .b_avgload = rqd->b_avgload, - .rq_load = rqd->load, - .rq_id = rqd->id, - .shift = P, + .rq_avgload = rqd->avgload, + .b_avgload = rqd->b_avgload, + .rq_load = rqd->load, + .rq_id = rqd->id, + .shift = P, }; - __trace_var(TRC_CSCHED2_UPDATE_RUNQ_LOAD, 1, - sizeof(d), - (unsigned char *)&d); + __trace_var(TRC_CSCHED2_UPDATE_RUNQ_LOAD, 1, sizeof(d), &d); } } @@ -1401,16 +1397,16 @@ update_svc_load(const struct scheduler *ops, { struct { uint64_t v_avgload; - unsigned unit:16, dom:16; - unsigned shift; - } d; - d.dom = svc->unit->domain->domain_id; - d.unit = svc->unit->unit_id; - d.v_avgload = svc->avgload; - d.shift = P; - __trace_var(TRC_CSCHED2_UPDATE_UNIT_LOAD, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint32_t shift; + } d = { + .v_avgload = svc->avgload, + .unit = svc->unit->unit_id, + .dom = svc->unit->domain->domain_id, + .shift = P, + }; + + __trace_var(TRC_CSCHED2_UPDATE_UNIT_LOAD, 1, sizeof(d), &d); } } @@ -1457,15 +1453,15 @@ static void runq_insert(struct csched2_unit *svc) if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - unsigned pos; - } d; - d.dom = svc->unit->domain->domain_id; - d.unit = svc->unit->unit_id; - d.pos = pos; - __trace_var(TRC_CSCHED2_RUNQ_POS, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint32_t pos; + } d = { + .unit = svc->unit->unit_id, + .dom = svc->unit->domain->domain_id, + .pos = pos, + }; + + __trace_var(TRC_CSCHED2_RUNQ_POS, 1, sizeof(d), &d); } } @@ -1557,16 +1553,16 @@ static s_time_t tickle_score(const struct scheduler *ops, s_time_t now, if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - int credit, score; - } d; - d.dom = cur->unit->domain->domain_id; - d.unit = cur->unit->unit_id; - d.credit = cur->credit; - d.score = score; - __trace_var(TRC_CSCHED2_TICKLE_CHECK, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint32_t credit, score; + } d = { + .unit = cur->unit->unit_id, + .dom = cur->unit->domain->domain_id, + .credit = cur->credit, + .score = score, + }; + + __trace_var(TRC_CSCHED2_TICKLE_CHECK, 1, sizeof(d), &d); } return score; @@ -1604,17 +1600,16 @@ runq_tickle(const struct scheduler *ops, struct csched2_unit *new, s_time_t now) if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - unsigned processor; - int credit; - } d; - d.dom = unit->domain->domain_id; - d.unit = unit->unit_id; - d.processor = cpu; - d.credit = new->credit; - __trace_var(TRC_CSCHED2_TICKLE_NEW, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint32_t processor, credit; + } d = { + .dom = unit->domain->domain_id, + .unit = unit->unit_id, + .processor = cpu, + .credit = new->credit, + }; + + __trace_var(TRC_CSCHED2_TICKLE_NEW, 1, sizeof(d), &d); } /* @@ -1753,12 +1748,12 @@ runq_tickle(const struct scheduler *ops, struct csched2_unit *new, s_time_t now) if ( unlikely(tb_init_done) ) { struct { - unsigned cpu:16, pad:16; - } d; - d.cpu = ipid; d.pad = 0; - __trace_var(TRC_CSCHED2_TICKLE, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t cpu, _pad; + } d = { + .cpu = ipid, + }; + + __trace_var(TRC_CSCHED2_TICKLE, 1, sizeof(d), &d); } tickle_cpu(ipid, rqd); @@ -1834,16 +1829,16 @@ static void reset_credit(int cpu, s_time_t now, struct csched2_unit *snext) if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - int credit_start, credit_end; - } d; - d.dom = svc->unit->domain->domain_id; - d.unit = svc->unit->unit_id; - d.credit_start = start_credit; - d.credit_end = svc->credit; - __trace_var(TRC_CSCHED2_CREDIT_RESET, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint32_t credit_start, credit_end; + } d = { + .unit = svc->unit->unit_id, + .dom = svc->unit->domain->domain_id, + .credit_start = start_credit, + .credit_end = svc->credit, + }; + + __trace_var(TRC_CSCHED2_CREDIT_RESET, 1, sizeof(d), &d); } } @@ -1889,18 +1884,17 @@ void burn_credits(struct csched2_runqueue_data *rqd, if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - int credit, budget; - int delta; - } d; - d.dom = svc->unit->domain->domain_id; - d.unit = svc->unit->unit_id; - d.credit = svc->credit; - d.budget = has_cap(svc) ? svc->budget : INT_MIN; - d.delta = delta; - __trace_var(TRC_CSCHED2_CREDIT_BURN, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint32_t credit, budget, delta; + } d = { + .unit = svc->unit->unit_id, + .dom = svc->unit->domain->domain_id, + .credit = svc->credit, + .budget = has_cap(svc) ? svc->budget : INT_MIN, + .delta = delta, + }; + + __trace_var(TRC_CSCHED2_CREDIT_BURN, 1, sizeof(d), &d); } } @@ -2545,17 +2539,17 @@ csched2_res_pick(const struct scheduler *ops, const struct sched_unit *unit) { struct { uint64_t b_avgload; - unsigned unit:16, dom:16; - unsigned rq_id:16, new_cpu:16; - } d; - d.dom = unit->domain->domain_id; - d.unit = unit->unit_id; - d.rq_id = min_rqd ? min_rqd->id : -1; - d.b_avgload = min_avgload; - d.new_cpu = new_cpu; - __trace_var(TRC_CSCHED2_PICKED_CPU, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint16_t rq_id, new_cpu; + } d = { + .b_avgload = min_avgload, + .unit = unit->unit_id, + .dom = unit->domain->domain_id, + .rq_id = min_rqd ? min_rqd->id : -1, + .new_cpu = new_cpu, + }; + + __trace_var(TRC_CSCHED2_PICKED_CPU, 1, sizeof(d), &d); } return get_sched_res(new_cpu); @@ -2616,16 +2610,16 @@ static void migrate(const struct scheduler *ops, if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - unsigned rqi:16, trqi:16; - } d; - d.dom = unit->domain->domain_id; - d.unit = unit->unit_id; - d.rqi = svc->rqd->id; - d.trqi = trqd->id; - __trace_var(TRC_CSCHED2_MIGRATE, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint16_t rqi, trqi; + } d = { + .unit = unit->unit_id, + .dom = unit->domain->domain_id, + .rqi = svc->rqd->id, + .trqi = trqd->id, + }; + + __trace_var(TRC_CSCHED2_MIGRATE, 1, sizeof(d), &d); } if ( svc->flags & CSFLAG_scheduled ) @@ -2762,15 +2756,15 @@ static void balance_load(const struct scheduler *ops, int cpu, s_time_t now) if ( unlikely(tb_init_done) ) { struct { - unsigned lrq_id:16, orq_id:16; - unsigned load_delta; - } d; - d.lrq_id = st.lrqd->id; - d.orq_id = st.orqd->id; - d.load_delta = st.load_delta; - __trace_var(TRC_CSCHED2_LOAD_CHECK, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t lrq_id, orq_id; + uint32_t load_delta; + } d = { + .lrq_id = st.lrqd->id, + .orq_id = st.orqd->id, + .load_delta = st.load_delta, + }; + + __trace_var(TRC_CSCHED2_LOAD_CHECK, 1, sizeof(d), &d); } /* @@ -2808,15 +2802,13 @@ static void balance_load(const struct scheduler *ops, int cpu, s_time_t now) uint16_t lrq_id, orq_id; uint32_t _pad; } d = { - .lb_avgload = st.lrqd->b_avgload, - .ob_avgload = st.orqd->b_avgload, - .lrq_id = st.lrqd->id, - .orq_id = st.orqd->id, + .lb_avgload = st.lrqd->b_avgload, + .ob_avgload = st.orqd->b_avgload, + .lrq_id = st.lrqd->id, + .orq_id = st.orqd->id, }; - __trace_var(TRC_CSCHED2_LOAD_BALANCE, 1, - sizeof(d), - (unsigned char *)&d); + __trace_var(TRC_CSCHED2_LOAD_BALANCE, 1, sizeof(d), &d); } SCHED_STAT_CRANK(acct_load_balance); @@ -3402,15 +3394,15 @@ runq_candidate(struct csched2_runqueue_data *rqd, if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - unsigned runtime; - } d; - d.dom = scurr->unit->domain->domain_id; - d.unit = scurr->unit->unit_id; - d.runtime = now - scurr->unit->state_entry_time; - __trace_var(TRC_CSCHED2_RATELIMIT, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint32_t runtime; + } d = { + .unit = scurr->unit->unit_id, + .dom = scurr->unit->domain->domain_id, + .runtime = now - scurr->unit->state_entry_time, + }; + + __trace_var(TRC_CSCHED2_RATELIMIT, 1, sizeof(d), &d); } return scurr; } @@ -3463,13 +3455,13 @@ runq_candidate(struct csched2_runqueue_data *rqd, if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - } d; - d.dom = svc->unit->domain->domain_id; - d.unit = svc->unit->unit_id; - __trace_var(TRC_CSCHED2_RUNQ_CAND_CHECK, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + } d = { + .unit = svc->unit->unit_id, + .dom = svc->unit->domain->domain_id, + }; + + __trace_var(TRC_CSCHED2_RUNQ_CAND_CHECK, 1, sizeof(d), &d); } /* @@ -3537,17 +3529,16 @@ runq_candidate(struct csched2_runqueue_data *rqd, if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - unsigned tickled_cpu; - int credit; - } d; - d.dom = snext->unit->domain->domain_id; - d.unit = snext->unit->unit_id; - d.credit = snext->credit; - d.tickled_cpu = snext->tickled_cpu; - __trace_var(TRC_CSCHED2_RUNQ_CANDIDATE, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint32_t tickled_cpu, credit; + } d = { + .unit = snext->unit->unit_id, + .dom = snext->unit->domain->domain_id, + .tickled_cpu = snext->tickled_cpu, + .credit = snext->credit, + }; + + __trace_var(TRC_CSCHED2_RUNQ_CANDIDATE, 1, sizeof(d), &d); } if ( unlikely(snext->tickled_cpu != -1 && snext->tickled_cpu != cpu) ) @@ -3603,18 +3594,18 @@ static void csched2_schedule( if ( unlikely(tb_init_done) ) { struct { - unsigned cpu:16, rq_id:16; - unsigned tasklet:8, idle:8, smt_idle:8, tickled:8; - } d; - d.cpu = cur_cpu; - d.rq_id = c2r(sched_cpu); - d.tasklet = tasklet_work_scheduled; - d.idle = is_idle_unit(currunit); - d.smt_idle = cpumask_test_cpu(sched_cpu, &rqd->smt_idle); - d.tickled = tickled; - __trace_var(TRC_CSCHED2_SCHEDULE, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t cpu, rq_id; + uint8_t tasklet, idle, smt_idle, tickled; + } d = { + .cpu = cur_cpu, + .rq_id = c2r(sched_cpu), + .tasklet = tasklet_work_scheduled, + .idle = is_idle_unit(currunit), + .smt_idle = cpumask_test_cpu(sched_cpu, &rqd->smt_idle), + .tickled = tickled, + }; + + __trace_var(TRC_CSCHED2_SCHEDULE, 1, sizeof(d), &d); } /* Update credits (and budget, if necessary). */ From patchwork Mon Sep 20 17:25:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506013 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 245F0C433F5 for ; Mon, 20 Sep 2021 17:25:59 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D10E5632D6 for ; Mon, 20 Sep 2021 17:25:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D10E5632D6 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191050.340941 (Exim 4.92) (envelope-from ) id 1mSN39-0004wj-CF; Mon, 20 Sep 2021 17:25:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191050.340941; Mon, 20 Sep 2021 17:25:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN39-0004wW-89; Mon, 20 Sep 2021 17:25:51 +0000 Received: by outflank-mailman (input) for mailman id 191050; Mon, 20 Sep 2021 17:25:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN37-0003ck-J8 for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:25:49 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3da059ef-c2a7-4fd9-b9e7-9e82b9762130; Mon, 20 Sep 2021 17:25:39 +0000 (UTC) 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: 3da059ef-c2a7-4fd9-b9e7-9e82b9762130 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632158739; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=PjTVtROVmKL1HBneR1Ooz1mqoxckEyucfjsCTUE+XFg=; b=Ozj3BsnLMabdSHAFo6BAi6ZQqTe6xpnmvvY0GQqeb4liiUFN/uoDrkiO TS4TKkM3Kvitti43Jquc+6kZOVPIbgfB7uAIPjsFVVWdURY3mvlGvniOe 9rJb1B1gbqfh454qYuB09y1zoQ6jwbLm8SUKbeeL9YF4WzVXAXPtK1w8H w=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: fvWHELj4aqtuu/oBdfmJOefbJx7VCae4/OwcTFEZMZczMk6E9cSGfCSi9x35xRvWPVX6O3+JJ6 8ANefdZqc0Np+xKeqRwAC2bQtPHOCIY9ZO82c+HfQsupQucvdlYWd58NOsM+TfhrjTXk4pzVJc 8sOR1NyCvC8aUa9Z+G1ff0lM45j14MVZUDw7vklht6BCHYtKxet0NU3bOz47gKWDVHSDIJCvPG k0YdaQSxdEybFhYNn9P7X8oQiz0Zo6nlUf52k6oFQItpyKV+gnIZB6FUrTl9/Q8aRrLOq7juz7 j/fDYSty/TjUDm0JaBHTfxGa X-SBRS: 5.1 X-MesageID: 54938584 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:ajyFH6zuT4yA1B8UMGx6t+exwSrEfRIJ4+MujC+fZmUNrF6WrkVUz WpNDDuGaf6OYDD9LtAgYNm+8U4PupfTx9A2Sgo6+SAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnvopW1TYhSEUOZugH9IQM8aZfHAsLeNYYH1500s7yrRh2tQAbeWRWGthh /uj+6UzB3f9s9JEGjp8B3Wr8U4HUFza4Vv0j3RmDRx5lAa2e0o9VfrzEZqZPXrgKrS4K8bhL wr1IBNVyUuCl/slIovNfr8W6STmSJaKVeSFoiI+t6RPHnGuD8H9u0o2HKN0VKtZt9mGt/Zx2 MQchZjpcyI0PvD1u/g/CTlCDggraMWq+JefSZS+mcmazkmAeHrw2fR+SkoxOOX0+M4uXzsIr 6ZBbmlQMFbT3Ipaw5riIgVoru0lINPmI8U0vXZ4wCuCJf0nXYrCU+PB4towMDIY25wfRqaDN 5ZxhTxHPTTNQTlr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W3DpJ82msL2AbV/R1v54XN4bnlw43xwwQepfbECL3vMmCZtgk3pPG+ dNIaH4uX4hh+3c= IronPort-HdrOrdr: A9a23:IYghL6GX72G5OYV6pLqE6seALOsnbusQ8zAXP0AYc3Jom62j5r mTdZsgtSMc5Ax8ZJhko6HkBEDiewK7yXcW2/hzAV7KZmCP0wHEEGgh1/qH/9SJIVyYygc378 ZdmsZFZ+EYdWIK7/rH3A== X-IronPort-AV: E=Sophos;i="5.85,308,1624334400"; d="scan'208";a="54938584" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Stefano Stabellini , Wei Liu , Julien Grall , Dario Faggioli , Meng Xu Subject: [PATCH v2 07/12] xen/rt: Clean up trace handling Date: Mon, 20 Sep 2021 18:25:24 +0100 Message-ID: <20210920172529.24932-8-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Most uses of bitfields and __packed are unnecessary. There is also no need to cast 'd' to (unsigned char *) before passing it to a function taking void *. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Dario Faggioli --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall CC: Dario Faggioli CC: Meng Xu v2: * New --- xen/common/sched/rt.c | 97 ++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 51 deletions(-) diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c index c58edca0de84..d5da35cac75e 100644 --- a/xen/common/sched/rt.c +++ b/xen/common/sched/rt.c @@ -455,21 +455,21 @@ rt_update_deadline(s_time_t now, struct rt_unit *svc) svc->cur_budget = svc->budget; svc->priority_level = 0; - /* TRACE */ + if ( unlikely(tb_init_done) ) { - struct __packed { - unsigned unit:16, dom:16; - unsigned priority_level; + struct { + uint16_t unit, dom; + uint32_t priority_level; uint64_t cur_deadline, cur_budget; - } d; - d.dom = svc->unit->domain->domain_id; - d.unit = svc->unit->unit_id; - d.priority_level = svc->priority_level; - d.cur_deadline = (uint64_t) svc->cur_deadline; - d.cur_budget = (uint64_t) svc->cur_budget; - trace_var(TRC_RTDS_BUDGET_REPLENISH, 1, - sizeof(d), - (unsigned char *) &d); + } d = { + .dom = svc->unit->domain->domain_id, + .unit = svc->unit->unit_id, + .priority_level = svc->priority_level, + .cur_deadline = svc->cur_deadline, + .cur_budget = svc->cur_budget, + }; + + __trace_var(TRC_RTDS_BUDGET_REPLENISH, 1, sizeof(d), &d); } return; @@ -965,7 +965,7 @@ burn_budget(const struct scheduler *ops, struct rt_unit *svc, s_time_t now) } } - /* TRACE */ + if ( unlikely(tb_init_done) ) { struct __packed { uint16_t unit, dom; @@ -982,9 +982,7 @@ burn_budget(const struct scheduler *ops, struct rt_unit *svc, s_time_t now) .has_extratime = !!(svc->flags & RTDS_extratime), }; - trace_var(TRC_RTDS_BUDGET_BURN, 1, - sizeof(d), - (unsigned char *) &d); + __trace_var(TRC_RTDS_BUDGET_BURN, 1, sizeof(d), &d); } } @@ -1019,22 +1017,19 @@ runq_pick(const struct scheduler *ops, const cpumask_t *mask, unsigned int cpu) break; } - /* TRACE */ + if ( unlikely(tb_init_done) && svc ) { - if( svc != NULL ) - { - struct __packed { - unsigned unit:16, dom:16; - uint64_t cur_deadline, cur_budget; - } d; - d.dom = svc->unit->domain->domain_id; - d.unit = svc->unit->unit_id; - d.cur_deadline = (uint64_t) svc->cur_deadline; - d.cur_budget = (uint64_t) svc->cur_budget; - trace_var(TRC_RTDS_RUNQ_PICK, 1, - sizeof(d), - (unsigned char *) &d); - } + struct __packed { + uint16_t unit, dom; + uint64_t cur_deadline, cur_budget; + } d = { + .unit = svc->unit->unit_id, + .dom = svc->unit->domain->domain_id, + .cur_deadline = svc->cur_deadline, + .cur_budget = svc->cur_budget, + }; + + __trace_var(TRC_RTDS_RUNQ_PICK, 1, sizeof(d), &d); } return svc; @@ -1055,18 +1050,19 @@ rt_schedule(const struct scheduler *ops, struct sched_unit *currunit, struct rt_unit *snext = NULL; bool migrated = false; - /* TRACE */ + if ( unlikely(tb_init_done) ) { - struct __packed { - unsigned cpu:16, tasklet:8, tickled:4, idle:4; - } d; - d.cpu = cur_cpu; - d.tasklet = tasklet_work_scheduled; - d.tickled = cpumask_test_cpu(sched_cpu, &prv->tickled); - d.idle = is_idle_unit(currunit); - trace_var(TRC_RTDS_SCHEDULE, 1, - sizeof(d), - (unsigned char *)&d); + struct { + uint16_t cpu; + uint8_t tasklet, tickled:4, idle:4; + } d = { + .cpu = cur_cpu, + .tasklet = tasklet_work_scheduled, + .tickled = cpumask_test_cpu(sched_cpu, &prv->tickled), + .idle = is_idle_unit(currunit), + }; + + __trace_var(TRC_RTDS_SCHEDULE, 1, sizeof(d), &d); } /* clear ticked bit now that we've been scheduled */ @@ -1223,16 +1219,15 @@ runq_tickle(const struct scheduler *ops, const struct rt_unit *new) SCHED_STAT_CRANK(tickled_no_cpu); return; out: - /* TRACE */ + if ( unlikely(tb_init_done) ) { struct { - unsigned cpu:16, pad:16; - } d; - d.cpu = cpu_to_tickle; - d.pad = 0; - trace_var(TRC_RTDS_TICKLE, 1, - sizeof(d), - (unsigned char *)&d); + uint16_t cpu, _pad; + } d = { + .cpu = cpu_to_tickle, + }; + + __trace_var(TRC_RTDS_TICKLE, 1, sizeof(d), &d); } cpumask_set_cpu(cpu_to_tickle, &prv->tickled); From patchwork Mon Sep 20 17:25:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E0FFC4332F for ; Mon, 20 Sep 2021 17:26:10 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07ECA632E5 for ; Mon, 20 Sep 2021 17:26:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 07ECA632E5 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191056.340995 (Exim 4.92) (envelope-from ) id 1mSN3L-0007Cq-1H; Mon, 20 Sep 2021 17:26:03 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191056.340995; Mon, 20 Sep 2021 17:26:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN3K-0007Ao-NE; Mon, 20 Sep 2021 17:26:02 +0000 Received: by outflank-mailman (input) for mailman id 191056; Mon, 20 Sep 2021 17:26:00 +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 1mSN3I-0003cq-DE for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:26:00 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c7800014-1a37-11ec-b87a-12813bfff9fa; Mon, 20 Sep 2021 17:25:42 +0000 (UTC) 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: c7800014-1a37-11ec-b87a-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632158742; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=blg5bSVn1FtPA4eRCL98DmLL9LKNBmU4Jtzbra9P1k8=; b=D5uqt+QsDawWW35aCg8jt4mqlc+UIIlq0CvqVejgTOwLVPddQOjUZjkc oV4m9KbCx4J8Qk7WJdtPqGsZLqPfPV3Hek6vm3znzEIm2S2z7L9taUSPI wWqYgXy5tio6pdzmCocF52mlztBiQvh14LjzlXBo7i6WrjISTy2jZWHow c=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: +usJDprPJ7Vo3ZALqmwYSVG+CjURABaRCqpMYhYpw8Y1BL2bHBRRV1/FFKSMBeKjLhz5GNjKP9 02ntmey2s4xsN5Q2UseyFRm+/f46R8Z7iJy5XBiGfGQwB3zXSgyehGxeTgY6SGeBZ+ipWbqJBQ NPQ2qC2dvck5YnvBnCIfr3hVDrS1XGbrDYf03SAy7w8N9DHlGerYcfYPLboY7Wvi7Eo5d7widn +yBj+tYJKKjSPO3tGTu05DP6U9JqUHpHos426uKNHoXiCaAJL8N4qTYUcqwIgpT7IAQk1mkjIq zABYCEpTLQC1uFLLt5sNtKVa X-SBRS: 5.1 X-MesageID: 53560997 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:sdl5R6mWI1Kde09Wk8JvH3To5gx6IURdPkR7XQ2eYbSJt1+Wr1Gzt xJODG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9zbyTo BlQmyZwlTLCuJEwAV/bMiw8MOy/A8kXQLBSFXVEAGtEEkMLOe6HhJrzvbNuFVX+3OA8n/NyU dcffMCMXqZGRjjdomxPZpjhto1yMh+sgFvWbSaiZTE+eb9mRhDIpYC4Lle+qnFWA3rlr9Y6r p2hyhjfHcgJSTN9AZuEc/mo1V6w4yQQwbogQ0vSL9BPU0zw64w2eTfph/o6LphUexXOzzeXz SiMBhIcqbWfqoM56oCR16uFs52oA611GU8DRzvX6rO/NC/7+Gu/wNAfDLbULG6FDG6tofesf +RYyf34IcYrplcSvtouCatvwII/+8Dr++1QwDN7ESiZdF+sEL5hfCWLhJEdqq1Xy7ZFkgKqQ UbTqMJCMLCENc65Ql4cIA0pMraK2f0Ow2SA6P00JAPx5TNt/arBWkJXZkHehCtYJbpzEYUk3 eZ+55JGt13h0kInYoSckyRZ12WQNXhRAawou6YTDJLvlgd2mEpJZobRC3Ou7ZyCAzmW3pLG/ tNAaHL+uolh IronPort-HdrOrdr: A9a23:zzdLT6PsDXUPYcBcTv2jsMiBIKoaSvp037BN7TEUdfU1SL38qy nApoV56faZslcssRIb9+xoWpPwJk80nKQdieN9AV7LZniBhILCFvAB0WKN+V3d8gTFh5dgPf gKScND4afLYmSSJ/yKmDVQaOxN/OW6 X-IronPort-AV: E=Sophos;i="5.85,308,1624334400"; d="scan'208";a="53560997" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Stefano Stabellini , Wei Liu , Julien Grall , Juergen Gross , Dario Faggioli Subject: [PATCH v2 08/12] xen/sched: Clean up trace handling Date: Mon, 20 Sep 2021 18:25:25 +0100 Message-ID: <20210920172529.24932-9-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 There is no need for bitfields anywhere - use more sensible types. There is also no need to cast 'd' to (unsigned char *) before passing it to a function taking void *. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Dario Faggioli --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall CC: Juergen Gross CC: Dario Faggioli v2: * New --- xen/common/sched/core.c | 4 ++-- xen/common/sched/credit.c | 38 ++++++++++++++++++-------------------- xen/common/sched/null.c | 42 +++++++++++++++++++++++++----------------- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 8f4b1ca10d1c..fe133cbf117c 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -205,7 +205,7 @@ static inline struct scheduler *vcpu_scheduler(const struct vcpu *v) static inline void trace_runstate_change(const struct vcpu *v, int new_state) { - struct { uint32_t vcpu:16, domain:16; } d; + struct { uint16_t vcpu, domain; } d; uint32_t event; if ( likely(!tb_init_done) ) @@ -223,7 +223,7 @@ static inline void trace_runstate_change(const struct vcpu *v, int new_state) static inline void trace_continue_running(const struct vcpu *v) { - struct { uint32_t vcpu:16, domain:16; } d; + struct { uint16_t vcpu, domain; } d; if ( likely(!tb_init_done) ) return; diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c index d0aa017c643e..f277fa37a8b1 100644 --- a/xen/common/sched/credit.c +++ b/xen/common/sched/credit.c @@ -1828,21 +1828,18 @@ static void csched_schedule( SCHED_STAT_CRANK(schedule); CSCHED_UNIT_CHECK(unit); - /* - * Here in Credit1 code, we usually just call TRACE_nD() helpers, and - * don't care about packing. But scheduling happens very often, so it - * actually is important that the record is as small as possible. - */ if ( unlikely(tb_init_done) ) { struct { - unsigned cpu:16, tasklet:8, idle:8; - } d; - d.cpu = cur_cpu; - d.tasklet = tasklet_work_scheduled; - d.idle = is_idle_unit(unit); - __trace_var(TRC_CSCHED_SCHEDULE, 1, sizeof(d), - (unsigned char *)&d); + uint16_t cpu; + uint8_t tasklet, idle; + } d = { + .cpu = cur_cpu, + .tasklet = tasklet_work_scheduled, + .idle = is_idle_unit(unit), + }; + + __trace_var(TRC_CSCHED_SCHEDULE, 1, sizeof(d), &d); } runtime = now - unit->state_entry_time; @@ -1904,14 +1901,15 @@ static void csched_schedule( if ( unlikely(tb_init_done) ) { struct { - unsigned unit:16, dom:16; - unsigned runtime; - } d; - d.dom = unit->domain->domain_id; - d.unit = unit->unit_id; - d.runtime = runtime; - __trace_var(TRC_CSCHED_RATELIMIT, 1, sizeof(d), - (unsigned char *)&d); + uint16_t unit, dom; + uint32_t runtime; + } d = { + .dom = unit->domain->domain_id, + .unit = unit->unit_id, + .runtime = runtime, + }; + + __trace_var(TRC_CSCHED_RATELIMIT, 1, sizeof(d), &d); } goto out; diff --git a/xen/common/sched/null.c b/xen/common/sched/null.c index 82d5d1baab85..deb59747fbe8 100644 --- a/xen/common/sched/null.c +++ b/xen/common/sched/null.c @@ -329,10 +329,12 @@ pick_res(const struct null_private *prv, const struct sched_unit *unit) struct { uint16_t unit, dom; uint32_t new_cpu; - } d; - d.dom = unit->domain->domain_id; - d.unit = unit->unit_id; - d.new_cpu = new_cpu; + } d = { + .unit = unit->unit_id, + .dom = unit->domain->domain_id, + .new_cpu = new_cpu, + }; + __trace_var(TRC_SNULL_PICKED_CPU, 1, sizeof(d), &d); } @@ -357,10 +359,12 @@ static void unit_assign(struct null_private *prv, struct sched_unit *unit, struct { uint16_t unit, dom; uint32_t cpu; - } d; - d.dom = unit->domain->domain_id; - d.unit = unit->unit_id; - d.cpu = cpu; + } d = { + .unit = unit->unit_id, + .dom = unit->domain->domain_id, + .cpu = cpu, + }; + __trace_var(TRC_SNULL_UNIT_ASSIGN, 1, sizeof(d), &d); } } @@ -388,10 +392,12 @@ static bool unit_deassign(struct null_private *prv, const struct sched_unit *uni struct { uint16_t unit, dom; uint32_t cpu; - } d; - d.dom = unit->domain->domain_id; - d.unit = unit->unit_id; - d.cpu = cpu; + } d = { + .unit = unit->unit_id, + .dom = unit->domain->domain_id, + .cpu = cpu, + }; + __trace_var(TRC_SNULL_UNIT_DEASSIGN, 1, sizeof(d), &d); } @@ -691,11 +697,13 @@ static void null_unit_migrate(const struct scheduler *ops, struct { uint16_t unit, dom; uint16_t cpu, new_cpu; - } d; - d.dom = unit->domain->domain_id; - d.unit = unit->unit_id; - d.cpu = sched_unit_master(unit); - d.new_cpu = new_cpu; + } d = { + .unit = unit->unit_id, + .dom = unit->domain->domain_id, + .cpu = sched_unit_master(unit), + .new_cpu = new_cpu, + }; + __trace_var(TRC_SNULL_MIGRATE, 1, sizeof(d), &d); } From patchwork Mon Sep 20 17:25:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506015 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE508C433FE for ; Mon, 20 Sep 2021 17:26:00 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8BE1D632DA for ; Mon, 20 Sep 2021 17:26:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8BE1D632DA Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191051.340946 (Exim 4.92) (envelope-from ) id 1mSN39-00051d-RE; Mon, 20 Sep 2021 17:25:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191051.340946; Mon, 20 Sep 2021 17:25:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSN39-0004zs-Ly; Mon, 20 Sep 2021 17:25:51 +0000 Received: by outflank-mailman (input) for mailman id 191051; Mon, 20 Sep 2021 17:25:50 +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 1mSN38-0003cq-Cg for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:25:50 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c5e97c3b-1a37-11ec-b87a-12813bfff9fa; Mon, 20 Sep 2021 17:25:40 +0000 (UTC) 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: c5e97c3b-1a37-11ec-b87a-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632158740; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=op3mN7Ssn2+qHvMncFrr9eY7JKq/qdFKvePUbUZAdVE=; b=RcVOOoaze2uwR7P9cXIuOh6dtW2+TpF9fVjIuYhA13ckgTV3TFdk/sUY LEXbWRfFhiKkFy+RQMRQpBZBVp0g0urKzrvln7NnKC0Mz68L8w3XmVnIV AN5yiovRy7qCvhwf0Z7lCZxWwIV/mPGfxhxgVNSTkqJDrAlEvl4iCmi2/ w=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: eDVWBXpWkoIOoo1AZVM4liBpfZcmugDKNRYzyrxPPYjrE3mqsirArDaUXgCfQrbvgBVttQ+g0L cfkXCAwNbQllMw4iSPZrM2oKdbiBYaZhueWW5XOqphEN3V0+YbuWu6f5ZdO5ymNNC17D4L8WIe gwJWeHXsDR6DdWnMJJmXekeID0oLhgdmFtHTEH5AcbADiI6w0AdqMLkOTcLs5Jr+kYJo8h56jM y6DLYBwuuPnM4SpxTq6x+ufRoWFdcE27uXuhSf1r08j475mY/knmRA1WrDJVWtq+g5L1IohsmV ThmAn1z6meN8JTqlTq0hP1wv X-SBRS: 5.1 X-MesageID: 54938585 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:VbwWZqwB1MSix56KN1h6t+ffwSrEfRIJ4+MujC+fZmUNrF6WrkVTy zEbWW/XMq2MNjGheNF2btzkpkJTvZDcztZiTAFprSAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnvopW1TYhSEUOZugH9IQM8aZfHAsLeNYYH1500s7yrRh2tQAbeWRWGthh /uj+6UzB3f9s9JEGjp8B3Wr8U4HUFza4Vv0j3RmDRx5lAa2e0o9VfrzEZqZPXrgKrS4K8bhL wr1IBNVyUuCl/slIovNfr8W6STmSJaKVeSFoiI+t6RPHnGuD8H9u0o2HKN0VKtZt9mGt/Zx2 MQchZjpcyI0PvD1u/g/CTlCDggraMWq+JefSZS+mcmazkmAeHrw2fR+SkoxOOX0+M4uXzsIr 6ZBbmlQMFbT3Ipaw5riIgVoru0lINPmI8U0vXZ4wCuCJf0nXYrCU+PB4towMDIY25wfRqaDN 5dxhTxHXBvtXC1CZHMrUtEYpcio2nPRfiVHpwfAzUYwyzeKl1EguFT3C/LXZ9iLSMN9jkue4 GXc8AzRIDsXKdiewjqt6W+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rdr: A9a23:fepU9qq6Y6YRGtz1OIBx+ngaV5opeYIsimQD101hICG8cqSj+f xG/c5rrCMc5wxwZJhNo7y90ey7MBbhHP1OkO8s1NWZLWrbUQKTRekIh+bfKn/baknDH4ZmpM BdmsNFaeEYY2IUsS+D2njbL+od X-IronPort-AV: E=Sophos;i="5.85,308,1624334400"; d="scan'208";a="54938585" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Stefano Stabellini , Wei Liu , Julien Grall , Dario Faggioli Subject: [PATCH v2 09/12] xen/trace: Minor code cleanup Date: Mon, 20 Sep 2021 18:25:26 +0100 Message-ID: <20210920172529.24932-10-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 * Delete trailing whitespace * Replace an opencoded DIV_ROUND_UP() * Drop bogus smp_rmb() - spin_lock_irqsave() has full smp_mb() semantics. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Dario Faggioli --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall CC: Dario Faggioli --- xen/common/trace.c | 37 +++++++++++++++---------------------- xen/include/asm-x86/hvm/trace.h | 2 +- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/xen/common/trace.c b/xen/common/trace.c index 4297ff505fb9..41a3c170446b 100644 --- a/xen/common/trace.c +++ b/xen/common/trace.c @@ -75,10 +75,6 @@ static cpumask_t tb_cpu_mask; /* which tracing events are enabled */ static u32 tb_event_mask = TRC_ALL; -/* Return the number of elements _type necessary to store at least _x bytes of data - * i.e., sizeof(_type) * ans >= _x. */ -#define fit_to_type(_type, _x) (((_x)+sizeof(_type)-1) / sizeof(_type)) - static int cpu_callback( struct notifier_block *nfb, unsigned long action, void *hcpu) { @@ -96,8 +92,8 @@ static struct notifier_block cpu_nfb = { static uint32_t calc_tinfo_first_offset(void) { - int offset_in_bytes = offsetof(struct t_info, mfn_offset[NR_CPUS]); - return fit_to_type(uint32_t, offset_in_bytes); + return DIV_ROUND_UP(offsetof(struct t_info, mfn_offset[NR_CPUS]), + sizeof(uint32_t)); } /** @@ -148,7 +144,7 @@ static int calculate_tbuf_size(unsigned int pages, uint16_t t_info_first_offset) pages = max_pages; } - /* + /* * NB this calculation is correct, because t_info_first_offset is * in words, not bytes */ @@ -167,7 +163,7 @@ static int calculate_tbuf_size(unsigned int pages, uint16_t t_info_first_offset) * trace buffers. The trace buffers are then available for debugging use, via * the %TRACE_xD macros exported in . * - * This function may also be called later when enabling trace buffers + * This function may also be called later when enabling trace buffers * via the SET_SIZE hypercall. */ static int alloc_trace_bufs(unsigned int pages) @@ -401,7 +397,7 @@ int tb_control(struct xen_sysctl_tbuf_op *tbc) break; case XEN_SYSCTL_TBUFOP_enable: /* Enable trace buffers. Check buffers are already allocated. */ - if ( opt_tbuf_size == 0 ) + if ( opt_tbuf_size == 0 ) rc = -EINVAL; else tb_init_done = 1; @@ -438,7 +434,7 @@ int tb_control(struct xen_sysctl_tbuf_op *tbc) return rc; } -static inline unsigned int calc_rec_size(bool_t cycles, unsigned int extra) +static inline unsigned int calc_rec_size(bool_t cycles, unsigned int extra) { unsigned int rec_size = 4; @@ -597,7 +593,7 @@ static inline void __insert_record(struct t_buf *buf, rec->u.cycles.cycles_lo = (uint32_t)tsc; rec->u.cycles.cycles_hi = (uint32_t)(tsc >> 32); dst = rec->u.cycles.extra_u32; - } + } if ( extra_data && extra ) memcpy(dst, extra_data, extra); @@ -717,9 +713,6 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra, if ( !cpumask_test_cpu(smp_processor_id(), &tb_cpu_mask) ) return; - /* Read tb_init_done /before/ t_bufs. */ - smp_rmb(); - spin_lock_irqsave(&this_cpu(t_lock), flags); buf = this_cpu(t_bufs); @@ -735,14 +728,14 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra, /* Calculate the record size */ rec_size = calc_rec_size(cycles, extra); - + /* How many bytes are available in the buffer? */ bytes_to_tail = calc_bytes_avail(buf); - + /* How many bytes until the next wrap-around? */ bytes_to_wrap = calc_bytes_to_wrap(buf); - - /* + + /* * Calculate expected total size to commit this record by * doing a dry-run. */ @@ -756,7 +749,7 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra, { total_size += bytes_to_wrap; bytes_to_wrap = data_size; - } + } total_size += LOST_REC_SIZE; bytes_to_wrap -= LOST_REC_SIZE; @@ -768,7 +761,7 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra, if ( rec_size > bytes_to_wrap ) { total_size += bytes_to_wrap; - } + } total_size += rec_size; /* Do we have enough space for everything? */ @@ -781,7 +774,7 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra, } /* - * Now, actually write information + * Now, actually write information */ bytes_to_wrap = calc_bytes_to_wrap(buf); @@ -791,7 +784,7 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra, { insert_wrap_record(buf, LOST_REC_SIZE); bytes_to_wrap = data_size; - } + } insert_lost_records(buf); bytes_to_wrap -= LOST_REC_SIZE; diff --git a/xen/include/asm-x86/hvm/trace.h b/xen/include/asm-x86/hvm/trace.h index 145b59f6ac65..696e42eb9499 100644 --- a/xen/include/asm-x86/hvm/trace.h +++ b/xen/include/asm-x86/hvm/trace.h @@ -52,7 +52,7 @@ #define DO_TRC_HVM_CLTS DEFAULT_HVM_MISC #define DO_TRC_HVM_LMSW DEFAULT_HVM_MISC #define DO_TRC_HVM_LMSW64 DEFAULT_HVM_MISC -#define DO_TRC_HVM_REALMODE_EMULATE DEFAULT_HVM_MISC +#define DO_TRC_HVM_REALMODE_EMULATE DEFAULT_HVM_MISC #define DO_TRC_HVM_TRAP DEFAULT_HVM_MISC #define DO_TRC_HVM_TRAP_DEBUG DEFAULT_HVM_MISC #define DO_TRC_HVM_VLAPIC DEFAULT_HVM_MISC From patchwork Mon Sep 20 17:25:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6D29C433F5 for ; Mon, 20 Sep 2021 17:34:52 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5F7246337B for ; Mon, 20 Sep 2021 17:34:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5F7246337B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191092.341006 (Exim 4.92) (envelope-from ) id 1mSNBg-0002PC-6j; Mon, 20 Sep 2021 17:34:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191092.341006; Mon, 20 Sep 2021 17:34:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSNBg-0002P5-3k; Mon, 20 Sep 2021 17:34:40 +0000 Received: by outflank-mailman (input) for mailman id 191092; Mon, 20 Sep 2021 17:34:38 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSNBe-0002Oz-Sr for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:34:38 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3aa76012-671c-46b2-b7a2-2af9ef69522c; Mon, 20 Sep 2021 17:34:36 +0000 (UTC) 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: 3aa76012-671c-46b2-b7a2-2af9ef69522c DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632159276; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bEpl8O1bP+VDWCJVrreYPoTbBZNOjPBNBltwePd93CU=; b=KF5GMFAE6TRaE/3VSJfM+NcTNBHSQ94Xl6twuYgkrqIxIhECxhURbpHQ otn6N/He5dOJZ4qPy0Fz4Mo0767et1gbX/6KdQUMfspkt7fnPS5mrRRDW 9pSHuKmcAujEgFttZvpi1ms13ggBlKywOskFaQ32zdYh0omwIvOvXpn80 w=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: jgyIU6088m3DDnn0RqsxcHn+/fcrkyd6geGy4fk9c2sF5hI+Xad3Tn7YU41JSyyJaW5ck7Gd+g w5TGS1/+aZZ0ZzEuft50O1FXgLn4AQt0+7Cl5dyyPakWc+5749KEIgg462kis+2bqP0PsPDpvi z32BucEwxDuVqS8msx2P/9A5/weFq770xh52KUNknDB44QyjQ1xW0dP68RQU2mBQaOV099mRax STU++DjoGaMe6l0VqO+gvsgMlf+XfKut3VaZBrJ2/ic40tEwhZSitfoMXWMGP9S0OiAh3z+rd0 EJZSVcw4pA3wMh9pkHZNNpVO X-SBRS: 5.1 X-MesageID: 53136338 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:LIKyZ6r0JKXuBZcPfpBy+qXNNPBeBmIAYhIvgKrLsJaIsI4StFCzt garIBnUOa2INGWkctF1boXno00EucXWm982SQM5pCkxHypB8ZuZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlZT4vE2xbuKU5NTsY0idfic5Dnd84f5fs7Rh2Ncw0ILhW1nlV e7a+KUzBnf0g1aYDUpMg06zgEsHUCPa4W5wUvQWPJinjXeG/5UnJMt3yZKZdhMUdrJ8DO+iL 9sv+Znilo/vE7XBPfv++lrzWhVirrc/pmFigFIOM0SpqkAqSiDfTs/XnRfTAKtao2zhojx/9 DlCnb+gVlk7YI2WpMU2VQIfIShSG71MyIaSdBBTseTLp6HHW37lwvEoB0AqJ4wIvO1wBAmi9 9RBdmpLNErawbvrnvTrEYGAhex6RCXvFKoZtmtt0nfyCvE+TIqYa67L+cVZzHE7gcUm8fP2O pFAMmQ0N0SojxtnIFYUBs0TgemSoXS8KTJRiG3IofcV7D2GpOB2+Oe0a4eEEjCQfu1Kmm6Iq 2SA+H72ajk4HtGCzTuO8lq3m/TC2yj8Xeo6BLC+s/JnnlCX7mgSEwENE0u2p+GjjUyzUM4ZL FYbkhfCtoBrqhbtFIOkGUTl/jjU5XbwRua8DcUZ+B7T2PT0uTq4LW4fCQxIRPo2vv8PEGlCO kCyoz/5OdB+mOTLEivNrebF9Wna1Ts9djBZNHRdJecRy5y6+thi0EiXJjp2OPPt1rXI9SfML ydmRcTUr44ai9ICn46/9ErO695HjsmUFlNpjuk7s2TM0++YWGJHT9fzgbQ4xawZRGp8crVml CJf8/VyFMhUUfmweNWlGY3h5o1FAspp1xWH2zZS82QJrWzxqxZPg6gJuGwWyLhV3jYsJmayP R67VfJ5z55PJnq6BZKbkKroUJ9C8EQULvy8Dqq8RoMXOvBZLVbblAkzNR/49z28yyAEzPBgU ap3hO7xVB72/4w8l2HoLwrcuJd2rh0DKZT7H8Gjk0v/jurAOxZ4i94taTOzUwzw14vcyC29z jqVH5LiJ8x3XLKsby/J35QUKFxWf3E3CYqv855cd/KZIxogE2YkUqeDzbQkco1jvqJUiuaXo S3tBh4GkALy1S/dNAGHSnF/c7ezD5xxmm02YH43NlGy1nl9PYv2tPUDd4E6dKUM/fB4yaImV OEMfsiNW6wdSjnO9zkHQ4P6qYhuKEaiiQ6UZnL3azkjZZ9wAQfO/4a8LAfo8SAPCAuxtNc// OL8hl+KH8JbSl07XsjMaf+pw1eghlQnmbp/DxnSP91eWETw64w2eSb/ueA6fpMXIhLZyzrEi wvPWUUEpfPAqpMe+cXSgfzWtJ+gFuZzExYIH2Tf6rrqZyDW8nD6nN1FWeeMOzvcSHn16OOpY uAMl6PwN/gOnVBrtYtgEuk0kfJitoW3/7IKnB55GHjrbkiwDuIyK3aL6sBDq6lRy+ILogCxQ E+OpoFXNLjh1BkJy7LNyN7Jtti+6Mw= IronPort-HdrOrdr: A9a23:9esM3KBYDB6bG3XlHemU55DYdb4zR+YMi2TC1yhKJyC9Ffbo7v xG/c5rsyMc5wxwZJhNo7y90ey7MBbhHP1OkO4s1NWZLWrbUQKTRekIh+bfKn/baknDH4ZmpN 9dmsNFaeEYY2IUsS+D2njbL+od X-IronPort-AV: E=Sophos;i="5.85,308,1624334400"; d="scan'208";a="53136338" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH v2 10/12] x86/pv: Move x86/trace.c to x86/pv/trace.c Date: Mon, 20 Sep 2021 18:25:27 +0100 Message-ID: <20210920172529.24932-11-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 This entire file is pv-only, and not excluded from the build by CONFIG_TRACEBUFFER. Move it into the pv/ directory, build it conditionally, and drop unused includes. Also move the contents of asm/trace.h to asm/pv/trace.h to avoid the functions being declared across the entire hypervisor. One caller in fixup_page_fault() is effectively PV only, but is not subject to dead code elimination. Add an additional IS_ENABLED(CONFIG_PV) to keep the build happy. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu v2: * New --- xen/arch/x86/Makefile | 1 - xen/arch/x86/pv/Makefile | 1 + xen/arch/x86/pv/emul-inv-op.c | 2 +- xen/arch/x86/pv/emul-priv-op.c | 1 + xen/arch/x86/pv/ro-page-fault.c | 2 +- xen/arch/x86/{ => pv}/trace.c | 13 +++++------ xen/arch/x86/pv/traps.c | 2 +- xen/arch/x86/traps.c | 3 ++- xen/include/asm-x86/{ => pv}/trace.h | 8 ++++--- xen/include/asm-x86/trace.h | 42 ------------------------------------ 10 files changed, 17 insertions(+), 58 deletions(-) rename xen/arch/x86/{ => pv}/trace.c (95%) copy xen/include/asm-x86/{ => pv}/trace.h (92%) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 202d4d27823d..82dd4e18bd36 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -61,7 +61,6 @@ obj-y += spec_ctrl.o obj-y += srat.o obj-y += string.o obj-y += time.o -obj-y += trace.o obj-y += traps.o obj-y += tsx.o obj-y += usercopy.o diff --git a/xen/arch/x86/pv/Makefile b/xen/arch/x86/pv/Makefile index 75b01b0062d8..6cda354cc41f 100644 --- a/xen/arch/x86/pv/Makefile +++ b/xen/arch/x86/pv/Makefile @@ -12,6 +12,7 @@ obj-y += misc-hypercalls.o obj-y += mm.o obj-y += ro-page-fault.o obj-$(CONFIG_PV_SHIM) += shim.o +obj-$(CONFIG_TRACEBUFFER) += trace.o obj-y += traps.o obj-bin-y += dom0_build.init.o diff --git a/xen/arch/x86/pv/emul-inv-op.c b/xen/arch/x86/pv/emul-inv-op.c index b15f302bcaad..2c07eed9a092 100644 --- a/xen/arch/x86/pv/emul-inv-op.c +++ b/xen/arch/x86/pv/emul-inv-op.c @@ -19,7 +19,7 @@ * along with this program; If not, see . */ -#include +#include #include "emulate.h" diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index 11467a1e3a90..d0df5bc616c0 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c index 335aa8dc5dc0..ac5b66870c8c 100644 --- a/xen/arch/x86/pv/ro-page-fault.c +++ b/xen/arch/x86/pv/ro-page-fault.c @@ -20,7 +20,7 @@ * along with this program; If not, see . */ -#include +#include #include #include "emulate.h" diff --git a/xen/arch/x86/trace.c b/xen/arch/x86/pv/trace.c similarity index 95% rename from xen/arch/x86/trace.c rename to xen/arch/x86/pv/trace.c index 4a953c5b2f1e..550c22765bae 100644 --- a/xen/arch/x86/trace.c +++ b/xen/arch/x86/pv/trace.c @@ -1,9 +1,6 @@ -#include -#include -#include -#include #include -#include + +#include void __trace_pv_trap(int trapnr, unsigned long eip, int use_error_code, unsigned error_code) @@ -21,7 +18,7 @@ void __trace_pv_trap(int trapnr, unsigned long eip, d.trapnr = trapnr; d.error_code = error_code; d.use_error_code=!!use_error_code; - + __trace_var(TRC_PV_TRAP, 1, sizeof(d), &d); } else @@ -38,7 +35,7 @@ void __trace_pv_trap(int trapnr, unsigned long eip, d.trapnr = trapnr; d.error_code = error_code; d.use_error_code=!!use_error_code; - + event = TRC_PV_TRAP; event |= TRC_64_FLAG; __trace_var(event, 1, sizeof(d), &d); @@ -58,7 +55,7 @@ void __trace_pv_page_fault(unsigned long addr, unsigned error_code) d.eip = eip; d.addr = addr; d.error_code = error_code; - + __trace_var(TRC_PV_PAGE_FAULT, 1, sizeof(d), &d); } else diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c index 7439b76df88d..764773c02104 100644 --- a/xen/arch/x86/pv/traps.c +++ b/xen/arch/x86/pv/traps.c @@ -22,10 +22,10 @@ #include #include #include -#include #include #include +#include #include #include #include diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 4a0e498b4c21..0cc1ee95cb5b 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -82,6 +82,7 @@ #include #include #include +#include #include /* @@ -1480,7 +1481,7 @@ static int fixup_page_fault(unsigned long addr, struct cpu_user_regs *regs) { int ret = paging_fault(addr, regs); - if ( ret == EXCRET_fault_fixed ) + if ( IS_ENABLED(CONFIG_PV) && ret == EXCRET_fault_fixed ) trace_trap_two_addr(TRC_PV_PAGING_FIXUP, regs->rip, addr); return ret; } diff --git a/xen/include/asm-x86/trace.h b/xen/include/asm-x86/pv/trace.h similarity index 92% copy from xen/include/asm-x86/trace.h copy to xen/include/asm-x86/pv/trace.h index e65b5de6eec4..c616206eeb15 100644 --- a/xen/include/asm-x86/trace.h +++ b/xen/include/asm-x86/pv/trace.h @@ -1,5 +1,7 @@ -#ifndef __ASM_TRACE_H__ -#define __ASM_TRACE_H__ +#ifndef XEN_X86_PV_TRACE_H +#define XEN_X86_PV_TRACE_H + +#include #include @@ -43,4 +45,4 @@ static inline void trace_ptwr_emulation(unsigned long addr, l1_pgentry_t npte) __trace_ptwr_emulation(addr, npte); } -#endif /* __ASM_TRACE_H__ */ +#endif /* XEN_X86_PV_TRACE_H */ diff --git a/xen/include/asm-x86/trace.h b/xen/include/asm-x86/trace.h index e65b5de6eec4..edef1bb099d4 100644 --- a/xen/include/asm-x86/trace.h +++ b/xen/include/asm-x86/trace.h @@ -1,46 +1,4 @@ #ifndef __ASM_TRACE_H__ #define __ASM_TRACE_H__ -#include - -void __trace_pv_trap(int trapnr, unsigned long eip, - int use_error_code, unsigned error_code); -static inline void trace_pv_trap(int trapnr, unsigned long eip, - int use_error_code, unsigned error_code) -{ - if ( unlikely(tb_init_done) ) - __trace_pv_trap(trapnr, eip, use_error_code, error_code); -} - -void __trace_pv_page_fault(unsigned long addr, unsigned error_code); -static inline void trace_pv_page_fault(unsigned long addr, - unsigned error_code) -{ - if ( unlikely(tb_init_done) ) - __trace_pv_page_fault(addr, error_code); -} - -void __trace_trap_one_addr(unsigned event, unsigned long va); -static inline void trace_trap_one_addr(unsigned event, unsigned long va) -{ - if ( unlikely(tb_init_done) ) - __trace_trap_one_addr(event, va); -} - -void __trace_trap_two_addr(unsigned event, unsigned long va1, - unsigned long va2); -static inline void trace_trap_two_addr(unsigned event, unsigned long va1, - unsigned long va2) -{ - if ( unlikely(tb_init_done) ) - __trace_trap_two_addr(event, va1, va2); -} - -void __trace_ptwr_emulation(unsigned long addr, l1_pgentry_t npte); -static inline void trace_ptwr_emulation(unsigned long addr, l1_pgentry_t npte) -{ - if ( unlikely(tb_init_done) ) - __trace_ptwr_emulation(addr, npte); -} - #endif /* __ASM_TRACE_H__ */ From patchwork Mon Sep 20 17:25:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 682A4C433FE for ; Mon, 20 Sep 2021 17:35:05 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1278863395 for ; Mon, 20 Sep 2021 17:35:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1278863395 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191094.341019 (Exim 4.92) (envelope-from ) id 1mSNBx-0002rP-Ic; Mon, 20 Sep 2021 17:34:57 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191094.341019; Mon, 20 Sep 2021 17:34:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSNBx-0002rI-DB; Mon, 20 Sep 2021 17:34:57 +0000 Received: by outflank-mailman (input) for mailman id 191094; Mon, 20 Sep 2021 17:34:56 +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 1mSNBw-0002pz-QL for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:34:56 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 119f6c42-1a39-11ec-b87a-12813bfff9fa; Mon, 20 Sep 2021 17:34:55 +0000 (UTC) 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: 119f6c42-1a39-11ec-b87a-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632159295; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l7ek/uy2/EYPLwKguMBv7A4G/dnRwY7hjtQmVQ7Fv4Y=; b=g3abrO1VCA0jyGONhkJuYTz0CEzQ7pBuyhlyovV/ojfTpFior+6xeXas C/I0WgU/3pc38d1WwHUAlRDfkbvQcD2cv0rgoKDABX3MbV7kspijRE3ew pWsahSIftfP7/JneJ6GJw83icRr0oAxPXtW4vIk8Ko3i1dh0U/HctB+Wg 4=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: uox8gRHU445v+MNpqPTbMwaBLEBftuG4qoxsBtQ7m5ew+SILQgpY2ghUvWiMG7wokWS+PXHCM7 d3BfdUpu9K+l/BTASTYcnfpKo8Z8yH/Mg3cCdhpPF3fnBsuSO7iS7xvhh2FWBnC9itLOWfwhiT CUMA0F4S00m773kfjEtB8g7IyHNth73ZcNlxjzOZ92+q3nycrzUFE6Zk7B1opy5OSnSE0M4oGp Zj5f1GcS5mirop/W93XDln7PlxzDWqY6HCKdcJPtNfANc85r6V3yIWHYTMgqo+fAeliwvOt4jK 92eY2c6ZmKOhrq06HbwZf4EP X-SBRS: 5.1 X-MesageID: 52741883 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:JN8Eial0pzg3B9CRD2GFXQ3o5gxmIURdPkR7XQ2eYbSJt1+Wr1Gzt xJNUD+Fbq7eYjCnKo9zYIm08x8GvMTSzdJhGgA++SFnEyMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BClVlxJVF/fngqoDUUYYoAQgsA185IMsdoUg7wbdh09Qw2YPR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtN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2LCh QqRBB4Zo8jLopM0r4aV1fzV8d/xHrInTERAHmTd4bKnDgXg/zKukd1aTeKFXTHBT2eoqq+sU vpYkqPnO/odkVcU74clS+R3zbgz7sfErqNBylg2B23CalmmB+8yInSC2sUT5KRByqUA5FmzU 0OLvNJbJa+IKIXuF1tIfFgpaeGK1Pc1nDjO7KtqfBWmtXEvpLfXA19POxSsiTBGKOonOYwo9 u4tpcoK5lHtkREtKNuH0nhZ+mnkwqbsiEn7WkX22LPWtzc= IronPort-HdrOrdr: A9a23:+Onija+OkwhFDIOs/Jluk+DgI+orL9Y04lQ7vn2YSXRuHPBw8P re5cjztCWE7gr5N0tBpTntAsW9qDbnhPtICOoqTNCftWvdyQiVxehZhOOIqVDd8m/Fh4pgPM 9bAtBD4bbLbGSS4/yU3ODBKadD/OW6 X-IronPort-AV: E=Sophos;i="5.85,309,1624334400"; d="scan'208";a="52741883" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH v2 11/12] xen/arch: Drop asm-*/trace.h Date: Mon, 20 Sep 2021 18:25:28 +0100 Message-ID: <20210920172529.24932-12-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 The feature is x86 and pv-dom0 specific, and each architecture's main trace.h files are empty. Don't force all new architectures to create an empty file. While moving the declaration of tb_init_done, change from int to bool. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Acked-by: Julien Grall --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk v2: * New --- xen/common/trace.c | 2 +- xen/include/asm-arm/trace.h | 12 ------------ xen/include/asm-x86/trace.h | 4 ---- xen/include/xen/trace.h | 13 +++++-------- 4 files changed, 6 insertions(+), 25 deletions(-) delete mode 100644 xen/include/asm-arm/trace.h delete mode 100644 xen/include/asm-x86/trace.h diff --git a/xen/common/trace.c b/xen/common/trace.c index 41a3c170446b..a5dc468296d6 100644 --- a/xen/common/trace.c +++ b/xen/common/trace.c @@ -67,7 +67,7 @@ static DEFINE_PER_CPU(unsigned long, lost_records_first_tsc); /* a flag recording whether initialization has been done */ /* or more properly, if the tbuf subsystem is enabled right now */ -int tb_init_done __read_mostly; +bool __read_mostly tb_init_done; /* which CPUs tracing is enabled on */ static cpumask_t tb_cpu_mask; diff --git a/xen/include/asm-arm/trace.h b/xen/include/asm-arm/trace.h deleted file mode 100644 index e06def61f6f3..000000000000 --- a/xen/include/asm-arm/trace.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __ASM_TRACE_H__ -#define __ASM_TRACE_H__ - -#endif /* __ASM_TRACE_H__ */ -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/include/asm-x86/trace.h b/xen/include/asm-x86/trace.h deleted file mode 100644 index edef1bb099d4..000000000000 --- a/xen/include/asm-x86/trace.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef __ASM_TRACE_H__ -#define __ASM_TRACE_H__ - -#endif /* __ASM_TRACE_H__ */ diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h index 3cbb542af888..055883287e8c 100644 --- a/xen/include/xen/trace.h +++ b/xen/include/xen/trace.h @@ -21,19 +21,14 @@ #ifndef __XEN_TRACE_H__ #define __XEN_TRACE_H__ -/* Put 'tb_init_done' here because 'asm/trace.h' may use it */ -#ifdef CONFIG_TRACEBUFFER -extern int tb_init_done; -#else -#define tb_init_done false -#endif - #include #include #include -#include #ifdef CONFIG_TRACEBUFFER + +extern bool tb_init_done; + /* Used to initialise trace buffer functionality */ void init_trace_bufs(void); @@ -58,6 +53,8 @@ void __trace_hypercall(uint32_t event, unsigned long op, #include +#define tb_init_done false + static inline void init_trace_bufs(void) {} static inline int tb_control(struct xen_sysctl_tbuf_op *tbc) { From patchwork Mon Sep 20 17:25:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDDE2C433EF for ; Mon, 20 Sep 2021 17:35:10 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7912E61B08 for ; Mon, 20 Sep 2021 17:35:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7912E61B08 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191095.341029 (Exim 4.92) (envelope-from ) id 1mSNC2-0003CF-R7; Mon, 20 Sep 2021 17:35:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191095.341029; Mon, 20 Sep 2021 17:35:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSNC2-0003C8-ME; Mon, 20 Sep 2021 17:35:02 +0000 Received: by outflank-mailman (input) for mailman id 191095; Mon, 20 Sep 2021 17:35:01 +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 1mSNC1-0002pz-NW for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 17:35:01 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 119f6c43-1a39-11ec-b87a-12813bfff9fa; Mon, 20 Sep 2021 17:34:56 +0000 (UTC) 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: 119f6c43-1a39-11ec-b87a-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632159296; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GcABwI8oWHgu530a+/KgqxWauKwNAPSdO5EboEi94Ao=; b=Yg74MBquc/o5k5Q+yVrZvcVvjRK6IaWTq3GXWJg/cxo700e/cQfaB535 qRKIzxVl1FmHmj4j7l+zh5Xz4mEubpEHGRaVggUNvsn53PBBSl4vor6yq unpP3XxHiS5qmtJXwUhJCvatk5daTcQ4bJkRxGjhxcjhiO/JNjG5v3ljb c=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: P7famdpIYSd9Iat7FzhqXhX4HUaZbz0EeCQRaQ6rqyFmwr5Za3YaAPyV85GzKrtJQ9tu5bJl42 RWVeXfrsmVfZfnTu7+4KmVQ2weBwttctvKGxwvm8JsPlsch+c4pgYAi4Kfj46ORWsLxZT2SWXG 0XP/YPlEZ+z0Sh/xibisxBH9+J9OS2VSH93KzVr/acBK4a4l6A84U1zZJmLO8lxvCw8aExVx3C xI0WocMQ1MB1IhLy/QX/L0zYgZgNJ83cB/CziO4B4k1sDumXMDRtXm4qL8BpP5aZLB9Viore6k Wkzi1RxUY9KpossjblwH6mP/ X-SBRS: 5.1 X-MesageID: 52741880 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:/bhr6KxIECZE6TC6NVJ6t+cvwSrEfRIJ4+MujC+fZmUNrF6WrkUHz GVJX22BPfqJZWChedgna47noBwD7J6Gn9NrHgo+rCAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnvopW1TYhSEUOZugH9IQM8aZfHAsLeNYYH1500s7yrRh2tUAbeWRWGthh /uj+6UzB3f9s9JEGjp8B3Wr8U4HUFza4Vv0j3RmDRx5lAa2e0o9VfrzEZqZPXrgKrS4K8bhL wr1IBNVyUuCl/slIovNfr8W6STmSJaKVeSFoiI+t6RPHnGuD8H9u0o2HKN0VKtZt9mGt4tr5 8sWsKOgdSd3Br/JmuI6QgRpTRgraMWq+JefSZS+mcmazkmAeHrw2fR+SkoxOOX0+M4uXzsIr 6ZBbmlQMFbT3Ipaw5riIgVoru0lINPmI8U0vXZ4wCuCJf0nXYrCU+PB4towMDIY25oRQa+ON 5JxhTxHZwXcaRsRHnAtVYNjxtmUtmDVI21RkQfAzUYwyzeKl1EguFT3C/LKfvSaSMMTmVyXz krk1WnkBhARNPSE1CGItHmrg4fnjS79HY4fCrC83vprm0GIgHweDgUMUlm2quX/jVSxM++zM GRNpHBo9/JrshX2EJ+tBHVUvUJooDZHQfVOSOgF+D2tlJLG5gSfIXkZf2B4PYlOWNANedA66 rOYt4q3XmU/6+zEESj1GqS89mzpaHNMRYMWTWpdF1JUvYO7yG0mpk+XFr5e/LiJYsoZ8N0a6 wuDqjQ3z54XhNQCv0lQ1QGa22/wznQlowhc2+k2Yo5HxlgiDGJGT9bxgbQ+0RqnBNzCJmRtR FBex6CjABkmVPlhbhBhpdnh+5nyvZ643MD02wYzT/HNCRz0oyPLkX9sDMFWex4yb5dslc7BS 07PowJBjKK/z1PzNvQfXm5FMOxzlfKIPY28Dpj8N4MSCrAsJF7v1Hw/Pia4gjGy+HXAZIliY P93h+73Vi1EYUmmpRLrL9ogPUgDnHFmmTyLGsClkHxKE9O2PRaodFvMC3PWBshR0U9OiFS9H w93O5TYxhNBfvf5ZyWLo4cfIUpTdSowBIzsqtwRfemGe1I0FGYkAv7X4LUgZ406wPgFyraWp imwCh1C1V7ypXzbMgHWOHptX6ziAMRkpnUhMC1yYVvxgyo/YZyi5bs0focseeV17/RqyPN5F qFXe8iJDvlVZC7A/jARMcv0oIB4LUz5jgOSJSu1JjM4esc4FQDO/9bleCrp9TUPUXXr5Zdv/ eX421qCE5QZRglkAMLHU96Vzgu87SoHheZ/f0rUOd0PKk/ix5dndn7qhfgtLsBSdRianmmG1 xybCAszrPXWp9Nn68HAgK2Jotv7E+Z6GUYGTWDX4azvaHvf92unh4RBTPyJbXbWU2atoPeuY uBczvfdNvwbnQkV79ogQugzla9utcHyo7J6zxh/GCSZZlumPbpsP32a0JQdraZK3LJY5VO7V 0/nFgO24llV1BcJyGIsGTc= IronPort-HdrOrdr: A9a23:c5rIWqCFmITTuWvlHemU55DYdb4zR+YMi2TC1yhKJyC9Ffbo7v xG/c5rsyMc5wxwZJhNo7y90ey7MBbhHP1OkO4s1NWZLWrbUQKTRekIh+bfKn/baknDH4ZmpN 9dmsNFaeEYY2IUsS+D2njbL+od X-IronPort-AV: E=Sophos;i="5.85,309,1624334400"; d="scan'208";a="52741880" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH v2 12/12] x86/trace: Clean up trace handling Date: Mon, 20 Sep 2021 18:25:29 +0100 Message-ID: <20210920172529.24932-13-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Use more appropriate types. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu v2: * New --- xen/arch/x86/irq.c | 4 +- xen/arch/x86/mm/p2m-pt.c | 6 +- xen/arch/x86/mm/shadow/multi.c | 2 +- xen/arch/x86/pv/trace.c | 159 +++++++++++++++++++---------------------- 4 files changed, 78 insertions(+), 93 deletions(-) diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index a1693f92dd92..67cbf6b979dc 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -130,8 +130,8 @@ static void _trace_irq_mask(uint32_t event, int irq, int vector, const cpumask_t *mask) { struct { - unsigned int irq:16, vec:16; - unsigned int mask[6]; + uint16_t irq, vec; + uint32_t mask[6]; } d = { .irq = irq, .vec = vector, diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c index 5a0c0f5aceff..09c99d78aa40 100644 --- a/xen/arch/x86/mm/p2m-pt.c +++ b/xen/arch/x86/mm/p2m-pt.c @@ -609,9 +609,9 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn, if ( tb_init_done ) { struct { - u64 gfn, mfn; - int p2mt; - int d:16,order:16; + uint64_t gfn, mfn; + uint32_t p2mt; + uint16_t d, order; } t; t.gfn = gfn; diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c index 8bb028c2e2fa..15265fc81dca 100644 --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -2118,7 +2118,7 @@ static inline void trace_shadow_emulate(guest_l1e_t gl1e, unsigned long va) so put it first for alignment sake. */ guest_l1e_t gl1e, write_val; guest_va_t va; - unsigned flags:29, emulation_count:3; + uint32_t flags:29, emulation_count:3; } d; u32 event; diff --git a/xen/arch/x86/pv/trace.c b/xen/arch/x86/pv/trace.c index 550c22765bae..a952fbc1eb0f 100644 --- a/xen/arch/x86/pv/trace.c +++ b/xen/arch/x86/pv/trace.c @@ -7,38 +7,35 @@ void __trace_pv_trap(int trapnr, unsigned long eip, { if ( is_pv_32bit_vcpu(current) ) { - struct __packed { - unsigned eip:32, - trapnr:15, - use_error_code:1, - error_code:16; - } d; - - d.eip = eip; - d.trapnr = trapnr; - d.error_code = error_code; - d.use_error_code=!!use_error_code; + struct { + uint32_t eip; + uint16_t trapnr:15; + bool use_error_code:1; + uint16_t error_code; + } d = { + .eip = eip, + .trapnr = trapnr, + .use_error_code = use_error_code, + .error_code = error_code, + }; __trace_var(TRC_PV_TRAP, 1, sizeof(d), &d); } else { struct __packed { - unsigned long eip; - unsigned trapnr:15, - use_error_code:1, - error_code:16; - } d; - unsigned event; - - d.eip = eip; - d.trapnr = trapnr; - d.error_code = error_code; - d.use_error_code=!!use_error_code; - - event = TRC_PV_TRAP; - event |= TRC_64_FLAG; - __trace_var(event, 1, sizeof(d), &d); + uint64_t rip; + uint16_t trapnr:15; + bool use_error_code:1; + uint16_t error_code; + } d = { + .rip = eip, + .trapnr = trapnr, + .use_error_code = use_error_code, + .error_code = error_code, + }; + + __trace_var(TRC_PV_TRAP | TRC_64_FLAG, 1, sizeof(d), &d); } } @@ -48,30 +45,28 @@ void __trace_pv_page_fault(unsigned long addr, unsigned error_code) if ( is_pv_32bit_vcpu(current) ) { - struct __packed { - u32 eip, addr, error_code; - } d; - - d.eip = eip; - d.addr = addr; - d.error_code = error_code; + struct { + uint32_t eip, addr, error_code; + } d = { + .eip = eip, + .addr = addr, + .error_code = error_code, + }; __trace_var(TRC_PV_PAGE_FAULT, 1, sizeof(d), &d); } else { struct __packed { - unsigned long eip, addr; - u32 error_code; - } d; - unsigned event; - - d.eip = eip; - d.addr = addr; - d.error_code = error_code; - event = TRC_PV_PAGE_FAULT; - event |= TRC_64_FLAG; - __trace_var(event, 1, sizeof(d), &d); + uint64_t eip, addr; + uint32_t error_code; + } d = { + .eip = eip, + .addr = addr, + .error_code = error_code, + }; + + __trace_var(TRC_PV_PAGE_FAULT | TRC_64_FLAG, 1, sizeof(d), &d); } } @@ -83,10 +78,7 @@ void __trace_trap_one_addr(unsigned event, unsigned long va) __trace_var(event, 1, sizeof(d), &d); } else - { - event |= TRC_64_FLAG; - __trace_var(event, 1, sizeof(va), &va); - } + __trace_var(event | TRC_64_FLAG, 1, sizeof(va), &va); } void __trace_trap_two_addr(unsigned event, unsigned long va1, @@ -94,22 +86,25 @@ void __trace_trap_two_addr(unsigned event, unsigned long va1, { if ( is_pv_32bit_vcpu(current) ) { - struct __packed { - u32 va1, va2; - } d; - d.va1=va1; - d.va2=va2; + struct { + uint32_t va1, va2; + } d = { + .va1 = va1, + .va2 = va2, + }; + __trace_var(event, 1, sizeof(d), &d); } else { - struct __packed { - unsigned long va1, va2; - } d; - d.va1=va1; - d.va2=va2; - event |= TRC_64_FLAG; - __trace_var(event, 1, sizeof(d), &d); + struct { + uint64_t va1, va2; + } d = { + .va1 = va1, + .va2 = va2, + }; + + __trace_var(event | TRC_64_FLAG, 1, sizeof(d), &d); } } @@ -117,40 +112,30 @@ void __trace_ptwr_emulation(unsigned long addr, l1_pgentry_t npte) { unsigned long eip = guest_cpu_user_regs()->rip; - /* We have a couple of different modes to worry about: - * - 32-on-32: 32-bit pte, 32-bit virtual addresses - * - pae-on-pae, pae-on-64: 64-bit pte, 32-bit virtual addresses - * - 64-on-64: 64-bit pte, 64-bit virtual addresses - * pae-on-64 is the only one that requires extra code; in all other - * cases, "unsigned long" is the size of a guest virtual address. - */ - if ( is_pv_32bit_vcpu(current) ) { - struct __packed { - l1_pgentry_t pte; - u32 addr, eip; - } d; - d.addr = addr; - d.eip = eip; - d.pte = npte; + struct { + uint64_t pte; + uint32_t addr, eip; + } d = { + .pte = l1e_get_intpte(npte), + .addr = addr, + .eip = eip, + }; __trace_var(TRC_PV_PTWR_EMULATION_PAE, 1, sizeof(d), &d); } else { struct { - l1_pgentry_t pte; - unsigned long addr, eip; - } d; - unsigned event; - - d.addr = addr; - d.eip = eip; - d.pte = npte; - - event = TRC_PV_PTWR_EMULATION; - event |= TRC_64_FLAG; - __trace_var(event, 1/*tsc*/, sizeof(d), &d); + uint64_t pte; + uint64_t addr, rip; + } d = { + .pte = l1e_get_intpte(npte), + .addr = addr, + .rip = eip, + }; + + __trace_var(TRC_PV_PTWR_EMULATION | TRC_64_FLAG, 1, sizeof(d), &d); } } From patchwork Mon Sep 20 19:29:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 904F4C433F5 for ; Mon, 20 Sep 2021 19:30:23 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4DBE26121E for ; Mon, 20 Sep 2021 19:30:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4DBE26121E Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191145.341062 (Exim 4.92) (envelope-from ) id 1mSOzI-00087n-TI; Mon, 20 Sep 2021 19:30:00 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191145.341062; Mon, 20 Sep 2021 19:30:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSOzI-00087g-Q4; Mon, 20 Sep 2021 19:30:00 +0000 Received: by outflank-mailman (input) for mailman id 191145; Mon, 20 Sep 2021 19:29:59 +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 1mSOzH-00087a-7b for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 19:29:59 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 23a86384-1a49-11ec-b881-12813bfff9fa; Mon, 20 Sep 2021 19:29:58 +0000 (UTC) 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: 23a86384-1a49-11ec-b881-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632166197; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=+TlaTCIqGu8j0bYpxe1cgsh+qhECUrKtrVKQp6Z2N0o=; b=QZkOXM4NAEHLBw7r9wuHZ7UveyJWhxI/2im/B11QFiiJbupRZFavtBdC SXrew94f6MjmhYJxlScM/6Ofr7GU5qbOAyUYnsGCymck4wqeNpqsf8mDx R/smI3Iwpte9JDfaHCbA6h1jmRTmFL0eWOOqHh5hR2SaVoSGaghVHwPV1 0=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 5c/xeiQ5NPwPiOWQO4WXo1wfogul/PN0wI86yPDPZyqgwApt3jFFtRbrwhPA8EjMPz6J3W1ZCU y8wSlQ2rgHRvGfaP8S6NVqfSPMo227cNmMKLFHY2fJeRQZocgPPaO0yyPqmvQMlLL/JWtqhqay AWdysyG/X9pL+ALbNnCYZsazWhF7qgMZkJXlLFpwi6Pgkq5kVazQWy195yEitjI9ARZ4+aNIit Y2PziFeENV3Yw8H/2CKegugLlmIPRLoT2gBNQnyDV0uYBhBiX0UUAa0H6BefWWUgwDyCkwwast PekvgmkSNoZDtE+rEQXESWLB X-SBRS: 5.1 X-MesageID: 52750854 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:4lRU1K2taxFwZqDMgPbD5Qx2kn2cJEfYwER7XKvMYLTBsI5bp2dTm DAYDWuGOvvYNGSgc4wlPd6z9EgDscXQnNZqG1NlpC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkS5PE3oHJ9RGQ74nRLlbHILOCan0ZqTNMEn970EoywbZh2eaEvPDia++zk YKqyyHgEAfNNw5cagr4PIra9XuDFNyr0N8plgRWicJj5TcypFFMZH4rHomjLmOQf2VhNrXSq 9Avbl2O1jixEx8FUrtJm1tgG6EAaua60QOm0hK6V0U+6/TrS+NbPqsTbZIhhUlrZzqhpd11l pJc9qaKWyA4OYLzm8U9VBl4DHQrVUFG0OevzXmXtMWSywvNcmf2wuUoB0YzVWEa0r8pWycUr 6VecW1TKEDY7w616OvTpu1Er8IvNsT0eqgYvWlt12rxBvc6W5HTBa7N4Le02R9t3J8TRaaDO 6L1bxI/XBHSTgdqeW48BYkajMalg3THQh5h/Qf9Sa0fvDGIkV0Z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HdrOrdr: A9a23:czrrI62UQLhBOomIE6s/pQqjBLYkLtp133Aq2lEZdPRUGvb4qy nOpoVi6faaskdzZJhNo7+90ey7MBfhHP1OkPAs1NWZLWvbUQKTRekIh+aP/9SjIVyYygc079 YHT0EUMr3N5DZB4/oSmDPIduod/A== X-IronPort-AV: E=Sophos;i="5.85,309,1624334400"; d="scan'208";a="52750854" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Stefano Stabellini , Wei Liu , Julien Grall Subject: [PATCH v2.1 13/12] xen/trace: Introduce new API Date: Mon, 20 Sep 2021 20:29:39 +0100 Message-ID: <20210920192939.16483-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 This will be used to clean up mess of macros which exists throughout the codebase. Signed-off-by: Andrew Cooper --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall v2.1: * New --- xen/include/xen/trace.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h index 055883287e8c..72c20550f6a6 100644 --- a/xen/include/xen/trace.h +++ b/xen/include/xen/trace.h @@ -74,6 +74,30 @@ static inline void __trace_hypercall(uint32_t event, unsigned long op, const xen_ulong_t *args) {} #endif /* CONFIG_TRACEBUFFER */ +/* + * Create a trace record, packaging up to 7 additional parameters into a + * uint32_t array. + */ +#define TRACE_INTERNAL(_e, _c, ...) \ + do { \ + if ( unlikely(tb_init_done) ) \ + { \ + uint32_t _d[] = { __VA_ARGS__ }; \ + BUILD_BUG_ON(ARRAY_SIZE(_d) > TRACE_EXTRA_MAX); \ + __trace_var(_e, _c, sizeof(_d), sizeof(_d) ? _d : NULL); \ + } \ + } while ( 0 ) + +/* Split a uint64_t into two adjacent uint32_t's for a trace record. */ +#define TRACE_PARAM64(p) (uint32_t)(p), ((p) >> 32) + +/* Create a trace record with time included. */ +#define TRACE_TIME(_e, ...) TRACE_INTERNAL(_e, true, ##__VA_ARGS__) + +/* Create a trace record with no time included. */ +#define TRACE(_e, ...) TRACE_INTERNAL(_e, false, ##__VA_ARGS__) + + /* Convenience macros for calling the trace function. */ #define TRACE_0D(_e) \ do { \ From patchwork Mon Sep 20 19:32:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506273 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2BE4C433EF for ; Mon, 20 Sep 2021 19:32:59 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8984A61107 for ; Mon, 20 Sep 2021 19:32:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8984A61107 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191158.341084 (Exim 4.92) (envelope-from ) id 1mSP21-0001fv-Nb; Mon, 20 Sep 2021 19:32:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191158.341084; Mon, 20 Sep 2021 19:32:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSP21-0001fo-Jb; Mon, 20 Sep 2021 19:32:49 +0000 Received: by outflank-mailman (input) for mailman id 191158; Mon, 20 Sep 2021 19:32:49 +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 1mSP20-0001fg-Td for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 19:32:48 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 87813f0c-1a49-11ec-b881-12813bfff9fa; Mon, 20 Sep 2021 19:32:45 +0000 (UTC) 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: 87813f0c-1a49-11ec-b881-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632166365; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=KHngWxU5NGMuCF7kJ9kXOWLSo5HfGZpL7wbVlWdiHGs=; b=HhmC59QoWoS+0IrCTn0l+OufQSvdRKRjrr+7n3hjqPF8ECsrZRS5QXbT yerPnhIJJl30oc+dVJZ7oQyRftD7qzeDFJZb4C4EyeBImhsMiZCjDZJud +nDRaa2p0U0W73LN4lI1WbGqxonbANqYEX16meks6x3EvKC1YrbxmQIIk w=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: pi1s2iXKKe6xDaf4/X8woomz9od6Bo+reevhKRa8KloSU62lyelURCQEOxNRez0SrqnxNnyfOO EWuDLbaVVcsmdEOv4cUmVsAMSLM6Vipx9E+T6OL48+1mmCz9VZzw2poWxgDRhwukluQDcR2WC9 U+29uH840FAGd8GmTPjEiyPlv8aJ2UHblcUVvWO0aLN43T/wGeqI/r7e7gH8L7hSnqLY8IfrUP hCtxZZBWJ7CQ7P6LQvqGu4su4ErOFL+V10k2l5kAKhT3sduKv3hwadz6NcK3kjw7vt9PcgxRms hqPHXJsBTtz5uhjm6hS6ilae X-SBRS: 5.1 X-MesageID: 54949765 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:KFRwu6jDGXmH/etxcr1NOqxKX161vBcKZh0ujC45NGQN5FlHY01je htvWWCDMviNMWf2f9sna4SyoEsF757QyYJrTwturH9mRHgb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oAMKRCQ7InQLlbGILes1htZGEk0FU/NtTo5w7Rg2t8y2YDia++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1vuoS0SB0YA5TDo/sPeQRnSCN5Za1ZreqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHCOo8Ft24m5jbeFfs8GrjIQrnQ5M8e1zA17ixLNauCN pZINmQyBPjGSxNmP0YyLpcUp+KXn0vPImRR8l+Oh5NitgA/yyQuieOwYbI5YOeiXt5Jl0yVo mbH+WXRARwAMtGbjz2f/RqEmevnjS79HoUIG9WQ9ONugVCV7nweDlsRT1TTiem0jAuyVsxSL 2QQ+zEytu4i+UqzVN7/Uhak5nmesXY0WsVSO/037hmXzajZ6BrfAXILJhZjQtE7sM49RR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AV: E=Sophos;i="5.85,309,1624334400"; d="scan'208";a="54949765" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Stefano Stabellini , Wei Liu , Julien Grall Subject: [PATCH v2.1 14/12] xen: Switch to new TRACE() API Date: Mon, 20 Sep 2021 20:32:34 +0100 Message-ID: <20210920193234.19409-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 (Almost) no functional change. irq_move_cleanup_interrupt() changes two smp_processor_id() calls to the 'me' local variable which manifests as a minor code improvement. All other differences in the compiled binary are to do with line numbers changing. Some conversion notes: * HVMTRACE_LONG_[234]D() and TRACE_2_LONG_[234]D() were latently buggy. They blindly discard extra parameters, but luckily no users are impacted. They are also obfuscated wrappers, depending on exactly one or two parameters being TRC_PAR_LONG() to compile successfully. * HVMTRACE_LONG_1D() behaves unlike its named companions, and takes exactly one 64bit parameter which it splits manually. It's one user, vmx_cr_access()'s LMSW path, is gets adjusted to use TRACE_PARAM64(). * TRACE_?D() and TRACE_2_LONG_*() change to TRACE_TIME() as cycles is always. * HVMTRACE_ND() is opencoded for VMENTRY/VMEXIT records to include cycles. These are converted to TRACE_TIME(), with the old modifier parameter expressed as an OR at the callsite. One callsite, svm_vmenter_helper() had a nested tb_init_done check, which is dropped. (The optimiser also spotted this, which is why it doesn't manifest as a binary difference.) * All HVMTRACE_?D() change to TRACE() as cycles is explicitly skipped. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Reviewed-by: Dario Faggioli --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall v2.1: * New I'm in two minds as to whether to split this up by subsystem or not. It is 95% x86, and isn't a massive patch. --- xen/arch/x86/acpi/cpu_idle.c | 12 +++++----- xen/arch/x86/compat.c | 4 ++-- xen/arch/x86/cpu/mwait-idle.c | 6 ++--- xen/arch/x86/emul-i8254.c | 14 +++++------ xen/arch/x86/hvm/emulate.c | 8 +++---- xen/arch/x86/hvm/hpet.c | 6 ++--- xen/arch/x86/hvm/hvm.c | 16 ++++++------- xen/arch/x86/hvm/rtc.c | 12 +++++----- xen/arch/x86/hvm/svm/intr.c | 6 ++--- xen/arch/x86/hvm/svm/svm.c | 40 +++++++++++++++----------------- xen/arch/x86/hvm/vlapic.c | 29 +++++++++++------------ xen/arch/x86/hvm/vmx/intr.c | 6 ++--- xen/arch/x86/hvm/vmx/vmx.c | 54 +++++++++++++++++++++---------------------- xen/arch/x86/hvm/vpic.c | 13 +++++------ xen/arch/x86/irq.c | 14 +++++------ xen/arch/x86/traps.c | 2 +- xen/common/domain.c | 4 ++-- xen/common/grant_table.c | 6 ++--- xen/common/sched/core.c | 48 ++++++++++++++++++-------------------- xen/common/sched/credit.c | 30 +++++++++++------------- xen/drivers/cpufreq/utility.c | 2 +- 21 files changed, 159 insertions(+), 173 deletions(-) diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c index d788c8bffc84..98cbb8dd8316 100644 --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -752,7 +752,7 @@ static void acpi_processor_idle(void) /* Get start time (ticks) */ t1 = alternative_call(cpuidle_get_tick); /* Trace cpu idle entry */ - TRACE_4D(TRC_PM_IDLE_ENTRY, cx->idx, t1, exp, pred); + TRACE_TIME(TRC_PM_IDLE_ENTRY, cx->idx, t1, exp, pred); update_last_cx_stat(power, cx, t1); @@ -762,8 +762,8 @@ static void acpi_processor_idle(void) t2 = alternative_call(cpuidle_get_tick); trace_exit_reason(irq_traced); /* Trace cpu idle exit */ - TRACE_6D(TRC_PM_IDLE_EXIT, cx->idx, t2, - irq_traced[0], irq_traced[1], irq_traced[2], irq_traced[3]); + TRACE_TIME(TRC_PM_IDLE_EXIT, cx->idx, t2, + irq_traced[0], irq_traced[1], irq_traced[2], irq_traced[3]); /* Update statistics */ update_idle_stats(power, cx, t1, t2); /* Re-enable interrupts */ @@ -783,7 +783,7 @@ static void acpi_processor_idle(void) /* Get start time (ticks) */ t1 = alternative_call(cpuidle_get_tick); /* Trace cpu idle entry */ - TRACE_4D(TRC_PM_IDLE_ENTRY, cx->idx, t1, exp, pred); + TRACE_TIME(TRC_PM_IDLE_ENTRY, cx->idx, t1, exp, pred); update_last_cx_stat(power, cx, t1); @@ -838,8 +838,8 @@ static void acpi_processor_idle(void) cstate_restore_tsc(); trace_exit_reason(irq_traced); /* Trace cpu idle exit */ - TRACE_6D(TRC_PM_IDLE_EXIT, cx->idx, t2, - irq_traced[0], irq_traced[1], irq_traced[2], irq_traced[3]); + TRACE_TIME(TRC_PM_IDLE_EXIT, cx->idx, t2, + irq_traced[0], irq_traced[1], irq_traced[2], irq_traced[3]); /* Update statistics */ update_idle_stats(power, cx, t1, t2); diff --git a/xen/arch/x86/compat.c b/xen/arch/x86/compat.c index 58b202f701d5..e4e09f34b87e 100644 --- a/xen/arch/x86/compat.c +++ b/xen/arch/x86/compat.c @@ -42,8 +42,8 @@ long do_sched_op_compat(int cmd, unsigned long arg) return fn(cmd, guest_handle_from_ptr(NULL, void)); case SCHEDOP_shutdown: - TRACE_3D(TRC_SCHED_SHUTDOWN, - current->domain->domain_id, current->vcpu_id, arg); + TRACE_TIME(TRC_SCHED_SHUTDOWN, + current->domain->domain_id, current->vcpu_id, arg); domain_shutdown(current->domain, (u8)arg); break; diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c index f0c6ff9d5229..43567865764b 100644 --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -808,7 +808,7 @@ static void mwait_idle(void) lapic_timer_off(); before = alternative_call(cpuidle_get_tick); - TRACE_4D(TRC_PM_IDLE_ENTRY, cx->type, before, exp, pred); + TRACE_TIME(TRC_PM_IDLE_ENTRY, cx->type, before, exp, pred); update_last_cx_stat(power, cx, before); @@ -819,8 +819,8 @@ static void mwait_idle(void) cstate_restore_tsc(); trace_exit_reason(irq_traced); - TRACE_6D(TRC_PM_IDLE_EXIT, cx->type, after, - irq_traced[0], irq_traced[1], irq_traced[2], irq_traced[3]); + TRACE_TIME(TRC_PM_IDLE_EXIT, cx->type, after, + irq_traced[0], irq_traced[1], irq_traced[2], irq_traced[3]); /* Now back in C0. */ update_idle_stats(power, cx, before, after); diff --git a/xen/arch/x86/emul-i8254.c b/xen/arch/x86/emul-i8254.c index 050c784702af..19b5c95af216 100644 --- a/xen/arch/x86/emul-i8254.c +++ b/xen/arch/x86/emul-i8254.c @@ -159,7 +159,7 @@ static int pit_get_gate(PITState *pit, int channel) static void pit_time_fired(struct vcpu *v, void *priv) { uint64_t *count_load_time = priv; - TRACE_0D(TRC_HVM_EMUL_PIT_TIMER_CB); + TRACE_TIME(TRC_HVM_EMUL_PIT_TIMER_CB); *count_load_time = get_guest_time(v); } @@ -189,19 +189,19 @@ static void pit_load_count(PITState *pit, int channel, int val) case 2: case 3: /* Periodic timer. */ - TRACE_2D(TRC_HVM_EMUL_PIT_START_TIMER, period, period); + TRACE_TIME(TRC_HVM_EMUL_PIT_START_TIMER, period, period); create_periodic_time(v, &pit->pt0, period, period, 0, pit_time_fired, &pit->count_load_time[channel], false); break; case 1: case 4: /* One-shot timer. */ - TRACE_2D(TRC_HVM_EMUL_PIT_START_TIMER, period, 0); + TRACE_TIME(TRC_HVM_EMUL_PIT_START_TIMER, period, 0); create_periodic_time(v, &pit->pt0, period, 0, 0, pit_time_fired, &pit->count_load_time[channel], false); break; default: - TRACE_0D(TRC_HVM_EMUL_PIT_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_PIT_STOP_TIMER); destroy_periodic_time(&pit->pt0); break; } @@ -385,7 +385,7 @@ void pit_stop_channel0_irq(PITState *pit) if ( !has_vpit(current->domain) ) return; - TRACE_0D(TRC_HVM_EMUL_PIT_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_PIT_STOP_TIMER); spin_lock(&pit->lock); destroy_periodic_time(&pit->pt0); spin_unlock(&pit->lock); @@ -454,7 +454,7 @@ void pit_reset(struct domain *d) if ( is_hvm_domain(d) ) { - TRACE_0D(TRC_HVM_EMUL_PIT_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_PIT_STOP_TIMER); destroy_periodic_time(&pit->pt0); pit->pt0.source = PTSRC_isa; } @@ -499,7 +499,7 @@ void pit_deinit(struct domain *d) if ( is_hvm_domain(d) ) { - TRACE_0D(TRC_HVM_EMUL_PIT_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_PIT_STOP_TIMER); destroy_periodic_time(&pit->pt0); } } diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index 425c8ddd9779..f863a19df311 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -2183,7 +2183,7 @@ static int hvmemul_read_cr( case 3: case 4: *val = current->arch.hvm.guest_cr[reg]; - HVMTRACE_LONG_2D(CR_READ, reg, TRC_PAR_LONG(*val)); + TRACE(TRC_HVM_CR_READ64, reg, TRACE_PARAM64(*val)); return X86EMUL_OKAY; default: break; @@ -2199,7 +2199,7 @@ static int hvmemul_write_cr( { int rc; - HVMTRACE_LONG_2D(CR_WRITE, reg, TRC_PAR_LONG(val)); + TRACE(TRC_HVM_CR_WRITE64, reg, TRACE_PARAM64(val)); switch ( reg ) { case 0: @@ -2244,7 +2244,7 @@ static int hvmemul_read_xcr( int rc = x86emul_read_xcr(reg, val, ctxt); if ( rc == X86EMUL_OKAY ) - HVMTRACE_LONG_2D(XCR_READ, reg, TRC_PAR_LONG(*val)); + TRACE(TRC_HVM_XCR_READ64, reg, TRACE_PARAM64(*val)); return rc; } @@ -2254,7 +2254,7 @@ static int hvmemul_write_xcr( uint64_t val, struct x86_emulate_ctxt *ctxt) { - HVMTRACE_LONG_2D(XCR_WRITE, reg, TRC_PAR_LONG(val)); + TRACE(TRC_HVM_XCR_WRITE64, reg, TRACE_PARAM64(val)); return x86emul_write_xcr(reg, val, ctxt); } diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c index 8267f0b8a278..5873bb8a506d 100644 --- a/xen/arch/x86/hvm/hpet.c +++ b/xen/arch/x86/hvm/hpet.c @@ -212,7 +212,7 @@ static void hpet_stop_timer(HPETState *h, unsigned int tn, { ASSERT(tn < HPET_TIMER_NUM); ASSERT(rw_is_write_locked(&h->lock)); - TRACE_1D(TRC_HVM_EMUL_HPET_STOP_TIMER, tn); + TRACE_TIME(TRC_HVM_EMUL_HPET_STOP_TIMER, tn); destroy_periodic_time(&h->pt[tn]); /* read the comparator to get it updated so a read while stopped will * return the expected value. */ @@ -316,8 +316,8 @@ static void hpet_set_timer(HPETState *h, unsigned int tn, if ( !oneshot ) period_ns = hpet_tick_to_ns(h, h->hpet.period[tn]); - TRACE_2_LONG_4D(TRC_HVM_EMUL_HPET_START_TIMER, tn, irq, - TRC_PAR_LONG(diff_ns), TRC_PAR_LONG(period_ns)); + TRACE_TIME(TRC_HVM_EMUL_HPET_START_TIMER, tn, irq, + TRACE_PARAM64(diff_ns), TRACE_PARAM64(period_ns)); create_periodic_time(vhpet_vcpu(h), &h->pt[tn], diff_ns, period_ns, irq, timer_level(h, tn) ? hpet_timer_fired : NULL, diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 09cf6330ad26..fa211d14afd8 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1679,7 +1679,7 @@ void hvm_hlt(unsigned int eflags) do_sched_op(SCHEDOP_block, guest_handle_from_ptr(NULL, void)); - HVMTRACE_1D(HLT, /* pending = */ vcpu_runnable(curr)); + TRACE(TRC_HVM_HLT, /* pending = */ vcpu_runnable(curr)); } void hvm_triple_fault(void) @@ -2136,7 +2136,7 @@ int hvm_mov_to_cr(unsigned int cr, unsigned int gpr) unsigned long val = *decode_gpr(guest_cpu_user_regs(), gpr); int rc; - HVMTRACE_LONG_2D(CR_WRITE, cr, TRC_PAR_LONG(val)); + TRACE(TRC_HVM_CR_WRITE64, cr, TRACE_PARAM64(val)); HVM_DBG_LOG(DBG_LEVEL_1, "CR%u, value = %lx", cr, val); switch ( cr ) @@ -2201,7 +2201,7 @@ int hvm_mov_from_cr(unsigned int cr, unsigned int gpr) } *reg = val; - HVMTRACE_LONG_2D(CR_READ, cr, TRC_PAR_LONG(val)); + TRACE(TRC_HVM_CR_READ64, cr, TRACE_PARAM64(val)); HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR%u, value = %lx", cr, val); return X86EMUL_OKAY; @@ -3463,7 +3463,7 @@ int hvm_vmexit_cpuid(struct cpu_user_regs *regs, unsigned int inst_len) } guest_cpuid(curr, leaf, subleaf, &res); - HVMTRACE_6D(CPUID, leaf, subleaf, res.a, res.b, res.c, res.d); + TRACE(TRC_HVM_CPUID, leaf, subleaf, res.a, res.b, res.c, res.d); regs->rax = res.a; regs->rbx = res.b; @@ -3477,7 +3477,7 @@ void hvm_rdtsc_intercept(struct cpu_user_regs *regs) { msr_split(regs, hvm_get_guest_tsc(current)); - HVMTRACE_2D(RDTSC, regs->eax, regs->edx); + TRACE(TRC_HVM_RDTSC, regs->eax, regs->edx); } int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content) @@ -3584,8 +3584,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content) } out: - HVMTRACE_3D(MSR_READ, msr, - (uint32_t)*msr_content, (uint32_t)(*msr_content >> 32)); + TRACE(TRC_HVM_MSR_READ, msr, TRACE_PARAM64(*msr_content)); return ret; gp_fault: @@ -3601,8 +3600,7 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content, struct domain *d = v->domain; int ret; - HVMTRACE_3D(MSR_WRITE, msr, - (uint32_t)msr_content, (uint32_t)(msr_content >> 32)); + TRACE(TRC_HVM_MSR_WRITE, msr, TRACE_PARAM64(msr_content)); if ( may_defer && unlikely(monitored_msr(v->domain, msr)) ) { diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c index 3150f5f1479b..6c133eabf5d4 100644 --- a/xen/arch/x86/hvm/rtc.c +++ b/xen/arch/x86/hvm/rtc.c @@ -92,7 +92,7 @@ static void rtc_pf_callback(struct vcpu *v, void *opaque) && ++(s->pt_dead_ticks) >= 10 ) { /* VM is ignoring its RTC; no point in running the timer */ - TRACE_0D(TRC_HVM_EMUL_RTC_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_RTC_STOP_TIMER); destroy_periodic_time(&s->pt); s->period = 0; } @@ -155,7 +155,7 @@ static void rtc_timer_update(RTCState *s) delta = period - ((now - s->start_time) % period); if ( s->hw.cmos_data[RTC_REG_B] & RTC_PIE ) { - TRACE_2D(TRC_HVM_EMUL_RTC_START_TIMER, delta, period); + TRACE_TIME(TRC_HVM_EMUL_RTC_START_TIMER, delta, period); create_periodic_time(v, &s->pt, delta, period, RTC_IRQ, rtc_pf_callback, s, false); } @@ -166,7 +166,7 @@ static void rtc_timer_update(RTCState *s) } /* fall through */ default: - TRACE_0D(TRC_HVM_EMUL_RTC_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_RTC_STOP_TIMER); destroy_periodic_time(&s->pt); s->period = 0; break; @@ -519,7 +519,7 @@ static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data) rtc_update_irq(s); if ( (data ^ orig) & RTC_PIE ) { - TRACE_0D(TRC_HVM_EMUL_RTC_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_RTC_STOP_TIMER); destroy_periodic_time(&s->pt); s->period = 0; rtc_timer_update(s); @@ -802,7 +802,7 @@ void rtc_reset(struct domain *d) if ( !has_vrtc(d) ) return; - TRACE_0D(TRC_HVM_EMUL_RTC_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_RTC_STOP_TIMER); destroy_periodic_time(&s->pt); s->period = 0; s->pt.source = PTSRC_isa; @@ -877,7 +877,7 @@ void rtc_deinit(struct domain *d) spin_barrier(&s->lock); - TRACE_0D(TRC_HVM_EMUL_RTC_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_RTC_STOP_TIMER); destroy_periodic_time(&s->pt); kill_timer(&s->update_timer); kill_timer(&s->update_timer2); diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c index 7f815d230785..122c9d7fbf14 100644 --- a/xen/arch/x86/hvm/svm/intr.c +++ b/xen/arch/x86/hvm/svm/intr.c @@ -101,8 +101,8 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack) } } - HVMTRACE_3D(INTR_WINDOW, intack.vector, intack.source, - vmcb->event_inj.v ? vmcb->event_inj.vector : -1); + TRACE(TRC_HVM_INTR_WINDOW, intack.vector, intack.source, + vmcb->event_inj.v ? vmcb->event_inj.vector : -1); /* * Create a dummy virtual interrupt to intercept as soon as the @@ -217,7 +217,7 @@ void svm_intr_assist(void) } else { - HVMTRACE_2D(INJ_VIRQ, intack.vector, /*fake=*/ 0); + TRACE(TRC_HVM_INJ_VIRQ, intack.vector, /*fake=*/ 0); svm_inject_extint(v, intack.vector); pt_intr_post(v, intack); } diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index f0e10dec046e..b98a2dd71d1e 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1049,10 +1049,8 @@ void svm_vmenter_helper(const struct cpu_user_regs *regs) svm_asid_handle_vmrun(); - if ( unlikely(tb_init_done) ) - HVMTRACE_ND(VMENTRY, - nestedhvm_vcpu_in_guestmode(curr) ? TRC_HVM_NESTEDFLAG : 0, - 1/*cycles*/); + TRACE_TIME(TRC_HVM_VMENTRY | + (nestedhvm_vcpu_in_guestmode(curr) ? TRC_HVM_NESTEDFLAG : 0)); svm_sync_vmcb(curr, vmcb_needs_vmsave); @@ -1424,10 +1422,10 @@ static void svm_inject_event(const struct x86_event *event) if ( _event.vector == TRAP_page_fault && _event.type == X86_EVENTTYPE_HW_EXCEPTION ) - HVMTRACE_LONG_2D(PF_INJECT, _event.error_code, - TRC_PAR_LONG(_event.cr2)); + TRACE(TRC_HVM_PF_INJECT64, _event.error_code, + TRACE_PARAM64(_event.cr2)); else - HVMTRACE_2D(INJ_EXC, _event.vector, _event.error_code); + TRACE(TRC_HVM_INJ_EXC, _event.vector, _event.error_code); } static bool svm_event_pending(const struct vcpu *v) @@ -1787,7 +1785,7 @@ static void svm_dr_access(struct vcpu *v, struct cpu_user_regs *regs) { struct vmcb_struct *vmcb = vcpu_nestedhvm(v).nv_n1vmcx; - HVMTRACE_0D(DR_WRITE); + TRACE(TRC_HVM_DR_WRITE); __restore_debug_registers(vmcb, v); } @@ -2436,7 +2434,7 @@ static void svm_invlpga_intercept( static void svm_invlpg_intercept(unsigned long linear) { - HVMTRACE_LONG_2D(INVLPG, 0, TRC_PAR_LONG(linear)); + TRACE(TRC_HVM_INVLPG64, 0, TRACE_PARAM64(linear)); paging_invlpg(current, linear); } @@ -2564,11 +2562,11 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) exit_reason = vmcb->exitcode; if ( hvm_long_mode_active(v) ) - HVMTRACE_ND(VMEXIT64, vcpu_guestmode ? TRC_HVM_NESTEDFLAG : 0, - 1/*cycles*/, exit_reason, TRC_PAR_LONG(regs->rip)); + TRACE_TIME(TRC_HVM_VMEXIT64 | (vcpu_guestmode ? TRC_HVM_NESTEDFLAG : 0), + exit_reason, TRACE_PARAM64(regs->rip)); else - HVMTRACE_ND(VMEXIT, vcpu_guestmode ? TRC_HVM_NESTEDFLAG : 0, - 1/*cycles*/, exit_reason, regs->eip); + TRACE_TIME(TRC_HVM_VMEXIT | (vcpu_guestmode ? TRC_HVM_NESTEDFLAG : 0), + exit_reason, regs->eip); if ( vcpu_guestmode ) { @@ -2660,17 +2658,17 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) { case VMEXIT_INTR: /* Asynchronous event, handled when we STGI'd after the VMEXIT. */ - HVMTRACE_0D(INTR); + TRACE(TRC_HVM_INTR); break; case VMEXIT_NMI: /* Asynchronous event, handled when we STGI'd after the VMEXIT. */ - HVMTRACE_0D(NMI); + TRACE(TRC_HVM_NMI); break; case VMEXIT_SMI: /* Asynchronous event, handled when we STGI'd after the VMEXIT. */ - HVMTRACE_0D(SMI); + TRACE(TRC_HVM_SMI); break; case VMEXIT_ICEBP: @@ -2758,9 +2756,9 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) if ( trace_will_trace_event(TRC_SHADOW) ) break; if ( hvm_long_mode_active(v) ) - HVMTRACE_LONG_2D(PF_XEN, regs->error_code, TRC_PAR_LONG(va)); + TRACE(TRC_HVM_PF_XEN64, regs->error_code, TRACE_PARAM64(va)); else - HVMTRACE_2D(PF_XEN, regs->error_code, va); + TRACE(TRC_HVM_PF_XEN, regs->error_code, va); break; } @@ -2769,7 +2767,7 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) } case VMEXIT_EXCEPTION_AC: - HVMTRACE_1D(TRAP, TRAP_alignment_check); + TRACE(TRC_HVM_TRAP, TRAP_alignment_check); hvm_inject_hw_exception(TRAP_alignment_check, vmcb->exitinfo1); break; @@ -2779,7 +2777,7 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) /* Asynchronous event, handled when we STGI'd after the VMEXIT. */ case VMEXIT_EXCEPTION_MC: - HVMTRACE_0D(MCE); + TRACE(TRC_HVM_MCE); svm_vmexit_mce_intercept(v, regs); break; @@ -2917,7 +2915,7 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) if ( (insn_len = svm_get_insn_len(v, INSTR_VMCALL)) == 0 ) break; BUG_ON(vcpu_guestmode); - HVMTRACE_1D(VMMCALL, regs->eax); + TRACE(TRC_HVM_VMMCALL, regs->eax); if ( hvm_hypercall(regs) == HVM_HCALL_completed ) __update_guest_eip(regs, insn_len); diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index b8c84458ffdc..30fd3b46ec4d 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -692,7 +692,7 @@ int guest_rdmsr_x2apic(const struct vcpu *v, uint32_t msr, uint64_t *val) static void vlapic_pt_cb(struct vcpu *v, void *data) { - TRACE_0D(TRC_HVM_EMUL_LAPIC_TIMER_CB); + TRACE_TIME(TRC_HVM_EMUL_LAPIC_TIMER_CB); *(s_time_t *)data = hvm_get_guest_time(v); } @@ -746,9 +746,8 @@ static void vlapic_update_timer(struct vlapic *vlapic, uint32_t lvtt, delta = delta * vlapic->hw.timer_divisor / old_divisor; } - TRACE_2_LONG_3D(TRC_HVM_EMUL_LAPIC_START_TIMER, TRC_PAR_LONG(delta), - TRC_PAR_LONG(is_periodic ? period : 0), - vlapic->pt.irq); + TRACE_TIME(TRC_HVM_EMUL_LAPIC_START_TIMER, TRACE_PARAM64(delta), + TRACE_PARAM64(is_periodic ? period : 0), vlapic->pt.irq); create_periodic_time(current, &vlapic->pt, delta, is_periodic ? period : 0, vlapic->pt.irq, @@ -768,7 +767,7 @@ static void vlapic_update_timer(struct vlapic *vlapic, uint32_t lvtt, } else { - TRACE_0D(TRC_HVM_EMUL_LAPIC_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_LAPIC_STOP_TIMER); destroy_periodic_time(&vlapic->pt); /* * From now, TMCCT should return 0 until TMICT is set again. @@ -1202,8 +1201,8 @@ void vlapic_tdt_msr_set(struct vlapic *vlapic, uint64_t value) vlapic->hw.tdt_msr = value; /* .... reprogram tdt timer */ - TRACE_2_LONG_3D(TRC_HVM_EMUL_LAPIC_START_TIMER, TRC_PAR_LONG(delta), - TRC_PAR_LONG(0LL), vlapic->pt.irq); + TRACE_TIME(TRC_HVM_EMUL_LAPIC_START_TIMER, TRACE_PARAM64(delta), + TRACE_PARAM64(0LL), vlapic->pt.irq); create_periodic_time(v, &vlapic->pt, delta, 0, vlapic->pt.irq, vlapic_tdt_pt_cb, &vlapic->timer_last_update, false); @@ -1216,8 +1215,8 @@ void vlapic_tdt_msr_set(struct vlapic *vlapic, uint64_t value) /* trigger a timer event if needed */ if ( value > 0 ) { - TRACE_2_LONG_3D(TRC_HVM_EMUL_LAPIC_START_TIMER, TRC_PAR_LONG(0LL), - TRC_PAR_LONG(0LL), vlapic->pt.irq); + TRACE_TIME(TRC_HVM_EMUL_LAPIC_START_TIMER, TRACE_PARAM64(0LL), + TRACE_PARAM64(0LL), vlapic->pt.irq); create_periodic_time(v, &vlapic->pt, 0, 0, vlapic->pt.irq, vlapic_tdt_pt_cb, &vlapic->timer_last_update, false); @@ -1226,7 +1225,7 @@ void vlapic_tdt_msr_set(struct vlapic *vlapic, uint64_t value) else { /* .... stop tdt timer */ - TRACE_0D(TRC_HVM_EMUL_LAPIC_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_LAPIC_STOP_TIMER); destroy_periodic_time(&vlapic->pt); } @@ -1276,7 +1275,7 @@ int vlapic_accept_pic_intr(struct vcpu *v) if ( target ) accept = __vlapic_accept_pic_intr(v); - TRACE_2D(TRC_HVM_EMUL_LAPIC_PIC_INTR, target, accept); + TRACE_TIME(TRC_HVM_EMUL_LAPIC_PIC_INTR, target, accept); return target && accept; } @@ -1427,7 +1426,7 @@ static void vlapic_do_init(struct vlapic *vlapic) vlapic_set_reg(vlapic, APIC_SPIV, 0xff); vlapic->hw.disabled |= VLAPIC_SW_DISABLED; - TRACE_0D(TRC_HVM_EMUL_LAPIC_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_LAPIC_STOP_TIMER); destroy_periodic_time(&vlapic->pt); } @@ -1470,8 +1469,8 @@ static void lapic_rearm(struct vlapic *s) (uint32_t)tmict * s->hw.timer_divisor); is_periodic = vlapic_lvtt_period(s); - TRACE_2_LONG_3D(TRC_HVM_EMUL_LAPIC_START_TIMER, TRC_PAR_LONG(period), - TRC_PAR_LONG(is_periodic ? period : 0LL), s->pt.irq); + TRACE_TIME(TRC_HVM_EMUL_LAPIC_START_TIMER, TRACE_PARAM64(period), + TRACE_PARAM64(is_periodic ? period : 0LL), s->pt.irq); create_periodic_time(vlapic_vcpu(s), &s->pt, period, is_periodic ? period : 0, @@ -1650,7 +1649,7 @@ void vlapic_destroy(struct vcpu *v) return; tasklet_kill(&vlapic->init_sipi.tasklet); - TRACE_0D(TRC_HVM_EMUL_LAPIC_STOP_TIMER); + TRACE_TIME(TRC_HVM_EMUL_LAPIC_STOP_TIMER); destroy_periodic_time(&vlapic->pt); unmap_domain_page_global(vlapic->regs); free_domheap_page(vlapic->regs_page); diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c index 80bfbb478782..303d07dc0a3a 100644 --- a/xen/arch/x86/hvm/vmx/intr.c +++ b/xen/arch/x86/hvm/vmx/intr.c @@ -79,8 +79,8 @@ static void vmx_enable_intr_window(struct vcpu *v, struct hvm_intack intack) unsigned long intr; __vmread(VM_ENTRY_INTR_INFO, &intr); - HVMTRACE_3D(INTR_WINDOW, intack.vector, intack.source, - (intr & INTR_INFO_VALID_MASK) ? intr & 0xff : -1); + TRACE(TRC_HVM_INTR_WINDOW, intack.vector, intack.source, + (intr & INTR_INFO_VALID_MASK) ? intr & 0xff : -1); } if ( (intack.source == hvm_intsrc_nmi) && cpu_has_vmx_vnmi ) @@ -402,7 +402,7 @@ void vmx_intr_assist(void) } else { - HVMTRACE_2D(INJ_VIRQ, intack.vector, /*fake=*/ 0); + TRACE(TRC_HVM_INJ_VIRQ, intack.vector, /*fake=*/ 0); vmx_inject_extint(intack.vector, intack.source); pt_intr_post(v, intack); } diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 974a25b34c41..47a5df20ebc1 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1875,10 +1875,10 @@ static void vmx_inject_event(const struct x86_event *event) if ( (_event.vector == TRAP_page_fault) && (_event.type == X86_EVENTTYPE_HW_EXCEPTION) ) - HVMTRACE_LONG_2D(PF_INJECT, _event.error_code, - TRC_PAR_LONG(curr->arch.hvm.guest_cr[2])); + TRACE(TRC_HVM_PF_INJECT64, _event.error_code, + TRACE_PARAM64(curr->arch.hvm.guest_cr[2])); else - HVMTRACE_2D(INJ_EXC, _event.vector, _event.error_code); + TRACE(TRC_HVM_INJ_EXC, _event.vector, _event.error_code); } static bool vmx_event_pending(const struct vcpu *v) @@ -2783,7 +2783,7 @@ static void noinline vmx_dr_access(unsigned long exit_qualification, { struct vcpu *v = current; - HVMTRACE_0D(DR_WRITE); + TRACE(TRC_HVM_DR_WRITE); if ( !v->arch.hvm.flag_dr_dirty ) __restore_debug_registers(v); @@ -2795,7 +2795,7 @@ static void noinline vmx_dr_access(unsigned long exit_qualification, static void noinline vmx_invlpg_intercept(unsigned long linear) { - HVMTRACE_LONG_2D(INVLPG, /*invlpga=*/ 0, TRC_PAR_LONG(linear)); + TRACE(TRC_HVM_INVLPG64, /*invlpga=*/ 0, TRACE_PARAM64(linear)); paging_invlpg(current, linear); } @@ -2843,7 +2843,7 @@ static int vmx_cr_access(cr_access_qual_t qual) hvm_monitor_crX(CR0, value, old); curr->arch.hvm.guest_cr[0] = value; vmx_update_guest_cr(curr, 0, 0); - HVMTRACE_0D(CLTS); + TRACE(TRC_HVM_CLTS); break; } @@ -2856,7 +2856,7 @@ static int vmx_cr_access(cr_access_qual_t qual) value = (value & ~(X86_CR0_MP|X86_CR0_EM|X86_CR0_TS)) | (qual.lmsw_data & (X86_CR0_PE|X86_CR0_MP|X86_CR0_EM|X86_CR0_TS)); - HVMTRACE_LONG_1D(LMSW, value); + TRACE(TRC_HVM_LMSW64, TRACE_PARAM64(value)); if ( (rc = hvm_set_cr0(value, true)) == X86EMUL_EXCEPTION ) hvm_inject_hw_exception(TRAP_gp_fault, 0); @@ -3522,7 +3522,7 @@ static void vmx_do_extint(struct cpu_user_regs *regs) BUG_ON(!(vector & INTR_INFO_VALID_MASK)); vector &= INTR_INFO_VECTOR_MASK; - HVMTRACE_1D(INTR, vector); + TRACE(TRC_HVM_INTR, vector); regs->entry_vector = vector; do_IRQ(regs); @@ -3662,7 +3662,7 @@ static void vmx_failed_vmentry(unsigned int exit_reason, case EXIT_REASON_MCE_DURING_VMENTRY: printk("MCE\n"); - HVMTRACE_0D(MCE); + TRACE(TRC_HVM_MCE); /* Already handled. */ break; @@ -3703,7 +3703,7 @@ static int vmx_handle_eoi_write(void) { update_guest_eip(); /* Safe: APIC data write */ vlapic_EOI_set(vcpu_vlapic(current)); - HVMTRACE_0D(VLAPIC); + TRACE(TRC_HVM_VLAPIC); return 1; } @@ -3864,10 +3864,9 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) __vmread(VM_EXIT_REASON, &exit_reason); if ( hvm_long_mode_active(v) ) - HVMTRACE_ND(VMEXIT64, 0, 1/*cycles*/, exit_reason, - TRC_PAR_LONG(regs->rip)); + TRACE_TIME(TRC_HVM_VMEXIT64, exit_reason, TRACE_PARAM64(regs->rip)); else - HVMTRACE_ND(VMEXIT, 0, 1/*cycles*/, exit_reason, regs->eip); + TRACE_TIME(TRC_HVM_VMEXIT, exit_reason, regs->eip); perfc_incra(vmexits, exit_reason); @@ -3969,7 +3968,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) default: perfc_incr(realmode_exits); v->arch.hvm.vmx.vmx_emulate = 1; - HVMTRACE_0D(REALMODE_EMULATE); + TRACE(TRC_HVM_REALMODE_EMULATE); return; } case EXIT_REASON_EXTERNAL_INTERRUPT: @@ -4032,7 +4031,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) * Table 23-1, "Exit Qualification for Debug Exceptions"). */ __vmread(EXIT_QUALIFICATION, &exit_qualification); - HVMTRACE_1D(TRAP_DEBUG, exit_qualification); + TRACE(TRC_HVM_TRAP_DEBUG, exit_qualification); __restore_debug_registers(v); write_debugreg(6, exit_qualification | DR_STATUS_RESERVED_ONE); @@ -4094,7 +4093,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) domain_pause_for_debugger(); break; case TRAP_int3: - HVMTRACE_1D(TRAP, vector); + TRACE(TRC_HVM_TRAP, vector); if ( !v->domain->debugger_attached ) { unsigned long insn_len; @@ -4119,7 +4118,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) } break; case TRAP_no_device: - HVMTRACE_1D(TRAP, vector); + TRACE(TRC_HVM_TRAP, vector); vmx_fpu_dirty_intercept(); break; case TRAP_page_fault: @@ -4137,37 +4136,36 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) if ( trace_will_trace_event(TRC_SHADOW) ) break; if ( hvm_long_mode_active(v) ) - HVMTRACE_LONG_2D(PF_XEN, regs->error_code, - TRC_PAR_LONG(exit_qualification) ); + TRACE(TRC_HVM_PF_XEN64, regs->error_code, + TRACE_PARAM64(exit_qualification)); else - HVMTRACE_2D(PF_XEN, - regs->error_code, exit_qualification ); + TRACE(TRC_HVM_PF_XEN, regs->error_code, exit_qualification); break; } hvm_inject_page_fault(regs->error_code, exit_qualification); break; case TRAP_alignment_check: - HVMTRACE_1D(TRAP, vector); + TRACE(TRC_HVM_TRAP, vector); vmx_propagate_intr(intr_info); break; case TRAP_nmi: if ( MASK_EXTR(intr_info, INTR_INFO_INTR_TYPE_MASK) != X86_EVENTTYPE_NMI ) goto exit_and_crash; - HVMTRACE_0D(NMI); + TRACE(TRC_HVM_NMI); /* Already handled above. */ break; case TRAP_machine_check: - HVMTRACE_0D(MCE); + TRACE(TRC_HVM_MCE); /* Already handled above. */ break; case TRAP_invalid_op: - HVMTRACE_1D(TRAP, vector); + TRACE(TRC_HVM_TRAP, vector); hvm_ud_intercept(regs); break; default: - HVMTRACE_1D(TRAP, vector); + TRACE(TRC_HVM_TRAP, vector); goto exit_and_crash; } break; @@ -4255,7 +4253,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) break; case EXIT_REASON_VMCALL: - HVMTRACE_1D(VMMCALL, regs->eax); + TRACE(TRC_HVM_VMMCALL, regs->eax); if ( hvm_hypercall(regs) == HVM_HCALL_completed ) update_guest_eip(); /* Safe: VMCALL */ @@ -4644,7 +4642,7 @@ bool vmx_vmenter_helper(const struct cpu_user_regs *regs) if ( unlikely(curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_MASK) ) lbr_fixup(); - HVMTRACE_ND(VMENTRY, 0, 1/*cycles*/); + TRACE_TIME(TRC_HVM_VMENTRY); __vmwrite(GUEST_RIP, regs->rip); __vmwrite(GUEST_RSP, regs->rsp); diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c index 91c2c6983393..1360f40b1044 100644 --- a/xen/arch/x86/hvm/vpic.c +++ b/xen/arch/x86/hvm/vpic.c @@ -99,8 +99,7 @@ static void vpic_update_int_output(struct hvm_hw_vpic *vpic) ASSERT(vpic_is_locked(vpic)); irq = vpic_get_highest_priority_irq(vpic); - TRACE_3D(TRC_HVM_EMUL_PIC_INT_OUTPUT, vpic->int_output, vpic->is_master, - irq); + TRACE_TIME(TRC_HVM_EMUL_PIC_INT_OUTPUT, vpic->int_output, vpic->is_master, irq); if ( vpic->int_output == (!vpic->init_state && irq >= 0) ) return; @@ -119,7 +118,7 @@ static void vpic_update_int_output(struct hvm_hw_vpic *vpic) if ( v != NULL ) { - TRACE_1D(TRC_HVM_EMUL_PIC_KICK, irq); + TRACE_TIME(TRC_HVM_EMUL_PIC_KICK, irq); vcpu_kick(v); } } @@ -144,7 +143,7 @@ static void __vpic_intack(struct hvm_hw_vpic *vpic, int irq) ASSERT(vpic_is_locked(vpic)); - TRACE_2D(TRC_HVM_EMUL_PIC_INTACK, vpic->is_master, irq); + TRACE_TIME(TRC_HVM_EMUL_PIC_INTACK, vpic->is_master, irq); /* Edge-triggered: clear the IRR (forget the edge). */ if ( !(vpic->elcr & mask) ) vpic->irr &= ~mask; @@ -483,7 +482,7 @@ void vpic_irq_positive_edge(struct domain *d, int irq) ASSERT(irq <= 15); ASSERT(vpic_is_locked(vpic)); - TRACE_1D(TRC_HVM_EMUL_PIC_POSEDGE, irq); + TRACE_TIME(TRC_HVM_EMUL_PIC_POSEDGE, irq); if ( irq == 2 ) return; @@ -501,7 +500,7 @@ void vpic_irq_negative_edge(struct domain *d, int irq) ASSERT(irq <= 15); ASSERT(vpic_is_locked(vpic)); - TRACE_1D(TRC_HVM_EMUL_PIC_NEGEDGE, irq); + TRACE_TIME(TRC_HVM_EMUL_PIC_NEGEDGE, irq); if ( irq == 2 ) return; @@ -519,7 +518,7 @@ int vpic_ack_pending_irq(struct vcpu *v) accept = vlapic_accept_pic_intr(v); - TRACE_2D(TRC_HVM_EMUL_PIC_PEND_IRQ_CALL, accept, vpic->int_output); + TRACE_TIME(TRC_HVM_EMUL_PIC_PEND_IRQ_CALL, accept, vpic->int_output); if ( !accept || !vpic->int_output ) return -1; diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 67cbf6b979dc..df85932f44b4 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -236,7 +236,7 @@ static void _clear_irq_vector(struct irq_desc *desc) for_each_cpu(cpu, tmp_mask) { ASSERT(per_cpu(vector_irq, cpu)[old_vector] == irq); - TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, old_vector, cpu); + TRACE_TIME(TRC_HW_IRQ_MOVE_FINISH, irq, old_vector, cpu); per_cpu(vector_irq, cpu)[old_vector] = ~irq; } @@ -799,13 +799,11 @@ void irq_move_cleanup_interrupt(struct cpu_user_regs *regs) goto unlock; } send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR); - TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP_DELAY, - irq, vector, smp_processor_id()); + TRACE_TIME(TRC_HW_IRQ_MOVE_CLEANUP_DELAY, irq, vector, me); goto unlock; } - TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP, - irq, vector, smp_processor_id()); + TRACE_TIME(TRC_HW_IRQ_MOVE_CLEANUP, irq, vector, me); per_cpu(vector_irq, me)[vector] = ~irq; desc->arch.move_cleanup_count--; @@ -1939,7 +1937,7 @@ void do_IRQ(struct cpu_user_regs *regs) spin_unlock(&desc->lock); } } - TRACE_1D(TRC_HW_IRQ_UNMAPPED_VECTOR, vector); + TRACE_TIME(TRC_HW_IRQ_UNMAPPED_VECTOR, vector); } goto out_no_unlock; } @@ -1980,7 +1978,7 @@ void do_IRQ(struct cpu_user_regs *regs) tsc_in = tb_init_done ? get_cycles() : 0; do_IRQ_guest(desc, vector); - TRACE_3D(TRC_HW_IRQ_HANDLED, irq, tsc_in, get_cycles()); + TRACE_TIME(TRC_HW_IRQ_HANDLED, irq, tsc_in, get_cycles()); goto out_no_end; } @@ -2004,7 +2002,7 @@ void do_IRQ(struct cpu_user_regs *regs) tsc_in = tb_init_done ? get_cycles() : 0; action->handler(irq, action->dev_id, regs); - TRACE_3D(TRC_HW_IRQ_HANDLED, irq, tsc_in, get_cycles()); + TRACE_TIME(TRC_HW_IRQ_HANDLED, irq, tsc_in, get_cycles()); spin_lock_irq(&desc->lock); } diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 0cc1ee95cb5b..ca8374eadf9e 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -1881,7 +1881,7 @@ void do_device_not_available(struct cpu_user_regs *regs) curr->arch.pv.ctrlreg[0] &= ~X86_CR0_TS; } else - TRACE_0D(TRC_PV_MATH_STATE_RESTORE); + TRACE_TIME(TRC_PV_MATH_STATE_RESTORE); #else ASSERT_UNREACHABLE(); #endif diff --git a/xen/common/domain.c b/xen/common/domain.c index 6ee5d033b0c2..e8672f86cc82 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -575,7 +575,7 @@ struct domain *domain_create(domid_t domid, hardware_domain = d; } - TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id); + TRACE_TIME(TRC_DOM0_DOM_ADD, d->domain_id); lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid); @@ -1141,7 +1141,7 @@ void domain_destroy(struct domain *d) if ( atomic_cmpxchg(&d->refcnt, 0, DOMAIN_DESTROYED) != 0 ) return; - TRACE_1D(TRC_DOM0_DOM_REM, d->domain_id); + TRACE_TIME(TRC_DOM0_DOM_REM, d->domain_id); /* Delete from task list and task hashtable. */ spin_lock(&domlist_update_lock); diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index fe1fc11b228e..7f1b2b010bc1 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -1271,7 +1271,7 @@ map_grant_ref( goto undo_out; } - TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, op->dom); + TRACE_TIME(TRC_MEM_PAGE_GRANT_MAP, op->dom); /* * All maptrack entry users check mt->flags first before using the @@ -1398,7 +1398,7 @@ unmap_common( return; } - TRACE_1D(TRC_MEM_PAGE_GRANT_UNMAP, dom); + TRACE_TIME(TRC_MEM_PAGE_GRANT_UNMAP, dom); rgt = rd->grant_table; @@ -2384,7 +2384,7 @@ gnttab_transfer( put_gfn(d, gop.mfn); #endif - TRACE_1D(TRC_MEM_PAGE_GRANT_TRANSFER, e->domain_id); + TRACE_TIME(TRC_MEM_PAGE_GRANT_TRANSFER, e->domain_id); /* Tell the guest about its new page frame. */ grant_read_lock(e->grant_table); diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index fe133cbf117c..37e1a17a888b 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -827,7 +827,7 @@ int sched_init_domain(struct domain *d, unsigned int poolid) return ret; SCHED_STAT_CRANK(dom_init); - TRACE_1D(TRC_SCHED_DOM_ADD, d->domain_id); + TRACE_TIME(TRC_SCHED_DOM_ADD, d->domain_id); rcu_read_lock(&sched_res_rculock); @@ -850,7 +850,7 @@ void sched_destroy_domain(struct domain *d) if ( d->cpupool ) { SCHED_STAT_CRANK(dom_destroy); - TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id); + TRACE_TIME(TRC_SCHED_DOM_REM, d->domain_id); rcu_read_lock(&sched_res_rculock); @@ -891,7 +891,7 @@ void vcpu_sleep_nosync(struct vcpu *v) unsigned long flags; spinlock_t *lock; - TRACE_2D(TRC_SCHED_SLEEP, v->domain->domain_id, v->vcpu_id); + TRACE_TIME(TRC_SCHED_SLEEP, v->domain->domain_id, v->vcpu_id); rcu_read_lock(&sched_res_rculock); @@ -920,7 +920,7 @@ void vcpu_wake(struct vcpu *v) spinlock_t *lock; struct sched_unit *unit = v->sched_unit; - TRACE_2D(TRC_SCHED_WAKE, v->domain->domain_id, v->vcpu_id); + TRACE_TIME(TRC_SCHED_WAKE, v->domain->domain_id, v->vcpu_id); rcu_read_lock(&sched_res_rculock); @@ -1429,7 +1429,7 @@ void vcpu_block(void) } else { - TRACE_2D(TRC_SCHED_BLOCK, v->domain->domain_id, v->vcpu_id); + TRACE_TIME(TRC_SCHED_BLOCK, v->domain->domain_id, v->vcpu_id); raise_softirq(SCHEDULE_SOFTIRQ); } } @@ -1502,7 +1502,7 @@ static long do_poll(struct sched_poll *sched_poll) if ( sched_poll->timeout != 0 ) set_timer(&v->poll_timer, sched_poll->timeout); - TRACE_2D(TRC_SCHED_BLOCK, d->domain_id, v->vcpu_id); + TRACE_TIME(TRC_SCHED_BLOCK, d->domain_id, v->vcpu_id); raise_softirq(SCHEDULE_SOFTIRQ); return 0; @@ -1530,7 +1530,7 @@ long vcpu_yield(void) SCHED_STAT_CRANK(vcpu_yield); - TRACE_2D(TRC_SCHED_YIELD, current->domain->domain_id, current->vcpu_id); + TRACE_TIME(TRC_SCHED_YIELD, current->domain->domain_id, current->vcpu_id); raise_softirq(SCHEDULE_SOFTIRQ); return 0; } @@ -1888,9 +1888,8 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) if ( copy_from_guest(&sched_shutdown, arg, 1) ) break; - TRACE_3D(TRC_SCHED_SHUTDOWN, - current->domain->domain_id, current->vcpu_id, - sched_shutdown.reason); + TRACE_TIME(TRC_SCHED_SHUTDOWN, current->domain->domain_id, + current->vcpu_id, sched_shutdown.reason); ret = domain_shutdown(current->domain, (u8)sched_shutdown.reason); break; @@ -1905,8 +1904,8 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) if ( copy_from_guest(&sched_shutdown, arg, 1) ) break; - TRACE_3D(TRC_SCHED_SHUTDOWN_CODE, - d->domain_id, current->vcpu_id, sched_shutdown.reason); + TRACE_TIME(TRC_SCHED_SHUTDOWN_CODE, d->domain_id, current->vcpu_id, + sched_shutdown.reason); spin_lock(&d->shutdown_lock); if ( d->shutdown_code == SHUTDOWN_CODE_INVALID ) @@ -2069,7 +2068,7 @@ long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op) rcu_read_lock(&sched_res_rculock); if ( (ret = sched_adjust_dom(dom_scheduler(d), d, op)) == 0 ) - TRACE_1D(TRC_SCHED_ADJDOM, d->domain_id); + TRACE_TIME(TRC_SCHED_ADJDOM, d->domain_id); rcu_read_unlock(&sched_res_rculock); @@ -2164,14 +2163,13 @@ static void sched_switch_units(struct sched_resource *sr, sr->curr = next; sr->prev = prev; - TRACE_3D(TRC_SCHED_SWITCH_INFPREV, prev->domain->domain_id, - prev->unit_id, now - prev->state_entry_time); - TRACE_4D(TRC_SCHED_SWITCH_INFNEXT, next->domain->domain_id, - next->unit_id, - (next->vcpu_list->runstate.state == RUNSTATE_runnable) ? - (now - next->state_entry_time) : 0, prev->next_time); - TRACE_4D(TRC_SCHED_SWITCH, prev->domain->domain_id, prev->unit_id, - next->domain->domain_id, next->unit_id); + TRACE_TIME(TRC_SCHED_SWITCH_INFPREV, prev->domain->domain_id, + prev->unit_id, now - prev->state_entry_time); + TRACE_TIME(TRC_SCHED_SWITCH_INFNEXT, next->domain->domain_id, next->unit_id, + (next->vcpu_list->runstate.state == RUNSTATE_runnable) ? + (now - next->state_entry_time) : 0, prev->next_time); + TRACE_TIME(TRC_SCHED_SWITCH, prev->domain->domain_id, prev->unit_id, + next->domain->domain_id, next->unit_id); ASSERT(!unit_running(next)); @@ -2363,10 +2361,10 @@ static void sched_context_switch(struct vcpu *vprev, struct vcpu *vnext, { if ( unlikely(vprev == vnext) ) { - TRACE_4D(TRC_SCHED_SWITCH_INFCONT, - vnext->domain->domain_id, vnext->sched_unit->unit_id, - now - vprev->runstate.state_entry_time, - vprev->sched_unit->next_time); + TRACE_TIME(TRC_SCHED_SWITCH_INFCONT, + vnext->domain->domain_id, vnext->sched_unit->unit_id, + now - vprev->runstate.state_entry_time, + vprev->sched_unit->next_time); sched_context_switched(vprev, vnext); /* diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c index f277fa37a8b1..0ea7145172ee 100644 --- a/xen/common/sched/credit.c +++ b/xen/common/sched/credit.c @@ -842,8 +842,7 @@ _csched_cpu_pick(const struct scheduler *ops, const struct sched_unit *unit, if ( commit && spc ) spc->idle_bias = cpu; - TRACE_3D(TRC_CSCHED_PICKED_CPU, unit->domain->domain_id, unit->unit_id, - cpu); + TRACE_TIME(TRC_CSCHED_PICKED_CPU, unit->domain->domain_id, unit->unit_id, cpu); return cpu; } @@ -887,8 +886,8 @@ __csched_unit_acct_start(struct csched_private *prv, struct csched_unit *svc) } } - TRACE_3D(TRC_CSCHED_ACCOUNT_START, sdom->dom->domain_id, - svc->unit->unit_id, sdom->active_unit_count); + TRACE_TIME(TRC_CSCHED_ACCOUNT_START, sdom->dom->domain_id, + svc->unit->unit_id, sdom->active_unit_count); spin_unlock_irqrestore(&prv->lock, flags); } @@ -913,8 +912,8 @@ __csched_unit_acct_stop_locked(struct csched_private *prv, list_del_init(&sdom->active_sdom_elem); } - TRACE_3D(TRC_CSCHED_ACCOUNT_STOP, sdom->dom->domain_id, - svc->unit->unit_id, sdom->active_unit_count); + TRACE_TIME(TRC_CSCHED_ACCOUNT_STOP, sdom->dom->domain_id, + svc->unit->unit_id, sdom->active_unit_count); } static void @@ -937,8 +936,8 @@ csched_unit_acct(struct csched_private *prv, unsigned int cpu) if ( svc->pri == CSCHED_PRI_TS_BOOST ) { svc->pri = CSCHED_PRI_TS_UNDER; - TRACE_2D(TRC_CSCHED_BOOST_END, svc->sdom->dom->domain_id, - svc->unit->unit_id); + TRACE_TIME(TRC_CSCHED_BOOST_END, svc->sdom->dom->domain_id, + svc->unit->unit_id); } /* @@ -1145,8 +1144,7 @@ csched_unit_wake(const struct scheduler *ops, struct sched_unit *unit) if ( !migrating && svc->pri == CSCHED_PRI_TS_UNDER && !test_bit(CSCHED_FLAG_UNIT_PARKED, &svc->flags) ) { - TRACE_2D(TRC_CSCHED_BOOST_START, unit->domain->domain_id, - unit->unit_id); + TRACE_TIME(TRC_CSCHED_BOOST_START, unit->domain->domain_id, unit->unit_id); SCHED_STAT_CRANK(unit_boost); svc->pri = CSCHED_PRI_TS_BOOST; } @@ -1647,8 +1645,8 @@ csched_runq_steal(int peer_cpu, int cpu, int pri, int balance_step) if ( __csched_unit_is_migrateable(prv, unit, cpu, cpumask_scratch) ) { /* We got a candidate. Grab it! */ - TRACE_3D(TRC_CSCHED_STOLEN_UNIT, peer_cpu, - unit->domain->domain_id, unit->unit_id); + TRACE_TIME(TRC_CSCHED_STOLEN_UNIT, peer_cpu, + unit->domain->domain_id, unit->unit_id); SCHED_UNIT_STAT_CRANK(speer, migrate_q); SCHED_STAT_CRANK(migrate_queued); runq_remove(speer); @@ -1751,7 +1749,7 @@ csched_load_balance(struct csched_private *prv, int cpu, */ if ( CSCHED_PCPU(peer_cpu)->nr_runnable <= 1 ) { - TRACE_2D(TRC_CSCHED_STEAL_CHECK, peer_cpu, /* skipp'n */ 0); + TRACE_TIME(TRC_CSCHED_STEAL_CHECK, peer_cpu, /* skipp'n */ 0); goto next_cpu; } @@ -1767,11 +1765,11 @@ csched_load_balance(struct csched_private *prv, int cpu, if ( !lock ) { SCHED_STAT_CRANK(steal_trylock_failed); - TRACE_2D(TRC_CSCHED_STEAL_CHECK, peer_cpu, /* skip */ 0); + TRACE_TIME(TRC_CSCHED_STEAL_CHECK, peer_cpu, /* skip */ 0); goto next_cpu; } - TRACE_2D(TRC_CSCHED_STEAL_CHECK, peer_cpu, /* checked */ 1); + TRACE_TIME(TRC_CSCHED_STEAL_CHECK, peer_cpu, /* checked */ 1); /* Any work over there to steal? */ speer = cpumask_test_cpu(peer_cpu, online) ? @@ -1939,7 +1937,7 @@ static void csched_schedule( /* Tasklet work (which runs in idle UNIT context) overrides all else. */ if ( tasklet_work_scheduled ) { - TRACE_0D(TRC_CSCHED_SCHED_TASKLET); + TRACE_TIME(TRC_CSCHED_SCHED_TASKLET); snext = CSCHED_UNIT(sched_idle_unit(sched_cpu)); snext->pri = CSCHED_PRI_TS_BOOST; } diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c index b93895d4dddc..bc3e62bdeadd 100644 --- a/xen/drivers/cpufreq/utility.c +++ b/xen/drivers/cpufreq/utility.c @@ -367,7 +367,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, retval = alternative_call(cpufreq_driver.target, policy, target_freq, relation); if ( retval == 0 ) - TRACE_2D(TRC_PM_FREQ_CHANGE, prev_freq/1000, policy->cur/1000); + TRACE_TIME(TRC_PM_FREQ_CHANGE, prev_freq / 1000, policy->cur / 1000); } return retval; From patchwork Mon Sep 20 19:33:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83A85C433F5 for ; Mon, 20 Sep 2021 19:33:24 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 313F161107 for ; Mon, 20 Sep 2021 19:33:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 313F161107 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191161.341095 (Exim 4.92) (envelope-from ) id 1mSP2Q-0002EZ-4u; Mon, 20 Sep 2021 19:33:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191161.341095; Mon, 20 Sep 2021 19:33:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSP2Q-0002EJ-1u; Mon, 20 Sep 2021 19:33:14 +0000 Received: by outflank-mailman (input) for mailman id 191161; Mon, 20 Sep 2021 19:33:13 +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 1mSP2P-000298-CJ for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 19:33:13 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 973eb1fe-1a49-11ec-b881-12813bfff9fa; Mon, 20 Sep 2021 19:33:11 +0000 (UTC) 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: 973eb1fe-1a49-11ec-b881-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632166391; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=98GnhCIOxU7shHKzdhEM8QcX53MmCZ5qPUFcPyknb0s=; b=DClUa4xBKYFRzapTkkrXOFwvVJUBkiKUlWM7RZuGA1UpN5RClkmUqo97 j3myFr7uR0FpCVPjDsuhrLYVvMZAMjlpeZcZJ8tLq7NvsXREvMA5UPnb0 ngWKhs6yuyRkZhCeCCUou75sfAffEHDyeNR+fXIjg4BxBLp1v682XDOnm Y=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 18ghwp3hTIE02UOptrisiyJXOfrmU4+e1UJkVU82XqzW1YU9fFModr+qxHIBOYp8+ApcJtxoWM jsaWhlikkwleIMiRevafQlENT9Gu7RO8Y377Qd/jkaDKVRac06Q0tw7mhHFQz36veMlDzkpWnh ZGjZEvI26zynzkQ32EVahDUa5n0dJeHKTf6dcskPNXy5JI0p857LYyRs7uHYjM1uI9Uhc5h37a 3VXy7AJux8LmHLJ9DBqqA20eMJRBK+/e/gx+eNtM5+7eyS7cLmIf9cysJ7EikN/+k3VWc+7q3w T8KlXkfW03cWGBtsG7hmkdBz X-SBRS: 5.1 X-MesageID: 54949821 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:RwOOl6Dip7TyqhVW//Xkw5YqxClBgxIJ4kV8jS/XYbTApDoq0jAGy WIdWmjUMquPNGSkKd8gO4Xn9hgFsZHWyoIyQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMo/u1Si6FatANl1ElvU2zbue6WLOs1hxZH1c+EX9w00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J4NLtYiDm6DIKUnisrcI7r rD5jlHbTJMPSh5MFsHTbP7znVq9sWJEwLB5XlfSI8kVc0LpqdA4Jyv0h/4xAscNNRScmWfKi 1fIWU8V/LCfrZU0/d/FgbG/g72oS+YuTFBHG2T77KqtMXWI9GSU3oIdAv2DeirQVT2o9fz6N /lV1fz1LNYOgE1O79hnC79uwK8zu4nvqrtdwlg2FXnHdQ32WLZpI33A1shTrKxdgLRevFLuC E6I/9BbP5SPOd/kTwFNdFZ0MLzb2KFGgCTW4NQ0PF7+tX1+87ewWElPOwWB1X5GJ7xvPYJ5m eostab6MeBkZsbG5jpesh1pyg== IronPort-HdrOrdr: A9a23:XMuYAapEn5Bd2Xji/GtKwiAaV5opeYIsimQD101hICG8cqSj+f xG/c5rrCMc5wxwZJhNo7y90ey7MBbhHP1OkO8s1NWZLWrbUQKTRekIh+bfKn/baknDH4ZmpM BdmsNFaeEYY2IUsS+D2njbL+od X-IronPort-AV: E=Sophos;i="5.85,309,1624334400"; d="scan'208";a="54949821" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Stefano Stabellini , Wei Liu , Julien Grall Subject: [PATCH v2.1 15/12] xen/trace: Drop old trace macros Date: Mon, 20 Sep 2021 20:33:02 +0100 Message-ID: <20210920193302.20275-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 With all users updated to the new API, drop the old API. This includes all of asm/hvm/trace.h, which allows us to drop some includes. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall v2.1: * New --- xen/arch/x86/hvm/emulate.c | 1 - xen/arch/x86/hvm/hpet.c | 1 - xen/arch/x86/hvm/hvm.c | 1 - xen/arch/x86/hvm/io.c | 1 - xen/arch/x86/hvm/svm/intr.c | 1 - xen/arch/x86/hvm/svm/svm.c | 1 - xen/arch/x86/hvm/vmx/intr.c | 1 - xen/arch/x86/hvm/vmx/vmx.c | 1 - xen/include/asm-x86/hvm/trace.h | 114 -------------------------------------- xen/include/asm-x86/hvm/vmx/vmx.h | 1 - xen/include/xen/trace.h | 35 ------------ 11 files changed, 158 deletions(-) delete mode 100644 xen/include/asm-x86/hvm/trace.h diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index f863a19df311..a651dd395b56 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c index 5873bb8a506d..1736b8f12583 100644 --- a/xen/arch/x86/hvm/hpet.c +++ b/xen/arch/x86/hvm/hpet.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index fa211d14afd8..5a81ffe9dc41 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -62,7 +62,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index 046a8eb4ed1b..9be206488043 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c index 122c9d7fbf14..154258c8b31f 100644 --- a/xen/arch/x86/hvm/svm/intr.c +++ b/xen/arch/x86/hvm/svm/intr.c @@ -37,7 +37,6 @@ #include #include #include -#include static void svm_inject_nmi(struct vcpu *v) { diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index b98a2dd71d1e..1f9dadaa173a 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -55,7 +55,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c index 303d07dc0a3a..ed17c79996c5 100644 --- a/xen/arch/x86/hvm/vmx/intr.c +++ b/xen/arch/x86/hvm/vmx/intr.c @@ -36,7 +36,6 @@ #include #include #include -#include #include /* diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 47a5df20ebc1..4f99fda8d662 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/include/asm-x86/hvm/trace.h b/xen/include/asm-x86/hvm/trace.h deleted file mode 100644 index 696e42eb9499..000000000000 --- a/xen/include/asm-x86/hvm/trace.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef __ASM_X86_HVM_TRACE_H__ -#define __ASM_X86_HVM_TRACE_H__ - -#include - -#define DEFAULT_HVM_TRACE_ON 1 -#define DEFAULT_HVM_TRACE_OFF 0 - -#define DEFAULT_HVM_VMSWITCH DEFAULT_HVM_TRACE_ON -#define DEFAULT_HVM_PF DEFAULT_HVM_TRACE_ON -#define DEFAULT_HVM_INJECT DEFAULT_HVM_TRACE_ON -#define DEFAULT_HVM_IO DEFAULT_HVM_TRACE_ON -#define DEFAULT_HVM_REGACCESS DEFAULT_HVM_TRACE_ON -#define DEFAULT_HVM_MISC DEFAULT_HVM_TRACE_ON -#define DEFAULT_HVM_INTR DEFAULT_HVM_TRACE_ON - -#define DO_TRC_HVM_VMENTRY DEFAULT_HVM_VMSWITCH -#define DO_TRC_HVM_VMEXIT DEFAULT_HVM_VMSWITCH -#define DO_TRC_HVM_VMEXIT64 DEFAULT_HVM_VMSWITCH -#define DO_TRC_HVM_PF_XEN DEFAULT_HVM_PF -#define DO_TRC_HVM_PF_XEN64 DEFAULT_HVM_PF -#define DO_TRC_HVM_PF_INJECT DEFAULT_HVM_PF -#define DO_TRC_HVM_PF_INJECT64 DEFAULT_HVM_PF -#define DO_TRC_HVM_INJ_EXC DEFAULT_HVM_INJECT -#define DO_TRC_HVM_INJ_VIRQ DEFAULT_HVM_INJECT -#define DO_TRC_HVM_REINJ_VIRQ DEFAULT_HVM_INJECT -#define DO_TRC_HVM_INTR_WINDOW DEFAULT_HVM_INJECT -#define DO_TRC_HVM_IO_READ DEFAULT_HVM_IO -#define DO_TRC_HVM_IO_WRITE DEFAULT_HVM_IO -#define DO_TRC_HVM_CR_READ DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_CR_READ64 DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_CR_WRITE DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_CR_WRITE64 DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_DR_READ DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_DR_WRITE DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_XCR_READ64 DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_XCR_WRITE64 DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_MSR_READ DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_MSR_WRITE DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_RDTSC DEFAULT_HVM_REGACCESS -#define DO_TRC_HVM_CPUID DEFAULT_HVM_MISC -#define DO_TRC_HVM_INTR DEFAULT_HVM_INTR -#define DO_TRC_HVM_NMI DEFAULT_HVM_INTR -#define DO_TRC_HVM_MCE DEFAULT_HVM_INTR -#define DO_TRC_HVM_SMI DEFAULT_HVM_INTR -#define DO_TRC_HVM_VMMCALL DEFAULT_HVM_MISC -#define DO_TRC_HVM_HLT DEFAULT_HVM_MISC -#define DO_TRC_HVM_INVLPG DEFAULT_HVM_MISC -#define DO_TRC_HVM_INVLPG64 DEFAULT_HVM_MISC -#define DO_TRC_HVM_IO_ASSIST DEFAULT_HVM_MISC -#define DO_TRC_HVM_MMIO_ASSIST DEFAULT_HVM_MISC -#define DO_TRC_HVM_CLTS DEFAULT_HVM_MISC -#define DO_TRC_HVM_LMSW DEFAULT_HVM_MISC -#define DO_TRC_HVM_LMSW64 DEFAULT_HVM_MISC -#define DO_TRC_HVM_REALMODE_EMULATE DEFAULT_HVM_MISC -#define DO_TRC_HVM_TRAP DEFAULT_HVM_MISC -#define DO_TRC_HVM_TRAP_DEBUG DEFAULT_HVM_MISC -#define DO_TRC_HVM_VLAPIC DEFAULT_HVM_MISC - - -#define TRC_PAR_LONG(par) ((par)&0xFFFFFFFF),((par)>>32) - -#define TRACE_2_LONG_2D(_e, d1, d2, ...) \ - TRACE_4D(_e, d1, d2) -#define TRACE_2_LONG_3D(_e, d1, d2, d3, ...) \ - TRACE_5D(_e, d1, d2, d3) -#define TRACE_2_LONG_4D(_e, d1, d2, d3, d4, ...) \ - TRACE_6D(_e, d1, d2, d3, d4) - -#define HVMTRACE_ND(evt, modifier, cycles, ...) \ - do { \ - if ( unlikely(tb_init_done) && DO_TRC_HVM_ ## evt ) \ - { \ - uint32_t _d[] = { __VA_ARGS__ }; \ - __trace_var(TRC_HVM_ ## evt | (modifier), cycles, \ - sizeof(_d), sizeof(_d) ? _d : NULL); \ - } \ - } while(0) - -#define HVMTRACE_6D(evt, d1, d2, d3, d4, d5, d6) \ - HVMTRACE_ND(evt, 0, 0, d1, d2, d3, d4, d5, d6) -#define HVMTRACE_5D(evt, d1, d2, d3, d4, d5) \ - HVMTRACE_ND(evt, 0, 0, d1, d2, d3, d4, d5) -#define HVMTRACE_4D(evt, d1, d2, d3, d4) \ - HVMTRACE_ND(evt, 0, 0, d1, d2, d3, d4) -#define HVMTRACE_3D(evt, d1, d2, d3) \ - HVMTRACE_ND(evt, 0, 0, d1, d2, d3) -#define HVMTRACE_2D(evt, d1, d2) \ - HVMTRACE_ND(evt, 0, 0, d1, d2) -#define HVMTRACE_1D(evt, d1) \ - HVMTRACE_ND(evt, 0, 0, d1) -#define HVMTRACE_0D(evt) \ - HVMTRACE_ND(evt, 0, 0) - -#define HVMTRACE_LONG_1D(evt, d1) \ - HVMTRACE_2D(evt ## 64, (d1) & 0xFFFFFFFF, (d1) >> 32) -#define HVMTRACE_LONG_2D(evt, d1, d2, ...) \ - HVMTRACE_3D(evt ## 64, d1, d2) -#define HVMTRACE_LONG_3D(evt, d1, d2, d3, ...) \ - HVMTRACE_4D(evt ## 64, d1, d2, d3) -#define HVMTRACE_LONG_4D(evt, d1, d2, d3, d4, ...) \ - HVMTRACE_5D(evt ## 64, d1, d2, d3, d4) - -#endif /* __ASM_X86_HVM_TRACE_H__ */ - -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h index 85530d2e0e26..2987d5870606 100644 --- a/xen/include/asm-x86/hvm/vmx/vmx.h +++ b/xen/include/asm-x86/hvm/vmx/vmx.h @@ -25,7 +25,6 @@ #include #include #include -#include #include extern int8_t opt_ept_exec_sp; diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h index 72c20550f6a6..940be79d7b8e 100644 --- a/xen/include/xen/trace.h +++ b/xen/include/xen/trace.h @@ -97,39 +97,4 @@ static inline void __trace_hypercall(uint32_t event, unsigned long op, /* Create a trace record with no time included. */ #define TRACE(_e, ...) TRACE_INTERNAL(_e, false, ##__VA_ARGS__) - -/* Convenience macros for calling the trace function. */ -#define TRACE_0D(_e) \ - do { \ - trace_var(_e, 1, 0, NULL); \ - } while ( 0 ) - -/* Common helper for TRACE_{1..6}D() below. */ -#define TRACE_varD(_e, ...) \ - do { \ - if ( unlikely(tb_init_done) ) \ - { \ - uint32_t _d[] = { __VA_ARGS__ }; \ - __trace_var(_e, true, sizeof(_d), _d); \ - } \ - } while ( 0 ) - -#define TRACE_1D(_e, d1) \ - TRACE_varD(_e, d1) - -#define TRACE_2D(_e, d1, d2) \ - TRACE_varD(_e, d1, d2) - -#define TRACE_3D(_e, d1, d2, d3) \ - TRACE_varD(_e, d1, d2, d3) - -#define TRACE_4D(_e, d1, d2, d3, d4) \ - TRACE_varD(_e, d1, d2, d3, d4) - -#define TRACE_5D(_e, d1, d2, d3, d4, d5) \ - TRACE_varD(_e, d1, d2, d3, d4, d5) - -#define TRACE_6D(_e, d1, d2, d3, d4, d5, d6) \ - TRACE_varD(_e, d1, d2, d3, d4, d5, d6) - #endif /* __XEN_TRACE_H__ */ From patchwork Mon Sep 20 19:40:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 12506279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3344C433EF for ; Mon, 20 Sep 2021 19:41:13 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD98260EE2 for ; Mon, 20 Sep 2021 19:41:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AD98260EE2 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.191173.341105 (Exim 4.92) (envelope-from ) id 1mSP9x-0003vd-VV; Mon, 20 Sep 2021 19:41:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 191173.341105; Mon, 20 Sep 2021 19:41:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSP9x-0003vW-Sa; Mon, 20 Sep 2021 19:41:01 +0000 Received: by outflank-mailman (input) for mailman id 191173; Mon, 20 Sep 2021 19:41:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSP9w-0003vQ-QA for xen-devel@lists.xenproject.org; Mon, 20 Sep 2021 19:41:00 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 44ece320-adcc-4bbb-a0aa-a55416f63440; Mon, 20 Sep 2021 19:40:59 +0000 (UTC) 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: 44ece320-adcc-4bbb-a0aa-a55416f63440 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632166859; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q5RosjG14jEcDjoqHjZaARZmPLrzC7t3kj65ZG4GA9g=; b=Dy+mwlfDbzTxGZtP8Zo7VcWgLIMBssk+wab63M26Pn/AkFWHCkr/jxpg qPKhlSzulWMrQL7MfuMniI4tcH9+TpcC5n5GE2tAxQAt4+r8ObubVFe54 9uvW9VSZB+DqtHfHe2dbQIwsObADcwOFRhw4oKBjIHnwD0XgxuF/UkAP1 c=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: URdGVb4GDUGZmnJleHI618yPWG0cdyYQiacFP0IJpJY8+pBE7XzjDkW/ypCObR2QjuRzt/RBYX +Kjl2PWqm9jQh4NyWoxoprF/Blj/VuKGDWBpKpX3bcTKvq+EbSeDcHwYtA3ttA5yCP5Ymz3LFK +zp6ZEtANWhlkRUlypCgcXPsRSWijLNx494Le+IASKcUE/bTWOEHoYRIFo9BWE/PtBTN77ElSI RNZ8483mEoBM1I6Sh3pwQBRF2CM92T/yiKD4ksdvLpnoHzRbsgQwJHa9hZCKGTezM+m+Rb03PT /OIfM9Z0VdsSf6hxvFuQ8yGf X-SBRS: 5.1 X-MesageID: 53173829 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:ybOnE6z02LYk0g8q9Md6t+fTwSrEfRIJ4+MujC+fZmUNrF6WrkVWy mIWUDqPM//Ya2SgfN13bI/i/UME75SAn9RkTQRv+yAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnvopW1TYhSEUOZugH9IQM8aZfHAsLeNYYH1500s7yrRh2tUAbeWRWGthh /uj+6UzB3f9s9JEGjp8B3Wr8U4HUFza4Vv0j3RmDRx5lAa2e0o9VfrzEZqZPXrgKrS4K8bhL wr1IBNVyUuCl/slIovNfr8W6STmSJaKVeSFoiI+t6RPHnGuD8H9u0o2HKN0VKtZt9mGt+97m e1DtpKec1kgHrLgmfYcVUgDNj4raMWq+JefSZS+mcmazkmAeHrw2fR+SkoxOOX0+M4uXzsIr 6ZBbmlQMFbT3Ipaw5riIgVoru0lINPmI8U0vXZ4wCuCJf0nXYrCU+PB4towMDIY25sXQq2OP ZtxhTxHayXKWThJBgYuKallhOqitnTGawdZpwfAzUYwyzeKl1EguFT3C/LKfvSaSMMTmVy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Port-HdrOrdr: A9a23:l7kHParxj+UfTNl9lIUuG0UaV5oReYIsimQD101hICG8cqSj9v xG+85rrSMc6QxhIU3I9urwW5VoLUmyyXcx2/h0AV7AZniBhILLFvAB0WKK+VSJcEeSmtK1l5 0QFJSWYOeAdmSS5vyb3ODXKbgdKaG8gcWVuds= X-IronPort-AV: E=Sophos;i="5.85,309,1624334400"; d="scan'208";a="53173829" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH v2.1 16/12] xen/trace: Restrict CONFIG_TRACEBUFFER to x86 PV Date: Mon, 20 Sep 2021 20:40:33 +0100 Message-ID: <20210920194033.25998-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210920172529.24932-1-andrew.cooper3@citrix.com> References: <20210920172529.24932-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 The mapping interface can only be used by x86 PV guests. This can and should be fixed by changing to an acquire_resource() based interface, which is compatbile with x86 PVH and ARM dom0's, but until this happens, don't give the impression of this feature being useable elsewhere. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk --- xen/common/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index db687b1785e7..6b6f7139e6f0 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -429,6 +429,7 @@ config DTB_FILE config TRACEBUFFER bool "Enable tracing infrastructure" if EXPERT + depends on PV default y ---help--- Enable tracing infrastructure and pre-defined tracepoints within Xen.