From patchwork Fri Jul 31 15:53:57 2015 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: 51792 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id B24BF22D9C for ; Fri, 31 Jul 2015 16:03:06 +0000 (UTC) Received: by lbbyj8 with SMTP id yj8sf6061258lbb.3 for ; Fri, 31 Jul 2015 09:03:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding:cc :subject:precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=aZPsbh6I09qhllDCArQZ45B2LiB9cWOs7bdmGCkSFHg=; b=AWXsRWC9ZD2iZQXg33KxFfGO5U+OYnwZFRk1H1UeI/DwyrZVzrYCqAS+SZQudnfl20 JdLcwxGfQd/OfD2VsKqspBEWhOEsVFJCy4v49/T7I9hJhhBALg1IMNH6rNfRkMEAbAKS USExLgT11P5+aJO1UNy90e89ZR7C/pUoO+r2hcZnSgbI1LJ2FO1gCUk+WKXOP4koqXjx 7oRqGX323cKn1fXMy9w9+Co5ded7WAb1tar4Ulg7572eQi9vxchRSwqsiyhs6EFUFkEV zBynk9F/WMTpER6HnQeu5w5JBSaOycZW3axjT+/inN8QjU1tU3NDB/91WXhLYa3tazg7 G1yg== X-Gm-Message-State: ALoCoQkaSsRKR5T0mNYk7AQCyFlXcsV0D4nprW3kxOINVZYPCp35bmkFtvlRxqk4SDHyEdvyzKz+ X-Received: by 10.112.87.69 with SMTP id v5mr1149245lbz.16.1438358585344; Fri, 31 Jul 2015 09:03:05 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.39 with SMTP id dd7ls335045lac.60.gmail; Fri, 31 Jul 2015 09:03:05 -0700 (PDT) X-Received: by 10.112.170.167 with SMTP id an7mr3820600lbc.103.1438358585205; Fri, 31 Jul 2015 09:03:05 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id rb8si4153310lbb.34.2015.07.31.09.03.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 09:03:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lacct8 with SMTP id ct8so13865281lac.2 for ; Fri, 31 Jul 2015 09:03:05 -0700 (PDT) X-Received: by 10.152.5.228 with SMTP id v4mr3838909lav.36.1438358585072; Fri, 31 Jul 2015 09:03:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp476943lba; Fri, 31 Jul 2015 09:03:04 -0700 (PDT) X-Received: by 10.140.22.73 with SMTP id 67mr5371519qgm.42.1438358583581; Fri, 31 Jul 2015 09:03:03 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h86si1911115qkh.107.2015.07.31.09.03.02 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 Jul 2015 09:03:03 -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; Received: from localhost ([::1]:45016 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCly-00084s-FL for patch@linaro.org; Fri, 31 Jul 2015 12:03:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCdp-0000z7-Kn for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZLCdh-0005ub-LC for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:54:37 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:37275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCdh-0005uO-DA for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:54:29 -0400 Received: by wibud3 with SMTP id ud3so37564190wib.0 for ; Fri, 31 Jul 2015 08:54:28 -0700 (PDT) X-Received: by 10.180.72.145 with SMTP id d17mr8433206wiv.69.1438358068590; Fri, 31 Jul 2015 08:54:28 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id wx9sm7815035wjb.6.2015.07.31.08.54.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 08:54:27 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 56C553E109E; Fri, 31 Jul 2015 16:54:23 +0100 (BST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: mttcg@listserver.greensocs.com, mark.burton@greensocs.com, fred.konrad@greensocs.com Date: Fri, 31 Jul 2015 16:53:57 +0100 Message-Id: <1438358041-18021-8-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1438358041-18021-1-git-send-email-alex.bennee@linaro.org> References: <1438358041-18021-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] [fuzzy] X-Received-From: 209.85.212.179 Cc: peter.maydell@linaro.org, drjones@redhat.com, kvm@vger.kernel.org, a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [Qemu-devel] [kvm-unit-tests PATCH v5 07/11] new arm/tlbflush-test: 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 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.bennee@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 --- arm/tlbflush-test.c | 194 +++++++++++++++++++++++++++++++++++++++++++ config/config-arm-common.mak | 7 +- 2 files changed, 198 insertions(+), 3 deletions(-) create mode 100644 arm/tlbflush-test.c 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