mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 22:51:35 +00:00
18f894c145
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/tile uses of the __cpuinit macros from
all C files. Currently tile does not have any __CPUINIT used in
assembly files.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
117 lines
3.1 KiB
C
117 lines
3.1 KiB
C
/*
|
|
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation, version 2.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
|
* NON INFRINGEMENT. See the GNU General Public License for
|
|
* more details.
|
|
*/
|
|
|
|
#include <linux/percpu.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/hardirq.h>
|
|
#include <linux/ptrace.h>
|
|
#include <asm/hv_driver.h>
|
|
#include <asm/irq_regs.h>
|
|
#include <asm/traps.h>
|
|
#include <hv/hypervisor.h>
|
|
#include <arch/interrupts.h>
|
|
|
|
/* All messages are stored here */
|
|
static DEFINE_PER_CPU(HV_MsgState, msg_state);
|
|
|
|
void init_messaging(void)
|
|
{
|
|
/* Allocate storage for messages in kernel space */
|
|
HV_MsgState *state = &__get_cpu_var(msg_state);
|
|
int rc = hv_register_message_state(state);
|
|
if (rc != HV_OK)
|
|
panic("hv_register_message_state: error %d", rc);
|
|
|
|
/* Make sure downcall interrupts will be enabled. */
|
|
arch_local_irq_unmask(INT_INTCTRL_K);
|
|
}
|
|
|
|
void hv_message_intr(struct pt_regs *regs, int intnum)
|
|
{
|
|
/*
|
|
* We enter with interrupts disabled and leave them disabled,
|
|
* to match expectations of called functions (e.g.
|
|
* do_ccupdate_local() in mm/slab.c). This is also consistent
|
|
* with normal call entry for device interrupts.
|
|
*/
|
|
|
|
int message[HV_MAX_MESSAGE_SIZE/sizeof(int)];
|
|
HV_RcvMsgInfo rmi;
|
|
int nmsgs = 0;
|
|
|
|
/* Track time spent here in an interrupt context */
|
|
struct pt_regs *old_regs = set_irq_regs(regs);
|
|
irq_enter();
|
|
|
|
#ifdef CONFIG_DEBUG_STACKOVERFLOW
|
|
/* Debugging check for stack overflow: less than 1/8th stack free? */
|
|
{
|
|
long sp = stack_pointer - (long) current_thread_info();
|
|
if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) {
|
|
pr_emerg("hv_message_intr: "
|
|
"stack overflow: %ld\n",
|
|
sp - sizeof(struct thread_info));
|
|
dump_stack();
|
|
}
|
|
}
|
|
#endif
|
|
|
|
while (1) {
|
|
rmi = hv_receive_message(__get_cpu_var(msg_state),
|
|
(HV_VirtAddr) message,
|
|
sizeof(message));
|
|
if (rmi.msglen == 0)
|
|
break;
|
|
|
|
if (rmi.msglen < 0)
|
|
panic("hv_receive_message failed: %d", rmi.msglen);
|
|
|
|
++nmsgs;
|
|
|
|
if (rmi.source == HV_MSG_TILE) {
|
|
int tag;
|
|
|
|
/* we just send tags for now */
|
|
BUG_ON(rmi.msglen != sizeof(int));
|
|
|
|
tag = message[0];
|
|
#ifdef CONFIG_SMP
|
|
evaluate_message(message[0]);
|
|
#else
|
|
panic("Received IPI message %d in UP mode", tag);
|
|
#endif
|
|
} else if (rmi.source == HV_MSG_INTR) {
|
|
HV_IntrMsg *him = (HV_IntrMsg *)message;
|
|
struct hv_driver_cb *cb =
|
|
(struct hv_driver_cb *)him->intarg;
|
|
cb->callback(cb, him->intdata);
|
|
__get_cpu_var(irq_stat).irq_hv_msg_count++;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* We shouldn't have gotten a message downcall with no
|
|
* messages available.
|
|
*/
|
|
if (nmsgs == 0)
|
|
panic("Message downcall invoked with no messages!");
|
|
|
|
/*
|
|
* Track time spent against the current process again and
|
|
* process any softirqs if they are waiting.
|
|
*/
|
|
irq_exit();
|
|
set_irq_regs(old_regs);
|
|
}
|