From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754881AbbHFXJz (ORCPT ); Thu, 6 Aug 2015 19:09:55 -0400 Received: from lb2-smtp-cloud6.xs4all.net ([194.109.24.28]:58286 "EHLO lb2-smtp-cloud6.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753371AbbHFXJx (ORCPT ); Thu, 6 Aug 2015 19:09:53 -0400 Message-ID: <1438902589.26981.14.camel@tiscali.nl> Subject: Re: windfarm: decrement client count when unregistering From: Paul Bolle To: Michael Ellerman Cc: Benjamin Herrenschmidt , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Date: Fri, 07 Aug 2015 01:09:49 +0200 In-Reply-To: <1438899707.25241.29.camel@tiscali.nl> References: <20150805041611.ACBD6140324@ozlabs.org> <1438899707.25241.29.camel@tiscali.nl> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.4 (3.16.4-2.fc22) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On vr, 2015-08-07 at 00:21 +0200, Paul Bolle wrote: > On wo, 2015-08-05 at 14:16 +1000, Michael Ellerman wrote: > > I also get an oops when removing windfarm_lm75_sensor, so I suspect there are > > gremlins in the module ref counting for windfarm. > > (This I haven't (yet) looked into.) And that might be, sort of, related. Because oops is probably triggered by the, it seems, rather straightforward chain of events triggered by unloading an I2C module. (So windfarm_lm75_sensor refcount must be zero.) Which gets interesting at: wf_lm75_remove() wf_unregister_sensor(&wf_lm75_sensor->sens) wf_put_sensor(&wf_lm75_sensor->sens) module_put(wf_lm75_sensor->sens->ops->owner /* THIS_MODULE */) And in windfarm_lm75_sensor we trigger this issue because in the .probe() function there appears to be no corresponding call to try_module_get() preventing unloading the module, as we saw in windfarm_ smu_sensors. So module refcounting looks broken for both these modules in opposite ways. Gremlins indeed. Good luck! Paul Bolle