* [PATCH] x86/kgdb: Replace bool_int_array[NR_CPUS] with bitmap
@ 2015-09-26 12:47 Denys Vlasenko
2015-09-26 12:47 ` [PATCH] cpufreq: p4-clockmod: " Denys Vlasenko
2015-09-29 8:36 ` [tip:x86/debug] x86/kgdb: " tip-bot for Denys Vlasenko
0 siblings, 2 replies; 7+ messages in thread
From: Denys Vlasenko @ 2015-09-26 12:47 UTC (permalink / raw)
To: Jason Wessel, Ingo Molnar
Cc: Denys Vlasenko, H. Peter Anvin, x86, linux-kernel
Straigntforward conversion from
int was_in_debug_nmi[NR_CPUS]
to
DECLARE_BITMAP(was_in_debug_nmi, NR_CPUS)
Saves about 2 kbytes in bss for NR_CPUS=512.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: Jason Wessel <jason.wessel@windriver.com>
CC: Ingo Molnar <mingo@kernel.org>
CC: H. Peter Anvin <hpa@zytor.com>
CC: x86@kernel.org
CC: linux-kernel@vger.kernel.org
---
arch/x86/kernel/kgdb.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index d6178d9..dd0a003 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -511,24 +511,27 @@ single_step_cont(struct pt_regs *regs, struct die_args *args)
return NOTIFY_STOP;
}
-static int was_in_debug_nmi[NR_CPUS];
+static DECLARE_BITMAP(was_in_debug_nmi, NR_CPUS);
static int kgdb_nmi_handler(unsigned int cmd, struct pt_regs *regs)
{
+ int cpu;
+
switch (cmd) {
case NMI_LOCAL:
if (atomic_read(&kgdb_active) != -1) {
/* KGDB CPU roundup */
- kgdb_nmicallback(raw_smp_processor_id(), regs);
- was_in_debug_nmi[raw_smp_processor_id()] = 1;
+ cpu = raw_smp_processor_id();
+ kgdb_nmicallback(cpu, regs);
+ set_bit(cpu, was_in_debug_nmi);
touch_nmi_watchdog();
return NMI_HANDLED;
}
break;
case NMI_UNKNOWN:
- if (was_in_debug_nmi[raw_smp_processor_id()]) {
- was_in_debug_nmi[raw_smp_processor_id()] = 0;
+ cpu = raw_smp_processor_id();
+ if (__test_and_clear_bit(cpu, was_in_debug_nmi)) {
return NMI_HANDLED;
}
break;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap 2015-09-26 12:47 [PATCH] x86/kgdb: Replace bool_int_array[NR_CPUS] with bitmap Denys Vlasenko @ 2015-09-26 12:47 ` Denys Vlasenko 2015-09-26 22:07 ` Viresh Kumar 2015-09-27 16:10 ` Jean Delvare 2015-09-29 8:36 ` [tip:x86/debug] x86/kgdb: " tip-bot for Denys Vlasenko 1 sibling, 2 replies; 7+ messages in thread From: Denys Vlasenko @ 2015-09-26 12:47 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki Cc: Denys Vlasenko, Ingo Molnar, Bartosz Golaszewski, H. Peter Anvin, Benoit Cousson, Fenghua Yu, Guenter Roeck, Jean Delvare, Jonathan Corbet, Peter Zijlstra, Thomas Gleixner, x86, linux-kernel Straigntforward conversion from int has_N44_O17_errata[NR_CPUS] to DECLARE_BITMAP(has_N44_O17_errata, NR_CPUS) Saves about 2 kbytes in bss for NR_CPUS=512. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> CC: Viresh Kumar <viresh.kumar@linaro.org> CC: Rafael J. Wysocki <rjw@rjwysocki.net> CC: Ingo Molnar <mingo@kernel.org> CC: Bartosz Golaszewski <bgolaszewski@baylibre.com> CC: H. Peter Anvin <hpa@zytor.com> CC: Benoit Cousson <bcousson@baylibre.com> CC: Fenghua Yu <fenghua.yu@intel.com> CC: Guenter Roeck <linux@roeck-us.net> CC: Jean Delvare <jdelvare@suse.de> CC: Jonathan Corbet <corbet@lwn.net> CC: Peter Zijlstra <peterz@infradead.org> CC: Thomas Gleixner <tglx@linutronix.de> CC: x86@kernel.org CC: linux-kernel@vger.kernel.org --- drivers/cpufreq/p4-clockmod.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c index 5dd95da..dd15810 100644 --- a/drivers/cpufreq/p4-clockmod.c +++ b/drivers/cpufreq/p4-clockmod.c @@ -49,7 +49,7 @@ enum { #define DC_ENTRIES 8 -static int has_N44_O17_errata[NR_CPUS]; +static DECLARE_BITMAP(has_N44_O17_errata, NR_CPUS); static unsigned int stock_freq; static struct cpufreq_driver p4clockmod_driver; static unsigned int cpufreq_p4_get(unsigned int cpu); @@ -66,7 +66,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate) if (l & 0x01) pr_debug("CPU#%d currently thermal throttled\n", cpu); - if (has_N44_O17_errata[cpu] && + if (test_bit(cpu, has_N44_O17_errata) && (newstate == DC_25PT || newstate == DC_DFLT)) newstate = DC_38PT; @@ -182,7 +182,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) case 0x0f0a: case 0x0f11: case 0x0f12: - has_N44_O17_errata[policy->cpu] = 1; + set_bit(policy->cpu, has_N44_O17_errata); pr_debug("has errata -- disabling low frequencies\n"); } @@ -199,7 +199,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) /* table init */ for (i = 1; (p4clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) { - if ((i < 2) && (has_N44_O17_errata[policy->cpu])) + if ((i < 2) && test_bit(policy->cpu, has_N44_O17_errata)) p4clockmod_table[i].frequency = CPUFREQ_ENTRY_INVALID; else p4clockmod_table[i].frequency = (stock_freq * i)/8; -- 1.8.1.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap 2015-09-26 12:47 ` [PATCH] cpufreq: p4-clockmod: " Denys Vlasenko @ 2015-09-26 22:07 ` Viresh Kumar 2015-09-27 16:10 ` Jean Delvare 1 sibling, 0 replies; 7+ messages in thread From: Viresh Kumar @ 2015-09-26 22:07 UTC (permalink / raw) To: Denys Vlasenko Cc: Rafael J. Wysocki, Ingo Molnar, Bartosz Golaszewski, H. Peter Anvin, Benoit Cousson, Fenghua Yu, Guenter Roeck, Jean Delvare, Jonathan Corbet, Peter Zijlstra, Thomas Gleixner, x86, linux-kernel On 26-09-15, 14:47, Denys Vlasenko wrote: > Straigntforward conversion from > int has_N44_O17_errata[NR_CPUS] > to > DECLARE_BITMAP(has_N44_O17_errata, NR_CPUS) > > Saves about 2 kbytes in bss for NR_CPUS=512. > > Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> > CC: Viresh Kumar <viresh.kumar@linaro.org> > CC: Rafael J. Wysocki <rjw@rjwysocki.net> > CC: Ingo Molnar <mingo@kernel.org> > CC: Bartosz Golaszewski <bgolaszewski@baylibre.com> > CC: H. Peter Anvin <hpa@zytor.com> > CC: Benoit Cousson <bcousson@baylibre.com> > CC: Fenghua Yu <fenghua.yu@intel.com> > CC: Guenter Roeck <linux@roeck-us.net> > CC: Jean Delvare <jdelvare@suse.de> > CC: Jonathan Corbet <corbet@lwn.net> > CC: Peter Zijlstra <peterz@infradead.org> > CC: Thomas Gleixner <tglx@linutronix.de> > CC: x86@kernel.org > CC: linux-kernel@vger.kernel.org > --- > drivers/cpufreq/p4-clockmod.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c > index 5dd95da..dd15810 100644 > --- a/drivers/cpufreq/p4-clockmod.c > +++ b/drivers/cpufreq/p4-clockmod.c > @@ -49,7 +49,7 @@ enum { > #define DC_ENTRIES 8 > > > -static int has_N44_O17_errata[NR_CPUS]; > +static DECLARE_BITMAP(has_N44_O17_errata, NR_CPUS); > static unsigned int stock_freq; > static struct cpufreq_driver p4clockmod_driver; > static unsigned int cpufreq_p4_get(unsigned int cpu); > @@ -66,7 +66,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate) > if (l & 0x01) > pr_debug("CPU#%d currently thermal throttled\n", cpu); > > - if (has_N44_O17_errata[cpu] && > + if (test_bit(cpu, has_N44_O17_errata) && > (newstate == DC_25PT || newstate == DC_DFLT)) > newstate = DC_38PT; > > @@ -182,7 +182,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) > case 0x0f0a: > case 0x0f11: > case 0x0f12: > - has_N44_O17_errata[policy->cpu] = 1; > + set_bit(policy->cpu, has_N44_O17_errata); > pr_debug("has errata -- disabling low frequencies\n"); > } > > @@ -199,7 +199,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) > > /* table init */ > for (i = 1; (p4clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) { > - if ((i < 2) && (has_N44_O17_errata[policy->cpu])) > + if ((i < 2) && test_bit(policy->cpu, has_N44_O17_errata)) > p4clockmod_table[i].frequency = CPUFREQ_ENTRY_INVALID; > else > p4clockmod_table[i].frequency = (stock_freq * i)/8; Acked-by: Viresh Kumar <viresh.kumar@linaro.org> -- viresh ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap 2015-09-26 12:47 ` [PATCH] cpufreq: p4-clockmod: " Denys Vlasenko 2015-09-26 22:07 ` Viresh Kumar @ 2015-09-27 16:10 ` Jean Delvare 2015-09-27 17:58 ` Denys Vlasenko 1 sibling, 1 reply; 7+ messages in thread From: Jean Delvare @ 2015-09-27 16:10 UTC (permalink / raw) To: Denys Vlasenko Cc: Viresh Kumar, Rafael J. Wysocki, Ingo Molnar, Bartosz Golaszewski, H. Peter Anvin, Benoit Cousson, Fenghua Yu, Guenter Roeck, Jonathan Corbet, Peter Zijlstra, Thomas Gleixner, x86, linux-kernel Hi Denys, On Sat, 26 Sep 2015 14:47:18 +0200, Denys Vlasenko wrote: > Straigntforward conversion from > int has_N44_O17_errata[NR_CPUS] > to > DECLARE_BITMAP(has_N44_O17_errata, NR_CPUS) > > Saves about 2 kbytes in bss for NR_CPUS=512. > > Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> > CC: Viresh Kumar <viresh.kumar@linaro.org> > CC: Rafael J. Wysocki <rjw@rjwysocki.net> > CC: Ingo Molnar <mingo@kernel.org> > CC: Bartosz Golaszewski <bgolaszewski@baylibre.com> > CC: H. Peter Anvin <hpa@zytor.com> > CC: Benoit Cousson <bcousson@baylibre.com> > CC: Fenghua Yu <fenghua.yu@intel.com> > CC: Guenter Roeck <linux@roeck-us.net> > CC: Jean Delvare <jdelvare@suse.de> > CC: Jonathan Corbet <corbet@lwn.net> > CC: Peter Zijlstra <peterz@infradead.org> > CC: Thomas Gleixner <tglx@linutronix.de> > CC: x86@kernel.org > CC: linux-kernel@vger.kernel.org > --- > drivers/cpufreq/p4-clockmod.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c > index 5dd95da..dd15810 100644 > --- a/drivers/cpufreq/p4-clockmod.c > +++ b/drivers/cpufreq/p4-clockmod.c > @@ -49,7 +49,7 @@ enum { > #define DC_ENTRIES 8 > > > -static int has_N44_O17_errata[NR_CPUS]; > +static DECLARE_BITMAP(has_N44_O17_errata, NR_CPUS); > static unsigned int stock_freq; > static struct cpufreq_driver p4clockmod_driver; > static unsigned int cpufreq_p4_get(unsigned int cpu); > @@ -66,7 +66,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate) > if (l & 0x01) > pr_debug("CPU#%d currently thermal throttled\n", cpu); > > - if (has_N44_O17_errata[cpu] && > + if (test_bit(cpu, has_N44_O17_errata) && > (newstate == DC_25PT || newstate == DC_DFLT)) > newstate = DC_38PT; > > @@ -182,7 +182,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) > case 0x0f0a: > case 0x0f11: > case 0x0f12: > - has_N44_O17_errata[policy->cpu] = 1; > + set_bit(policy->cpu, has_N44_O17_errata); > pr_debug("has errata -- disabling low frequencies\n"); > } > > @@ -199,7 +199,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) > > /* table init */ > for (i = 1; (p4clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) { > - if ((i < 2) && (has_N44_O17_errata[policy->cpu])) > + if ((i < 2) && test_bit(policy->cpu, has_N44_O17_errata)) > p4clockmod_table[i].frequency = CPUFREQ_ENTRY_INVALID; > else > p4clockmod_table[i].frequency = (stock_freq * i)/8; Looks good, however I think you should #include <linux/bitmap.h> to avoid build failures in the future or on certain architectures. -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap 2015-09-27 16:10 ` Jean Delvare @ 2015-09-27 17:58 ` Denys Vlasenko 2015-09-28 7:10 ` Jean Delvare 0 siblings, 1 reply; 7+ messages in thread From: Denys Vlasenko @ 2015-09-27 17:58 UTC (permalink / raw) To: Jean Delvare Cc: Viresh Kumar, Rafael J. Wysocki, Ingo Molnar, Bartosz Golaszewski, H. Peter Anvin, Benoit Cousson, Fenghua Yu, Guenter Roeck, Jonathan Corbet, Peter Zijlstra, Thomas Gleixner, x86, linux-kernel On 09/27/2015 06:10 PM, Jean Delvare wrote: > Looks good, however I think you should #include <linux/bitmap.h> to > avoid build failures in the future or on certain architectures. <linux/cpumask.h> already includes <linux/bitmap.h> on any arch. p4-clockmod.c builds only on x86 arch, it's Pentium 4 on demand clock modulation/speed scaling module. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpufreq: p4-clockmod: Replace bool_int_array[NR_CPUS] with bitmap 2015-09-27 17:58 ` Denys Vlasenko @ 2015-09-28 7:10 ` Jean Delvare 0 siblings, 0 replies; 7+ messages in thread From: Jean Delvare @ 2015-09-28 7:10 UTC (permalink / raw) To: Denys Vlasenko Cc: Viresh Kumar, Rafael J. Wysocki, Ingo Molnar, Bartosz Golaszewski, H. Peter Anvin, Benoit Cousson, Fenghua Yu, Guenter Roeck, Jonathan Corbet, Peter Zijlstra, Thomas Gleixner, x86, linux-kernel On Sun, 27 Sep 2015 19:58:11 +0200, Denys Vlasenko wrote: > On 09/27/2015 06:10 PM, Jean Delvare wrote: > > Looks good, however I think you should #include <linux/bitmap.h> to > > avoid build failures in the future or on certain architectures. > > <linux/cpumask.h> already includes <linux/bitmap.h> > on any arch. Today it does. Tomorrow, who knows. > p4-clockmod.c builds only on x86 arch, it's Pentium 4 > on demand clock modulation/speed scaling module. That is a valid point. My comment was generic, I did not pay attention to the specific driver. -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip:x86/debug] x86/kgdb: Replace bool_int_array[NR_CPUS] with bitmap 2015-09-26 12:47 [PATCH] x86/kgdb: Replace bool_int_array[NR_CPUS] with bitmap Denys Vlasenko 2015-09-26 12:47 ` [PATCH] cpufreq: p4-clockmod: " Denys Vlasenko @ 2015-09-29 8:36 ` tip-bot for Denys Vlasenko 1 sibling, 0 replies; 7+ messages in thread From: tip-bot for Denys Vlasenko @ 2015-09-29 8:36 UTC (permalink / raw) To: linux-tip-commits Cc: torvalds, dvlasenk, jason.wessel, tglx, hpa, mingo, peterz, linux-kernel Commit-ID: 0d44975d1e2791f6df2b84b182f49d815ba3c9e0 Gitweb: http://git.kernel.org/tip/0d44975d1e2791f6df2b84b182f49d815ba3c9e0 Author: Denys Vlasenko <dvlasenk@redhat.com> AuthorDate: Sat, 26 Sep 2015 14:47:17 +0200 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Mon, 28 Sep 2015 10:13:31 +0200 x86/kgdb: Replace bool_int_array[NR_CPUS] with bitmap Straigntforward conversion from: int was_in_debug_nmi[NR_CPUS] to: DECLARE_BITMAP(was_in_debug_nmi, NR_CPUS) Saves about 2 kbytes in BSS for NR_CPUS=512. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/r/1443271638-2568-1-git-send-email-dvlasenk@redhat.com [ Tidied up the code a bit. ] Signed-off-by: Ingo Molnar <mingo@kernel.org> --- arch/x86/kernel/kgdb.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index d6178d9..44256a6 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c @@ -511,26 +511,31 @@ single_step_cont(struct pt_regs *regs, struct die_args *args) return NOTIFY_STOP; } -static int was_in_debug_nmi[NR_CPUS]; +static DECLARE_BITMAP(was_in_debug_nmi, NR_CPUS); static int kgdb_nmi_handler(unsigned int cmd, struct pt_regs *regs) { + int cpu; + switch (cmd) { case NMI_LOCAL: if (atomic_read(&kgdb_active) != -1) { /* KGDB CPU roundup */ - kgdb_nmicallback(raw_smp_processor_id(), regs); - was_in_debug_nmi[raw_smp_processor_id()] = 1; + cpu = raw_smp_processor_id(); + kgdb_nmicallback(cpu, regs); + set_bit(cpu, was_in_debug_nmi); touch_nmi_watchdog(); + return NMI_HANDLED; } break; case NMI_UNKNOWN: - if (was_in_debug_nmi[raw_smp_processor_id()]) { - was_in_debug_nmi[raw_smp_processor_id()] = 0; + cpu = raw_smp_processor_id(); + + if (__test_and_clear_bit(cpu, was_in_debug_nmi)) return NMI_HANDLED; - } + break; default: /* do nothing */ ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-09-29 8:40 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-09-26 12:47 [PATCH] x86/kgdb: Replace bool_int_array[NR_CPUS] with bitmap Denys Vlasenko 2015-09-26 12:47 ` [PATCH] cpufreq: p4-clockmod: " Denys Vlasenko 2015-09-26 22:07 ` Viresh Kumar 2015-09-27 16:10 ` Jean Delvare 2015-09-27 17:58 ` Denys Vlasenko 2015-09-28 7:10 ` Jean Delvare 2015-09-29 8:36 ` [tip:x86/debug] x86/kgdb: " tip-bot for Denys Vlasenko
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.