From patchwork Sun Feb 3 13:40:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 157363 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2808232jaa; Sun, 3 Feb 2019 05:40:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN7aoFpTha2UEh8TTeBzXawxjD0UZq5G1prq2VGD6O44Sr4WgMcC+amYvsc1zhsv7P52NwmY X-Received: by 2002:a17:902:9a02:: with SMTP id v2mr48645282plp.180.1549201246978; Sun, 03 Feb 2019 05:40:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549201246; cv=none; d=google.com; s=arc-20160816; b=uKur7XRaGR1qB7B51pLIqdM8/dLfw3dW7gFBlGF+e20azst7IiRtImSIP6eGdB9cyB V+K1rpPz4ffhgHPiMUdNX3Did7drke2E9FnhFSFgcAD+CrP5ypKsn8dDRyKrSCVYjlF9 w8ne3mqJdCmfb9//trihtzPlMv0TGA/oMvi3z9/tCv3g2FHZ0k2r6JuC+GOl/qfMr9J7 25Q2HQK8PbhGmAs4R1GHRa58xYGA2M7d6VhAzSgQad0RXx45XzercH4GHdFniciYkCD+ ZhuPFFBJzqcLzHMYzWeCT1WrJwWcv8sl/9Co9+AgbYSSq6zxaA+VC7UWyLXhBbM3hXPh Y6lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VKySZkkI4XqwFjyt4DuiZf+0fTKw+MXXbKB8BaCZ13k=; b=f8oyFIZIqEq8s7Yx6PrSYYvhfiAoS3Lp7na/Ss1gzsBAGkAXTGFP1UM8Aoy9nUY3Fy sc8FFGQo0kh5VQRdm2WmyWlD5xBwbD4pDFSPEhDFd0EPP0p0J3FQ/4T4cWmumSUw3lK7 6MUAzdRF1FWogkGG3d1kb8kCF6E2wnBqYdRuQYzEhLJL1M7N96aV6Dtd4h/AcQHF386j 1c2mfvdc13yMamfQnYIT2gg1qxQAfKl53hOfZv0Yb59UFg7G+gGhJwlddonZBhygOPHw 6X+m2LAMMJs9KbBhex3mEHL8dW5Ze2Qa4kPbSTjQSekTvpAyR5IzWpz4DGYACZ93wm/z 3qvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=rMoGEuRa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a13si12462139pgh.561.2019.02.03.05.40.46; Sun, 03 Feb 2019 05:40:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=rMoGEuRa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727800AbfBCNkl (ORCPT + 31 others); Sun, 3 Feb 2019 08:40:41 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:57454 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbfBCNkk (ORCPT ); Sun, 3 Feb 2019 08:40:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VKySZkkI4XqwFjyt4DuiZf+0fTKw+MXXbKB8BaCZ13k=; b=rMoGEuRa5Ns7Sqj3C3wPhDndA+ DRllUrxjY2P7Pl6XtHB/CvviT+37/zwq7shrGySPhlonwsHe7Ql8HFTwdO8VkVKquCooankhnjxKe +GSVGtDTxVw5evEkkQA79x2N6bbhUhZjKrAbeeAQqPU79dGgcOIpCzTxSqZvrFDxPzpg=; Received: from [2001:67c:1810:f055:877d:5801:eba7:24a1] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gqI0a-0000WH-WB; Sun, 03 Feb 2019 13:40:29 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 90A91440083; Sun, 3 Feb 2019 13:40:26 +0000 (GMT) From: Mark Brown To: Shuah Khan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Andy Lutomirski Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-kselftest@vger.kernel.org, Mark Brown , Dan Rue Subject: [PATCH 2/2] selftests/x86/fsgsbase: Default to trying to run the test repeatedly Date: Sun, 3 Feb 2019 14:40:17 +0100 Message-Id: <20190203134017.9375-3-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190203134017.9375-1-broonie@kernel.org> References: <20190203134017.9375-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In automated testing it has been found that on many systems the fsgsbase test fails intermittently. This was reported and discussed a while back: https://lore.kernel.org/lkml/20180126153631.ha7yc33fj5uhitjo@xps/ with the analysis concluding that this is a hardware issue affecting a subset of systems but no fix has been merged as yet. As well as the actual problem found by testing the intermittent test failure is causing issues for the people doing the automated testing due to the noise. In order to make the testing stable modify the test program to iterate through the test repeatedly, choosing 5000 iterations based on prior reports and local testing. This unfortunately greatly increases the execution time for the selftests when things succeed which isn't great, in my local tests on a range of systems it pushes the execution time up to approximately a minute when no failures are encountered. Reported-by: Dan Rue Signed-off-by: Mark Brown --- tools/testing/selftests/x86/fsgsbase.c | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/tools/testing/selftests/x86/fsgsbase.c b/tools/testing/selftests/x86/fsgsbase.c index 6cda6daa1f8c..83410749ff1f 100644 --- a/tools/testing/selftests/x86/fsgsbase.c +++ b/tools/testing/selftests/x86/fsgsbase.c @@ -379,7 +379,7 @@ static void test_unexpected_base(void) } } -int main() +int test() { pthread_t thread; @@ -437,3 +437,28 @@ int main() return nerrs == 0 ? 0 : 1; } + +int main() +{ + int tries = 5000; + int i; + + if (tries > 1) + quiet = true; + + for (i = 0; i < tries; i++) { + if (test() != 0) + break; + } + + if (quiet) { + if (nerrs) { + printf("[FAIL] %d errors detected in %d tries\n", + nerrs, i + 1); + } else { + printf("[PASS] %d runs succeeded\n", i); + } + } + + return nerrs == 0 ? 0 : 1; +}