From: Petri Latvala <adrinael@adrinael.net>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org, Chris Wilson <chris.p.wilson@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] lib/igt_dummyload: Fall back to no scheduling policy if SCHED_FIFO unavailable
Date: Tue, 18 Apr 2023 19:36:02 +0300 [thread overview]
Message-ID: <ZD7G8uT0cWHHWtQX@adrinael.net> (raw)
In-Reply-To: <20230418145408.39730-1-kamil.konieczny@linux.intel.com>
On Tue, Apr 18, 2023 at 04:54:08PM +0200, Kamil Konieczny wrote:
> From: Petri Latvala <petri.latvala@intel.com>
>
> From: Petri Latvala <petri.latvala@intel.com>
>
> If pthread_create with SCHED_FIFO fails, try creating the thread
> without a policy before bailing out.
>
> Cc: Petri Latvala <adrinael@adrinael.net>
> Suggested-by: Chris Wilson <chris.p.wilson@intel.com>
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Still seems relevant, no objections to this going upstream.
--
Petri Latvala
> ---
> lib/igt_dummyload.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> index b3dc18ee7..740a58f3d 100644
> --- a/lib/igt_dummyload.c
> +++ b/lib/igt_dummyload.c
> @@ -528,6 +528,7 @@ void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns)
> struct itimerspec its;
> pthread_attr_t attr;
> int timerfd;
> + int err;
>
> if (!spin)
> return;
> @@ -547,8 +548,13 @@ void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns)
> pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
> pthread_attr_setschedparam(&attr, ¶m);
>
> - igt_assert(pthread_create(&spin->timer_thread, &attr,
> - timer_thread, spin) == 0);
> + err = pthread_create(&spin->timer_thread, &attr, timer_thread, spin);
> + if (err) {
> + igt_debug("Cannot create thread with SCHED_FIFO (%s), trying without scheduling policy...\n",
> + strerror(err));
> + igt_assert_eq(pthread_create(&spin->timer_thread, NULL,
> + timer_thread, spin), 0);
> + }
> pthread_attr_destroy(&attr);
>
> memset(&its, 0, sizeof(its));
> --
> 2.37.2
>
next prev parent reply other threads:[~2023-04-18 16:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 14:54 [igt-dev] [PATCH i-g-t] lib/igt_dummyload: Fall back to no scheduling policy if SCHED_FIFO unavailable Kamil Konieczny
2023-04-18 15:27 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-04-18 16:36 ` Petri Latvala [this message]
2023-04-18 17:49 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-04-19 16:07 ` [igt-dev] [PATCH i-g-t] " Zbigniew Kempczyński
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=ZD7G8uT0cWHHWtQX@adrinael.net \
--to=adrinael@adrinael.net \
--cc=chris.p.wilson@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox