Print this page
8368 remove warlock leftovers from usr/src/uts

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ib/adapters/tavor/tavor_umap.c
          +++ new/usr/src/uts/common/io/ib/adapters/tavor/tavor_umap.c
↓ open down ↓ 446 lines elided ↑ open up ↑
 447  447          key  = off >> PAGESHIFT;
 448  448          type = key & MLNX_UMAP_RSRC_TYPE_MASK;
 449  449          key  = key >> MLNX_UMAP_RSRC_TYPE_SHIFT;
 450  450  
 451  451          /*
 452  452           * Allocate an entry to track the mapping and unmapping (specifically,
 453  453           * partial unmapping) of this resource.
 454  454           */
 455  455          dvm_track = (tavor_devmap_track_t *)kmem_zalloc(
 456  456              sizeof (tavor_devmap_track_t), KM_SLEEP);
 457      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*dvm_track))
 458  457          dvm_track->tdt_offset = off;
 459  458          dvm_track->tdt_state  = state;
 460  459          dvm_track->tdt_refcnt = 1;
 461  460          mutex_init(&dvm_track->tdt_lock, NULL, MUTEX_DRIVER,
 462  461              DDI_INTR_PRI(state->ts_intrmsi_pri));
 463  462  
 464  463          /*
 465  464           * Depending of the type of resource that has been mapped out, we
 466  465           * need to update the QP or CQ handle to reflect that it has, in
 467  466           * fact, been mapped.  This allows the driver code which frees a QP
↓ open down ↓ 93 lines elided ↑ open up ↑
 561  560          uint_t                  maxprot;
 562  561          int                     status;
 563  562  
 564  563          TAVOR_TNF_ENTER(tavor_devmap_umem_dup);
 565  564  
 566  565          /*
 567  566           * Extract the Tavor softstate pointer from "Tavor devmap tracking
 568  567           * structure" (in "pvtp").
 569  568           */
 570  569          dvm_track = (tavor_devmap_track_t *)pvtp;
 571      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*dvm_track))
 572  570          state = dvm_track->tdt_state;
 573  571  
 574  572          /*
 575  573           * Since this devmap_dup() entry point is generally called
 576  574           * when a process does fork(2), it is incumbent upon the driver
 577  575           * to insure that the child does not inherit a valid copy of
 578  576           * the parent's QP or CQ resource.  This is accomplished by using
 579  577           * devmap_devmem_remap() to invalidate the child's mapping to the
 580  578           * kernel memory.
 581  579           */
↓ open down ↓ 9 lines elided ↑ open up ↑
 591  589          /*
 592  590           * Allocate a new entry to track the subsequent unmapping
 593  591           * (specifically, all partial unmappings) of the child's newly
 594  592           * invalidated resource.  Note: Setting the "tdt_size" field to
 595  593           * zero here is an indication to the devmap_unmap() entry point
 596  594           * that this mapping is invalid, and that its subsequent unmapping
 597  595           * should not affect any of the parent's CQ or QP resources.
 598  596           */
 599  597          new_dvm_track = (tavor_devmap_track_t *)kmem_zalloc(
 600  598              sizeof (tavor_devmap_track_t), KM_SLEEP);
 601      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*new_dvm_track))
 602  599          new_dvm_track->tdt_offset = 0;
 603  600          new_dvm_track->tdt_state  = state;
 604  601          new_dvm_track->tdt_refcnt = 1;
 605  602          new_dvm_track->tdt_size   = 0;
 606  603          mutex_init(&new_dvm_track->tdt_lock, NULL, MUTEX_DRIVER,
 607  604              DDI_INTR_PRI(state->ts_intrmsi_pri));
 608  605          *new_pvtp = new_dvm_track;
 609  606  
 610  607          TAVOR_TNF_EXIT(tavor_devmap_umem_dup);
 611  608          return (DDI_SUCCESS);
