IB/ehca: Fix sync between completion handler and destroy cq
authorHoang-Nam Nguyen <hnguyen@linux.vnet.ibm.com>
Wed, 28 Feb 2007 17:01:02 +0000 (18:01 +0100)
committerRoland Dreier <rolandd@cisco.com>
Thu, 1 Mar 2007 21:04:05 +0000 (13:04 -0800)
commit31726798bd8fbef6244b28cf962f4a4c45793dea
tree78f8067c58e003c639f58cf9fbf89d08e0d85465
parenta27cbe878203076247c1b5287f5ab59ed143b560
IB/ehca: Fix sync between completion handler and destroy cq

This patch fixes two issues reported by Roland Dreier and Christoph Hellwig:

- Mismatched sync/locking between completion handler and destroy cq We
  introduced a counter nr_events per cq to track number of irq events
  seen. This counter is incremented when an event queue entry is seen
  and decremented after completion handler has been called regardless
  if scaling code is active or not. Note that nr_callbacks tracks
  number of events assigned to a cpu and both counters can potentially
  diverge.

  The sync between running completion handler and destroy cq is done
  by using the global spin lock ehca_cq_idr_lock.

- Replace yield by wait_event on the counter above to become zero.

Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/ehca/ehca_classes.h
drivers/infiniband/hw/ehca/ehca_cq.c
drivers/infiniband/hw/ehca/ehca_irq.c
drivers/infiniband/hw/ehca/ehca_main.c