提交 7fcd9d77 编写于 作者: Z Zou Cao 提交者: Joseph Qi

hinic: panic when reading back he IRQ affinity hint

It is wrong for using stack variable to store the current code sets an
affinity hint, it will cause a panic or returning corrupt data.

So this patch moves the mask local variable into hinic_rq struct
to avoid this situation.

Backtrace:
Internal error: Oops: 96000007 [#1] SMP
Process irqbalance (pid: 1464, stack limit = 0x000000009bc2bec4)
CPU: 35 PID: 1464 Comm: irqbalance Tainted: G        W
pstate: 00400089 (nzcv daIf +PAN -UAO)
pc : __memcpy+0x44/0x180
lr : irq_affinity_hint_proc_show+0x9c/0x100
sp : ffff00002cb7bb60
x29: ffff00002cb7bb60 x28: 0000ffff9f6d9000
x27: ffff803f27cef9c0 x26: ffff00002cb7be30
x25: 0000000000000400 x24: ffff803f290e7000
x23: 0000000000000000 x22: ffff803f27cef980
x21: ffff000009009000 x20: ffff802fb9f01000
x19: ffff00002cb7bba8 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000
x15: 0000000000000000 x14: 0000000000000000
x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000
x9 : 0000000000000000 x8 : 0000000000000000
x7 : 0000000000000000 x6 : ffff00002cb7bba8
x5 : ffff802fb9f01000 x4 : 0000000000000008
x3 : ffff802fb9f01194 x2 : 0000000000000078
x1 : ffff000027d2b8b8 x0 : ffff00002cb7bba8
Call trace:
	__memcpy+0x44/0x180
	seq_read+0x1b4/0x45c
	proc_reg_read+0x7c/0xb8
	__vfs_read+0x58/0x190
	vfs_read+0x94/0x154
	ksys_read+0x68/0xd8
	__arm64_sys_read+0x28/0x34
	el0_svc_common+0xe8/0x19c
	el0_svc_handler+0x78/0x94
	el0_svc+0x8/0xc
Code: 36100064 b8404423 b80044c3 36180064 (f8408423)

---[ end trace b2cae62a9c2d153f ]---
Signed-off-by: NZou Cao <zoucao@linux.alibaba.com>
Reviewed-by: NBaoyou Xie <xie.baoyou@linux.alibaba.com>
上级 fa1d290d
...@@ -115,6 +115,7 @@ struct hinic_rq { ...@@ -115,6 +115,7 @@ struct hinic_rq {
u16 *pi_virt_addr; u16 *pi_virt_addr;
dma_addr_t pi_dma_addr; dma_addr_t pi_dma_addr;
cpumask_t mask;
}; };
struct hinic_qp { struct hinic_qp {
......
...@@ -414,7 +414,6 @@ static int rx_request_irq(struct hinic_rxq *rxq) ...@@ -414,7 +414,6 @@ static int rx_request_irq(struct hinic_rxq *rxq)
struct hinic_hwdev *hwdev = nic_dev->hwdev; struct hinic_hwdev *hwdev = nic_dev->hwdev;
struct hinic_rq *rq = rxq->rq; struct hinic_rq *rq = rxq->rq;
struct hinic_qp *qp; struct hinic_qp *qp;
struct cpumask mask;
int err; int err;
rx_add_napi(rxq); rx_add_napi(rxq);
...@@ -431,8 +430,8 @@ static int rx_request_irq(struct hinic_rxq *rxq) ...@@ -431,8 +430,8 @@ static int rx_request_irq(struct hinic_rxq *rxq)
} }
qp = container_of(rq, struct hinic_qp, rq); qp = container_of(rq, struct hinic_qp, rq);
cpumask_set_cpu(qp->q_id % num_online_cpus(), &mask); cpumask_set_cpu(qp->q_id % num_online_cpus(), &rq->mask);
return irq_set_affinity_hint(rq->irq, &mask); return irq_set_affinity_hint(rq->irq, &rq->mask);
} }
static void rx_free_irq(struct hinic_rxq *rxq) static void rx_free_irq(struct hinic_rxq *rxq)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册