All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH V2] drm/vkms: Add vblank events simulated by hrtimers
Date: Thu, 5 Jul 2018 13:28:20 -0300	[thread overview]
Message-ID: <20180705162820.wv3miht3zvbxmfzn@smtp.gmail.com> (raw)
In-Reply-To: <153077913849.15734.14484307863805619962@skylake-alporthouse-com>

Hi and thanks for all the feedback, I will work on the suggestions you sent,
but I have some doubts:

On 07/05, Chris Wilson wrote:
> Quoting Daniel Vetter (2018-07-05 09:20:13)
> > On Thu, Jul 05, 2018 at 12:48:43AM -0300, Rodrigo Siqueira wrote:
> > > +     ktime_t current_timestamp;
> > > +
> > > +     hrtimer_init(&out->vblank_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> > 
> > Can't we use absolute timer mode here? That avoids all the timestampt
> > computations.
> 
> Where's your absolute timestamp being computed?

I did not understand the question. hrtimer_forward_now calculates the
absolute timestamp from the relative value provided, this is what I am
using. In any case, it would be easy to switch to absolute mode, but
the code would not be smaller (or larger).

> What's being done is recomputing what hrtimer already knows given a
> relative interval. output->expires should be equivalent to
> hrtimer->expires, and a lot of this code evaporates.

Indeed, output->expires can be removed; as for the rest of the code, that
depends on the answer to question 2 below.

I have two questions:

1. The timestamp that is returned to userspace is (A) the timestamp when the
interrupt was actually handled, allowing applications to detect when there
is some irregularities in the interrupt handling timing, or (B) the timestamp
when the current interrupt was *scheduled* to happen, allowing applications
to detect overruns but not variations in the interrupt handling timing?

2. If I use hrtimer with a period of 1s and return HRTIMER_RESTART, will I
be called back (A) 1s after the previous iteration was *scheduled to start*
(i.e., I will actually be called back at regular intervals, so that after
1,000 iterations approximately 1,000s have elapsed) or (B) 1s after the
previous iteration *ended* (i.e., I will be called back at intervals of
1s + the average processing time of the function, so that after 1,000
iterations significantly more than 1,000s have elapsed)?

The code I wrote assumes the answer to both questions is (B). If the
answer to the second question is A, the code can indeed be made much
simpler; if the answer to the first question is A, I have not been able
to keep timing within the expected strict limits of the IGT test in a VM
(maybe on physical hardware things would go better).

Thanks
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-07-05 16:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-05  3:48 [PATCH V2] drm/vkms: Add vblank events simulated by hrtimers Rodrigo Siqueira
2018-07-05  8:20 ` Daniel Vetter
2018-07-05  8:25   ` Chris Wilson
2018-07-05 16:28     ` Rodrigo Siqueira [this message]
2018-07-05 16:45       ` Chris Wilson
2018-07-05 18:19         ` Rodrigo Siqueira
2018-07-05 18:38         ` Daniel Vetter

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=20180705162820.wv3miht3zvbxmfzn@smtp.gmail.com \
    --to=rodrigosiqueiramelo@gmail.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.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 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.