Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d25413ef authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull module and param updates from Rusty Russell:
 "I'm getting married next week, and then honeymoon until 6th May.  I'll
  be offline from next week, except to post the compulsory pictures if
  Alex shaves her head..."

I'm sure Rusty can take time off from his honeymoon if something comes
up. And here's the explanation about head shaving:

	http://baldalex.org/

in case you wondered and wanted to support another insane caper or
Rusty's involving shaving.

What *is* it with Rusty and shaving, anyway?

* git://github.com/rustyrussell/linux:
  module: Remove module size limit
  module: move __module_get and try_module_get() out of line.
  params: <level>_initcall-like kernel parameters
  module_param: remove support for bool parameters which are really int.
  module: add kernel param to force disable module load
parents 683c5e85 f946eeb9
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -1869,6 +1869,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
			shutdown the other cpus.  Instead use the REBOOT_VECTOR
			shutdown the other cpus.  Instead use the REBOOT_VECTOR
			irq.
			irq.


	nomodule	Disable module load

	nopat		[X86] Disable PAT (page attribute table extension of
	nopat		[X86] Disable PAT (page attribute table extension of
			pagetables) support.
			pagetables) support.


+2 −1
Original line number Original line Diff line number Diff line
@@ -310,7 +310,8 @@ void __init reserve_hugetlb_gpages(void)
	int i;
	int i;


	strlcpy(cmdline, boot_command_line, COMMAND_LINE_SIZE);
	strlcpy(cmdline, boot_command_line, COMMAND_LINE_SIZE);
	parse_args("hugetlb gpages", cmdline, NULL, 0, &do_gpage_early_setup);
	parse_args("hugetlb gpages", cmdline, NULL, 0, 0, 0,
			&do_gpage_early_setup);


	/*
	/*
	 * Walk gpage list in reverse, allocating larger page sizes first.
	 * Walk gpage list in reverse, allocating larger page sizes first.
+14 −21
Original line number Original line Diff line number Diff line
@@ -616,30 +616,23 @@
		*(.init.setup)						\
		*(.init.setup)						\
		VMLINUX_SYMBOL(__setup_end) = .;
		VMLINUX_SYMBOL(__setup_end) = .;


#define INITCALLS							\
#define INIT_CALLS_LEVEL(level)						\
	*(.initcallearly.init)						\
		VMLINUX_SYMBOL(__initcall##level##_start) = .;		\
	VMLINUX_SYMBOL(__early_initcall_end) = .;			\
		*(.initcall##level##.init)				\
  	*(.initcall0.init)						\
		*(.initcall##level##s.init)				\
  	*(.initcall0s.init)						\
  	*(.initcall1.init)						\
  	*(.initcall1s.init)						\
  	*(.initcall2.init)						\
  	*(.initcall2s.init)						\
  	*(.initcall3.init)						\
  	*(.initcall3s.init)						\
  	*(.initcall4.init)						\
  	*(.initcall4s.init)						\
  	*(.initcall5.init)						\
  	*(.initcall5s.init)						\
	*(.initcallrootfs.init)						\
  	*(.initcall6.init)						\
  	*(.initcall6s.init)						\
  	*(.initcall7.init)						\
  	*(.initcall7s.init)


#define INIT_CALLS							\
#define INIT_CALLS							\
		VMLINUX_SYMBOL(__initcall_start) = .;			\
		VMLINUX_SYMBOL(__initcall_start) = .;			\
		INITCALLS						\
		*(.initcallearly.init)					\
		INIT_CALLS_LEVEL(0)					\
		INIT_CALLS_LEVEL(1)					\
		INIT_CALLS_LEVEL(2)					\
		INIT_CALLS_LEVEL(3)					\
		INIT_CALLS_LEVEL(4)					\
		INIT_CALLS_LEVEL(5)					\
		INIT_CALLS_LEVEL(rootfs)				\
		INIT_CALLS_LEVEL(6)					\
		INIT_CALLS_LEVEL(7)					\
		VMLINUX_SYMBOL(__initcall_end) = .;
		VMLINUX_SYMBOL(__initcall_end) = .;


#define CON_INITCALL							\
#define CON_INITCALL							\
+4 −28
Original line number Original line Diff line number Diff line
@@ -21,8 +21,6 @@
#include <linux/percpu.h>
#include <linux/percpu.h>
#include <asm/module.h>
#include <asm/module.h>


#include <trace/events/module.h>

/* Not Yet Implemented */
/* Not Yet Implemented */
#define MODULE_SUPPORTED_DEVICE(name)
#define MODULE_SUPPORTED_DEVICE(name)


