Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1505444
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable |
| Date | 2016-10-21 05:30 +0200 |
| Message-ID | <suyGR-8on-5@gated-at.bofh.it> (permalink) |
| References | <srUXf-8pd-23@gated-at.bofh.it> <srWml-XG-1@gated-at.bofh.it> <su95M-8vP-11@gated-at.bofh.it> <suoeu-1uW-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 20 Oct 2016 12:14:14 -0400 Don Zickus <dzickus@redhat.com> wrote:
> > > -static int watchdog_nmi_enable(unsigned int cpu) { return 0; }
> > > -static void watchdog_nmi_disable(unsigned int cpu) { return; }
> > > +/*
> > > + * These two functions are mostly architecture specific
> > > + * defining them as weak here.
> > > + */
> > > +int __weak arch_watchdog_nmi_enable(unsigned int cpu) { return 0; }
> > > +void __weak arch_watchdog_nmi_disable(unsigned int cpu) { return; }
> > > +
> > > #endif /* CONFIG_HARDLOCKUP_DETECTOR */
> >
> > This is a strange way of using __weak.
> >
> > Take a look at (one of many examples) kernel/module.c:module_alloc().
> > We simply provide a default implementation and some other compilation
> > unit can override (actually replace) that at link time. No strange
> > ifdeffing needed.
>
> Yeah, this is mostly because of how we enable the hardlockup detector.
>
> Some arches use the perf hw and enable CONFIG_HARDLOCKUP_DETECTOR. Other
> arches just use their own variant of nmi and set CONFIG_HAVE_NMI_WATCHDOG and
> the rest of the arches do not use this.
>
> So the thought was if CONFIG_HARDLOCKUP_DETECTOR use that implementation,
> everyone else use the __weak version. Then the arches like sparc can override
> the weak version with their own nmi enablement.
>
> I don't know how to represent those 3 states correctly and the above is what
> we end up with.
<head spins>
Is there a suitable site where we could capture these considerations in
a code comment?
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/2] Introduce arch specific nmi enable, disable handlers Babu Moger <babu.moger@oracle.com> - 2016-10-13 22:40 +0200
[PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Babu Moger <babu.moger@oracle.com> - 2016-10-14 00:10 +0200
Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Don Zickus <dzickus@redhat.com> - 2016-10-17 19:40 +0200
Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Babu Moger <babu.moger@oracle.com> - 2016-10-18 04:50 +0200
Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Andrew Morton <akpm@linux-foundation.org> - 2016-10-20 02:10 +0200
Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Don Zickus <dzickus@redhat.com> - 2016-10-20 18:20 +0200
Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Andrew Morton <akpm@linux-foundation.org> - 2016-10-21 05:30 +0200
Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Don Zickus <dzickus@redhat.com> - 2016-10-21 17:20 +0200
Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Andrew Morton <akpm@linux-foundation.org> - 2016-10-21 21:20 +0200
Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Babu Moger <babu.moger@oracle.com> - 2016-10-22 00:00 +0200
Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Don Zickus <dzickus@redhat.com> - 2016-10-24 17:30 +0200
Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Babu Moger <babu.moger@oracle.com> - 2016-10-25 03:00 +0200
[PATCH v2 2/2] sparc: Implement arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Babu Moger <babu.moger@oracle.com> - 2016-10-14 00:30 +0200
Re: [PATCH v2 0/2] Introduce arch specific nmi enable, disable handlers Don Zickus <dzickus@redhat.com> - 2016-10-17 16:30 +0200
csiph-web