Message ID | 20211110202448.4054153-5-valentin.schneider@arm.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | preempt: PREEMPT vs PREEMPT_DYNAMIC configs fixup | expand |
Subject s/kscan/kcsan/ On Wed, Nov 10, 2021 at 08:24PM +0000, Valentin Schneider wrote: > Per PREEMPT_DYNAMIC, checking CONFIG_PREEMPT doesn't tell you the actual > preemption model of the live kernel. Use the newly-introduced accessors > instead. > > Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> Reviewed-by: Marco Elver <elver@google.com> Though it currently doesn't compile as a module due to missing EXPORT_SYMBOL of is_preempt*(). > --- > kernel/kcsan/kcsan_test.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c > index dc55fd5a36fc..14d811eb9a21 100644 > --- a/kernel/kcsan/kcsan_test.c > +++ b/kernel/kcsan/kcsan_test.c > @@ -1005,13 +1005,13 @@ static const void *nthreads_gen_params(const void *prev, char *desc) > else > nthreads *= 2; > > - if (!IS_ENABLED(CONFIG_PREEMPT) || !IS_ENABLED(CONFIG_KCSAN_INTERRUPT_WATCHER)) { > + if (!is_preempt_full() || !IS_ENABLED(CONFIG_KCSAN_INTERRUPT_WATCHER)) { > /* > * Without any preemption, keep 2 CPUs free for other tasks, one > * of which is the main test case function checking for > * completion or failure. > */ > - const long min_unused_cpus = IS_ENABLED(CONFIG_PREEMPT_NONE) ? 2 : 0; > + const long min_unused_cpus = is_preempt_none() ? 2 : 0; > const long min_required_cpus = 2 + min_unused_cpus; > > if (num_online_cpus() < min_required_cpus) { > -- > 2.25.1
On Thu, 11 Nov 2021 at 10:11, Marco Elver <elver@google.com> wrote: > > Subject s/kscan/kcsan/ > > On Wed, Nov 10, 2021 at 08:24PM +0000, Valentin Schneider wrote: > > Per PREEMPT_DYNAMIC, checking CONFIG_PREEMPT doesn't tell you the actual > > preemption model of the live kernel. Use the newly-introduced accessors > > instead. > > > > Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> > > Reviewed-by: Marco Elver <elver@google.com> > > Though it currently doesn't compile as a module due to missing > EXPORT_SYMBOL of is_preempt*(). > > > --- > > kernel/kcsan/kcsan_test.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c > > index dc55fd5a36fc..14d811eb9a21 100644 > > --- a/kernel/kcsan/kcsan_test.c > > +++ b/kernel/kcsan/kcsan_test.c > > @@ -1005,13 +1005,13 @@ static const void *nthreads_gen_params(const void *prev, char *desc) > > else > > nthreads *= 2; > > > > - if (!IS_ENABLED(CONFIG_PREEMPT) || !IS_ENABLED(CONFIG_KCSAN_INTERRUPT_WATCHER)) { > > + if (!is_preempt_full() || !IS_ENABLED(CONFIG_KCSAN_INTERRUPT_WATCHER)) { In case you introduce the 5th helper I suggested (is_preempt_full_or_rt() or whatever you'll call it), this one can be switched, because this check really does want to know if "at least full preemption" and not "precisely full preemption". Thanks, -- Marco
On 11/11/21 10:11, Marco Elver wrote: > Subject s/kscan/kcsan/ > Woops... > On Wed, Nov 10, 2021 at 08:24PM +0000, Valentin Schneider wrote: >> Per PREEMPT_DYNAMIC, checking CONFIG_PREEMPT doesn't tell you the actual >> preemption model of the live kernel. Use the newly-introduced accessors >> instead. >> >> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> > > Reviewed-by: Marco Elver <elver@google.com> > > Though it currently doesn't compile as a module due to missing > EXPORT_SYMBOL of is_preempt*(). > >> --- >> kernel/kcsan/kcsan_test.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c >> index dc55fd5a36fc..14d811eb9a21 100644 >> --- a/kernel/kcsan/kcsan_test.c >> +++ b/kernel/kcsan/kcsan_test.c >> @@ -1005,13 +1005,13 @@ static const void *nthreads_gen_params(const void *prev, char *desc) >> else >> nthreads *= 2; >> >> - if (!IS_ENABLED(CONFIG_PREEMPT) || !IS_ENABLED(CONFIG_KCSAN_INTERRUPT_WATCHER)) { >> + if (!is_preempt_full() || !IS_ENABLED(CONFIG_KCSAN_INTERRUPT_WATCHER)) { >> /* >> * Without any preemption, keep 2 CPUs free for other tasks, one >> * of which is the main test case function checking for >> * completion or failure. >> */ >> - const long min_unused_cpus = IS_ENABLED(CONFIG_PREEMPT_NONE) ? 2 : 0; >> + const long min_unused_cpus = is_preempt_none() ? 2 : 0; >> const long min_required_cpus = 2 + min_unused_cpus; >> >> if (num_online_cpus() < min_required_cpus) { >> -- >> 2.25.1
diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c index dc55fd5a36fc..14d811eb9a21 100644 --- a/kernel/kcsan/kcsan_test.c +++ b/kernel/kcsan/kcsan_test.c @@ -1005,13 +1005,13 @@ static const void *nthreads_gen_params(const void *prev, char *desc) else nthreads *= 2; - if (!IS_ENABLED(CONFIG_PREEMPT) || !IS_ENABLED(CONFIG_KCSAN_INTERRUPT_WATCHER)) { + if (!is_preempt_full() || !IS_ENABLED(CONFIG_KCSAN_INTERRUPT_WATCHER)) { /* * Without any preemption, keep 2 CPUs free for other tasks, one * of which is the main test case function checking for * completion or failure. */ - const long min_unused_cpus = IS_ENABLED(CONFIG_PREEMPT_NONE) ? 2 : 0; + const long min_unused_cpus = is_preempt_none() ? 2 : 0; const long min_required_cpus = 2 + min_unused_cpus; if (num_online_cpus() < min_required_cpus) {
Per PREEMPT_DYNAMIC, checking CONFIG_PREEMPT doesn't tell you the actual preemption model of the live kernel. Use the newly-introduced accessors instead. Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> --- kernel/kcsan/kcsan_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)