Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1626724pxb; Sat, 4 Sep 2021 16:18:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLsCCfNRej+BWkwVpG6kzZQ6B1ZmyWvw9KfnPrpi93VdGfnku34XPuDI098MnM+z+nheiM X-Received: by 2002:a17:906:3fc1:: with SMTP id k1mr6303602ejj.44.1630797503905; Sat, 04 Sep 2021 16:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630797503; cv=none; d=google.com; s=arc-20160816; b=aKn3QstcHfZf6NYQvwo69Q+YZJf+gpsHVH63V5fe4YqgIm1IzZ6O4Jyo3BlzAPwD1r sMFAg6rsag6BQpJfmsF99vHen74ul9zVTRmWeG8vwWhLEsA5uaOUl4GM9/Ea7U+PxzWJ zfGyWLrLVAR5b47EZhYG+YHxwJV4eAhazZTHFe0/b0o3C66ZTsjRdlO9LunYm29AHmYV ppbPcUN1m73SuwWpOEhOMRz4gY6gYXiGCnQb2q3PeMYqd5nSGxLiFx+TJ+ZlM8Fdsf9l 25IhpKSc8DPZjC7cOMV9RKpVRAkuyfhXSMQlqgKJRqC2X4WUDQzsSdOeFNaeGx498xFx iwKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=YbEz7hbR0vUTJcANoy2TUU8aIBHuxfll14EJQRAOdbQ=; b=ARjvdgXym6RwXK+d+m/L89CeSpR+AatsbV5a04MvRszJGBBec5Cy3e547Kb5P+btA2 PpE94yqTkiMvvi7yE7UcsqCbPRx2bxcolX/Dyn9RxXyGyOHqap5K3LTMKOct/OmSTCed QkC4fcSLrkF8YXAQrZ86uRTmgmHVtuYVUYce/+iuT1PRVTrbCGcnxW5yCnMFEGXmqlT2 VVzERe71zT328SKUoNgtJieHYx4DmDMXQzGa0pdiBWGTdiynZkAyReKK5o+iqMALGZ8N MHLfQAh0ZZ+aTKCZGxgSGDJtfC6WJFJE9m0tDojZsHBNTdHWb2Uu+CClQ8BHjwhCe2qC 6PIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd5si3942109ejc.375.2021.09.04.16.18.01; Sat, 04 Sep 2021 16:18:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237652AbhIDXNj (ORCPT + 99 others); Sat, 4 Sep 2021 19:13:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237586AbhIDXNh (ORCPT ); Sat, 4 Sep 2021 19:13:37 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D895C0613CF; Sat, 4 Sep 2021 16:12:35 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 3F1DE1F4210F From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Darren Hart , linux-kernel@vger.kernel.org, Steven Rostedt , Sebastian Andrzej Siewior Cc: kernel@collabora.com, krisman@collabora.com, linux-api@vger.kernel.org, libc-alpha@sourceware.org, mtk.manpages@gmail.com, Davidlohr Bueso , Arnd Bergmann , =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH v2 5/5] selftests: futex2: Test futex_waitv timeout Date: Sat, 4 Sep 2021 20:11:59 -0300 Message-Id: <20210904231159.13292-6-andrealmeid@collabora.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210904231159.13292-1-andrealmeid@collabora.com> References: <20210904231159.13292-1-andrealmeid@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Test if the futex_waitv timeout is working as expected, using the supported clockid options. Signed-off-by: André Almeida --- .../futex/functional/futex_wait_timeout.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/futex/functional/futex_wait_timeout.c b/tools/testing/selftests/futex/functional/futex_wait_timeout.c index 1f8f6daaf1e7..4cdada0fcb81 100644 --- a/tools/testing/selftests/futex/functional/futex_wait_timeout.c +++ b/tools/testing/selftests/futex/functional/futex_wait_timeout.c @@ -17,6 +17,7 @@ #include #include "futextest.h" +#include "futex2test.h" #include "logging.h" #define TEST_NAME "futex-wait-timeout" @@ -96,6 +97,12 @@ int main(int argc, char *argv[]) struct timespec to; pthread_t thread; int c; + struct futex_waitv waitv = { + .uaddr = (uintptr_t)&f1, + .val = f1, + .flags = FUTEX_32, + .__reserved = 0 + }; while ((c = getopt(argc, argv, "cht:v:")) != -1) { switch (c) { @@ -118,7 +125,7 @@ int main(int argc, char *argv[]) } ksft_print_header(); - ksft_set_plan(7); + ksft_set_plan(9); ksft_print_msg("%s: Block on a futex and wait for timeout\n", basename(argv[0])); ksft_print_msg("\tArguments: timeout=%ldns\n", timeout_ns); @@ -175,6 +182,18 @@ int main(int argc, char *argv[]) res = futex_lock_pi(&futex_pi, NULL, 0, FUTEX_CLOCK_REALTIME); test_timeout(res, &ret, "futex_lock_pi invalid timeout flag", ENOSYS); + /* futex_waitv with CLOCK_MONOTONIC */ + if (futex_get_abs_timeout(CLOCK_MONOTONIC, &to, timeout_ns)) + return RET_FAIL; + res = futex_waitv(&waitv, 1, 0, &to); + test_timeout(res, &ret, "futex_waitv monotonic", ETIMEDOUT); + + /* futex_waitv with CLOCK_REALTIME */ + if (futex_get_abs_timeout(CLOCK_REALTIME, &to, timeout_ns)) + return RET_FAIL; + res = futex_waitv(&waitv, 1, FUTEX_CLOCK_REALTIME, &to); + test_timeout(res, &ret, "futex_waitv realtime", ETIMEDOUT); + ksft_print_cnts(); return ret; } -- 2.33.0