Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2468307ybg; Thu, 30 Jul 2020 23:48:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhhVBZOjnps5LSc6X6z00725Vrc6wMg+7EZdnINzOauoJuwZi6opUbKqKc0hfrgzXoN1X7 X-Received: by 2002:a17:906:4acd:: with SMTP id u13mr2640600ejt.4.1596178090969; Thu, 30 Jul 2020 23:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596178090; cv=none; d=google.com; s=arc-20160816; b=sra9QYJF0o4YwPVz6p9Rrse1G8qX1onj8OqTHTEBYPaBdtBVwfkhS5K3SR79fdr0DA s7mCvXDV/CVYpSR4FJgzAuvakpaJEWziCWT0W447Ro+CPe24Agiqh6Xy5dp2OAz7LwA8 0YPQHTt2aiG7NGeEwyENpH1LFFtzr3wQgYaWih3ZsnQoD9uMMvhM0Jcn/w4tpF72PR2r TF4fP5rZDrxxXTbXN46SxysXDTfMFZ1OCJmWjm78qClKMS4db8+zIh54Fklx2f+FCx0M VfjwJYCn87sScK73ibW4S/wZJNkrBsC/ksoxsw45mr9AqQKGTobBS7/L8em4KoMk5DE0 pYqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=HS9sCRjGsOBLri+VYcJsBvJQA9WsJer5x1FdfYVrkAg=; b=rvCIEkgcAu0SEtannO5Pe9J65gKzKZZFRgHf/NY6UC47nY+pQFH1ze0rLtPli/xRxW uC+9nnLN2PCPjtf4E1kbckaJVuyx6W7Ccm8/2uPKnTHXr1oZhclOdjcR+2YOIBed9eY2 kmsZIbTk9Ly+AJ4he4xu2le/NfSXXrrdiCat6+eR06bBA8Bx9suiSGSagNyq9bpZxGI2 lQ6hc/q8odDtMYF2at48qidNKRbRaLih/O/42z0v1Ajmm6ME1jDz5oNnWpoUkOEPvdje Pb1E2h6D6pJF6Fs7n9JJgSm735j2o1+NhgmD2+VAFHMpwibU/FqiqzniMxJXwLCNk7Uv YIEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E8u4Ypz5; 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 s15si4708773ejc.530.2020.07.30.23.47.48; Thu, 30 Jul 2020 23:48:10 -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; dkim=pass header.i=@kernel.org header.s=default header.b=E8u4Ypz5; 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 S1731461AbgGaGpV (ORCPT + 99 others); Fri, 31 Jul 2020 02:45:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:55822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731400AbgGaGpS (ORCPT ); Fri, 31 Jul 2020 02:45:18 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 47F3C20829; Fri, 31 Jul 2020 06:45:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596177917; bh=1YXpe3U3o4uaI2bdopIW3kDgpC0UgdKI39pipMD2SOE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=E8u4Ypz5WsgTFM/sdmSvhPdx18F5Ncfwx6utunjwqEs65LQWv47Ol8sOCLpc+42ZP 2IBnWysBTugUJ+Vn5iuruZw6gGmdwAwaLggMGiqNHjE6YcehlgF52LSA5HdllByvWD 7LyissnM2TLiBRCtGP6Xxbmfeh15g4lGZ4gNDetA= Date: Fri, 31 Jul 2020 08:45:05 +0200 From: Greg Kroah-Hartman To: Lukas Wunner 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: <20200731064505.GH1508201@kroah.com> References: <20200730065326.GA3950394@kroah.com> <20200730095610.orkum2n6snb42uzs@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200730095610.orkum2n6snb42uzs@wunner.de> 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 11:56:10AM +0200, Lukas Wunner wrote: > 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. I thought the bus code itself had this type of serialization already...