Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Dec 2010 12:25:26 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/sys/cddl/compat/opensolaris/sys cyclic_impl.h src/sys/cddl/dev/cyclic cyclic.c
Message-ID:  <201012071225.oB7CPgJW066907@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
avg         2010-12-07 12:25:26 UTC

  FreeBSD src repository

  Modified files:
    sys/cddl/compat/opensolaris/sys cyclic_impl.h 
    sys/cddl/dev/cyclic  cyclic.c 
  Log:
  SVN rev 216254 on 2010-12-07 12:25:26Z by avg
  
  opensolaris cyclic: fix deadlock and make a little bit closer to upstream
  
  The dealock was caused in the following way:
  - thread T1 on CPU C1 holds a spin mutex, IPIs CPU C2 and waits for the
    IPI to be handled
  - C2 executes timer interrupt filter, thus has interrupts disabled, and
    gets blocked on the spin mutex held by T1
  The problem seems to have been introduced by simplifications made to
  OpenSolaris code during porting.
  The problem is fixed by reorganizing the code to more closely resemble
  the upstream version.  Interrupt filter (cyclic_fire) now doesn't
  acquire any locks, all per-CPU data accesses are performed on a
  target CPU with preemption and interrupts disabled thus precluding
  concurrent access to the data.
  cyp_mtx spin mutex is used to disable preemtion and interrupts; it's not
  used for classical mutual exclusion, because xcall already serializes
  calls to a CPU.  It's an emulation of OpenSolaris
  cyb_set_level(CY_HIGH_LEVEL) call, the spin mutexes could probably be
  reduced to just a spinlock_enter()/_exit() pair.
  
  Diff with upstream version is now reduced by ~500 lines, however it still
  remains quite large - many things that are not needed (at the moment) or
  are irrelevant on FreeBSD were simply ripped out during porting.
  Examples of such things:
  - support for CPU onlining/offlining
  - support for suspend/resume
  - support for running callouts at soft interrupt levels
  - support for callout rebinding from CPU to CPU
  - support for CPU partitions
  
  Tested by:      Artem Belevich <fbsdlist@src.cx>
  MFC after:      3 weeks
  X-MFC with:     r216252
  
  Revision  Changes    Path
  1.2       +8 -1      src/sys/cddl/compat/opensolaris/sys/cyclic_impl.h
  1.4       +164 -175  src/sys/cddl/dev/cyclic/cyclic.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012071225.oB7CPgJW066907>