OSDN Git Service

IB/hfi1: Race condition between user notification and driver state
authorMichael J. Ruhl <michael.j.ruhl@intel.com>
Mon, 23 Oct 2017 13:05:45 +0000 (06:05 -0700)
committerDoug Ledford <dledford@redhat.com>
Mon, 30 Oct 2017 18:51:36 +0000 (14:51 -0400)
commit4061f3a4da4574b8c9f11a82c767aaaed3ef2aa9
tree08394267eb7dc05cc03535d6bcdc8dfbe65720d8
parent5455e73a76a397d77541bb5b0eedac137ef525b5
IB/hfi1: Race condition between user notification and driver state

The handler for link init state (HLS_UP_INIT) notifies userspace
(update_statusp()) before enabling the device
(RCV_CTRL_RCV_PORT_ENABLE_SMASK) or setting the device state
(ppd->host_link_state).  This causes a race condition where the
userspace thinks the interface is in the INIT state before the driver
has set that state.

Rework the code path to eliminate the race.

Delay setting the init state until after a HW settling period.

Reviewed-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/chip.c
drivers/infiniband/hw/hfi1/intr.c