Print this page
5042 stop using deprecated atomic functions

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/cyclic.c
          +++ new/usr/src/uts/common/os/cyclic.c
↓ open down ↓ 650 lines elided ↑ open up ↑
 651  651  static void
 652  652  cyclic_coverage(char *why, int level, uint64_t arg0, uint64_t arg1)
 653  653  {
 654  654          uint_t ndx, orig;
 655  655  
 656  656          for (ndx = orig = cyclic_coverage_hash(why) % CY_NCOVERAGE; ; ) {
 657  657                  if (cyc_coverage[ndx].cyv_why == why)
 658  658                          break;
 659  659  
 660  660                  if (cyc_coverage[ndx].cyv_why != NULL ||
 661      -                    casptr(&cyc_coverage[ndx].cyv_why, NULL, why) != NULL) {
      661 +                    atomic_cas_ptr(&cyc_coverage[ndx].cyv_why, NULL, why) !=
      662 +                    NULL) {
 662  663  
 663  664                          if (++ndx == CY_NCOVERAGE)
 664  665                                  ndx = 0;
 665  666  
 666  667                          if (ndx == orig)
 667  668                                  panic("too many cyclic coverage points");
 668  669                          continue;
 669  670                  }
 670  671  
 671  672                  /*
↓ open down ↓ 540 lines elided ↑ open up ↑
1212 1213                                  ASSERT(intr_resized == 0);
1213 1214                                  intr_resized = 1;
1214 1215                                  cyclics = cpu->cyp_cyclics;
1215 1216                                  cyclic = &cyclics[buf[consmasked]];
1216 1217                                  ASSERT(cyclic->cy_handler == handler);
1217 1218                                  ASSERT(cyclic->cy_arg == arg);
1218 1219                                  goto reread;
1219 1220                          }
1220 1221  
1221 1222                          if ((opend =
1222      -                            cas32(&cyclic->cy_pend, pend, npend)) != pend) {
     1223 +                            atomic_cas_32(&cyclic->cy_pend, pend, npend)) !=
     1224 +                            pend) {
1223 1225                                  /*
1224      -                                 * Our cas32 can fail for one of several
     1226 +                                 * Our atomic_cas_32 can fail for one of several
1225 1227                                   * reasons:
1226 1228                                   *
1227 1229                                   *  (a) An intervening high level bumped up the
1228 1230                                   *      pend count on this cyclic.  In this
1229 1231                                   *      case, we will see a higher pend.
1230 1232                                   *
1231 1233                                   *  (b) The cyclics array has been yanked out
1232 1234                                   *      from underneath us by a resize
1233 1235                                   *      operation.  In this case, pend is 0 and
1234 1236                                   *      cyp_state is CYS_EXPANDING.
↓ open down ↓ 69 lines elided ↑ open up ↑
1304 1306          ASSERT(!(intr_resized == 1 && resized == 0));
1305 1307  
1306 1308          if (resized) {
1307 1309                  uint32_t lev, nlev;
1308 1310  
1309 1311                  ASSERT(cpu->cyp_state == CYS_EXPANDING);
1310 1312  
1311 1313                  do {
1312 1314                          lev = cpu->cyp_modify_levels;
1313 1315                          nlev = lev + 1;
1314      -                } while (cas32(&cpu->cyp_modify_levels, lev, nlev) != lev);
     1316 +                } while (atomic_cas_32(&cpu->cyp_modify_levels, lev, nlev) !=
     1317 +                    lev);
1315 1318  
1316 1319                  /*
1317 1320                   * If we are the last soft level to see the modification,
1318 1321                   * post on cyp_modify_wait.  Otherwise, (if we're not
1319 1322                   * already at low level), post down to the next soft level.
1320 1323                   */
1321 1324                  if (nlev == CY_SOFT_LEVELS) {
1322 1325                          CYC_TRACE0(cpu, level, "resize-kick");
1323 1326                          sema_v(&cpu->cyp_modify_wait);
1324 1327                  } else {
↓ open down ↓ 2303 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX