Print this page
11909 THREAD_KPRI_RELEASE does nothing of the sort
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/condvar.c
          +++ new/usr/src/uts/common/os/condvar.c
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /*
  28   28   * Copyright (c) 2012 by Delphix. All rights reserved.
       29 + * Copyright 2019 Joyent, Inc.
  29   30   */
  30   31  
  31   32  #include <sys/thread.h>
  32   33  #include <sys/proc.h>
  33   34  #include <sys/debug.h>
  34   35  #include <sys/cmn_err.h>
  35   36  #include <sys/systm.h>
  36   37  #include <sys/sobject.h>
  37   38  #include <sys/sleepq.h>
  38   39  #include <sys/cpuvar.h>
↓ open down ↓ 415 lines elided ↑ open up ↑
 454  455          }
 455  456          lwp->lwp_asleep = 0;
 456  457          lwp->lwp_sysabort = 0;
 457  458          if (rval <= 0 && signalled)     /* avoid consuming the cv_signal() */
 458  459                  cv_signal(cvp);
 459  460          return (rval);
 460  461  }
 461  462  
 462  463  /*
 463  464   * Returns:
 464      - *      Function result in order of precedence:
      465 + *      Function result in order of precedence:
 465  466   *               0 if a signal was received
 466  467   *              -1 if timeout occured
 467  468   *              >0 if awakened via cv_signal() or cv_broadcast().
 468  469   *                 (returns time remaining)
 469  470   *
 470  471   * cv_timedwait_sig() is now part of the DDI.
 471  472   *
 472  473   * This function is now just a wrapper for cv_timedwait_sig_hires().
 473  474   */
 474  475  clock_t
↓ open down ↓ 70 lines elided ↑ open up ↑
 545  546          if (lwp == NULL || (p->p_flag & SSYS)) {
 546  547                  cv_wait(cvp, mp);
 547  548                  return (rval);
 548  549          }
 549  550          ASSERT(t->t_intr == NULL);
 550  551  
 551  552          cancel_pending = schedctl_cancel_pending();
 552  553          lwp->lwp_asleep = 1;
 553  554          lwp->lwp_sysabort = 0;
 554  555          thread_lock(t);
 555      -        t->t_kpri_req = 0;      /* don't need kernel priority */
 556  556          cv_block_sig(t, (condvar_impl_t *)cvp);
 557  557          /* I can be swapped now */
 558  558          curthread->t_schedflag &= ~TS_DONT_SWAP;
 559  559          thread_unlock_nopreempt(t);
 560  560          mutex_exit(mp);
 561  561          if (ISSIG(t, JUSTLOOKING) || MUSTRETURN(p, t) || cancel_pending)
 562  562                  setrun(t);
 563  563          /* ASSERT(no locks are held) */
 564  564          swtch();
 565  565          signalled = (t->t_schedflag & TS_SIGNALLED);
↓ open down ↓ 172 lines elided ↑ open up ↑
 738  738          mutex_exit(&p->p_lock);
 739  739          mutex_enter(mp);
 740  740  }
 741  741  
 742  742  /*
 743  743   * Like cv_timedwait_sig(), but takes an absolute hires future time
 744  744   * rather than a future time in clock ticks.  Will not return showing
 745  745   * that a timeout occurred until the future time is passed.
 746  746   * If 'when' is a NULL pointer, no timeout will occur.
 747  747   * Returns:
 748      - *      Function result in order of precedence:
      748 + *      Function result in order of precedence:
 749  749   *               0 if a signal was received
 750  750   *              -1 if timeout occured
 751  751   *              >0 if awakened via cv_signal() or cv_broadcast()
 752  752   *                 or by a spurious wakeup.
 753  753   *                 (might return time remaining)
 754  754   * As a special test, if someone abruptly resets the system time
 755  755   * (but not through adjtime(2); drifting of the clock is allowed and
 756  756   * expected [see timespectohz_adj()]), then we force a return of -1
 757  757   * so the caller can return a premature timeout to the calling process
 758  758   * so it can reevaluate the situation in light of the new system time.
 759  759   * (The system clock has been reset if timecheck != timechanged.)
 760  760   *
 761  761   * Generally, cv_timedwait_sig_hrtime() should be used instead of this
 762  762   * routine.  It waits based on hrtime rather than wall-clock time and therefore
 763  763   * does not need to deal with the time changing.
 764  764   */
 765  765  int
 766      -cv_waituntil_sig(kcondvar_t *cvp, kmutex_t *mp,
 767      -        timestruc_t *when, int timecheck)
      766 +cv_waituntil_sig(kcondvar_t *cvp, kmutex_t *mp, timestruc_t *when,
      767 +    int timecheck)
 768  768  {
 769  769          timestruc_t now;
 770  770          timestruc_t delta;
 771  771          hrtime_t interval;
 772  772          int rval;
 773  773  
 774  774          if (when == NULL)
 775  775                  return (cv_wait_sig_swap(cvp, mp));
 776  776  
 777  777          gethrestime(&now);
↓ open down ↓ 44 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX