From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3842279907 for ; Mon, 9 Mar 2026 08:16:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773044163; cv=none; b=GaR6XtamDZFQ1VK5kfbJaRUHpphVKlCM9Wh7iWanFXuERI9dFxnOjmQj8wdRiDA4Ai6MO76MVTWhuwOnbJ/72VIqo7PVPPVofz8LslRFlKzyTauJ5NIjdTgQM2RInQqU/Ixjk0Do4Iw/IbTsJPKZfBK4MtR2UQ9nLy91KulUfUw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773044163; c=relaxed/simple; bh=cT+T/hqHFr7lrTF15rWikRaO50e53ZT2RN4SJqijhvY=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=loNs11hgCfipD3RWb6R7zLrHooBrGVCPWMAMKX7rSaHBYBDFc6ow6jn4uSXS3e3d2TwKUEilQHEHPVzhDGAdZWAdAMLbnxaCJ0s8H6SpoS+JVUJe0vdpZ6xIeNa2ZZ66YwYCeiaUwp9+OfzAx7ooFx76kilOENABCIdNVgsfwss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VyIdjDNO; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=OtLvQ7Nx; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VyIdjDNO"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="OtLvQ7Nx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773044160; h=from:from: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:autocrypt:autocrypt; bh=Y1Ps22diV+WqMM3WZSbsW6DrnFcvdXzfbQr1BWPykyo=; b=VyIdjDNO1DFy9UsLkavIawGPmgHmV+faVfkp05ee+qF/dYjGxiuxJ0FNbp2hV1Tc49sjjX eyQc9boOzTTSDC5/nn5CiQw3+ipS0Ki8qjGNu2Q56fStLchVRXVsF4ZoB2NXaROoCq+aS6 yXSupE6fGel5EnuGPHAp+luXHTafzMA= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-215-jPT0trnNNm23GPCN-q3n1w-1; Mon, 09 Mar 2026 04:15:59 -0400 X-MC-Unique: jPT0trnNNm23GPCN-q3n1w-1 X-Mimecast-MFC-AGG-ID: jPT0trnNNm23GPCN-q3n1w_1773044158 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4853b00f9f5so13331625e9.2 for ; Mon, 09 Mar 2026 01:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773044158; x=1773648958; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to; bh=Y1Ps22diV+WqMM3WZSbsW6DrnFcvdXzfbQr1BWPykyo=; b=OtLvQ7NxpQA2ZepsnsOcNEUv1NLWZetx6H1BLF3Q9U+wR6Wtz5u90ELTjofBx6iFPS tkVloVyosMseQIenvwfu1lKgiRc17WMeX7cKwVhYIayXaJWTF4qdc5Adhy2rIgvl16HC 5tT1Eid0DJWiGVG/hlXJ/wFPHtY/kGfpKj6eS9kNPFgKu0lDq/NPHqRhRoov83vL/YG2 OC7dw1iPXSxajvUbL4ftmycwebvC8WT+tckuS1NJNh12jwsLjgekurVGNXC60jZYU36W OFEx5A3MqXflrCLmzCJBWLptqE5d9NdJ/ad6AYn2QGi1mQxLOxZt+BOUzNI1GovbZlxe j9IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773044158; x=1773648958; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y1Ps22diV+WqMM3WZSbsW6DrnFcvdXzfbQr1BWPykyo=; b=urBEHxI6TOS0CDwej+KP72lgudQ6dd6CBqkxZ0o9UYXvRNgIfv15oPc0fG69rktZEB Zalk9V0B1KjJkc6M8ad5RiG1QYlGIHjBBJwU7y16VaqO99N+KcRstntmIhZ/d+pZgSyB YtKQx0CQtDLErMpLFzO58OcbtHP2gAoeYTdyUyl1T26PLHkV77/2fnkm+GJZIPDsDoCY YGgZMg9g0Eceg8pNoljjjgL43qvxH1jhe5PWCpCct6fIM/8SxZkys2zAEf9oJGerHp39 n7jH6Ppsd5q9NIw977LYcBbgSpUcOaNWwQKMdry8lobMnH/D1kqFM5Cl5t/zh0JA0KDm +n5A== X-Forwarded-Encrypted: i=1; AJvYcCWZSsXdiWqS1tkZBQEquG71X+AIGTH3icj6EIK49ErNyblXLZNFnps85hDcTDmhvX4Gn1NdcPXx5jaDjWg=@vger.kernel.org X-Gm-Message-State: AOJu0Ywcr0ZZJqIJhIjKabVYSNP3ugzz3PfD8LHOTEZpSO8WdOjmsVw1 QEH9BR6l++1UEdGkCzvzB/4fJ16La3GANQAIzf9fvW7o/Ryv28hTlaZz+bIKdZQ32y3EqkICHMC TSv8f84XLD4NVBGRagchqf8JKT/SPQDrOs87+uil56/GvXDX4hWxreHsO0x0A0ZrXGw== X-Gm-Gg: ATEYQzwS9EXMjxGFP7JroCT+MLUOKWkIANgREEZJ8TjuPIEBmrRHZHDiEVuM7pIxeVG M8leJnN2UeHFXCCiBsjGlgkFmJ5ujEd6c9/Rx8mHs3WcVqsRxyWDgHnoEPOLbItZ3lZY6857ezI 8GiAflah54Yax6Jeldlqe7+LPmw+ayIIGGX8+pKI9t5Zj5pF1Y7o7Gmd4ZTQLhUq0DLGVq8s1j5 hNtCVlztMwOtgOyVFAmL7XZWdCbG0uYbsM2/mlyjr5hR/t3eMbjaNAKGX3Pn17i3ZY3uycs6NyF g3aDmXvPCMJ7Mj9eydGfaXY9rA9isZGcRwB5BSiX89WtLq8mGgP6xn88nn8sxhZZrz6603zZGIZ IaKx4dAymfUQefF8aB5aCQytFnFyKnDQlLG1MkofF3wGoZYzFP+i0uwXWnFvpo1mg8d5OSZh9ek 4DUFG6r++jthw2wYE= X-Received: by 2002:a05:600c:64c7:b0:476:4efc:8ed4 with SMTP id 5b1f17b1804b1-48526923bbcmr157396515e9.11.1773044158339; Mon, 09 Mar 2026 01:15:58 -0700 (PDT) X-Received: by 2002:a05:600c:64c7:b0:476:4efc:8ed4 with SMTP id 5b1f17b1804b1-48526923bbcmr157396025e9.11.1773044157793; Mon, 09 Mar 2026 01:15:57 -0700 (PDT) Received: from gmonaco-thinkpadt14gen3.rmtit.csb (212-8-243-115.hosted-by-worldstream.net. [212.8.243.115]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485237dcf04sm121719035e9.1.2026.03.09.01.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 01:15:57 -0700 (PDT) Message-ID: <64fa81f453d7909e5669cc32284f7c9f48f2fea9.camel@redhat.com> Subject: Re: [PATCH RFC 4/7] selftests/sched: Add basic SCHED_DEADLINE functionality tests From: Gabriele Monaco To: Juri Lelli , Shuah Khan , Peter Zijlstra , Ingo Molnar Cc: Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Valentin Schneider , Clark Williams , Tommaso Cucinotta , Luca Abeni , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Date: Mon, 09 Mar 2026 09:15:55 +0100 In-Reply-To: <20260306-upstream-deadline-kselftests-v1-4-2b23ef74c46a@redhat.com> References: <20260306-upstream-deadline-kselftests-v1-0-2b23ef74c46a@redhat.com> <20260306-upstream-deadline-kselftests-v1-4-2b23ef74c46a@redhat.com> Autocrypt: addr=gmonaco@redhat.com; prefer-encrypt=mutual; keydata=mDMEZuK5YxYJKwYBBAHaRw8BAQdAmJ3dM9Sz6/Hodu33Qrf8QH2bNeNbOikqYtxWFLVm0 1a0JEdhYnJpZWxlIE1vbmFjbyA8Z21vbmFjb0BrZXJuZWwub3JnPoiZBBMWCgBBFiEEysoR+AuB3R Zwp6j270psSVh4TfIFAmjKX2MCGwMFCQWjmoAFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgk Q70psSVh4TfIQuAD+JulczTN6l7oJjyroySU55Fbjdvo52xiYYlMjPG7dCTsBAMFI7dSL5zg98I+8 cXY1J7kyNsY6/dcipqBM4RMaxXsOtCRHYWJyaWVsZSBNb25hY28gPGdtb25hY29AcmVkaGF0LmNvb T6InAQTFgoARAIbAwUJBaOagAULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgBYhBMrKEfgLgd0WcK eo9u9KbElYeE3yBQJoymCyAhkBAAoJEO9KbElYeE3yjX4BAJ/ETNnlHn8OjZPT77xGmal9kbT1bC1 7DfrYVISWV2Y1AP9HdAMhWNAvtCtN2S1beYjNybuK6IzWYcFfeOV+OBWRDQ== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Hello, On Fri, 2026-03-06 at 17:10 +0100, Juri Lelli wrote: > Add initial test coverage for SCHED_DEADLINE scheduler functionality. > This patch introduces two fundamental tests that validate core > SCHED_DEADLINE behavior using the test framework and utility library. >=20 > The basic_scheduling test creates a cpuhog process with SCHED_DEADLINE > policy and verifies the scheduling policy is correctly set to policy 6 > (SCHED_DEADLINE). It confirms the task executes successfully for the > specified duration using reasonable parameters with 30ms runtime, 100ms > deadline, and 100ms period. This validates the fundamental operation of > setting SCHED_DEADLINE policy and running deadline-scheduled tasks. >=20 > The parameter_validation test ensures the kernel properly validates > SCHED_DEADLINE parameters. It tests that invalid parameter combinations > such as runtime greater than deadline are correctly rejected with > EINVAL, while valid parameter configurations are accepted. This confirms > the kernel's parameter validation logic is working correctly and > prevents misconfigured deadline tasks from being scheduled. >=20 > Both tests use the dl_util library for SCHED_DEADLINE operations and > follow the framework pattern with automatic registration via > REGISTER_DL_TEST(). The tests pass cleanly in VM environments with 2 > tests passing, 0 skipped, and 0 failed. >=20 > Assisted-by: Claude Code: claude-sonnet-4-5@20250929 > Signed-off-by: Juri Lelli > --- ... > =C2=A0 > +# Test files > +$(OUTPUT)/basic.o: basic.c dl_test.h dl_util.h | $(OUTPUT_DIR) > + $(CC) $(CFLAGS) -c $< -o $@ > + This seems a constant in all tests, what about just having make do the tric= k: $(OUTPUT)/%.o: %.c dl_test.h dl_util.h | $(OUTPUT_DIR) $(CC) $(CFLAGS) -c $< -o $@ The rest looks neat. Thanks, Gabriele > =C2=A0$(OUTPUT_DIR): > =C2=A0 mkdir -p $@ > =C2=A0 > diff --git a/tools/testing/selftests/sched/deadline/basic.c > b/tools/testing/selftests/sched/deadline/basic.c > new file mode 100644 > index 0000000000000..f1c4e8c751b61 > --- /dev/null > +++ b/tools/testing/selftests/sched/deadline/basic.c > @@ -0,0 +1,127 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Basic SCHED_DEADLINE functionality tests > + * > + * Validates fundamental SCHED_DEADLINE scheduler operations including > + * policy setup, parameter validation, and basic task execution. > + */ > + > +#define _GNU_SOURCE > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include "dl_test.h" > +#include "dl_util.h" > + > +/* > + * Test: Basic SCHED_DEADLINE scheduling > + * > + * Verifies that a task can be successfully scheduled with SCHED_DEADLIN= E > + * policy and executes correctly. > + */ > +static enum dl_test_status test_basic_scheduling_run(void *ctx) > +{ > + pid_t pid; > + int policy; > + int status; > + uint64_t runtime_ns, deadline_ns, period_ns; > + > + /* Use reasonable deadline parameters: 30ms/100ms/100ms */ > + runtime_ns =3D dl_ms_to_ns(30); > + deadline_ns =3D dl_ms_to_ns(100); > + period_ns =3D dl_ms_to_ns(100); > + > + /* Create a cpuhog process with SCHED_DEADLINE */ > + pid =3D dl_create_cpuhog(runtime_ns, deadline_ns, period_ns, 2); > + DL_FAIL_IF(pid < 0, "Failed to create cpuhog process: %s", > + =C2=A0=C2=A0 strerror(errno)); > + > + /* Process is now running with SCHED_DEADLINE set */ > + printf("=C2=A0 Created cpuhog with SCHED_DEADLINE (PID %d)\n", pid); > + > + /* Verify it's using SCHED_DEADLINE (policy 6) */ > + policy =3D dl_get_policy(pid); > + DL_FAIL_IF(policy < 0, "Failed to read scheduling policy"); > + DL_EQ(policy, SCHED_DEADLINE); > + > + /* Alternative check using helper */ > + DL_ASSERT(dl_is_deadline_task(pid)); > + > + printf("=C2=A0 cpuhog running with SCHED_DEADLINE (PID %d)\n", pid); > + > + /* Wait for cpuhog to complete (2 seconds) */ > + if (waitpid(pid, &status, 0) < 0) { > + dl_cleanup_cpuhog(pid); > + DL_FAIL("waitpid failed: %s", strerror(errno)); > + } > + > + /* Verify it exited successfully */ > + DL_FAIL_IF(!WIFEXITED(status), "Process did not exit normally"); > + DL_EQ(WEXITSTATUS(status), 0); > + > + printf("=C2=A0 cpuhog completed successfully\n"); > + > + return DL_TEST_PASS; > +} > + > +static struct dl_test test_basic_scheduling =3D { > + .name =3D "basic_scheduling", > + .description =3D "Verify basic SCHED_DEADLINE policy setup and > execution", > + .run =3D test_basic_scheduling_run, > +}; > +REGISTER_DL_TEST(&test_basic_scheduling); > + > +/* > + * Test: SCHED_DEADLINE parameter validation > + * > + * Verifies that the kernel correctly validates deadline parameters, > + * rejecting invalid configurations and accepting valid ones. > + */ > +static enum dl_test_status test_parameter_validation_run(void *ctx) > +{ > + int ret; > + uint64_t runtime_ns, deadline_ns, period_ns; > + > + printf("=C2=A0 Testing invalid parameters (runtime > deadline)...\n"); > + > + /* Invalid: runtime (200ms) > deadline (100ms) */ > + runtime_ns =3D dl_ms_to_ns(200); > + deadline_ns =3D dl_ms_to_ns(100); > + period_ns =3D dl_ms_to_ns(100); > + > + ret =3D dl_set_sched_attr(0, runtime_ns, deadline_ns, period_ns); > + DL_FAIL_IF(ret =3D=3D 0, "Invalid parameters were accepted (runtime > > deadline)"); > + DL_FAIL_IF(errno !=3D EINVAL, "Expected EINVAL, got %s", > strerror(errno)); > + > + printf("=C2=A0 Invalid parameters correctly rejected with EINVAL\n"); > + > + printf("=C2=A0 Testing valid parameters...\n"); > + > + /* Valid: runtime (30ms) <=3D deadline (100ms) <=3D period (100ms) */ > + runtime_ns =3D dl_ms_to_ns(30); > + deadline_ns =3D dl_ms_to_ns(100); > + period_ns =3D dl_ms_to_ns(100); > + > + ret =3D dl_set_sched_attr(0, runtime_ns, deadline_ns, period_ns); > + DL_FAIL_IF(ret < 0, "Valid parameters were rejected: %s", > strerror(errno)); > + > + printf("=C2=A0 Valid parameters correctly accepted\n"); > + > + /* Reset to normal scheduling using sched_setscheduler */ > + struct sched_param param =3D { .sched_priority =3D 0 }; > + > + sched_setscheduler(0, SCHED_OTHER, ¶m); > + > + return DL_TEST_PASS; > +} > + > +static struct dl_test test_parameter_validation =3D { > + .name =3D "parameter_validation", > + .description =3D "Verify SCHED_DEADLINE parameter validation > (accept/reject)", > + .run =3D test_parameter_validation_run, > +}; > +REGISTER_DL_TEST(&test_parameter_validation);