Re: [PATCH] perf: Fix UAPI fallout

2012-10-19 Thread David Howells
Ingo Molnar  wrote:

> What we want in .c files are not ../.. inclusions but the 
> 'seemless'  inclusions. Which is the overwhelming 
> majority, gladly. Do we want to make that the 100% majority?

I think this is going to be necessary for when x86 gets merged.  x86's
asm/unistd.h #includes uapi/asm/unistd.h, so you can't manually specify the
header without also specifying a -I flag.

I've been having a prod at it, and this seems to partially work:

-BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util 
-I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+$(info XXX $(srctree))
+
+BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include 
-I../../arch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) 
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE

However, I'm trying to work out what will happen if this is run in a separate
output dir, but if I do:

make tools/perf O=build_dir

from the bottom directory, I get:

scripts/Makefile.include:2: *** O=build_dir does not exist.  Stop.

The problem is that the bottom-level Makefile does this:

tools/: FORCE
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/
tools/%: FORCE
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $*

which changes the directory, rendering a relative O= that would be good for
building the normal kernel useless for building a tool.  Should these rules
respecify the O= flag here, or should we give an error if someone tries it?

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf: Fix UAPI fallout

2012-10-19 Thread David Howells
Ingo Molnar mi...@kernel.org wrote:

 What we want in .c files are not ../.. inclusions but the 
 'seemless' linux/abc.h inclusions. Which is the overwhelming 
 majority, gladly. Do we want to make that the 100% majority?

I think this is going to be necessary for when x86 gets merged.  x86's
asm/unistd.h #includes uapi/asm/unistd.h, so you can't manually specify the
header without also specifying a -I flag.

I've been having a prod at it, and this seems to partially work:

-BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util 
-I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+$(info XXX $(srctree))
+
+BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include 
-I../../arch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) 
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE

However, I'm trying to work out what will happen if this is run in a separate
output dir, but if I do:

make tools/perf O=build_dir

from the bottom directory, I get:

scripts/Makefile.include:2: *** O=build_dir does not exist.  Stop.

The problem is that the bottom-level Makefile does this:

tools/: FORCE
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/
tools/%: FORCE
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $*

which changes the directory, rendering a relative O= that would be good for
building the normal kernel useless for building a tool.  Should these rules
respecify the O= flag here, or should we give an error if someone tries it?

David
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf: Fix UAPI fallout

2012-10-15 Thread David Howells
Ingo Molnar  wrote:

> Arnaldo: the way we include some of the include files directly 
> into tools/perf/ .c files [such as hw_breakpoint.h] and 
> represent others transparently via utils/include/ [such as 
> rbtree.h] is a bit messy and ought to be cleaned up I suspect.

I tried to make the USERINCLUDE macro in the bottom-level Makefile that, but I
didn't realise I had to export it:-(.

That, however, also brings in linux/kconfig.h but I don't know whether you
want/need that.

> I think the best model would be to cleanly separate from any 
> /usr/include/linux/ muck, which might be out of sync, and which 
> might stand in the way of changes. Is it possible to exclude all 
> of /usr/include/ and try to build purely from 
> include/uapi/linux/

You would also need arch/foo/include/uapi/.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf: Fix UAPI fallout

2012-10-15 Thread David Howells
Ingo Molnar mi...@kernel.org wrote:

 Arnaldo: the way we include some of the include files directly 
 into tools/perf/ .c files [such as hw_breakpoint.h] and 
 represent others transparently via utils/include/ [such as 
 rbtree.h] is a bit messy and ought to be cleaned up I suspect.

I tried to make the USERINCLUDE macro in the bottom-level Makefile that, but I
didn't realise I had to export it:-(.

That, however, also brings in linux/kconfig.h but I don't know whether you
want/need that.

 I think the best model would be to cleanly separate from any 
 /usr/include/linux/ muck, which might be out of sync, and which 
 might stand in the way of changes. Is it possible to exclude all 
 of /usr/include/ and try to build purely from 
 include/uapi/linux/

