All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Bristot de Oliveira <daniel@bristot.me>
To: Tim Blechmann <tim@klingt.org>, Juri Lelli <juri.lelli@gmail.com>
Cc: linux-rt-users@vger.kernel.org,
	Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>,
	Luca Abeni <luca.abeni@santannapisa.it>
Subject: Re: SCHED_DEADLINE as user
Date: Mon, 20 Aug 2018 14:38:09 +0200	[thread overview]
Message-ID: <4c58c94c-d99d-9f08-a5a3-710defc612c8@bristot.me> (raw)
In-Reply-To: <d7cd5c88-dbe6-c74d-43e8-724ac0b463ce@klingt.org>



On 08/20/2018 01:54 PM, Tim Blechmann wrote:
>> In your case - assuming you could already use DEADLINE for !root - do
>> you think you would need to use the same interface for the multiple
>> threads you are distributing work among? Or would you be fine with
>> assigning runtime/deadline for each one of those?
> 
> that's a tricky question and depends on the use-case: for me it's "good
> enough" to use something like:
> 
> main audio thread:
> while running:
>   snd_pcm_read  // blocks until data is delivered from ALSA
>   wake helper(s)
>   do work()
>   sync_with_helper(s)
>   snd_pcm_write // blocks until data is delivered to ALSA
> 
> alsa is basically driven by the hardware, which delivers/requests data
> every ~1.3ms.

Hi Tim!

> 
> distributing the work is a little tricky: to avoid excessive scheduling
> overhead, the worker threads are typically woken up (after snd_pcm_read)
> and the result is collected where sync_with_helper() typically boils
> down to busy waiting. in this case, the workers as rate-monotonic in a
> similar manner as the main audio thread.

When you say "rate-monitonic", do you mean that the worker threads with
smaller period (high rate, so) have a higher fixed-priority? If so, what
are the other periods?

as sync_with_helper() does a busy-wait, the "main audio thread" has a
relative lower priority than the worker threads, right?

> one could also use lock-free queues with semaphores to wake only as many
> threads as needed for the graph topology (which can depend on user
> input). in this case SCHED_FIFO sounds more suitable.
> --
> 
> from a practical point of view: i'm not targeting a safety critical
> system. one advantage i'm seeing of DEADLINE over FIFO/RR is that it's
> easier to prevent lockups (e.g. when a user overloads the system). in
> the linux audio world this is typically done by a watchdog thread. the
> other part of the unix world (mach) is using time-constraint threads by
> default for audio use cases. so i'd assume that DEADLINE would free me
> from the need to spawn the watchdog thread ...

So, your main wish here is to avoid having a watchdog thread to
"throttle" misbehaving workload/setup?

For curiosity, what are the "time-constraints" setup used on mach?

-- Daniel

  reply	other threads:[~2018-08-20 15:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-15  6:08 SCHED_DEADLINE as user Tim Blechmann
2018-08-15  8:21 ` Daniel Bristot de Oliveira
2018-08-17  9:51   ` Juri Lelli
2018-08-17 10:08     ` Tim Blechmann
2018-08-17 10:28       ` Juri Lelli
     [not found]         ` <513fd544-bc51-7ea6-8b94-983d28922a66@klingt.org>
2018-08-20  8:54           ` Juri Lelli
2018-08-20 11:54             ` Tim Blechmann
2018-08-20 12:38               ` Daniel Bristot de Oliveira [this message]
2018-08-20 13:55                 ` Tim Blechmann
     [not found]                   ` <e207a65d-b1af-3fb1-8802-d1c05c0a9118@bristot.me>
     [not found]                     ` <05fbd5a4-f354-e084-cf40-8488548d7cb1@klingt.org>
2018-08-21  6:55                       ` Tommaso Cucinotta
2018-08-21  7:38                       ` Juri Lelli
2018-08-22  8:49                         ` Juri Lelli
2018-08-21  7:17               ` Tommaso Cucinotta
2018-08-21  7:59                 ` Tim Blechmann
2018-08-23  9:56             ` luca abeni
2018-08-23 10:23               ` Juri Lelli
2018-08-23 10:43                 ` luca abeni
2018-08-23 12:37                   ` Juri Lelli
2018-08-23 12:58                     ` luca abeni
2018-08-23 13:00                     ` luca abeni
2018-08-23 13:09                       ` Juri Lelli
2018-08-23 13:30                         ` luca abeni
2018-08-23 13:45                       ` Gene Heskett
2018-08-23 16:01                         ` Chris Friesen
2018-08-23 18:07                           ` Gene Heskett

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=4c58c94c-d99d-9f08-a5a3-710defc612c8@bristot.me \
    --to=daniel@bristot.me \
    --cc=juri.lelli@gmail.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=luca.abeni@santannapisa.it \
    --cc=tim@klingt.org \
    --cc=tommaso.cucinotta@santannapisa.it \
    /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.