From patchwork Tue Apr 11 10:50:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 97236 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1748297qgd; Tue, 11 Apr 2017 03:52:15 -0700 (PDT) X-Received: by 10.237.42.98 with SMTP id k31mr61009354qtf.232.1491907935864; Tue, 11 Apr 2017 03:52:15 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 24si16069803qku.3.2017.04.11.03.52.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 11 Apr 2017 03:52:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxtPB-0004QG-FY for patch@linaro.org; Tue, 11 Apr 2017 06:52:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxtNT-0003Y8-Ci for qemu-devel@nongnu.org; Tue, 11 Apr 2017 06:50:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxtNQ-0004S6-Aj for qemu-devel@nongnu.org; Tue, 11 Apr 2017 06:50:27 -0400 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:34681) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cxtNQ-0004Rw-3o for qemu-devel@nongnu.org; Tue, 11 Apr 2017 06:50:24 -0400 Received: by mail-wr0-x234.google.com with SMTP id z109so26151911wrb.1 for ; Tue, 11 Apr 2017 03:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nlpqL77iMHG3cu2mlgZ3elawlLXLsEfQ/YYQFDXwjng=; b=PeZ7k3efjruxeME32gb4OpSHpvEuuI5zJTFQ1gD3+tY9lvmQ8c88vLKWrlIfxq4k0m hUoH3xVUbfzd++RNiXW54V/aA8VvR+RbYtMs9R8JFrT8IRA260BfsfJ1F2jH4p+rMfge rOqK5aXg5qG2OwJ7rpMyt4+g5tfc5ZGtmZ6X0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nlpqL77iMHG3cu2mlgZ3elawlLXLsEfQ/YYQFDXwjng=; b=Y09F4jFMDEoW9KJFuHE5E1kttL1nVnx3VQPzwqowsKBd9Qkc2GW6sDAKc4ONavAae8 mZ8tKpD4/BVRZ4L6DbECUs8PAUdky3IdE0rSTD4mlzAEYvi+H0eTWACKCaiaBWESWs+x xMl59DMwYd97GmdMF0H9mMX2aRJ5VzJB37y0ZtnEpdG7Gx1c888+LzHN/hH1NaXp6vV0 +eJ0wUgq1Tov1TkjVMwWUU8qLtw5qdOx4C5iNzxm3ydBPflJc1d+qKrVKzEKt+9uoiAR HZ/CXHEVhkE/Iox7Ixa6bCHvOfOkdlyxbenJ1ncKkVRKR3l0pt6SoWBVogxfqIWGpscE gGxQ== X-Gm-Message-State: AFeK/H2pJLPh0R/lY1LXdSj69oG6dqXasntBj/a6kwp8mYIJ/lkQ6Jpc8uAQrHfXZg6DMlCJ X-Received: by 10.223.136.56 with SMTP id d53mr28578648wrd.160.1491907822472; Tue, 11 Apr 2017 03:50:22 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a66sm21199790wrc.58.2017.04.11.03.50.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 03:50:21 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 169343E1103; Tue, 11 Apr 2017 11:50:31 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: bobby.prani@gmail.com, rth@twiddle.net, stefanha@redhat.com Date: Tue, 11 Apr 2017 11:50:28 +0100 Message-Id: <20170411105031.28904-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::234 Subject: [Qemu-devel] [PATCH v1 0/3] Fix cputlb flush stats and exporting data X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is mostly just an RFC for discussion as I know a number of GSoC projects will involve a degree of instrumentation and measurement of the internals of the TCG. The first patch just fixes and expands the counters. The second uses (abuses?) the trace mechanism to export the data via the simpletrace binary trace format. The final patch is a script that then allows us to plot the collected data. So this series raises a few questions/thoughts: - doing an atomic_inc(__ATOMIC_SEQ_CST) is inefficient It would probably be better to have per-thread counters that are summed when needed rather than enforcing sequential consistency on a global counter. - I could encode the events directly and count them in the script This would be more trace-like but we'd loose the counters in the MMI which is helpful on a live non-trace-enabled builds if you want to get an idea of whats happening. - Tracing is very event focused, would it be worth adding some sort of counter/sampling support? Currently the insertion of the trace_tlb_flushes() event in the entry to the run loop is a massive hack. Most of the time the numbers haven't changed. I could have just spawned a sampling helper on a main-loop timer but I feel this might be a use case thinking about for the tracing system. - timestamps could be replaced with icount for some analysis The icount mechanism would allow for a fairly fine grained matching of events to execution time in TCG. Maybe this could be an optional replacement? - The simpletrace binary format is more efficient than debug output One problem I have as a TCG hacker is the normal -d foo output is very verbose and generates massive logs. -dfilter was an attempt to make that easier but I'm quite happy with the trace approach. A boot and build takes only about 85M in trace files compared to the gigabytes a text file can take up. Alex Bennée (3): cputlb: fix and enhance TLB statistics cpus: dump TLB flush counts as trace event new script/analyse-tlb-flushes-simpletrace.py cpus.c | 6 +++ cputlb.c | 27 +++++++++++-- include/exec/cputlb.h | 4 +- scripts/analyse-tlb-flushes-simpletrace.py | 62 ++++++++++++++++++++++++++++++ trace-events | 3 ++ translate-all.c | 4 +- 6 files changed, 101 insertions(+), 5 deletions(-) create mode 100755 scripts/analyse-tlb-flushes-simpletrace.py -- 2.11.0