From patchwork Tue Oct 9 21:06:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael David Tinoco X-Patchwork-Id: 148525 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp29069lji; Tue, 9 Oct 2018 14:06:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV61viuuGMw6sBkwgjs26/VElpTy8Pd8wRoT53Lz+6vQfEFYiKKoTq8mqTRGz2/eM7Vo3ZG9N X-Received: by 2002:adf:83c3:: with SMTP id 61-v6mr20493979wre.5.1539119174441; Tue, 09 Oct 2018 14:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539119174; cv=none; d=google.com; s=arc-20160816; b=O+3SOKMTtVVtAVw+cObfYkZsedCe1rxwAbwbwCtiNA+WxIPtSI8hqfiIdmvd7lmPoA Tmz9CzF5pAN4942xCk4JCZ+fiQGdXQlt3pmwQmTzvfDFKLgQj26aDc3+EfuxZdmPXjXk +cUGvD8ZYjcA8MAHeWtXiVjvn32sSLG+EM/jJrjGEc0cH1JLBjJGSQqgixEhuber6Ja2 TfnEOaE8RDkvs/Ihv9LCLiYwa/rahqO0Rz0+9LJQ7WsvUCcIFxS2LBHoUh/7RKS8Y9LL dMkPJhnqm3+2SHonWIPCQxnGXjGtwzUJDWcIrq7C1LCunxDBfSRb6ALN8lMgvgOSomXr /oCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:delivered-to; bh=4IQcvY1PLgP4ODfrWAW4fLlCdX9zv9OieTZRznMCAgE=; b=Lw5Oa5QXbjfZuzjbJ4nSqxX77GStn2fYobDF/XQCNOTSDNeRKMGJFIN7VJiRvOyrFn QzsK5imLiiNtiXnI4mWZv3ji5t1DDS5IILpNXqcdwSFniRMRd56kVZL8rAogJwMzCTpK 0v9cGewD8NtOxW0pqkVKRLe0Tv56s7ZoHGsB9x9LcmLaGA0E/Ic2bdQYU/S13+WL4NVT xcLObL9un86KtG7/h6Rki7apQkmzpPnrUFlrY8lvAi7zAMh3sGCB1Cb4JN2ivlwM2ric icDvoJ5SN3afadtchWoKrdIPD7T+TxjOS6g/p2u+V38Gnspo07YxIjpqBQf/t4SgdmCj gjHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="QnB4P/Ck"; spf=pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 2001:1418:10:5::2 as permitted sender) smtp.mailfrom="ltp-bounces+patch=linaro.org@lists.linux.it"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from picard.linux.it (picard.linux.it. [2001:1418:10:5::2]) by mx.google.com with ESMTPS id h8-v6si15543650wrt.183.2018.10.09.14.06.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 14:06:14 -0700 (PDT) Received-SPF: pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 2001:1418:10:5::2 as permitted sender) client-ip=2001:1418:10:5::2; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="QnB4P/Ck"; spf=pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 2001:1418:10:5::2 as permitted sender) smtp.mailfrom="ltp-bounces+patch=linaro.org@lists.linux.it"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0B3BD3E7440 for ; Tue, 9 Oct 2018 23:06:14 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id C94E43E60BA for ; Tue, 9 Oct 2018 23:06:09 +0200 (CEST) Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id F3F611000C32 for ; Tue, 9 Oct 2018 23:06:07 +0200 (CEST) Received: by mail-qk1-x741.google.com with SMTP id a85-v6so1903038qkg.3 for ; Tue, 09 Oct 2018 14:06:07 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=erpltYkMiKVXmsisOMzwDmiF8vPonX0ds3PeEK972yU=; b=QnB4P/Ckd2JajpXprdburUHNWoE2d7BKc6XMj6dPzlvqoccbiUhyXMREQpIS2dJwgS oJDj7LJYY32DhitiUKFHGqllBEd9Yu51vlf7+NCEAELPDH8WE9PerU8FZy+Nt1gTgW/Z y+tpjGkw+rmpN/cQwaazDIIIYySNKOU3cf3mY= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=erpltYkMiKVXmsisOMzwDmiF8vPonX0ds3PeEK972yU=; b=Gwn4hOhbztCwmZtsihXAfSiHhF4yMPgcSi9gv8zmP3y79Ao+L6Py0PC2LkTEocKivN Eoauvp2676XXoqgEB7vXCw+nOgkGF/H7eOsCGvyWo8QqDWgxRhAZqgKS13aUt+aI2pSw 3JohHAEI3NNIr+mFWlt7vsLI8SVu2gHUCGwzxcLar9dc6eAcQ8vyC7jLPEHX/gb7pjkI gx8yULEyUYr3e67NUKDsJjWM9WSxUOORPmQ/gyTHbdcBazTyfP9cnsbyKZTVqoZ2wDNs USemhQhk4L0wfmFGzfMl00PMLtywVfa1wKQw0GzJ1JtfIZf8KvMtjPUr+TAKMlnezV24 lC8A== X-Gm-Message-State: ABuFfoi85HjUHCg1pzyPJELgkD3jAyNIK85LQUlNrCpcTl1jfBJr0DcO 0w1/GVyjzuYE0M/WXy4tAneS3zq2qTI= X-Received: by 2002:a37:8d06:: with SMTP id p6-v6mr23726410qkd.4.1539119166559; Tue, 09 Oct 2018 14:06:06 -0700 (PDT) Received: from workstation.celeiro.br ([138.204.25.12]) by smtp.gmail.com with ESMTPSA id k185-v6sm9895069qkd.27.2018.10.09.14.06.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 14:06:05 -0700 (PDT) From: Rafael David Tinoco To: ltp@lists.linux.it Date: Tue, 9 Oct 2018 18:06:02 -0300 Message-Id: <20181009210602.23261-1-rafael.tinoco@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <6903290a-523f-7130-b64f-d1a73b601c38@linaro.org> References: <6903290a-523f-7130-b64f-d1a73b601c38@linaro.org> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Cc: rafael.tinoco@linaro.org Subject: [LTP] [PATCH] futex/futex_wake04.c: fix issues with hugepages and usleep X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+patch=linaro.org@lists.linux.it Sender: "ltp" This commit fixes 2 observed issues: 1) usleep() time is too small if test is being executed in slower terminal devices (specially embedded systems). Raising it to 0.001 seconds was enough to finish 10240 iterations in around 90 seconds in a 4 vcpu kvm guest (fully emulated serial being used as console). 2) Test was changing number of hugepages during setup()/cleanup() phase despite the system had (or not) available hugepages. This was causing overhead of destroying (or creating) hugepages during the test execution. Now, if system has > 0 hugepages available, the test doesn't touch it. Link: https://bugs.linaro.org/show_bug.cgi?id=3984 Signed-off-by: Rafael David Tinoco --- testcases/kernel/syscalls/futex/futex_wake04.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/syscalls/futex/futex_wake04.c b/testcases/kernel/syscalls/futex/futex_wake04.c index 3c7038317..93d36ac33 100644 --- a/testcases/kernel/syscalls/futex/futex_wake04.c +++ b/testcases/kernel/syscalls/futex/futex_wake04.c @@ -76,14 +76,17 @@ static void setup(void) tst_tmpdir(); SAFE_FILE_SCANF(NULL, PATH_NR_HUGEPAGES, "%ld", &orig_hugepages); - SAFE_FILE_PRINTF(NULL, PATH_NR_HUGEPAGES, "%d", 1); + + if (!orig_hugepages) + SAFE_FILE_PRINTF(NULL, PATH_NR_HUGEPAGES, "%d", 1); TEST_PAUSE; } static void cleanup(void) { - SAFE_FILE_PRINTF(NULL, PATH_NR_HUGEPAGES, "%ld", orig_hugepages); + if (!orig_hugepages) + SAFE_FILE_PRINTF(NULL, PATH_NR_HUGEPAGES, "%d", 0); tst_rmdir(); } @@ -172,8 +175,9 @@ static void wakeup_thread2(void) tst_strerrno(res)); } + /* 0.001 seconds: less might cause lockups for slower terminals */ while (wait_for_threads(2)) - usleep(100); + usleep(1000); futex_wake(futex2, 1, 0);