From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1ECB7606A322 for ; Wed, 2 Dec 2026 22:12:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=pVawbYWJ Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 709983EBE35 for ; Wed, 2 Dec 2026 23:12:28 +0100 (CET) Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id A6CF63EA689 for ; Wed, 2 Dec 2026 23:12:11 +0100 (CET) Received: from mail-dl2-x08.google.com (mail-dl2-x08.google.com [IPv6:2607:f8b0:4864:38::8]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 75F26200759 for ; Wed, 2 Dec 2026 23:12:11 +0100 (CET) Received: by mail-dl2-x08.google.com with SMTP id a92af1059eb24-15901d262aeso119851c88.1 for ; Wed, 02 Dec 2026 14:12:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796249530; x=1796854330; darn=lists.linux.it; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=b8q00cZAgqsYGpdOYdORhwAbukkMLznrGegGBjTbnYQ=; b=pVawbYWJC+O08uXXwrDEfrfRQjEFJjIM3IZDPMl2xjRUv7UfcHyjsytmUpPNb3OxWZ 5pMrWYSFDicOHKdVsCtUihOEs0b5wuHxOtsn7szXmxRYmGBubZuueih26SLNq6I16PrL cy3mu0mnGFBBHDlfGFQFvQgRFy8YRliq1Knz9g/Mxq+6Yhv2HrpklBJxyTAvWgzv3awI 6hehEYQv3Jd16rSpGiTVtyZC+e8xPE6h1YE0yqHsfcO26S/ATSwTiTbpgBF54A/UywJH 3j3pnoL/D6o9p5B9mN5Li1HlIEto0rAyKAoHctSPGj+Ei8tgS8PYszOz77f9IPFg8iBx e//g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796249530; x=1796854330; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=b8q00cZAgqsYGpdOYdORhwAbukkMLznrGegGBjTbnYQ=; b=S9/NR8fLqCZXKAHjNZdQgP6ZWS+ybg0L9uSRR4lTQhiMsbrf76awCk6uWNpWM+z8Ru khivZnR00b1+v+XQGlxyMpr7b0RA6sNLwVvEYLMwrFPvyXnoUqT+nRG8G1//7VVdmlKR bb+3CgN8yDbwjHE43oCR/5Rgrb+KBNYDX8mwwYYyUNY6KnHIE87SPEk3dahYlLpfmHBk 8dRdGGpnhAdZcHzxKuSs6tCM4o2xNkGIX+Meux3ft+/nGAsDqEzAd2J+LiFlPqXDYWnn jFwb8kkG4cvBfIGRBnRzhZ7VIOmg/gNpEvNJ/z2dbhyA4KsOk3FrEbkq+b2Sey0Mb5fv hFYg== X-Gm-Message-State: APuU4Z+rb2Cy89hC+h1FKVNsNtWXcmxGCn2zFt6PC4v3cr+6V8KaHfEF 4jBRU0HGx50rHhEB4xfXthifqFRLqbfp9OuFv6vnqjlZGvEqzQXv/P2s X-Gm-Gg: AZFdTZeJTew739gBsNIcViC3dr+9dyI3oP7bMdTwX2Akg248ppeX+/k7KlpqrJ8SI8D 4lKLnvV/oFfzuWOKaN0pkEuuJYkusgXh+zX9TEqfGtGGSBc8eY9zv1y8mQ0MnSwuh/xunLKhKOz jngA8RNagW2Fnpql8cEx6ZguysnJUrv3xBJSVV2sSKnWqzte1U1+oYtYt8+H4OHNlnfm2H8/HxT bVG+vstYfq+tIAuobaG6NJcwn739o/MxzvZcELP8G9eChifdmQkQXZBkqgjmY5Ph8fwcB8zGNZE xAyY1Yo72JKI2J+Qn/W72cYaeNAqE4MEB4KEXkEQXNJavNvEsDMsiN1nF/ypWD6TeQDdsEGfjXo XU3JPt013MkMwuq/QPIJrkw75wmb/OQB31uQtk/c2t6P9AJs9ToGaTRPRyCxU1Czx+whYfZ9E8a SEFAJHsA6VTIXjjHexsZfETtuvpWCPz58IfxTZu7YeQr4bct+yV4QSJ9O0UVJY0D+cu1gjKFc9n TQJB1Xzgg/E3NN+dC/zAWTjX2s7Mze8B0zVMjSx1bbXpTKNOSQioZJmDXGAo8BH59LYdAtQ+3V9 UX7pgn9houqksdPoeiV+OV+egBV+hPuatPUv8F5a5gOMUR3klXOZbyc1/QNLr1oSNd00ozd55nE wsXvNngaFgx5LhO/iShGX2xyvU8mG0E4OPzJ7zBe45pQ= X-Received: by 2002:a05:701b:2504:b0:1b3:be0d:696c with SMTP id a92af1059eb24-1b5cec656e4mr118768c88.1.1796249529459; Wed, 02 Dec 2026 14:12:09 -0800 (PST) Received: from runnervm5g69j.b1c1wyiqt5lethi2qcxzn2fl5c.phxx.internal.cloudapp.net ([20.172.111.27]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b59d8c0cafsm41750973c88.7.2026.12.02.14.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 14:12:09 -0800 (PST) From: linuxtestproject.agent@gmail.com To: ujwal300@linux.ibm.com Date: Wed, 2 Dec 2026 22:12:07 +0000 Message-ID: <20261202221207.4104-1-linuxtestproject.agent@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202070106.35620-2-ujwal300@linux.ibm.com> References: <20261202070106.35620-2-ujwal300@linux.ibm.com> X-Archived-By: MIME-Version: 1.0 X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Virus-Scanned: clamav-milter 1.0.9 at in-7.smtp.seeweb.it X-Virus-Status: Clean Subject: Re: [LTP] sched/psi: Add psi_trigger_interface01 test X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ltp@lists.linux.it Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ltp" Hi Ujwal, On Wed Dec 2 12:31:07 2026 +0530, Ujwal Kumar wrote: > sched/psi: Add psi_trigger_interface01 test > diff --git a/testcases/kernel/sched/psi/Makefile b/testcases/kernel/sched/psi/Makefile > new file mode 100644 > index 000000000..5ea7d67db The new test binary needs a testcases/kernel/sched/psi/.gitignore entry (/psi_trigger_interface01) and a runtest/sched entry. > +/*\ > + * Verify the PSI trigger interface of the pressure files. > + * > + * A trigger is registered by writing " " > + * to an open pressure file and is monitored with poll(2) and POLLPRI. It > + * lives as long as the file descriptor it was registered on. The test uses > + * the pressure files of a cgroup of its own and the ones in /proc/pressure/ > + * and does not generate any load, so only the interface is checked: > + * > + * - valid triggers are accepted, including the smallest and the largest > + * allowed threshold and window. > + * - malformed triggers, a window of zero or above 10s and a threshold of zero > + * or above the window are rejected with EINVAL. > + * - a second trigger written to a file descriptor that has one already is > + * rejected with EBUSY. > + * - several file descriptors of the same file can hold different triggers > + * at the same time. > + * - the trigger is released when its file descriptor is closed, so a new one > + * can be registered afterwards. > + * - poll(2) on a file descriptor without a trigger reports POLLERR, while on > + * one with a trigger it does not report any event as long as there is no > + * stall in the idle cgroup. > + * > + * The accounting of the stall time is checked by psi_accounting01. > + * > + * [Kernel config] > + * CONFIG_PSI=y > + * > + * [References] > + * - kernel/sched/psi.c > + * - Documentation/accounting/psi.rst > + */ Format poll(2) as :manpage:`poll(2)` and document why .needs_root = 1 is required (CAP_SYS_RESOURCE is needed for trigger windows that are not multiples of 2s). Also remove the reference to the non-existent psi_accounting01 test and the redundant [Kernel config] section, and add a blank line after [References] using :kernel_tree: and :kernel_doc: roles. > +static void check_write(ssize_t ret, const char *trigger, int err, > + const char *desc) > +{ > + if (!err && ret == (ssize_t)trigger_len(trigger)) { > + tst_res(TPASS, "%s: '%s' accepted", desc, trigger); > + } else if (!err) { > + tst_res(TFAIL | TERRNO, "%s: '%s' not accepted, ret=%zd", > + desc, trigger, ret); > + } else if (ret >= 0) { > + tst_res(TFAIL, "%s: '%s' accepted, expected %s", > + desc, trigger, tst_strerrno(err)); > + } else if (errno != err) { > + tst_res(TFAIL | TERRNO, "%s: '%s' expected %s", > + desc, trigger, tst_strerrno(err)); > + } else { > + tst_res(TPASS | TERRNO, "%s: '%s' rejected", desc, trigger); > + } > +} Pass fd to check_write() and use TST_EXP_VAL(write(fd, trigger, len), len, "%s: '%s'", desc, trigger) when !err and TST_EXP_FAIL2(write(fd, trigger, len), err, "%s: '%s'", desc, trigger) otherwise, instead of calling write() bare in write_trigger() and open-coding the result checks. > +static int register_trigger(const char *file, const char *trigger) > +{ > + int fd = open_pressure(file); > + > + if (write_trigger(fd, trigger) != (ssize_t)trigger_len(trigger)) > + tst_brk(TBROK | TERRNO, "write('%s') to %s failed", trigger, file); > + > + return fd; > +} > + > +static short poll_events(int fd, const char *file, int timeout_ms, int *ret) > +{ > + struct pollfd pfd = {.fd = fd, .events = POLLPRI}; > + > + *ret = poll(&pfd, 1, timeout_ms); > + if (*ret < 0) > + tst_brk(TBROK | TERRNO, "poll(%s) failed", file); > + > + return pfd.revents; > +} Use SAFE_WRITE(SAFE_WRITE_ALL, fd, trigger, trigger_len(trigger)) in register_trigger() and SAFE_POLL(&pfd, 1, timeout_ms) in poll_events(). > + /* Some distributions build PSI but keep it disabled unless psi=1 is set */ > + if (fd < 0) { > + if (errno == ENOENT) > + tst_brk(TCONF, "PSI is not enabled in GRUB, %s does not exist " > + "(add psi=1 to the kernel command line)", PSI_PROBE); > + > + tst_brk(TBROK | TERRNO, "open(%s) failed", PSI_PROBE); > + } > + > + /* psi=0 on the kernel command line makes the interface return EOPNOTSUPP */ > + if (read(fd, buf, sizeof(buf)) < 0) { > + if (errno == EOPNOTSUPP) > + tst_brk(TCONF, "PSI is not enabled in GRUB, it is disabled by " > + "psi=0 (use psi=1 on the kernel command line)"); Do not split user-visible format strings across lines; checkpatch.pl flags lines 278 and 287 with quoted string split warnings. > + .needs_cgroup_ver = TST_CG_V2, > + .needs_cgroup_ctrls = (const char *const[]) {"memory", NULL}, Use "base" instead of "memory" in .needs_cgroup_ctrls. The *.pressure files are cgroup v2 core files enabled by CONFIG_PSI=y and do not require the memory controller. Verdict - Needs revision --- Note: The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions. Regards, LTP AI Reviewer -- Mailing list info: https://lists.linux.it/listinfo/ltp