From patchwork Tue Aug 13 14:43:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Loehle X-Patchwork-Id: 819332 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAAAE19EEDF; Tue, 13 Aug 2024 14:44:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723560243; cv=none; b=BLiWAuE3zqPHjOqIneMpWQUSdnWeXKewn13XX7Y+066jatBUNr76v4egFYBLBSSzDB1r+L0Yl+bAxbX3BRAUZG2hBBdxSCW68aVKxFE9uSzuRXORWGmgzLtlocLuncWjIF6hHRbHFzInQxNcf4orFJgOTLSKEsf7kBPDlrnF2F0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723560243; c=relaxed/simple; bh=IZkUOEj+ynT1cgZSlkqf7jexEJo9g6ns6R0oSMRUXb8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BwBXpZfPJRU2L4trZr+2QibiLDSiFwGGzfjxQosTZCjH9BjT3gQgJ+hQhSkfz4oSIzdcelJYGHtGMt95neogPcXxaMZ95aLDmO+5ODBQ71FbFlCHxyNlufgx+Rl4tSWgzlTER+3yaCeBSFFrYQBkO23BP7JuDL3X83sxgMFxpYM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DAE8D1596; Tue, 13 Aug 2024 07:44:26 -0700 (PDT) Received: from e127648.arm.com (unknown [10.57.84.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6BE453F58B; Tue, 13 Aug 2024 07:43:58 -0700 (PDT) From: Christian Loehle To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rafael@kernel.org Cc: vincent.guittot@linaro.org, qyousef@layalina.io, peterz@infradead.org, daniel.lezcano@linaro.org, rostedt@goodmis.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, Christian Loehle Subject: [PATCH 1/4] sched/deadline: Convert schedtool example to chrt Date: Tue, 13 Aug 2024 15:43:45 +0100 Message-Id: <20240813144348.1180344-2-christian.loehle@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240813144348.1180344-1-christian.loehle@arm.com> References: <20240813144348.1180344-1-christian.loehle@arm.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 chrt has SCHED_DEADLINE support so convert the example instead of relying on a schedtool fork. While at it fix the wrong mentioning of microseconds, it was nanoseconds for both schedtool and chrt. Signed-off-by: Christian Loehle --- Documentation/scheduler/sched-deadline.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst index 9fe4846079bb..22838ed8e13a 100644 --- a/Documentation/scheduler/sched-deadline.rst +++ b/Documentation/scheduler/sched-deadline.rst @@ -749,21 +749,19 @@ Appendix A. Test suite of the command line options. Please refer to rt-app documentation for more details (`/doc/*.json`). - The second testing application is a modification of schedtool, called - schedtool-dl, which can be used to setup SCHED_DEADLINE parameters for a - certain pid/application. schedtool-dl is available at: - https://github.com/scheduler-tools/schedtool-dl.git. + The second testing application is done using chrt which has support + for SCHED_DEADLINE. The usage is straightforward:: - # schedtool -E -t 10000000:100000000 -e ./my_cpuhog_app + # chrt -d -T 10000000 -D 100000000 0 ./my_cpuhog_app With this, my_cpuhog_app is put to run inside a SCHED_DEADLINE reservation - of 10ms every 100ms (note that parameters are expressed in microseconds). - You can also use schedtool to create a reservation for an already running + of 10ms every 100ms (note that parameters are expressed in nanoseconds). + You can also use chrt to create a reservation for an already running application, given that you know its pid:: - # schedtool -E -t 10000000:100000000 my_app_pid + # chrt -d -T 10000000 -D 100000000 -p 0 my_app_pid Appendix B. Minimal main() ========================== From patchwork Tue Aug 13 14:43:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Loehle X-Patchwork-Id: 819055 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C15219FA66; Tue, 13 Aug 2024 14:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723560247; cv=none; b=WmuDlj3FBLzF1+iKuTPBOzLc7Nyon/lLFUkA9+iaeiK+zX7iQlcuLaqlb3Wrz0T0TQjUCSnAEQ7F48JzMVB60YFtXzGhwpMw/NVQs0T5UzUfyoJOQgV+xFBwvcfEeHVa2XVI+JC8Z7Y37tOEjZcKH9M5fHtHdF2elkEGFWijl3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723560247; c=relaxed/simple; bh=8IhLL3z1xEqON4wCm82bS0eL6LCxkYo48zoGlA4JFsY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FY/EJESacVAtjkdTnjvUHBYgqfQ67kvJKdTK89gVkp/tm9EpM3ENt7sh2xauJ644eqcjPhl7R4mzvAmdmAPmA1TsKaqjvVOc+hgPBwrXhTj81ClIpPsl/ppdIamHPGKty9UsVqcvoX+zfE6HJgZJjborL07/NAj7VRgkkL+DPTk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 757981688; Tue, 13 Aug 2024 07:44:30 -0700 (PDT) Received: from e127648.arm.com (unknown [10.57.84.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 078953F58B; Tue, 13 Aug 2024 07:44:01 -0700 (PDT) From: Christian Loehle To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rafael@kernel.org Cc: vincent.guittot@linaro.org, qyousef@layalina.io, peterz@infradead.org, daniel.lezcano@linaro.org, rostedt@goodmis.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, Christian Loehle Subject: [PATCH 2/4] sched/deadline: Clarify nanoseconds in uapi Date: Tue, 13 Aug 2024 15:43:46 +0100 Message-Id: <20240813144348.1180344-3-christian.loehle@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240813144348.1180344-1-christian.loehle@arm.com> References: <20240813144348.1180344-1-christian.loehle@arm.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Specify the time values of the deadline parameters of deadline, runtime, and period as being in nanoseconds explicitly as they always have been. Signed-off-by: Christian Loehle --- include/uapi/linux/sched/types.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/sched/types.h b/include/uapi/linux/sched/types.h index 90662385689b..bf6e9ae031c1 100644 --- a/include/uapi/linux/sched/types.h +++ b/include/uapi/linux/sched/types.h @@ -58,9 +58,9 @@ * * This is reflected by the following fields of the sched_attr structure: * - * @sched_deadline representative of the task's deadline - * @sched_runtime representative of the task's runtime - * @sched_period representative of the task's period + * @sched_deadline representative of the task's deadline in nanoseconds + * @sched_runtime representative of the task's runtime in nanoseconds + * @sched_period representative of the task's period in nanoseconds * * Given this task model, there are a multiplicity of scheduling algorithms * and policies, that can be used to ensure all the tasks will make their From patchwork Tue Aug 13 14:43:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Loehle X-Patchwork-Id: 819331 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E47719FA8A; Tue, 13 Aug 2024 14:44:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723560250; cv=none; b=Dxa43Yb1g5Udu0qhNTTDyYGDmYvLyW9cTylpsNOv5ReH2xDk5TnZa2DIqPrz0LvZH3VhqDdT4B+EO1iWc+QutHz6EUA4vhJ/+Lhs0Y2ofTFdDjPl3w3ZdW6VwGn9IkHpawBxw/XFC8gX86bpRYiWM/wO+ODhvTbBSj+yMpbYWIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723560250; c=relaxed/simple; bh=rlTff6BH+S02Z7v6mU3O5SYccXhywjE7llECeO3S+BY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=leEdXgRY0P009pttkywepB6lSRRS9qs8tywXBFhe6LYDLhmPvGAbFhrnXC2OGJiafI6ZT8bilto8IbJJ9YkfhegFBXGzHoLX2MjVzbDdQK1XodRX/u++h0cy99DXfU8szoe20G3UKp8ylLxJycGOCRbTdT/WjPzg/dvqPJTGWt4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D2081168F; Tue, 13 Aug 2024 07:44:33 -0700 (PDT) Received: from e127648.arm.com (unknown [10.57.84.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6361F3F58B; Tue, 13 Aug 2024 07:44:05 -0700 (PDT) From: Christian Loehle To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rafael@kernel.org Cc: vincent.guittot@linaro.org, qyousef@layalina.io, peterz@infradead.org, daniel.lezcano@linaro.org, rostedt@goodmis.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, Christian Loehle Subject: [PATCH 3/4] cpufreq/cppc: Use NSEC_PER_MSEC for deadline task Date: Tue, 13 Aug 2024 15:43:47 +0100 Message-Id: <20240813144348.1180344-4-christian.loehle@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240813144348.1180344-1-christian.loehle@arm.com> References: <20240813144348.1180344-1-christian.loehle@arm.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert the cppc deadline task attributes to use the available definitions to make them more readable. No functional change. Signed-off-by: Christian Loehle --- drivers/cpufreq/cppc_cpufreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index bafa32dd375d..aff25b598ec4 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -224,9 +224,9 @@ static void __init cppc_freq_invariance_init(void) * Fake (unused) bandwidth; workaround to "fix" * priority inheritance. */ - .sched_runtime = 1000000, - .sched_deadline = 10000000, - .sched_period = 10000000, + .sched_runtime = NSER_PER_MSEC, + .sched_deadline = 10 * NSEC_PER_MSEC + .sched_period = 10 * NSEC_PER_MSEC, }; int ret; From patchwork Tue Aug 13 14:43:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Loehle X-Patchwork-Id: 819054 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F34F51A00EC; Tue, 13 Aug 2024 14:44:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723560253; cv=none; b=VVCvwtYzSoh69ZHHzP3OI1VGD+Mf//xv6oCcgW5YVHMisSpJMhl8+iAkTOYKUEg0SyjiUV2VWSOdmJv77L6NDbqKo9rd/aaZbY+uW/cu/2hYuXhw82grEx81JguWgpAXijUD0i48Wts/2IsOXpssarcv49Ih+Egan4qr+AwDqK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723560253; c=relaxed/simple; bh=Qlu1HYB7+bT3fSXN4kVOyYR7KHbgSX488+bRZ21T6/U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SUgRVFzkuQnNW/IVmHIaj0c9ZIOpLPP67DylfJa5w62HpAKAhDopBTvefWvFH09WOOG7fIt2hDfeem0Ves7rbUn+lKL/OcNsxBHK1wUoIxLiwTlx744grvQR70Ocm++YhEbRskQGG3ZOtWIARaPxAYrupqCxOU974ELD/papBxw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3AEB212FC; Tue, 13 Aug 2024 07:44:37 -0700 (PDT) Received: from e127648.arm.com (unknown [10.57.84.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F193C3F58B; Tue, 13 Aug 2024 07:44:08 -0700 (PDT) From: Christian Loehle To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rafael@kernel.org Cc: vincent.guittot@linaro.org, qyousef@layalina.io, peterz@infradead.org, daniel.lezcano@linaro.org, rostedt@goodmis.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, Christian Loehle Subject: [PATCH 4/4] sched/cpufreq: Use NSEC_PER_MSEC for deadline task Date: Tue, 13 Aug 2024 15:43:48 +0100 Message-Id: <20240813144348.1180344-5-christian.loehle@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240813144348.1180344-1-christian.loehle@arm.com> References: <20240813144348.1180344-1-christian.loehle@arm.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert the sugov deadline task attributes to use the available definitions to make them more readable. No functional change. Signed-off-by: Christian Loehle --- kernel/sched/cpufreq_schedutil.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index eece6244f9d2..43111a515a28 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -654,9 +654,9 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy) * Fake (unused) bandwidth; workaround to "fix" * priority inheritance. */ - .sched_runtime = 1000000, - .sched_deadline = 10000000, - .sched_period = 10000000, + .sched_runtime = NSEC_PER_MSEC, + .sched_deadline = 10 * NSEC_PER_MSEC, + .sched_period = 10 * NSEC_PER_MSEC, }; struct cpufreq_policy *policy = sg_policy->policy; int ret;