You would also need arch/foo/include/uapi/.

David
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf: Fix UAPI fallout

2012-10-14 Thread David Miller
From: Ingo Molnar 
Date: Sun, 14 Oct 2012 10:56:17 +0200

> Find below a stab at that, lightly tested.

Thanks for doing this.

> diff --git a/tools/perf/perf.h b/tools/perf/perf.h
> index a89cbbb..2762877 100644
> --- a/tools/perf/perf.h
> +++ b/tools/perf/perf.h
> @@ -112,7 +112,7 @@ void get_term_dimensions(struct winsize *ws);
>  #include 
>  #include 
>  
> -#include "../../include/linux/perf_event.h"
> +#include "../../include/uapi/linux/perf_event.h"
>  #include "util/types.h"
>  #include 
>  

Each arch stanza in this header will also need the asm/unistd.h header
path adjusted to the UAPI one.

In fact, that's the only thing that broke the build for me.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] perf: Fix UAPI fallout

2012-10-14 Thread Ingo Molnar

Find below a stab at that, lightly tested.

Arnaldo: the way we include some of the include files directly 
into tools/perf/ .c files [such as hw_breakpoint.h] and 
represent others transparently via utils/include/ [such as 
rbtree.h] is a bit messy and ought to be cleaned up I suspect.

What we want in .c files are not ../.. inclusions but the 
'seemless'  inclusions. Which is the overwhelming 
majority, gladly. Do we want to make that the 100% majority?

We should probably also think about how to represent kernel 
versus UAPI headers in tools/perf/, plus the /usr/include/linux/ 
headers which are always an option to get picked up.

I think the best model would be to cleanly separate from any 
/usr/include/linux/ muck, which might be out of sync, and which 
might stand in the way of changes. Is it possible to exclude all 
of /usr/include/ and try to build purely from 
include/uapi/linux/, with a few exceptions (with clearly 
distinctive patterns) where we [currently] need to pick up 
include/linux/ headers, such as hw_breakpoint.h or rbtree.h?

This would clean up the code and would also make it easier to 
drive UAPI conversions: the bits that we still pick up from 
include/linux/ are candidates for (incremental, slow, well 
tested, please) UAPI conversions.

Thanks,

Ingo

>
>From 957e49e521292324053809bb73173b82d9e42464 Mon Sep 17 00:00:00 2001
From: Ingo Molnar 
Date: Sun, 14 Oct 2012 10:40:57 +0200
Subject: [PATCH] perf: Fix UAPI fallout

The UAPI commits forgot to test tooling builds such as tools/perf/,
and this fixes the fallout.

Manual conversion.

Signed-off-by: Ingo Molnar 
---
 tools/perf/Makefile | 4 ++--
 tools/perf/perf.h   | 2 +-
 tools/perf/util/evsel.c | 2 +-
 tools/perf/util/evsel.h | 2 +-
 tools/perf/util/header.h| 2 +-
 tools/perf/util/include/asm/byteorder.h | 2 +-
 tools/perf/util/include/linux/const.h   | 2 +-
 tools/perf/util/parse-events.h  | 2 +-
 tools/perf/util/pmu.h   | 2 +-
 tools/perf/util/session.h   | 2 +-
 10 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 2472645..f7c968a 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -252,10 +252,10 @@ $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c 
$(OUTPUT)util/pmu-bison.c
 
 LIB_FILE=$(OUTPUT)libperf.a
 
-LIB_H += ../../include/linux/perf_event.h
+LIB_H += ../../include/uapi/linux/perf_event.h
 LIB_H += ../../include/linux/rbtree.h
 LIB_H += ../../include/linux/list.h
-LIB_H += ../../include/linux/const.h
+LIB_H += ../../include/uapi/linux/const.h
 LIB_H += ../../include/linux/hash.h
 LIB_H += ../../include/linux/stringify.h
 LIB_H += util/include/linux/bitmap.h
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index a89cbbb..2762877 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -112,7 +112,7 @@ void get_term_dimensions(struct winsize *ws);
 #include 
 #include 
 
