Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1797386ybg; Thu, 30 Jul 2020 02:58:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4bmxtsIadCngpl8lhh1cOuVGbIbsrHQibDIcpOPU04sgvPYPzDhIazqFYeMm2us9YS8V4 X-Received: by 2002:a17:906:3715:: with SMTP id d21mr1780327ejc.281.1596103137340; Thu, 30 Jul 2020 02:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596103137; cv=none; d=google.com; s=arc-20160816; b=PjriH9NUVfrzTSDsiZZz0Ag9JWDHdv1DVD5vqIcK9tEFOk19qiL8lxUECb2eDBcEE0 bHoVQggQdYwPHLgb+uhRequx/M1ImTlasGzwovI6TpSCRcW5BZLVllDpWjubEeHeZNNz HmeT0+2UogT/EpDLpL92PGslnMqCZVpJzlzxFkAVfebT8NmkOda0BGGjZkPQKkMREclq FriMLfnKYaKD5apCxgj5qtllDC81mc9dQqN3WN8FOe7/6jY2EfbdND1ugAgnhzmJ00Xq TzbayDEC2HEgfsSPyUoKspZEbg4Bz/+0Rf1E4O+rlAgAckHPV1b6Uzw+f6bLG3CF3OS6 LU3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=FSKKIxvFLUx9X3nKuEedzvw2vycT/ljglu6fDNT+ExY=; b=V6fFgj1BZOpn7A2/OiX7VnJVh/PtK0ZIkedoMxdUVyKMqFvc2G5kJA827VxFvMeM8A WfLdMYzuhwuSPgBuIajCuK+PR2fTl4EpnQGwoch3U0IXc+yXmsxxYOeJtpOx9IHDgNAW 8kYhjtxm5pIhrrjLL7P+vMXVTBjraoe/flBKHn8JQkecJ8evOeyeLeJgs8cC+2bwG0Z3 galbWT/exH+G9tk7qknv/zsUmRGG8QbNhBiiFZ2vjB/Ilpix2FM7L3wSNkzwGrHknpAv UfeAqkHbZ5ZDNBNStfupB0GlosWhnu8x/0n4rYf/iWELfFx1Nkf70fTBkg/iH1wfNEYg PVkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w18si2840690eds.406.2020.07.30.02.58.35; Thu, 30 Jul 2020 02:58:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729549AbgG3J4O (ORCPT + 99 others); Thu, 30 Jul 2020 05:56:14 -0400 Received: from bmailout1.hostsharing.net ([83.223.95.100]:58417 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726790AbgG3J4N (ORCPT ); Thu, 30 Jul 2020 05:56:13 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id 3352D30000898; Thu, 30 Jul 2020 11:56:11 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id ED72B60DD4; Thu, 30 Jul 2020 11:56:10 +0200 (CEST) Date: Thu, 30 Jul 2020 11:56:10 +0200 From: Lukas Wunner To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Dan Williams , Geert Uytterhoeven , Pantelis Antoniou , Alexander Duyck , Mark Brown , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Subject: Re: [PATCH 2/3] driver core: Use rwsem for kill_device() serialization Message-ID: <20200730095610.orkum2n6snb42uzs@wunner.de> References: <20200730065326.GA3950394@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200730065326.GA3950394@kroah.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 30, 2020 at 08:53:26AM +0200, Greg Kroah-Hartman wrote: > On Wed, Jul 08, 2020 at 03:27:02PM +0200, Lukas Wunner wrote: > > kill_device() is currently serialized with driver probing by way of the > > device_lock(). We're about to serialize it with device_add() as well > > to prevent addition of children below a device which is going away. > > Why? Who does this? Shouldn't the bus that is trying to do this know > this is happening? AFAICS, at least spi and i2c are affected. I first thought that pci is affected as well but it seems the global pci_lock_rescan_remove() performs the required serialization. I've yet to take a closer look at acpi and usb. Any bus which creates a device hierarchy with dynamic addition & removal needs to make sure no new children are added after removal of the parent has begun. > So, why are you pushing this down into the driver core, can't this be > done in whatever crazy bus wants to do this, like is done here? I guess it can. Let me try to perform the locking at the bus level then. Thanks, Lukas