From: "Ser, Simon" <simon.ser@intel.com>
To: "Hiler, Arkadiusz" <arkadiusz.hiler@intel.com>,
"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t 2/5] lib/tests/igt_subtest_group: Operate within defined behavior
Date: Thu, 9 May 2019 10:31:34 +0000 [thread overview]
Message-ID: <1144e80f027e70dc2e5cf3366a382e20f106d716.camel@intel.com> (raw)
In-Reply-To: <20190509100326.29224-2-arkadiusz.hiler@intel.com>
On Thu, 2019-05-09 at 13:03 +0300, Arkadiusz Hiler wrote:
> Quoting lib/igt_core.c:
> * - Code blocks with magic control flow are implemented with setjmp() and
> * longjmp(). This applies to #igt_fixture and #igt_subtest blocks and all the
> * three variants to finish test: igt_success(), igt_skip() and igt_fail().
> * Mostly this is of no concern, except when such a control block changes
> * stack variables defined in the same function as the control block resides.
> * Any store/load behaviour after a longjmp() is ill-defined for these
> * variables. Avoid such code.
> *
> * Quoting the man page for longjmp():
> *
> * "The values of automatic variables are unspecified after a call to
> * longjmp() if they meet all the following criteria:"
> * - "they are local to the function that made the corresponding setjmp() call;
> * - "their values are changed between the calls to setjmp() and longjmp(); and
> * - "they are not declared as volatile."
>
> igt_subtest_group test uses two local variables for tracking the state
> of execution, making sure that skips are working correctly.
>
> We can just make them volatile to be back on the defined grounds.
>
> Cc: Simon Ser <simon.ser@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
> lib/tests/igt_subtest_group.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/tests/igt_subtest_group.c b/lib/tests/igt_subtest_group.c
> index 7783d021..d8e7d861 100644
> --- a/lib/tests/igt_subtest_group.c
> +++ b/lib/tests/igt_subtest_group.c
> @@ -28,8 +28,8 @@
>
> igt_main
> {
> - bool t1 = false;
> - int t2 = 0;
> + volatile bool t1 = false;
> + volatile int t2 = 0;
Hi,
I think a little comment explaining why these need to be volatile would
be a good addition to this patch. Something among the lines of: "Local
variables updated in subtests have undefined contents unless marked as
volatile".
> igt_subtest_group {
> igt_fixture {
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-05-09 10:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-09 10:03 [igt-dev] [PATCH i-g-t 1/5] meson/cc: Disable memory-allocating builtins Arkadiusz Hiler
2019-05-09 10:03 ` [igt-dev] [PATCH i-g-t 2/5] lib/tests/igt_subtest_group: Operate within defined behavior Arkadiusz Hiler
2019-05-09 10:31 ` Ser, Simon [this message]
2019-05-09 11:11 ` Arkadiusz Hiler
2019-05-09 11:30 ` Ser, Simon
2019-05-09 10:03 ` [igt-dev] [PATCH i-g-t 3/5] runner_tests: " Arkadiusz Hiler
2019-05-09 10:43 ` Petri Latvala
2019-05-09 10:03 ` [igt-dev] [PATCH i-g-t 4/5] meson: Change the default build type to debugoptimized Arkadiusz Hiler
2019-05-09 10:03 ` [igt-dev] [PATCH i-g-t 5/5] meson: Use -D_FORTIFY_SOURCE=2 on optimized builds Arkadiusz Hiler
2019-05-09 11:37 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/5] meson/cc: Disable memory-allocating builtins Patchwork
2019-05-09 14:54 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-05-10 5:07 ` Arkadiusz Hiler
2019-05-09 20:35 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/5] meson/cc: Disable memory-allocating builtins (rev2) Patchwork
2019-05-10 4:46 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-05-10 8:28 ` [igt-dev] [PATCH i-g-t 1/5] meson/cc: Disable memory-allocating builtins 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=1144e80f027e70dc2e5cf3366a382e20f106d716.camel@intel.com \
--to=simon.ser@intel.com \
--cc=arkadiusz.hiler@intel.com \
--cc=igt-dev@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