All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] Can we assume at least GCC 4.1 for building LTP tests? (__builtin___clear_cache())
@ 2016-07-26 13:08 Peter Maydell
  2016-07-26 13:21 ` Cyril Hrubis
  2016-07-26 13:31 ` Jan Stancek
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2016-07-26 13:08 UTC (permalink / raw)
  To: ltp

Hi; is there a minimum GCC version we can assume for LTP tests,
and is it GCC 4.1 or better?

I ask because the mprotect04.c test case currently does this:

#ifdef __powerpc__
    for (i = 0; i < copy_sz; i += 4)
        __asm__ __volatile__("dcbst 0,%0; sync; icbi 0,%0; sync; isync"
            :: "r"(mem_start + i));
#endif

to synchronize the icache and dcache following copying some code,
but this only works on PPC, not on other architectures which
require explicit cache maintenance (like ARM). The easy way to
do this portably is:

    __builtin___clear_cache(mem_start, mem_start + copy_sz);

which uses the GCC (and clang) builtin which should work on any
architecture (and do nothing on ones like x86 which don't need
special handling). However it doesn't exist prior to GCC 4.1
(which was released a decade ago), so if LTP still has to
support ancient compilers it gets a bit more awkward. (Perhaps
the easiest thing would be to TCONF the test on ancient gcc.)

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] Can we assume at least GCC 4.1 for building LTP tests? (__builtin___clear_cache())
  2016-07-26 13:08 [LTP] Can we assume at least GCC 4.1 for building LTP tests? (__builtin___clear_cache()) Peter Maydell
@ 2016-07-26 13:21 ` Cyril Hrubis
  2016-07-26 13:31 ` Jan Stancek
  1 sibling, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2016-07-26 13:21 UTC (permalink / raw)
  To: ltp

Hi!
> Hi; is there a minimum GCC version we can assume for LTP tests,
> and is it GCC 4.1 or better?

From my point of view SLES10 comes with 4.1.x which is okay, but RHEL4
has extended support till 2017 and has gcc 3.4.x not sure how much
actively it will be tested though.

And we had to add fallbacks for __sync_add_and_fetch() since some
architectures implemented it later than 4.1.2 although general support
was added in 4.1.2. So if we decide to go without configure check for
the building it has to be tested on all platforms.

And of course the safest bet is configure check and TCONF if buildin is
not supported...

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] Can we assume at least GCC 4.1 for building LTP tests? (__builtin___clear_cache())
  2016-07-26 13:08 [LTP] Can we assume at least GCC 4.1 for building LTP tests? (__builtin___clear_cache()) Peter Maydell
  2016-07-26 13:21 ` Cyril Hrubis
@ 2016-07-26 13:31 ` Jan Stancek
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Stancek @ 2016-07-26 13:31 UTC (permalink / raw)
  To: ltp





----- Original Message -----
> From: "Peter Maydell" <peter.maydell@linaro.org>
> To: ltp@lists.linux.it
> Sent: Tuesday, 26 July, 2016 3:08:36 PM
> Subject: [LTP] Can we assume at least GCC 4.1 for building LTP tests?	(__builtin___clear_cache())
> 
> Hi; is there a minimum GCC version we can assume for LTP tests,
> and is it GCC 4.1 or better?

Hmm, I don't seem to have this available with gcc version 4.1.2 on RHEL5.6.

> 
> I ask because the mprotect04.c test case currently does this:
> 
> #ifdef __powerpc__
>     for (i = 0; i < copy_sz; i += 4)
>         __asm__ __volatile__("dcbst 0,%0; sync; icbi 0,%0; sync; isync"
>             :: "r"(mem_start + i));
> #endif
> 
> to synchronize the icache and dcache following copying some code,
> but this only works on PPC, not on other architectures which
> require explicit cache maintenance (like ARM). The easy way to
> do this portably is:
> 
>     __builtin___clear_cache(mem_start, mem_start + copy_sz);
> 
> which uses the GCC (and clang) builtin which should work on any
> architecture (and do nothing on ones like x86 which don't need
> special handling). However it doesn't exist prior to GCC 4.1
> (which was released a decade ago), so if LTP still has to
> support ancient compilers it gets a bit more awkward. (Perhaps
> the easiest thing would be to TCONF the test on ancient gcc.)

I'd go with configure check and TCONF testcases that needs it.
I recall only 2 testcases that needed icache flush, and given
that RHELs with this old gcc should EOL in 2017, I don't mind
if few testcases get skipped.

Regards,
Jan

> 
> thanks
> -- PMM
> 
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-26 13:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-26 13:08 [LTP] Can we assume at least GCC 4.1 for building LTP tests? (__builtin___clear_cache()) Peter Maydell
2016-07-26 13:21 ` Cyril Hrubis
2016-07-26 13:31 ` Jan Stancek

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.