From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
"Goel, Akash" <akash.goel@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] tools/intel_guc_logger: Utility for capturing GuC firmware logs in a file
Date: Wed, 7 Sep 2016 10:37:07 +0100 [thread overview]
Message-ID: <57CFDFC3.4080300@linux.intel.com> (raw)
In-Reply-To: <20160907084412.GC16682@nuc-i3427.alporthouse.com>
On 07/09/16 09:44, Chris Wilson wrote:
> On Wed, Sep 07, 2016 at 01:40:27PM +0530, Goel, Akash wrote:
>> On 9/6/2016 9:22 PM, Tvrtko Ursulin wrote:
[snip]
>>>>>> + while (!stop_logging)
>>>>>> + {
>>>>>> + if (test_duration && (igt_seconds_elapsed(&start) >
>>>>>> test_duration)) {
>>>>>
>>>>> If you agree to allow no poll period the this would not work right? In
>>>>> that case you would need to use alarm(2) or something.
>>>>>
>>>>
>>>> Can calculate the timeout value for poll call as,
>>>> if (poll_timeout < 0) {
>>>> timeout = test_duration - igt_seconds_elapsed(&start))
>>>> }
>>>
>>> My point was that with indefinite poll loop will not run if there is not
>>> log data so timeout will not work implemented like this.
>>>
>> I understood your concern in first place but probably didn't put
>> forth my point clearly.
>>
>> For more clarity, this is how think it can be addressed.
>>
>> --- a/tools/intel_guc_logger.c
>> +++ b/tools/intel_guc_logger.c
>> @@ -370,6 +370,8 @@ int main(int argc, char **argv)
>> {
>> struct pollfd relay_poll_fd;
>> struct timespec start={};
>> + uint32_t time_elapsed;
>> + int timeout;
>> int nfds;
>> int ret;
>>
>> @@ -395,10 +397,17 @@ int main(int argc, char **argv)
>>
>> while (!stop_logging)
>> {
>> - if (test_duration && (igt_seconds_elapsed(&start) > test_duration)) {
>> - igt_debug("Ran for stipulated %d seconds, exit now\n", test_duration);
>> - stop_logging = true;
>> - break;
>> + timeout = poll_timeout;
>> + if (test_duration) {
>> + time_elapsed = igt_seconds_elapsed(&start);
>> + if (time_elapsed >= test_duration) {
>> + igt_debug("Ran for stipulated %d seconds, exit now\n", test_duration);
>> + stop_logging = true;
>> + break;
>> + }
>> + if (poll_timeout < 0)
>> + timeout = (test_duration - time_elapsed) * 1000;
>> }
>>
>> /* Wait/poll for the new data to be available, relay doesn't
>> @@ -412,7 +421,7 @@ int main(int argc, char **argv)
>> * than a jiffy gap between 2 flush interrupts) and relay runs
>> * out of sub buffers to store the new logs.
>> */
>> - ret = poll(&relay_poll_fd, nfds, poll_timeout);
>> + ret = poll(&relay_poll_fd, nfds, timeout);
>> if (ret < 0) {
>> if (errno == EINTR)
>> break;
>>
>> So will not do polling with indefinite timeout and adjust the
>> timeout value as per test's duration.
>> Does it look ok ?
>
> Since the comment still refers to a kernel bug that you've fixed, it can
> just go. The timeout calculation is indeed more simply expressed as
> alarm(timeout).
Yes I wrote privately that's especially true since there is already a
handler for SIGINT which would do the right thing for SIGALRM as well. I
don't feel so strongly about this but now that we both think the same
maybe go for the simpler implementation if you don't mind Akash?
> And fixing the blocking read() is about 10 lines in the kernel...
Haven't checked but if that is the case, since we are already fixing
relayfs issues, it would be good to do that one as well since it would
simplify the logger. Because if we do it straight away then we know
logger can use it, and if we leave it for later then it gets uglier for
the logger.
But if we cannot make the fix go in the same kernel version (or earlier)
than the GuC logging then I think we don't need to block on that.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-09-07 9:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-06 10:43 [PATCH] tools/intel_guc_logger: Utility for capturing GuC firmware logs in a file akash.goel
2016-09-06 13:17 ` Tvrtko Ursulin
2016-09-06 15:33 ` Goel, Akash
2016-09-06 15:52 ` Tvrtko Ursulin
2016-09-07 8:10 ` Goel, Akash
2016-09-07 8:44 ` Chris Wilson
2016-09-07 9:37 ` Tvrtko Ursulin [this message]
2016-09-07 9:55 ` Chris Wilson
2016-09-07 15:27 ` [PATCH v2] " akash.goel
2016-09-07 15:39 ` Tvrtko Ursulin
2016-09-08 10:44 ` [PATCH v3] " akash.goel
2016-10-10 10:59 ` [PATCH v4] " akash.goel
2016-10-10 13:52 ` Tvrtko Ursulin
2016-10-10 14:31 ` Goel, Akash
2016-10-12 13:32 ` Tvrtko Ursulin
2016-10-25 9:01 ` Petri Latvala
2016-09-07 10:45 ` [PATCH] " Goel, Akash
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=57CFDFC3.4080300@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=akash.goel@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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