aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-04-16 20:18:07 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2012-04-16 20:18:07 -0400
commit440aa2083245b81583980e3f4177f3b4cc805556 (patch)
treeff6b8a7101ba4c48c05b70f79bfe124412ad8c12
parent8675824ed85d6e83a24e77dabaf3a5c02c91ef6f (diff)
make gpu registration a little more robust
-rw-r--r--litmus/Kconfig1
-rw-r--r--litmus/nvidia_info.c9
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
298 298
299config LITMUS_NVIDIA 299config LITMUS_NVIDIA
300 bool "Litmus handling of NVIDIA interrupts." 300 bool "Litmus handling of NVIDIA interrupts."
301 depends on LITMUS_SOFTIRQD || LITMUS_PAI_SOFTIRQD
302 default n 301 default n
303 help 302 help
304 Direct tasklets from NVIDIA devices to Litmus's klitirqd 303 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)
426 struct task_struct *old_max = NULL; 426 struct task_struct *old_max = NULL;
427 unsigned long flags; 427 unsigned long flags;
428 nv_device_registry_t *reg = &NV_DEVICE_REG[reg_device_id]; 428 nv_device_registry_t *reg = &NV_DEVICE_REG[reg_device_id];
429 429
430 if(__test_bit(reg_device_id, &tsk_rt(t)->held_gpus)) {
431 // TODO: check if taks is already registered.
432 return ret; // assume already registered.
433 }
434
430 raw_spin_lock_irqsave(&reg->lock, flags); 435 raw_spin_lock_irqsave(&reg->lock, flags);
431 436
432 if(reg->nr_owners < MAX_NR_OWNERS) { 437 if(reg->nr_owners < MAX_NR_OWNERS) {
@@ -478,6 +483,8 @@ static int __clear_reg_nv_device(int de_reg_device_id)
478 struct task_struct* klitirqd_th = get_klitirqd(de_reg_device_id); 483 struct task_struct* klitirqd_th = get_klitirqd(de_reg_device_id);
479#endif 484#endif
480 485
486 WARN_ON(!__test_bit(de_reg_device_id, &tsk_rt(t)->held_gpus));
487
481 raw_spin_lock_irqsave(&reg->lock, flags); 488 raw_spin_lock_irqsave(&reg->lock, flags);
482 489
483 for(i = 0; i < reg->nr_owners; ++i) { 490 for(i = 0; i < reg->nr_owners; ++i) {