From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751359AbdCHIK1 (ORCPT ); Wed, 8 Mar 2017 03:10:27 -0500 Received: from foss.arm.com ([217.140.101.70]:55970 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750770AbdCHIKZ (ORCPT ); Wed, 8 Mar 2017 03:10:25 -0500 From: Marc Zyngier To: "Michael S. Tsirkin" , Jason Wang Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH] virtio-pci: Remove affinity hint before freeing the interrupt Date: Wed, 8 Mar 2017 08:09:27 +0000 Message-Id: <20170308080927.4493-1-marc.zyngier@arm.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org virtio-pci registers a per-vq affinity hint when using MSIX, but fails to remove it when freeing the interrupt, resulting in this type of splat: [ 31.111202] WARNING: CPU: 0 PID: 2823 at kernel/irq/manage.c:1503 __free_irq+0x2c4/0x2c8 [ 31.114689] Modules linked in: [ 31.116101] CPU: 0 PID: 2823 Comm: kexec Not tainted 4.10.0+ #6941 [ 31.118911] Hardware name: Generic DT based system [ 31.121319] [] (unwind_backtrace) from [] (show_stack+0x18/0x1c) [ 31.125017] [] (show_stack) from [] (dump_stack+0x84/0x98) [ 31.128427] [] (dump_stack) from [] (__warn+0xf4/0x10c) [ 31.131910] [] (__warn) from [] (warn_slowpath_null+0x28/0x30) [ 31.135543] [] (warn_slowpath_null) from [] (__free_irq+0x2c4/0x2c8) [ 31.139355] [] (__free_irq) from [] (free_irq+0x44/0x78) [ 31.142909] [] (free_irq) from [] (vp_del_vqs+0x68/0x1c0) [ 31.146299] [] (vp_del_vqs) from [] (pci_device_shutdown+0x3c/0x78) The obvious fix is to drop the affinity hint before freeing the interrupt. Signed-off-by: Marc Zyngier --- drivers/virtio/virtio_pci_common.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c index df548a6fb844..5a84f8207c02 100644 --- a/drivers/virtio/virtio_pci_common.c +++ b/drivers/virtio/virtio_pci_common.c @@ -106,9 +106,12 @@ static void vp_remove_vqs(struct virtio_device *vdev) if (vp_dev->msix_vector_map) { int v = vp_dev->msix_vector_map[vq->index]; - if (v != VIRTIO_MSI_NO_VECTOR) - free_irq(pci_irq_vector(vp_dev->pci_dev, v), - vq); + if (v != VIRTIO_MSI_NO_VECTOR) { + unsigned int irq; + irq = pci_irq_vector(vp_dev->pci_dev, v); + irq_set_affinity_hint(irq, NULL); + free_irq(irq, vq); + } } vp_dev->del_vq(vq); } -- 2.11.0