Re: [PATCH 3/5] cpumask: convert misc driver functions

From: Mike Travis
Date: Fri Jan 16 2009 - 17:02:35 EST


Tony Luck wrote:
> +void __exit buffer_sync_cleanup(void)
> +{
> + free_cpumask_var(marked_cpus);
> +}
>
> This breaks ia64 with CONFIG_OPROFILE=y
>
> `buffer_sync_cleanup' referenced in section `.init.text' of
> arch/ia64/oprofile/built-in.o: defined in discarded section
> `.exit.text' of arch/ia64/oprofile/built-in.o
> make: *** [.tmp_vmlinux1] Error 1
>
> -Tony

Hi,

It's a bit hackish but I couldn't think of another workaround.
And curiously, it doesn't affect x86?

Also, CPUMASK_OFFSTACK=n for ia64 so this is really a nop.
(I haven't been able to turn it on for ia64.)

Thanks,
Mike
---

Subject: ia64: fix build error when OPROFILE enabled.

Impact: Fix build error.

Add a buffer_sync_cleanup_init() which duplicates the
buffer_sync_cleanup() function but is placed in the
.init.text section. This eliminates this build error:

`buffer_sync_cleanup' referenced in section `.init.text' of
arch/ia64/oprofile/built-in.o: defined in discarded section
`.exit.text' of arch/ia64/oprofile/built-in.o

Signed-off-by: Mike Travis <travis@xxxxxxx>
Cc: Tony Luck <tony.luck@xxxxxxxxx>
Cc: Robert Richter <robert.richter@xxxxxxx>
Cc: <oprofile-list@xxxxxxxxxxxx>
---
drivers/oprofile/buffer_sync.c | 6 ++++++
drivers/oprofile/buffer_sync.h | 1 +
drivers/oprofile/oprof.c | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)

--- linux-2.6-for-ingo.orig/drivers/oprofile/buffer_sync.c
+++ linux-2.6-for-ingo/drivers/oprofile/buffer_sync.c
@@ -579,6 +579,12 @@ void __exit buffer_sync_cleanup(void)
free_cpumask_var(marked_cpus);
}

+/* same as above but in the __init section */
+void __init buffer_sync_cleanup_init(void)
+{
+ free_cpumask_var(marked_cpus);
+}
+
/* The function can be used to add a buffer worth of data directly to
* the kernel buffer. The buffer is assumed to be a circular buffer.
* Take the entries from index start and end at index end, wrapping
--- linux-2.6-for-ingo.orig/drivers/oprofile/buffer_sync.h
+++ linux-2.6-for-ingo/drivers/oprofile/buffer_sync.h
@@ -22,5 +22,6 @@ void sync_buffer(int cpu);
/* initialize/destroy the buffer system. */
int buffer_sync_init(void);
void buffer_sync_cleanup(void);
+void buffer_sync_cleanup_init(void);

#endif /* OPROFILE_BUFFER_SYNC_H */
--- linux-2.6-for-ingo.orig/drivers/oprofile/oprof.c
+++ linux-2.6-for-ingo/drivers/oprofile/oprof.c
@@ -197,7 +197,7 @@ static int __init oprofile_init(void)
err = oprofilefs_register();
if (err) {
oprofile_arch_exit();
- buffer_sync_cleanup();
+ buffer_sync_cleanup_init();
}

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