Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp778650pxb; Tue, 19 Oct 2021 12:49:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy40JwkXP3+r0k6yYl3vMPV3yNVWcYyYd/a1ztpQgVMFkJCWKG5De1TJx9m/ph/uSCEc+Kb X-Received: by 2002:a17:906:2f16:: with SMTP id v22mr39738035eji.126.1634672996299; Tue, 19 Oct 2021 12:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634672996; cv=none; d=google.com; s=arc-20160816; b=rDgRep72tZdZT1DUsUshbmn0Jf8azCkFxFaYk4zkB7RcBMsrapScX7PtA+P+Bn0AWL PBZB66e8wUCcYwCkEDzG+6k6THySlMGnp/ozYK+YqCnEOsI0X9OH0L96oN9CtrqBbb8y FdToQ3+gbX/jSLmWAmqJWZGc2xRX3jcE5+vRJwdszJOFFUyfZDd/ypRC3e1sbUrpyUhf Z0hMrPo3N+JDB+Ia0RlCC+rycKtmuD2wlX/u+HLrASEBEXrKk55XWFTEr6AUv2l0RUKE f43RpLcqfZMyca6DbTssuyGVp8QtIDYAu4U7RTLXdjmSAOuDRAuGleOnxmdP1I8ZJG6W W0Bg== 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=jCo7U915eFRqWzpvn4v1HPXwjv12FjYjhZ4kBCli1BA=; b=bAbW4IUQE1VwbOy6urwm3gR9EpqR4g5UAwIdutdcPEHtxrtacN0wTNIkNWFHRfJL1x /s2PqArhSK6AqzqL5SB3fY2Pmn3Se+2gce9odcd3zGA4F2W32IyILunPrwaOob8eCj9J XCufoHoMaKvjZiDHz4YsuBHc8N0dbRIKxoP8EcH9nS1suleweyYBhytMOPNu/PCVA+ll gEIC9tyo8bHYbQ1cr3s+Dd3ntRFxhq20nm44Os9BW1I2DSLqIYeUf9lZyxtsVjt8CyX9 lOPSWIkJwWIkDvDSs7FXoT71WQGHndr48sUZQYdCctjRJedU/v+vqjBtkjgGoO0FSbOm rAqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=XQzRM95C; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si25349680ejb.572.2021.10.19.12.49.31; Tue, 19 Oct 2021 12:49:56 -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=@infradead.org header.s=bombadil.20210309 header.b=XQzRM95C; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235002AbhJSTsx (ORCPT + 99 others); Tue, 19 Oct 2021 15:48:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230147AbhJSTsw (ORCPT ); Tue, 19 Oct 2021 15:48:52 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E596C06161C; Tue, 19 Oct 2021 12:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jCo7U915eFRqWzpvn4v1HPXwjv12FjYjhZ4kBCli1BA=; b=XQzRM95CX9ofAeF03oyBgo9tdr tca/b6ddAmgUpGHrIOgKOl7J+MmMtICCtW9iI9X/pIp9MDdL8jhpdq1WUpyF+AqNyJJXM+xcXea+Y A+/eXwEiUOwerfpiB9WrGkP+ywwG+ealnZuYQt1ByR+KUnhNAXDvKMFwufKpwEgRWHNiYPNEhnjoi bTJNL3eWVoeD+EBPCVAiiRgFpwqUUIkHuRc7HNZ6R8Ax6kfd/8src6qtI8PSnjLsvdemXY2lQiN4s fVHcuQayWAEmJ2qh+RFvpTD5WkbnMFHUROEQZMwM1v8B3T9/7bol/7RXJacyarkYcDITzTWqga2Vd eQK52yWw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcv49-002XTn-Ah; Tue, 19 Oct 2021 19:46:29 +0000 Date: Tue, 19 Oct 2021 12:46:29 -0700 From: Luis Chamberlain To: Greg KH Cc: Ming Lei , Benjamin Herrenschmidt , Paul Mackerras , tj@kernel.org, akpm@linux-foundation.org, minchan@kernel.org, jeyu@kernel.org, shuah@kernel.org, bvanassche@acm.org, dan.j.williams@intel.com, joe@perches.com, tglx@linutronix.de, keescook@chromium.org, rostedt@goodmis.org, linux-spdx@vger.kernel.org, linux-doc@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 11/12] zram: fix crashes with cpu hotplug multistate Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 07:28:35PM +0200, Greg KH wrote: > On Tue, Oct 19, 2021 at 09:30:05AM -0700, Luis Chamberlain wrote: > > On Tue, Oct 19, 2021 at 06:25:18PM +0200, Greg KH wrote: > > > On Tue, Oct 19, 2021 at 08:50:24AM -0700, Luis Chamberlain wrote: > > > > So do you want to take the position: > > > > > > > > Hey driver authors: you cannot use any shared lock on module removal and > > > > on sysfs ops? > > > > > > Yes, I would not recommend using such a lock at all. sysfs operations > > > happen on a per-device basis, so you can lock the device structure. > > > > All devices are going to be removed on module removal and so cannot be locked. > > devices are not normally created by a driver, that is up to the bus > controller logic. A module will just disconnect itself from the device, > the device does not go away. > > But yes, there are exceptions, and if you are doing something odd like > that, then you need to be aware of crazy things like this, so be > careful. But for all normal drivers, they do not have to worry about > this. "Recommend" is a weak position to take given a possible deadlock with sysfs. Do we want to at the very least document this is not a supported scheme? If so I can also add a simple 1 level indirrection coccinelle patch to detect these schemes and complain about them as wel, if we are going to take this position. But to simply disregard this as "not an issue", or we won't do anything seems pretty counter productive given we *do* had drivers with this issue before *and* still have them upstream, and can end up with more drivers like this later. Luis