* stopping a process during a timer interrupt
[not found] <d0bd1c10610170311s3ef77226n1d645f3f1e178753@mail.gmail.com>
@ 2006-10-17 10:18 ` Kay Tiong Khoo
2006-10-17 22:56 ` Hagen Paul Pfeifer
2006-10-18 14:30 ` Michal Schmidt
0 siblings, 2 replies; 5+ messages in thread
From: Kay Tiong Khoo @ 2006-10-17 10:18 UTC (permalink / raw)
To: linux-kernel
On a timer interrupt, I tried to stop the current process by changing
it's run state to TASK_STOPPED via set_current_state(TASK_STOPPED).
However, this results in a system hang.
I can't find a way to stop the current process during an interrupt
context. Does such code exist in the kernel? If not, how does one go
about implementing it from within a kernel module.
Thanks.
Kay Tiong
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: stopping a process during a timer interrupt
2006-10-17 10:18 ` stopping a process during a timer interrupt Kay Tiong Khoo
@ 2006-10-17 22:56 ` Hagen Paul Pfeifer
2006-10-19 3:38 ` Kay Tiong Khoo
2006-10-18 14:30 ` Michal Schmidt
1 sibling, 1 reply; 5+ messages in thread
From: Hagen Paul Pfeifer @ 2006-10-17 22:56 UTC (permalink / raw)
To: Kay Tiong Khoo; +Cc: linux-kernel
* Kay Tiong Khoo | 2006-10-17 18:18:25 [+0800]:
>On a timer interrupt, I tried to stop the current process by changing
>it's run state to TASK_STOPPED via set_current_state(TASK_STOPPED).
>However, this results in a system hang.
>
>I can't find a way to stop the current process during an interrupt
>context. Does such code exist in the kernel? If not, how does one go
>about implementing it from within a kernel module.
Take a look at some driver implementations!
There you will find some ways how to put a process into a sleep state.
Grep for "*->state*TASK_UNINTERRUPTIBLE" and take also a look at the
interaction with schedule() and spinlocks.
>Thanks.
>Kay Tiong
Best regards
--
Hagen Pfeifer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: stopping a process during a timer interrupt
2006-10-17 10:18 ` stopping a process during a timer interrupt Kay Tiong Khoo
2006-10-17 22:56 ` Hagen Paul Pfeifer
@ 2006-10-18 14:30 ` Michal Schmidt
2006-10-19 3:42 ` Kay Tiong Khoo
1 sibling, 1 reply; 5+ messages in thread
From: Michal Schmidt @ 2006-10-18 14:30 UTC (permalink / raw)
To: Kay Tiong Khoo; +Cc: linux-kernel
Kay Tiong Khoo skrev:
> On a timer interrupt, I tried to stop the current process by changing
> it's run state to TASK_STOPPED via set_current_state(TASK_STOPPED).
> However, this results in a system hang.
>
> I can't find a way to stop the current process during an interrupt
> context. Does such code exist in the kernel? If not, how does one go
> about implementing it from within a kernel module.
In interrupt context there's no "current process" by definition.
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: stopping a process during a timer interrupt
2006-10-17 22:56 ` Hagen Paul Pfeifer
@ 2006-10-19 3:38 ` Kay Tiong Khoo
0 siblings, 0 replies; 5+ messages in thread
From: Kay Tiong Khoo @ 2006-10-19 3:38 UTC (permalink / raw)
To: Hagen Paul Pfeifer; +Cc: linux-kernel
Thanks!
For the record, I was trying to sleep kernel threads as well as user
threads. That didn't work out too well.
All worked fine when I only attempted to sleep user threads.
Kay Tiong
On Oct 18, 2006, at 6:56 AM, Hagen Paul Pfeifer wrote:
> * Kay Tiong Khoo | 2006-10-17 18:18:25 [+0800]:
>
>> On a timer interrupt, I tried to stop the current process by changing
>> it's run state to TASK_STOPPED via set_current_state(TASK_STOPPED).
>> However, this results in a system hang.
>>
>> I can't find a way to stop the current process during an interrupt
>> context. Does such code exist in the kernel? If not, how does one go
>> about implementing it from within a kernel module.
>
> Take a look at some driver implementations!
> There you will find some ways how to put a process into a sleep state.
>
> Grep for "*->state*TASK_UNINTERRUPTIBLE" and take also a look at the
> interaction with schedule() and spinlocks.
>
>> Thanks.
>> Kay Tiong
>
> Best regards
>
> --
> Hagen Pfeifer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: stopping a process during a timer interrupt
2006-10-18 14:30 ` Michal Schmidt
@ 2006-10-19 3:42 ` Kay Tiong Khoo
0 siblings, 0 replies; 5+ messages in thread
From: Kay Tiong Khoo @ 2006-10-19 3:42 UTC (permalink / raw)
To: Michal Schmidt; +Cc: linux-kernel
That's true. But if you are writing a profiler, the current process
is the process of interest in the interrupt context.
Kay Tiong
On Oct 18, 2006, at 10:30 PM, Michal Schmidt wrote:
> Kay Tiong Khoo skrev:
>> On a timer interrupt, I tried to stop the current process by changing
>> it's run state to TASK_STOPPED via set_current_state(TASK_STOPPED).
>> However, this results in a system hang.
>> I can't find a way to stop the current process during an interrupt
>> context. Does such code exist in the kernel? If not, how does one go
>> about implementing it from within a kernel module.
>
> In interrupt context there's no "current process" by definition.
>
> Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-10-19 3:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <d0bd1c10610170311s3ef77226n1d645f3f1e178753@mail.gmail.com>
2006-10-17 10:18 ` stopping a process during a timer interrupt Kay Tiong Khoo
2006-10-17 22:56 ` Hagen Paul Pfeifer
2006-10-19 3:38 ` Kay Tiong Khoo
2006-10-18 14:30 ` Michal Schmidt
2006-10-19 3:42 ` Kay Tiong Khoo
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®