@@ -452,33 +450,11 @@ void symbol_put_addr(void *addr);


/* Sometimes we know we already have a refcount, and it's easier not
/* Sometimes we know we already have a refcount, and it's easier not
   to handle the error case (which only happens with rmmod --wait). */
   to handle the error case (which only happens with rmmod --wait). */
static inline void __module_get(struct module *module)
extern void __module_get(struct module *module);
{
	if (module) {
		preempt_disable();
		__this_cpu_inc(module->refptr->incs);
		trace_module_get(module, _THIS_IP_);
		preempt_enable();
	}
}

static inline int try_module_get(struct module *module)
{
	int ret = 1;

	if (module) {
		preempt_disable();


		if (likely(module_is_live(module))) {
/* This is the Right Way to get a module: if it fails, it's being removed,
			__this_cpu_inc(module->refptr->incs);
 * so pretend it's not there. */
			trace_module_get(module, _THIS_IP_);
extern bool try_module_get(struct module *module);
		} else
			ret = 0;

		preempt_enable();
	}
	return ret;
}


extern void module_put(struct module *module);
extern void module_put(struct module *module);


+43 −15
Original line number Original line Diff line number Diff line
@@ -47,14 +47,11 @@ struct kernel_param_ops {
	void (*free)(void *arg);
	void (*free)(void *arg);
};
};


/* Flag bits for kernel_param.flags */
#define KPARAM_ISBOOL		2

struct kernel_param {
struct kernel_param {
	const char *name;
	const char *name;
	const struct kernel_param_ops *ops;
	const struct kernel_param_ops *ops;
	u16 perm;
	u16 perm;
	u16 flags;
	s16 level;
	union {
	union {
		void *arg;
		void *arg;
		const struct kparam_string *str;
		const struct kparam_string *str;
@@ -131,8 +128,40 @@ struct kparam_array
 * The ops can have NULL set or get functions.
 * The ops can have NULL set or get functions.
 */
 */
#define module_param_cb(name, ops, arg, perm)				      \
#define module_param_cb(name, ops, arg, perm)				      \
	__module_param_call(MODULE_PARAM_PREFIX,			      \
	__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, 0)
			    name, ops, arg, __same_type((arg), bool *), perm)

/**
 * <level>_param_cb - general callback for a module/cmdline parameter
 *                    to be evaluated before certain initcall level
 * @name: a valid C identifier which is the parameter name.
 * @ops: the set & get operations for this parameter.
 * @perm: visibility in sysfs.
 *
 * The ops can have NULL set or get functions.
 */
#define __level_param_cb(name, ops, arg, perm, level)			\
	__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level)

#define core_param_cb(name, ops, arg, perm)		\
	__level_param_cb(name, ops, arg, perm, 1)

#define postcore_param_cb(name, ops, arg, perm)		\
	__level_param_cb(name, ops, arg, perm, 2)

#define arch_param_cb(name, ops, arg, perm)		\
	__level_param_cb(name, ops, arg, perm, 3)

#define subsys_param_cb(name, ops, arg, perm)		\
	__level_param_cb(name, ops, arg, perm, 4)

#define fs_param_cb(name, ops, arg, perm)		\
	__level_param_cb(name, ops, arg, perm, 5)

#define device_param_cb(name, ops, arg, perm)		\
	__level_param_cb(name, ops, arg, perm, 6)

#define late_param_cb(name, ops, arg, perm)		\
	__level_param_cb(name, ops, arg, perm, 7)


/* On alpha, ia64 and ppc64 relocations to global data cannot go into
/* On alpha, ia64 and ppc64 relocations to global data cannot go into
   read-only sections (which is part of respective UNIX ABI on these
   read-only sections (which is part of respective UNIX ABI on these
@@ -146,7 +175,7 @@ struct kparam_array


/* This is the fundamental function for registering boot/module
/* This is the fundamental function for registering boot/module
   parameters. */
   parameters. */
#define __module_param_call(prefix, name, ops, arg, isbool, perm)	\
#define __module_param_call(prefix, name, ops, arg, perm, level)	\
	/* Default value instead of permissions? */			\
	/* Default value instead of permissions? */			\
	static int __param_perm_check_##name __attribute__((unused)) =	\
	static int __param_perm_check_##name __attribute__((unused)) =	\
	BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2))	\
	BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2))	\
