From patchwork Wed Nov 14 19:50:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 10683029 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0F0F139B for ; Wed, 14 Nov 2018 19:51:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C52092BEC4 for ; Wed, 14 Nov 2018 19:51:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B890A2BEE6; Wed, 14 Nov 2018 19:51:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 613852BED6 for ; Wed, 14 Nov 2018 19:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725756AbeKOFzo (ORCPT ); Thu, 15 Nov 2018 00:55:44 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:48156 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725791AbeKOFzh (ORCPT ); Thu, 15 Nov 2018 00:55:37 -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=SbIHJ6Qgb/UHyCHdpX/ITanH1IL6ffpfB5+IP7GGx3w=; b=TPVtcwuv9buopKaIpi9AnOXfyI 7pheUl2J9ylPqOXFwvb3/5VaGOdauuJJgGpFbEyRjDjIIqlMVK+J55aP+HXzqxqw3rK1O9qnjj4FT PVGekG429kZlqkjK/rTFQh4t392zzFvzkpwYVfIyECzUJdgQb0MM3hoTkviUj3Cw7pP4=; Received: from [64.114.255.97] (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 1gN1Bd-0004Ka-7D; Wed, 14 Nov 2018 19:50:53 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 0DB5144007A; Wed, 14 Nov 2018 19:50:47 +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, linux-kselftest@vger.kernel.org, x86@kernel.org, Mark Brown Subject: [PATCH RFC 2/2] selftests/x86/fsgsbase: Default to trying to run the test repeatedly Date: Wed, 14 Nov 2018 11:50:43 -0800 Message-Id: <20181114195043.8021-3-broonie@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114195043.8021-1-broonie@kernel.org> References: <20181114195043.8021-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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; +}