From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753324AbdLSWvj (ORCPT ); Tue, 19 Dec 2017 17:51:39 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53606 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752829AbdLSWvi (ORCPT ); Tue, 19 Dec 2017 17:51:38 -0500 Date: Tue, 19 Dec 2017 14:51:36 -0800 From: Andrew Morton To: 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 Subject: Re: [PATCH] lib: add module unload support to sort tests Message-Id: <20171219145136.e50d3b4c71fc4b9b6de50338@linux-foundation.org> In-Reply-To: References: <1513504167-4118-1-git-send-email-pravin.shedge4linux@gmail.com> <20171218142138.f1b84a8c1ca072b15b54af33@linux-foundation.org> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?