From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [Letux-kernel] BUG: drivers/pinctrl/core: races in pinctrl_groups and deferred probing Date: Tue, 19 Jun 2018 00:15:23 -0700 Message-ID: <20180619071523.GZ112168@atomide.com> References: <20180618095428.GQ112168@atomide.com> <20180618115122.GT26255@atomide.com> <20180618181744.GS112168@atomide.com> <404C63D9-169E-4051-88E0-2856F3602A72@goldelico.com> <20180619043408.GT112168@atomide.com> <631A1D2F-093A-498F-8923-FC9CD20E11A8@goldelico.com> <20180619061102.GU112168@atomide.com> <4435BD7A-AE0D-45A5-9D6A-277175ABE489@goldelico.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <4435BD7A-AE0D-45A5-9D6A-277175ABE489@goldelico.com> Sender: linux-kernel-owner@vger.kernel.org To: "H. Nikolaus Schaller" Cc: Christ van Willegen , Linus Walleij , Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Andy Shevchenko , kernel@pyra-handheld.com, Discussions about the Letux Kernel List-Id: linux-gpio@vger.kernel.org * H. Nikolaus Schaller [180619 06:42]: > Hi Tony, > > > Am 19.06.2018 um 08:11 schrieb Tony Lindgren : > > > > * H. Nikolaus Schaller [180619 04:54]: > >>>> I had seen the call sequence > >>>> > >>>> > >>>> > >>>> w/o any lock inside. > > > > So the sequence above has mutex added around adding the pin > > controller specific functions and groups by the patch series > > I posted for both pcs_parse_bits_in_pinctrl_entry() and > > pcs_parse_one_pinctrl_entry(). So I think the above should > > be fixed now. But please confirm to make sure I'm not mistaken. > > Ah, now I see. > > My dump_stack() added to pinctrl_generic_add_group() reported > > [ 6.155487] Hardware name: Generic OMAP36xx (Flattened Device Tree) > [ 6.162048] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [ 6.170166] [] (show_stack) from [] (dump_stack+0x7c/0x9c) > [ 6.177734] [] (dump_stack) from [] (pinctrl_generic_add_group+0x48/0x90) > [ 6.186614] [] (pinctrl_generic_add_group) from [] (pcs_dt_node_to_map+0x4b0/0x81c) > [ 6.196441] [] (pcs_dt_node_to_map) from [] (pinctrl_dt_to_map+0x1ec/0x2b8) > [ 6.205535] [] (pinctrl_dt_to_map) from [] (create_pinctrl+0x58/0x2f8) > [ 6.214141] [] (create_pinctrl) from [] (devm_pinctrl_get+0x2c/0x6c) > [ 6.222625] [] (devm_pinctrl_get) from [] (pinctrl_bind_pins+0x3c/0x138) > [ 6.231445] [] (pinctrl_bind_pins) from [] (driver_probe_device+0xe8/0x318) > [ 6.240509] [] (driver_probe_device) from [] (__driver_attach+0x80/0xa4) > [ 6.249328] [] (__driver_attach) from [] (bus_for_each_dev+0x58/0x7c) > > Apparently I didn't notice that pcs_parse_*_pinctrl_entry() are called > inside pcs_dt_node_to_map() and are part of the call sequence. > > Hence your new mutex locks calls to pinctrl_generic_add_group() as > needed. > > Obviously, the compiler has optimized away the nested calls to static > functions and I had no previous experience with how the whole pinctrl code > works (learning by debugging :). > > So it looks sane and no need for further locks. OK thanks for checking it. Regards, Tony