Skip to content

Commit

Permalink
Merge branch 'linus'
Browse files Browse the repository at this point in the history
Merge in the relevant upstream merge point to queue up dependent patch.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Sep 26, 2013
2 parents 16c21ae + 654fdd0 commit 474a83b
Show file tree
Hide file tree
Showing 29 changed files with 196 additions and 62 deletions.
3 changes: 1 addition & 2 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -2808,8 +2808,7 @@ S: Ottawa, Ontario
S: Canada K2P 0X8

N: Mikael Pettersson
E: mikpe@it.uu.se
W: http://user.it.uu.se/~mikpe/linux/
E: mikpelinux@gmail.com
D: Miscellaneous fixes

N: Reed H. Petty
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6596,7 +6596,7 @@ S: Obsolete
F: drivers/net/wireless/prism54/

PROMISE SATA TX2/TX4 CONTROLLER LIBATA DRIVER
M: Mikael Pettersson <mikpe@it.uu.se>
M: Mikael Pettersson <mikpelinux@gmail.com>
L: linux-ide@vger.kernel.org
S: Maintained
F: drivers/ata/sata_promise.*
Expand Down
10 changes: 5 additions & 5 deletions arch/x86/kernel/cpu/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1883,9 +1883,9 @@ static struct pmu pmu = {

void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
{
userpg->cap_usr_time = 0;
userpg->cap_usr_time_zero = 0;
userpg->cap_usr_rdpmc = x86_pmu.attr_rdpmc;
userpg->cap_user_time = 0;
userpg->cap_user_time_zero = 0;
userpg->cap_user_rdpmc = x86_pmu.attr_rdpmc;
userpg->pmc_width = x86_pmu.cntval_bits;

if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC))
Expand All @@ -1894,13 +1894,13 @@ void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
return;

userpg->cap_usr_time = 1;
userpg->cap_user_time = 1;
userpg->time_mult = this_cpu_read(cyc2ns);
userpg->time_shift = CYC2NS_SCALE_FACTOR;
userpg->time_offset = this_cpu_read(cyc2ns_offset) - now;

if (sched_clock_stable && !check_tsc_disabled()) {
userpg->cap_usr_time_zero = 1;
userpg->cap_user_time_zero = 1;
userpg->time_zero = this_cpu_read(cyc2ns_offset);
}
}
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/cpu/perf_event_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2325,6 +2325,7 @@ __init int intel_pmu_init(void)
break;

case 55: /* Atom 22nm "Silvermont" */
case 77: /* Avoton "Silvermont" */
memcpy(hw_cache_event_ids, slm_hw_cache_event_ids,
sizeof(hw_cache_event_ids));
memcpy(hw_cache_extra_regs, slm_hw_cache_extra_regs,
Expand Down
10 changes: 5 additions & 5 deletions arch/x86/kernel/cpu/perf_event_intel_uncore.c
Original file line number Diff line number Diff line change
Expand Up @@ -2706,14 +2706,14 @@ static void uncore_pmu_init_hrtimer(struct intel_uncore_box *box)
box->hrtimer.function = uncore_pmu_hrtimer;
}

struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, int cpu)
static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, int node)
{
struct intel_uncore_box *box;
int i, size;

size = sizeof(*box) + type->num_shared_regs * sizeof(struct intel_uncore_extra_reg);

box = kzalloc_node(size, GFP_KERNEL, cpu_to_node(cpu));
box = kzalloc_node(size, GFP_KERNEL, node);
if (!box)
return NULL;

Expand Down Expand Up @@ -3031,7 +3031,7 @@ static int uncore_validate_group(struct intel_uncore_pmu *pmu,
struct intel_uncore_box *fake_box;
int ret = -EINVAL, n;

fake_box = uncore_alloc_box(pmu->type, smp_processor_id());
fake_box = uncore_alloc_box(pmu->type, NUMA_NO_NODE);
if (!fake_box)
return -ENOMEM;

Expand Down Expand Up @@ -3294,7 +3294,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id
}

type = pci_uncores[UNCORE_PCI_DEV_TYPE(id->driver_data)];
box = uncore_alloc_box(type, 0);
box = uncore_alloc_box(type, NUMA_NO_NODE);
if (!box)
return -ENOMEM;

Expand Down Expand Up @@ -3499,7 +3499,7 @@ static int uncore_cpu_prepare(int cpu, int phys_id)
if (pmu->func_id < 0)
pmu->func_id = j;

box = uncore_alloc_box(type, cpu);
box = uncore_alloc_box(type, cpu_to_node(cpu));
if (!box)
return -ENOMEM;

Expand Down
18 changes: 17 additions & 1 deletion arch/x86/kernel/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,28 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
},
{ /* Handle problems with rebooting on the Precision M6600. */
.callback = set_pci_reboot,
.ident = "Dell OptiPlex 990",
.ident = "Dell Precision M6600",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Precision M6600"),
},
},
{ /* Handle problems with rebooting on the Dell PowerEdge C6100. */
.callback = set_pci_reboot,
.ident = "Dell PowerEdge C6100",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "C6100"),
},
},
{ /* Some C6100 machines were shipped with vendor being 'Dell'. */
.callback = set_pci_reboot,
.ident = "Dell PowerEdge C6100",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
DMI_MATCH(DMI_PRODUCT_NAME, "C6100"),
},
},
{ }
};

