Skip to contentSkip to conversation

intel_aubdump: Rename intel_aubdump.so to libintel_aubdump.so

PATCH In review Jordan Justen 3 participants 15 messages Sep 14, 2017 – Sep 15, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 intel_aubdump: Rename intel_aubdump.so to libintel_aubdump.so

The meson shared_library function appears to hard code prefixing the library name with 'lib'.

---
 tools/Makefile.am      | 2 +-
 tools/intel_aubdump.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/Makefile.am +1 -1
index 2c7b5799..73811060 100644
@@ -24,7 +24,7 @@ AM_LDFLAGS = -Wl,--as-needed
 
 # aubdumper
 
-module_LTLIBRARIES = intel_aubdump.la
+module_LTLIBRARIES = libintel_aubdump.la
 moduledir = $(libdir)
 intel_aubdump_la_LDFLAGS = -module -avoid-version -no-undefined
 intel_aubdump_la_SOURCES = aubdump.c
tools/intel_aubdump.in +1 -1
index 977fe951..8bc6b19d 100644
@@ -105,7 +105,7 @@ prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 
-LD_PRELOAD=${libdir}/intel_aubdump.so${LD_PPRELOAD:+:${LD_PRELOAD}} \
+LD_PRELOAD=${libdir}/libintel_aubdump.so${LD_PPRELOAD:+:${LD_PRELOAD}} \
 	  exec -- "$@" 3<<EOF
 `echo -e $args`
 EOF
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/6 meson: Install libigt.so

---
 lib/meson.build | 1 +
 1 file changed, 1 insertion(+)
lib/meson.build +1 -0
index b78e42dc..0d379d90 100644
@@ -170,6 +170,7 @@ lib_igt_build = shared_library('igt',
     ['dummy.c'],
     link_whole: lib_intermediates,
     dependencies: lib_deps,
+    install : true
 )
 
 lib_igt = declare_dependency(link_with : lib_igt_build,
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 2/6] meson: Install libigt.so

Quoted 10 lines · Jordan Justen
---
 lib/meson.build | 1 +
 1 file changed, 1 insertion(+)
lib/meson.build +0 -0
index b78e42dc..0d379d90 100644

