liquidio: fix race condition in instruction completion processing
In lio_enable_irq, the pkt_in_done count register was being cleared to zero. However, there could be some completed instructions which were not yet processed due to budget and limit constraints. So, only write this register with the number of actual completions that were processed. Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com> Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9ecc660ea1
commit
b943f17e06
|
@ -1450,8 +1450,9 @@ void lio_enable_irq(struct octeon_droq *droq, struct octeon_instr_queue *iq)
|
||||||
}
|
}
|
||||||
if (iq) {
|
if (iq) {
|
||||||
spin_lock_bh(&iq->lock);
|
spin_lock_bh(&iq->lock);
|
||||||
writel(iq->pkt_in_done, iq->inst_cnt_reg);
|
writel(iq->pkts_processed, iq->inst_cnt_reg);
|
||||||
iq->pkt_in_done = 0;
|
iq->pkt_in_done -= iq->pkts_processed;
|
||||||
|
iq->pkts_processed = 0;
|
||||||
/* this write needs to be flushed before we release the lock */
|
/* this write needs to be flushed before we release the lock */
|
||||||
mmiowb();
|
mmiowb();
|
||||||
spin_unlock_bh(&iq->lock);
|
spin_unlock_bh(&iq->lock);
|
||||||
|
|
|
@ -94,6 +94,8 @@ struct octeon_instr_queue {
|
||||||
|
|
||||||
u32 pkt_in_done;
|
u32 pkt_in_done;
|
||||||
|
|
||||||
|
u32 pkts_processed;
|
||||||
|
|
||||||
/** A spinlock to protect access to the input ring.*/
|
/** A spinlock to protect access to the input ring.*/
|
||||||
spinlock_t iq_flush_running_lock;
|
spinlock_t iq_flush_running_lock;
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ int octeon_init_instr_queue(struct octeon_device *oct,
|
||||||
iq->do_auto_flush = 1;
|
iq->do_auto_flush = 1;
|
||||||
iq->db_timeout = (u32)conf->db_timeout;
|
iq->db_timeout = (u32)conf->db_timeout;
|
||||||
atomic_set(&iq->instr_pending, 0);
|
atomic_set(&iq->instr_pending, 0);
|
||||||
|
iq->pkts_processed = 0;
|
||||||
|
|
||||||
/* Initialize the spinlock for this instruction queue */
|
/* Initialize the spinlock for this instruction queue */
|
||||||
spin_lock_init(&iq->lock);
|
spin_lock_init(&iq->lock);
|
||||||
|
@ -495,6 +496,7 @@ octeon_flush_iq(struct octeon_device *oct, struct octeon_instr_queue *iq,
|
||||||
lio_process_iq_request_list(oct, iq, 0);
|
lio_process_iq_request_list(oct, iq, 0);
|
||||||
|
|
||||||
if (inst_processed) {
|
if (inst_processed) {
|
||||||
|
iq->pkts_processed += inst_processed;
|
||||||
atomic_sub(inst_processed, &iq->instr_pending);
|
atomic_sub(inst_processed, &iq->instr_pending);
|
||||||
iq->stats.instr_processed += inst_processed;
|
iq->stats.instr_processed += inst_processed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue