Re: [RFC PATCH v2 10/14] kernel/watchdog: Add a function to obtain the watchdog_allowed_mask
On Tue, Apr 09, 2019 at 01:34:21PM +0200, Peter Zijlstra wrote: > On Wed, Feb 27, 2019 at 08:05:14AM -0800, Ricardo Neri wrote: > > diff --git a/kernel/watchdog.c b/kernel/watchdog.c > > index 8fbfda94a67b..367aa81294ef 100644 > > --- a/kernel/watchdog.c > > +++ b/kernel/watchdog.c > > @@ -44,7 +44,7 @@ int __read_mostly soft_watchdog_user_enabled = 1; > > int __read_mostly watchdog_thresh = 10; > > int __read_mostly nmi_watchdog_available; > > > > -struct cpumask watchdog_allowed_mask __read_mostly; > > +static struct cpumask watchdog_allowed_mask __read_mostly; > > > > struct cpumask watchdog_cpumask __read_mostly; > > unsigned long *watchdog_cpumask_bits = cpumask_bits(_cpumask); > > Hurmph, more struct cpumask, ideally this would get converted to > cpumask_var_t, I don't think we need this before the allocators work, do > we? I see mm_init() is called before lockup_detector_init(); both from start_kernel(). Thus, IMHO, kzalloc should work at this point. Thanks and BR, Ricardo
Re: [RFC PATCH v2 10/14] kernel/watchdog: Add a function to obtain the watchdog_allowed_mask
On Wed, Feb 27, 2019 at 08:05:14AM -0800, Ricardo Neri wrote: > diff --git a/kernel/watchdog.c b/kernel/watchdog.c > index 8fbfda94a67b..367aa81294ef 100644 > --- a/kernel/watchdog.c > +++ b/kernel/watchdog.c > @@ -44,7 +44,7 @@ int __read_mostly soft_watchdog_user_enabled = 1; > int __read_mostly watchdog_thresh = 10; > int __read_mostly nmi_watchdog_available; > > -struct cpumask watchdog_allowed_mask __read_mostly; > +static struct cpumask watchdog_allowed_mask __read_mostly; > > struct cpumask watchdog_cpumask __read_mostly; > unsigned long *watchdog_cpumask_bits = cpumask_bits(_cpumask); Hurmph, more struct cpumask, ideally this would get converted to cpumask_var_t, I don't think we need this before the allocators work, do we?
Re: [RFC PATCH v2 10/14] kernel/watchdog: Add a function to obtain the watchdog_allowed_mask
On Tue, Mar 26, 2019 at 10:22:40PM +0100, Thomas Gleixner wrote: > On Wed, 27 Feb 2019, Ricardo Neri wrote: > > > > -struct cpumask watchdog_allowed_mask __read_mostly; > > +static struct cpumask watchdog_allowed_mask __read_mostly; > > That hunk is correct. I'll send a separate patch with this hunk only. > > > struct cpumask watchdog_cpumask __read_mostly; > > unsigned long *watchdog_cpumask_bits = cpumask_bits(_cpumask); > > @@ -92,6 +92,11 @@ static int __init > > hardlockup_all_cpu_backtrace_setup(char *str) > > } > > __setup("hardlockup_all_cpu_backtrace=", > > hardlockup_all_cpu_backtrace_setup); > > # endif /* CONFIG_SMP */ > > + > > +struct cpumask *watchdog_get_allowed_cpumask(void) > > +{ > > + return _allowed_mask; > > +} > > That part is pointless as I showed you in the other reply. You don't need > that mask in your code at all. Yes. I'll remove this hunk and follow the approach you suggested in your reply to patch 11. Thanks and BR, Ricardo > > Thanks, > > tglx > >
Re: [RFC PATCH v2 10/14] kernel/watchdog: Add a function to obtain the watchdog_allowed_mask
On Wed, 27 Feb 2019, Ricardo Neri wrote: > > -struct cpumask watchdog_allowed_mask __read_mostly; > +static struct cpumask watchdog_allowed_mask __read_mostly; That hunk is correct. > struct cpumask watchdog_cpumask __read_mostly; > unsigned long *watchdog_cpumask_bits = cpumask_bits(_cpumask); > @@ -92,6 +92,11 @@ static int __init hardlockup_all_cpu_backtrace_setup(char > *str) > } > __setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup); > # endif /* CONFIG_SMP */ > + > +struct cpumask *watchdog_get_allowed_cpumask(void) > +{ > + return _allowed_mask; > +} That part is pointless as I showed you in the other reply. You don't need that mask in your code at all. Thanks, tglx
[RFC PATCH v2 10/14] kernel/watchdog: Add a function to obtain the watchdog_allowed_mask
Implementations of NMI watchdogs that use a single piece of hardware to monitor all the CPUs in the system (as opposed to per-CPU implementations such as perf) need to know which CPUs the watchdog is allowed to monitor. In this manner, non-maskable interrupts are directed only to the monitored CPUs. Cc: "H. Peter Anvin" Cc: Ashok Raj Cc: Andi Kleen Cc: Tony Luck Cc: "Rafael J. Wysocki" Cc: Don Zickus Cc: Nicholas Piggin Cc: Michael Ellerman Cc: Frederic Weisbecker Cc: Alexei Starovoitov Cc: Babu Moger Cc: Paul Mackerras Cc: Mathieu Desnoyers Cc: Masami Hiramatsu Cc: Peter Zijlstra Cc: Andrew Morton Cc: Philippe Ombredanne Cc: Colin Ian King Cc: Byungchul Park Cc: "Paul E. McKenney" Cc: "Luis R. Rodriguez" Cc: Waiman Long Cc: Josh Poimboeuf Cc: Randy Dunlap Cc: Davidlohr Bueso Cc: Christoffer Dall Cc: Marc Zyngier Cc: Kai-Heng Feng Cc: Konrad Rzeszutek Wilk Cc: David Rientjes Cc: "Ravi V. Shankar" Cc: x...@kernel.org Cc: "David S. Miller" Cc: Benjamin Herrenschmidt Cc: sparcli...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ricardo Neri --- include/linux/nmi.h | 1 + kernel/watchdog.c | 7 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/nmi.h b/include/linux/nmi.h index bf5ebcfdd590..b563fb6ef21d 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -83,6 +83,7 @@ static inline void reset_hung_task_detector(void) { } #if defined(CONFIG_HARDLOCKUP_DETECTOR) extern void hardlockup_detector_disable(void); +extern struct cpumask *watchdog_get_allowed_cpumask(void); extern unsigned int hardlockup_panic; #else static inline void hardlockup_detector_disable(void) {} diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 8fbfda94a67b..367aa81294ef 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -44,7 +44,7 @@ int __read_mostly soft_watchdog_user_enabled = 1; int __read_mostly watchdog_thresh = 10; int __read_mostly nmi_watchdog_available; -struct cpumask watchdog_allowed_mask __read_mostly; +static struct cpumask watchdog_allowed_mask __read_mostly; struct cpumask watchdog_cpumask __read_mostly; unsigned long *watchdog_cpumask_bits = cpumask_bits(_cpumask); @@ -92,6 +92,11 @@ static int __init hardlockup_all_cpu_backtrace_setup(char *str) } __setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup); # endif /* CONFIG_SMP */ + +struct cpumask *watchdog_get_allowed_cpumask(void) +{ + return _allowed_mask; +} #endif /* CONFIG_HARDLOCKUP_DETECTOR */ /* -- 2.17.1