Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1117903img; Fri, 22 Mar 2019 16:21:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIzY0RF+bms4PfN78lWH6/mpUUHYjcKcVJ7X6u48GzxN7xDsi3+W76+Ci3Wk/9lzHaboUr X-Received: by 2002:a63:1061:: with SMTP id 33mr11354126pgq.226.1553296901074; Fri, 22 Mar 2019 16:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553296901; cv=none; d=google.com; s=arc-20160816; b=wnqIYNPcDED8nluBkAWtespeSGQZLjL7BSRIcS7KZxcNp5YpDwQ6hP9WMK9tla1aZx g0RiyeY+FscWE3cUCiN7VvNssyt9S6m56lXjP+MlbETDtYVDyUoDgIKDsrl0kTU1dYeb Ih+KnSAGT8Zb64UiLTHdYU/3sSlnYMwlYwE29/rHUGaNfOnS/2jVFP5N54FG6htjg60l +136qLkNTgHDVxmLtHe57EDXSMpct7eOpMtlsxY5/AnYN09Zx1XC/2kmkpMvB3Y+XJcY NLN9BOT6JCYR+7FHASimJbxK/20RH8KelEYQQwcMGirYPyoV2sbQq0yR1LA3yikmkSlO Z8uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=F+Y6EH6+bkdFqEhAIio0IWMyAICRsA3z8r+kbcsVjaQ=; b=MqAlR5c2qjbSxMujR0E8pOvYKpPoHFCZ6cvEo/YFtGT7Os/ay10lcQV2SKQ3be3pzB MxQe2mLL/MxN3ZVJjrd/5moea3ULmLcR19/Llbd+uE4RVj4qsVHo+FT5DjfgQ4Ndu89y agaEITJBip4YXpo6ra7Nz7cO0fHF+zmePFj0IlfQYR6i6HtnQfwhorc4HdZXPu/a6pXF R4oAmd+4lmp1GRwcTmWx0udXhSPJwIQECjkeoYgWbFLvyXQRTReobNRdn6yVAR3qfbzR XxFC5YuaMFjSPSZFOXB8o2oB4pneORnLCNF8qNkpB3C/rnF9ThqCLOFwRusNxt/btSy4 GO0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22si7875161pls.17.2019.03.22.16.21.26; Fri, 22 Mar 2019 16:21:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728337AbfCVXUp (ORCPT + 99 others); Fri, 22 Mar 2019 19:20:45 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:56781 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726023AbfCVXUo (ORCPT ); Fri, 22 Mar 2019 19:20:44 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from parav@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Mar 2019 01:20:39 +0200 Received: from sw-mtx-036.mtx.labs.mlnx (sw-mtx-036.mtx.labs.mlnx [10.12.150.149]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x2MNKavw007896; Sat, 23 Mar 2019 01:20:37 +0200 From: Parav Pandit To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, kwankhede@nvidia.com, alex.williamson@redhat.com Cc: parav@mellanox.com Subject: [PATCH 0/8] vfio/mdev: Improve vfio/mdev core module Date: Fri, 22 Mar 2019 18:20:27 -0500 Message-Id: <1553296835-37522-1-git-send-email-parav@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we would like to use mdev subsystem for wider use case as discussed in [1], [2] apart from an offline discussion. This use case is also discussed with wider forum in [4] in track 'Lightweight NIC HW functions for container offload use cases'. This series is prep-work and improves vfio/mdev module in following ways. Patch-1 and 2 Fixes releasing parent dev reference during error unwinding of mdev create and mdev parent registration. Patch-3 Simplifies mdev device for unused kref. Patch-4 Drops redundant extern prefix of exported symbols. Patch-5 Returns right error code from vendor driver. Patch-6 Fixes to use right sysfs remove sequence. Patch-7 Fixes removing all child devices if one of them fails. Patch 8 Brings improvements to mdev in following ways. 1. Fix race conditions among mdev parent's create(), remove() and mdev parent unregistration routines that leads to call traces. 2. Setup vendor mdev device before placing the device on mdev bus. This ensures that vfio_mdev or any other module that accesses mdev, is rightly in any of the callbacks of mdev_register_driver(). This follows Linux driver model now. Similarly follow exact reverse remove sequence, i.e. to take away the device first from the bus before removing underlying hardware mdev. This series is tested using (a) mtty with VM using vfio_mdev driver for positive tests. (b) mtty with vfio_mdev with error race condition cases of create, remove and mtty driver. (c) mlx5 core driver using RFC patches [3] and internal patches. Internal patches are large and cannot be combined with this prep-work patches. It will posted once prep-work completes. [1] https://www.spinics.net/lists/netdev/msg556978.html [2] https://lkml.org/lkml/2019/3/7/696 [3] https://lkml.org/lkml/2019/3/8/819 [4] https://netdevconf.org/0x13/session.html?workshop-hardware-offload Parav Pandit (8): vfio/mdev: Fix to not do put_device on device_register failure vfio/mdev: Avoid release parent reference during error path vfio/mdev: Removed unused kref vfio/mdev: Drop redundant extern for exported symbols vfio/mdev: Avoid masking error code to EBUSY vfio/mdev: Follow correct remove sequence vfio/mdev: Fix aborting mdev child device removal if one fails vfio/mdev: Improve the create/remove sequence drivers/vfio/mdev/mdev_core.c | 164 +++++++++++++++++++-------------------- drivers/vfio/mdev/mdev_private.h | 8 +- drivers/vfio/mdev/mdev_sysfs.c | 8 +- include/linux/mdev.h | 21 +++-- 4 files changed, 98 insertions(+), 103 deletions(-) -- 1.8.3.1