From patchwork Mon Dec 5 21:08:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirti Wankhede X-Patchwork-Id: 9461497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 824B96022E for ; Mon, 5 Dec 2016 21:07:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 786EA24B48 for ; Mon, 5 Dec 2016 21:07:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CBF428066; Mon, 5 Dec 2016 21:07:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9C2227FBE for ; Mon, 5 Dec 2016 21:07:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752448AbcLEVG5 (ORCPT ); Mon, 5 Dec 2016 16:06:57 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:3731 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752090AbcLEVG4 (ORCPT ); Mon, 5 Dec 2016 16:06:56 -0500 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Mon, 05 Dec 2016 13:07:06 -0800 Received: from HQMAIL107.nvidia.com ([172.20.13.39]) by hqnvupgp07.nvidia.com (PGP Universal service); Mon, 05 Dec 2016 01:04:51 -0800 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 05 Dec 2016 01:04:51 -0800 Received: from HQMAIL106.nvidia.com (172.18.146.12) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 5 Dec 2016 21:06:55 +0000 Received: from kwankhede-dev.nvidia.com (172.20.13.39) by HQMAIL106.nvidia.com (172.18.146.12) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Mon, 5 Dec 2016 21:06:52 +0000 From: Kirti Wankhede To: , , , CC: , , , Kirti Wankhede Subject: [PATCH 1/1] vfio iommu type1: WARN_ON if notifier block is not unregistered Date: Tue, 6 Dec 2016 02:38:20 +0530 Message-ID: <1480972100-846-1-git-send-email-kwankhede@nvidia.com> X-Mailer: git-send-email 2.7.0 X-NVConfidentiality: public MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mdev vendor driver should unregister the iommu notifier since the vfio iommu can persist beyond the attachment of the mdev group. WARN_ON will show warning if vendor driver doesn't unregister the notifier and is forced to follow the implementations steps. Signed-off-by: Kirti Wankhede Signed-off-by: Neo Jia Change-Id: I75fd0a40e582a144fe7a037c7140d3513e8ff030 --- drivers/vfio/vfio_iommu_type1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 023fba7b8d5a..37871ee0c0c5 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -1361,6 +1361,8 @@ static void vfio_sanity_check_pfn_list(struct vfio_iommu *iommu) if (WARN_ON(!RB_EMPTY_ROOT(&dma->pfn_list))) break; } + /* mdev venfor driver must unregister notifier */ + WARN_ON(iommu->notifier.head); } static void vfio_iommu_type1_detach_group(void *iommu_data,