aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visornic
diff options
context:
space:
mode:
authorTim Sell <Timothy.Sell@unisys.com>2015-10-12 15:28:57 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-12 20:49:29 -0700
commit91678f37004d84757738790a7257b87cc909f483 (patch)
tree43e64c6bb365a986ffc58d411cedfef0a97b5b57 /drivers/staging/unisys/visornic
parentStaging: unisys: Use kcalloc instead of kzalloc to allocate array (diff)
downloadlinux-dev-91678f37004d84757738790a7257b87cc909f483.tar.xz
linux-dev-91678f37004d84757738790a7257b87cc909f483.zip
staging: unisys: visornic: prevent faults if driver re-loaded during stress
Prevent faults that would occur during this sequence of activity during network stress: rmmod visornic modprobe visornic /etc/init.d/network restart The problem fixed was that the back-end IO partition was holding onto stale receive buffers after the "rmmod visornic", and erroneously completing them after a subsequent "modprobe visornic". This is fixed in this patch as follows: * Tell the back-end IO partition that we want it to employ its "incarnation mechanism" to ensure it does not complete stale receive buffers after the guest virtual device environment changes (e.g., by re-loading the driver), by setting the ULTRA_IO_DRIVER_SUPPORTS_ENHANCED_RCVBUF_CHECKING feature bit, and supplying a unique incarnation number in rcvpost.unique_num for each receive buffer posted. * When visornic loads, make sure we drain and ignore any possible-stale data in the channel before beginning network operation. Prior to this patch, faults like this would occur almost every time if you attempted to rmmod + modprobe the visornic driver and restart the network service during heavy network activity: BUG: spinlock bad magic on CPU#0, ksoftirqd/0/3 lock: 0xffff88002d8a56d8, .magic: ffff8800, .owner: <none>/-1, .owner_cpu: 2304 CPU: 0 PID: 3 Comm: ksoftirqd/0 Tainted: G C 4.3.0-rc3-ARCH+ #74 Signed-off-by: Tim Sell <timothy.sell@unisys.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/unisys/visornic')
-rw-r--r--drivers/staging/unisys/visornic/visornic_main.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 6db74ded184c..296b11cea247 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -120,7 +120,7 @@ struct visornic_devdata {
atomic_t interrupt_rcvd;
wait_queue_head_t rsp_queue;
struct sk_buff **rcvbuf;
- u64 uniquenum; /* TODO figure out why not used */
+ u64 incarnation_id; /* lets IOPART know about re-birth */
unsigned short old_flags; /* flags as they were prior to
* set_multicast_list
*/
@@ -431,7 +431,7 @@ post_skb(struct uiscmdrsp *cmdrsp,
cmdrsp->net.rcvpost.frag.pi_off =
(unsigned long)skb->data & PI_PAGE_MASK;
cmdrsp->net.rcvpost.frag.pi_len = skb->len;
- cmdrsp->net.rcvpost.unique_num = devdata->uniquenum;
+ cmdrsp->net.rcvpost.unique_num = devdata->incarnation_id;
if ((cmdrsp->net.rcvpost.frag.pi_off + skb->len) <= PI_PAGE_SIZE) {
cmdrsp->net.type = NET_RCV_POST;
@@ -1365,6 +1365,7 @@ devdata_initialize(struct visornic_devdata *devdata, struct visor_device *dev)
return NULL;
memset(devdata, '\0', sizeof(struct visornic_devdata));
devdata->dev = dev;
+ devdata->incarnation_id = get_jiffies_64();
return devdata;
}
@@ -1588,7 +1589,21 @@ send_rcv_posts_if_needed(struct visornic_devdata *devdata)
}
/**
- * draing_queue - drains the response queue
+ * drain_resp_queue - drains and ignores all messages from the resp queue
+ * @cmdrsp: io channel command response message
+ * @devdata: visornic device to drain
+ */
+static void
+drain_resp_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata)
+{
+ while (visorchannel_signalremove(devdata->dev->visorchannel,
+ IOCHAN_FROM_IOPART,
+ cmdrsp))
+ ;
+}
+
+/**
+ * service_resp_queue - drains the response queue
* @cmdrsp: io channel command response message
* @devdata: visornic device to drain
*
@@ -1777,6 +1792,8 @@ static int visornic_probe(struct visor_device *dev)
err = -ENOMEM;
goto cleanup_netdev;
}
+ /* don't trust messages laying around in the channel */
+ drain_resp_queue(devdata->cmdrsp, devdata);
devdata->netdev = netdev;
dev_set_drvdata(&dev->device, devdata);
@@ -1868,6 +1885,7 @@ static int visornic_probe(struct visor_device *dev)
}
features |= ULTRA_IO_CHANNEL_IS_POLLING;
+ features |= ULTRA_IO_DRIVER_SUPPORTS_ENHANCED_RCVBUF_CHECKING;
err = visorbus_write_channel(dev, channel_offset, &features, 8);
if (err) {
dev_err(&dev->device,