[S390] s390: enforce HW limits for the initial sampling rate

On specific configurations with hwsampler opcontrol --start returns an
error on "echo 1 >/dev/oprofile/enable". Turns out that the hw sampling
interval is not checked against the hardware limits.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Christian Borntraeger 2011-06-22 16:24:08 +02:00 коммит произвёл Martin Schwidefsky
Родитель 80629b0b0f
Коммит b530ce7a1a
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -151,6 +151,12 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops)
if (oprofile_max_interval == 0) if (oprofile_max_interval == 0)
return -ENODEV; return -ENODEV;
/* The initial value should be sane */
if (oprofile_hw_interval < oprofile_min_interval)
oprofile_hw_interval = oprofile_min_interval;
if (oprofile_hw_interval > oprofile_max_interval)
oprofile_hw_interval = oprofile_max_interval;
if (oprofile_timer_init(ops)) if (oprofile_timer_init(ops))
return -ENODEV; return -ENODEV;