Expand Down
11 changes: 7 additions & 4 deletions arch/x86/platform/efi/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,10 +912,13 @@ void __init efi_enter_virtual_mode(void)

for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
md = p;
if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
md->type != EFI_BOOT_SERVICES_CODE &&
md->type != EFI_BOOT_SERVICES_DATA)
continue;
if (!(md->attribute & EFI_MEMORY_RUNTIME)) {
#ifdef CONFIG_X86_64
if (md->type != EFI_BOOT_SERVICES_CODE &&
md->type != EFI_BOOT_SERVICES_DATA)
#endif
continue;
}

size = md->num_pages << EFI_PAGE_SHIFT;
end = md->phys_addr + size;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/sata_promise.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* sata_promise.c - Promise SATA
*
* Maintained by: Tejun Heo <tj@kernel.org>
* Mikael Pettersson <mikpe@it.uu.se>
* Mikael Pettersson
* Please ALWAYS copy linux-ide@vger.kernel.org
* on emails.
*
Expand Down
15 changes: 10 additions & 5 deletions include/uapi/linux/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,13 @@ struct perf_event_mmap_page {
union {
__u64 capabilities;
struct {
__u64 cap_usr_time : 1,
cap_usr_rdpmc : 1,
cap_usr_time_zero : 1,
cap_____res : 61;
__u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */
cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */

cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */
cap_user_time : 1, /* The time_* fields are used */
cap_user_time_zero : 1, /* The time_zero field is used */
cap_____res : 59;
};
};

Expand Down Expand Up @@ -442,12 +445,13 @@ struct perf_event_mmap_page {
* ((rem * time_mult) >> time_shift);
*/
__u64 time_zero;
__u32 size; /* Header size up to __reserved[] fields. */

/*
* Hole for extension of the self monitor capabilities
*/

__u64 __reserved[119]; /* align to 1k */
__u8 __reserved[118*8+4]; /* align to 1k. */

/*
* Control data for the mmap() data buffer.
Expand Down Expand Up @@ -528,6 +532,7 @@ enum perf_event_type {
* u64 len;
* u64 pgoff;
* char filename[];
* struct sample_id sample_id;
* };
*/
PERF_RECORD_MMAP = 1,
Expand Down
21 changes: 21 additions & 0 deletions kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3660,6 +3660,26 @@ static void calc_timer_values(struct perf_event *event,
*running = ctx_time - event->tstamp_running;
}

static void perf_event_init_userpage(struct perf_event *event)
{
struct perf_event_mmap_page *userpg;
struct ring_buffer *rb;

rcu_read_lock();
rb = rcu_dereference(event->rb);
if (!rb)
goto unlock;

userpg = rb->user_page;

/* Allow new userspace to detect that bit 0 is deprecated */
userpg->cap_bit0_is_deprecated = 1;
userpg->size = offsetof(struct perf_event_mmap_page, __reserved);

unlock:
rcu_read_unlock();
}

void __weak arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
{
}
Expand Down Expand Up @@ -4044,6 +4064,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
ring_buffer_attach(event, rb);
rcu_assign_pointer(event->rb, rb);

perf_event_init_userpage(event);
perf_event_update_userpage(event);

unlock:
Expand Down
9 changes: 5 additions & 4 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -4242,7 +4242,7 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq)
}

if (!se) {
cfs_rq->h_load = rq->avg.load_avg_contrib;
cfs_rq->h_load = cfs_rq->runnable_load_avg;
cfs_rq->last_h_load_update = now;
}

Expand Down Expand Up @@ -4823,8 +4823,8 @@ void fix_small_imbalance(struct lb_env *env, struct sd_lb_stats *sds)
(busiest->load_per_task * SCHED_POWER_SCALE) /
busiest->group_power;

