Skip to content

Commit

Permalink
Merge branches 'perf-fixes-for-linus', 'x86-fixes-for-linus' and 'tim…
Browse files Browse the repository at this point in the history
…ers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  perf timechart: Fix max number of cpus
  perf timechart: Fix black idle boxes in the title
  perf hists: Print number of samples, not the period sum

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: Use u32 instead of long to set reset vector back to 0

* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  clockevents: Prevent oneshot mode when broadcast device is periodic
  • Loading branch information
Linus Torvalds committed Mar 1, 2011
4 parents 58da94f + 54b08f5 + 299c569 + 3a142a0 commit 7f233de
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion arch/x86/include/asm/smpboot_hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static inline void smpboot_restore_warm_reset_vector(void)
*/
CMOS_WRITE(0, 0xf);

*((volatile long *)phys_to_virt(apic->trampoline_phys_low)) = 0;
*((volatile u32 *)phys_to_virt(apic->trampoline_phys_low)) = 0;
}

static inline void __init smpboot_setup_io_apic(void)
Expand Down
10 changes: 10 additions & 0 deletions kernel/time/tick-broadcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,4 +600,14 @@ int tick_broadcast_oneshot_active(void)
return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT;
}

/*
* Check whether the broadcast device supports oneshot.
*/
bool tick_broadcast_oneshot_available(void)
{
struct clock_event_device *bc = tick_broadcast_device.evtdev;

return bc ? bc->features & CLOCK_EVT_FEAT_ONESHOT : false;
}

#endif
6 changes: 5 additions & 1 deletion kernel/time/tick-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ int tick_is_oneshot_available(void)
{
struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev);

return dev && (dev->features & CLOCK_EVT_FEAT_ONESHOT);
if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT))
return 0;
if (!(dev->features & CLOCK_EVT_FEAT_C3STOP))
return 1;
return tick_broadcast_oneshot_available();
}

/*
Expand Down
3 changes: 3 additions & 0 deletions kernel/time/tick-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
extern int tick_broadcast_oneshot_active(void);
extern void tick_check_oneshot_broadcast(int cpu);
bool tick_broadcast_oneshot_available(void);
# else /* BROADCAST */
static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
{
Expand All @@ -46,6 +47,7 @@ static inline void tick_broadcast_switch_to_oneshot(void) { }
static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
static inline int tick_broadcast_oneshot_active(void) { return 0; }
static inline void tick_check_oneshot_broadcast(int cpu) { }
static inline bool tick_broadcast_oneshot_available(void) { return true; }
# endif /* !BROADCAST */

#else /* !ONESHOT */
Expand Down Expand Up @@ -76,6 +78,7 @@ static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
return 0;
}
static inline int tick_broadcast_oneshot_active(void) { return 0; }
static inline bool tick_broadcast_oneshot_available(void) { return false; }
#endif /* !TICK_ONESHOT */

/*
Expand Down
6 changes: 3 additions & 3 deletions tools/perf/builtin-timechart.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,6 @@ pid_put_sample(int pid, int type, unsigned int cpu, u64 start, u64 end)
c->start_time = start;
if (p->start_time == 0 || p->start_time > start)
p->start_time = start;

if (cpu > numcpus)
numcpus = cpu;
}

#define MAX_CPUS 4096
Expand Down Expand Up @@ -511,6 +508,9 @@ static int process_sample_event(event_t *event __used,
if (!event_str)
return 0;

if (sample->cpu > numcpus)
numcpus = sample->cpu;

if (strcmp(event_str, "power:cpu_idle") == 0) {
struct power_processor_entry *ppe = (void *)te;
if (ppe->state == (u32)PWR_EVENT_EXIT)
Expand Down
7 changes: 5 additions & 2 deletions tools/perf/util/hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,
{
struct sort_entry *se;
u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us;
u64 nr_events;
const char *sep = symbol_conf.field_sep;
int ret;

Expand All @@ -593,13 +594,15 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,

if (pair_hists) {
period = self->pair ? self->pair->period : 0;
nr_events = self->pair ? self->pair->nr_events : 0;
total = pair_hists->stats.total_period;
period_sys = self->pair ? self->pair->period_sys : 0;
period_us = self->pair ? self->pair->period_us : 0;
period_guest_sys = self->pair ? self->pair->period_guest_sys : 0;
period_guest_us = self->pair ? self->pair->period_guest_us : 0;
} else {
period = self->period;
nr_events = self->nr_events;
total = session_total;
period_sys = self->period_sys;
period_us = self->period_us;
Expand Down Expand Up @@ -640,9 +643,9 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,

if (symbol_conf.show_nr_samples) {
if (sep)
ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period);
ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events);
else
ret += snprintf(s + ret, size - ret, "%11" PRIu64, period);
ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events);
}

if (pair_hists) {
Expand Down
6 changes: 3 additions & 3 deletions tools/perf/util/svghelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,9 @@ void svg_legenda(void)
return;

svg_legenda_box(0, "Running", "sample");
svg_legenda_box(100, "Idle","rect.c1");
svg_legenda_box(200, "Deeper Idle", "rect.c3");
svg_legenda_box(350, "Deepest Idle", "rect.c6");
svg_legenda_box(100, "Idle","c1");
svg_legenda_box(200, "Deeper Idle", "c3");
svg_legenda_box(350, "Deepest Idle", "c6");
svg_legenda_box(550, "Sleeping", "process2");
svg_legenda_box(650, "Waiting for cpu", "waiting");
svg_legenda_box(800, "Blocked on IO", "blocked");
Expand Down

0 comments on commit 7f233de

Please sign in to comment.