mirror of
https://github.com/torvalds/linux.git
synced 2026-06-11 08:03:05 +02:00
Merge branch 'android-2.6.36' into android-tegra-2.6.36
This commit is contained in:
commit
ecf1cce25c
|
|
@ -44,6 +44,10 @@
|
|||
#include "fiq_debugger_ringbuf.h"
|
||||
|
||||
#define DEBUG_MAX 64
|
||||
#define MAX_UNHANDLED_FIQ_COUNT 1000000
|
||||
|
||||
#define THREAD_INFO(sp) ((struct thread_info *) \
|
||||
((unsigned long)(sp) & ~(THREAD_SIZE - 1)))
|
||||
|
||||
struct fiq_debugger_state {
|
||||
struct fiq_glue_handler handler;
|
||||
|
|
@ -70,6 +74,9 @@ struct fiq_debugger_state {
|
|||
bool uart_clk_enabled;
|
||||
struct wake_lock debugger_wake_lock;
|
||||
bool console_enable;
|
||||
int current_cpu;
|
||||
atomic_t unhandled_fiq_count;
|
||||
bool in_fiq;
|
||||
|
||||
#ifdef CONFIG_FIQ_DEBUGGER_CONSOLE
|
||||
struct console console;
|
||||
|
|
@ -388,8 +395,7 @@ void dump_stacktrace(struct fiq_debugger_state *state,
|
|||
struct pt_regs * const regs, unsigned int depth, void *ssp)
|
||||
{
|
||||
struct frame_tail *tail;
|
||||
struct thread_info *real_thread_info = (struct thread_info *)
|
||||
((unsigned long)ssp & ~(THREAD_SIZE - 1));
|
||||
struct thread_info *real_thread_info = THREAD_INFO(ssp);
|
||||
struct stacktrace_state sts;
|
||||
|
||||
sts.depth = depth;
|
||||
|
|
@ -449,6 +455,15 @@ static void debug_exec(struct fiq_debugger_state *state,
|
|||
} else if (!strcmp(cmd, "console")) {
|
||||
state->console_enable = true;
|
||||
debug_printf(state, "console mode\n");
|
||||
} else if (!strcmp(cmd, "cpu")) {
|
||||
debug_printf(state, "cpu %d\n", state->current_cpu);
|
||||
} else if (!strncmp(cmd, "cpu ", 4)) {
|
||||
unsigned long cpu = 0;
|
||||
if (strict_strtoul(cmd + 4, 10, &cpu) == 0)
|
||||
state->current_cpu = cpu;
|
||||
else
|
||||
debug_printf(state, "invalid cpu\n");
|
||||
debug_printf(state, "cpu %d\n", state->current_cpu);
|
||||
} else {
|
||||
if (state->debug_busy) {
|
||||
debug_printf(state,
|
||||
|
|
@ -552,6 +567,26 @@ static void debug_fiq(struct fiq_glue_handler *h, void *regs, void *svc_sp)
|
|||
int c;
|
||||
static int last_c;
|
||||
int count = 0;
|
||||
unsigned int this_cpu = THREAD_INFO(svc_sp)->cpu;
|
||||
|
||||
if (this_cpu != state->current_cpu) {
|
||||
if (state->in_fiq)
|
||||
return;
|
||||
|
||||
if (atomic_inc_return(&state->unhandled_fiq_count) !=
|
||||
MAX_UNHANDLED_FIQ_COUNT)
|
||||
return;
|
||||
|
||||
debug_printf(state, "fiq_debugger: cpu %d not responding, "
|
||||
"reverting to cpu %d\n", state->current_cpu,
|
||||
this_cpu);
|
||||
|
||||
atomic_set(&state->unhandled_fiq_count, 0);
|
||||
state->current_cpu = this_cpu;
|
||||
return;
|
||||
}
|
||||
|
||||
state->in_fiq = true;
|
||||
|
||||
while ((c = debug_getc(state)) != FIQ_DEBUGGER_NO_CHAR) {
|
||||
count++;
|
||||
|
|
@ -606,6 +641,9 @@ static void debug_fiq(struct fiq_glue_handler *h, void *regs, void *svc_sp)
|
|||
/* poke sleep timer if necessary */
|
||||
if (state->debug_enable && !state->no_sleep)
|
||||
debug_force_irq(state);
|
||||
|
||||
atomic_set(&state->unhandled_fiq_count, 0);
|
||||
state->in_fiq = false;
|
||||
}
|
||||
|
||||
static void debug_resume(struct fiq_glue_handler *h)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ extern void fiq_glue_setup(void *func, void *data, void *sp);
|
|||
static struct fiq_handler fiq_debbuger_fiq_handler = {
|
||||
.name = "fiq_glue",
|
||||
};
|
||||
static __percpu void *fiq_stack;
|
||||
DEFINE_PER_CPU(void *, fiq_stack);
|
||||
static struct fiq_glue_handler *current_handler;
|
||||
static DEFINE_MUTEX(fiq_glue_lock);
|
||||
|
||||
|
|
@ -31,12 +31,13 @@ static void fiq_glue_setup_helper(void *info)
|
|||
{
|
||||
struct fiq_glue_handler *handler = info;
|
||||
fiq_glue_setup(handler->fiq, handler,
|
||||
__this_cpu_ptr(fiq_stack) + THREAD_START_SP);
|
||||
__get_cpu_var(fiq_stack) + THREAD_START_SP);
|
||||
}
|
||||
|
||||
int fiq_glue_register_handler(struct fiq_glue_handler *handler)
|
||||
{
|
||||
int ret;
|
||||
int cpu;
|
||||
|
||||
if (!handler || !handler->fiq)
|
||||
return -EINVAL;
|
||||
|
|
@ -47,10 +48,14 @@ int fiq_glue_register_handler(struct fiq_glue_handler *handler)
|
|||
goto err_busy;
|
||||
}
|
||||
|
||||
fiq_stack = __alloc_percpu(THREAD_SIZE, L1_CACHE_BYTES);
|
||||
if (WARN_ON(!fiq_stack)) {
|
||||
ret = -ENOMEM;
|
||||
goto err_alloc_fiq_stack;
|
||||
for_each_possible_cpu(cpu) {
|
||||
void *stack;
|
||||
stack = (void *)__get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER);
|
||||
if (WARN_ON(!stack)) {
|
||||
ret = -ENOMEM;
|
||||
goto err_alloc_fiq_stack;
|
||||
}
|
||||
per_cpu(fiq_stack, cpu) = stack;
|
||||
}
|
||||
|
||||
ret = claim_fiq(&fiq_debbuger_fiq_handler);
|
||||
|
|
@ -61,12 +66,15 @@ int fiq_glue_register_handler(struct fiq_glue_handler *handler)
|
|||
on_each_cpu(fiq_glue_setup_helper, handler, true);
|
||||
set_fiq_handler(&fiq_glue, &fiq_glue_end - &fiq_glue);
|
||||
|
||||
mutex_unlock(&fiq_glue_lock);
|
||||
return 0;
|
||||
|
||||
err_claim_fiq:
|
||||
if (ret) {
|
||||
free_percpu(fiq_stack);
|
||||
fiq_stack = NULL;
|
||||
}
|
||||
err_alloc_fiq_stack:
|
||||
for_each_possible_cpu(cpu) {
|
||||
__free_pages(per_cpu(fiq_stack, cpu), THREAD_SIZE_ORDER);
|
||||
per_cpu(fiq_stack, cpu) = NULL;
|
||||
}
|
||||
err_busy:
|
||||
mutex_unlock(&fiq_glue_lock);
|
||||
return ret;
|
||||
|
|
@ -85,7 +93,7 @@ void fiq_glue_resume(void)
|
|||
if (!current_handler)
|
||||
return;
|
||||
fiq_glue_setup(current_handler->fiq, current_handler,
|
||||
__this_cpu_ptr(fiq_stack) + THREAD_START_SP);
|
||||
__get_cpu_var(fiq_stack) + THREAD_START_SP);
|
||||
if (current_handler->resume)
|
||||
current_handler->resume(current_handler);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,8 @@ int mmc_add_host(struct mmc_host *host)
|
|||
#endif
|
||||
|
||||
mmc_start_host(host);
|
||||
register_pm_notifier(&host->pm_notify);
|
||||
if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY))
|
||||
register_pm_notifier(&host->pm_notify);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -154,7 +155,9 @@ EXPORT_SYMBOL(mmc_add_host);
|
|||
*/
|
||||
void mmc_remove_host(struct mmc_host *host)
|
||||
{
|
||||
unregister_pm_notifier(&host->pm_notify);
|
||||
if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY))
|
||||
unregister_pm_notifier(&host->pm_notify);
|
||||
|
||||
mmc_stop_host(host);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
|
|
|||
|
|
@ -77,9 +77,6 @@
|
|||
/* Maximum number of nesting allowed inside epoll sets */
|
||||
#define EP_MAX_NESTS 4
|
||||
|
||||
/* Maximum msec timeout value storeable in a long int */
|
||||
#define EP_MAX_MSTIMEO min(1000ULL * MAX_SCHEDULE_TIMEOUT / HZ, (LONG_MAX - 999ULL) / HZ)
|
||||
|
||||
#define EP_MAX_EVENTS (INT_MAX / sizeof(struct epoll_event))
|
||||
|
||||
#define EP_UNACTIVE_PTR ((void *) -1L)
|
||||
|
|
@ -1116,18 +1113,22 @@ static int ep_send_events(struct eventpoll *ep,
|
|||
static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
|
||||
int maxevents, long timeout)
|
||||
{
|
||||
int res, eavail;
|
||||
int res, eavail, timed_out = 0;
|
||||
unsigned long flags;
|
||||
long jtimeout;
|
||||
long slack;
|
||||
wait_queue_t wait;
|
||||
struct timespec end_time;
|
||||
ktime_t expires, *to = NULL;
|
||||
|
||||
/*
|
||||
* Calculate the timeout by checking for the "infinite" value (-1)
|
||||
* and the overflow condition. The passed timeout is in milliseconds,
|
||||
* that why (t * HZ) / 1000.
|
||||
*/
|
||||
jtimeout = (timeout < 0 || timeout >= EP_MAX_MSTIMEO) ?
|
||||
MAX_SCHEDULE_TIMEOUT : (timeout * HZ + 999) / 1000;
|
||||
if (timeout > 0) {
|
||||
ktime_get_ts(&end_time);
|
||||
timespec_add_ns(&end_time, (u64)timeout * NSEC_PER_MSEC);
|
||||
slack = select_estimate_accuracy(&end_time);
|
||||
to = &expires;
|
||||
*to = timespec_to_ktime(end_time);
|
||||
} else if (timeout == 0) {
|
||||
timed_out = 1;
|
||||
}
|
||||
|
||||
retry:
|
||||
spin_lock_irqsave(&ep->lock, flags);
|
||||
|
|
@ -1149,7 +1150,7 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
|
|||
* to TASK_INTERRUPTIBLE before doing the checks.
|
||||
*/
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
if (!list_empty(&ep->rdllist) || !jtimeout)
|
||||
if (!list_empty(&ep->rdllist) || timed_out)
|
||||
break;
|
||||
if (signal_pending(current)) {
|
||||
res = -EINTR;
|
||||
|
|
@ -1157,7 +1158,9 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
|
|||
}
|
||||
|
||||
spin_unlock_irqrestore(&ep->lock, flags);
|
||||
jtimeout = schedule_timeout(jtimeout);
|
||||
if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS))
|
||||
timed_out = 1;
|
||||
|
||||
spin_lock_irqsave(&ep->lock, flags);
|
||||
}
|
||||
__remove_wait_queue(&ep->wq, &wait);
|
||||
|
|
@ -1175,7 +1178,7 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
|
|||
* more luck.
|
||||
*/
|
||||
if (!res && eavail &&
|
||||
!(res = ep_send_events(ep, events, maxevents)) && jtimeout)
|
||||
!(res = ep_send_events(ep, events, maxevents)) && !timed_out)
|
||||
goto retry;
|
||||
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static long __estimate_accuracy(struct timespec *tv)
|
|||
return slack;
|
||||
}
|
||||
|
||||
static long estimate_accuracy(struct timespec *tv)
|
||||
long select_estimate_accuracy(struct timespec *tv)
|
||||
{
|
||||
unsigned long ret;
|
||||
struct timespec now;
|
||||
|
|
@ -417,7 +417,7 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
|
|||
}
|
||||
|
||||
if (end_time && !timed_out)
|
||||
slack = estimate_accuracy(end_time);
|
||||
slack = select_estimate_accuracy(end_time);
|
||||
|
||||
retval = 0;
|
||||
for (;;) {
|
||||
|
|
@ -769,7 +769,7 @@ static int do_poll(unsigned int nfds, struct poll_list *list,
|
|||
}
|
||||
|
||||
if (end_time && !timed_out)
|
||||
slack = estimate_accuracy(end_time);
|
||||
slack = select_estimate_accuracy(end_time);
|
||||
|
||||
for (;;) {
|
||||
struct poll_list *walk;
|
||||
|
|
|
|||
|
|
@ -26,5 +26,6 @@ typedef unsigned int mmc_pm_flag_t;
|
|||
|
||||
#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */
|
||||
#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */
|
||||
#define MMC_PM_IGNORE_PM_NOTIFY (1 << 2) /* ignore mmc pm notify */
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ extern void poll_initwait(struct poll_wqueues *pwq);
|
|||
extern void poll_freewait(struct poll_wqueues *pwq);
|
||||
extern int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
|
||||
ktime_t *expires, unsigned long slack);
|
||||
extern long select_estimate_accuracy(struct timespec *tv);
|
||||
|
||||
|
||||
static inline int poll_schedule(struct poll_wqueues *pwq, int state)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user