@@ -155,8 +184,7 @@ struct kparam_array
	static struct kernel_param __moduleparam_const __param_##name	\
	static struct kernel_param __moduleparam_const __param_##name	\
	__used								\
	__used								\
    __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
    __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
	= { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0,	\
	= { __param_str_##name, ops, perm, level, { arg } }
	    { arg } }


/* Obsolete - use module_param_cb() */
/* Obsolete - use module_param_cb() */
#define module_param_call(name, set, get, arg, perm)			\
#define module_param_call(name, set, get, arg, perm)			\
@@ -164,8 +192,7 @@ struct kparam_array
		 { (void *)set, (void *)get };				\
		 { (void *)set, (void *)get };				\
	__module_param_call(MODULE_PARAM_PREFIX,			\
	__module_param_call(MODULE_PARAM_PREFIX,			\
			    name, &__param_ops_##name, arg,		\
			    name, &__param_ops_##name, arg,		\
			    __same_type(arg, bool *),			\
			    (perm) + sizeof(__check_old_set_param(set))*0, 0)
			    (perm) + sizeof(__check_old_set_param(set))*0)


/* We don't get oldget: it's often a new-style param_get_uint, etc. */
/* We don't get oldget: it's often a new-style param_get_uint, etc. */
static inline int
static inline int
@@ -245,8 +272,7 @@ static inline void __kernel_param_unlock(void)
 */
 */
#define core_param(name, var, type, perm)				\
#define core_param(name, var, type, perm)				\
	param_check_##type(name, &(var));				\
	param_check_##type(name, &(var));				\
	__module_param_call("", name, &param_ops_##type,		\
	__module_param_call("", name, &param_ops_##type, &var, perm, 0)
			    &var, __same_type(var, bool), perm)
#endif /* !MODULE */
#endif /* !MODULE */


/**
/**
@@ -264,7 +290,7 @@ static inline void __kernel_param_unlock(void)
		= { len, string };					\
		= { len, string };					\
	__module_param_call(MODULE_PARAM_PREFIX, name,			\
	__module_param_call(MODULE_PARAM_PREFIX, name,			\
			    &param_ops_string,				\
			    &param_ops_string,				\
			    .str = &__param_string_##name, 0, perm);	\
			    .str = &__param_string_##name, perm, 0);	\
	__MODULE_PARM_TYPE(name, "string")
	__MODULE_PARM_TYPE(name, "string")


/**
/**
@@ -292,6 +318,8 @@ extern int parse_args(const char *name,
		      char *args,
		      char *args,
		      const struct kernel_param *params,
		      const struct kernel_param *params,
		      unsigned num,
		      unsigned num,
		      s16 level_min,
		      s16 level_max,
		      int (*unknown)(char *param, char *val));
		      int (*unknown)(char *param, char *val));


/* Called by module remove. */
/* Called by module remove. */
@@ -403,7 +431,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp);
	__module_param_call(MODULE_PARAM_PREFIX, name,			\
	__module_param_call(MODULE_PARAM_PREFIX, name,			\
			    &param_array_ops,				\
			    &param_array_ops,				\
			    .arr = &__param_arr_##name,			\
			    .arr = &__param_arr_##name,			\
			    __same_type(array[0], bool), perm);		\
			    perm, 0);					\
	__MODULE_PARM_TYPE(name, "array of " #type)
	__MODULE_PARM_TYPE(name, "array of " #type)


extern struct kernel_param_ops param_array_ops;
extern struct kernel_param_ops param_array_ops;
Loading