ERROR: modpost: "sched_setscheduler" undefined!
Subsystems (2)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/fifo head: 8b700983de82f79e05b2c1136d6513ea4c9b22c4 commit: 616d91b68cd56bcb1954b6a5af7d542401fde772 [44/45] sched: Remove sched_setscheduler*() EXPORTs config: x86_64-rhel (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 reproduce (this is a W=1 build): git checkout 616d91b68cd56bcb1954b6a5af7d542401fde772 # save the attached .config to linux build tree make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "sched_setscheduler" [kernel/trace/ring_buffer_benchmark.ko] undefined!
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoted 10 lines · kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/fifo head: 8b700983de82f79e05b2c1136d6513ea4c9b22c4 commit: 616d91b68cd56bcb1954b6a5af7d542401fde772 [44/45] sched: Remove sched_setscheduler*() EXPORTs config: x86_64-rhel (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 reproduce (this is a W=1 build): git checkout 616d91b68cd56bcb1954b6a5af7d542401fde772 # save the attached .config to linux build tree make W=1 ARCH=x86_64
Quoted 6 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>, old ones prefixed by <<):
Quoted 1 line
Quoted 1 line
ERROR: modpost: "
sched_setscheduler" [kernel/trace/ring_buffer_benchmark.ko] undefined!
Steve, do you have any preference on how to go about fixing this one?
Steven Rostedt
maintainerQuoted 11 lines · On Thu, 9 Jul 2020 14:45:05 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 10 lines · kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/fifo head: 8b700983de82f79e05b2c1136d6513ea4c9b22c4 commit: 616d91b68cd56bcb1954b6a5af7d542401fde772 [44/45] sched: Remove sched_setscheduler*() EXPORTs config: x86_64-rhel (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 reproduce (this is a W=1 build): git checkout 616d91b68cd56bcb1954b6a5af7d542401fde772 # save the attached .config to linux build tree make W=1 ARCH=x86_64
Quoted 8 lines
Quoted 6 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>, old ones prefixed by <<):
Quoted 1 line
Quoted 1 line
ERROR: modpost: "
sched_setscheduler" [kernel/trace/ring_buffer_benchmark.ko] undefined!Steve, do you have any preference on how to go about fixing this one?
Well, I use to manually set the priority of the test, but I guess we can switch the parameters to accepting a "high, medium, and low" that will correspond to your setting of the other sched_setscheduler() calls that were replaced.
-- Steve
Quoted 19 lines · Steven Rostedt
Quoted 16 lines · On Thu, 9 Jul 2020 14:45:05 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 15 lines · kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/fifo head: 8b700983de82f79e05b2c1136d6513ea4c9b22c4 commit: 616d91b68cd56bcb1954b6a5af7d542401fde772 [44/45] sched: Remove sched_setscheduler*() EXPORTs config: x86_64-rhel (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 reproduce (this is a W=1 build): git checkout 616d91b68cd56bcb1954b6a5af7d542401fde772 # save the attached .config to linux build tree make W=1 ARCH=x86_64If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>, old ones prefixed by <<):
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
ERROR: modpost: "
sched_setscheduler" [kernel/trace/ring_buffer_benchmark.ko] undefined!Steve, do you have any preference on how to go about fixing this one?
Well, I use to manually set the priority of the test, but I guess we can switch the parameters to accepting a "high, medium, and low" that will correspond to your setting of the other
sched_setscheduler()calls that were replaced.
Steve, would this work for you, or would you prefer renaming the parameters as well?
--- kernel/trace/ring_buffer_benchmark.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
kernel/trace/ring_buffer_benchmark.c +10 -12
@@ -455,21 +455,19 @@ static int __init ring_buffer_benchmark_init(void)* Run them as low-prio background tasks by default: */ if (!disable_reader) { -if (consumer_fifo >=0 ) { -struct sched_param param = { - .sched_priority = consumer_fifo - }; -sched_setscheduler (consumer,SCHED_FIFO , ¶m); - }else +if (consumer_fifo >1 ) +sched_set_fifo (consumer); +else if (consumer_fifo >=0 ) +sched_set_fifo_low (consumer); +else set_user_nice (consumer, consumer_nice); } -if (producer_fifo >=0 ) { -struct sched_param param = { - .sched_priority = producer_fifo - }; -sched_setscheduler (producer,SCHED_FIFO , ¶m); - }else +if (producer_fifo >1 ) +sched_set_fifo (producer); +else if (producer_fifo >=0 ) +sched_set_fifo_low (producer); +else set_user_nice (producer, producer_nice);return 0 ;
Steven Rostedt
maintainerQuoted 3 lines · On Mon, 20 Jul 2020 23:49:18 +0200 Peter Zijlstra <[email protected]> wrote:
Steve, would this work for you, or would you prefer renaming the parameters as well?
Yeah, that's fine. You don't have any sched_fifo_high() ?
Sometimes I see what the numbers are at prio 98.
Not a big deal, as I seldom do that, and I'm probably the only one doing it. I can live with patching the kernel to do that test.
-- Steve
Quoted 8 lines · Steven Rostedt
Quoted 3 lines · On Mon, 20 Jul 2020 23:49:18 +0200 Peter Zijlstra <[email protected]> wrote:
Steve, would this work for you, or would you prefer renaming the parameters as well?
Yeah, that's fine. You don't have any
sched_fifo_high()?
Thanks! and no.
I'll go write a Changelog and add it to tip/sched/fifo, so that hopefully, sfr can stop complaining about this build fail ;-)
I've even argued we should rename fifo_low() to something else, but failed to come up with a sensible name. The intended case is for when you want something above normal but don't particularly care about RT at all.
The thing is, once you start adding priorities, even low,med,high, we're back to where we were. And the whole argument is that the kernel cannot set priorities in any sensible fashion.
Quoted 15 lines · peterz(a)infradead.org
Quoted 8 lines · Steven Rostedt
Quoted 3 lines · On Mon, 20 Jul 2020 23:49:18 +0200 Peter Zijlstra <[email protected]> wrote:
Steve, would this work for you, or would you prefer renaming the parameters as well?
Yeah, that's fine. You don't have any
sched_fifo_high()?Thanks! and no.
I'll go write a Changelog and add it to tip/sched/fifo, so that hopefully, sfr can stop complaining about this build fail ;-)
Quoted 8 lines
I've even argued we should rename
fifo_low()to something else, but failed to come up with a sensible name. The intended case is for when you want something above normal but don't particularly care about RT at all.The thing is, once you start adding priorities, even low,med,high, we're back to where we were. And the whole argument is that the kernel cannot set priorities in any sensible fashion.
Agreed. I am worried about in-kernel users setting random uclamp values too.
This series should do most of the work but there are more pieces needed on-top.
Quoted 1 line
From what I see we still need to move the
sched_setscheduler()from
include/linux/sched.h to kernel/sched/sched.h. And sched_setattr() too. The latter has a single user in kernel/trace/trace_selftest.c to create a deadline task. I think that can be easily wrapped with a similar sched_set_dl() function and exported instead.
Happy to do the work if you nudge me after you've published this fix on tip or your queue.
Thanks
--
Qais Yousef
Quoted 21 lines · Qais Yousef
Quoted 20 lines · peterz(a)infradead.org
Quoted 8 lines · Steven Rostedt
Quoted 3 lines · On Mon, 20 Jul 2020 23:49:18 +0200 Peter Zijlstra <[email protected]> wrote:
Steve, would this work for you, or would you prefer renaming the parameters as well?
Yeah, that's fine. You don't have any
sched_fifo_high()?Thanks! and no.
I'll go write a Changelog and add it to tip/sched/fifo, so that hopefully, sfr can stop complaining about this build fail ;-)
I've even argued we should rename
fifo_low()to something else, but failed to come up with a sensible name. The intended case is for when you want something above normal but don't particularly care about RT at all.
Quoted 5 lines
Quoted 3 lines
The thing is, once you start adding priorities, even low,med,high, we're back to where we were. And the whole argument is that the kernel cannot set priorities in any sensible fashion.
Agreed. I am worried about in-kernel users setting random uclamp values too.
Do we really have to restrict in-kernel user?
And avoiding module uclamp abuse is covered by 616d91b68cd5 ("sched:
Remove sched_setscheduler*() EXPORTs").
Quoted 7 lines
This series should do most of the work but there are more pieces needed on-top.
From what I see we still need to move the
sched_setscheduler()frominclude/linux/sched.htokernel/sched/sched.h. Andsched_setattr()too. The latter has a single user inkernel/trace/trace_selftest.cto create a deadline task. I think that can be easily wrapped with a similarsched_set_dl()function and exported instead.
But DL does not have the same issue like the FIFO/RR when it comes to resource management.
Not sure if we have to restrict in-kernel user.
[...]
Quoted 26 lines · Dietmar Eggemann
Quoted 25 lines · Qais Yousef
Quoted 23 lines · peterz(a)infradead.org
Quoted 8 lines · Steven Rostedt
Quoted 3 lines · On Mon, 20 Jul 2020 23:49:18 +0200 Peter Zijlstra <[email protected]> wrote:
Steve, would this work for you, or would you prefer renaming the parameters as well?
Yeah, that's fine. You don't have any
sched_fifo_high()?Thanks! and no.
I'll go write a Changelog and add it to tip/sched/fifo, so that hopefully, sfr can stop complaining about this build fail ;-)
I've even argued we should rename
fifo_low()to something else, but failed to come up with a sensible name. The intended case is for when you want something above normal but don't particularly care about RT at all.The thing is, once you start adding priorities, even low,med,high, we're back to where we were. And the whole argument is that the kernel cannot set priorities in any sensible fashion.
Quoted 6 lines
Quoted 1 line
Agreed. I am worried about in-kernel users setting random uclamp values too.
Do we really have to restrict in-kernel user?
And avoiding module uclamp abuse is covered by
616d91b68cd5("sched:
Remove sched_setscheduler*() EXPORTs").
The worry is not just about modules abuse IMO. We can put a filter in our emails to catch all patches that try to use this API. I don't think we can assume we'd catch all.
Quoted 9 lines
Quoted 8 lines
This series should do most of the work but there are more pieces needed on-top.
From what I see we still need to move the
sched_setscheduler()frominclude/linux/sched.htokernel/sched/sched.h. Andsched_setattr()too. The latter has a single user inkernel/trace/trace_selftest.cto create a deadline task. I think that can be easily wrapped with a similarsched_set_dl()function and exported instead.
Quoted 3 lines
But DL does not have the same issue like the FIFO/RR when it comes to resource management.
Not sure if we have to restrict in-kernel user.
I didn't think much about it. But we can relax the wrapper if really needed. IMO the kernel should present a predictable behavior for userspace. But I don't know a lot about DL to comment. The easy answer the wrapper could be relaxed to offer the required tunables without giving direct access to sched_setscheduler().
Thanks
--
Qais Yousef
Quoted 41 lines · Dietmar Eggemann
Quoted 21 lines · Qais Yousef
Quoted 20 lines · peterz(a)infradead.org
Quoted 8 lines · Steven Rostedt
Quoted 3 lines · On Mon, 20 Jul 2020 23:49:18 +0200 Peter Zijlstra <[email protected]> wrote:
Steve, would this work for you, or would you prefer renaming the parameters as well?
Yeah, that's fine. You don't have any
sched_fifo_high()?Thanks! and no.
I'll go write a Changelog and add it to tip/sched/fifo, so that hopefully, sfr can stop complaining about this build fail ;-)
I've even argued we should rename
fifo_low()to something else, but failed to come up with a sensible name. The intended case is for when you want something above normal but don't particularly care about RT at all.Quoted 5 lines
Quoted 3 lines
The thing is, once you start adding priorities, even low,med,high, we're back to where we were. And the whole argument is that the kernel cannot set priorities in any sensible fashion.
Agreed. I am worried about in-kernel users setting random uclamp values too.
Do we really have to restrict in-kernel user?
And avoiding module uclamp abuse is covered by
616d91b68cd5("sched:
Remove sched_setscheduler*() EXPORTs").Quoted 7 lines
This series should do most of the work but there are more pieces needed on-top.
From what I see we still need to move the
sched_setscheduler()frominclude/linux/sched.htokernel/sched/sched.h. Andsched_setattr()too. The latter has a single user inkernel/trace/trace_selftest.cto create a deadline task. I think that can be easily wrapped with a similarsched_set_dl()function and exported instead.
Quoted 3 lines
But DL does not have the same issue like the FIFO/RR when it comes to resource management.
Not sure if we have to restrict in-kernel user.
FWIW, I have the patches ready and tested for posting.
http://linux-arm.org/git?p=linux-qy.git;a=shortlog;h=refs/heads/sched-setscheduler-hide
Peter, do you think it's not necessary to go to that level of restriction too?
It'll just avoid surprises IMO by making sched_set{sched, attr}() static. The wrapper can be flexible to change if needed, but at least we'll know.
I addressed Paul's concern on IRC too.
Thanks
--
Qais Yousef
Steven Rostedt
maintainerQuoted 7 lines · On Tue, 21 Jul 2020 10:36:43 +0200 peterz(a)infradead.org wrote:
Quoted 1 line
Yeah, that's fine. You don't have any
sched_fifo_high()?Thanks! and no.
I'll go write a Changelog and add it to tip/sched/fifo, so that hopefully, sfr can stop complaining about this build fail ;-)
Quoted 8 lines
I've even argued we should rename
fifo_low()to something else, but failed to come up with a sensible name. The intended case is for when you want something above normal but don't particularly care about RT at all.The thing is, once you start adding priorities, even low,med,high, we're back to where we were. And the whole argument is that the kernel cannot set priorities in any sensible fashion.
Actually, I was wondering about a "sched_fifo_benchmark()" used specifically for internal testing, where you *want* to disrupt the system. Perhaps have it depend on CONFIG_DEBUG to at least scare people away from using it for normal production code. Or make it print a nasty banner like trace_printk() does. That worked pretty well at keeping people from using it ;-)
-- Steve
PATCH 1/1 sched,tracing: Convert to sched_set_fifo()
In reply to Peter ZijlstraQuoted 2 lines · Peter Zijlstra
Steve, would this work for you, or would you prefer renaming the parameters as well?
Steve mentioned he's like to have the parameters changes after all. How's this then?
---
Subject: sched,tracing: Convert to sched_set_fifo()
From: Peter Zijlstra <[email protected]>
Date: Mon, 20 Jul 2020 23:49:18 +0200
One module user of sched_setscheduler() was overlooked and is obviously causing build failures.
Convert ring_buffer_benchmark to use sched_set_fifo_low() when fifo==1 and sched_set_fifo() when fifo==2. This is a bit of an abuse, but it makes the thing 'work' again.
Specifically, it enables all combinations that were previously possible:
producer higher than consumer
consumer higher than producer
--- kernel/trace/ring_buffer_benchmark.c | 48 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 25 deletions(-)
kernel/trace/ring_buffer_benchmark.c +23 -25
@@ -45,8 +45,8 @@ MODULE_PARM_DESC(write_iteration, "# ofstatic int producer_nice =MAX_NICE ;static int consumer_nice =MAX_NICE ; -static int producer_fifo =-1 ; -static int consumer_fifo =-1 ; +static int producer_fifo =0 ; +static int consumer_fifo =0 ;module_param (producer_nice, int,0644 );MODULE_PARM_DESC (producer_nice,"nice prio for producer" );
@@ -55,10 +55,10 @@ module_param(consumer_nice, int, 0644);MODULE_PARM_DESC (consumer_nice,"nice prio for consumer" );module_param (producer_fifo, int,0644 ); -MODULE_PARM_DESC (producer_fifo,"fifo prio for producer" ); +MODULE_PARM_DESC (producer_fifo,"use fifo for producer: 0 - disabled, 1 - low prio, 2 - fifo" );module_param (consumer_fifo, int,0644 ); -MODULE_PARM_DESC (consumer_fifo,"fifo prio for consumer" ); +MODULE_PARM_DESC (consumer_fifo,"use fifo for consumer: 0 - disabled, 1 - low prio, 2 - fifo" );static int read_events;
@@ -303,22 +303,22 @@ static void ring_buffer_producer(void)trace_printk ("ERROR!\n" );if (!disable_reader) { -if (consumer_fifo <0 ) -trace_printk ("Running Consumer at nice: %d\n" , - consumer_nice); -else +if (consumer_fifo)trace_printk ("Running Consumer at SCHED_FIFO %d\n" , consumer_fifo); +else +trace_printk ("Running Consumer at nice: %d\n" , + consumer_nice); } -if (producer_fifo <0 ) -trace_printk ("Running Producer at nice: %d\n" , - producer_nice); -else +if (producer_fifo)trace_printk ("Running Producer at SCHED_FIFO %d\n" , producer_fifo); +else +trace_printk ("Running Producer at nice: %d\n" , + producer_nice);/* Let the user know that the test is running at low priority */ -if (producer_fifo <0 && consumer_fifo <0 && +if (!producer_fifo && !consumer_fifo && producer_nice ==MAX_NICE && consumer_nice ==MAX_NICE )trace_printk ("WARNING!!! This test is running@lowest priority.\n" );
@@ -455,21 +455,19 @@ static int __init ring_buffer_benchmark_* Run them as low-prio background tasks by default: */ if (!disable_reader) { -if (consumer_fifo >=0 ) { -struct sched_param param = { - .sched_priority = consumer_fifo - }; -sched_setscheduler (consumer,SCHED_FIFO , ¶m); - }else +if (consumer_fifo ==2 ) +sched_set_fifo (consumer); +else if (consumer_fifo ==1 ) +sched_set_fifo_low (consumer); +else set_user_nice (consumer, consumer_nice); } -if (producer_fifo >=0 ) { -struct sched_param param = { - .sched_priority = producer_fifo - }; -sched_setscheduler (producer,SCHED_FIFO , ¶m); - }else +if (producer_fifo ==2 ) +sched_set_fifo (producer); +else if (producer_fifo ==1 ) +sched_set_fifo_low (producer); +else set_user_nice (producer, producer_nice);return 0 ;
Steven Rostedt
maintainerRe: [PATCH] sched,tracing: Convert to sched_set_fifo()
Quoted 36 lines · On Fri, 24 Jul 2020 23:39:11 +0200 peterz(a)infradead.org wrote:
Quoted 2 lines · Peter Zijlstra
Steve, would this work for you, or would you prefer renaming the parameters as well?
Steve mentioned he's like to have the parameters changes after all. How's this then?
---
Subject: sched,tracing: Convert tosched_set_fifo()
From: Peter Zijlstra <[email protected]>
Date: Mon, 20 Jul 2020 23:49:18 +0200One module user of
sched_setscheduler()was overlooked and is obviously causing build failures.Convert
ring_buffer_benchmarkto usesched_set_fifo_low()when fifo==1 andsched_set_fifo()when fifo==2. This is a bit of an abuse, but it makes the thing 'work' again.Specifically, it enables all combinations that were previously possible:
producer higher than consumer
consumer higher than producerFixes 616d91b68cd5 ("sched: Remove sched_setscheduler*() EXPORTs")Reported-by kernel test robot <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>--- kernel/trace/ring_buffer_benchmark.c | 48 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 25 deletions(-)
kernel/trace/ring_buffer_benchmark.c MODULE_PARM_DESC(write_iteration, "# of · line 49
Quoted 7 lines
kernel/trace/ring_buffer_benchmark.c +2
-2@@ -45,8 +45,8 @@ MODULE_PARM_DESC(write_iteration, "# ofstatic int producer_nice =MAX_NICE ;static int consumer_nice =MAX_NICE ; -static int producer_fifo =-1 ; -static int consumer_fifo =-1 ; +static int producer_fifo =0 ; +static int consumer_fifo =0 ;
The initialization of zero for static variables isn't needed.
Quoted 17 lines
kernel/trace/ring_buffer_benchmark.c +2
-2module_param (producer_nice, int,0644 );MODULE_PARM_DESC (producer_nice,"nice prio for producer" );@@ -55,10 +55,10 @@ module_param(consumer_nice, int, 0644);MODULE_PARM_DESC (consumer_nice,"nice prio for consumer" );module_param (producer_fifo, int,0644 ); -MODULE_PARM_DESC (producer_fifo,"fifo prio for producer" ); +MODULE_PARM_DESC (producer_fifo,"use fifo for producer: 0 - disabled, 1 - low prio, 2 - fifo" );module_param (consumer_fifo, int,0644 ); -MODULE_PARM_DESC (consumer_fifo,"fifo prio for consumer" ); +MODULE_PARM_DESC (consumer_fifo,"use fifo for consumer: 0 - disabled, 1 - low prio, 2 - fifo" );static int read_events;
kernel/trace/ring_buffer_benchmark.c static void ring_buffer_producer(void) · line 308
Quoted 10 lines
kernel/trace/ring_buffer_benchmark.c +1
-4@@ -303,22 +303,22 @@ static void ring_buffer_producer(void)trace_printk ("ERROR!\n" );if (!disable_reader) { -if (consumer_fifo <0 ) -trace_printk ("Running Consumer at nice: %d\n" , - consumer_nice); -else +if (consumer_fifo)trace_printk ("Running Consumer at SCHED_FIFO %d\n" , consumer_fifo);
Can we change the above to:
trace_printk("Running Consumer at SCHED_FIFO %s\n",
consumer_fifo == 1 ? "low" : "high");kernel/trace/ring_buffer_benchmark.c static void ring_buffer_producer(void) · line 315
Quoted 11 lines
kernel/trace/ring_buffer_benchmark.c +4
-4+else +trace_printk ("Running Consumer at nice: %d\n" , + consumer_nice); } -if (producer_fifo <0 ) -trace_printk ("Running Producer at nice: %d\n" , - producer_nice); -else +if (producer_fifo)trace_printk ("Running Producer at SCHED_FIFO %d\n" , producer_fifo);
Same here.
Quoted 11 lines
kernel/trace/ring_buffer_benchmark.c +4
-1+else +trace_printk ("Running Producer at nice: %d\n" , + producer_nice);/* Let the user know that the test is running at low priority */ -if (producer_fifo <0 && consumer_fifo <0 && +if (!producer_fifo && !consumer_fifo && producer_nice ==MAX_NICE && consumer_nice ==MAX_NICE )trace_printk ("WARNING!!! This test is running at lowest priority.\n" );
kernel/trace/ring_buffer_benchmark.c static int __init ring_buffer_benchmark_ · line 458
Quoted 10 lines
kernel/trace/ring_buffer_benchmark.c +1
-6@@ -455,21 +455,19 @@ static int __init ring_buffer_benchmark_* Run them as low-prio background tasks by default: */ if (!disable_reader) { -if (consumer_fifo >=0 ) { -struct sched_param param = { - .sched_priority = consumer_fifo - }; -sched_setscheduler (consumer,SCHED_FIFO , ¶m); - }else +if (consumer_fifo ==2 )
Let's make this be:
if (consumer_fifo > 1)
Then if someone sends in 3 it doesn't go low again.
Quoted 4 lines
kernel/trace/ring_buffer_benchmark.c +4
-0+sched_set_fifo (consumer); + else if (consumer_fifo == 1) + sched_set_fifo_low(consumer); + else
kernel/trace/ring_buffer_benchmark.c static int __init ring_buffer_benchmark_ · line 466
Quoted 10 lines
kernel/trace/ring_buffer_benchmark.c +1
-6set_user_nice (consumer, consumer_nice); } -if (producer_fifo >=0 ) { -struct sched_param param = { - .sched_priority = producer_fifo - }; -sched_setscheduler (producer,SCHED_FIFO , ¶m); - }else +if (producer_fifo ==2 )
Same here.
-- Steve
Quoted 7 lines
kernel/trace/ring_buffer_benchmark.c +4
-0+sched_set_fifo (producer); + else if (producer_fifo == 1) + sched_set_fifo_low(producer); + else set_user_nice(producer, producer_nice); return 0;
PATCH v2 1/1 sched,tracing: Convert to sched_set_fifo()
Subject: sched,tracing: Convert to sched_set_fifo()
From: Peter Zijlstra <[email protected]>
Date: Mon, 20 Jul 2020 23:49:18 +0200
One module user of sched_setscheduler() was overlooked and is obviously causing build failures.
Convert ring_buffer_benchmark to use sched_set_fifo_low() when fifo==1 and sched_set_fifo() when fifo==2. This is a bit of an abuse, but it makes the thing 'work' again.
Specifically, it enables all combinations that were previously possible:
producer higher than consumer
consumer higher than producer
--- kernel/trace/ring_buffer_benchmark.c | 48 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 25 deletions(-)
kernel/trace/ring_buffer_benchmark.c +23 -25
@@ -45,8 +45,8 @@ MODULE_PARM_DESC(write_iteration, "# ofstatic int producer_nice =MAX_NICE ;static int consumer_nice =MAX_NICE ; -static int producer_fifo =-1 ; -static int consumer_fifo =-1 ; +static int producer_fifo; +static int consumer_fifo;module_param (producer_nice, int,0644 );MODULE_PARM_DESC (producer_nice,"nice prio for producer" );
@@ -55,10 +55,10 @@ module_param(consumer_nice, int, 0644);MODULE_PARM_DESC (consumer_nice,"nice prio for consumer" );module_param (producer_fifo, int,0644 ); -MODULE_PARM_DESC (producer_fifo,"fifo prio for producer" ); +MODULE_PARM_DESC (producer_fifo,"use fifo for producer: 0 - disabled, 1 - low prio, 2 - fifo" );module_param (consumer_fifo, int,0644 ); -MODULE_PARM_DESC (consumer_fifo,"fifo prio for consumer" ); +MODULE_PARM_DESC (consumer_fifo,"use fifo for consumer: 0 - disabled, 1 - low prio, 2 - fifo" );static int read_events;
@@ -303,22 +303,22 @@ static void ring_buffer_producer(void)trace_printk ("ERROR!\n" );if (!disable_reader) { -if (consumer_fifo <0 ) +if (consumer_fifo) +trace_printk ("Running Consumer at SCHED_FIFO %s\n" , + consumer_fifo ==1 ?"low" :"high" ); +else trace_printk ("Running Consumer at nice: %d\n" , consumer_nice); -else -trace_printk ("Running Consumer at SCHED_FIFO %d\n" , - consumer_fifo); } -if (producer_fifo <0 ) +if (producer_fifo) +trace_printk ("Running Producer at SCHED_FIFO %s\n" , + consumer_fifo ==1 ?"low" :"high" ); +else trace_printk ("Running Producer at nice: %d\n" , producer_nice); -else -trace_printk ("Running Producer at SCHED_FIFO %d\n" , - producer_fifo);/* Let the user know that the test is running at low priority */ -if (producer_fifo <0 && consumer_fifo <0 && +if (!producer_fifo && !consumer_fifo && producer_nice ==MAX_NICE && consumer_nice ==MAX_NICE )trace_printk ("WARNING!!! This test is running@lowest priority.\n" );
@@ -455,21 +455,19 @@ static int __init ring_buffer_benchmark_* Run them as low-prio background tasks by default: */ if (!disable_reader) { -if (consumer_fifo >=0 ) { -struct sched_param param = { - .sched_priority = consumer_fifo - }; -sched_setscheduler (consumer,SCHED_FIFO , ¶m); - }else +if (consumer_fifo >=2 ) +sched_set_fifo (consumer); +else if (consumer_fifo ==1 ) +sched_set_fifo_low (consumer); +else set_user_nice (consumer, consumer_nice); } -if (producer_fifo >=0 ) { -struct sched_param param = { - .sched_priority = producer_fifo - }; -sched_setscheduler (producer,SCHED_FIFO , ¶m); - }else +if (producer_fifo >=2 ) +sched_set_fifo (producer); +else if (producer_fifo ==1 ) +sched_set_fifo_low (producer); +else set_user_nice (producer, producer_nice);return 0 ;
Steven Rostedt
maintainerRe: [PATCH v2] sched,tracing: Convert to sched_set_fifo()
kernel/trace/ring_buffer_benchmark.c static void ring_buffer_producer(void) · line 315
Quoted 4 lines · On Fri, 24 Jul 2020 23:50:03 +0200 peterz(a)infradead.org wrote:
kernel/trace/ring_buffer_benchmark.c +3
-1-if (producer_fifo <0 ) +if (producer_fifo) +trace_printk ("Running Producer at SCHED_FIFO %s\n" , + consumer_fifo ==1 ?"low" :"high" );
I'm going to take cut-and-paste away from you!
-- Steve
Quoted 3 lines
kernel/trace/ring_buffer_benchmark.c +1
-0+else trace_printk ("Running Producer at nice: %d\n" , producer_nice);
Re: [PATCH v2] sched,tracing: Convert to sched_set_fifo()
Quoted 9 lines · Steven Rostedt
kernel/trace/ring_buffer_benchmark.c static void ring_buffer_producer(void) · line 315
Quoted 4 lines · On Fri, 24 Jul 2020 23:50:03 +0200 peterz(a)infradead.org wrote:
kernel/trace/ring_buffer_benchmark.c +3
-1-if (producer_fifo <0 ) +if (producer_fifo) +trace_printk ("Running Producer at SCHED_FIFO %s\n" , + consumer_fifo ==1 ?"low" :"high" );I'm going to take cut-and-paste away from you!
Well, yes, I said so, I also already have it fixed.
Aside from that, is the patch ok?
Re: [PATCH v2] sched,tracing: Convert to sched_set_fifo()
Quoted 4 lines · On Sat, 25 Jul 2020 18:58:16 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 3 lines · Steven Rostedt
On Fri, 24 Jul 2020 23:50:03 +0200
peterz(a)infradead.org wrote:
Quoted 8 lines
Quoted 6 lines
kernel/trace/ring_buffer_benchmark.c static void ring_buffer_producer(void) · line 315
Quoted 4 lines
kernel/trace/ring_buffer_benchmark.c +3
-1-if (producer_fifo <0 ) +if (producer_fifo) +trace_printk ("Running Producer at SCHED_FIFO %s\n" , + consumer_fifo ==1 ?"low" :"high" );I'm going to take cut-and-paste away from you!
Well, yes, I said so, I also already have it fixed.
I thought you're comment on IRC was about v1, as I read it before seeing v2.
Quoted 2 lines
Aside from that, is the patch ok?
Beside this, yes.
-- Steve
[tip: sched/fifo] sched,tracing: Convert to sched_set_fifo()
In reply to Peter ZijlstraThe following commit has been merged into the sched/fifo branch of tip:
The following commit has been merged into the sched/fifo branch of tip:
Commit-ID: 4fd5750af02ab7bba7c58a073060cc1da8a69173 Gitweb: https://git.kernel.org/tip/4fd5750af02ab7bba7c58a073060cc1da8a69173 Author: Peter Zijlstra <[email protected]> AuthorDate: Mon, 20 Jul 2020 23:49:18 +02:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 29 Jul 2020 11:43:53 +02:00
sched,tracing: Convert to sched_set_fifo()
One module user of sched_setscheduler() was overlooked and is obviously causing build failures.
Convert ring_buffer_benchmark to use sched_set_fifo_low() when fifo==1 and sched_set_fifo() when fifo==2. This is a bit of an abuse, but it makes the thing 'work' again.
Specifically, it enables all combinations that were previously possible:
producer higher than consumer
consumer higher than producer
--- kernel/trace/ring_buffer_benchmark.c | 48 ++++++++++++--------------- 1 file changed, 23 insertions(+), 25 deletions(-)
kernel/trace/ring_buffer_benchmark.c +23 -25
@@ -45,8 +45,8 @@ MODULE_PARM_DESC(write_iteration, "# of writes between timestamp readings");static int producer_nice =MAX_NICE ;static int consumer_nice =MAX_NICE ; -static int producer_fifo =-1 ; -static int consumer_fifo =-1 ; +static int producer_fifo; +static int consumer_fifo;module_param (producer_nice, int,0644 );MODULE_PARM_DESC (producer_nice,"nice prio for producer" );
@@ -55,10 +55,10 @@ module_param(consumer_nice, int, 0644);MODULE_PARM_DESC (consumer_nice,"nice prio for consumer" );module_param (producer_fifo, int,0644 ); -MODULE_PARM_DESC (producer_fifo,"fifo prio for producer" ); +MODULE_PARM_DESC (producer_fifo,"use fifo for producer: 0 - disabled, 1 - low prio, 2 - fifo" );module_param (consumer_fifo, int,0644 ); -MODULE_PARM_DESC (consumer_fifo,"fifo prio for consumer" ); +MODULE_PARM_DESC (consumer_fifo,"use fifo for consumer: 0 - disabled, 1 - low prio, 2 - fifo" );static int read_events;
@@ -303,22 +303,22 @@ static void ring_buffer_producer(void)trace_printk ("ERROR!\n" );if (!disable_reader) { -if (consumer_fifo <0 ) +if (consumer_fifo) +trace_printk ("Running Consumer at SCHED_FIFO %s\n" , + consumer_fifo ==1 ?"low" :"high" ); +else trace_printk ("Running Consumer at nice: %d\n" , consumer_nice); -else -trace_printk ("Running Consumer at SCHED_FIFO %d\n" , - consumer_fifo); } -if (producer_fifo <0 ) +if (producer_fifo) +trace_printk ("Running Producer at SCHED_FIFO %s\n" , + producer_fifo ==1 ?"low" :"high" ); +else trace_printk ("Running Producer at nice: %d\n" , producer_nice); -else -trace_printk ("Running Producer at SCHED_FIFO %d\n" , - producer_fifo);/* Let the user know that the test is running at low priority */ -if (producer_fifo <0 && consumer_fifo <0 && +if (!producer_fifo && !consumer_fifo && producer_nice ==MAX_NICE && consumer_nice ==MAX_NICE )trace_printk ("WARNING!!! This test is running at lowest priority.\n" );
@@ -455,21 +455,19 @@ static int __init ring_buffer_benchmark_init(void)* Run them as low-prio background tasks by default: */ if (!disable_reader) { -if (consumer_fifo >=0 ) { -struct sched_param param = { - .sched_priority = consumer_fifo - }; -sched_setscheduler (consumer,SCHED_FIFO , ¶m); - }else +if (consumer_fifo >=2 ) +sched_set_fifo (consumer); +else if (consumer_fifo ==1 ) +sched_set_fifo_low (consumer); +else set_user_nice (consumer, consumer_nice); } -if (producer_fifo >=0 ) { -struct sched_param param = { - .sched_priority = producer_fifo - }; -sched_setscheduler (producer,SCHED_FIFO , ¶m); - }else +if (producer_fifo >=2 ) +sched_set_fifo (producer); +else if (producer_fifo ==1 ) +sched_set_fifo_low (producer); +else set_user_nice (producer, producer_nice);return 0 ;