public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Handling NMI in a kernel module
@ 2002-07-23 17:37 Isabelle, Francois
  2002-07-23 18:27 ` John Levon
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Isabelle, Francois @ 2002-07-23 17:37 UTC (permalink / raw)
  To: Linux-Ha (E-mail); +Cc: 'linux-kernel@vger.kernel.org'

Is it possible to request_nmi() the way you can request_irq() from a kernel
driver on the i386 arch?

Our hardware watchdog is dual stage and can generate NMI on first stage ,
our cPCI handle switch can also be used for Hot swap request via NMI.
I'ld like to make use of this, I noticed cpqhealth module already
implemented some nmi handling but this driver is close sourced.

Should we patch in i386/kernel/traps.c to add a callback to our stuff in
unkown_nmi_error().

I'ld like my driver to register a callback there, what about maintaining a
list of user callback functions which could be registered via:
 
request_nmi(int option, void (*hander)(void *dev_id, struct pt_regs *regs),
unsigned long flags, const char *dev_name, void *dev_id);

where option could take meaning such as
 - prepend   : place at start of nmi callback functions
 - append    : place at end of nmi callback functions 
 - truncate : replace callback chain

Is there any standard mecanism to implement such features( dual stage
watchdog ) ?

Comments are welcome.

Francois Isabelle
Francois.Isabelle@ca.kontron.com
Kontron Canada Inc

 
 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Handling NMI in a kernel module
  2002-07-23 17:37 Handling NMI in a kernel module Isabelle, Francois
@ 2002-07-23 18:27 ` John Levon
  2002-07-23 22:30 ` Alan Cox
  2002-07-26 21:55 ` Alan Robertson
  2 siblings, 0 replies; 9+ messages in thread
From: John Levon @ 2002-07-23 18:27 UTC (permalink / raw)
  To: Isabelle, Francois
  Cc: Linux-Ha (E-mail), 'linux-kernel@vger.kernel.org'

On Tue, Jul 23, 2002 at 01:37:01PM -0400, Isabelle, Francois wrote:

> Is it possible to request_nmi() the way you can request_irq() from a kernel
> driver on the i386 arch?

Not currently, no.

> Our hardware watchdog is dual stage and can generate NMI on first stage ,
> our cPCI handle switch can also be used for Hot swap request via NMI.
> I'ld like to make use of this, I noticed cpqhealth module already
> implemented some nmi handling but this driver is close sourced.

You can do some horrible hack with sidt + _set_gate() to replace the NMI trap handler.

> Should we patch in i386/kernel/traps.c to add a callback to our stuff in
> unkown_nmi_error().
> 
> I'ld like my driver to register a callback there, what about maintaining a
> list of user callback functions which could be registered via:
>  
> request_nmi(int option, void (*hander)(void *dev_id, struct pt_regs *regs),
> unsigned long flags, const char *dev_name, void *dev_id);
> 
> where option could take meaning such as
>  - prepend   : place at start of nmi callback functions
>  - append    : place at end of nmi callback functions 
>  - truncate : replace callback chain

Why all three ? When would anything other than prepend be useful ? Each
handler must simply see if the NMI is their responsibility, and pass its
duty along to the next handler if not.

What is the purpose of dev_name, dev_id, and flags exactly ?
 
Personally, I'd like to see such a patch.

regards
john

