From patchwork Mon Jul 1 06:50:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rusty Russell X-Patchwork-Id: 2806501 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1B17C9F3C3 for ; Mon, 1 Jul 2013 08:54:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1801C2019F for ; Mon, 1 Jul 2013 08:54:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 182272018A for ; Mon, 1 Jul 2013 08:54:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753345Ab3GAIxE (ORCPT ); Mon, 1 Jul 2013 04:53:04 -0400 Received: from ozlabs.org ([203.10.76.45]:34961 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753262Ab3GAIxA (ORCPT ); Mon, 1 Jul 2013 04:53:00 -0400 Received: by ozlabs.org (Postfix, from userid 1011) id CE5132C00A9; Mon, 1 Jul 2013 18:52:59 +1000 (EST) From: Rusty Russell To: Lucas De Marchi Cc: Andy Lutomirski , linux-kernel@vger.kernel.org, Ben Hutchings , linux-kbuild@vger.kernel.org, Jon Masters Subject: Re: [RFC PATCH] Allow optional module parameters In-Reply-To: <87sj3qpwdz.fsf@rustcorp.com.au> References: <87ehfhtftn.fsf@rustcorp.com.au> <87sj3tsawh.fsf@rustcorp.com.au> <87hak8qfu5.fsf@rustcorp.com.au> <87sj3qpwdz.fsf@rustcorp.com.au> User-Agent: Notmuch/0.15.2+81~gd2c8818 (http://notmuchmail.org) Emacs/23.4.1 (i686-pc-linux-gnu) Date: Mon, 01 Jul 2013 16:20:44 +0930 Message-ID: <87a9m6sri3.fsf@rustcorp.com.au> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Rusty Russell writes: > Lucas De Marchi writes: >> Hi Rusty, >> >> On Mon, Mar 18, 2013 at 11:32 PM, Rusty Russell wrote: >>> Andy Lutomirski writes: >>>> On Sun, Mar 17, 2013 at 7:24 PM, Rusty Russell wrote: >>>>> Andy Lutomirski writes: >>>>>> On Thu, Mar 14, 2013 at 10:03 PM, Rusty Russell wrote: >>>>>>> Err, yes. Don't remove module parameters, they're part of the API. Do >>>>>>> you have a particular example? >>>>>> >>>>>> So things like i915.i915_enable_ppgtt, which is there to enable >>>>>> something experimental, needs to stay forever once the relevant >>>>>> feature becomes non-experimental and non-optional? This seems silly. >>> ... >>>>>> Having the module parameter go away while still allowing the module to >>>>>> load seems like a good solution (possibly with a warning in the logs >>>>>> so the user can eventually delete the parameter). >>>>> >>>>> Why not do that for *every* missing parameter then? Why have this weird >>>>> notation where the user must know that the parameter might one day go >>>>> away? >>>> >>>> Fair enough. What about the other approach, then? Always warn if an >>>> option doesn't match (built-in or otherwise) but load the module >>>> anyways. >>> >>> What does everyone think of this? Jon, Lucas, does this match your >>> experience? >>> >>> Thanks, >>> Rusty. >>> >>> Subject: modules: don't fail to load on unknown parameters. >>> >>> Although parameters are supposed to be part of the kernel API, experimental >>> parameters are often removed. In addition, downgrading a kernel might cause >>> previously-working modules to fail to load. >> >> I agree with this reasoning >> >>> >>> On balance, it's probably better to warn, and load the module anyway. >> >> However loading the module anyway would bring at least one drawback: >> if the user made a typo when passing the option the module would load >> anyway and he will probably not even look in the log, since there's >> was no errors from modprobe. OK, so I've had this patch on the backburner, but noone has come up with anything better so I'll queue it into modules-next now. Thanks, Rusty. modules: don't fail to load on unknown parameters. Although parameters are supposed to be part of the kernel API, experimental parameters are often removed. In addition, downgrading a kernel might cause previously-working modules to fail to load. On balance, it's probably better to warn, and load the module anyway. This may let through a typo, but at least the logs will show it. Reported-by: Andy Lutomirski Signed-off-by: Rusty Russell --- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/module.c b/kernel/module.c index 3c2c72d..46db10a 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -3206,6 +3206,17 @@ out: return err; } +static int unknown_module_param_cb(char *param, char *val, const char *modname) +{ + /* Check for magic 'dyndbg' arg */ + int ret = ddebug_dyndbg_module_param_cb(param, val, modname); + if (ret != 0) { + printk(KERN_WARNING "%s: unknown parameter '%s' ignored\n", + modname, param); + } + return 0; +} + /* Allocate and load the module: note that size of section 0 is always zero, and we rely on this for optional sections. */ static int load_module(struct load_info *info, const char __user *uargs, @@ -3292,7 +3303,7 @@ static int load_module(struct load_info *info, const char __user *uargs, /* Module is ready to execute: parsing args may do that. */ err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, - -32768, 32767, &ddebug_dyndbg_module_param_cb); + -32768, 32767, unknown_module_param_cb); if (err < 0) goto bug_cleanup;