mirror of
https://github.com/torvalds/linux.git
synced 2024-12-22 10:56:40 +00:00
e2741f1758
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0
("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/s390 uses of the __cpuinit macros from
all C files. Currently s390 does not have any __CPUINIT used in
assembly files.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
98 lines
2.2 KiB
C
98 lines
2.2 KiB
C
/*
|
|
* Copyright IBM Corp. 2008
|
|
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
|
|
*/
|
|
|
|
#define KMSG_COMPONENT "cpu"
|
|
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/seq_file.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/cpu.h>
|
|
#include <asm/elf.h>
|
|
#include <asm/lowcore.h>
|
|
#include <asm/param.h>
|
|
|
|
static DEFINE_PER_CPU(struct cpuid, cpu_id);
|
|
|
|
/*
|
|
* cpu_init - initializes state that is per-CPU.
|
|
*/
|
|
void cpu_init(void)
|
|
{
|
|
struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
|
|
struct cpuid *id = &__get_cpu_var(cpu_id);
|
|
|
|
get_cpu_id(id);
|
|
atomic_inc(&init_mm.mm_count);
|
|
current->active_mm = &init_mm;
|
|
BUG_ON(current->mm);
|
|
enter_lazy_tlb(&init_mm, current);
|
|
memset(idle, 0, sizeof(*idle));
|
|
}
|
|
|
|
/*
|
|
* show_cpuinfo - Get information on one CPU for use by procfs.
|
|
*/
|
|
static int show_cpuinfo(struct seq_file *m, void *v)
|
|
{
|
|
static const char *hwcap_str[] = {
|
|
"esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
|
|
"edat", "etf3eh", "highgprs", "te"
|
|
};
|
|
unsigned long n = (unsigned long) v - 1;
|
|
int i;
|
|
|
|
if (!n) {
|
|
s390_adjust_jiffies();
|
|
seq_printf(m, "vendor_id : IBM/S390\n"
|
|
"# processors : %i\n"
|
|
"bogomips per cpu: %lu.%02lu\n",
|
|
num_online_cpus(), loops_per_jiffy/(500000/HZ),
|
|
(loops_per_jiffy/(5000/HZ))%100);
|
|
seq_puts(m, "features\t: ");
|
|
for (i = 0; i < ARRAY_SIZE(hwcap_str); i++)
|
|
if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
|
|
seq_printf(m, "%s ", hwcap_str[i]);
|
|
seq_puts(m, "\n");
|
|
show_cacheinfo(m);
|
|
}
|
|
get_online_cpus();
|
|
if (cpu_online(n)) {
|
|
struct cpuid *id = &per_cpu(cpu_id, n);
|
|
seq_printf(m, "processor %li: "
|
|
"version = %02X, "
|
|
"identification = %06X, "
|
|
"machine = %04X\n",
|
|
n, id->version, id->ident, id->machine);
|
|
}
|
|
put_online_cpus();
|
|
return 0;
|
|
}
|
|
|
|
static void *c_start(struct seq_file *m, loff_t *pos)
|
|
{
|
|
return *pos < nr_cpu_ids ? (void *)((unsigned long) *pos + 1) : NULL;
|
|
}
|
|
|
|
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
|
|
{
|
|
++*pos;
|
|
return c_start(m, pos);
|
|
}
|
|
|
|
static void c_stop(struct seq_file *m, void *v)
|
|
{
|
|
}
|
|
|
|
const struct seq_operations cpuinfo_op = {
|
|
.start = c_start,
|
|
.next = c_next,
|
|
.stop = c_stop,
|
|
.show = show_cpuinfo,
|
|
};
|
|
|