-#include "../../include/linux/perf_event.h"
+#include "../../include/uapi/linux/perf_event.h"
 #include "util/types.h"
 #include 
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index ffdd94e..618d411 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -19,7 +19,7 @@
 #include "thread_map.h"
 #include "target.h"
 #include "../../../include/linux/hw_breakpoint.h"
-#include "../../include/linux/perf_event.h"
+#include "../../../include/uapi/linux/perf_event.h"
 #include "perf_regs.h"
 
 #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 3ead0d5..6f94d6d 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -3,7 +3,7 @@
 
 #include 
 #include 
-#include "../../../include/linux/perf_event.h"
+#include "../../../include/uapi/linux/perf_event.h"
 #include "types.h"
 #include "xyarray.h"
 #include "cgroup.h"
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 99bdd3a..879d215 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -1,7 +1,7 @@
 #ifndef __PERF_HEADER_H
 #define __PERF_HEADER_H
 
-#include "../../../include/linux/perf_event.h"
+#include "../../../include/uapi/linux/perf_event.h"
 #include 
 #include 
 #include "types.h"
diff --git a/tools/perf/util/include/asm/byteorder.h 
b/tools/perf/util/include/asm/byteorder.h
index b722abe..2a9bdc0 100644
--- a/tools/perf/util/include/asm/byteorder.h
+++ b/tools/perf/util/include/asm/byteorder.h
@@ -1,2 +1,2 @@
 #include 
-#include "../../../../include/linux/swab.h"
+#include "../../../../include/uapi/linux/swab.h"
diff --git a/tools/perf/util/include/linux/const.h 
b/tools/perf/util/include/linux/const.h
index 1b476c9..c10a35e 100644
--

[PATCH] perf: Fix UAPI fallout

2012-10-14 Thread Ingo Molnar

Find below a stab at that, lightly tested.

Arnaldo: the way we include some of the include files directly 
into tools/perf/ .c files [such as hw_breakpoint.h] and 
represent others transparently via utils/include/ [such as 
rbtree.h] is a bit messy and ought to be cleaned up I suspect.

What we want in .c files are not ../.. inclusions but the 
'seemless' linux/abc.h inclusions. Which is the overwhelming 
majority, gladly. Do we want to make that the 100% majority?

We should probably also think about how to represent kernel 
versus UAPI headers in tools/perf/, plus the /usr/include/linux/ 
headers which are always an option to get picked up.

I think the best model would be to cleanly separate from any 
/usr/include/linux/ muck, which might be out of sync, and which 
might stand in the way of changes. Is it possible to exclude all 
of /usr/include/ and try to build purely from 
include/uapi/linux/, with a few exceptions (with clearly 
distinctive patterns) where we [currently] need to pick up 
include/linux/ headers, such as hw_breakpoint.h or rbtree.h?

This would clean up the code and would also make it easier to 
drive UAPI conversions: the bits that we still pick up from 
include/linux/ are candidates for (incremental, slow, well 
tested, please) UAPI conversions.

Thanks,

Ingo


From 957e49e521292324053809bb73173b82d9e42464 Mon Sep 17 00:00:00 2001
From: Ingo Molnar mi...@kernel.org
Date: Sun, 14 Oct 2012 10:40:57 +0200
Subject: [PATCH] perf: Fix UAPI fallout

The UAPI commits forgot to test tooling builds such as tools/perf/,
and this fixes the fallout.

Manual conversion.

Signed-off-by: Ingo Molnar mi...@kernel.org
---
 tools/perf/Makefile | 4 ++--
 tools/perf/perf.h   | 2 +-
 tools/perf/util/evsel.c | 2 +-
 tools/perf/util/evsel.h | 2 +-
 tools/perf/util/header.h| 2 +-
 tools/perf/util/include/asm/byteorder.h | 2 +-
 tools/perf/util/include/linux/const.h   | 2 +-
 tools/perf/util/parse-events.h  | 2 +-
 tools/perf/util/pmu.h   | 2 +-
 tools/perf/util/session.h   | 2 +-
 10 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 2472645..f7c968a 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -252,10 +252,10 @@ $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c 
$(OUTPUT)util/pmu-bison.c
 
 LIB_FILE=$(OUTPUT)libperf.a
 
-LIB_H += ../../include/linux/perf_event.h
+LIB_H += ../../include/uapi/linux/perf_event.h
 LIB_H += ../../include/linux/rbtree.h
 LIB_H += ../../include/linux/list.h
-LIB_H += ../../include/linux/const.h
+LIB_H += ../../include/uapi/linux/const.h
 LIB_H += ../../include/linux/hash.h
 LIB_H += ../../include/linux/stringify.h
 LIB_H += util/include/linux/bitmap.h
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index a89cbbb..2762877 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -112,7 +112,7 @@ void get_term_dimensions(struct winsize *ws);
 #include sys/types.h
 #include sys/syscall.h
 
-#include ../../include/linux/perf_event.h
+#include ../../include/uapi/linux/perf_event.h
 #include util/types.h
 #include stdbool.h
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index ffdd94e..618d411 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -19,7 +19,7 @@
 #include thread_map.h
 #include target.h
 #include ../../../include/linux/hw_breakpoint.h
-#include ../../include/linux/perf_event.h
+#include ../../../include/uapi/linux/perf_event.h
 #include perf_regs.h
 
 #define FD(e, x, y) (*(int *)xyarray__entry(e-fd, x, y))
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 3ead0d5..6f94d6d 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -3,7 +3,7 @@
 
 #include linux/list.h
 #include stdbool.h
-#include ../../../include/linux/perf_event.h
+#include ../../../include/uapi/linux/perf_event.h
 #include types.h
 #include xyarray.h
 #include cgroup.h
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 99bdd3a..879d215 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -1,7 +1,7 @@
 #ifndef __PERF_HEADER_H
 #define __PERF_HEADER_H
 
-#include ../../../include/linux/perf_event.h
+#include ../../../include/uapi/linux/perf_event.h
 #include sys/types.h
 #include stdbool.h
 #include types.h
diff --git a/tools/perf/util/include/asm/byteorder.h 
b/tools/perf/util/include/asm/byteorder.h
index b722abe..2a9bdc0 100644
--- a/tools/perf/util/include/asm/byteorder.h
+++ b/tools/perf/util/include/asm/byteorder.h
@@ -1,2 +1,2 @@
 #include asm/types.h
-#include ../../../../include/linux/swab.h
+#include ../../../../include/uapi/linux/swab.h
diff --git a/tools/perf/util/include/linux/const.h 
b/tools/perf/util/include/linux/const.h
index 1b476c9..c10a35e 100644
--- a/tools/perf/util/include/linux/const.h
+++ b/tools/perf/util/include/linux/const.h
@@ -1 +1 @@
-#include

Re: [PATCH] perf: Fix UAPI fallout

2012-10-14 Thread David Miller
From: Ingo Molnar mi...@kernel.org
Date: Sun, 14 Oct 2012 10:56:17 +0200

 Find below a stab at that, lightly tested.

Thanks for doing this.

 diff --git a/tools/perf/perf.h b/tools/perf/perf.h
 index a89cbbb..2762877 100644
 --- a/tools/perf/perf.h
 +++ b/tools/perf/perf.h
 @@ -112,7 +112,7 @@ void get_term_dimensions(struct winsize *ws);
  #include sys/types.h
  #include sys/syscall.h
  
 -#include ../../include/linux/perf_event.h
 +#include ../../include/uapi/linux/perf_event.h
  #include util/types.h
  #include stdbool.h
  

Each arch stanza in this header will also need the asm/unistd.h header
path adjusted to the UAPI one.

In fact, that's the only thing that broke the build for me.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/