From 0f8f88ca466b0e3b8045a19f54bfd685ed4f451b Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Thu, 21 Sep 2017 12:49:28 +0900 Subject: [PATCH] hfi1/user_exp_rcv/invalid: Remove function user_exp_rcv_invalid is only used together with the mmu cache (its purpose is the delayed freeing of tids that were invalidated in cache) Since we do not use that cache, the function can go --- kernel/file_ops.c | 15 +++---------- kernel/user_exp_rcv.c | 52 ------------------------------------------- 2 files changed, 3 insertions(+), 64 deletions(-) diff --git a/kernel/file_ops.c b/kernel/file_ops.c index 96510492..c02cadc9 100644 --- a/kernel/file_ops.c +++ b/kernel/file_ops.c @@ -516,18 +516,9 @@ long hfi1_file_ioctl(void *private_data, unsigned int cmd, case HFI1_IOCTL_TID_INVAL_READ: kprintf("%s: HFI1_IOCTL_TID_INVAL_READ \n", __FUNCTION__); - if (copy_from_user(&tinfo, - (struct hfi11_tid_info __user *)arg, - sizeof(tinfo))) - return -EFAULT; - - ret = hfi1_user_exp_rcv_invalid(fd, &tinfo); - if (ret) - break; - addr = arg + offsetof(struct hfi1_tid_info, tidcnt); - if (copy_to_user((void __user *)addr, &tinfo.tidcnt, - sizeof(tinfo.tidcnt))) - ret = -EFAULT; + /* This function is only invovled with the tid mmu caching. + * It is a no-op for us. */ + ret = 0; break; case HFI1_IOCTL_RECV_CTRL: diff --git a/kernel/user_exp_rcv.c b/kernel/user_exp_rcv.c index 9a265b97..de7bd774 100644 --- a/kernel/user_exp_rcv.c +++ b/kernel/user_exp_rcv.c @@ -256,58 +256,6 @@ done: return ret; } -int hfi1_user_exp_rcv_invalid(struct hfi1_filedata *fd, struct hfi1_tid_info *tinfo) -{ -#if 0 - struct hfi1_ctxtdata *uctxt = fd->uctxt; - unsigned long *ev = uctxt->dd->events + - (((uctxt->ctxt - uctxt->dd->first_user_ctxt) * - HFI1_MAX_SHARED_CTXTS) + fd->subctxt); - u32 *array; - int ret = 0; - - if (!fd->invalid_tids) - return -EINVAL; - - /* - * copy_to_user() can sleep, which will leave the invalid_lock - * locked and cause the MMU notifier to be blocked on the lock - * for a long time. - * Copy the data to a local buffer so we can release the lock. - */ - array = kcalloc(uctxt->expected_count, sizeof(*array), GFP_KERNEL); - if (!array) - return -EFAULT; - - spin_lock(&fd->invalid_lock); - if (fd->invalid_tid_idx) { - memcpy(array, fd->invalid_tids, sizeof(*array) * - fd->invalid_tid_idx); - memset(fd->invalid_tids, 0, sizeof(*fd->invalid_tids) * - fd->invalid_tid_idx); - tinfo->tidcnt = fd->invalid_tid_idx; - fd->invalid_tid_idx = 0; - /* - * Reset the user flag while still holding the lock. - * Otherwise, PSM can miss events. - */ - clear_bit(_HFI1_EVENT_TID_MMU_NOTIFY_BIT, ev); - } else { - tinfo->tidcnt = 0; - } - spin_unlock(&fd->invalid_lock); - - if (tinfo->tidcnt) { - if (copy_to_user((void __user *)tinfo->tidlist, - array, sizeof(*array) * tinfo->tidcnt)) - ret = -EFAULT; - } - kfree(array); - - return ret; -#endif - return 0; -} /** * program_rcvarray() - program an RcvArray group with receive buffers * @fd: file data