Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3148344pxb; Sat, 9 Oct 2021 03:09:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRTxphS66ST0PVSkMS6sbwmafhgVbsLxfcTuVm6ak6XMCbD9UocDgswWNEM2UcW88r3/0U X-Received: by 2002:a50:9347:: with SMTP id n7mr21736724eda.249.1633774149006; Sat, 09 Oct 2021 03:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633774148; cv=none; d=google.com; s=arc-20160816; b=U/MnqL4RfdGNoqCtBeuSnwucFotp3sYy1zIwzZI/v9Ytb9x+KDDVeyyRq3nEuQuRz0 FZpjFk5MsVL0pE2DwAZcA2k1WVxfJmSkHFNeHpCfiy1XA0hG2kG8TS5NwGCHbib6Mm+C PxjoCv5a5JHYkqfL3oVE8J5ONEBg8CCSe261TyPJZ4fGC26QSURTerydTosU6momZF2W ePdc4OdpLCjid7OD8AITM1R4F4YPDd6TfafHWBTvucs/5GAcYewhHkiFAth89GtmNTI6 E0DvFeqAcLEdF+c/UmusN/+2c8SrZp780JYuOZGSBEggv/tTxdtpwZVg+fP1v9zvRdNg SMYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=9wkUY0TfYQ7BXLB6nLTQglO5Wo6OEsOpDJApBAflki4=; b=F8TpduyZp1ZRufZ0HFCZJ1/FhGKqusvI0spGgZR+CTaEpFi+CnRGxlB/Ve1zgzJtp4 K0PaJAmU2nOWpzEk4DMukkkMOKHa5HAMUglEGh8NZy1w/gObBp42w9IWqwgWE0XEGFy5 LqTF+hP7r5oirNesbPY/8Hpr3SgbDugP6kqnfyukgKhpWZjl+Q/8cQZgRUHxHMyR/q+8 Lm3zkjhjPFOUhpLYoJ2W+zJVEyhhb3uYqs6vf5ioSlTUdLGS/YVn0xf3nKfs5tSIXwPY G8sgtUsJt5fIWG0r/S7z5UmMxMk4tEUB8n/fY3P28MZP5DlmgKMAEXuNfWlJ6F94zhwr 0GOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="ZC67GHE/"; dkim=neutral (no key) header.i=@linutronix.de; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si2731884edw.225.2021.10.09.03.08.45; Sat, 09 Oct 2021 03:09:08 -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; dkim=pass header.i=@linutronix.de header.s=2020 header.b="ZC67GHE/"; dkim=neutral (no key) header.i=@linutronix.de; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244575AbhJIKJM (ORCPT + 99 others); Sat, 9 Oct 2021 06:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244412AbhJIKJB (ORCPT ); Sat, 9 Oct 2021 06:09:01 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFB3BC061755; Sat, 9 Oct 2021 03:07:04 -0700 (PDT) Date: Sat, 09 Oct 2021 10:07:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1633774021; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9wkUY0TfYQ7BXLB6nLTQglO5Wo6OEsOpDJApBAflki4=; b=ZC67GHE/rfHxlj+jXKDdLiJJZaU0DUCSZJG0TnUZnDBXscZK1IVhu2+keE5XWW+iMuPesk SQAXn3XeR1SBoKuLOLRYyrhsPizT4EaylDO/KzlfyVNw73hBaRd30b8B7ot7xxf1FqXkC8 UFxKMTxtq07rKG5Jzc1z2kI1OBQ7/kaFE55YAdo8UUKbGVE7kR3he25VDxBGVfaHVMXaQ5 RoWv89pXLWjx7kps1IaHLM5FePh0Wv9GpJFD2xt91+DACBfJFSwbSNk+SugQw/pK/PFLzk ntEzsDTqtLKIA9o1uHW+3HpHiP06qayqAtfdv7sO5tMQ2fDLJinS/Xiy9U/0TA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1633774021; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9wkUY0TfYQ7BXLB6nLTQglO5Wo6OEsOpDJApBAflki4=; b=uU71ipaD9C/ez63ZmcUxlhg7F0Gzm1/64yZcPeuRkLYj6+oEl3mM+Nj383jZOIEXmqXSf0 7GIFolcw67oVpDBQ== From: tip-bot2 for =?utf-8?q?Andr=C3=A9?= Almeida Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] selftests: futex: Test sys_futex_waitv() wouldblock Cc: andrealmeid@collabora.com, "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210923171111.300673-22-andrealmeid@collabora.com> References: <20210923171111.300673-22-andrealmeid@collabora.com> MIME-Version: 1.0 Message-ID: <163377402010.25758.2005094433485495424.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: 9d57f7c79748920636f8293d2f01192d702fe390 Gitweb: https://git.kernel.org/tip/9d57f7c79748920636f8293d2f01192d702= fe390 Author: Andr=C3=A9 Almeida AuthorDate: Thu, 23 Sep 2021 14:11:10 -03:00 Committer: Peter Zijlstra CommitterDate: Thu, 07 Oct 2021 13:51:12 +02:00 selftests: futex: Test sys_futex_waitv() wouldblock Test if futex_waitv() returns -EWOULDBLOCK correctly when the expected value is different from the actual value for a waiter. Signed-off-by: Andr=C3=A9 Almeida Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20210923171111.300673-22-andrealmeid@collabor= a.com --- tools/testing/selftests/futex/functional/futex_wait_wouldblock.c | 41 ++++++= +++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c= b/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c index 0ae390f..7d7a6a0 100644 --- a/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c +++ b/tools/testing/selftests/futex/functional/futex_wait_wouldblock.c @@ -22,6 +22,7 @@ #include #include #include "futextest.h" +#include "futex2test.h" #include "logging.h" =20 #define TEST_NAME "futex-wait-wouldblock" @@ -42,6 +43,12 @@ int main(int argc, char *argv[]) futex_t f1 =3D FUTEX_INITIALIZER; int res, ret =3D RET_PASS; int c; + struct futex_waitv waitv =3D { + .uaddr =3D (uintptr_t)&f1, + .val =3D f1+1, + .flags =3D FUTEX_32, + .__reserved =3D 0 + }; =20 while ((c =3D getopt(argc, argv, "cht:v:")) !=3D -1) { switch (c) { @@ -61,18 +68,44 @@ int main(int argc, char *argv[]) } =20 ksft_print_header(); - ksft_set_plan(1); + ksft_set_plan(2); ksft_print_msg("%s: Test the unexpected futex value in FUTEX_WAIT\n", basename(argv[0])); =20 info("Calling futex_wait on f1: %u @ %p with val=3D%u\n", f1, &f1, f1+1); res =3D futex_wait(&f1, f1+1, &to, FUTEX_PRIVATE_FLAG); if (!res || errno !=3D EWOULDBLOCK) { - fail("futex_wait returned: %d %s\n", - res ? errno : res, res ? strerror(errno) : ""); + ksft_test_result_fail("futex_wait returned: %d %s\n", + res ? errno : res, + res ? strerror(errno) : ""); ret =3D RET_FAIL; + } else { + ksft_test_result_pass("futex_wait\n"); } =20 - print_result(TEST_NAME, ret); + if (clock_gettime(CLOCK_MONOTONIC, &to)) { + error("clock_gettime failed\n", errno); + return errno; + } + + to.tv_nsec +=3D timeout_ns; + + if (to.tv_nsec >=3D 1000000000) { + to.tv_sec++; + to.tv_nsec -=3D 1000000000; + } + + info("Calling futex_waitv on f1: %u @ %p with val=3D%u\n", f1, &f1, f1+1); + res =3D futex_waitv(&waitv, 1, 0, &to, CLOCK_MONOTONIC); + if (!res || errno !=3D EWOULDBLOCK) { + ksft_test_result_pass("futex_waitv returned: %d %s\n", + res ? errno : res, + res ? strerror(errno) : ""); + ret =3D RET_FAIL; + } else { + ksft_test_result_pass("futex_waitv\n"); + } + + ksft_print_cnts(); return ret; }