↓ open down ↓ 21 lines elided ↑ open up ↑
 633  630          uint_t                  size;
 634  631          int                     status;
 635  632  
 636  633          TAVOR_TNF_ENTER(tavor_devmap_umem_unmap);
 637  634  
 638  635          /*
 639  636           * Extract the Tavor softstate pointer from "Tavor devmap tracking
 640  637           * structure" (in "pvtp").
 641  638           */
 642  639          dvm_track = (tavor_devmap_track_t *)pvtp;
 643      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*dvm_track))
 644  640          state     = dvm_track->tdt_state;
 645  641  
 646  642          /*
 647  643           * Extract the "offset" from the "Tavor devmap tracking structure".
 648  644           * Note: The input argument "off" is ignored here because the
 649  645           * Tavor mapping interfaces define a very specific meaning to
 650  646           * each "logical offset".  Also extract the "key" and "type" encoded
 651  647           * in the logical offset.
 652  648           */
 653  649          key  = dvm_track->tdt_offset >> PAGESHIFT;
↓ open down ↓ 181 lines elided ↑ open up ↑
 835  831          /*
 836  832           * Allocate an entry to track the mapping and unmapping of this
 837  833           * resource.  Note:  We don't need to initialize the "refcnt" or
 838  834           * "offset" fields here, nor do we need to initialize the mutex
 839  835           * used with the "refcnt".  Since UAR pages are single pages, they
 840  836           * are not subject to "partial" unmappings.  This makes these other
 841  837           * fields unnecessary.
 842  838           */
 843  839          dvm_track = (tavor_devmap_track_t *)kmem_zalloc(
 844  840              sizeof (tavor_devmap_track_t), KM_SLEEP);
 845      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*dvm_track))
 846  841          dvm_track->tdt_state  = state;
 847  842          dvm_track->tdt_size   = PAGESIZE;
 848  843  
 849  844          /*
 850  845           * Pass the private "Tavor devmap tracking structure" back.  This
 851  846           * pointer will be returned in a subsequent "unmap" callback.
 852  847           */
 853  848          *pvtp = dvm_track;
 854  849  
 855  850          TAVOR_TNF_EXIT(tavor_devmap_devmem_map);
↓ open down ↓ 23 lines elided ↑ open up ↑
 879  874           * here, it means that the mapping corresponds to an invalid mapping.
 880  875           * In this case, it can be safely ignored ("new_pvtp" set to NULL).
 881  876           */
 882  877          dvm_track = (tavor_devmap_track_t *)pvtp;
 883  878          if (dvm_track == NULL) {
 884  879                  *new_pvtp = NULL;
 885  880                  TAVOR_TNF_EXIT(tavor_devmap_devmem_dup);
 886  881                  return (DDI_SUCCESS);
 887  882          }
 888  883  
 889      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*dvm_track))
 890  884          state = dvm_track->tdt_state;
 891  885  
 892  886          /*
 893  887           * Since this devmap_dup() entry point is generally called
 894  888           * when a process does fork(2), it is incumbent upon the driver
 895  889           * to insure that the child does not inherit a valid copy of
 896  890           * the parent's resource.  This is accomplished by using
 897  891           * devmap_devmem_remap() to invalidate the child's mapping to the
 898  892           * kernel memory.
 899  893           */
↓ open down ↓ 35 lines elided ↑ open up ↑
 935  929          TAVOR_TNF_ENTER(tavor_devmap_devmem_unmap);
 936  930  
 937  931          /*
 938  932           * Free up the "Tavor devmap tracking structure" (in "pvtp").
 939  933           * There cannot be "partial" unmappings here because all UAR pages
 940  934           * are single pages.  Note: If the tracking structure is NULL here,
 941  935           * it means that the mapping corresponds to an invalid mapping.  In
 942  936           * this case, it can be safely ignored.
 943  937           */
 944  938          dvm_track = (tavor_devmap_track_t *)pvtp;
 945      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*dvm_track))
 946  939          if (dvm_track == NULL) {
 947  940                  TAVOR_TNF_EXIT(tavor_devmap_devmem_unmap);
 948  941                  return;
 949  942          }
 950  943  
 951  944          kmem_free(dvm_track, sizeof (tavor_devmap_track_t));
 952  945          TAVOR_TNF_EXIT(tavor_devmap_devmem_unmap);
 953  946  }
 954  947  
 955  948  
