[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Missing "\n" in dump_softtsc() from xen/arch/x86/time.c



When doing "xl debug-key s; xl dmesg | tail" as instructed for checking
TSC emulation mode on x86, I always see this line unterminated:

(XEN) dom2(hvm): mode=0,ofs=0x204b1518d4d,khz=2672736,inc=1

Apparently, the cause is simple: in xen/arch/x86/time.c there is

static void dump_softtsc(unsigned char key)
{
    // ... (skipped) ...
    for_each_domain ( d )
    {
        if ( is_hardware_domain(d) && d->arch.tsc_mode == TSC_MODE_DEFAULT )
            continue;
        printk("dom%u%s: mode=%d",d->domain_id,
                is_hvm_domain(d) ? "(hvm)" : "", d->arch.tsc_mode);
        if ( d->arch.vtsc_offset )
            printk(",ofs=%#"PRIx64, d->arch.vtsc_offset);
        if ( d->arch.tsc_khz )
            printk(",khz=%"PRIu32, d->arch.tsc_khz);
        if ( d->arch.incarnation )
            printk(",inc=%"PRIu32, d->arch.incarnation);
#if !defined(NDEBUG) || defined(CONFIG_PERF_COUNTERS)
        if ( !(d->arch.vtsc_kerncount | d->arch.vtsc_usercount) )
            printk("\n");
        else
            printk(",vtsc count: %"PRIu64" kernel, %"PRIu64" user\n",
                   d->arch.vtsc_kerncount, d->arch.vtsc_usercount);
#endif
        domcnt++;
    }
    // ... (skipped) ...
}

That is, "\n" is only output in debug builds. Please, add an unconditional
printk("\n") in #else clause for regular builds. Following is my formal
patch proposal, but it is so trivial that you better reimplement that
yourself as your rules mandate, with all that "Signed-off-by" and other
cool git-related and legal-related stuff. Thanks in advance.



From dac74660f526436ecc6a2fa0101ec81f6822eb66 Mon Sep 17 00:00:00 2001
From: Anton Samsonov <devel@xxxxxxxx>
Date: Sat, 10 Dec 2016 18:51:38 +0300
Subject: [PATCH] x86/time: Fix missing "\n" in non-debug log.

On x86, when dumping the emulated TSC information to dmesg, the line

    dom%u%s: mode=%d,ofs=0#ul,khz=%u,inc=%u

is formed by several conditional statements, possibly followed by other
printk() calls which ultimately end the line with "\n", but only in debug
builds or with performance counters enabled, - in regular builds, however,
the line stays unfinished and continued by further output.

This patch adds such final printk("\n") for regular builds, too.
---
 xen/arch/x86/time.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index dda89d8..d3e8fc3 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -2186,6 +2186,8 @@ static void dump_softtsc(unsigned char key)
         else
             printk(",vtsc count: %"PRIu64" kernel, %"PRIu64" user\n",
                    d->arch.vtsc_kerncount, d->arch.vtsc_usercount);
+#else
+        printk("\n");
 #endif
         domcnt++;
     }
-- 
2.10.2

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.