Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 1 | /* |
Vishwanathapura, Niranjana | 2280740 | 2017-04-12 20:29:29 -0700 | [diff] [blame] | 2 | * Copyright(c) 2015-2017 Intel Corporation. |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 3 | * |
| 4 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 5 | * redistributing this file, you may do so under either license. |
| 6 | * |
| 7 | * GPL LICENSE SUMMARY |
| 8 | * |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of version 2 of the GNU General Public License as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * General Public License for more details. |
| 17 | * |
| 18 | * BSD LICENSE |
| 19 | * |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 20 | * Redistribution and use in source and binary forms, with or without |
| 21 | * modification, are permitted provided that the following conditions |
| 22 | * are met: |
| 23 | * |
| 24 | * - Redistributions of source code must retain the above copyright |
| 25 | * notice, this list of conditions and the following disclaimer. |
| 26 | * - Redistributions in binary form must reproduce the above copyright |
| 27 | * notice, this list of conditions and the following disclaimer in |
| 28 | * the documentation and/or other materials provided with the |
| 29 | * distribution. |
| 30 | * - Neither the name of Intel Corporation nor the names of its |
| 31 | * contributors may be used to endorse or promote products derived |
| 32 | * from this software without specific prior written permission. |
| 33 | * |
| 34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 35 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 36 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 37 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 38 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 39 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 41 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 42 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 43 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 44 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 45 | * |
| 46 | */ |
| 47 | #include <asm/page.h> |
Michael J. Ruhl | 1bb0d7b | 2017-02-08 05:28:31 -0800 | [diff] [blame] | 48 | #include <linux/string.h> |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 49 | |
Harish Chegondi | 637f460 | 2017-08-21 18:27:23 -0700 | [diff] [blame] | 50 | #include "mmu_rb.h" |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 51 | #include "user_exp_rcv.h" |
| 52 | #include "trace.h" |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 53 | |
Michael J. Ruhl | f4cd876 | 2017-05-04 05:14:39 -0700 | [diff] [blame] | 54 | static void unlock_exp_tids(struct hfi1_ctxtdata *uctxt, |
| 55 | struct exp_tid_set *set, |
| 56 | struct hfi1_filedata *fd); |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 57 | static u32 find_phys_blocks(struct tid_user_buf *tidbuf, unsigned int npages); |
| 58 | static int set_rcvarray_entry(struct hfi1_filedata *fd, |
| 59 | struct tid_user_buf *tbuf, |
Michael J. Ruhl | f4cd876 | 2017-05-04 05:14:39 -0700 | [diff] [blame] | 60 | u32 rcventry, struct tid_group *grp, |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 61 | u16 pageidx, unsigned int npages); |
Michael J. Ruhl | f4cd876 | 2017-05-04 05:14:39 -0700 | [diff] [blame] | 62 | static int tid_rb_insert(void *arg, struct mmu_rb_node *node); |
Ira Weiny | 2677a76 | 2016-07-28 15:21:26 -0400 | [diff] [blame] | 63 | static void cacheless_tid_rb_remove(struct hfi1_filedata *fdata, |
| 64 | struct tid_rb_node *tnode); |
Michael J. Ruhl | f4cd876 | 2017-05-04 05:14:39 -0700 | [diff] [blame] | 65 | static void tid_rb_remove(void *arg, struct mmu_rb_node *node); |
| 66 | static int tid_rb_invalidate(void *arg, struct mmu_rb_node *mnode); |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 67 | static int program_rcvarray(struct hfi1_filedata *fd, struct tid_user_buf *, |
| 68 | struct tid_group *grp, |
| 69 | unsigned int start, u16 count, |
| 70 | u32 *tidlist, unsigned int *tididx, |
| 71 | unsigned int *pmapped); |
Michael J. Ruhl | 5042cdd | 2017-05-04 05:14:45 -0700 | [diff] [blame] | 72 | static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo, |
Michael J. Ruhl | f4cd876 | 2017-05-04 05:14:39 -0700 | [diff] [blame] | 73 | struct tid_group **grp); |
Ira Weiny | 2677a76 | 2016-07-28 15:21:26 -0400 | [diff] [blame] | 74 | static void clear_tid_node(struct hfi1_filedata *fd, struct tid_rb_node *node); |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 75 | |
| 76 | static struct mmu_rb_ops tid_rb_ops = { |
Dean Luick | a7cd2dc | 2016-07-28 12:27:37 -0400 | [diff] [blame] | 77 | .insert = tid_rb_insert, |
| 78 | .remove = tid_rb_remove, |
| 79 | .invalidate = tid_rb_invalidate |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 80 | }; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 81 | |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 82 | /* |
| 83 | * Initialize context and file private data needed for Expected |
| 84 | * receive caching. This needs to be done after the context has |
| 85 | * been configured with the eager/expected RcvEntry counts. |
| 86 | */ |
Michael J. Ruhl | e87473b | 2017-07-29 08:43:32 -0700 | [diff] [blame] | 87 | int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd, |
| 88 | struct hfi1_ctxtdata *uctxt) |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 89 | { |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 90 | struct hfi1_devdata *dd = uctxt->dd; |
Michael J. Ruhl | 9b60d2c | 2017-05-04 05:15:09 -0700 | [diff] [blame] | 91 | int ret = 0; |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 92 | |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 93 | spin_lock_init(&fd->tid_lock); |
| 94 | spin_lock_init(&fd->invalid_lock); |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 95 | |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 96 | fd->entry_to_rb = kcalloc(uctxt->expected_count, |
Michael J. Ruhl | 9b60d2c | 2017-05-04 05:15:09 -0700 | [diff] [blame] | 97 | sizeof(struct rb_node *), |
| 98 | GFP_KERNEL); |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 99 | if (!fd->entry_to_rb) |
| 100 | return -ENOMEM; |
| 101 | |
Dean Luick | 622c202 | 2016-07-28 15:21:21 -0400 | [diff] [blame] | 102 | if (!HFI1_CAP_UGET_MASK(uctxt->flags, TID_UNMAP)) { |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 103 | fd->invalid_tid_idx = 0; |
Markus Elfring | 4076e51 | 2017-02-09 15:30:53 +0100 | [diff] [blame] | 104 | fd->invalid_tids = kcalloc(uctxt->expected_count, |
| 105 | sizeof(*fd->invalid_tids), |
| 106 | GFP_KERNEL); |
Michael J. Ruhl | 62239fc | 2017-05-04 05:15:21 -0700 | [diff] [blame] | 107 | if (!fd->invalid_tids) { |
| 108 | kfree(fd->entry_to_rb); |
| 109 | fd->entry_to_rb = NULL; |
Michael J. Ruhl | 9b60d2c | 2017-05-04 05:15:09 -0700 | [diff] [blame] | 110 | return -ENOMEM; |
Michael J. Ruhl | 62239fc | 2017-05-04 05:15:21 -0700 | [diff] [blame] | 111 | } |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 112 | |
| 113 | /* |
| 114 | * Register MMU notifier callbacks. If the registration |
Dean Luick | 622c202 | 2016-07-28 15:21:21 -0400 | [diff] [blame] | 115 | * fails, continue without TID caching for this context. |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 116 | */ |
Dean Luick | b85ced9 | 2016-07-28 15:21:24 -0400 | [diff] [blame] | 117 | ret = hfi1_mmu_rb_register(fd, fd->mm, &tid_rb_ops, |
| 118 | dd->pport->hfi1_wq, |
| 119 | &fd->handler); |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 120 | if (ret) { |
| 121 | dd_dev_info(dd, |
| 122 | "Failed MMU notifier registration %d\n", |
| 123 | ret); |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 124 | ret = 0; |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 125 | } |
| 126 | } |
| 127 | |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 128 | /* |
| 129 | * PSM does not have a good way to separate, count, and |
| 130 | * effectively enforce a limit on RcvArray entries used by |
| 131 | * subctxts (when context sharing is used) when TID caching |
| 132 | * is enabled. To help with that, we calculate a per-process |
| 133 | * RcvArray entry share and enforce that. |
| 134 | * If TID caching is not in use, PSM deals with usage on its |
| 135 | * own. In that case, we allow any subctxt to take all of the |
| 136 | * entries. |
| 137 | * |
| 138 | * Make sure that we set the tid counts only after successful |
| 139 | * init. |
| 140 | */ |
Mitko Haralanov | 455d7f1 | 2016-02-05 11:57:56 -0500 | [diff] [blame] | 141 | spin_lock(&fd->tid_lock); |
Dean Luick | 622c202 | 2016-07-28 15:21:21 -0400 | [diff] [blame] | 142 | if (uctxt->subctxt_cnt && fd->handler) { |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 143 | u16 remainder; |
| 144 | |
| 145 | fd->tid_limit = uctxt->expected_count / uctxt->subctxt_cnt; |
| 146 | remainder = uctxt->expected_count % uctxt->subctxt_cnt; |
| 147 | if (remainder && fd->subctxt < remainder) |
| 148 | fd->tid_limit++; |
| 149 | } else { |
| 150 | fd->tid_limit = uctxt->expected_count; |
| 151 | } |
Mitko Haralanov | 455d7f1 | 2016-02-05 11:57:56 -0500 | [diff] [blame] | 152 | spin_unlock(&fd->tid_lock); |
Michael J. Ruhl | 9b60d2c | 2017-05-04 05:15:09 -0700 | [diff] [blame] | 153 | |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 154 | return ret; |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 155 | } |
| 156 | |
Michael J. Ruhl | 9b60d2c | 2017-05-04 05:15:09 -0700 | [diff] [blame] | 157 | void hfi1_user_exp_rcv_free(struct hfi1_filedata *fd) |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 158 | { |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 159 | struct hfi1_ctxtdata *uctxt = fd->uctxt; |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 160 | |
| 161 | /* |
| 162 | * The notifier would have been removed when the process'es mm |
| 163 | * was freed. |
| 164 | */ |
Michael J. Ruhl | 224d71f | 2017-05-04 05:14:34 -0700 | [diff] [blame] | 165 | if (fd->handler) { |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 166 | hfi1_mmu_rb_unregister(fd->handler); |
Michael J. Ruhl | 224d71f | 2017-05-04 05:14:34 -0700 | [diff] [blame] | 167 | } else { |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 168 | if (!EXP_TID_SET_EMPTY(uctxt->tid_full_list)) |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 169 | unlock_exp_tids(uctxt, &uctxt->tid_full_list, fd); |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 170 | if (!EXP_TID_SET_EMPTY(uctxt->tid_used_list)) |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 171 | unlock_exp_tids(uctxt, &uctxt->tid_used_list, fd); |
Mitko Haralanov | 3abb33a | 2016-02-05 11:57:54 -0500 | [diff] [blame] | 172 | } |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 173 | |
Michael J. Ruhl | 224d71f | 2017-05-04 05:14:34 -0700 | [diff] [blame] | 174 | kfree(fd->invalid_tids); |
| 175 | fd->invalid_tids = NULL; |
| 176 | |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 177 | kfree(fd->entry_to_rb); |
Michael J. Ruhl | 224d71f | 2017-05-04 05:14:34 -0700 | [diff] [blame] | 178 | fd->entry_to_rb = NULL; |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 179 | } |
| 180 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 181 | /** |
| 182 | * Release pinned receive buffer pages. |
| 183 | * |
| 184 | * @mapped - true if the pages have been DMA mapped. false otherwise. |
| 185 | * @idx - Index of the first page to unpin. |
| 186 | * @npages - No of pages to unpin. |
| 187 | * |
| 188 | * If the pages have been DMA mapped (indicated by mapped parameter), their |
| 189 | * info will be passed via a struct tid_rb_node. If they haven't been mapped, |
| 190 | * their info will be passed via a struct tid_user_buf. |
| 191 | */ |
| 192 | static void unpin_rcv_pages(struct hfi1_filedata *fd, |
| 193 | struct tid_user_buf *tidbuf, |
| 194 | struct tid_rb_node *node, |
| 195 | unsigned int idx, |
| 196 | unsigned int npages, |
| 197 | bool mapped) |
| 198 | { |
| 199 | struct page **pages; |
| 200 | struct hfi1_devdata *dd = fd->uctxt->dd; |
| 201 | |
| 202 | if (mapped) { |
| 203 | pci_unmap_single(dd->pcidev, node->dma_addr, |
| 204 | node->mmu.len, PCI_DMA_FROMDEVICE); |
| 205 | pages = &node->pages[idx]; |
| 206 | } else { |
| 207 | pages = &tidbuf->pages[idx]; |
| 208 | } |
| 209 | hfi1_release_user_pages(fd->mm, pages, npages, mapped); |
| 210 | fd->tid_n_pinned -= npages; |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Pin receive buffer pages. |
| 215 | */ |
| 216 | static int pin_rcv_pages(struct hfi1_filedata *fd, struct tid_user_buf *tidbuf) |
| 217 | { |
| 218 | int pinned; |
| 219 | unsigned int npages; |
| 220 | unsigned long vaddr = tidbuf->vaddr; |
| 221 | struct page **pages = NULL; |
| 222 | struct hfi1_devdata *dd = fd->uctxt->dd; |
| 223 | |
| 224 | /* Get the number of pages the user buffer spans */ |
| 225 | npages = num_user_pages(vaddr, tidbuf->length); |
| 226 | if (!npages) |
| 227 | return -EINVAL; |
| 228 | |
| 229 | if (npages > fd->uctxt->expected_count) { |
| 230 | dd_dev_err(dd, "Expected buffer too big\n"); |
| 231 | return -EINVAL; |
| 232 | } |
| 233 | |
| 234 | /* Verify that access is OK for the user buffer */ |
| 235 | if (!access_ok(VERIFY_WRITE, (void __user *)vaddr, |
| 236 | npages * PAGE_SIZE)) { |
| 237 | dd_dev_err(dd, "Fail vaddr %p, %u pages, !access_ok\n", |
| 238 | (void *)vaddr, npages); |
| 239 | return -EFAULT; |
| 240 | } |
| 241 | /* Allocate the array of struct page pointers needed for pinning */ |
| 242 | pages = kcalloc(npages, sizeof(*pages), GFP_KERNEL); |
| 243 | if (!pages) |
| 244 | return -ENOMEM; |
| 245 | |
| 246 | /* |
| 247 | * Pin all the pages of the user buffer. If we can't pin all the |
| 248 | * pages, accept the amount pinned so far and program only that. |
| 249 | * User space knows how to deal with partially programmed buffers. |
| 250 | */ |
| 251 | if (!hfi1_can_pin_pages(dd, fd->mm, fd->tid_n_pinned, npages)) { |
| 252 | kfree(pages); |
| 253 | return -ENOMEM; |
| 254 | } |
| 255 | |
| 256 | pinned = hfi1_acquire_user_pages(fd->mm, vaddr, npages, true, pages); |
| 257 | if (pinned <= 0) { |
| 258 | kfree(pages); |
| 259 | return pinned; |
| 260 | } |
| 261 | tidbuf->pages = pages; |
| 262 | tidbuf->npages = npages; |
| 263 | fd->tid_n_pinned += pinned; |
| 264 | return pinned; |
| 265 | } |
| 266 | |
Mitko Haralanov | b8abe34 | 2016-02-05 11:57:51 -0500 | [diff] [blame] | 267 | /* |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 268 | * RcvArray entry allocation for Expected Receives is done by the |
| 269 | * following algorithm: |
| 270 | * |
| 271 | * The context keeps 3 lists of groups of RcvArray entries: |
| 272 | * 1. List of empty groups - tid_group_list |
| 273 | * This list is created during user context creation and |
| 274 | * contains elements which describe sets (of 8) of empty |
| 275 | * RcvArray entries. |
| 276 | * 2. List of partially used groups - tid_used_list |
| 277 | * This list contains sets of RcvArray entries which are |
| 278 | * not completely used up. Another mapping request could |
| 279 | * use some of all of the remaining entries. |
| 280 | * 3. List of full groups - tid_full_list |
| 281 | * This is the list where sets that are completely used |
| 282 | * up go. |
| 283 | * |
| 284 | * An attempt to optimize the usage of RcvArray entries is |
| 285 | * made by finding all sets of physically contiguous pages in a |
| 286 | * user's buffer. |
| 287 | * These physically contiguous sets are further split into |
| 288 | * sizes supported by the receive engine of the HFI. The |
| 289 | * resulting sets of pages are stored in struct tid_pageset, |
| 290 | * which describes the sets as: |
| 291 | * * .count - number of pages in this set |
| 292 | * * .idx - starting index into struct page ** array |
| 293 | * of this set |
| 294 | * |
| 295 | * From this point on, the algorithm deals with the page sets |
| 296 | * described above. The number of pagesets is divided by the |
| 297 | * RcvArray group size to produce the number of full groups |
| 298 | * needed. |
| 299 | * |
| 300 | * Groups from the 3 lists are manipulated using the following |
| 301 | * rules: |
| 302 | * 1. For each set of 8 pagesets, a complete group from |
| 303 | * tid_group_list is taken, programmed, and moved to |
| 304 | * the tid_full_list list. |
| 305 | * 2. For all remaining pagesets: |
| 306 | * 2.1 If the tid_used_list is empty and the tid_group_list |
| 307 | * is empty, stop processing pageset and return only |
| 308 | * what has been programmed up to this point. |
| 309 | * 2.2 If the tid_used_list is empty and the tid_group_list |
| 310 | * is not empty, move a group from tid_group_list to |
| 311 | * tid_used_list. |
| 312 | * 2.3 For each group is tid_used_group, program as much as |
| 313 | * can fit into the group. If the group becomes fully |
| 314 | * used, move it to tid_full_list. |
| 315 | */ |
Michael J. Ruhl | 5042cdd | 2017-05-04 05:14:45 -0700 | [diff] [blame] | 316 | int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd, |
| 317 | struct hfi1_tid_info *tinfo) |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 318 | { |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 319 | int ret = 0, need_group = 0, pinned; |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 320 | struct hfi1_ctxtdata *uctxt = fd->uctxt; |
| 321 | struct hfi1_devdata *dd = uctxt->dd; |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 322 | unsigned int ngroups, pageidx = 0, pageset_count, |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 323 | tididx = 0, mapped, mapped_pages = 0; |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 324 | u32 *tidlist = NULL; |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 325 | struct tid_user_buf *tidbuf; |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 326 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 327 | tidbuf = kzalloc(sizeof(*tidbuf), GFP_KERNEL); |
| 328 | if (!tidbuf) |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 329 | return -ENOMEM; |
| 330 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 331 | tidbuf->vaddr = tinfo->vaddr; |
| 332 | tidbuf->length = tinfo->length; |
| 333 | tidbuf->psets = kcalloc(uctxt->expected_count, sizeof(*tidbuf->psets), |
| 334 | GFP_KERNEL); |
| 335 | if (!tidbuf->psets) { |
| 336 | kfree(tidbuf); |
| 337 | return -ENOMEM; |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 338 | } |
| 339 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 340 | pinned = pin_rcv_pages(fd, tidbuf); |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 341 | if (pinned <= 0) { |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 342 | kfree(tidbuf->psets); |
| 343 | kfree(tidbuf); |
| 344 | return pinned; |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 345 | } |
| 346 | |
| 347 | /* Find sets of physically contiguous pages */ |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 348 | tidbuf->n_psets = find_phys_blocks(tidbuf, pinned); |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 349 | |
| 350 | /* |
| 351 | * We don't need to access this under a lock since tid_used is per |
| 352 | * process and the same process cannot be in hfi1_user_exp_rcv_clear() |
| 353 | * and hfi1_user_exp_rcv_setup() at the same time. |
| 354 | */ |
| 355 | spin_lock(&fd->tid_lock); |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 356 | if (fd->tid_used + tidbuf->n_psets > fd->tid_limit) |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 357 | pageset_count = fd->tid_limit - fd->tid_used; |
| 358 | else |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 359 | pageset_count = tidbuf->n_psets; |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 360 | spin_unlock(&fd->tid_lock); |
| 361 | |
| 362 | if (!pageset_count) |
| 363 | goto bail; |
| 364 | |
| 365 | ngroups = pageset_count / dd->rcv_entries.group_size; |
| 366 | tidlist = kcalloc(pageset_count, sizeof(*tidlist), GFP_KERNEL); |
| 367 | if (!tidlist) { |
| 368 | ret = -ENOMEM; |
| 369 | goto nomem; |
| 370 | } |
| 371 | |
| 372 | tididx = 0; |
| 373 | |
| 374 | /* |
| 375 | * From this point on, we are going to be using shared (between master |
| 376 | * and subcontexts) context resources. We need to take the lock. |
| 377 | */ |
| 378 | mutex_lock(&uctxt->exp_lock); |
| 379 | /* |
| 380 | * The first step is to program the RcvArray entries which are complete |
| 381 | * groups. |
| 382 | */ |
| 383 | while (ngroups && uctxt->tid_group_list.count) { |
| 384 | struct tid_group *grp = |
| 385 | tid_group_pop(&uctxt->tid_group_list); |
| 386 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 387 | ret = program_rcvarray(fd, tidbuf, grp, |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 388 | pageidx, dd->rcv_entries.group_size, |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 389 | tidlist, &tididx, &mapped); |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 390 | /* |
| 391 | * If there was a failure to program the RcvArray |
| 392 | * entries for the entire group, reset the grp fields |
| 393 | * and add the grp back to the free group list. |
| 394 | */ |
| 395 | if (ret <= 0) { |
| 396 | tid_group_add_tail(grp, &uctxt->tid_group_list); |
| 397 | hfi1_cdbg(TID, |
| 398 | "Failed to program RcvArray group %d", ret); |
| 399 | goto unlock; |
| 400 | } |
| 401 | |
| 402 | tid_group_add_tail(grp, &uctxt->tid_full_list); |
| 403 | ngroups--; |
| 404 | pageidx += ret; |
| 405 | mapped_pages += mapped; |
| 406 | } |
| 407 | |
| 408 | while (pageidx < pageset_count) { |
| 409 | struct tid_group *grp, *ptr; |
| 410 | /* |
| 411 | * If we don't have any partially used tid groups, check |
| 412 | * if we have empty groups. If so, take one from there and |
| 413 | * put in the partially used list. |
| 414 | */ |
| 415 | if (!uctxt->tid_used_list.count || need_group) { |
| 416 | if (!uctxt->tid_group_list.count) |
| 417 | goto unlock; |
| 418 | |
| 419 | grp = tid_group_pop(&uctxt->tid_group_list); |
| 420 | tid_group_add_tail(grp, &uctxt->tid_used_list); |
| 421 | need_group = 0; |
| 422 | } |
| 423 | /* |
| 424 | * There is an optimization opportunity here - instead of |
| 425 | * fitting as many page sets as we can, check for a group |
| 426 | * later on in the list that could fit all of them. |
| 427 | */ |
| 428 | list_for_each_entry_safe(grp, ptr, &uctxt->tid_used_list.list, |
| 429 | list) { |
| 430 | unsigned use = min_t(unsigned, pageset_count - pageidx, |
| 431 | grp->size - grp->used); |
| 432 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 433 | ret = program_rcvarray(fd, tidbuf, grp, |
| 434 | pageidx, use, tidlist, |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 435 | &tididx, &mapped); |
| 436 | if (ret < 0) { |
| 437 | hfi1_cdbg(TID, |
| 438 | "Failed to program RcvArray entries %d", |
| 439 | ret); |
| 440 | ret = -EFAULT; |
| 441 | goto unlock; |
| 442 | } else if (ret > 0) { |
| 443 | if (grp->used == grp->size) |
| 444 | tid_group_move(grp, |
| 445 | &uctxt->tid_used_list, |
| 446 | &uctxt->tid_full_list); |
| 447 | pageidx += ret; |
| 448 | mapped_pages += mapped; |
| 449 | need_group = 0; |
| 450 | /* Check if we are done so we break out early */ |
| 451 | if (pageidx >= pageset_count) |
| 452 | break; |
| 453 | } else if (WARN_ON(ret == 0)) { |
| 454 | /* |
| 455 | * If ret is 0, we did not program any entries |
| 456 | * into this group, which can only happen if |
| 457 | * we've screwed up the accounting somewhere. |
| 458 | * Warn and try to continue. |
| 459 | */ |
| 460 | need_group = 1; |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | unlock: |
| 465 | mutex_unlock(&uctxt->exp_lock); |
| 466 | nomem: |
| 467 | hfi1_cdbg(TID, "total mapped: tidpairs:%u pages:%u (%d)", tididx, |
| 468 | mapped_pages, ret); |
| 469 | if (tididx) { |
| 470 | spin_lock(&fd->tid_lock); |
| 471 | fd->tid_used += tididx; |
| 472 | spin_unlock(&fd->tid_lock); |
| 473 | tinfo->tidcnt = tididx; |
| 474 | tinfo->length = mapped_pages * PAGE_SIZE; |
| 475 | |
Jason Gunthorpe | 6f57c93 | 2018-03-27 14:18:47 -0600 | [diff] [blame] | 476 | if (copy_to_user(u64_to_user_ptr(tinfo->tidlist), |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 477 | tidlist, sizeof(tidlist[0]) * tididx)) { |
| 478 | /* |
| 479 | * On failure to copy to the user level, we need to undo |
| 480 | * everything done so far so we don't leak resources. |
| 481 | */ |
| 482 | tinfo->tidlist = (unsigned long)&tidlist; |
Michael J. Ruhl | 5042cdd | 2017-05-04 05:14:45 -0700 | [diff] [blame] | 483 | hfi1_user_exp_rcv_clear(fd, tinfo); |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 484 | tinfo->tidlist = 0; |
| 485 | ret = -EFAULT; |
| 486 | goto bail; |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | /* |
| 491 | * If not everything was mapped (due to insufficient RcvArray entries, |
| 492 | * for example), unpin all unmapped pages so we can pin them nex time. |
| 493 | */ |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 494 | if (mapped_pages != pinned) |
| 495 | unpin_rcv_pages(fd, tidbuf, NULL, mapped_pages, |
| 496 | (pinned - mapped_pages), false); |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 497 | bail: |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 498 | kfree(tidbuf->psets); |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 499 | kfree(tidlist); |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 500 | kfree(tidbuf->pages); |
| 501 | kfree(tidbuf); |
Mitko Haralanov | 7e7a436e | 2016-02-05 11:57:57 -0500 | [diff] [blame] | 502 | return ret > 0 ? 0 : ret; |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 503 | } |
| 504 | |
Michael J. Ruhl | 5042cdd | 2017-05-04 05:14:45 -0700 | [diff] [blame] | 505 | int hfi1_user_exp_rcv_clear(struct hfi1_filedata *fd, |
| 506 | struct hfi1_tid_info *tinfo) |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 507 | { |
Mitko Haralanov | 455d7f1 | 2016-02-05 11:57:56 -0500 | [diff] [blame] | 508 | int ret = 0; |
Mitko Haralanov | 455d7f1 | 2016-02-05 11:57:56 -0500 | [diff] [blame] | 509 | struct hfi1_ctxtdata *uctxt = fd->uctxt; |
| 510 | u32 *tidinfo; |
| 511 | unsigned tididx; |
| 512 | |
Michael J. Ruhl | db73089 | 2017-04-09 10:16:03 -0700 | [diff] [blame] | 513 | if (unlikely(tinfo->tidcnt > fd->tid_used)) |
| 514 | return -EINVAL; |
| 515 | |
Jason Gunthorpe | 6f57c93 | 2018-03-27 14:18:47 -0600 | [diff] [blame] | 516 | tidinfo = memdup_user(u64_to_user_ptr(tinfo->tidlist), |
Michael J. Ruhl | 1bb0d7b | 2017-02-08 05:28:31 -0800 | [diff] [blame] | 517 | sizeof(tidinfo[0]) * tinfo->tidcnt); |
| 518 | if (IS_ERR(tidinfo)) |
| 519 | return PTR_ERR(tidinfo); |
Mitko Haralanov | 455d7f1 | 2016-02-05 11:57:56 -0500 | [diff] [blame] | 520 | |
| 521 | mutex_lock(&uctxt->exp_lock); |
| 522 | for (tididx = 0; tididx < tinfo->tidcnt; tididx++) { |
Michael J. Ruhl | 5042cdd | 2017-05-04 05:14:45 -0700 | [diff] [blame] | 523 | ret = unprogram_rcvarray(fd, tidinfo[tididx], NULL); |
Mitko Haralanov | 455d7f1 | 2016-02-05 11:57:56 -0500 | [diff] [blame] | 524 | if (ret) { |
| 525 | hfi1_cdbg(TID, "Failed to unprogram rcv array %d", |
| 526 | ret); |
| 527 | break; |
| 528 | } |
| 529 | } |
| 530 | spin_lock(&fd->tid_lock); |
| 531 | fd->tid_used -= tididx; |
| 532 | spin_unlock(&fd->tid_lock); |
| 533 | tinfo->tidcnt = tididx; |
| 534 | mutex_unlock(&uctxt->exp_lock); |
Michael J. Ruhl | 1bb0d7b | 2017-02-08 05:28:31 -0800 | [diff] [blame] | 535 | |
Mitko Haralanov | 455d7f1 | 2016-02-05 11:57:56 -0500 | [diff] [blame] | 536 | kfree(tidinfo); |
| 537 | return ret; |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 538 | } |
| 539 | |
Michael J. Ruhl | 5042cdd | 2017-05-04 05:14:45 -0700 | [diff] [blame] | 540 | int hfi1_user_exp_rcv_invalid(struct hfi1_filedata *fd, |
| 541 | struct hfi1_tid_info *tinfo) |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 542 | { |
Mitko Haralanov | 455d7f1 | 2016-02-05 11:57:56 -0500 | [diff] [blame] | 543 | struct hfi1_ctxtdata *uctxt = fd->uctxt; |
| 544 | unsigned long *ev = uctxt->dd->events + |
Michael J. Ruhl | 21e5acc | 2017-09-26 07:00:56 -0700 | [diff] [blame] | 545 | (uctxt_offset(uctxt) + fd->subctxt); |
Mitko Haralanov | 455d7f1 | 2016-02-05 11:57:56 -0500 | [diff] [blame] | 546 | u32 *array; |
| 547 | int ret = 0; |
| 548 | |
Mitko Haralanov | 455d7f1 | 2016-02-05 11:57:56 -0500 | [diff] [blame] | 549 | /* |
| 550 | * copy_to_user() can sleep, which will leave the invalid_lock |
| 551 | * locked and cause the MMU notifier to be blocked on the lock |
| 552 | * for a long time. |
| 553 | * Copy the data to a local buffer so we can release the lock. |
| 554 | */ |
| 555 | array = kcalloc(uctxt->expected_count, sizeof(*array), GFP_KERNEL); |
| 556 | if (!array) |
| 557 | return -EFAULT; |
| 558 | |
| 559 | spin_lock(&fd->invalid_lock); |
| 560 | if (fd->invalid_tid_idx) { |
| 561 | memcpy(array, fd->invalid_tids, sizeof(*array) * |
| 562 | fd->invalid_tid_idx); |
| 563 | memset(fd->invalid_tids, 0, sizeof(*fd->invalid_tids) * |
| 564 | fd->invalid_tid_idx); |
| 565 | tinfo->tidcnt = fd->invalid_tid_idx; |
| 566 | fd->invalid_tid_idx = 0; |
| 567 | /* |
| 568 | * Reset the user flag while still holding the lock. |
| 569 | * Otherwise, PSM can miss events. |
| 570 | */ |
| 571 | clear_bit(_HFI1_EVENT_TID_MMU_NOTIFY_BIT, ev); |
| 572 | } else { |
| 573 | tinfo->tidcnt = 0; |
| 574 | } |
| 575 | spin_unlock(&fd->invalid_lock); |
| 576 | |
| 577 | if (tinfo->tidcnt) { |
| 578 | if (copy_to_user((void __user *)tinfo->tidlist, |
| 579 | array, sizeof(*array) * tinfo->tidcnt)) |
| 580 | ret = -EFAULT; |
| 581 | } |
| 582 | kfree(array); |
| 583 | |
| 584 | return ret; |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 585 | } |
| 586 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 587 | static u32 find_phys_blocks(struct tid_user_buf *tidbuf, unsigned int npages) |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 588 | { |
| 589 | unsigned pagecount, pageidx, setcount = 0, i; |
| 590 | unsigned long pfn, this_pfn; |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 591 | struct page **pages = tidbuf->pages; |
| 592 | struct tid_pageset *list = tidbuf->psets; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 593 | |
| 594 | if (!npages) |
| 595 | return 0; |
| 596 | |
| 597 | /* |
| 598 | * Look for sets of physically contiguous pages in the user buffer. |
| 599 | * This will allow us to optimize Expected RcvArray entry usage by |
| 600 | * using the bigger supported sizes. |
| 601 | */ |
| 602 | pfn = page_to_pfn(pages[0]); |
| 603 | for (pageidx = 0, pagecount = 1, i = 1; i <= npages; i++) { |
| 604 | this_pfn = i < npages ? page_to_pfn(pages[i]) : 0; |
| 605 | |
| 606 | /* |
| 607 | * If the pfn's are not sequential, pages are not physically |
| 608 | * contiguous. |
| 609 | */ |
| 610 | if (this_pfn != ++pfn) { |
| 611 | /* |
| 612 | * At this point we have to loop over the set of |
| 613 | * physically contiguous pages and break them down it |
| 614 | * sizes supported by the HW. |
| 615 | * There are two main constraints: |
| 616 | * 1. The max buffer size is MAX_EXPECTED_BUFFER. |
| 617 | * If the total set size is bigger than that |
| 618 | * program only a MAX_EXPECTED_BUFFER chunk. |
| 619 | * 2. The buffer size has to be a power of two. If |
| 620 | * it is not, round down to the closes power of |
| 621 | * 2 and program that size. |
| 622 | */ |
| 623 | while (pagecount) { |
| 624 | int maxpages = pagecount; |
| 625 | u32 bufsize = pagecount * PAGE_SIZE; |
| 626 | |
| 627 | if (bufsize > MAX_EXPECTED_BUFFER) |
| 628 | maxpages = |
| 629 | MAX_EXPECTED_BUFFER >> |
| 630 | PAGE_SHIFT; |
| 631 | else if (!is_power_of_2(bufsize)) |
| 632 | maxpages = |
| 633 | rounddown_pow_of_two(bufsize) >> |
| 634 | PAGE_SHIFT; |
| 635 | |
| 636 | list[setcount].idx = pageidx; |
| 637 | list[setcount].count = maxpages; |
| 638 | pagecount -= maxpages; |
| 639 | pageidx += maxpages; |
| 640 | setcount++; |
| 641 | } |
| 642 | pageidx = i; |
| 643 | pagecount = 1; |
| 644 | pfn = this_pfn; |
| 645 | } else { |
| 646 | pagecount++; |
| 647 | } |
| 648 | } |
| 649 | return setcount; |
| 650 | } |
| 651 | |
| 652 | /** |
| 653 | * program_rcvarray() - program an RcvArray group with receive buffers |
Michael J. Ruhl | 5042cdd | 2017-05-04 05:14:45 -0700 | [diff] [blame] | 654 | * @fd: filedata pointer |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 655 | * @tbuf: pointer to struct tid_user_buf that has the user buffer starting |
| 656 | * virtual address, buffer length, page pointers, pagesets (array of |
| 657 | * struct tid_pageset holding information on physically contiguous |
| 658 | * chunks from the user buffer), and other fields. |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 659 | * @grp: RcvArray group |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 660 | * @start: starting index into sets array |
| 661 | * @count: number of struct tid_pageset's to program |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 662 | * @tidlist: the array of u32 elements when the information about the |
| 663 | * programmed RcvArray entries is to be encoded. |
| 664 | * @tididx: starting offset into tidlist |
| 665 | * @pmapped: (output parameter) number of pages programmed into the RcvArray |
| 666 | * entries. |
| 667 | * |
| 668 | * This function will program up to 'count' number of RcvArray entries from the |
| 669 | * group 'grp'. To make best use of write-combining writes, the function will |
| 670 | * perform writes to the unused RcvArray entries which will be ignored by the |
| 671 | * HW. Each RcvArray entry will be programmed with a physically contiguous |
| 672 | * buffer chunk from the user's virtual buffer. |
| 673 | * |
| 674 | * Return: |
| 675 | * -EINVAL if the requested count is larger than the size of the group, |
| 676 | * -ENOMEM or -EFAULT on error from set_rcvarray_entry(), or |
| 677 | * number of RcvArray entries programmed. |
| 678 | */ |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 679 | static int program_rcvarray(struct hfi1_filedata *fd, struct tid_user_buf *tbuf, |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 680 | struct tid_group *grp, |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 681 | unsigned int start, u16 count, |
| 682 | u32 *tidlist, unsigned int *tididx, |
| 683 | unsigned int *pmapped) |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 684 | { |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 685 | struct hfi1_ctxtdata *uctxt = fd->uctxt; |
| 686 | struct hfi1_devdata *dd = uctxt->dd; |
| 687 | u16 idx; |
| 688 | u32 tidinfo = 0, rcventry, useidx = 0; |
| 689 | int mapped = 0; |
| 690 | |
| 691 | /* Count should never be larger than the group size */ |
| 692 | if (count > grp->size) |
| 693 | return -EINVAL; |
| 694 | |
| 695 | /* Find the first unused entry in the group */ |
| 696 | for (idx = 0; idx < grp->size; idx++) { |
| 697 | if (!(grp->map & (1 << idx))) { |
| 698 | useidx = idx; |
| 699 | break; |
| 700 | } |
| 701 | rcv_array_wc_fill(dd, grp->base + idx); |
| 702 | } |
| 703 | |
| 704 | idx = 0; |
| 705 | while (idx < count) { |
| 706 | u16 npages, pageidx, setidx = start + idx; |
| 707 | int ret = 0; |
| 708 | |
| 709 | /* |
| 710 | * If this entry in the group is used, move to the next one. |
| 711 | * If we go past the end of the group, exit the loop. |
| 712 | */ |
| 713 | if (useidx >= grp->size) { |
| 714 | break; |
| 715 | } else if (grp->map & (1 << useidx)) { |
| 716 | rcv_array_wc_fill(dd, grp->base + useidx); |
| 717 | useidx++; |
| 718 | continue; |
| 719 | } |
| 720 | |
| 721 | rcventry = grp->base + useidx; |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 722 | npages = tbuf->psets[setidx].count; |
| 723 | pageidx = tbuf->psets[setidx].idx; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 724 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 725 | ret = set_rcvarray_entry(fd, tbuf, |
| 726 | rcventry, grp, pageidx, |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 727 | npages); |
| 728 | if (ret) |
| 729 | return ret; |
| 730 | mapped += npages; |
| 731 | |
| 732 | tidinfo = rcventry2tidinfo(rcventry - uctxt->expected_base) | |
| 733 | EXP_TID_SET(LEN, npages); |
| 734 | tidlist[(*tididx)++] = tidinfo; |
| 735 | grp->used++; |
| 736 | grp->map |= 1 << useidx++; |
| 737 | idx++; |
| 738 | } |
| 739 | |
| 740 | /* Fill the rest of the group with "blank" writes */ |
| 741 | for (; useidx < grp->size; useidx++) |
| 742 | rcv_array_wc_fill(dd, grp->base + useidx); |
| 743 | *pmapped = mapped; |
| 744 | return idx; |
| 745 | } |
| 746 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 747 | static int set_rcvarray_entry(struct hfi1_filedata *fd, |
| 748 | struct tid_user_buf *tbuf, |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 749 | u32 rcventry, struct tid_group *grp, |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 750 | u16 pageidx, unsigned int npages) |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 751 | { |
| 752 | int ret; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 753 | struct hfi1_ctxtdata *uctxt = fd->uctxt; |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 754 | struct tid_rb_node *node; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 755 | struct hfi1_devdata *dd = uctxt->dd; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 756 | dma_addr_t phys; |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 757 | struct page **pages = tbuf->pages + pageidx; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 758 | |
| 759 | /* |
| 760 | * Allocate the node first so we can handle a potential |
| 761 | * failure before we've programmed anything. |
| 762 | */ |
| 763 | node = kzalloc(sizeof(*node) + (sizeof(struct page *) * npages), |
| 764 | GFP_KERNEL); |
| 765 | if (!node) |
| 766 | return -ENOMEM; |
| 767 | |
| 768 | phys = pci_map_single(dd->pcidev, |
| 769 | __va(page_to_phys(pages[0])), |
| 770 | npages * PAGE_SIZE, PCI_DMA_FROMDEVICE); |
| 771 | if (dma_mapping_error(&dd->pcidev->dev, phys)) { |
| 772 | dd_dev_err(dd, "Failed to DMA map Exp Rcv pages 0x%llx\n", |
| 773 | phys); |
| 774 | kfree(node); |
| 775 | return -EFAULT; |
| 776 | } |
| 777 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 778 | node->mmu.addr = tbuf->vaddr + (pageidx * PAGE_SIZE); |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 779 | node->mmu.len = npages * PAGE_SIZE; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 780 | node->phys = page_to_phys(pages[0]); |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 781 | node->npages = npages; |
| 782 | node->rcventry = rcventry; |
| 783 | node->dma_addr = phys; |
| 784 | node->grp = grp; |
| 785 | node->freed = false; |
| 786 | memcpy(node->pages, pages, sizeof(struct page *) * npages); |
| 787 | |
Dean Luick | 622c202 | 2016-07-28 15:21:21 -0400 | [diff] [blame] | 788 | if (!fd->handler) |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 789 | ret = tid_rb_insert(fd, &node->mmu); |
Mitko Haralanov | 368f2b5 | 2016-03-08 11:14:42 -0800 | [diff] [blame] | 790 | else |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 791 | ret = hfi1_mmu_rb_insert(fd->handler, &node->mmu); |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 792 | |
| 793 | if (ret) { |
| 794 | hfi1_cdbg(TID, "Failed to insert RB node %u 0x%lx, 0x%lx %d", |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 795 | node->rcventry, node->mmu.addr, node->phys, ret); |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 796 | pci_unmap_single(dd->pcidev, phys, npages * PAGE_SIZE, |
| 797 | PCI_DMA_FROMDEVICE); |
| 798 | kfree(node); |
| 799 | return -EFAULT; |
| 800 | } |
| 801 | hfi1_put_tid(dd, rcventry, PT_EXPECTED, phys, ilog2(npages) + 1); |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 802 | trace_hfi1_exp_tid_reg(uctxt->ctxt, fd->subctxt, rcventry, npages, |
| 803 | node->mmu.addr, node->phys, phys); |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 804 | return 0; |
| 805 | } |
| 806 | |
Michael J. Ruhl | 5042cdd | 2017-05-04 05:14:45 -0700 | [diff] [blame] | 807 | static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo, |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 808 | struct tid_group **grp) |
| 809 | { |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 810 | struct hfi1_ctxtdata *uctxt = fd->uctxt; |
| 811 | struct hfi1_devdata *dd = uctxt->dd; |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 812 | struct tid_rb_node *node; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 813 | u8 tidctrl = EXP_TID_GET(tidinfo, CTRL); |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 814 | u32 tididx = EXP_TID_GET(tidinfo, IDX) << 1, rcventry; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 815 | |
| 816 | if (tididx >= uctxt->expected_count) { |
| 817 | dd_dev_err(dd, "Invalid RcvArray entry (%u) index for ctxt %u\n", |
| 818 | tididx, uctxt->ctxt); |
| 819 | return -EINVAL; |
| 820 | } |
| 821 | |
| 822 | if (tidctrl == 0x3) |
| 823 | return -EINVAL; |
| 824 | |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 825 | rcventry = tididx + (tidctrl - 1); |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 826 | |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 827 | node = fd->entry_to_rb[rcventry]; |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 828 | if (!node || node->rcventry != (uctxt->expected_base + rcventry)) |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 829 | return -EBADF; |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 830 | |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 831 | if (grp) |
| 832 | *grp = node->grp; |
Ira Weiny | 2677a76 | 2016-07-28 15:21:26 -0400 | [diff] [blame] | 833 | |
| 834 | if (!fd->handler) |
| 835 | cacheless_tid_rb_remove(fd, node); |
| 836 | else |
| 837 | hfi1_mmu_rb_remove(fd->handler, &node->mmu); |
| 838 | |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 839 | return 0; |
| 840 | } |
| 841 | |
Ira Weiny | 5ed3b15 | 2016-07-28 12:27:32 -0400 | [diff] [blame] | 842 | static void clear_tid_node(struct hfi1_filedata *fd, struct tid_rb_node *node) |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 843 | { |
| 844 | struct hfi1_ctxtdata *uctxt = fd->uctxt; |
| 845 | struct hfi1_devdata *dd = uctxt->dd; |
| 846 | |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 847 | trace_hfi1_exp_tid_unreg(uctxt->ctxt, fd->subctxt, node->rcventry, |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 848 | node->npages, node->mmu.addr, node->phys, |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 849 | node->dma_addr); |
| 850 | |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 851 | /* |
| 852 | * Make sure device has seen the write before we unpin the |
| 853 | * pages. |
| 854 | */ |
Mike Marciniszyn | cb51c5d | 2017-07-24 07:45:31 -0700 | [diff] [blame] | 855 | hfi1_put_tid(dd, node->rcventry, PT_INVALID_FLUSH, 0, 0); |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 856 | |
Harish Chegondi | 9dc1170 | 2017-08-21 18:26:51 -0700 | [diff] [blame] | 857 | unpin_rcv_pages(fd, NULL, node, 0, node->npages, true); |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 858 | |
| 859 | node->grp->used--; |
| 860 | node->grp->map &= ~(1 << (node->rcventry - node->grp->base)); |
| 861 | |
| 862 | if (node->grp->used == node->grp->size - 1) |
| 863 | tid_group_move(node->grp, &uctxt->tid_full_list, |
| 864 | &uctxt->tid_used_list); |
| 865 | else if (!node->grp->used) |
| 866 | tid_group_move(node->grp, &uctxt->tid_used_list, |
| 867 | &uctxt->tid_group_list); |
| 868 | kfree(node); |
| 869 | } |
| 870 | |
Ira Weiny | 2677a76 | 2016-07-28 15:21:26 -0400 | [diff] [blame] | 871 | /* |
| 872 | * As a simple helper for hfi1_user_exp_rcv_free, this function deals with |
| 873 | * clearing nodes in the non-cached case. |
| 874 | */ |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 875 | static void unlock_exp_tids(struct hfi1_ctxtdata *uctxt, |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 876 | struct exp_tid_set *set, |
| 877 | struct hfi1_filedata *fd) |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 878 | { |
| 879 | struct tid_group *grp, *ptr; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 880 | int i; |
| 881 | |
| 882 | list_for_each_entry_safe(grp, ptr, &set->list, list) { |
| 883 | list_del_init(&grp->list); |
| 884 | |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 885 | for (i = 0; i < grp->size; i++) { |
| 886 | if (grp->map & (1 << i)) { |
| 887 | u16 rcventry = grp->base + i; |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 888 | struct tid_rb_node *node; |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 889 | |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 890 | node = fd->entry_to_rb[rcventry - |
| 891 | uctxt->expected_base]; |
| 892 | if (!node || node->rcventry != rcventry) |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 893 | continue; |
Ira Weiny | 2677a76 | 2016-07-28 15:21:26 -0400 | [diff] [blame] | 894 | |
| 895 | cacheless_tid_rb_remove(fd, node); |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 896 | } |
| 897 | } |
Mitko Haralanov | f88e0c8 | 2016-02-05 11:57:52 -0500 | [diff] [blame] | 898 | } |
| 899 | } |
| 900 | |
Ira Weiny | 2677a76 | 2016-07-28 15:21:26 -0400 | [diff] [blame] | 901 | /* |
| 902 | * Always return 0 from this function. A non-zero return indicates that the |
| 903 | * remove operation will be called and that memory should be unpinned. |
| 904 | * However, the driver cannot unpin out from under PSM. Instead, retain the |
| 905 | * memory (by returning 0) and inform PSM that the memory is going away. PSM |
| 906 | * will call back later when it has removed the memory from its list. |
| 907 | */ |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 908 | static int tid_rb_invalidate(void *arg, struct mmu_rb_node *mnode) |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 909 | { |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 910 | struct hfi1_filedata *fdata = arg; |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 911 | struct hfi1_ctxtdata *uctxt = fdata->uctxt; |
| 912 | struct tid_rb_node *node = |
| 913 | container_of(mnode, struct tid_rb_node, mmu); |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 914 | |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 915 | if (node->freed) |
| 916 | return 0; |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 917 | |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 918 | trace_hfi1_exp_tid_inval(uctxt->ctxt, fdata->subctxt, node->mmu.addr, |
| 919 | node->rcventry, node->npages, node->dma_addr); |
| 920 | node->freed = true; |
Mitko Haralanov | b5eb3b2 | 2016-02-05 11:57:55 -0500 | [diff] [blame] | 921 | |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 922 | spin_lock(&fdata->invalid_lock); |
| 923 | if (fdata->invalid_tid_idx < uctxt->expected_count) { |
| 924 | fdata->invalid_tids[fdata->invalid_tid_idx] = |
| 925 | rcventry2tidinfo(node->rcventry - uctxt->expected_base); |
| 926 | fdata->invalid_tids[fdata->invalid_tid_idx] |= |
| 927 | EXP_TID_SET(LEN, node->npages); |
| 928 | if (!fdata->invalid_tid_idx) { |
| 929 | unsigned long *ev; |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 930 | |
Mitko Haralanov | b5eb3b2 | 2016-02-05 11:57:55 -0500 | [diff] [blame] | 931 | /* |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 932 | * hfi1_set_uevent_bits() sets a user event flag |
| 933 | * for all processes. Because calling into the |
| 934 | * driver to process TID cache invalidations is |
| 935 | * expensive and TID cache invalidations are |
| 936 | * handled on a per-process basis, we can |
| 937 | * optimize this to set the flag only for the |
| 938 | * process in question. |
Mitko Haralanov | b5eb3b2 | 2016-02-05 11:57:55 -0500 | [diff] [blame] | 939 | */ |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 940 | ev = uctxt->dd->events + |
Michael J. Ruhl | 21e5acc | 2017-09-26 07:00:56 -0700 | [diff] [blame] | 941 | (uctxt_offset(uctxt) + fdata->subctxt); |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 942 | set_bit(_HFI1_EVENT_TID_MMU_NOTIFY_BIT, ev); |
Mitko Haralanov | b5eb3b2 | 2016-02-05 11:57:55 -0500 | [diff] [blame] | 943 | } |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 944 | fdata->invalid_tid_idx++; |
Mitko Haralanov | b5eb3b2 | 2016-02-05 11:57:55 -0500 | [diff] [blame] | 945 | } |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 946 | spin_unlock(&fdata->invalid_lock); |
| 947 | return 0; |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 948 | } |
| 949 | |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 950 | static int tid_rb_insert(void *arg, struct mmu_rb_node *node) |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 951 | { |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 952 | struct hfi1_filedata *fdata = arg; |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 953 | struct tid_rb_node *tnode = |
| 954 | container_of(node, struct tid_rb_node, mmu); |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 955 | u32 base = fdata->uctxt->expected_base; |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 956 | |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 957 | fdata->entry_to_rb[tnode->rcventry - base] = tnode; |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 958 | return 0; |
| 959 | } |
| 960 | |
Ira Weiny | 2677a76 | 2016-07-28 15:21:26 -0400 | [diff] [blame] | 961 | static void cacheless_tid_rb_remove(struct hfi1_filedata *fdata, |
| 962 | struct tid_rb_node *tnode) |
| 963 | { |
| 964 | u32 base = fdata->uctxt->expected_base; |
| 965 | |
| 966 | fdata->entry_to_rb[tnode->rcventry - base] = NULL; |
| 967 | clear_tid_node(fdata, tnode); |
| 968 | } |
| 969 | |
Dean Luick | 082b353 | 2016-07-28 15:21:25 -0400 | [diff] [blame] | 970 | static void tid_rb_remove(void *arg, struct mmu_rb_node *node) |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 971 | { |
Dean Luick | e0b09ac | 2016-07-28 15:21:20 -0400 | [diff] [blame] | 972 | struct hfi1_filedata *fdata = arg; |
Mitko Haralanov | 06e0ffa | 2016-03-08 11:14:20 -0800 | [diff] [blame] | 973 | struct tid_rb_node *tnode = |
| 974 | container_of(node, struct tid_rb_node, mmu); |
Mitko Haralanov | f727a0c | 2016-02-05 11:57:46 -0500 | [diff] [blame] | 975 | |
Ira Weiny | 2677a76 | 2016-07-28 15:21:26 -0400 | [diff] [blame] | 976 | cacheless_tid_rb_remove(fdata, tnode); |
Mitko Haralanov | a92ba6d | 2016-02-03 14:34:41 -0800 | [diff] [blame] | 977 | } |