All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ser, Simon" <simon.ser@intel.com>
To: "guillaume.tucker@collabora.com" <guillaume.tucker@collabora.com>,
	"Hiler, Arkadiusz" <arkadiusz.hiler@intel.com>,
	"Latvala, Petri" <petri.latvala@intel.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t 1/4] tests: add libatomic dependency
Date: Thu, 13 Jun 2019 12:57:59 +0000	[thread overview]
Message-ID: <e0bb778a0882dc99f3b0b19e51f49d132f043705.camel@intel.com> (raw)
In-Reply-To: <05c4aa32-3103-d82f-e596-90537d48a10d@collabora.com>

On Thu, 2019-06-13 at 13:55 +0100, Guillaume Tucker wrote:
> On 06/06/2019 08:18, Ser, Simon wrote:
> > On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
> > > Add dependency to libatomic in order to be able to use the __atomic_*
> > > functions instead of the older __sync_* ones.  This is to enable
> > > atomic operations on a wider number of architectures including MIPS.
> > 
> > Thanks for your patch! I have a few questions because I don't know well
> > how libatomic works.
> 
> Thanks for the review!
> 
> > Do we want to always link against libatomic? For instance LLVM tries to
> > compile a program with atomic before falling back to libatomic:
> > https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake
> > 
> > Should this dependency be mandatory?
> 
> I've had a look around, the short answer is we should make this
> dependency optional.  I'm sending a v2 of this series which
> addresses this issue.
> 
> From what I understand, linking against libatomic is actually
> only needed when some atomic operations aren't supported natively
> by a CPU architecture.  For example, this is the case with 64-bit
> atomics on 32-bit MIPS.  If the CPU can't do an atomic operation
> and there's no libatomic available, then it won't build.  So I've
> made a test in meson.build to check whether linking against
> libatomic is required or not, to drop the dependency when it
> isn't.  I've verified that the test passes on x86 (i.e. no
> dependency) and fails on 32-bit MIPS (i.e. with dependency).

Nice! Looks like a good idea to me.

> Guillaume
> 
> 
> > > Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> > > ---
> > >  meson.build       | 1 +
> > >  tests/meson.build | 2 +-
> > >  2 files changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 6268c58d3634..4e5bb323fa49 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -179,6 +179,7 @@ math = cc.find_library('m')
> > >  realtime = cc.find_library('rt')
> > >  dlsym = cc.find_library('dl')
> > >  zlib = cc.find_library('z')
> > > +libatomic = cc.find_library('atomic')
> > >  
> > >  if cc.has_header('linux/kd.h')
> > >  	config.set('HAVE_LINUX_KD_H', 1)
> > > diff --git a/tests/meson.build b/tests/meson.build
> > > index 806766e51667..6877ccd59235 100644
> > > --- a/tests/meson.build
> > > +++ b/tests/meson.build
> > > @@ -233,7 +233,7 @@ i915_progs = [
> > >  	'i915_suspend',
> > >  ]
> > >  
> > > -test_deps = [ igt_deps ]
> > > +test_deps = [ igt_deps, libatomic ]
> > >  
> > >  if libdrm_nouveau.found()
> > >  	test_progs += [
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: "Ser, Simon" <simon.ser@intel.com>
To: "guillaume.tucker@collabora.com" <guillaume.tucker@collabora.com>,
	"Hiler, Arkadiusz" <arkadiusz.hiler@intel.com>,
	"Latvala, Petri" <petri.latvala@intel.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t 1/4] tests: add libatomic dependency
Date: Thu, 13 Jun 2019 12:57:59 +0000	[thread overview]
Message-ID: <e0bb778a0882dc99f3b0b19e51f49d132f043705.camel@intel.com> (raw)
In-Reply-To: <05c4aa32-3103-d82f-e596-90537d48a10d@collabora.com>

