From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F445C433EF for ; Tue, 16 Nov 2021 06:57:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3CCD61AEC for ; Tue, 16 Nov 2021 06:57:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C3CCD61AEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gvauk3vrKpGlI+85UmxleM/AXchTGsx/vXL8qbVFF4w=; b=R9auiDdMFXlROa rH5ww+JY1PcmBob6zmNuCF2KPPP21T15rtxwlrASZOR6YzopaWuuEc6GMX8rmvYhWG1sMmgj+FRka +AmIlGnEY2MCjqVuIxw3zuLWUeIuudG8zxrb5QSoq5dPg4zPgSQXlNDhQFJALViLFUuj3Go7p9toJ 5ug/Mju4D3HyeZr4tdTdnl6tehP7LBdfxfMMSo5QENXpPn32P/rVLHOQRg7OJ+hW3IDCQUImtsxTD IK/PP4Gwdp6a7rgtvrdQJuGfnhtqUe+v6O19vuEI0jIEj36gPz+SAJxks10jXJWHSGc1eK9pcVv/L Rd5G+m9IgmsgaE3aS3yA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmsNL-000Veg-Is; Tue, 16 Nov 2021 06:55:30 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmrvX-000OsB-3W for linux-arm-kernel@lists.infradead.org; Tue, 16 Nov 2021 06:26:44 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2AA8A614C8; Tue, 16 Nov 2021 06:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637044002; bh=AiP1xjR6qcKw8cmJ80lJrFN5bNbs0D2VyefHMyYb3z0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rAdWQ1YQxccyMONofsDbmG5JRlehNbsB99jOPJzaVFcdTRcA4ws39LiNWk3dB7uWb uNAT5/M4GeN3kEnYpwksavGrmR+POUUZtsZDKXx42L9m0V4gGSyQ+y+ecJSg6h7zao wwhvs9UzhWYf/FBFU0d7JfWEdkj/s1ZlCxm2+EV8= Date: Tue, 16 Nov 2021 07:26:28 +0100 From: "gregkh@linuxfoundation.org" To: "Winiarska, Iwona" Cc: "corbet@lwn.net" , "jae.hyun.yoo@linux.intel.com" , "linux-hwmon@vger.kernel.org" , "andrew@aj.id.au" , "Luck, Tony" , "Hansen, Dave" , "d.mueller@elsoft.ch" , "jdelvare@suse.com" , "linux-kernel@vger.kernel.org" , "olof@lixom.net" , "rdunlap@infradead.org" , "devicetree@vger.kernel.org" , "linux-aspeed@lists.ozlabs.org" , "linux-doc@vger.kernel.org" , "arnd@arndb.de" , "linux@roeck-us.net" , "zweiss@equinix.com" , "robh+dt@kernel.org" , "openbmc@lists.ozlabs.org" , "bp@alien8.de" , "joel@jms.id.au" , "linux-arm-kernel@lists.infradead.org" , "pierre-louis.bossart@linux.intel.com" , "andriy.shevchenko@linux.intel.com" , "Williams, Dan J" Subject: Re: [PATCH v3 06/13] peci: Add device detection Message-ID: References: <20211115182552.3830849-1-iwona.winiarska@intel.com> <20211115182552.3830849-7-iwona.winiarska@intel.com> <368c990c30c5bacde15ac4bce5db8389aea3ec9c.camel@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <368c990c30c5bacde15ac4bce5db8389aea3ec9c.camel@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211115_222643_246460_8ADB73D7 X-CRM114-Status: GOOD ( 18.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Nov 15, 2021 at 10:35:23PM +0000, Winiarska, Iwona wrote: > On Mon, 2021-11-15 at 19:49 +0100, Greg Kroah-Hartman wrote: > > On Mon, Nov 15, 2021 at 07:25:45PM +0100, Iwona Winiarska wrote: > > > +void peci_device_destroy(struct peci_device *device) > > > +{ > > > +=A0=A0=A0=A0=A0=A0=A0bool killed; > > > + > > > +=A0=A0=A0=A0=A0=A0=A0device_lock(&device->dev); > > > +=A0=A0=A0=A0=A0=A0=A0killed =3D kill_device(&device->dev); > > = > > Eeek, why call this? > > = > > > +=A0=A0=A0=A0=A0=A0=A0device_unlock(&device->dev); > > > + > > > +=A0=A0=A0=A0=A0=A0=A0if (!killed) > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0return; > > = > > What happened if something changed after you unlocked it? > = > We either killed it, or the other caller killed it. > = > > = > > Why is kill_device() required at all?=A0 That's a very rare function to > > call, and one that only one "bus" calls today because it is very > > special (i.e. crazy and broken...) > = > It's used to avoid double-delete in case of races between peci_controller > unregister and "manually" removing the device using sysfs (pointed out by= Dan in > v2). We're calling peci_device_destroy() in both callsites. > Other way to solve it would be to just have a peci-specific lock, but > kill_device seemed to be well suited for the problem at hand. > Do you suggest to remove it and just go with the lock? Yes please, remove it and use the lock. Also, why are you required to have a sysfs file that can remove the device? Who wants that? thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel