This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH] configure: check for perf_event.h version
- From: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 6 Aug 2015 15:00:35 +0000
- Subject: RE: [PATCH] configure: check for perf_event.h version
- Authentication-results: sourceware.org; auth=none
- References: <1438866405-22616-1-git-send-email-markus dot t dot metzger at intel dot com> <55C365B2 dot 4010906 at redhat dot com> <A78C989F6D9628469189715575E55B2333190C1E at IRSMSX104 dot ger dot corp dot intel dot com> <55C36F31 dot 5080807 at redhat dot com>
> -----Original Message-----
> From: Pedro Alves [mailto:palves@redhat.com]
> Sent: Thursday, August 6, 2015 4:29 PM
> To: Metzger, Markus T
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH] configure: check for perf_event.h version
>
> On 08/06/2015 03:14 PM, Metzger, Markus T wrote:
> >> -----Original Message-----
> >> From: Pedro Alves [mailto:palves@redhat.com]
> >> Sent: Thursday, August 6, 2015 3:49 PM
> >> To: Metzger, Markus T
> >> Cc: gdb-patches@sourceware.org
> >> Subject: Re: [PATCH] configure: check for perf_event.h version
> >>
> >> On 08/06/2015 02:06 PM, Markus Metzger wrote:
> >>> Intel(R) Processor Trace support requires a recent linux/perf_event.h
> >> header.
> >>>
> >>> When GDB is built on an older system, Intel(R) Processor Trace will not
> be
> >>> available and there is no indication in the configure and build log as to
> >>> what went wrong.
> >>>
> >>> Check for a compatible linux/perf_event.h at configure-time.
> >>
> >>
> >>> diff --git a/gdb/configure.ac b/gdb/configure.ac
> >>> index 905c27b..d867e85 100644
> >>> --- a/gdb/configure.ac
> >>> +++ b/gdb/configure.ac
> >>> @@ -1252,6 +1252,20 @@ if test "${with_intel_pt}" = no; then
> >>> AC_MSG_WARN([Intel(R) Processor Trace support disabled; some
> >> features may be unavailable.])
> >>> HAVE_LIBIPT=no
> >>> else
> >>> + AC_PREPROC_IFELSE(AC_LANG_SOURCE([[
> >>> +#include <linux/perf_event.h>
> >>> +#ifdef PERF_ATTR_SIZE_VER5
> >>> +# error
> >>> +#endif
> >>
> >> Can you explain what kind of symbol PERF_ATTR_SIZE_VER5 is?
> >> From the patch, I understand that that is something that is _not_
> >> defined in the perf versions that are supposedly supported?
> >> (otherwise, I'd expect an #ifndef instead.)
> >
> > It's a macro.
>
> Was there ever a PERF_ATTR_SIZE_VER4 symbol? What if
> PERF_ATTR_SIZE_VER6 is ever created? Do we want to have to
> check for it explicitly then?
The linux/perf_event.h header defines the macros for all previous
versions. The current version thus defines
#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */
#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */
#define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */
/* add: sample_stack_user */
#define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */
#define PERF_ATTR_SIZE_VER5 112 /* add: aux_watermark */
> > I took the double-negation approach from a similar
> > check for python_has_threads.
>
> In the python case, we've already checked earlier that python.h
> is available.
>
> In your case, it seems that if <linux/perf_event.h> isn't
> available, you end up with perf_event=yes? Is that what we want?
No. I'll change it and send an update.
Thanks,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul
Chairperson of the Supervisory Board: Tiffany Doon Silva
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928