On Thu, 2019-06-13 at 13:55 +0100, Guillaume Tucker wrote:
> On 06/06/2019 08:18, Ser, Simon wrote:
> > On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
> > > Add dependency to libatomic in order to be able to use the __atomic_*
> > > functions instead of the older __sync_* ones.  This is to enable
> > > atomic operations on a wider number of architectures including MIPS.
> > 
> > Thanks for your patch! I have a few questions because I don't know well
> > how libatomic works.
> 
> Thanks for the review!
> 
> > Do we want to always link against libatomic? For instance LLVM tries to
> > compile a program with atomic before falling back to libatomic:
> > https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake
> > 
> > Should this dependency be mandatory?
> 
> I've had a look around, the short answer is we should make this
> dependency optional.  I'm sending a v2 of this series which
> addresses this issue.
> 
> From what I understand, linking against libatomic is actually
> only needed when some atomic operations aren't supported natively
> by a CPU architecture.  For example, this is the case with 64-bit
> atomics on 32-bit MIPS.  If the CPU can't do an atomic operation
> and there's no libatomic available, then it won't build.  So I've
> made a test in meson.build to check whether linking against
> libatomic is required or not, to drop the dependency when it
> isn't.  I've verified that the test passes on x86 (i.e. no
> dependency) and fails on 32-bit MIPS (i.e. with dependency).

Nice! Looks like a good idea to me.

> Guillaume
> 
> 
> > > Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> > > ---
> > >  meson.build       | 1 +
> > >  tests/meson.build | 2 +-
> > >  2 files changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 6268c58d3634..4e5bb323fa49 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -179,6 +179,7 @@ math = cc.find_library('m')
> > >  realtime = cc.find_library('rt')
> > >  dlsym = cc.find_library('dl')
> > >  zlib = cc.find_library('z')
> > > +libatomic = cc.find_library('atomic')
> > >  
> > >  if cc.has_header('linux/kd.h')
> > >  	config.set('HAVE_LINUX_KD_H', 1)
> > > diff --git a/tests/meson.build b/tests/meson.build
> > > index 806766e51667..6877ccd59235 100644
> > > --- a/tests/meson.build
> > > +++ b/tests/meson.build
> > > @@ -233,7 +233,7 @@ i915_progs = [
> > >  	'i915_suspend',
> > >  ]
> > >  
> > > -test_deps = [ igt_deps ]
> > > +test_deps = [ igt_deps, libatomic ]
> > >  
> > >  if libdrm_nouveau.found()
> > >  	test_progs += [
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-06-13 12:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 11:54 [PATCH i-g-t 1/4] tests: add libatomic dependency Guillaume Tucker
2019-06-03 11:54 ` [igt-dev] " Guillaume Tucker
2019-06-03 11:54 ` [PATCH i-g-t 2/4] gitlab-ci: add libatomic to Fedora docker image Guillaume Tucker
2019-06-03 11:54   ` [igt-dev] " Guillaume Tucker
2019-06-06  7:21   ` Arkadiusz Hiler
2019-06-06  7:21     ` [igt-dev] " Arkadiusz Hiler
2019-06-06  7:26     ` Ser, Simon
2019-06-06  7:26       ` Ser, Simon
2019-06-13 12:56       ` Guillaume Tucker
2019-06-13 12:56         ` [Intel-gfx] " Guillaume Tucker
2019-06-03 11:54 ` [PATCH i-g-t 3/4] i915/gem_create: use __atomic_* instead of __sync_* Guillaume Tucker
2019-06-03 11:54   ` [igt-dev] " Guillaume Tucker
2019-06-06  7:20   ` Ser, Simon
2019-06-06  7:20     ` [Intel-gfx] " Ser, Simon
2019-06-13 13:03     ` Guillaume Tucker
2019-06-13 13:03       ` Guillaume Tucker
2019-06-03 11:54 ` [PATCH i-g-t 4/4] tests/sw_sync: " Guillaume Tucker
2019-06-03 11:54   ` [Intel-gfx] " Guillaume Tucker
2019-06-03 13:04 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] tests: add libatomic dependency Patchwork
2019-06-03 16:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-06-06  7:18 ` [igt-dev] [PATCH i-g-t 1/4] " Ser, Simon
2019-06-06  7:18   ` Ser, Simon
2019-06-13 12:55   ` Guillaume Tucker
2019-06-13 12:55     ` Guillaume Tucker
2019-06-13 12:57     ` Ser, Simon [this message]
2019-06-13 12:57       ` Ser, Simon
2019-06-06  7:19 ` Arkadiusz Hiler
2019-06-06  7:19   ` [Intel-gfx] " Arkadiusz Hiler

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=e0bb778a0882dc99f3b0b19e51f49d132f043705.camel@intel.com \
    --to=simon.ser@intel.com \
    --cc=arkadiusz.hiler@intel.com \
    --cc=guillaume.tucker@collabora.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=petri.latvala@intel.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.