kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Question about watchdog
@ 2018-07-01 12:44 bing zhu
  2018-07-01 23:12 ` Ruben Safir
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: bing zhu @ 2018-07-01 12:44 UTC (permalink / raw)
  To: kernelnewbies

Dear Sir/Ma'am
Thank you for your time ,i'm a student new to linux kernel.at present ,i'd
like to create a kernel thread
say use kthread_create func ,my question is :how can i make this thread to
run on a cpu and never get switched or scheduled , there is a
while(1).....structure in that thread i need it to do work . at present i
comes with errors like "NMI watchdog: BUG: soft lockup - CPU#0 stuck for
23s! [test thread :1881]",i understand there is a watchdog but is there
anyway i can feed the dog myself and let my thread have cpu as much as i
want ?
thanks again ,any information would be great !
best wishes!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180701/b359142b/attachment.html>

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

* Question about watchdog
  2018-07-01 12:44 Question about watchdog bing zhu
@ 2018-07-01 23:12 ` Ruben Safir
  2018-07-02  7:58 ` Justin Skists
  2018-07-02 15:59 ` valdis.kletnieks at vt.edu
  2 siblings, 0 replies; 13+ messages in thread
From: Ruben Safir @ 2018-07-01 23:12 UTC (permalink / raw)
  To: kernelnewbies

On 07/01/2018 08:44 AM, bing zhu wrote:
> my question is :how can i make this thread to
> run on a cpu and never get switched or scheduled ,


it is a preemptive multitasking kernel

-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

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

* Question about watchdog
  2018-07-01 12:44 Question about watchdog bing zhu
  2018-07-01 23:12 ` Ruben Safir
@ 2018-07-02  7:58 ` Justin Skists
  2018-07-02  8:29   ` Greg KH
  2018-07-02 15:59 ` valdis.kletnieks at vt.edu
  2 siblings, 1 reply; 13+ messages in thread
From: Justin Skists @ 2018-07-02  7:58 UTC (permalink / raw)
  To: kernelnewbies


> On 01 July 2018 at 13:44 bing zhu <zhubohong12@gmail.com> wrote:
> 
> 
> Dear Sir/Ma'am
> Thank you for your time ,i'm a student new to linux kernel.at present ,i'd
> like to create a kernel thread
> say use kthread_create func ,my question is :how can i make this thread to
> run on a cpu and never get switched or scheduled , there is a
> while(1).....structure in that thread i need it to do work . at present i
> comes with errors like "NMI watchdog: BUG: soft lockup - CPU#0 stuck for
> 23s! [test thread :1881]",i understand there is a watchdog but is there
> anyway i can feed the dog myself and let my thread have cpu as much as i
> want ?

Yowsers! Why would you want to do that? The whole idea of a watchdog is
to prevent threads hogging the CPU for a long time. Linux is a multi-user,
multi-process, pre-emptive operating system. It needs to share. :-)

If you really need a thread to hog the processor, indefinitely, then you're
probably using the wrong OS. Use the correct tool for the job. Or explore
"cpusets". Or maybe rebuild the kernel with soft watchdog turned off.


Justin.

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

* Question about watchdog
  2018-07-02  7:58 ` Justin Skists
@ 2018-07-02  8:29   ` Greg KH
  2018-07-02  8:38     ` Justin Skists
  2018-07-08 19:46     ` Ruben Safir
  0 siblings, 2 replies; 13+ messages in thread
From: Greg KH @ 2018-07-02  8:29 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Jul 02, 2018 at 08:58:16AM +0100, Justin Skists wrote:
> 
> > On 01 July 2018 at 13:44 bing zhu <zhubohong12@gmail.com> wrote:
> > 
> > 
> > Dear Sir/Ma'am
> > Thank you for your time ,i'm a student new to linux kernel.at present ,i'd
> > like to create a kernel thread
> > say use kthread_create func ,my question is :how can i make this thread to
> > run on a cpu and never get switched or scheduled , there is a
> > while(1).....structure in that thread i need it to do work . at present i
> > comes with errors like "NMI watchdog: BUG: soft lockup - CPU#0 stuck for
> > 23s! [test thread :1881]",i understand there is a watchdog but is there
> > anyway i can feed the dog myself and let my thread have cpu as much as i
> > want ?
> 
> Yowsers! Why would you want to do that? The whole idea of a watchdog is
> to prevent threads hogging the CPU for a long time. Linux is a multi-user,
> multi-process, pre-emptive operating system. It needs to share. :-)