-- 
"If you cannot convince them, confuse them."
	- Harry S. Truman

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Handling NMI in a kernel module
  2002-07-23 17:37 Handling NMI in a kernel module Isabelle, Francois
  2002-07-23 18:27 ` John Levon
@ 2002-07-23 22:30 ` Alan Cox
  2002-07-26 21:55 ` Alan Robertson
  2 siblings, 0 replies; 9+ messages in thread
From: Alan Cox @ 2002-07-23 22:30 UTC (permalink / raw)
  To: Isabelle, Francois
  Cc: Linux-Ha (E-mail), 'linux-kernel@vger.kernel.org'

On Tue, 2002-07-23 at 18:37, Isabelle, Francois wrote:
> I'ld like my driver to register a callback there, what about maintaining a
> list of user callback functions which could be registered via:
>  
> request_nmi(int option, void (*hander)(void *dev_id, struct pt_regs *regs),
> unsigned long flags, const char *dev_name, void *dev_id)

Doesnt seen unreasonable
;
> Is there any standard mecanism to implement such features( dual stage
> watchdog ) ?

We have a watchdog API but not yet dual stage stuff. Its becoming a must
have for HA stuff so the API needs extending


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Handling NMI in a kernel module
  2002-07-23 17:37 Handling NMI in a kernel module Isabelle, Francois
  2002-07-23 18:27 ` John Levon
  2002-07-23 22:30 ` Alan Cox
@ 2002-07-26 21:55 ` Alan Robertson
  2002-07-27  2:05   ` Alan Cox
  2 siblings, 1 reply; 9+ messages in thread
From: Alan Robertson @ 2002-07-26 21:55 UTC (permalink / raw)
  To: Isabelle, Francois
  Cc: Linux-Ha (E-mail), 'linux-kernel@vger.kernel.org'

Isabelle, Francois wrote:
> Is it possible to request_nmi() the way you can request_irq() from a kernel
> driver on the i386 arch?
> 
> Our hardware watchdog is dual stage and can generate NMI on first stage ,
> our cPCI handle switch can also be used for Hot swap request via NMI.
> I'ld like to make use of this, I noticed cpqhealth module already
> implemented some nmi handling but this driver is close sourced.
> 
> Should we patch in i386/kernel/traps.c to add a callback to our stuff in
> unkown_nmi_error().
> 
> I'ld like my driver to register a callback there, what about maintaining a
> list of user callback functions which could be registered via:
>  
> request_nmi(int option, void (*hander)(void *dev_id, struct pt_regs *regs),
> unsigned long flags, const char *dev_name, void *dev_id);
> 
> where option could take meaning such as
>  - prepend   : place at start of nmi callback functions
>  - append    : place at end of nmi callback functions 
>  - truncate : replace callback chain
> 
> Is there any standard mecanism to implement such features( dual stage
> watchdog ) ?

We've created a separate mailing list to talk about enhancements to the 
watchdog driver API.  Dual stage watchdog is on the list.  It's pretty quiet 
now, but perhaps now that summer is winding down, we can get started again...


Info on the list is here:  	
	http://lists.tummy.com/mailman/listinfo/watchdogng



	-- Alan Robertson
	   alanr@unix.sh


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Handling NMI in a kernel module
  2002-07-26 21:55 ` Alan Robertson
@ 2002-07-27  2:05   ` Alan Cox
  2002-07-27  3:30     ` Alan Robertson
  2002-07-27  3:44     ` Jonathan Lundell
  0 siblings, 2 replies; 9+ messages in thread
From: Alan Cox @ 2002-07-27  2:05 UTC (permalink / raw)
  To: Alan Robertson
  Cc: Isabelle, Francois, Linux-Ha (E-mail),
	'linux-kernel@vger.kernel.org'

I've been tracking other lists. The current state is very much that we
need the dual notifier. I now have some draft code that allows us to do
this even on hardware that doesn't support it, and where the read()
function gets told when an event is about to occur


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Handling NMI in a kernel module
  2002-07-27  2:05   ` Alan Cox
@ 2002-07-27  3:30     ` Alan Robertson
  2002-07-27 12:39       ` Alan Cox
  2002-07-27  3:44     ` Jonathan Lundell
  1 sibling, 1 reply; 9+ messages in thread
From: Alan Robertson @ 2002-07-27  3:30 UTC (permalink / raw)
  To: Alan Cox
  Cc: Isabelle, Francois, Linux-Ha (E-mail),
	'linux-kernel@vger.kernel.org'

Alan Cox wrote:
> I've been tracking other lists. The current state is very much that we
> need the dual notifier. I now have some draft code that allows us to do
> this even on hardware that doesn't support it, and where the read()
> function gets told when an event is about to occur

I know what had been requested from the telco crowd was the ability to 
register a function to get called (in the kernel) when an event was about to 
occur.

I'm not sure what it means to say that "the read() function gets told when 
an event is about to occur".

	-- Alan Robertson
	   alanr@unix.sh


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Handling NMI in a kernel module
  2002-07-27  2:05   ` Alan Cox
  2002-07-27  3:30     ` Alan Robertson
@ 2002-07-27  3:44     ` Jonathan Lundell
  1 sibling, 0 replies; 9+ messages in thread
