Print this page
9249 System crash dump to NVME not working
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Ryan Zezeski <rpz@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/semaphore.c
          +++ new/usr/src/uts/common/os/semaphore.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
       27 +/*
       28 + * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
       29 + */
  28   30  
  29   31  /*
  30   32   * This file contains the semaphore operations.
  31   33   */
  32   34  
  33   35  #include <sys/param.h>
  34   36  #include <sys/types.h>
  35   37  #include <sys/systm.h>
  36   38  #include <sys/schedctl.h>
  37   39  #include <sys/semaphore.h>
↓ open down ↓ 182 lines elided ↑ open up ↑
 220  222   * the semaphore is granted when the semaphore's
 221  223   * count is greater than zero and blocks when equal
 222  224   * to zero.
 223  225   */
 224  226  void
 225  227  sema_p(ksema_t *sp)
 226  228  {
 227  229          sema_impl_t     *s;
 228  230          disp_lock_t     *sqlp;
 229  231  
      232 +        /* no-op during panic */
      233 +        if (panicstr)
      234 +                return;
      235 +
 230  236          s = (sema_impl_t *)sp;
 231  237          sqlp = &SQHASH(s)->sq_lock;
 232  238          disp_lock_enter(sqlp);
 233  239          ASSERT(s->s_count >= 0);
 234  240          while (s->s_count == 0) {
 235      -                if (panicstr) {
 236      -                        disp_lock_exit(sqlp);
 237      -                        return;
 238      -                }
 239  241                  thread_lock_high(curthread);
 240  242                  SEMA_BLOCK(s, sqlp);
 241  243                  thread_unlock_nopreempt(curthread);
 242  244                  swtch();
 243  245                  disp_lock_enter(sqlp);
 244  246          }
 245  247          s->s_count--;
 246  248          disp_lock_exit(sqlp);
 247  249  }
 248  250  
↓ open down ↓ 77 lines elided ↑ open up ↑
 326  328   * the semaphore's count is incremented by one. a blocked thread
 327  329   * is awakened and re-tries to acquire the semaphore.
 328  330   */
 329  331  void
 330  332  sema_v(ksema_t *sp)
 331  333  {
 332  334          sema_impl_t     *s;
 333  335          kthread_t       *sq, *tp;
 334  336          disp_lock_t     *sqlp;
 335  337  
      338 +        /* no-op during panic */
      339 +        if (panicstr)
      340 +                return;
      341 +
 336  342          s = (sema_impl_t *)sp;
 337  343          sqlp = &SQHASH(s)->sq_lock;
 338  344          disp_lock_enter(sqlp);
 339      -        if (panicstr) {
 340      -                disp_lock_exit(sqlp);
 341      -                return;
 342      -        }
 343  345          s->s_count++;
 344  346          sq = s->s_slpq;
 345  347          if (sq != NULL) {
 346  348                  tp = sq;
 347  349                  ASSERT(THREAD_LOCK_HELD(tp));
 348  350                  sq = sq->t_link;
 349  351                  tp->t_link = NULL;
 350  352                  DTRACE_SCHED1(wakeup, kthread_t *, tp);
 351  353                  tp->t_sobj_ops = NULL;
 352  354                  tp->t_wchan = NULL;
↓ open down ↓ 13 lines elided ↑ open up ↑
 366  368   * return 0.
 367  369   */
 368  370  int
 369  371  sema_tryp(ksema_t *sp)
 370  372  {
 371  373          sema_impl_t     *s;
 372  374          sleepq_head_t   *sqh;
 373  375  
 374  376          int     gotit = 0;
 375  377  
      378 +        /* no-op during panic */
      379 +        if (panicstr)
      380 +                return (1);
      381 +
 376  382          s = (sema_impl_t *)sp;
 377  383          sqh = SQHASH(s);
 378  384          disp_lock_enter(&sqh->sq_lock);
 379  385          if (s->s_count > 0) {
 380  386                  s->s_count--;
 381  387                  gotit = 1;
 382  388          }
 383  389          disp_lock_exit(&sqh->sq_lock);
 384  390          return (gotit);
 385  391  }
 386  392  
 387  393  int
 388  394  sema_held(ksema_t *sp)
 389  395  {
 390  396          sema_impl_t     *s;
 391  397  
 392      -
 393      -        s = (sema_impl_t *)sp;
      398 +        /* no-op during panic */
 394  399          if (panicstr)
 395  400                  return (1);
 396      -        else
 397      -                return (s->s_count <= 0);
      401 +
      402 +        s = (sema_impl_t *)sp;
      403 +        return (s->s_count <= 0);
 398  404  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX