Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1852338ybi; Mon, 1 Jul 2019 01:25:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqccFhdKRV/2D8BIxnu0brGXZsl0avxLQ4VyAqmldw5Zwn83mfSQNALSxCwjoB/ZCPp0K6 X-Received: by 2002:a63:b22:: with SMTP id 34mr20165420pgl.38.1561969541327; Mon, 01 Jul 2019 01:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561969541; cv=none; d=google.com; s=arc-20160816; b=xVbA4Ja6MKMwGUhZV6CsGhaKW/Bm1eyiwyZoisv40Rg5ieN0g3XzZsyS7l/z/Nowf7 PUDghRlxvq/QkADRYJRneqOZXWWmOIpur/ZyiGIK3JNVb3hKv8GRB0gEhCw/DMUuhsuR EfjU058U0VgQYF5T0gHGUy3ccbOWY6ozeCGEKke6/dU5t0Xz7ROAff4QujUCZ401Gp5e 0K1QZAMv83mZOiQcfT2GdoKlcEwGk8whKSvIsrt+Q6AGt5VGbO8Dtt/btnqgjEviyDPj c8dDiZapCIi/7fgfQRXMSVwTleRlCkvROxdVTowUFOlrVQgglf04/uqxhD1pIb/4+Dc9 uDHA== 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=DRROjtbUO72tEcanUxJ98lTo2FnzK84lrkDRYWn/dOM=; b=NLXWfeUWLQHJfn5MEr3G1/g0pCAgKdX86GCs6pNECmpfIGTEqVC+NeTN1FQCpFJCkO x71LBLhZlAW5tBTM3VfnSJnYDP0RPDPEixLrxIT9Yw87ShFyvnMtbUyZgiq8tXKULdaY 4orI6tVqxMT96tQQ4YCG0EFtvawhpXRZDDQHUIDVELV3BdUCIS6JjAbPVUoOeqXCpmhb FxUhEwDnODSAMSpGamhKjbN1fb/UEgO1PMjGfFus4hODfDIRXVL7WMYTrDhcRwMriM+t qbvnPiocu3CrCd01QOZznQqkCrQrmreTh+UlZazypT5MMBV2/z3bKO9hMopXeKqvfEfC PXeg== 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 l4si4673222pjq.69.2019.07.01.01.25.24; Mon, 01 Jul 2019 01:25: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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727689AbfGAIGi (ORCPT + 99 others); Mon, 1 Jul 2019 04:06:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38436 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727080AbfGAIGi (ORCPT ); Mon, 1 Jul 2019 04:06:38 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 11C73308FB82; Mon, 1 Jul 2019 08:06:38 +0000 (UTC) Received: from gondolin (ovpn-117-220.ams2.redhat.com [10.36.117.220]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAC43BA4D; Mon, 1 Jul 2019 08:06:34 +0000 (UTC) Date: Mon, 1 Jul 2019 10:06:32 +0200 From: Cornelia Huck To: Alex Williamson Cc: kwankhede@nvidia.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mdev: Send uevents around parent device registration Message-ID: <20190701100632.31fe96db.cohuck@redhat.com> In-Reply-To: <20190628095608.7762d6d0@x1.home> References: <156155924767.11505.11457229921502145577.stgit@gimli.home> <20190627101914.32829440.cohuck@redhat.com> <20190628095608.7762d6d0@x1.home> Organization: Red Hat GmbH 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 01 Jul 2019 08:06:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 28 Jun 2019 09:56:08 -0600 Alex Williamson wrote: > On Thu, 27 Jun 2019 10:19:14 +0200 > Cornelia Huck wrote: > > > On Wed, 26 Jun 2019 08:27:58 -0600 > > Alex Williamson wrote: > > > @@ -243,6 +247,8 @@ void mdev_unregister_device(struct device *dev) > > > up_write(&parent->unreg_sem); > > > > > > mdev_put_parent(parent); > > > + > > > + kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); > > > > I'm wondering whether we should indicate this uevent earlier: Once we > > have detached from the parent list, we're basically done for all > > practical purposes. So maybe move this right before we grab the > > unreg_sem? > > That would make it a "this thing is about to go away" (ie. > "unregistering") rather than "this thing is gone" ("unregistered"). I > was aiming for the latter as the former just seems like it might make > userspace race to remove devices. Note that I don't actually make use > of this event in mdevctl currently, so we could maybe save it for > later, but the symmetry seemed preferable. Thanks, > > Alex Fair enough. I was thinking about signaling that it does not make much sense to register new devices after that point, but if that might trigger userspace to actually try and remove devices, not much is gained.