Not true, Linux can take a cpu, remove itself from it, and run a single
process if needed, just fine.  It's a great operating system for such a
thing.

You just have to use the apis we have for this already, it's been
possible to do this for many years now.

As for why you would want to do this within the kernel itself, well, I
can understand that need for some situations, and it is possible to do
as well, just use the correct api and all is fine (no, I can't remember
what it is at the moment, sorry...)

greg k-h

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

* Question about watchdog
  2018-07-02  8:29   ` Greg KH
@ 2018-07-02  8:38     ` Justin Skists
  2018-07-08 19:46     ` Ruben Safir
  1 sibling, 0 replies; 13+ messages in thread
From: Justin Skists @ 2018-07-02  8:38 UTC (permalink / raw)
  To: kernelnewbies


> On 02 July 2018 at 09:29 Greg KH <greg@kroah.com> wrote:
> 
> 
> On Mon, Jul 02, 2018 at 08:58:16AM +0100, Justin Skists wrote:
> > 
> > > On 01 July 2018 at 13:44 bing zhu <zhubohong12@gmail.com> wrote:
> > > 
> > > 
> > > Dear Sir/Ma'am
> > > Thank you for your time ,i'm a student new to linux kernel.at present ,i'd
> > > like to create a kernel thread
> > > say use kthread_create func ,my question is :how can i make this thread to
> > > run on a cpu and never get switched or scheduled , there is a
> > > while(1).....structure in that thread i need it to do work . at present i
> > > comes with errors like "NMI watchdog: BUG: soft lockup - CPU#0 stuck for
> > > 23s! [test thread :1881]",i understand there is a watchdog but is there
> > > anyway i can feed the dog myself and let my thread have cpu as much as i
> > > want ?
> > 
> > Yowsers! Why would you want to do that? The whole idea of a watchdog is
> > to prevent threads hogging the CPU for a long time. Linux is a multi-user,
> > multi-process, pre-emptive operating system. It needs to share. :-)
> 
> Not true, Linux can take a cpu, remove itself from it, and run a single
> process if needed, just fine.  It's a great operating system for such a
> thing.

Hmm. Interesting. Looks like I've got more reading to do. :-)


Thanks,
Justin.

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

* Question about watchdog
  2018-07-01 12:44 Question about watchdog bing zhu
  2018-07-01 23:12 ` Ruben Safir
  2018-07-02  7:58 ` Justin Skists
@ 2018-07-02 15:59 ` valdis.kletnieks at vt.edu
       [not found]   ` <CACdNawp4Mfo9ifWu==9t1fUZJ1kqCrunU1CRwmL8zXHsa5zLWg@mail.gmail.com>
  2018-07-07 11:27   ` bing zhu
  2 siblings, 2 replies; 13+ messages in thread
From: valdis.kletnieks at vt.edu @ 2018-07-02 15:59 UTC (permalink / raw)
  To: kernelnewbies

On Sun, 01 Jul 2018 20:44:29 +0800, bing zhu said:

> say use kthread_create func ,my question is :how can i make this thread to
> run on a cpu and never get switched or scheduled , there is a
> while(1).....structure in that thread i need it to do work

That's almost certainly a result of a poor design.  What problem
were you trying to solve by wrapping a 'while(1)' around in-kernel code?

> comes with errors like "NMI watchdog: BUG: soft lockup - CPU#0 stuck for
> 23s! [test thread :1881]",i understand there is a watchdog but is there
> anyway i can feed the dog myself and let my thread have cpu as much as i
> want ?

There are ways.  But you probably should figure out how to fix your code
so feeding the watchdog isn't needed....
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180702/66287861/attachment.sig>

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

* Question about watchdog
       [not found]   ` <CACdNawp4Mfo9ifWu==9t1fUZJ1kqCrunU1CRwmL8zXHsa5zLWg@mail.gmail.com>
@ 2018-07-03 16:02     ` valdis.kletnieks at vt.edu
  0 siblings, 0 replies; 13+ messages in thread
From: valdis.kletnieks at vt.edu @ 2018-07-03 16:02 UTC (permalink / raw)
  To: kernelnewbies

