From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753411AbdLSXGj (ORCPT ); Tue, 19 Dec 2017 18:06:39 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:52698 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753280AbdLSXGg (ORCPT ); Tue, 19 Dec 2017 18:06:36 -0500 Subject: Re: [PATCH] lib: add module unload support to sort tests To: Andrew Morton , Pravin Shedge Cc: fkostenzer@live.at, andriy.shevchenko@linux.intel.com, geert@linux-m68k.org, paul.gortmaker@windriver.com, linux-kernel@vger.kernel.org, Jessica Yu , Rusty Russell References: <1513504167-4118-1-git-send-email-pravin.shedge4linux@gmail.com> <20171218142138.f1b84a8c1ca072b15b54af33@linux-foundation.org> <20171219145136.e50d3b4c71fc4b9b6de50338@linux-foundation.org> From: Randy Dunlap Message-ID: <3d17b669-d8e7-f2a7-07ff-b8ccb8bfc28b@infradead.org> Date: Tue, 19 Dec 2017 15:06:29 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171219145136.e50d3b4c71fc4b9b6de50338@linux-foundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/19/17 14:51, Andrew Morton wrote: > On Tue, 19 Dec 2017 23:10:00 +0530 Pravin Shedge wrote: > >>> >>> If so, why do you think we shiould alter lib/test_sort.c to behave in >>> this atypical fashion? >> >> If test case is going affects only at boot time or at module load >> time, it's smart decision to unload module >> automatically on successful completion. > > OK. > > I think it does make sense for a lib/text_*.ko type module to unload > itself after successful completion of the test. However: > > - returning a fake error code from the module's module_init() is a > daft way of doing that. We should find a way to let the > module_init() handler tell do_init_module() "I succeeded, but please > unload me anyway". So the initial sys_init_module() call doesn't say > "it failed". Could create a new, kernel-internal errno for this and > have do_init_module() rewrite that to 0. > > Maybe. A sys_init_module() caller's expectation is that if the > syscall succeeded then the module is now loaded. > > Well. Except for the test_*.ko modules, which are special. > > - Changing any test module so that it now auto-unloads on success is > a non-back-compat change. The practical effect of which will be very > minor: a subsequent rmmod finds that the module isn't there. > > I'm not sure what to do, really. Does any of this matter much at all? Nope. But I would merge this patch that returns fake-error so that the module doesn't remain loaded, similar to what some others also do. I don't think it's worth a new return value for success_but_unload_me. -- ~Randy