From 440aa2083245b81583980e3f4177f3b4cc805556 Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Mon, 16 Apr 2012 20:18:07 -0400 Subject: make gpu registration a little more robust --- litmus/Kconfig | 1 - litmus/nvidia_info.c | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/litmus/Kconfig b/litmus/Kconfig index 263c3ee49c15..34ce6fb3a22e 100644 --- a/litmus/Kconfig +++ b/litmus/Kconfig @@ -298,7 +298,6 @@ config NR_LITMUS_SOFTIRQD config LITMUS_NVIDIA bool "Litmus handling of NVIDIA interrupts." - depends on LITMUS_SOFTIRQD || LITMUS_PAI_SOFTIRQD default n help Direct tasklets from NVIDIA devices to Litmus's klitirqd diff --git a/litmus/nvidia_info.c b/litmus/nvidia_info.c index 66181515186a..80900035881c 100644 --- a/litmus/nvidia_info.c +++ b/litmus/nvidia_info.c @@ -426,7 +426,12 @@ static int __reg_nv_device(int reg_device_id) struct task_struct *old_max = NULL; unsigned long flags; nv_device_registry_t *reg = &NV_DEVICE_REG[reg_device_id]; - + + if(__test_bit(reg_device_id, &tsk_rt(t)->held_gpus)) { + // TODO: check if taks is already registered. + return ret; // assume already registered. + } + raw_spin_lock_irqsave(®->lock, flags); if(reg->nr_owners < MAX_NR_OWNERS) { @@ -478,6 +483,8 @@ static int __clear_reg_nv_device(int de_reg_device_id) struct task_struct* klitirqd_th = get_klitirqd(de_reg_device_id); #endif + WARN_ON(!__test_bit(de_reg_device_id, &tsk_rt(t)->held_gpus)); + raw_spin_lock_irqsave(®->lock, flags); for(i = 0; i < reg->nr_owners; ++i) { -- cgit v1.2.2