On Tue, 03 Jul 2018 10:28:48 +0800, you said:

> yes ! but there are days when people have to do a real-time work with no
> delay in kernel space ,i think i can feed the dog
> a percpu variable "nmi_touch" looks suspicious???thanks???

1) The Linux kernel community convention is t use 'reply all' so that a copy
goes back to the list, so that all may read, learn, and comment...

2) If you're hanging a CPU with something for long enough to trigger a watchdog
event, you've *already* *broken* real-time processing on that CPU.

Read that second sentence again, and repeat until it sinks in.

If the watchdog is firing for a CPU because you've been running a tight loop
on it for *that* long, *that CPU is by definition not able to do realtime in a Linux
context*.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180703/43a8bcf9/attachment.sig>

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

* Question about watchdog
  2018-07-02 15:59 ` valdis.kletnieks at vt.edu
       [not found]   ` <CACdNawp4Mfo9ifWu==9t1fUZJ1kqCrunU1CRwmL8zXHsa5zLWg@mail.gmail.com>
@ 2018-07-07 11:27   ` bing zhu
  1 sibling, 0 replies; 13+ messages in thread
From: bing zhu @ 2018-07-07 11:27 UTC (permalink / raw)
  To: kernelnewbies

you mean like this ? i think im doing it right finally ,thank you !

2018-07-02 23:59 GMT+08:00 <valdis.kletnieks@vt.edu>:

> On Sun, 01 Jul 2018 20:44:29 +0800, bing zhu said:
>
> > say use kthread_create func ,my question is :how can i make this thread
> to
> > run on a cpu and never get switched or scheduled , there is a
> > while(1).....structure in that thread i need it to do work
>
> That's almost certainly a result of a poor design.  What problem
> were you trying to solve by wrapping a 'while(1)' around in-kernel code?
>
> > comes with errors like "NMI watchdog: BUG: soft lockup - CPU#0 stuck for
> > 23s! [test thread :1881]",i understand there is a watchdog but is there
> > anyway i can feed the dog myself and let my thread have cpu as much as i
> > want ?
>
> There are ways.  But you probably should figure out how to fix your code
> so feeding the watchdog isn't needed....
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180707/6d75476e/attachment.html>

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

* Question about watchdog
  2018-07-02  8:29   ` Greg KH
  2018-07-02  8:38     ` Justin Skists
@ 2018-07-08 19:46     ` Ruben Safir
  2018-07-08 20:44       ` valdis.kletnieks at vt.edu
  1 sibling, 1 reply; 13+ messages in thread
From: Ruben Safir @ 2018-07-08 19:46 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Jul 02, 2018 at 10:29:30AM +0200, Greg KH wrote:
> On Mon, Jul 02, 2018 at 08:58:16AM +0100, Justin Skists wrote:
> > 
> > > On 01 July 2018 at 13:44 bing zhu <zhubohong12@gmail.com> wrote:
> > > 
> > > 
> > > Dear Sir/Ma'am
> > > Thank you for your time ,i'm a student new to linux kernel.at present ,i'd
> > > like to create a kernel thread
> > > say use kthread_create func ,my question is :how can i make this thread to
> > > run on a cpu and never get switched or scheduled , there is a
> > > while(1).....structure in that thread i need it to do work . at present i
> > > comes with errors like "NMI watchdog: BUG: soft lockup - CPU#0 stuck for
> > > 23s! [test thread :1881]",i understand there is a watchdog but is there
> > > anyway i can feed the dog myself and let my thread have cpu as much as i
> > > want ?
> > 
> > Yowsers! Why would you want to do that? The whole idea of a watchdog is
> > to prevent threads hogging the CPU for a long time. Linux is a multi-user,
> > multi-process, pre-emptive operating system. It needs to share. :-)
> 
> Not true, Linux can take a cpu, remove itself from it, and run a single
> process if needed, just fine.  It's a great operating system for such a
> thing.
> 
> You just have to use the apis we have for this already, it's been
> possible to do this for many years now.
> 
> As for why you would want to do this within the kernel itself, well, I
> can understand that need for some situations, and it is possible to do
> as well, just use the correct api and all is fine (no, I can't remember
> what it is at the moment, sorry...)
> 
> greg k-h
> 


What are you saying?  That is the filesystem bus sends a HW interupt on
the bus that the scheuler will ignore it and refuse to swap the
executable to handle the HW interupt?


> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com 

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive 
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com 

Being so tracked is for FARM ANIMALS and and extermination camps, 
but incompatible with living as a free human being. -RI Safir 2013

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

* Question about watchdog
  2018-07-08 19:46     ` Ruben Safir
