mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Babu Moger <babu.moger@oracle.com>
Cc: mingo@kernel.org, ak@linux.intel.com, jkosina@suse.cz,
	baiyaowei@cmss.chinamobile.com, dzickus@redhat.com,
	atomlin@redhat.com, uobergfe@redhat.com, tj@kernel.org,
	hidehiro.kawai.ez@hitachi.com, johunt@akamai.com,
	davem@davemloft.net, sparclinux@vger.kernel.org,
	linux-kernel@vger.kernel.org, sam@ravnborg.org
Subject: Re: [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable
Date: Wed, 19 Oct 2016 17:00:12 -0700	[thread overview]
Message-ID: <20161019170012.6006d06d9326e62a8059fd08@linux-foundation.org> (raw)
In-Reply-To: <1476391082-77928-2-git-send-email-babu.moger@oracle.com>

On Thu, 13 Oct 2016 13:38:01 -0700 Babu Moger <babu.moger@oracle.com> wrote:

> Currently we do not have a way to enable/disable arch specific
> watchdog handlers if it was implemented by any of the architectures.
> 
> This patch introduces new functions arch_watchdog_nmi_enable and
> arch_watchdog_nmi_disable which can be used to enable/disable architecture
> specific NMI watchdog handlers. These functions are defined as weak as
> architectures can override their definitions to enable/disable nmi
> watchdog behaviour.
> 
> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -676,8 +660,13 @@ static void watchdog_nmi_disable(unsigned int cpu)
>  }
>  
>  #else
> -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.

And I'm not really understanding the interaction with
CONFIG_HARDLOCKUP_DETECTOR here.  I haven't really worked out why the
code is all this way but it seems....  odd?

  parent reply	other threads:[~2016-10-20  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13 20:38 [PATCH v2 0/2] Introduce arch specific nmi enable, disable handlers Babu Moger
2016-10-13 20:38 ` [PATCH v2 1/2] watchdog: Introduce arch_watchdog_nmi_enable and arch_watchdog_nmi_disable Babu Moger
2016-10-17 17:31   ` Don Zickus
2016-10-18  2:46     ` Babu Moger
2016-10-20  0:00   ` Andrew Morton [this message]
2016-10-20 16:14     ` Don Zickus
2016-10-21  3:25       ` Andrew Morton
2016-10-21 15:11         ` Don Zickus
2016-10-21 19:19           ` Andrew Morton
2016-10-21 21:50             ` Babu Moger
2016-10-24 15:19               ` Don Zickus
2016-10-25  0:55                 ` Babu Moger
2016-10-13 20:38 ` [PATCH v2 2/2] sparc: Implement " Babu Moger
2016-10-17 14:25 ` [PATCH v2 0/2] Introduce arch specific nmi enable, disable handlers Don Zickus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161019170012.6006d06d9326e62a8059fd08@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ak@linux.intel.com \
    --cc=atomlin@redhat.com \
    --cc=babu.moger@oracle.com \
    --cc=baiyaowei@cmss.chinamobile.com \
    --cc=davem@davemloft.net \
    --cc=dzickus@redhat.com \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=jkosina@suse.cz \
    --cc=johunt@akamai.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=uobergfe@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®