Skip to content

Commit

Permalink
qdma: ctrl-c hangs if there is pending request in stream (Xilinx#2213)
Browse files Browse the repository at this point in the history
  • Loading branch information
houlz0507 authored and maxzhen committed Oct 5, 2019
1 parent 4b42bbc commit 59d4787
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions src/runtime_src/core/pcie/driver/linux/xocl/subdev/qdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ struct qdma_stream_queue {
unsigned long queue;
struct qdma_queue_conf qconf;
u32 state;
spinlock_t qlock;
unsigned long refcnt;
wait_queue_head_t wq;
int flowid;
int routeid;
struct file *file;
Expand Down Expand Up @@ -149,8 +146,6 @@ struct xocl_qdma {
u32 c2h_ringsz_idx;
u32 wrb_ringsz_idx;

struct mutex str_dev_lock;

u16 instance;

struct qdma_irq user_msix_table[QDMA_MAX_INTR];
Expand Down Expand Up @@ -1042,15 +1037,6 @@ static ssize_t queue_rw(struct xocl_qdma *qdma, struct qdma_stream_queue *queue,
if (sz == 0)
return 0;

spin_lock(&queue->qlock);
if (queue->state == QUEUE_STATE_CLEANUP) {
xocl_err(&qdma->pdev->dev, "Invalid queue state");
spin_unlock(&queue->qlock);
return -EINVAL;
}
queue->refcnt++;
spin_unlock(&queue->qlock);

if (((uint64_t)(buf) & ~PAGE_MASK) && queue->qconf.c2h) {
xocl_err(&qdma->pdev->dev,
"C2H buffer has to be page aligned, buf %p", buf);
Expand Down Expand Up @@ -1173,11 +1159,6 @@ static ssize_t queue_rw(struct xocl_qdma *qdma, struct qdma_stream_queue *queue,
} else if (kiocb)
ret = -EIOCBQUEUED;

spin_lock(&queue->qlock);
queue->refcnt--;
spin_unlock(&queue->qlock);
wake_up(&queue->wq);

return ret;
}

Expand Down Expand Up @@ -1315,25 +1296,12 @@ static int queue_flush(struct qdma_stream_queue *queue)
qdma = queue->qdma;

xocl_info(&qdma->pdev->dev, "Release Queue 0x%lx", queue->queue);
spin_lock(&queue->qlock);
if (queue->state != QUEUE_STATE_INITIALIZED) {
xocl_info(&qdma->pdev->dev, "Already released 0x%lx",
queue->queue);
spin_unlock(&queue->qlock);
return 0;
}
queue->state = QUEUE_STATE_CLEANUP;
spin_unlock(&queue->qlock);

wait_event(queue->wq, queue->refcnt == 0);

mutex_lock(&qdma->str_dev_lock);
qdma_stream_sysfs_destroy(queue);
if (queue->qconf.c2h)
qdma->queues[queue->qconf.qidx] = NULL;
else
qdma->queues[QDMA_QSETS_MAX + queue->qconf.qidx] = NULL;
mutex_unlock(&qdma->str_dev_lock);

ret = qdma_queue_stop((unsigned long)qdma->dma_handle, queue->queue,
NULL, 0);
Expand Down Expand Up @@ -1426,8 +1394,6 @@ static long qdma_stream_ioctl_create_queue(struct xocl_qdma *qdma,
INIT_LIST_HEAD(&queue->req_pend_list);
INIT_LIST_HEAD(&queue->req_free_list);
spin_lock_init(&queue->req_lock);
spin_lock_init(&queue->qlock);
init_waitqueue_head(&queue->wq);

qconf = &queue->qconf;
qconf->st = 1; /* stream queue */
Expand Down Expand Up @@ -1542,10 +1508,8 @@ static long qdma_stream_ioctl_create_queue(struct xocl_qdma *qdma,

queue->qdma = qdma;

mutex_lock(&qdma->str_dev_lock);
ret = qdma_stream_sysfs_create(queue);
if (ret) {
mutex_unlock(&qdma->str_dev_lock);
xocl_err(&qdma->pdev->dev, "sysfs create failed");
goto failed;
}
Expand All @@ -1555,7 +1519,6 @@ static long qdma_stream_ioctl_create_queue(struct xocl_qdma *qdma,
qdma->queues[queue->qconf.qidx] = queue;
else
qdma->queues[QDMA_QSETS_MAX + queue->qconf.qidx] = queue;
mutex_unlock(&qdma->str_dev_lock);

fd_install(queue->qfd, queue->file);

Expand Down Expand Up @@ -1826,7 +1789,6 @@ static int qdma_probe(struct platform_device *pdev)

qdma->user_msix_mask = QDMA_USER_INTR_MASK;

mutex_init(&qdma->str_dev_lock);
spin_lock_init(&qdma->user_msix_table_lock);

platform_set_drvdata(pdev, qdma);
Expand Down Expand Up @@ -1881,8 +1843,6 @@ static int qdma_remove(struct platform_device *pdev)
}


mutex_destroy(&qdma->str_dev_lock);

platform_set_drvdata(pdev, NULL);
xocl_drvinst_free(qdma);

Expand Down

0 comments on commit 59d4787

Please sign in to comment.