Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4383332img; Tue, 26 Mar 2019 08:22:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhqrVD+iLBrfYImaUhKsi3V6Ia0Q0kd/2PUC9O6T/3Kjvq6KR1DUle36aSxX6aCwzfwLdn X-Received: by 2002:a65:62c9:: with SMTP id m9mr23971086pgv.309.1553613758752; Tue, 26 Mar 2019 08:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553613758; cv=none; d=google.com; s=arc-20160816; b=Jh8iMbi20swluo9hRUgpjqqpTJEeCUORnCNgG9t/A8a0BVsdu6s8xBLnnGgEZJ8/N8 XTqLRU57zQsYDf80R0c9jSiQW1DjWtudW+TVOnWkC3ohnmTuiaBL1/flJjt3iVWSMGXn Vrmj6wXcku0vEUAWjJkTwYZm2GpnxQbyad9z1RtYQPnhb9LP61i9ueHuow/hHQpQMUXx 3Sg/AMDo42B75THBo8+Wh32uIYSWr27bp8XLQXPEHaKe4APdMruaWRW08n4FnbR9TpP1 A/+B49lY7E5Nl6cgDZX+dbqLmXy1HOpYb6CY5VrKn9vrQL9A0OB+7/IalWTmdpmeYnc5 TKzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=VGJs4RDUhqaolfx8q7kmkjPLA/8Uz+5hkPiVFDYTLWg=; b=Jho0KDmNWzLo7d7DuW/5flvuxUkCXgnj0h4KxtqhKooVn4ukwY4oUnN+oyzy1Bd27B mMuqPSMpez5yvc6Q6bn9xzYaGuuwXVgJaX6qyH0Bi3jKgtgwktVh0xe6Ainhi4L8+T01 +37smWL6bfXjsBalpWMXLcCqvnSsWv75rWtqxUKD5u/AWb+NvYjlZ0FR94Ku2nsC8V5C z2O/rGJbRiH+PxSQllCsSuuK1s/HXqfwgiSBH2o5OpNgkhZSPD7//NHhKcdPPHY2Em8A bb5Ys6FVWwW/8f1uFDoGuPEq+dv59DEa94k4/Qc+qaYOn7kBZrm2JRvW51nj3pYixZ8s YkNw== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14si16046232pgg.377.2019.03.26.08.22.23; Tue, 26 Mar 2019 08:22:38 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731998AbfCZPVr (ORCPT + 99 others); Tue, 26 Mar 2019 11:21:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49032 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731715AbfCZPVr (ORCPT ); Tue, 26 Mar 2019 11:21:47 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A624C1306F8; Tue, 26 Mar 2019 15:21:47 +0000 (UTC) Received: from x1.home (ovpn-116-99.phx2.redhat.com [10.3.116.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5A651759E; Tue, 26 Mar 2019 15:21:46 +0000 (UTC) Date: Tue, 26 Mar 2019 09:21:46 -0600 From: Alex Williamson To: Parav Pandit Cc: "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kwankhede@nvidia.com" Subject: Re: [PATCH 8/8] vfio/mdev: Improve the create/remove sequence Message-ID: <20190326092146.6c93ce96@x1.home> In-Reply-To: References: <1553296835-37522-1-git-send-email-parav@mellanox.com> <1553296835-37522-9-git-send-email-parav@mellanox.com> <20190325171831.1ac2a441@x1.home> <20190325180537.11842c03@x1.home> <20190325201645.1ba4e9bf@x1.home> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 26 Mar 2019 15:21:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 Mar 2019 05:53:22 +0000 Parav Pandit wrote: > > -----Original Message----- > > From: linux-kernel-owner@vger.kernel.org > owner@vger.kernel.org> On Behalf Of Parav Pandit > > Sent: Monday, March 25, 2019 10:19 PM > > To: Alex Williamson > > Cc: kvm@vger.kernel.org; linux-kernel@vger.kernel.org; > > kwankhede@nvidia.com > > Subject: RE: [PATCH 8/8] vfio/mdev: Improve the create/remove sequence > > > > > > > > > -----Original Message----- > > > From: Alex Williamson > > > Sent: Monday, March 25, 2019 9:17 PM > > > To: Parav Pandit > > > Cc: kvm@vger.kernel.org; linux-kernel@vger.kernel.org; > > > kwankhede@nvidia.com > > > Subject: Re: [PATCH 8/8] vfio/mdev: Improve the create/remove sequence > > > > > > On Tue, 26 Mar 2019 01:43:44 +0000 > > > Parav Pandit wrote: > > > > > > > > -----Original Message----- > > > > > From: Alex Williamson > > > > > > I mean the callback iterator on the parent remove can do a WARN_ON > > > > > if this returns an error while the device remove path can silently > > > > > return -EBUSY, the common function doesn't need to decide whether > > > > > the parent ops remove function deserves a dev_err. > > > > > > > > > Ok. I understood. > > > > But device remove returning silent -EBUSY looks an error that should > > > > get logged in, because this is something not expected. Its probably > > > > late for sysfs layer to return report an error by that time it > > > > prints device name, because put_device() is done. So if remove() > > > > returns an error, I think its legitimate failure to do WARN_ON or > > dev_err(). > > > > > > Calling put_device() if the parent remove op fails looks like a bug > > > introduced by this series, the current code allows that failure > > > leaving the device in a coherent state and returning errno to the sysfs > > store function. > > > > > Why should it fail? > > We are taking off the device bus first as describe in commit log. > > This ensures that everything is closed before calling the remove(). > > We cannot avoid put_device() and put_parent, it all buggy path... > > I audited remove() callbacks of kvmgt.c, vfio_ccw_ops.c, > vfio_ap_ops.c, mbochs.c, mdpy.c, mtty.c, who makes the remove > possible once the device release is executed. This should complete > once the device is taken off the bus. This was not the case before > this sequence where remove() is done while device is open...hence the > check was needed in past. dev_err() is to help catch any errors/bugs > in this area. > > I doubt we need to retry remove() like vfio_del_group_dev(), in > mdev_core if release() is not yet complete. I'm ok with this, I've always thought the 'force' semantics and allowing remove to fail were not terribly inline with other drivers, even if ultimately I wish drivers could nak a remove request to avoid the ugliness of blocking. But ultimately you'll need to come to an agreement with Kirti, the drivers we have in-tree are not the complete set of mdev drivers, but it also doesn't necessarily make sense to cater to the lone out-of-tree driver either. Thanks, Alex