2008-10-15 18:09:57

by Chris J Arges

[permalink] [raw]
Subject: [PATCH] oprofile: hotplug cpu fix

This patch addresses crashes when hotplugging cpus while profiling.
I used the following script to test :

#!/bin/bash
startup()
{
opcontrol --init
opcontrol --vmlinux=/boot/vmlinux
opcontrol --reset
opcontrol --start
opcontrol --dump
}
shutdown()
{
opcontrol --dump
opcontrol -h
}
startup
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu1/online
shutdown
startup
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu1/online
shutdown
startup
echo 0 > /sys/devices/system/cpu/cpu2/online
shutdown
startup
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu2/online
shutdown
echo 1 > /sys/devices/system/cpu/cpu2/online

Without the patch on my Power machine (ppc970mp) I get the following error:

Vector: 300 (Data Access) at [c000000276143950]
pc: d0000000000366e8: .add_event_entry+0x60/0xb0 [oprofile]
lr: d000000000035e60: .sync_buffer+0x68/0x4ac [oprofile]

Without the patch on my x86 (Core 2 Duo) machine:

mutex_lock +0x8/0x20
sync_buffer +0x29/0x3e0
wq_sync_buffer +0x0/0x70

Since I'm guessing hotplugging cpus and using oprofile is not a common
occurrence, this patch is just a do-no-harm fix, instead
of a full solution with a hotplug callback, etc.

Thanks,
--chris


Attachments:
0001-oprofile-hotplug-cpu-fix.patch (1.67 kB)

Subject: Re: [PATCH] oprofile: hotplug cpu fix

On 15.10.08 12:09:45, Chris J Arges wrote:
> From 60f07301d3c387a0405becccbdc0cfb7e99ecf39 Mon Sep 17 00:00:00 2001
> From: Chris J Arges <[email protected]>
> Date: Wed, 15 Oct 2008 11:03:39 -0500
> Subject: [PATCH] oprofile: hotplug cpu fix
> This patch addresses problems when hotplugging cpus while profiling.
> Instead of allocating only online cpus, all possible cpu buffers are
> allocated, which allows cpus to be onlined during operation. If a cpu is
> offlined before profiling is shutdown wq_sync_buffer checks for this
> condition then cancels this work and does not sync this buffer.
>

Applied to oprofile/oprofile-for-tip. Thanks, Chris.

-Robert

--
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]