if (busiest->avg_load - local->avg_load + scaled_busy_load_per_task >=
(scaled_busy_load_per_task * imbn)) {
if (busiest->avg_load + scaled_busy_load_per_task >=
local->avg_load + (scaled_busy_load_per_task * imbn)) {
env->imbalance = busiest->load_per_task;
return;
}
Expand Down Expand Up @@ -4896,7 +4896,8 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
* max load less than avg load(as we skip the groups at or below
* its cpu_power, while calculating max_load..)
*/
if (busiest->avg_load < sds->avg_load) {
if (busiest->avg_load <= sds->avg_load ||
local->avg_load >= sds->avg_load) {
env->imbalance = 0;
return fix_small_imbalance(env, sds);
}
Expand Down
1 change: 0 additions & 1 deletion tools/lib/lk/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <stdbool.h>
#include <sys/vfs.h>
#include <sys/mount.h>
#include <linux/magic.h>
#include <linux/kernel.h>

#include "debugfs.h"
Expand Down
6 changes: 3 additions & 3 deletions tools/perf/arch/x86/util/tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ u64 tsc_to_perf_time(u64 cyc, struct perf_tsc_conversion *tc)
int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
struct perf_tsc_conversion *tc)
{
bool cap_usr_time_zero;
bool cap_user_time_zero;
u32 seq;
int i = 0;

Expand All @@ -42,7 +42,7 @@ int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
tc->time_mult = pc->time_mult;
tc->time_shift = pc->time_shift;
tc->time_zero = pc->time_zero;
cap_usr_time_zero = pc->cap_usr_time_zero;
cap_user_time_zero = pc->cap_user_time_zero;
rmb();
if (pc->lock == seq && !(seq & 1))
break;
Expand All @@ -52,7 +52,7 @@ int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
}
}

if (!cap_usr_time_zero)
if (!cap_user_time_zero)
return -EOPNOTSUPP;

return 0;
Expand Down
2 changes: 0 additions & 2 deletions tools/perf/builtin-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,6 @@ static int perf_inject__sched_stat(struct perf_tool *tool,
return perf_event__repipe(tool, event_sw, &sample_sw, machine);
}

extern volatile int session_done;

static void sig_handler(int sig __maybe_unused)
{
session_done = 1;
Expand Down
5 changes: 3 additions & 2 deletions tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,6 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
return 0;
}

extern volatile int session_done;

static void sig_handler(int sig __maybe_unused)
{
session_done = 1;
Expand Down Expand Up @@ -568,6 +566,9 @@ static int __cmd_report(struct perf_report *rep)
}
}

if (session_done())
return 0;

if (nr_samples == 0) {
ui__error("The %s file has no samples!\n", session->filename);
return 0;
Expand Down
2 changes: 0 additions & 2 deletions tools/perf/builtin-script.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,6 @@ static struct perf_tool perf_script = {
.ordering_requires_timestamps = true,
};

extern volatile int session_done;

static void sig_handler(int sig __maybe_unused)
{
session_done = 1;
Expand Down
17 changes: 17 additions & 0 deletions tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@
#include <sys/mman.h>
#include <linux/futex.h>

/* For older distros: */
#ifndef MAP_STACK
# define MAP_STACK 0x20000
#endif

#ifndef MADV_HWPOISON
# define MADV_HWPOISON 100
#endif

#ifndef MADV_MERGEABLE
# define MADV_MERGEABLE 12
#endif

#ifndef MADV_UNMERGEABLE
# define MADV_UNMERGEABLE 13
#endif

static size_t syscall_arg__scnprintf_hex(char *bf, size_t size,
unsigned long arg,
u8 arg_idx __maybe_unused,
Expand Down
3 changes: 3 additions & 0 deletions tools/perf/config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
CFLAGS += -DLIBELF_MMAP
endif
ifeq ($(call try-cc,$(SOURCE_ELF_GETPHDRNUM),$(FLAGS_LIBELF),-DHAVE_ELF_GETPHDRNUM),y)
CFLAGS += -DHAVE_ELF_GETPHDRNUM
endif

# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile
Expand Down
10 changes: 10 additions & 0 deletions tools/perf/config/feature-tests.mak
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ int main(void)
}
endef

define SOURCE_ELF_GETPHDRNUM
#include <libelf.h>
int main(void)
{
size_t dst;
return elf_getphdrnum(0, &dst);
}
endef

ifndef NO_SLANG
define SOURCE_SLANG
#include <slang.h>
Expand Down Expand Up @@ -210,6 +219,7 @@ define SOURCE_LIBAUDIT

int main(void)
{
printf(\"error message: %s\n\", audit_errno_to_name(0));
return audit_open();
}
endef
Expand Down
Loading

0 comments on commit 474a83b

Please sign in to comment.