From df57458e4d8d86eee647a11f00ef7b2913a7f4a5 Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Thu, 31 Mar 2011 12:13:01 -0400 Subject: Simplify Nvidia registration. Cleaned up the interface to register nvidia devices. Removed reliance on use of pid since we always assumed pid was the calling thread (AKA 'current'). --- include/litmus.h | 12 +++++++----- src/syscalls.c | 9 +++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/litmus.h b/include/litmus.h index d45cbd0..035d1c3 100644 --- a/include/litmus.h +++ b/include/litmus.h @@ -66,7 +66,8 @@ int litmus_lock(int od); int litmus_unlock(int od); /* nvidia graphics cards */ -int register_nv_device(pid_t pid, int nv_device_id); +int register_nv_device(int nv_device_id); +int unregister_nv_device(int nv_device_id); /* job control*/ int get_job_no(unsigned int* job_no); @@ -124,16 +125,17 @@ static inline int open_fmlp_sem(int fd, int name) return od_open(fd, FMLP_SEM, name); } -static inline int open_srp_sem(int fd, int name) +static inline int open_kfmlp_sem(int fd, int name, void* arg) { - return od_open(fd, SRP_SEM, name); + return od_openx(fd, KFMLP_SEM, name, arg); } -static inline int open_kfmlp_sem(int fd, int name, void* arg) +static inline int open_srp_sem(int fd, int name) { - return od_openx(fd, KFMLP_SEM, name, arg); + return od_open(fd, SRP_SEM, name); } + /* syscall overhead measuring */ int null_call(cycles_t *timestamp); diff --git a/src/syscalls.c b/src/syscalls.c index b6f6c5c..b0fee23 100644 --- a/src/syscalls.c +++ b/src/syscalls.c @@ -89,7 +89,12 @@ int null_call(cycles_t *timestamp) return syscall(__NR_null_call, timestamp); } -int register_nv_device(pid_t pid, int nv_device_id) +int register_nv_device(int nv_device_id) { - return syscall(__NR_register_nv_device, pid, nv_device_id); + return syscall(__NR_register_nv_device, nv_device_id, 1); +} + +int unregister_nv_device(int nv_device_id) +{ + return syscall(__NR_register_nv_device, nv_device_id, 0); } -- cgit v1.2.2