From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
Tvrtko Ursulin <tursulin@ursulin.net>,
Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 1/3] lib/core: Avoid unused result in backtrace printing
Date: Fri, 3 Nov 2017 13:07:58 +0000 [thread overview]
Message-ID: <d8c0f1ca-e77b-eced-8111-8927d9713346@linux.intel.com> (raw)
In-Reply-To: <150971414305.13980.11152057208246735129@mail.alporthouse.com>
On 03/11/2017 13:02, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2017-11-03 12:56:14)
>>
>> On 03/11/2017 12:10, Chris Wilson wrote:
>>> Quoting Tvrtko Ursulin (2017-11-03 12:04:15)
>>>>
>>>> On 03/11/2017 11:52, Chris Wilson wrote:
>>>>> Quoting Tvrtko Ursulin (2017-11-03 11:47:54)
>>>>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>>>>
>>>>>> Add helpers for direct write to stderr to consolidate the code
>>>>>> and avoid the unused result warning in build.
>>>>>>
>>>>>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>>>> ---
>>>>>> lib/igt_core.c | 23 ++++++++++++++++-------
>>>>>> 1 file changed, 16 insertions(+), 7 deletions(-)
>>>>>>
>>>>>> diff --git a/lib/igt_core.c b/lib/igt_core.c
>>>>>> index 538a4472e209..351859eaa04c 100644
>>>>>> --- a/lib/igt_core.c
>>>>>> +++ b/lib/igt_core.c
>>>>>> @@ -1239,7 +1239,7 @@ static const char hex[] = "0123456789abcdef";
>>>>>> static void
>>>>>> xputch(int c)
>>>>>> {
>>>>>> - write(STDERR_FILENO, (const void *) &c, 1);
>>>>>> + igt_assert_eq(write(STDERR_FILENO, (const void *) &c, 1), 1);
>>>>>
>>>>> Infinite recursion, you can't use an assert from inside the assert
>>>>> handler.
>>>>
>>>> I thought it is the signal handler. Tested sending some signals and it
>>>> survived. If there is a flaw there could instead nerf them with void
>>>> cast, don't know.
>>>
>>> I do recall these are meant to be fail safe, so using something like
>>> assert which may end up here again is no-no. igt_ignore_warn()?
>>
>> But then on the other hand igt_fail seems to have handling for exit
>> handlers using igt_asserts. Which suggests what I've done might be fine
>> after all.
>
> Otoh, where does the assert go if we fail to write to stderr? I do not
> like the means by which we are meant to be writing the death throes to
> cause further output. These routines are the lowest level and meant to
> be impervious, callable from any context, calling back up into igt is a
> layering violation.
I can send a version which avoids that, but also note fatal_sig_handler
already uses igt_assert. I'll end up changing more than I bargained for
when I started. :)
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:[~2017-11-03 13:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 11:47 [PATCH i-g-t 1/3] lib/core: Avoid unused result in backtrace printing Tvrtko Ursulin
2017-11-03 11:47 ` [PATCH i-g-t 2/3] gem_syslatency: Avoid arithmetic on void * warning Tvrtko Ursulin
2017-11-03 11:53 ` Chris Wilson
2017-11-03 11:47 ` [PATCH i-g-t 3/3] intel_gvtg_test: Handle system(3) return value Tvrtko Ursulin
2017-11-03 11:55 ` Chris Wilson
2017-11-03 12:01 ` Tvrtko Ursulin
2017-11-03 11:52 ` [PATCH i-g-t 1/3] lib/core: Avoid unused result in backtrace printing Chris Wilson
2017-11-03 12:04 ` Tvrtko Ursulin
2017-11-03 12:10 ` Chris Wilson
2017-11-03 12:56 ` Tvrtko Ursulin
2017-11-03 13:02 ` Chris Wilson
2017-11-03 13:07 ` Tvrtko Ursulin [this message]
2017-11-03 13:09 ` [PATCH i-g-t v2 " Tvrtko Ursulin
2017-11-03 12:20 ` ✗ Fi.CI.BAT: warning for series starting with [1/3] " Patchwork
2017-11-03 14:18 ` ✗ Fi.CI.BAT: warning for series starting with [v2,1/3] lib/core: Avoid unused result in backtrace printing (rev2) Patchwork
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=d8c0f1ca-e77b-eced-8111-8927d9713346@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=chris@chris-wilson.co.uk \
--cc=tursulin@ursulin.net \
/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