public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* preempt_check_resched() gone?
@ 2014-03-06 20:27 Ville Syrjälä
  2014-03-06 20:52 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Ville Syrjälä @ 2014-03-06 20:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: peterz, tglx, mingo

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 <peterz@infradead.org>
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

-- 
Ville Syrjälä
Intel OTC

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

* Re: preempt_check_resched() gone?
  2014-03-06 20:27 preempt_check_resched() gone? Ville Syrjälä
@ 2014-03-06 20:52 ` Thomas Gleixner
  2014-03-07 12:14   ` Ville Syrjälä
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2014-03-06 20:52 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: linux-kernel, peterz, mingo

[-- Attachment #1: Type: TEXT/PLAIN, Size: 681 bytes --]

On Thu, 6 Mar 2014, Ville Syrjälä wrote:
> 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

 

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

* Re: preempt_check_resched() gone?
  2014-03-06 20:52 ` Thomas Gleixner
@ 2014-03-07 12:14   ` Ville Syrjälä
  0 siblings, 0 replies; 3+ messages in thread
From: Ville Syrjälä @ 2014-03-07 12:14 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, peterz, mingo

On Thu, Mar 06, 2014 at 09:52:42PM +0100, Thomas Gleixner wrote:
> On Thu, 6 Mar 2014, Ville Syrjälä wrote:
> > 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.

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.

-- 
Ville Syrjälä
Intel OTC

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

end of thread, other threads:[~2014-03-07 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-06 20:27 preempt_check_resched() gone? Ville Syrjälä
2014-03-06 20:52 ` Thomas Gleixner
2014-03-07 12:14   ` Ville Syrjälä

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