From: Jonathan Lundell @ 2002-07-27  3:44 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

At 3:05 AM +0100 2002-07-27, Alan Cox wrote:
>I've been tracking other lists. The current state is very much that we
>need the dual notifier. I now have some draft code that allows us to do
>this even on hardware that doesn't support it, and where the read()
>function gets told when an event is about to occur

I'd be grateful for a copy of the draft code. We've done a machine 
with a hardware-based two-stage watchdog, and are in the process of 
implementing one on a more-vanilla piece of hardware.
-- 
/Jonathan Lundell.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Handling NMI in a kernel module
  2002-07-27  3:30     ` Alan Robertson
@ 2002-07-27 12:39       ` Alan Cox
  2002-07-27 13:50         ` Alan Robertson
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Cox @ 2002-07-27 12:39 UTC (permalink / raw)
  To: Alan Robertson
  Cc: Isabelle, Francois, Linux-Ha (E-mail),
	'linux-kernel@vger.kernel.org'

On Sat, 2002-07-27 at 04:30, Alan Robertson wrote:
> Alan Cox wrote:
> > I've been tracking other lists. The current state is very much that we
> > need the dual notifier. I now have some draft code that allows us to do
> > this even on hardware that doesn't support it, and where the read()
> > function gets told when an event is about to occur
> 
> I know what had been requested from the telco crowd was the ability to 
> register a function to get called (in the kernel) when an event was about to 
> occur.

They can already do that anyway. Its called add_timer() 8)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Handling NMI in a kernel module
  2002-07-27 12:39       ` Alan Cox
@ 2002-07-27 13:50         ` Alan Robertson
  0 siblings, 0 replies; 9+ messages in thread
From: Alan Robertson @ 2002-07-27 13:50 UTC (permalink / raw)
  To: Alan Cox
  Cc: Isabelle, Francois, Linux-Ha (E-mail),
	'linux-kernel@vger.kernel.org'

Alan Cox wrote:
> On Sat, 2002-07-27 at 04:30, Alan Robertson wrote:
> 
>>Alan Cox wrote:
>>
>>>I've been tracking other lists. The current state is very much that we
>>>need the dual notifier. I now have some draft code that allows us to do
>>>this even on hardware that doesn't support it, and where the read()
>>>function gets told when an event is about to occur
>>>
>>I know what had been requested from the telco crowd was the ability to 
>>register a function to get called (in the kernel) when an event was about to 
>>occur.
>>
> 
> They can already do that anyway. Its called add_timer() 8)

Given how vaguely I stated it, I guess that's what I deserve ;-)
However, it's not quite what I had in mind. ;-)

You'd like to see the driver add a timer when someone opens the device, and 
removes and readds it each time they tickle the watchdog timer.  It's this 
interaction which the driver has to provide support for.

Also, you'd like to specify how long before the watchdog timer goes off that 
it "pops".

So, you really want something like register_watchdog_pretimeout() and pass 
it a function and a pretimeout time in ticks or milliseconds, or whatever. 
You'd also need an unregister_watchdog_pretimeout() function of course as 
well...  IIRC, this is what I mentioned on the watchdog timer list.

	-- Alan Robertson
	   alanr@unix.sh


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-07-27 13:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-23 17:37 Handling NMI in a kernel module Isabelle, Francois
2002-07-23 18:27 ` John Levon
2002-07-23 22:30 ` Alan Cox
2002-07-26 21:55 ` Alan Robertson
2002-07-27  2:05   ` Alan Cox
2002-07-27  3:30     ` Alan Robertson
2002-07-27 12:39       ` Alan Cox
2002-07-27 13:50         ` Alan Robertson
2002-07-27  3:44     ` Jonathan Lundell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox