SVNews r322364

NOTE: This service is experimental and subject to change! Use at your own risk!

2017-08-10 14:59:17 - r322364 by ken (Kenneth D. Merry)

Complete list of files affected by revision r322364:

(Note: At the moment, these links point to ViewVC on They are probably slow. Do not overuse.)

  History   Contents   Diff   MODIFY   /head/sys/dev/mpr/mpr.c  
  History   Contents   Diff   MODIFY   /head/sys/dev/mpr/mpr_config.c  
  History   Contents   Diff   MODIFY   /head/sys/dev/mpr/mpr_sas.c  
  History   Contents   Diff   MODIFY   /head/sys/dev/mpr/mpr_sas_lsi.c  
  History   Contents   Diff   MODIFY   /head/sys/dev/mpr/mpr_user.c  
  History   Contents   Diff   MODIFY   /head/sys/dev/mpr/mprvar.h  
  History   Contents   Diff   MODIFY   /head/sys/dev/mps/mps.c  
  History   Contents   Diff   MODIFY   /head/sys/dev/mps/mps_config.c  
  History   Contents   Diff   MODIFY   /head/sys/dev/mps/mps_sas.c  
  History   Contents   Diff   MODIFY   /head/sys/dev/mps/mps_sas_lsi.c  
  History   Contents   Diff   MODIFY   /head/sys/dev/mps/mps_user.c  
  History   Contents   Diff   MODIFY   /head/sys/dev/mps/mpsvar.h  

Commit message:

Changes to make mps(4) and mpr(4) handle reinit with reallocation.

When the mps(4) and mpr(4) drivers need to reinitialize the
firmware, they sometimes need to reallocate all of the memory
allocated by the driver. The reallocation happens whenever the IOC
Facts change. That should only happen after a firmware upgrade.

If the reinitialization happens as a result of a timed out command
sent to the card, the command that timed out and triggered the
reinit may have been freed if iocfacts_allocate() reallocated all
memory. If the caller attempts to access the command after that,
the kernel will panic because the caller will be dereferencing
freed memory.

The solution is to set a flag in the softc when we reallocate,
and avoid dereferencing the command strucure if we've reallocated.

The changes are largely the same in both drivers, since mpr(4) is a
derivative of mps(4).

 o In iocfacts_allocate(), if the IOC Facts have changed and we
  need to reallocate, set the REALLOCATED flag in the softc.

 o Change wait_command() to take a struct mps_command ** instead of
  a struct mps_command *. This allows us to NULL out the caller's
  command pointer if we have to reinit the controller and the data
  structures get reallocated. (The REALLOCATED flag will be set
  in the softc if that has happened.)

 o In every place that calls wait_command(), make sure we handle
  the case where the command is NULL after the call.

 o The mpr(4) driver has mpr_request_polled() which can also
  reinitialize the card. Also check for reallocation there.

Reviewed by: scottl, slm
MFC after: 1 week
Sponsored by: Spectra Logic


Powered by Python FreeBSD support by secnetix GmbH & Co. KG

Page generated in 28 ms, 12 files printed. Current time is 2018-03-22 04:01:45. All times are in UTC/GMT.