lib/meson.build lib_igt_build = shared_library('igt', · line 174

Quoted 5 lines
lib/meson.build +1 -0
@@ -170,6 +170,7 @@ lib_igt_build = shared_library('igt',
     ['dummy.c'],
     link_whole: lib_intermediates,
     dependencies: lib_deps,
+    install : true
 )

I don't actually know what the plan is w.r.t. installing the lib, so I'll leave this one for someone else to ack/nack.

Quoted 9 lines
lib/meson.build +0 -0
 lib_igt = declare_dependency(link_with : lib_igt_build,
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 2/6] meson: Install libigt.so

Quoted 6 lines · Ville Syrjälä
Quoted 5 lines · Jordan Justen
---
 lib/meson.build | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

lib/meson.build lib_igt_build = shared_library('igt', · line 174

Quoted 10 lines
lib/meson.build +1 -0
index b78e42dc..0d379d90 100644
@@ -170,6 +170,7 @@ lib_igt_build = shared_library('igt',
     ['dummy.c'],
     link_whole: lib_intermediates,
     dependencies: lib_deps,
+    install : true
 )

I don't actually know what the plan is w.r.t. installing the lib, so I'll leave this one for someone else to ack/nack.

Ok. I just noted that the aubdump library would not load because it linked to this library and couldn't find it until it was installed.

-Jordan
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Acked-by
#4 lore raw

Re: [PATCH 2/6] meson: Install libigt.so

Quoted 3 lines · Jordan Justen
Quoted 2 lines · Ville Syrjälä

I don't actually know what the plan is w.r.t. installing the lib, so I'll leave this one for someone else to ack/nack.

The plan is to install the lib.

The concerns with installing the lib are that we should keep support for running the IGT binaries without and with installing. That means:

- Setting things up so that the runtime linker can find the installed .so for installed executables, and builddir-.so for builddir-executables.

- Making sure the linked .so originates from the same build as the executable, using some better error message than just corrupting the call stack. Nailing down an ABI for libigt.so is impossible.

With that said: Meson build system in general, and the existence of the .so in particular is for experimental users who know they get to keep both pieces when things break. And installing the .so is anyway something to be done sooner or later.

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [PATCH 2/6] meson: Install libigt.so

Quoted 18 lines · Petri Latvala
Quoted 3 lines · Jordan Justen
Quoted 2 lines · Ville Syrjälä

I don't actually know what the plan is w.r.t. installing the lib, so I'll leave this one for someone else to ack/nack.

The plan is to install the lib.

The concerns with installing the lib are that we should keep support for running the IGT binaries without and with installing. That means:

- Setting things up so that the runtime linker can find the installed .so for installed executables, and builddir-.so for builddir-executables.

- Making sure the linked .so originates from the same build as the executable, using some better error message than just corrupting the call stack. Nailing down an ABI for libigt.so is impossible.

Quoted 6 lines

With that said: Meson build system in general, and the existence of the .so in particular is for experimental users who know they get to keep both pieces when things break. And installing the .so is anyway something to be done sooner or later.

Cool. I've pushed the three patches from this series, and my own series (with the whitespace fixed) to master. Thanks for the patches and reviews.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH 3/6 meson: Install libintel_aubdump.so

In reply to Jordan Justen
---
 tools/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/meson.build +2 -1
index d2d4410e..91c58760 100644
@@ -54,6 +54,7 @@ foreach prog : tools_progs
 			dependencies : tool_deps)
 endforeach
 
-shared_library('intel_aubdump', 'aubdump.c', dependencies : [ igt_deps, dlsym ])
+shared_library('intel_aubdump', 'aubdump.c',
+               dependencies : [ igt_deps, dlsym ], install : true)
 
 subdir('null_state_gen')
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 4/6 intel_aubdump.in: Set executable permissions (for meson build)

In reply to Jordan Justen

Meson detects if an input file is executable, and copies that to the output file.

---
 tools/intel_aubdump.in | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 tools/intel_aubdump.in
tools/intel_aubdump.in +0 -0
old mode 100644
new mode 100755
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 4/6
#8 lore raw

Re: [PATCH 4/6] intel_aubdump.in: Set executable permissions (for meson build)

Quoted 4 lines · Jordan Justen

Meson detects if an input file is executable, and copies that to the output file.

Quoted 15 lines
---
 tools/intel_aubdump.in | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 tools/intel_aubdump.in
tools/intel_aubdump.in +0 -0
old mode 100644
new mode 100755
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 5/6 meson: Process intel_aubdump.in into intel_aubdump

In reply to Jordan Justen
---
 tools/meson.build | 7 +++++++
 1 file changed, 7 insertions(+)
tools/meson.build +7 -0
index 91c58760..20b63cce 100644
@@ -57,4 +57,11 @@ endforeach
 shared_library('intel_aubdump', 'aubdump.c',
                dependencies : [ igt_deps, dlsym ], install : true)
 
+conf_data = configuration_data()
+conf_data.set('prefix', get_option('prefix'))
+conf_data.set('exec_prefix', '${prefix}')
+conf_data.set('libdir', join_paths('${prefix}', get_option('libdir')))
+configure_file(input : 'intel_aubdump.in', output : 'intel_aubdump',
+               configuration : conf_data, install_dir : get_option('bindir'))
+
 subdir('null_state_gen')
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 5/6
#10 lore raw

Re: [PATCH 5/6] meson: Process intel_aubdump.in into intel_aubdump

Quoted 10 lines · Jordan Justen
---
 tools/meson.build | 7 +++++++
 1 file changed, 7 insertions(+)
tools/meson.build +0 -0
index 91c58760..20b63cce 100644

tools/meson.build endforeach · line 65

Quoted 9 lines
tools/meson.build +6 -0
@@ -57,4 +57,11 @@ endforeach
 shared_library('intel_aubdump', 'aubdump.c',
                dependencies : [ igt_deps, dlsym ], install : true)
 
+conf_data = configuration_data()
+conf_data.set('prefix', get_option('prefix'))
+conf_data.set('exec_prefix', '${prefix}')
+conf_data.set('libdir', join_paths('${prefix}', get_option('libdir')))
+configure_file(input : 'intel_aubdump.in', output : 'intel_aubdump',
+               configuration : conf_data, install_dir : get_option('bindir'))

I haven't yet figured out why meson installs something without explicit guidance, and other things it leaves behind until you tell it otherwise. This one didn't seem to need the manual prodding. Someone care to clue me in on the rules?

Quoted 9 lines
tools/meson.build +1 -0
+
 subdir('null_state_gen')
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH 6/6 intel_aubdump: Add --no-exec command option

In reply to Jordan Justen

In some cases it is preferable to not send exec commands to the kernel, but to otherwise record the exec command into the AUB file.

For example, when using the --device override option, it might be best to avoid passing the EXEC ioctls through to the kernel.

---
 tools/aubdump.c        | 13 +++++++++++--
 tools/intel_aubdump.in |  7 +++++++
 2 files changed, 18 insertions(+), 2 deletions(-)
tools/aubdump.c +11 -2
index 4392e589..6961cd51 100644
@@ -58,6 +58,7 @@ static int gen = 0;
 static int verbose = 0;
 static bool device_override;
 static uint32_t device;
+static bool no_exec = false;
 
 #define MAX_BO_COUNT 64 * 1024
 
@@ -567,6 +568,8 @@ maybe_init(void)
 				"intel_aubdump: failed to parse device id '%s'",
 				value);
 			device_override = true;
+		} else if (!strcmp(key, "no_exec")) {
+			no_exec = true;
 		} else if (!strcmp(key, "file")) {
 			filename = strdup(value);
 			files[0] = fopen(filename, "w+");
@@ -645,7 +648,10 @@ ioctl(int fd, unsigned long request, ...)
 					"application uses DRM_IOCTL_I915_GEM_EXECBUFFER, not handled\n");
 				once = true;
 			}
-			return libc_ioctl(fd, request, argp);
+			if (verbose && no_exec)
+				printf("Skipping DRM_IOCTL_I915_GEM_EXECBUFFER "
+				       "ioctl (--no-exec)\n");
+			return no_exec ? 0 : libc_ioctl(fd, request, argp);
 		}
 
 		case DRM_IOCTL_I915_GEM_EXECBUFFER2:
@@ -654,7 +660,10 @@ ioctl(int fd, unsigned long request, ...)
 			if (device_override)
 				return 0;
 
-			return libc_ioctl(fd, request, argp);
+			if (verbose && no_exec)
+				printf("Skipping DRM_IOCTL_I915_GEM_EXECBUFFER2 "
+				       "ioctl (--no-exec)\n");
+			return no_exec ? 0 : libc_ioctl(fd, request, argp);
 		}
 
 		case DRM_IOCTL_I915_GEM_CREATE: {
tools/intel_aubdump.in +7 -0
index 8bc6b19d..ce77c849 100755
@@ -15,6 +15,9 @@ contents and execution of the GEM application.
 
       --device=ID    Override PCI ID of the reported device
 
+  -n, --no-exec      Record exec commands in the AUB file, but don't send
+                     them to the kernel
+
   -v                 Enable verbose output
 
       --help         Display this help message and exit
@@ -79,6 +82,10 @@ while true; do
 	      add_arg "device=${1##--device=}"
 	      shift
 	      ;;
+	  -n|--no-exec)
+	      add_arg "no_exec=1"
+	      shift
+	      ;;
 	  --help)
 	      show_help
 	      ;;
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

Re: [PATCH 6/6] intel_aubdump: Add --no-exec command option

Quoted 46 lines · Jordan Justen

In some cases it is preferable to not send exec commands to the kernel, but to otherwise record the exec command into the AUB file.

For example, when using the --device override option, it might be best to avoid passing the EXEC ioctls through to the kernel.

---
 tools/aubdump.c        | 13 +++++++++++--
 tools/intel_aubdump.in |  7 +++++++
 2 files changed, 18 insertions(+), 2 deletions(-)
tools/aubdump.c +7 -1
index 4392e589..6961cd51 100644
@@ -58,6 +58,7 @@ static int gen = 0;
 static int verbose = 0;
 static bool device_override;
 static uint32_t device;
+static bool no_exec = false;
 
 #define MAX_BO_COUNT 64 * 1024
 
@@ -567,6 +568,8 @@ maybe_init(void)
                                "intel_aubdump: failed to parse device id '%s'",
                                value);
                        device_override = true;
+               } else if (!strcmp(key, "no_exec")) {
+                       no_exec = true;
                } else if (!strcmp(key, "file")) {
                        filename = strdup(value);
                        files[0] = fopen(filename, "w+");
@@ -645,7 +648,10 @@ ioctl(int fd, unsigned long request, ...)
                                        "application uses DRM_IOCTL_I915_GEM_EXECBUFFER, not handled\n");
                                once = true;
                        }
-                       return libc_ioctl(fd, request, argp);
+                       if (verbose && no_exec)
+                               printf("Skipping DRM_IOCTL_I915_GEM_EXECBUFFER "
+                                      "ioctl (--no-exec)\n");
+                       return no_exec ? 0 : libc_ioctl(fd, request, argp);
                }
 
                case DRM_IOCTL_I915_GEM_EXECBUFFER2:

tools/aubdump.c ioctl(int fd, unsigned long request, ...) · line 661

Quoted 2 lines
tools/aubdump.c +0 -0
@@ -654,7 +660,10 @@ ioctl(int fd, unsigned long request, ...)
                        if (device_override)
                                return 0;

Hmm, I guess I just looked at the DRM_IOCTL_I915_GEM_EXECBUFFER case and then glossed over the fact that DRM_IOCTL_I915_GEM_EXECBUFFER2 already skips exec when --device is used.

So, this patch should be dropped...

I guess the other meson ones might be useful.

-Jordan

Quoted 37 lines
tools/aubdump.c +4 -1
-                       return libc_ioctl(fd, request, argp);
+                       if (verbose && no_exec)
+                               printf("Skipping DRM_IOCTL_I915_GEM_EXECBUFFER2 "
+                                      "ioctl (--no-exec)\n");
+                       return no_exec ? 0 : libc_ioctl(fd, request, argp);
                }
 
                case DRM_IOCTL_I915_GEM_CREATE: {
tools/intel_aubdump.in +7 -0
index 8bc6b19d..ce77c849 100755
@@ -15,6 +15,9 @@ contents and execution of the GEM application.
 
       --device=ID    Override PCI ID of the reported device
 
+  -n, --no-exec      Record exec commands in the AUB file, but don't send
+                     them to the kernel
+
   -v                 Enable verbose output
 
       --help         Display this help message and exit
@@ -79,6 +82,10 @@ while true; do
              add_arg "device=${1##--device=}"
              shift
              ;;
+         -n|--no-exec)
+             add_arg "no_exec=1"
+             shift
+             ;;
          --help)
              show_help
              ;;
Signature · 1 line
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw
In reply to Jordan Justen
Quoted 27 lines · Jordan Justen

The meson shared_library function appears to hard code prefixing the library name with 'lib'.

---
 tools/Makefile.am      | 2 +-
 tools/intel_aubdump.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/Makefile.am +1 -1
index 2c7b5799..73811060 100644
@@ -24,7 +24,7 @@ AM_LDFLAGS = -Wl,--as-needed
 
 # aubdumper
 
-module_LTLIBRARIES = intel_aubdump.la
+module_LTLIBRARIES = libintel_aubdump.la
 moduledir = $(libdir)
 intel_aubdump_la_LDFLAGS = -module -avoid-version -no-undefined
 intel_aubdump_la_SOURCES = aubdump.c
tools/intel_aubdump.in +0 -0
index 977fe951..8bc6b19d 100644

tools/intel_aubdump.in prefix=@prefix@ · line 109

Quoted 6 lines
tools/intel_aubdump.in +1 -1
@@ -105,7 +105,7 @@ prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 
-LD_PRELOAD=${libdir}/intel_aubdump.so${LD_PPRELOAD:+:${LD_PRELOAD}} \
+LD_PRELOAD=${libdir}/libintel_aubdump.so${LD_PPRELOAD:+:${LD_PRELOAD}} \
 	  exec -- "$@" 3<<EOF

Ville's series makes meson build intel_aubdump.so instead. Can you take a look at his series and slap reviews where appropriate?

https://patchwork.freedesktop.org/series/30155/

Signature · 5 lines
Petri Latvala
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw
Quoted 31 lines · Petri Latvala
Quoted 30 lines · Jordan Justen

The meson shared_library function appears to hard code prefixing the library name with 'lib'.

---
 tools/Makefile.am      | 2 +-
 tools/intel_aubdump.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/Makefile.am +1 -1
index 2c7b5799..73811060 100644
@@ -24,7 +24,7 @@ AM_LDFLAGS = -Wl,--as-needed
 
 # aubdumper
 
-module_LTLIBRARIES = intel_aubdump.la
+module_LTLIBRARIES = libintel_aubdump.la
 moduledir = $(libdir)
 intel_aubdump_la_LDFLAGS = -module -avoid-version -no-undefined
 intel_aubdump_la_SOURCES = aubdump.c
tools/intel_aubdump.in +0 -0
index 977fe951..8bc6b19d 100644
@@ -105,7 +105,7 @@ prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 
Quoted 7 lines

tools/intel_aubdump.in prefix=@prefix@ · line 109

Quoted 3 lines
tools/intel_aubdump.in +1 -1
-LD_PRELOAD=${libdir}/intel_aubdump.so${LD_PPRELOAD:+:${LD_PRELOAD}} \
+LD_PRELOAD=${libdir}/libintel_aubdump.so${LD_PPRELOAD:+:${LD_PRELOAD}} \
        exec -- "$@" 3<<EOF

Ville's series makes meson build intel_aubdump.so instead. Can you take a look at his series and slap reviews where appropriate?

Oh, nice. I'll talk a look.

Ville, Petri: After skimming Ville's series, it looks like maybe patches 2, 4 and 5 from this series might still be useful. Or, did I miss similar patches on the list for that as well?

-Jordan
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx