From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F584C2FC0F for ; Thu, 17 Aug 2023 18:02:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DA9A28000A; Thu, 17 Aug 2023 14:02:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96413940009; Thu, 17 Aug 2023 14:02:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DCE928000A; Thu, 17 Aug 2023 14:02:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 69CC7940009 for ; Thu, 17 Aug 2023 14:02:23 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2CF41C100D for ; Thu, 17 Aug 2023 18:02:23 +0000 (UTC) X-FDA: 81134366166.13.2447152 Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53]) by imf13.hostedemail.com (Postfix) with ESMTP id 3724E20070 for ; Thu, 17 Aug 2023 18:02:00 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=google header.b=YbXL9Hs6; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf13.hostedemail.com: domain of skhan@linuxfoundation.org designates 209.85.160.53 as permitted sender) smtp.mailfrom=skhan@linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692295321; h=from:from:sender: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:dkim-signature; bh=SYb4Pd47UFlcMLjK0TyKHWunAauH0WdeCKCWucrXGAs=; b=7tQAfHvjs5lUQij7723KJaEN7GTPGASuZ5nWxm/Z1m8HHZekUWUa7GCFqzqZb3yV9poKbu 8eLoQUSRXQh9Rvl5QlvLhoozGKbn3xsQY8ESKlUHkD5JPkjqytn08mMxqq1OcWC725HlW2 qHhy4KMms6lN4zUaw3R6H6Lu3Mpj58g= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=google header.b=YbXL9Hs6; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf13.hostedemail.com: domain of skhan@linuxfoundation.org designates 209.85.160.53 as permitted sender) smtp.mailfrom=skhan@linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692295321; a=rsa-sha256; cv=none; b=C0NOjt/rZtwSbv3PAbUXV1zIpFAZ96T9s8KHHSA/V8cvo+NU/2akt7XZ3vQSuvXarQYDt3 QWYu8i7MpuK+LoN4H1DrjSj6KvazlmhTQoIA/BxrclFLjzI3GgShlnimRmOTxPY0tH1nb7 NLbw/hnRLfZyW6pplrfZHdtTbtbrud0= Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-1c530d5468bso326107fac.0 for ; Thu, 17 Aug 2023 11:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1692295320; x=1692900120; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SYb4Pd47UFlcMLjK0TyKHWunAauH0WdeCKCWucrXGAs=; b=YbXL9Hs6z5ZuNLmZ+yLinpxkNiAnyvofipKx3SNA40CElWHpjhsMaVmhSm3YiSYMYl gpDh4yrPCEBHb8F9sPw0jRjHgNslCPc+WFsIUC8Wxrw4Xf3XwRxO+5EDJHe8IXB67PYn ZGuYoQ62+pOIxlkwfiPG4I4vLm7DQbem8afI4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692295320; x=1692900120; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SYb4Pd47UFlcMLjK0TyKHWunAauH0WdeCKCWucrXGAs=; b=RdBoKqGDMDd0h26qt88wKYIXdXl1gcE3oEFZE5CJIJIHptJQffdv7CgScKPXjwJW7R DlRsnJjjkCGX1IyDn+b3GJm0TBlKawOgimIq3yN4rPeqUpAlrqWWZg4o/H1r3v2LnAoN 0rRrNZWgXqo9/VNjTLfypqz4BXRVpBLEEhxPb5mMvUDOj4Ewb8rzuc74u+ghlF3KHfNY IhjvzjTkGxdfCbvMPGorNsIqnrbV/sxs2HfthXMojPHvk22Y334aZKp/TMhh9Ptj8Bab U1VwWqC66dvJJJXUCgO1WbMeW1uxytwtFN5KdqXdKSEIEFS/7MyZCFLqxBmlN8NQ9j0O B8wA== X-Gm-Message-State: AOJu0YxnxeTsZlhRXy2X/U2GJeyjCbMV78ap8QhRTBD9RxevPPm+ZIMl yOjyP5aelMn3qWcLTIjc7JWZq1tekObA4uc7e8s= X-Google-Smtp-Source: AGHT+IHqAFbrL4qdvGW97H1r5YhxKtn+dJdhOGwnTl2VThvVgLzvX54ojzU6tKtuiGeN6/G6QY07AQ== X-Received: by 2002:a05:6871:209:b0:1c0:d0e8:8ff5 with SMTP id t9-20020a056871020900b001c0d0e88ff5mr189976oad.1.1692295320147; Thu, 17 Aug 2023 11:02:00 -0700 (PDT) Received: from [192.168.1.128] ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id o24-20020a02cc38000000b0042b3e04510asm5035568jap.98.2023.08.17.11.01.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Aug 2023 11:01:59 -0700 (PDT) Message-ID: Date: Thu, 17 Aug 2023 12:01:58 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 3/3] selftests: cachestat: test for cachestat availability To: Andre Przywara Cc: Shuah Khan , Nhat Pham , Johannes Weiner , linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shuah Khan References: <20230815155612.2535947-1-andre.przywara@arm.com> <20230815155612.2535947-4-andre.przywara@arm.com> <59c0fcd1-a1f2-de37-c94d-76687934acd5@linuxfoundation.org> <20230817154754.278218ae@donnerap.manchester.arm.com> Content-Language: en-US From: Shuah Khan In-Reply-To: <20230817154754.278218ae@donnerap.manchester.arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3724E20070 X-Stat-Signature: 1nzpeewihaefs3bh4ouuaugggs9gsxe3 X-HE-Tag: 1692295320-898800 X-HE-Meta: U2FsdGVkX19hyZ92mFWjIGlmQwSfoB26lzyMTnGii+S4h66WoLmWa+Hw1IRlfApZ7PAZC0sYZK/hF4o798YfKlxfF6aAxYFmY2Uiip9rYp0G7TdXI/CSP3b5dz0AHnsdYRxws5bfTbo5ksvrIX82N/bxbI8OMbJHbO077KCLOn5KAtSJh/Rbcz0yISZQh6a+w4XOggKZEIiGTFV7LzUrucsYS1/lgQg/WtyrzsMslAqxNIK+fOCxhQK+9KA3fKiigT4r+h8QDEJrbuFOSNMVtwkmq+AQJ1qfZ7xTbxdlTfHwSk9ZUsczzmaq4brSvuNjy2U0pUKh/bUMAgxAiMrfewviG55wiV20F4TahfMMec59xQ3hBdfW8HT+sAGCRu5Kf8wg27g2Ju8ktu58N+IJFUx2rNZXvNJtGn152WoqUUH5AIGbXXKknhOffRMJTaxbsPgtq8fjX8TICFRGvftWI0xdU7R2oZ94N59LxQiYHBg1/Q0/IKEkff2WVWSykmErGjNXp1DES5XpbbxqOdXeZ5nohTeEZrvkBo8nTgx3h1LehhSLNns0osNZyJu7jn1LyCY8Oc+W/aY7zU50vTcBdlWbTUghQfx+88z0oPIiGFC0tJ8xj0bwNbCULF5l/T7YQLjRJjqpVg+Vd8JcJlMVi1M5ThdoLw7cZALYq1ioxB5x0+XgQ49MHgFWikKhxvOJlmqScl4RMaQti3jNi9dJv4eREWIZ1ue/bZ84TLtxJ4RAaDYjemwP6M0cFqzpedqjMpern5NB2uISf4h+takXCaXa9MTowqhXygie9krsCUCVPBUq8QR4Ia2BnFDf90IlQv8RTKcohEWkPZ39iRbA1AdfimXP32jGbiSSP/GieEBCm4UjrFLE8ytPf1gL0SD6FkUd/kVVA3Wr/pdixjXUcrAdonUBn8Qca8+uVn8mj9BPrv0841pnJfWijHvK2oD4b0hSoXdDSIxJzp2wFYG XJfqu8wq 5/ONhpK0317DjTkJrDFOXQI+NCBIvBJvXK00RGw7mSsWZRRpt0YC6qIaY+13wFVH36gB1pyyDbhj25C1Kd23buN1V029GLvDIIYnJ4CUX6amPszHYxXpbmrvtUghjucrAFfM66SCxNxY8WHvn+yeWLIU4YsxCzE9Unno3PzvmaVK+aWVZXfr+bVPc05dTDImw/o+qD3AZ1dsYVJkH5c+ajUqLoXVLjyl2E/p/pwTU+V5AsqQQ/lypA3fm19Y3iHe2Wc7x9cumJZig117vjlOBQSvuwa2puVZpzDVYQcNe3aVkcAre07toQ6OyfU0nUuammVPElAKlBpTdKe0rJe79ckUyIqMh0EUzSriKLXKXRu43HGrKnHYMTFwFy7WxuslqBfaqU+QI839tvaKtPpxW4oraPMM096SzmmQaUOJD+EpgtvTXG/HDFWNoK0WfNTpXWarInL0FRx+vdvbTEKcn1poEPRdTBFZv0hqxYmiWoeU5E7sueVeuij5Liw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 8/17/23 08:47, Andre Przywara wrote: > On Wed, 16 Aug 2023 11:11:49 -0600 > Shuah Khan wrote: > > Hi, > >> On 8/15/23 09:56, Andre Przywara wrote: >>> As cachestat is a new syscall, it won't be available on older kernels, >>> for instance those running on a build machine. In this case, a run >>> reports all tests as "not ok" at the moment. >>> >>> Test for the cachestat syscall availability first, before doing further >>> tests, and bail out early with a TAP SKIP comment. >>> >>> This also uses the opportunity to add the proper TAP headers, and add >>> one check for the syscall error handling (illegal file descriptor). >>> >>> Signed-off-by: Andre Przywara >>> --- >>> .../selftests/cachestat/test_cachestat.c | 22 ++++++++++++++++++- >>> 1 file changed, 21 insertions(+), 1 deletion(-) >>> >>> diff --git a/tools/testing/selftests/cachestat/test_cachestat.c b/tools/testing/selftests/cachestat/test_cachestat.c >>> index a5a4ac8dcb76c..77620e7ecf562 100644 >>> --- a/tools/testing/selftests/cachestat/test_cachestat.c >>> +++ b/tools/testing/selftests/cachestat/test_cachestat.c >>> @@ -15,6 +15,8 @@ >>> >>> #include "../kselftest.h" >>> >>> +#define NR_TESTS 8 >>> + >>> static const char * const dev_files[] = { >>> "/dev/zero", "/dev/null", "/dev/urandom", >>> "/proc/version", "/proc" >>> @@ -235,7 +237,25 @@ bool test_cachestat_shmem(void) >>> >>> int main(void) >>> { >>> - int ret = 0; >>> + int ret; >>> + >>> + ksft_print_header(); >>> + >>> + ret = syscall(__NR_cachestat, -1, NULL, NULL, 0); >>> + if (ret == -1 && errno == ENOSYS) { >>> + printf("1..0 # Skipped: cachestat syscall not available\n"); >>> + return KSFT_SKIP; >> What happens when other errors besides ENOSYS? The test shouldn't >> continue. > > -1 is an illegal file descriptor, and this is checked below (still using > the same ret and errno), but reported using the normal framework. > This check above is done early, before we even announce the plan, so that > we can skip *all* of the tests, since they don't make any sense when the > syscall is not available at all. > > Does that make sense? > Yup. I will apply this for Linux 6.6-rc1. You will get patchbot notification shortly. thanks, -- Shuah