From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933707AbXGQRC7 (ORCPT ); Tue, 17 Jul 2007 13:02:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756701AbXGQRCu (ORCPT ); Tue, 17 Jul 2007 13:02:50 -0400 Received: from mx2.suse.de ([195.135.220.15]:50555 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754546AbXGQRCs (ORCPT ); Tue, 17 Jul 2007 13:02:48 -0400 Date: Tue, 17 Jul 2007 19:02:47 +0200 Message-ID: From: Takashi Iwai To: Sam Ravnborg Cc: Domen Puncer , linux-kernel@vger.kernel.org Subject: Re: [PATCH] introduce __init_exit function annotation In-Reply-To: <20070717164846.GB26953@uranus.ravnborg.org> References: <20070717080248.GK4375@moe.telargo.com> <20070717130230.GB24780@uranus.ravnborg.org> <20070717151432.GA25939@uranus.ravnborg.org> <20070717153236.GB25939@uranus.ravnborg.org> <20070717164846.GB26953@uranus.ravnborg.org> User-Agent: Wanderlust/2.15.5 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.5 (beta27) (fiddleheads) (+CVS-20060704) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org At Tue, 17 Jul 2007 18:48:46 +0200, Sam Ravnborg wrote: > > On Tue, Jul 17, 2007 at 05:40:15PM +0200, Takashi Iwai wrote: > > At Tue, 17 Jul 2007 17:32:36 +0200, > > Sam Ravnborg wrote: > > > > > > On Tue, Jul 17, 2007 at 05:16:13PM +0200, Takashi Iwai wrote: > > > > At Tue, 17 Jul 2007 17:14:32 +0200, > > > > Sam Ravnborg wrote: > > > > > > > > > > On Tue, Jul 17, 2007 at 04:52:12PM +0200, Takashi Iwai wrote: > > > > > > At Tue, 17 Jul 2007 15:02:30 +0200, > > > > > > Sam Ravnborg wrote: > > > > > > > > > > > > > > On Tue, Jul 17, 2007 at 10:02:48AM +0200, Domen Puncer wrote: > > > > > > > > Introduce __init_exit, which is useful ie. for drivers that call > > > > > > > > cleanup functions when they fail in __init functions. > > > > > > > > > > > > > > This is wrong. > > > > > > > On arm (just one example of several) the __exit section are discarded > > > > > > > at buildtime so any reference from __init to __exit will cause the > > > > > > > linker to error out. > > > > > > > > > > > > Hmm, from what I see, it adds __init to the function. There is no > > > > > > reference to __exit. > > > > > > > > > > The cleanup functions are marked __exit in the referenced case. > > > > > > > > My understanding is that it's the very purpose of this patch -- > > > > change the mark from __exit to __init_exit for such clean-up > > > > functions. > > > > > > And that is wrong. > > > > You misunderstood. What I meant is the case like this: > > > > static void __init_exit cleanup() > > { > > ... > > } > > > > static void __init foo_init() > > { > > if (error) > > cleanup(); > > } > > > > static void __exit foo_exit() > > { > > cleanup(); > > } > > > > Currently, there is no proper way to mark cleanup(). Neither __init, > > __exit, __devinit nor __devexit can be used there. > > Then you get the annotation sorted out so cleanup() get discarded in the > built-in case. But you leave no room for automated tools to detect this. > > If this is really necessary (and I daught) then a specific section should be > dedicated for this usage. > > We have lot of issues with current __init/__exit, __devinit/__devexit, __cpuint/__cpuexit > and introducing more of the kind does not help it. > So even if it saves a few bytes in some odd cases the added complaxity is IMHO not worth it. Well, I don't think it's a few bytes and not so odd, but I agree that this solution isn't the best way. And, I now remember that this won't work anyway, too. Calling __init from __exit also causes error... BTW, this reminds me why we have to add annotations for each subisdiary function manually. A tool to parse the code statically and give the proper annotations/hints would be really nice. Takashi