All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
Cc: linux-rt-users <linux-rt-users@vger.kernel.org>
Subject: Re: Bug or works as intended: signal behaviour on -RT
Date: Wed, 3 Oct 2018 17:51:14 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1810031748250.26169@nanos.tec.linutronix.de> (raw)
In-Reply-To: <d5b58969-26d3-d32b-71f7-fdd437c06ee1@oth-regensburg.de>

On Wed, 26 Sep 2018, Ralf Ramsauer wrote:

> Hi,
> 
> If I set the SCHED_FIFO schedular, register a SIGALRM handler, set an
> alarm() and consume 100% of CPU time on an isolated CPU (IOW, never
> leave running/runable), the signal will never arrive in userspace.
> According to /proc/timer_list the expiration time will become a negative
> value.
> 
> But if I synchronously send a SIGALRM via kill, it will immediately
> arrive. Even a sched_yield() in the busy loop won't help. In order to
> get the signal, I have to leave running/runable with usleep().
> 
> Now I'm not sure if this behaviour is intended for some reason or if
> it's a bug. Please find a minimal example attached. Run it on an
> isolated CPU with taskset.
> 
> Reproduceable with 4.14.x-rt and latest -rt. Not reproducable with
> mainline Linux and PREEMPT.

The problem is that the alarm timer is delivered in softirq
context. Assuming that your task loops with higher priority than the
softirq thread it will simply starve it and the timer is never expired and
therefore no siganl delivered. Not pretty, but nothing we can do about
right now with the way signal based timers work. There are ideas to
implement that differently, but that's more complex than it seems in the
first place.

Thanks,

	tglx

  reply	other threads:[~2018-10-03 22:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 15:07 Bug or works as intended: signal behaviour on -RT Ralf Ramsauer
2018-10-03 15:51 ` Thomas Gleixner [this message]
2018-10-05 11:07 ` Sebastian Andrzej Siewior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.1810031748250.26169@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=ralf.ramsauer@oth-regensburg.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.