@ 2018-07-08 20:44       ` valdis.kletnieks at vt.edu
  2018-07-09 13:30         ` Ruben Safir
  0 siblings, 1 reply; 13+ messages in thread
From: valdis.kletnieks at vt.edu @ 2018-07-08 20:44 UTC (permalink / raw)
  To: kernelnewbies

On Sun, 08 Jul 2018 15:46:32 -0400, Ruben Safir said:

> What are you saying?  That is the filesystem bus sends a HW interupt on

Error while parsing statement.,  What is a "filesystem bus" and when does it
issue a HW interrupt?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180708/69b51838/attachment.sig>

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

* Question about watchdog
  2018-07-08 20:44       ` valdis.kletnieks at vt.edu
@ 2018-07-09 13:30         ` Ruben Safir
  2018-07-09 16:17           ` valdis.kletnieks at vt.edu
  0 siblings, 1 reply; 13+ messages in thread
From: Ruben Safir @ 2018-07-09 13:30 UTC (permalink / raw)
  To: kernelnewbies

On 07/08/2018 04:44 PM, valdis.kletnieks at vt.edu wrote:
> Error while parsing statement.,  What is a "filesystem bus" and when does it
> issue a HW interrupt?


You have a hard drive on the system bus and it sends interupts...
Not to mention other devices like network cards, GPUs, Firewire, express
PCI and PLP, and even the CPU and LUNA

All these hard peices demand attention and send interupts on the system bus

http://www.nylxs.com/docs/journal_2_2015.pdf

-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

http://www.nylxs.com - Leadership Development in Free Software
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

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

* Question about watchdog
  2018-07-09 13:30         ` Ruben Safir
@ 2018-07-09 16:17           ` valdis.kletnieks at vt.edu
  2018-07-10  0:25             ` Ruben Safir
  0 siblings, 1 reply; 13+ messages in thread
From: valdis.kletnieks at vt.edu @ 2018-07-09 16:17 UTC (permalink / raw)
  To: kernelnewbies

On Mon, 09 Jul 2018 09:30:51 -0400, Ruben Safir said:
> On 07/08/2018 04:44 PM, valdis.kletnieks at vt.edu wrote:
> > Error while parsing statement.,  What is a "filesystem bus" and when does it
> > issue a HW interrupt?

> You have a hard drive on the system bus and it sends interupts...

That's probably on the PCI or USB buses - Linux doesn't have a "filesystem bus".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180709/fe74d1b3/attachment.sig>

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

* Question about watchdog
  2018-07-09 16:17           ` valdis.kletnieks at vt.edu
@ 2018-07-10  0:25             ` Ruben Safir
  0 siblings, 0 replies; 13+ messages in thread
From: Ruben Safir @ 2018-07-10  0:25 UTC (permalink / raw)
  To: kernelnewbies

On 07/09/2018 12:17 PM, valdis.kletnieks at vt.edu wrote:
> Linux doesn't have a "filesystem bus".


of course not.  i mispoke

-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

http://www.nylxs.com - Leadership Development in Free Software
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

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

end of thread, other threads:[~2018-07-10  0:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-01 12:44 Question about watchdog bing zhu
2018-07-01 23:12 ` Ruben Safir
2018-07-02  7:58 ` Justin Skists
2018-07-02  8:29   ` Greg KH
2018-07-02  8:38     ` Justin Skists
2018-07-08 19:46     ` Ruben Safir
2018-07-08 20:44       ` valdis.kletnieks at vt.edu
2018-07-09 13:30         ` Ruben Safir
2018-07-09 16:17           ` valdis.kletnieks at vt.edu
2018-07-10  0:25             ` Ruben Safir
2018-07-02 15:59 ` valdis.kletnieks at vt.edu
     [not found]   ` <CACdNawp4Mfo9ifWu==9t1fUZJ1kqCrunU1CRwmL8zXHsa5zLWg@mail.gmail.com>
2018-07-03 16:02     ` valdis.kletnieks at vt.edu
2018-07-07 11:27   ` bing zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).