linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question about kthread_mod_delayed_work() allowed context
@ 2020-02-11 10:23 Grygorii Strashko
  2020-02-12 15:41 ` Petr Mladek
  0 siblings, 1 reply; 4+ messages in thread
From: Grygorii Strashko @ 2020-02-11 10:23 UTC (permalink / raw)
  To: linux-kernel, Petr Mladek
  Cc: linux-rt-users, Linux ARM, netdev, Richard Cochran

Hi All,

I'd like to ask question about allowed calling context for kthread_mod_delayed_work().

The comment to kthread_mod_delayed_work() says:

  * This function is safe to call from any context including IRQ handler.
  * See __kthread_cancel_work() and kthread_delayed_work_timer_fn()
  * for details.
  */

But it has del_timer_sync() inside which seems can't be called from hard_irq context:
kthread_mod_delayed_work()
   |-__kthread_cancel_work()
      |- del_timer_sync()
	|- WARN_ON(in_irq() && !(timer->flags & TIMER_IRQSAFE));

My use case is related to PTP processing using PTP auxiliary worker:
(commit d9535cb7b760 ("ptp: introduce ptp auxiliary worker")):
  - periodic work A is started and res-schedules itself for every dtX
  - on IRQ - the work A need to be scheduled immediately

Any advice on how to proceed?
Can kthread_queue_work() be used even if there is delayed work is
scheduled already (in general, don't care if work A will be executed one
more time after timer expiration)?

-- 
Best regards,
grygorii

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

end of thread, other threads:[~2020-02-13  8:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-11 10:23 Question about kthread_mod_delayed_work() allowed context Grygorii Strashko
2020-02-12 15:41 ` Petr Mladek
2020-02-12 19:17   ` Grygorii Strashko
2020-02-13  8:33     ` Petr Mladek

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).