From patchwork Fri Feb 26 13:15:30 2016 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: 63051 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp714429lbc; Fri, 26 Feb 2016 05:21:22 -0800 (PST) X-Received: by 10.140.99.69 with SMTP id p63mr1753285qge.97.1456492880115; Fri, 26 Feb 2016 05:21:20 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p199si13089336qhb.90.2016.02.26.05.21.19 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 26 Feb 2016 05:21:20 -0800 (PST) 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; 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; dkim=fail header.i=@linaro.org Received: from localhost ([::1]:49734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIKd-0008D4-IG for patch@linaro.org; Fri, 26 Feb 2016 08:21:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIFO-0008NE-93 for qemu-devel@nongnu.org; Fri, 26 Feb 2016 08:15:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZIFM-0004Fq-Ei for qemu-devel@nongnu.org; Fri, 26 Feb 2016 08:15:54 -0500 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:35112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIFM-0004Fl-50 for qemu-devel@nongnu.org; Fri, 26 Feb 2016 08:15:52 -0500 Received: by mail-wm0-x229.google.com with SMTP id c200so71915472wme.0 for ; Fri, 26 Feb 2016 05:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3l4am4n8evT6PjNI+PT0vY8DSmmI5LWhT3yVAjQwac4=; b=ikn1vYZnIjtiG2CU0vm4sRswO44pz7a0nxCNqOaUlHukEpqs/4ERP+KFOHnikNq9ok 9XSD77eeoKcRsVZXcpPcJG2BA6UoHFtmpKOhFO/GRHZaBER4qns3WwddJJI4f48aWx7x mxVcjDKtla60NL3zetnMG2seKK8M3vmagQCv4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3l4am4n8evT6PjNI+PT0vY8DSmmI5LWhT3yVAjQwac4=; b=ZRRLpj+9oS08tJDSitMHJvL1A0pZzEySG+kEyPLVIzLZyxZqdbTcimvJ53wc2EO/gS sEOPIULRvBoybZ7FxxwUP4/hYuDO23dBE7xMM/ADq8t0rFPClGi/lnbSUlCN2U50Qz3N 4WHSXMnoC5PUNDQXdNEUwnlE2xVW2jSODFYAkm1DONrEkC4vDPYUdvXpuZhK6uRq+SHb DxRCjkPRssec0/FTrHn2aQGms7CQI2nYoe6RtADba6VnseWfRDss3lWSlq88JbVtMDKz 9fUb8HqW5N3SQkD5K9tQVQOj+S8MdtQC2iGqCiK/0Nt9rEo+bqquPv7YKRqQaWhohYfZ e6sw== X-Gm-Message-State: AD7BkJJ8H5jaPAYYCDjYSz3Qmgzzi50y7ibNMyeflvhVArQqoHU4L3c8lnivXLP+LwUqI1AX X-Received: by 10.194.92.68 with SMTP id ck4mr1665268wjb.144.1456492551616; Fri, 26 Feb 2016 05:15:51 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id hh8sm12345125wjc.42.2016.02.26.05.15.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Feb 2016 05:15:46 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 7D14D3E0312; Fri, 26 Feb 2016 13:15:41 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: mttcg@listserver.greensocs.com, mark.burton@greensocs.com, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com Date: Fri, 26 Feb 2016 13:15:30 +0000 Message-Id: <1456492533-17171-9-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1456492533-17171-1-git-send-email-alex.bennee@linaro.org> References: <1456492533-17171-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::229 Cc: peter.maydell@linaro.org, drjones@redhat.com, a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, will.deacon@arm.com, crosthwaitepeter@gmail.com, pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net, rth@twiddle.net Subject: [Qemu-devel] [RFC 08/11] arm/tlbflush-test: Add TLB torture test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This adds a fairly brain dead torture test for TLB flushes intended for stressing the MTTCG QEMU build. It takes the usual -smp option for multiple CPUs. By default it CPU0 will do a TLBIALL flush after each cycle. You can pass options via -append to control additional aspects of the test: - "page" flush each page in turn (one per function) - "self" do the flush after each computation cycle - "verbose" report progress on each computation cycle Signed-off-by: Alex Bennée --- v2 - rename to tlbflush-test - made makefile changes cleaner - added self/other flush mode - create specific prefix - whitespace fixes v3 - using new SMP framework for test runing v4 - merge in the unitests.cfg --- arm/tlbflush-test.c | 194 +++++++++++++++++++++++++++++++++++++++++++ arm/unittests.cfg | 24 ++++++ config/config-arm-common.mak | 2 + 3 files changed, 220 insertions(+) create mode 100644 arm/tlbflush-test.c -- 2.7.1 diff --git a/arm/tlbflush-test.c b/arm/tlbflush-test.c new file mode 100644 index 0000000..0375ad9 --- /dev/null +++ b/arm/tlbflush-test.c @@ -0,0 +1,194 @@ +#include +#include +#include +#include +#include + +#define SEQ_LENGTH 10 +#define SEQ_HASH 0x7cd707fe + +static cpumask_t smp_test_complete; +static int flush_count = 1000000; +static int flush_self = 0; +static int flush_page = 0; +static int flush_verbose = 0; + +/* Work functions + * + * These work functions need to be: + * + * - page aligned, so we can flush one function at a time + * - have branches, so QEMU TCG generates multiple basic blocks + * - call across pages, so we exercise the TCG basic block slow path + */ + +/* Adler32 */ +__attribute__((aligned(PAGE_SIZE))) uint32_t hash_array(const void *buf, + size_t buflen) +{ + const uint8_t *data = (uint8_t *) buf; + uint32_t s1 = 1; + uint32_t s2 = 0; + + for (size_t n = 0; n < buflen; n++) { + s1 = (s1 + data[n]) % 65521; + s2 = (s2 + s1) % 65521; + } + return (s2 << 16) | s1; +} + +__attribute__((aligned(PAGE_SIZE))) void create_fib_sequence(int length, + unsigned int *array) +{ + int i; + + /* first two values */ + array[0] = 0; + array[1] = 1; + for (i=2; i