↓ open down ↓ 86 lines elided ↑ open up ↑
1042 1035                  return (IBT_MR_HDL_INVALID);
1043 1036          }
1044 1037  
1045 1038          /* Check for valid MR input structure size */
1046 1039          if (data_sz < sizeof (ibt_mr_data_in_t)) {
1047 1040                  TNF_PROBE_0(tavor_umap_mr_data_in_invdatasz_fail,
1048 1041                      TAVOR_TNF_ERROR, "");
1049 1042                  TAVOR_TNF_EXIT(tavor_umap_mr_data_in);
1050 1043                  return (IBT_INSUFF_RESOURCE);
1051 1044          }
1052      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*data))
1053 1045  
1054 1046          /*
1055 1047           * Ensure that the MR corresponds to userland memory and that it is
1056 1048           * a currently valid memory region as well.
1057 1049           */
1058 1050          mutex_enter(&mr->mr_lock);
1059 1051          if ((mr->mr_is_umem == 0) || (mr->mr_umemcookie == NULL)) {
1060 1052                  mutex_exit(&mr->mr_lock);
1061 1053                  TNF_PROBE_0(tavor_umap_mr_data_in_invumem_fail,
1062 1054                      TAVOR_TNF_ERROR, "");
↓ open down ↓ 129 lines elided ↑ open up ↑
1192 1184                  return (IBT_CQ_HDL_INVALID);
1193 1185          }
1194 1186  
1195 1187          /* Check for valid CQ mapping structure size */
1196 1188          if (data_sz < sizeof (mlnx_umap_cq_data_out_t)) {
1197 1189                  TNF_PROBE_0(tavor_umap_cq_data_out_invdatasz_fail,
1198 1190                      TAVOR_TNF_ERROR, "");
1199 1191                  TAVOR_TNF_EXIT(tavor_umap_cq_data_out);
1200 1192                  return (IBT_INSUFF_RESOURCE);
1201 1193          }
1202      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*data))
1203 1194  
1204 1195          /*
1205 1196           * If it has passed all the above checks, then fill in all the useful
1206 1197           * mapping information (including the mapping offset that will be
1207 1198           * passed back to the devmap() interface during a subsequent mmap()
1208 1199           * call.
1209 1200           *
1210 1201           * The "offset" for CQ mmap()'s looks like this:
1211 1202           * +----------------------------------------+--------+--------------+
1212 1203           * |               CQ Number                |  0x33  | Reserved (0) |
↓ open down ↓ 35 lines elided ↑ open up ↑
1248 1239                  return (IBT_QP_HDL_INVALID);
1249 1240          }
1250 1241  
1251 1242          /* Check for valid QP mapping structure size */
1252 1243          if (data_sz < sizeof (mlnx_umap_qp_data_out_t)) {
1253 1244                  TNF_PROBE_0(tavor_umap_qp_data_out_invdatasz_fail,
1254 1245                      TAVOR_TNF_ERROR, "");
1255 1246                  TAVOR_TNF_EXIT(tavor_umap_qp_data_out);
1256 1247                  return (IBT_INSUFF_RESOURCE);
1257 1248          }
1258      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*data))
1259 1249  
1260 1250          /*
1261 1251           * If it has passed all the checks, then fill in all the useful
1262 1252           * mapping information (including the mapping offset that will be
1263 1253           * passed back to the devmap() interface during a subsequent mmap()
1264 1254           * call.
1265 1255           *
1266 1256           * The "offset" for QP mmap()'s looks like this:
1267 1257           * +----------------------------------------+--------+--------------+
1268 1258           * |               QP Number                |  0x44  | Reserved (0) |
↓ open down ↓ 64 lines elided ↑ open up ↑
1333 1323                  return (IBT_SRQ_HDL_INVALID);
1334 1324          }
1335 1325  
1336 1326          /* Check for valid SRQ mapping structure size */
1337 1327          if (data_sz < sizeof (mlnx_umap_srq_data_out_t)) {
1338 1328                  TNF_PROBE_0(tavor_umap_srq_data_out_invdatasz_fail,
1339 1329                      TAVOR_TNF_ERROR, "");
1340 1330                  TAVOR_TNF_EXIT(tavor_umap_srq_data_out);
1341 1331                  return (IBT_INSUFF_RESOURCE);
1342 1332          }
1343      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*data))
1344 1333  
1345 1334          /*
1346 1335           * If it has passed all the checks, then fill in all the useful
1347 1336           * mapping information (including the mapping offset that will be
1348 1337           * passed back to the devmap() interface during a subsequent mmap()
1349 1338           * call.
1350 1339           *
1351 1340           * The "offset" for SRQ mmap()'s looks like this:
1352 1341           * +----------------------------------------+--------+--------------+
1353 1342           * |               SRQ Number               |  0x66  | Reserved (0) |
↓ open down ↓ 42 lines elided ↑ open up ↑
1396 1385                  return (IBT_PD_HDL_INVALID);
1397 1386          }
1398 1387  
1399 1388          /* Check for valid PD mapping structure size */
1400 1389          if (data_sz < sizeof (mlnx_umap_pd_data_out_t)) {
1401 1390                  TNF_PROBE_0(tavor_umap_pd_data_out_invdatasz_fail,
1402 1391                      TAVOR_TNF_ERROR, "");
1403 1392                  TAVOR_TNF_EXIT(tavor_umap_pd_data_out);
1404 1393                  return (IBT_INSUFF_RESOURCE);
1405 1394          }
1406      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*data))
1407 1395  
1408 1396          /*
1409 1397           * If it has passed all the checks, then fill the PD table index
1410 1398           * (the PD table allocated index for the PD pd_pdnum)
1411 1399           */
1412 1400          data->mpd_rev   = MLNX_UMAP_IF_VERSION;
1413 1401          data->mpd_pdnum = pd->pd_pdnum;
1414 1402  
1415 1403          TAVOR_TNF_EXIT(tavor_umap_pd_data_out);
1416 1404          return (DDI_SUCCESS);
↓ open down ↓ 62 lines elided ↑ open up ↑
1479 1467  
1480 1468          TAVOR_TNF_ENTER(tavor_umap_db_alloc);
1481 1469  
1482 1470          /* Allocate an entry to add to the "userland resources database" */
1483 1471          umapdb = kmem_zalloc(sizeof (tavor_umap_db_entry_t), KM_NOSLEEP);
1484 1472          if (umapdb == NULL) {
1485 1473                  TNF_PROBE_0(tavor_umap_db_alloc_kmz_fail, TAVOR_TNF_ERROR, "");
1486 1474                  TAVOR_TNF_EXIT(tavor_umap_db_alloc);
1487 1475                  return (NULL);
1488 1476          }
1489      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*umapdb))
1490 1477  
1491 1478          /* Fill in the fields in the database entry */
1492 1479          umapdb->tdbe_common.tdb_instance  = instance;
1493 1480          umapdb->tdbe_common.tdb_type      = type;
1494 1481          umapdb->tdbe_common.tdb_key       = key;
1495 1482          umapdb->tdbe_common.tdb_value     = value;
1496 1483  
1497 1484          TAVOR_TNF_EXIT(tavor_umap_db_alloc);
1498 1485          return (umapdb);
1499 1486  }
↓ open down ↓ 39 lines elided ↑ open up ↑
1539 1526  void
1540 1527  tavor_umap_db_add_nolock(tavor_umap_db_entry_t *umapdb)
1541 1528  {
1542 1529          tavor_umap_db_query_t   query;
1543 1530          avl_index_t             where;
1544 1531  
1545 1532          TAVOR_TNF_ENTER(tavor_umap_db_add_nolock);
1546 1533  
1547 1534          ASSERT(MUTEX_HELD(&tavor_userland_rsrc_db.tdl_umapdb_lock));
1548 1535  
1549      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*umapdb))
1550      -
1551 1536          /*
1552 1537           * Copy the common portion of the "to-be-added" database entry
1553 1538           * into the "tavor_umap_db_query_t" structure.  We use this structure
1554 1539           * (with no flags set) to find the appropriate location in the
1555 1540           * "userland resources database" for the new entry to be added.
1556 1541           *
1557 1542           * Note: we expect that this entry should not be found in the
1558 1543           * database (unless something bad has happened).
1559 1544           */
1560 1545          query.tqdb_common = umapdb->tdbe_common;
↓ open down ↓ 63 lines elided ↑ open up ↑
1624 1609          /*
1625 1610           * Perform the database query.  If no entry is found, then
1626 1611           * return failure, else continue.
1627 1612           */
1628 1613          entry = (tavor_umap_db_entry_t *)avl_find(
1629 1614              &tavor_userland_rsrc_db.tdl_umapdb_avl, &query, &where);
1630 1615          if (entry == NULL) {
1631 1616                  TAVOR_TNF_EXIT(tavor_umap_db_find_nolock);
1632 1617                  return (DDI_FAILURE);
1633 1618          }
1634      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*entry))
1635 1619  
1636 1620          /*
1637 1621           * If the flags argument specifies that the entry should
1638 1622           * be removed if found, then call avl_remove() to remove
1639 1623           * the entry from the database.
1640 1624           */
1641 1625          if (flags & TAVOR_UMAP_DB_REMOVE) {
1642 1626  
1643 1627                  avl_remove(&tavor_userland_rsrc_db.tdl_umapdb_avl, entry);
1644 1628  
↓ open down ↓ 46 lines elided ↑ open up ↑
1691 1675          /*
1692 1676           * If this was userland memory, then we need to remove its entry
1693 1677           * from the "userland resources database".  Note:  We use the
1694 1678           * TAVOR_UMAP_DB_IGNORE_INSTANCE flag here because we don't know
1695 1679           * which instance was used when the entry was added (but we want
1696 1680           * to know after the entry is found using the other search criteria).
1697 1681           */
1698 1682          status = tavor_umap_db_find(0, (uint64_t)(uintptr_t)umem_cookie,
1699 1683              MLNX_UMAP_MRMEM_RSRC, &value, (TAVOR_UMAP_DB_REMOVE |
1700 1684              TAVOR_UMAP_DB_IGNORE_INSTANCE), &umapdb);
1701      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*umapdb))
1702 1685          if (status == DDI_SUCCESS) {
1703 1686                  instance = umapdb->tdbe_common.tdb_instance;
1704 1687                  state = ddi_get_soft_state(tavor_statep, instance);
1705 1688                  if (state == NULL) {
1706 1689                          cmn_err(CE_WARN, "Unable to match Tavor instance\n");
1707 1690                          TNF_PROBE_0(tavor_umap_umemlock_cb_gss_fail,
1708 1691                              TAVOR_TNF_ERROR, "");
1709 1692                          TAVOR_TNF_EXIT(tavor_umap_umemlock_cb);
1710 1693                          return;
1711 1694                  }
↓ open down ↓ 48 lines elided ↑ open up ↑
1760 1743   *    Context: Can be called from user or kernel context.
1761 1744   */
1762 1745  static int
1763 1746  tavor_umap_db_compare(const void *q, const void *e)
1764 1747  {
1765 1748          tavor_umap_db_common_t  *entry_common, *query_common;
1766 1749          uint_t                  query_flags;
1767 1750  
1768 1751          TAVOR_TNF_ENTER(tavor_umap_db_compare);
1769 1752  
1770      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*((tavor_umap_db_query_t *)q)))
1771      -
1772 1753          entry_common = &((tavor_umap_db_entry_t *)e)->tdbe_common;
1773 1754          query_common = &((tavor_umap_db_query_t *)q)->tqdb_common;
1774 1755          query_flags  = ((tavor_umap_db_query_t *)q)->tqdb_flags;
1775 1756  
1776 1757          /*
1777 1758           * The first comparison is done on the "key" value in "query"
1778 1759           * and "entry".  If they are not equal, then the appropriate
1779 1760           * search direction is returned.  Else, we continue by
1780 1761           * comparing "type".
1781 1762           */
↓ open down ↓ 215 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX