All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] kbuild: Increase kallsyms max symbol length
@ 2013-08-11  0:55 Andi Kleen
  0 siblings, 0 replies; 14+ messages in thread
From: Andi Kleen @ 2013-08-11  0:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: mmarek, linux-kbuild, Joe Mario, Andi Kleen

From: Joe Mario <jmario@redhat.com>

[AK: This seems like a ticking time bomb even without LTO,
so should be merged now. It causes very weird problems.
Thanks to Joe for tracking them down.]

With the added postfixes that LTO adds for local
symbols, the longest name in the kernel overflows
the namebuf[KSYM_NAME_LEN] array by two bytes.  That name is:
__pci_fixup_resumePCI_VENDOR_ID_SERVERWORKSPCI_DEVICE_ID_SERVERWORKS_HT1000SBquirk_disable_broadcom_boot_interrupt.1488004.672802

Double the max symbol name length.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 include/linux/kallsyms.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 6883e19..711a50f 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -9,7 +9,7 @@
 #include <linux/kernel.h>
 #include <linux/stddef.h>
 
-#define KSYM_NAME_LEN 128
+#define KSYM_NAME_LEN 256
 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
 			 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
 
-- 
1.8.3.1


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

* Some kbuild fixes
@ 2013-10-22 15:46 Andi Kleen
  2013-10-22 15:46 ` [PATCH 1/3] kbuild: Increase kallsyms max symbol length Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Andi Kleen @ 2013-10-22 15:46 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kbuild, linux-kernel

These are some generic Kbuild fixes from the LTO tree.
These are not really LTO specific and can be applied indepdently.

-Andi

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

* [PATCH 1/3] kbuild: Increase kallsyms max symbol length
  2013-10-22 15:46 Some kbuild fixes Andi Kleen
@ 2013-10-22 15:46 ` Andi Kleen
  2013-10-22 16:36   ` Joe Perches
  2013-10-22 15:46 ` [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c Andi Kleen
  2013-10-22 15:46 ` [PATCH 3/3] kbuild, bloat-o-meter: fix static detection Andi Kleen
  2 siblings, 1 reply; 14+ messages in thread
From: Andi Kleen @ 2013-10-22 15:46 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kbuild, linux-kernel, Joe Mario, Andi Kleen

From: Joe Mario <jmario@redhat.com>

[AK: This seems like a ticking time bomb even without LTO,
so should be merged now. It causes very weird problems.
Thanks to Joe for tracking them down.]

With the added postfixes that LTO adds for local
symbols, the longest name in the kernel overflows
the namebuf[KSYM_NAME_LEN] array by two bytes.  That name is:
__pci_fixup_resumePCI_VENDOR_ID_SERVERWORKSPCI_DEVICE_ID_SERVERWORKS_HT1000SBquirk_disable_broadcom_boot_interrupt.1488004.672802

Double the max symbol name length.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 include/linux/kallsyms.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 6883e19..711a50f 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -9,7 +9,7 @@
 #include <linux/kernel.h>
 #include <linux/stddef.h>
 
-#define KSYM_NAME_LEN 128
+#define KSYM_NAME_LEN 256
 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
 			 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
 
-- 
1.8.3.1


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

* [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c
  2013-10-22 15:46 Some kbuild fixes Andi Kleen
  2013-10-22 15:46 ` [PATCH 1/3] kbuild: Increase kallsyms max symbol length Andi Kleen
@ 2013-10-22 15:46 ` Andi Kleen
  2013-10-22 16:36   ` Joe Perches
  2013-10-22 15:46 ` [PATCH 3/3] kbuild, bloat-o-meter: fix static detection Andi Kleen
  2 siblings, 1 reply; 14+ messages in thread
From: Andi Kleen @ 2013-10-22 15:46 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kbuild, linux-kernel, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Also warn for too long symbols

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 scripts/kallsyms.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 6940f00..46264c7 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -27,7 +27,7 @@
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
 #endif
 
-#define KSYM_NAME_LEN		128
+#define KSYM_NAME_LEN		256
 
 struct sym_entry {
 	unsigned long long addr;
@@ -118,6 +118,12 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 			fprintf(stderr, "Read error or end of file.\n");
 		return -1;
 	}
+	if (strlen(str) > KSYM_NAME_LEN) {
+		fprintf(stderr, "Symbol %s too long for kallsyms.\n"
+                                "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c",
+			str);
+		return -1;
+	}
 
 	sym = str;
 	/* skip prefix char */
-- 
1.8.3.1


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

* [PATCH 3/3] kbuild, bloat-o-meter: fix static detection
  2013-10-22 15:46 Some kbuild fixes Andi Kleen
  2013-10-22 15:46 ` [PATCH 1/3] kbuild: Increase kallsyms max symbol length Andi Kleen
  2013-10-22 15:46 ` [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c Andi Kleen
@ 2013-10-22 15:46 ` Andi Kleen
  2013-11-06 21:27   ` Michal Marek
  2 siblings, 1 reply; 14+ messages in thread
From: Andi Kleen @ 2013-10-22 15:46 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kbuild, linux-kernel, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Disable static detection: the static currently drops a lot of useful information
including clones generated by gcc. Drop this. The statics will appear now
without static. prefix.

But remove the LTO .NUMBER postfixes that look ugly

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 scripts/bloat-o-meter | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 6129020..855198c 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -20,8 +20,8 @@ def getsizes(file):
         if type in "tTdDbBrR":
             # strip generated symbols
             if name[:6] == "__mod_": continue
-            # function names begin with '.' on 64-bit powerpc
-            if "." in name[1:]: name = "static." + name.split(".")[0]
+            # statics and some other optimizations adds random .NUMBER
+            name = re.sub(r'\.[0-9]+', '', name)
             sym[name] = sym.get(name, 0) + int(size, 16)
     return sym
 
-- 
1.8.3.1


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

* Re: [PATCH 1/3] kbuild: Increase kallsyms max symbol length
  2013-10-22 15:46 ` [PATCH 1/3] kbuild: Increase kallsyms max symbol length Andi Kleen
@ 2013-10-22 16:36   ` Joe Perches
  2013-10-22 16:40     ` Andi Kleen
  2013-10-23 13:06     ` [PATCH 1/3] kbuild: Increase kallsyms max symbol length v2 Andi Kleen
  0 siblings, 2 replies; 14+ messages in thread
From: Joe Perches @ 2013-10-22 16:36 UTC (permalink / raw)
  To: Andi Kleen; +Cc: mmarek, linux-kbuild, linux-kernel, Joe Mario, Andi Kleen

On Tue, 2013-10-22 at 08:46 -0700, Andi Kleen wrote:
> From: Joe Mario <jmario@redhat.com>
> 
> [AK: This seems like a ticking time bomb even without LTO,
> so should be merged now. It causes very weird problems.
> Thanks to Joe for tracking them down.]
> 
> With the added postfixes that LTO adds for local
> symbols, the longest name in the kernel overflows
> the namebuf[KSYM_NAME_LEN] array by two bytes.  That name is:
> __pci_fixup_resumePCI_VENDOR_ID_SERVERWORKSPCI_DEVICE_ID_SERVERWORKS_HT1000SBquirk_disable_broadcom_boot_interrupt.1488004.672802
> 
> Double the max symbol name length.
[]
> diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
> index 6883e19..711a50f 100644
> --- a/include/linux/kallsyms.h
> +++ b/include/linux/kallsyms.h
> @@ -9,7 +9,7 @@
>  #include <linux/kernel.h>
>  #include <linux/stddef.h>
>  
> -#define KSYM_NAME_LEN 128
> +#define KSYM_NAME_LEN 256

Doesn't doubling seems a tad excessive given the
silly length of that symbol above?



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

* Re: [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c
  2013-10-22 15:46 ` [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c Andi Kleen
@ 2013-10-22 16:36   ` Joe Perches
  2013-10-23 13:07     ` [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c v2 Andi Kleen
  0 siblings, 1 reply; 14+ messages in thread
From: Joe Perches @ 2013-10-22 16:36 UTC (permalink / raw)
  To: Andi Kleen; +Cc: mmarek, linux-kbuild, linux-kernel, Andi Kleen

On Tue, 2013-10-22 at 08:46 -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> Also warn for too long symbols

[]

> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
[]
> @@ -27,7 +27,7 @@
>  #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
>  #endif
>  
> -#define KSYM_NAME_LEN		128
> +#define KSYM_NAME_LEN		256

Maybe nicer to get these #defines via #include <>
to avoid getting out of sync.
 
>  struct sym_entry {
>  	unsigned long long addr;
> @@ -118,6 +118,12 @@ static int read_symbol(FILE *in, struct sym_entry *s)
>  			fprintf(stderr, "Read error or end of file.\n");
>  		return -1;
>  	}
> +	if (strlen(str) > KSYM_NAME_LEN) {
> +		fprintf(stderr, "Symbol %s too long for kallsyms.\n"
> +                                "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c",
> +			str);

Missing newline?

Also maybe nicer to show symbol length and KSYM_NAME_LEN values.



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

* Re: [PATCH 1/3] kbuild: Increase kallsyms max symbol length
  2013-10-22 16:36   ` Joe Perches
@ 2013-10-22 16:40     ` Andi Kleen
  2013-10-22 16:55       ` Joe Perches
  2013-10-23 13:06     ` [PATCH 1/3] kbuild: Increase kallsyms max symbol length v2 Andi Kleen
  1 sibling, 1 reply; 14+ messages in thread
From: Andi Kleen @ 2013-10-22 16:40 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andi Kleen, mmarek, linux-kbuild, linux-kernel, Joe Mario,
	Andi Kleen

> Doesn't doubling seems a tad excessive given the
> silly length of that symbol above?

No, it doesn't.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

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

* Re: [PATCH 1/3] kbuild: Increase kallsyms max symbol length
  2013-10-22 16:40     ` Andi Kleen
@ 2013-10-22 16:55       ` Joe Perches
  0 siblings, 0 replies; 14+ messages in thread
From: Joe Perches @ 2013-10-22 16:55 UTC (permalink / raw)
  To: Andi Kleen; +Cc: mmarek, linux-kbuild, linux-kernel, Joe Mario, Andi Kleen

On Tue, 2013-10-22 at 18:40 +0200, Andi Kleen wrote:
> > Doesn't doubling seems a tad excessive given the
> > silly length of that symbol above?
> 
> No, it doesn't.

Does it work?

Doesn't kallsyms:get_symbol_offset restrict the maximum
possible length to 255?



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

* [PATCH 1/3] kbuild: Increase kallsyms max symbol length v2
  2013-10-22 16:36   ` Joe Perches
  2013-10-22 16:40     ` Andi Kleen
@ 2013-10-23 13:06     ` Andi Kleen
  2013-11-06 21:26       ` Michal Marek
  1 sibling, 1 reply; 14+ messages in thread
From: Andi Kleen @ 2013-10-23 13:06 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andi Kleen, mmarek, linux-kbuild, linux-kernel, Joe Mario,
	Andi Kleen

From: Joe Mario <jmario@redhat.com>

[AK: This seems like a ticking time bomb even without LTO,
so should be merged now. It causes very weird problems.
Thanks to Joe for tracking them down.]

With the added postfixes that LTO adds for local
symbols, the longest name in the kernel overflows
the namebuf[KSYM_NAME_LEN] array by two bytes.  That name is:
__pci_fixup_resumePCI_VENDOR_ID_SERVERWORKSPCI_DEVICE_ID_SERVERWORKS_HT1000SBquirk_disable_broadcom_boot_interrupt.1488004.672802

Double the max symbol name length.

v2: Use 255  (Joe Perches)
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 include/linux/kallsyms.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 6883e19..5648870 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -9,7 +9,7 @@
 #include <linux/kernel.h>
 #include <linux/stddef.h>
 
-#define KSYM_NAME_LEN 128
+#define KSYM_NAME_LEN 255
 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
 			 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
 
-- 
1.8.4

-- 
ak@linux.intel.com -- Speaking for myself only.

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

* [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c v2
  2013-10-22 16:36   ` Joe Perches
@ 2013-10-23 13:07     ` Andi Kleen
  2013-11-06 21:27       ` Michal Marek
  0 siblings, 1 reply; 14+ messages in thread
From: Andi Kleen @ 2013-10-23 13:07 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andi Kleen, mmarek, linux-kbuild, linux-kernel, Andi Kleen


Also warn for too long symbols

v2: Add missing newline. Use 255 max (Joe Perches)
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 scripts/kallsyms.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 6940f00..c4230a4 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -27,7 +27,7 @@
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
 #endif
 
-#define KSYM_NAME_LEN		128
+#define KSYM_NAME_LEN		255
 
 struct sym_entry {
 	unsigned long long addr;
@@ -118,6 +118,12 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 			fprintf(stderr, "Read error or end of file.\n");
 		return -1;
 	}
+	if (strlen(str) > KSYM_NAME_LEN) {
+		fprintf(stderr, "Symbol %s too long for kallsyms (%lu vs %d).\n"
+                                "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n",
+			str, strlen(str), KSYM_NAME_LEN);
+		return -1;
+	}
 
 	sym = str;
 	/* skip prefix char */
-- 
1.8.4

-- 
ak@linux.intel.com -- Speaking for myself only.

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

* Re: [PATCH 1/3] kbuild: Increase kallsyms max symbol length v2
  2013-10-23 13:06     ` [PATCH 1/3] kbuild: Increase kallsyms max symbol length v2 Andi Kleen
@ 2013-11-06 21:26       ` Michal Marek
  0 siblings, 0 replies; 14+ messages in thread
From: Michal Marek @ 2013-11-06 21:26 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Joe Perches, linux-kbuild, linux-kernel, Joe Mario, Andi Kleen

On Wed, Oct 23, 2013 at 03:06:53PM +0200, Andi Kleen wrote:
> From: Joe Mario <jmario@redhat.com>
> 
> [AK: This seems like a ticking time bomb even without LTO,
> so should be merged now. It causes very weird problems.
> Thanks to Joe for tracking them down.]
> 
> With the added postfixes that LTO adds for local
> symbols, the longest name in the kernel overflows
> the namebuf[KSYM_NAME_LEN] array by two bytes.  That name is:
> __pci_fixup_resumePCI_VENDOR_ID_SERVERWORKSPCI_DEVICE_ID_SERVERWORKS_HT1000SBquirk_disable_broadcom_boot_interrupt.1488004.672802
> 
> Double the max symbol name length.
> 
> v2: Use 255  (Joe Perches)
> Signed-off-by: Andi Kleen <ak@linux.intel.com>

Applied to kbuild.git#kbuild.

Michal

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

* Re: [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c v2
  2013-10-23 13:07     ` [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c v2 Andi Kleen
@ 2013-11-06 21:27       ` Michal Marek
  0 siblings, 0 replies; 14+ messages in thread
From: Michal Marek @ 2013-11-06 21:27 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Joe Perches, linux-kbuild, linux-kernel, Andi Kleen

On Wed, Oct 23, 2013 at 03:07:53PM +0200, Andi Kleen wrote:
> 
> Also warn for too long symbols
> 
> v2: Add missing newline. Use 255 max (Joe Perches)
> Signed-off-by: Andi Kleen <ak@linux.intel.com>

Applied to kbuild.git#kbuild.

Michal

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

* Re: [PATCH 3/3] kbuild, bloat-o-meter: fix static detection
  2013-10-22 15:46 ` [PATCH 3/3] kbuild, bloat-o-meter: fix static detection Andi Kleen
@ 2013-11-06 21:27   ` Michal Marek
  0 siblings, 0 replies; 14+ messages in thread
From: Michal Marek @ 2013-11-06 21:27 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kbuild, linux-kernel, Andi Kleen

On Tue, Oct 22, 2013 at 08:46:23AM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> Disable static detection: the static currently drops a lot of useful information
> including clones generated by gcc. Drop this. The statics will appear now
> without static. prefix.
> 
> But remove the LTO .NUMBER postfixes that look ugly
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>

Applied to kbuild.git#kbuild.

Michal

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

end of thread, other threads:[~2013-11-07  5:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-22 15:46 Some kbuild fixes Andi Kleen
2013-10-22 15:46 ` [PATCH 1/3] kbuild: Increase kallsyms max symbol length Andi Kleen
2013-10-22 16:36   ` Joe Perches
2013-10-22 16:40     ` Andi Kleen
2013-10-22 16:55       ` Joe Perches
2013-10-23 13:06     ` [PATCH 1/3] kbuild: Increase kallsyms max symbol length v2 Andi Kleen
2013-11-06 21:26       ` Michal Marek
2013-10-22 15:46 ` [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c Andi Kleen
2013-10-22 16:36   ` Joe Perches
2013-10-23 13:07     ` [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c v2 Andi Kleen
2013-11-06 21:27       ` Michal Marek
2013-10-22 15:46 ` [PATCH 3/3] kbuild, bloat-o-meter: fix static detection Andi Kleen
2013-11-06 21:27   ` Michal Marek
  -- strict thread matches above, loose matches on Subject: below --
2013-08-11  0:55 [PATCH 1/3] kbuild: Increase kallsyms max symbol length Andi Kleen

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.