Skip to contentSkip to conversation

preempt_check_resched() gone?

DISCUSSION Ville Syrjälä 2 participants 3 messages Mar 6, 2014 – Mar 7, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

It appears preempt_check_resched() is no longer available for modules since [1]. So now I'm left wondering what is one supposed to use after local_irq_enable(). Documentation/preempt-locking.txt still says one should do a check, but the tool to do that was taken away.

In case you're wondering why I even need local_irq_enable(), see [2]. So I'm trying to make sure a bunch of double buffered registers get latched by the hardware during the same display frame. The hardware will latch the registers at a specific point during the display refresh cycle, and so I need to avoid writing the registers when we're too close to that point to make sure all of the registers will latch the new values at the same time.

[1]
commit 62b94a08da1bae9d187d49dfcd6665af393750f8

Author: Peter Zijlstra <[email protected]>
Date:   Wed Nov 20 16:52:19 2013 +0100

sched/preempt: Take away preempt_enable_no_resched() from modules

Discourage drivers/modules to be creative with preemption.

Sadly all is implemented in macros and inline so if they want to do evil they still can, but at least try and discourage some.

[2] http://lists.freedesktop.org/archives/intel-gfx/2014-February/040161.html

Signature · 2 lines
Ville Syrjälä
Intel OTC
#1 lore raw
Quoted 6 lines · Ville Syrjälä

Hi,

It appears preempt_check_resched() is no longer available for modules since [1]. So now I'm left wondering what is one supposed to use after local_irq_enable(). Documentation/preempt-locking.txt still says one should do a check, but the tool to do that was taken away.

The documentation is slightly misleading. The point is:

If you have an irq disabled section and you do a wakeup inside this section which causes the need resched bit to be set, then local_irq_enable/restore wont do an preemption check.

If you merily poke at a few device registers then nothing will set need resched and you're good.

Thanks,

tglx

#2 lore raw
Quoted 8 lines · Thomas Gleixner
Quoted 6 lines · Ville Syrjälä

Hi,

It appears preempt_check_resched() is no longer available for modules since [1]. So now I'm left wondering what is one supposed to use after local_irq_enable(). Documentation/preempt-locking.txt still says one should do a check, but the tool to do that was taken away.

Quoted 8 lines

The documentation is slightly misleading. The point is:

If you have an irq disabled section and you do a wakeup inside this section which causes the need resched bit to be set, then local_irq_enable/restore wont do an preemption check.

If you merily poke at a few device registers then nothing will set need resched and you're good.

OK. There are a few extra things that get called while irqs are
disabled: prepare_to_wait(), finish_wait(), mod_timer(), spin_{lock,unlock}(). Based on a quick glance none of those should do anything I need to worry about, so I'll just drop preempt_check_resched() from my code.

Thanks.

Signature · 2 lines
Ville Syrjälä
Intel OTC