Lustre: final procfs bits removal.
cover Lustre: final procfs bits removal.
From: Oleg Drokin <[email protected]>
This patch series removes the sysctls (also under /proc) from Lustre. /proc/sys/lnet is moved to debugfs and/proc/sys/lustre content is moved to /sys/fs/lustre
Additionally we now have the tools that understand the new layout, and so first few patches fix problems introduced by earlier code moving to sysfs.
With this accepted there would be no more proc files exported by Lustre.
Please consider.
Dmitry Eremin (4):
staging/lustre/libcfs: Remove redundant enums and sysctl moduleparams staging/lustre/libcfs: Remove unneeded lnet watchdog_ratelimit sysctl staging/lustre/libcfs: get rid of
debugfs/lnet/console_{min,max}_delay_centisecs
staging/lustre/libcfs: remove unused portal_enter_debugger variable
Oleg Drokin (16):
staging/lustre/lov: Move target sysfs symlink removal to object
freeing
staging/lustre: make ldebugfs_remove recursive staging/lustre/ldlm: In ldlm_pools_fini make sure there was init
first.
staging/lustre/obdclass: fix class_procfs_init error return value staging/lustre: remove alloc_fail_rate sysctl staging/lustre: Remove now obsolete memory tracking sysctls staging/lustre: Remove unneeded ldlm_timeout control staging/lustre/obdclass: move sysctl timeout to sysfs staging/lustre/obdclass: move max_dirty_mb from sysctl to sysfs staging/lustre/obdclass: move debug controls to sysfs staging/lustre/obdclass: Move AT controls from sysctl to sysfs staging/lustre: Get rid of remaining /proc/sys/lustre plumbing staging/lustre/libcfs: move /proc/sys/lnet to debugfs staging/lustre/libcfs: Remove redundant lnet debugfs variables staging/lustre/libcfs: get rid of debugfs/lnet/console_backoff staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
.../lustre/include/linux/libcfs/libcfs_debug.h | 1 - .../lustre/include/linux/libcfs/libcfs_private.h | 28 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 12 - .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 5 - .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 3 +- drivers/staging/lustre/lnet/lnet/router_proc.c | 11 - drivers/staging/lustre/lustre/include/obd_class.h | 3 +- .../staging/lustre/lustre/include/obd_support.h | 16 +- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 9 - drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 6 +- drivers/staging/lustre/lustre/libcfs/debug.c | 146 +++++++- drivers/staging/lustre/lustre/libcfs/module.c | 334 +++++------------- drivers/staging/lustre/lustre/libcfs/tracefile.c | 12 - drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 - drivers/staging/lustre/lustre/lov/lov_obd.c | 7 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 17 +- .../lustre/lustre/obdclass/linux/linux-module.c | 2 +- .../lustre/lustre/obdclass/linux/linux-sysctl.c | 374 +++++---------------- .../lustre/lustre/obdclass/lprocfs_status.c | 2 +- .../staging/lustre/lustre/obdclass/obd_config.c | 7 +- drivers/staging/lustre/sysfs-fs-lustre | 103 ++++++ 21 files changed, 424 insertions(+), 675 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/20 staging/lustre/lov: Move target sysfs symlink removal to object freeing
From: Oleg Drokin <[email protected]>
This helps to avoid use after free on unmount.
--- drivers/staging/lustre/lustre/lov/lov_obd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/lov/lov_obd.c +4 -3
@@ -107,6 +107,10 @@ static void lov_putref(struct obd_device *obd)/* Disconnect */ __lov_del_obd (obd, tgt); } + +if (lov->lov_tgts_kobj) +kobject_put (lov->lov_tgts_kobj); + }else {mutex_unlock (&lov->lov_lock); }
@@ -322,9 +326,6 @@ static int lov_disconnect(struct obd_export *exp) } } -if (lov->lov_tgts_kobj) -kobject_put (lov->lov_tgts_kobj); -obd_putref (obd); out:
Signature · 1 line
2.1.0
PATCH 2/20 staging/lustre: make ldebugfs_remove recursive
In reply to [email protected]From: Oleg Drokin <[email protected]>
ldebugfs_remove is usually called on directories with files passed in as attributes, so simple debugfs_remove failes on them as not empty Switch to debugfs_remove_recursive.
This fixes a number of problems where a new filesystem is mounted after being unmounted first.
--- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +1 -1
@@ -329,7 +329,7 @@ EXPORT_SYMBOL(ldebugfs_add_vars);void ldebugfs_remove (struct dentry **entryp) { -debugfs_remove (*entryp); +debugfs_remove_recursive (*entryp); *entryp =NULL ; }EXPORT_SYMBOL (ldebugfs_remove);
Signature · 1 line
2.1.0
PATCH 3/20 staging/lustre/ldlm: In ldlm_pools_fini make sure there was init first.
In reply to [email protected]From: Oleg Drokin <[email protected]>
It turns out if you call ldlm_pools_fini without completing the ldlm_pools_init, then attempt to unregister not yet registered shrinkers makes the kernel very unhappy.
So make sure we have them registered first.
--- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +4 -2
@@ -1486,8 +1486,10 @@ EXPORT_SYMBOL(ldlm_pools_init);void ldlm_pools_fini (void ) { -unregister_shrinker (&ldlm_pools_srv_shrinker); -unregister_shrinker (&ldlm_pools_cli_shrinker); +if (ldlm_pools_thread) { +unregister_shrinker (&ldlm_pools_srv_shrinker); +unregister_shrinker (&ldlm_pools_cli_shrinker); + }ldlm_pools_thread_stop (); }EXPORT_SYMBOL (ldlm_pools_fini);
Signature · 1 line
2.1.0
PATCH 4/20 staging/lustre/obdclass: fix class_procfs_init error return value
In reply to [email protected]From: Oleg Drokin <[email protected]>
Dan Carpenter noticed that procfs conversion patches introduced a bug where should kobject_create_and_add, an error is not returned from class_procfs_init.
--- drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +1 -1
@@ -423,7 +423,7 @@ static struct attribute_group lustre_attr_group = {int class_procfs_init (void ) { -int rc =0 ; +int rc = -ENOMEM ;struct dentry *file; lustre_kobj =kobject_create_and_add ("lustre" , fs_kobj);
Signature · 1 line
2.1.0
PATCH 5/20 staging/lustre: remove alloc_fail_rate sysctl
In reply to [email protected]From: Oleg Drokin <[email protected]>
It was used to control allocation failure rate, but there is in-kernel way of doing that that's more versatile too.
This is going to remove just the sysctl, the underlying variable will be removed once all OBD_ALLOC* macros removal patchseries land.
--- .../lustre/lustre/obdclass/linux/linux-sysctl.c | 38 ---------------------- 1 file changed, 38 deletions(-)
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +0 -38
@@ -203,37 +203,6 @@ static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write,return rc; } -static int proc_alloc_fail_rate (struct ctl_table *table,int write, -void __user *buffer,size_t *lenp,loff_t *ppos) -{ -int rc =0 ; - -if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { - *lenp =0 ; -return 0 ; - } -if (write) { - rc =lprocfs_write_frac_helper (buffer, *lenp, - (unsigned int *)table->data, -OBD_ALLOC_FAIL_MULT ); - }else { -char buf[21 ]; -int len; - - len =lprocfs_read_frac_helper (buf,21 , - *(unsigned int *)table->data, -OBD_ALLOC_FAIL_MULT ); -if (len > *lenp) - len = *lenp; - buf[len] ='\0' ; -if (copy_to_user (buffer, buf, len)) -return -EFAULT ; - *lenp = len; - } - *ppos += *lenp; -return rc; -} -static struct ctl_table obd_table[] = { { .procname ="timeout" ,
@@ -299,13 +268,6 @@ static struct ctl_table obd_table[] = { .proc_handler = &proc_set_timeout }, { - .procname = "alloc_fail_rate", - .data = &obd_alloc_fail_rate, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_alloc_fail_rate - }, - { .procname = "max_dirty_mb", .data = &obd_max_dirty_pages, .maxlen = sizeof(int),
Signature · 1 line
2.1.0
PATCH 6/20 staging/lustre: Remove now obsolete memory tracking sysctls
In reply to [email protected]From: Oleg Drokin <[email protected]>
In the past when Lustre did its own allocation amounts tracking the results were shown in sysctl as current and overall max number of bytes and pages allocated. Now that we don't track these, remove the sysctls.
--- .../lustre/lustre/obdclass/linux/linux-sysctl.c | 124 --------------------- 1 file changed, 124 deletions(-)
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +0 -124
@@ -66,102 +66,6 @@ static int proc_set_timeout(struct ctl_table *table, int write,return rc; } -static int proc_memory_alloc (struct ctl_table *table,int write, -void __user *buffer,size_t *lenp,loff_t *ppos) -{ -char buf[22 ]; -int len; - -if (!*lenp || (*ppos && !write)) { - *lenp =0 ; -return 0 ; - } -if (write) -return -EINVAL ; - - len =snprintf (buf,sizeof (buf),"%llu\n" ,obd_memory_sum ()); -if (len > *lenp) - len = *lenp; - buf[len] ='\0' ; -if (copy_to_user (buffer, buf, len)) -return -EFAULT ; - *lenp = len; - *ppos += *lenp; -return 0 ; -} - -static int proc_pages_alloc (struct ctl_table *table,int write, -void __user *buffer,size_t *lenp,loff_t *ppos) -{ -char buf[22 ]; -int len; - -if (!*lenp || (*ppos && !write)) { - *lenp =0 ; -return 0 ; - } -if (write) -return -EINVAL ; - - len =snprintf (buf,sizeof (buf),"%llu\n" ,obd_pages_sum ()); -if (len > *lenp) - len = *lenp; - buf[len] ='\0' ; -if (copy_to_user (buffer, buf, len)) -return -EFAULT ; - *lenp = len; - *ppos += *lenp; -return 0 ; -} - -static int proc_mem_max (struct ctl_table *table,int write,void __user *buffer, -size_t *lenp,loff_t *ppos) -{ -char buf[22 ]; -int len; - -if (!*lenp || (*ppos && !write)) { - *lenp =0 ; -return 0 ; - } -if (write) -return -EINVAL ; - - len =snprintf (buf,sizeof (buf),"%llu\n" ,obd_memory_max ()); -if (len > *lenp) - len = *lenp; - buf[len] ='\0' ; -if (copy_to_user (buffer, buf, len)) -return -EFAULT ; - *lenp = len; - *ppos += *lenp; -return 0 ; -} - -static int proc_pages_max (struct ctl_table *table,int write, -void __user *buffer,size_t *lenp,loff_t *ppos) -{ -char buf[22 ]; -int len; - -if (!*lenp || (*ppos && !write)) { - *lenp =0 ; -return 0 ; - } -if (write) -return -EINVAL ; - - len =snprintf (buf,sizeof (buf),"%llu\n" ,obd_pages_max ()); -if (len > *lenp) - len = *lenp; - buf[len] ='\0' ; -if (copy_to_user (buffer, buf, len)) -return -EFAULT ; - *lenp = len; - *ppos += *lenp; -return 0 ; -} -static int proc_max_dirty_pages_in_mb (struct ctl_table *table,int write,void __user *buffer,size_t *lenp,loff_t *ppos) {
@@ -233,34 +137,6 @@ static struct ctl_table obd_table[] = { .proc_handler = &proc_dointvec }, { - .procname = "memused", - .data = NULL, - .maxlen = 0, - .mode = 0444, - .proc_handler = &proc_memory_alloc - }, - { - .procname = "pagesused", - .data = NULL, - .maxlen = 0, - .mode = 0444, - .proc_handler = &proc_pages_alloc - }, - { - .procname = "memused_max", - .data = NULL, - .maxlen = 0, - .mode = 0444, - .proc_handler = &proc_mem_max - }, - { - .procname = "pagesused_max", - .data = NULL, - .maxlen = 0, - .mode = 0444, - .proc_handler = &proc_pages_max - }, - { .procname = "ldlm_timeout", .data = &ldlm_timeout, .maxlen = sizeof(int),
Signature · 1 line
2.1.0
PATCH 7/20 staging/lustre: Remove unneeded ldlm_timeout control
In reply to [email protected]From: Oleg Drokin <[email protected]>
ldlm_timeout is used server-side to determine AST timeouts, so it makes no sense on the client, esp. since it's not really used anywhere.
Remove all traces of it except from the config where make it a noop.
--- drivers/staging/lustre/lustre/include/obd_support.h | 4 ---- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 9 --------- drivers/staging/lustre/lustre/obdclass/class_obd.c | 4 ---- drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c | 9 --------- drivers/staging/lustre/lustre/obdclass/obd_config.c | 7 +------ 5 files changed, 1 insertion(+), 32 deletions(-)
drivers/staging/lustre/lustre/include/obd_support.h +0 -4
@@ -56,9 +56,7 @@ extern unsigned int obd_dump_on_eviction;/* obd_timeout should only be used for recovery, not for networking / disk / timings affected by load (use Adaptive Timeouts) */ extern unsigned int obd_timeout;/* seconds */ -extern unsigned int ldlm_timeout;/* seconds */ extern unsigned int obd_timeout_set; -extern unsigned int ldlm_timeout_set;extern unsigned int at_min;extern unsigned int at_max;extern unsigned int at_history;
@@ -105,8 +103,6 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,/* Timeout definitions */ #define OBD_TIMEOUT_DEFAULT 100 -#define LDLM_TIMEOUT_DEFAULT 20 -#define MDS_LDLM_TIMEOUT_DEFAULT 6/* Time to wait for all clients to reconnect during recovery (hard limit) */ #define OBD_RECOVERY_TIME_HARD (obd_timeout * 9)/* Time to wait for all clients to reconnect during recovery (soft limit) */
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +0 -9
@@ -76,15 +76,6 @@ inline unsigned long round_timeout(unsigned long timeout)return cfs_time_seconds ((int )cfs_duration_sec (cfs_time_sub (timeout,0 )) +1 ); } -/* timeout for initial callback (AST) reply (bz10399) */ -static inline unsigned int ldlm_get_rq_timeout (void ) -{ -/* Non-AT value */ -unsigned int timeout =min (ldlm_timeout, obd_timeout /3 ); - -return timeout <1 ?1 : timeout; -} -#define ELT_STOPPED 0#define ELT_READY 1#define ELT_TERMINATE 2
drivers/staging/lustre/lustre/obdclass/class_obd.c +0 -4
@@ -78,12 +78,8 @@ atomic_t obd_dirty_pages;EXPORT_SYMBOL (obd_dirty_pages);unsigned int obd_timeout =OBD_TIMEOUT_DEFAULT ;/* seconds */ EXPORT_SYMBOL (obd_timeout); -unsigned int ldlm_timeout =LDLM_TIMEOUT_DEFAULT ;/* seconds */ -EXPORT_SYMBOL (ldlm_timeout);unsigned int obd_timeout_set;EXPORT_SYMBOL (obd_timeout_set); -unsigned int ldlm_timeout_set; -EXPORT_SYMBOL (ldlm_timeout_set);/* Adaptive timeout defs here instead of ptlrpc module for /proc/sys/ access */ unsigned int at_min =0 ;EXPORT_SYMBOL (at_min);
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +0 -9
@@ -61,8 +61,6 @@ static int proc_set_timeout(struct ctl_table *table, int write,int rc; rc =proc_dointvec (table, write, buffer, lenp, ppos); -if (ldlm_timeout >= obd_timeout) - ldlm_timeout =max (obd_timeout /3 ,1U );return rc; }
@@ -137,13 +135,6 @@ static struct ctl_table obd_table[] = { .proc_handler = &proc_dointvec }, { - .procname = "ldlm_timeout", - .data = &ldlm_timeout, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_set_timeout - }, - { .procname = "max_dirty_mb", .data = &obd_max_dirty_pages, .maxlen = sizeof(int),
drivers/staging/lustre/lustre/obdclass/obd_config.c +1 -6
@@ -1123,12 +1123,7 @@ int class_process_config(struct lustre_cfg *lcfg) goto out; }case LCFG_SET_LDLM_TIMEOUT : { -CDEBUG (D_IOCTL ,"changing lustre ldlm_timeout from %d to %d\n" , - ldlm_timeout, lcfg->lcfg_num); - ldlm_timeout =max (lcfg->lcfg_num,1U ); -if (ldlm_timeout >= obd_timeout) - ldlm_timeout =max (obd_timeout /3 ,1U ); - ldlm_timeout_set =1 ; +/* ldlm_timeout is not used on the client */ err =0 ; goto out; }
Signature · 1 line
2.1.0
PATCH 8/20 staging/lustre/obdclass: move sysctl timeout to sysfs
In reply to [email protected]From: Oleg Drokin <[email protected]>
This is the first step of moving lustre sysctls from /proc/sys/lustre to /sys/fs/lustre
--- drivers/staging/lustre/lustre/include/obd_class.h | 4 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 6 +- .../lustre/lustre/obdclass/linux/linux-sysctl.c | 66 +++++++++++++++++----- drivers/staging/lustre/sysfs-fs-lustre | 12 ++++ 4 files changed, 71 insertions(+), 17 deletions(-)
drivers/staging/lustre/lustre/include/obd_class.h +2 -2
@@ -1869,8 +1869,8 @@ extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c);/* obd_mount.c */ /* sysctl.c */ -extern void obd_sysctl_init (void ); -extern void obd_sysctl_clean (void ); +extern int obd_sysctl_init (void ); +extern void obd_sysctl_clean (void );/* uuid.c */ typedef __u8 class_uuid_t [16 ];
drivers/staging/lustre/lustre/obdclass/class_obd.c +4 -2
@@ -567,12 +567,14 @@ static int __init init_obdclass(void)if (err)return err; -obd_sysctl_init (); - err =class_procfs_init ();if (err)return err; + err =obd_sysctl_init (); +if (err) +return err; + err =lu_global_init ();if (err)return err;
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +53 -13
94 lines not on this page · raw message
drivers/staging/lustre/sysfs-fs-lustre +12 -0
@@ -40,6 +40,18 @@ Description: e.g. dd.1253 nodelocal - use jobid_name value from above. +What: /sys/fs/lustre/timeout +Date: June 2015 +Contact: "Oleg Drokin" <[email protected]> +Description: + Controls "lustre timeout" variable, also known as obd_timeout + in some old manual. In the past obd_timeout was of paramount + importance as the timeout value used everywhere and where + other timeouts were derived from. These days it's much less + important as network timeouts are mostly determined by + AT (adaptive timeouts). + Unit: seconds, default: 100 + What: /sys/fs/lustre/llite/<fsname>-<uuid>/blocksize Date: May 2015 Contact: "Oleg Drokin" <[email protected]>
Signature · 1 line
2.1.0
PATCH 9/20 staging/lustre/obdclass: move max_dirty_mb from sysctl to sysfs
In reply to [email protected]From: Oleg Drokin <[email protected]>
max_dirty_mb is now a parameter in /sys/fs/lustre/
--- .../lustre/lustre/obdclass/linux/linux-sysctl.c | 74 +++++++++------------- drivers/staging/lustre/sysfs-fs-lustre | 12 ++++ 2 files changed, 43 insertions(+), 43 deletions(-)
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +31 -43
@@ -100,48 +100,42 @@ static struct static_lustre_uintvalue_attr lustre_sattr_##name = \LUSTRE_STATIC_UINT_ATTR (timeout, &obd_timeout); -#ifdef CONFIG_SYSCTL -static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) +static ssize_t max_dirty_mb_show (struct kobject *kobj,struct attribute *attr, +char *buf) { - int rc = 0; +return sprintf (buf,"%ul\n" , + obd_max_dirty_pages / (1 << (20 -PAGE_CACHE_SHIFT ))); +} + +static ssize_t max_dirty_mb_store (struct kobject *kobj,struct attribute *attr, +const char *buffer,size_t count) +{ +int rc; +unsigned long val; + + rc =kstrtoul (buffer,10 , &val); +if (rc) +return rc; + + val *=1 << (20 -PAGE_CACHE_SHIFT );/* convert to pages */ - if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { - *lenp = 0; - return 0; +if (val > ((totalram_pages /10 ) *9 )) { +/* Somebody wants to assign too much memory to dirty pages */ +return -EINVAL ; } - if (write) { - rc = lprocfs_write_frac_helper(buffer, *lenp, - (unsigned int *)table->data, - 1 << (20 - PAGE_CACHE_SHIFT)); - /* Don't allow them to let dirty pages exceed 90% of system - * memory and set a hard minimum of 4MB. */ - if (obd_max_dirty_pages > ((totalram_pages / 10) * 9)) { - CERROR("Refusing to set max dirty pages to %u, which is more than 90%% of available RAM; setting to %lu\n", - obd_max_dirty_pages, - ((totalram_pages / 10) * 9)); - obd_max_dirty_pages = (totalram_pages / 10) * 9; - } else if (obd_max_dirty_pages < 4 << (20 - PAGE_CACHE_SHIFT)) { - obd_max_dirty_pages = 4 << (20 - PAGE_CACHE_SHIFT); - } - } else { - char buf[21]; - int len; - - len = lprocfs_read_frac_helper(buf, sizeof(buf), - *(unsigned int *)table->data, - 1 << (20 - PAGE_CACHE_SHIFT)); - if (len > *lenp) - len = *lenp; - buf[len] = '\0'; - if (copy_to_user(buffer, buf, len)) - return -EFAULT; - *lenp = len; + +if (val <4 << (20 -PAGE_CACHE_SHIFT )) { +/* Less than 4 Mb for dirty cache is also bad */ +return -EINVAL ; } - *ppos += *lenp; - return rc; + + obd_max_dirty_pages = val; + +return count; } +LUSTRE_RW_ATTR (max_dirty_mb); +#ifdef CONFIG_SYSCTL static struct ctl_table obd_table[] = { { .procname = "debug_peer_on_timeout",
@@ -165,13 +159,6 @@ static struct ctl_table obd_table[] = { .proc_handler = &proc_dointvec }, { - .procname = "max_dirty_mb", - .data = &obd_max_dirty_pages, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_max_dirty_pages_in_mb - }, - { .procname = "at_min", .data = &at_min, .maxlen = sizeof(int),
@@ -223,6 +210,7 @@ static struct ctl_table parent_table[] = {static struct attribute *lustre_attrs[] = { &lustre_sattr_timeout.u.attr, + &lustre_attr_max_dirty_mb.attr,NULL , };
drivers/staging/lustre/sysfs-fs-lustre +12 -0
@@ -52,6 +52,18 @@ Description: AT (adaptive timeouts). Unit: seconds, default: 100 +What: /sys/fs/lustre/max_dirty_mb +Date: June 2015 +Contact: "Oleg Drokin" <[email protected]> +Description: + Controls total number of dirty cache (in megabytes) allowed + across all mounted lustre filesystems. + Since writeout of dirty pages in Lustre is somewhat expensive, + when you allow to many dirty pages, this might lead to + performance degradations as kernel tries to desperately + find some pages to free/writeout. + Default 1/2 RAM. Min value 4, max value 9/10 of RAM. + What: /sys/fs/lustre/llite/<fsname>-<uuid>/blocksize Date: May 2015 Contact: "Oleg Drokin" <[email protected]>
Signature · 1 line
2.1.0
PATCH 10/20 staging/lustre/obdclass: move debug controls to sysfs
In reply to [email protected]From: Oleg Drokin <[email protected]>
debug_peer_on_timeout, dump_on_timeout and dump_on_eviction controls from /proc/sys/lustre to /sys/fs/lustre
--- .../lustre/lustre/obdclass/linux/linux-sysctl.c | 28 ++++++---------------- drivers/staging/lustre/sysfs-fs-lustre | 26 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 21 deletions(-)
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +7 -21
@@ -135,30 +135,13 @@ static ssize_t max_dirty_mb_store(struct kobject *kobj, struct attribute *attr, }LUSTRE_RW_ATTR (max_dirty_mb); +LUSTRE_STATIC_UINT_ATTR (debug_peer_on_timeout, &obd_debug_peer_on_timeout); +LUSTRE_STATIC_UINT_ATTR (dump_on_timeout, &obd_dump_on_timeout); +LUSTRE_STATIC_UINT_ATTR (dump_on_eviction, &obd_dump_on_eviction); + #ifdef CONFIG_SYSCTL static struct ctl_table obd_table[] = { { - .procname = "debug_peer_on_timeout", - .data = &obd_debug_peer_on_timeout, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .procname = "dump_on_timeout", - .data = &obd_dump_on_timeout, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .procname = "dump_on_eviction", - .data = &obd_dump_on_eviction, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { .procname = "at_min", .data = &at_min, .maxlen = sizeof(int),
@@ -211,6 +194,9 @@ static struct ctl_table parent_table[] = {static struct attribute *lustre_attrs[] = { &lustre_sattr_timeout.u.attr, &lustre_attr_max_dirty_mb.attr, + &lustre_sattr_debug_peer_on_timeout.u.attr, + &lustre_sattr_dump_on_timeout.u.attr, + &lustre_sattr_dump_on_eviction.u.attr,NULL , };
drivers/staging/lustre/sysfs-fs-lustre +26 -0
@@ -64,6 +64,32 @@ Description: find some pages to free/writeout. Default 1/2 RAM. Min value 4, max value 9/10 of RAM. +What: /sys/fs/lustre/debug_peer_on_timeout +Date: June 2015 +Contact: "Oleg Drokin" <[email protected]> +Description: + Control if lnet debug information should be printed when + an RPC timeout occurs. + 0 disabled (default) + 1 enabled + +What: /sys/fs/lustre/dump_on_timeout +Date: June 2015 +Contact: "Oleg Drokin" <[email protected]> +Description: + Controls if Lustre debug log should be dumped when an RPC + timeout occurs. This is useful if yout debug buffer typically + rolls over by the time you notice RPC timeouts. + +What: /sys/fs/lustre/dump_on_eviction +Date: June 2015 +Contact: "Oleg Drokin" <[email protected]> +Description: + Controls if Lustre debug log should be dumped when an this + client is evicted from one of the servers. + This is useful if yout debug buffer typically rolls over + by the time you notice the eviction event. + What: /sys/fs/lustre/llite/<fsname>-<uuid>/blocksize Date: May 2015 Contact: "Oleg Drokin" <[email protected]>
Signature · 1 line
2.1.0
PATCH 11/20 staging/lustre/obdclass: Move AT controls from sysctl to sysfs
In reply to [email protected]From: Oleg Drokin <[email protected]>
Adaptive Timeouts controls are being moved from /proc/sys/lustre to /sys/fs/lustre
--- .../lustre/lustre/obdclass/linux/linux-sysctl.c | 45 ++++-------------- drivers/staging/lustre/sysfs-fs-lustre | 53 ++++++++++++++++++++++ 2 files changed, 63 insertions(+), 35 deletions(-)
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +10 -35
@@ -138,44 +138,14 @@ LUSTRE_RW_ATTR(max_dirty_mb);LUSTRE_STATIC_UINT_ATTR (debug_peer_on_timeout, &obd_debug_peer_on_timeout);LUSTRE_STATIC_UINT_ATTR (dump_on_timeout, &obd_dump_on_timeout);LUSTRE_STATIC_UINT_ATTR (dump_on_eviction, &obd_dump_on_eviction); +LUSTRE_STATIC_UINT_ATTR (at_min, &at_min); +LUSTRE_STATIC_UINT_ATTR (at_max, &at_max); +LUSTRE_STATIC_UINT_ATTR (at_extra, &at_extra); +LUSTRE_STATIC_UINT_ATTR (at_early_margin, &at_early_margin); +LUSTRE_STATIC_UINT_ATTR (at_history, &at_history);#ifdef CONFIG_SYSCTL static struct ctl_table obd_table[] = { - { - .procname ="at_min" , - .data = &at_min, - .maxlen =sizeof (int ), - .mode =0644 , - .proc_handler = &proc_dointvec, - }, - { - .procname ="at_max" , - .data = &at_max, - .maxlen =sizeof (int ), - .mode =0644 , - .proc_handler = &proc_dointvec, - }, - { - .procname ="at_extra" , - .data = &at_extra, - .maxlen =sizeof (int ), - .mode =0644 , - .proc_handler = &proc_dointvec, - }, - { - .procname ="at_early_margin" , - .data = &at_early_margin, - .maxlen =sizeof (int ), - .mode =0644 , - .proc_handler = &proc_dointvec, - }, - { - .procname ="at_history" , - .data = &at_history, - .maxlen =sizeof (int ), - .mode =0644 , - .proc_handler = &proc_dointvec, - }, {} };
@@ -197,6 +167,11 @@ static struct attribute *lustre_attrs[] = { &lustre_sattr_debug_peer_on_timeout.u.attr, &lustre_sattr_dump_on_timeout.u.attr, &lustre_sattr_dump_on_eviction.u.attr, + &lustre_sattr_at_min.u.attr, + &lustre_sattr_at_max.u.attr, + &lustre_sattr_at_extra.u.attr, + &lustre_sattr_at_early_margin.u.attr, + &lustre_sattr_at_history.u.attr, NULL, };
drivers/staging/lustre/sysfs-fs-lustre +53 -0
59 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 12/20 staging/lustre: Get rid of remaining /proc/sys/lustre plumbing
In reply to [email protected]From: Oleg Drokin <[email protected]>
Since all of the variables from /proc/sys/lustre were moved to /sys/fs/lustre, get rid of the remaining infrastructure.
--- drivers/staging/lustre/lustre/include/obd_class.h | 1 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 - .../lustre/lustre/obdclass/linux/linux-sysctl.c | 30 ---------------------- 3 files changed, 32 deletions(-)
drivers/staging/lustre/lustre/include/obd_class.h +0 -1
@@ -1870,7 +1870,6 @@ extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c);/* sysctl.c */ extern int obd_sysctl_init (void ); -extern void obd_sysctl_clean (void );/* uuid.c */ typedef __u8 class_uuid_t [16 ];
drivers/staging/lustre/lustre/obdclass/class_obd.c +0 -1
@@ -659,7 +659,6 @@ static void cleanup_obdclass(void)lu_global_fini ();obd_cleanup_caches (); -obd_sysctl_clean ();class_procfs_clean ();
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +0 -30
@@ -50,10 +50,6 @@#include "../../include/obd_support.h" #include "../../include/lprocfs_status.h" -#ifdef CONFIG_SYSCTL -static struct ctl_table_header *obd_table_header; -#endif -struct static_lustre_uintvalue_attr {struct {struct attribute attr;
@@ -144,23 +140,6 @@ LUSTRE_STATIC_UINT_ATTR(at_extra, &at_extra);LUSTRE_STATIC_UINT_ATTR (at_early_margin, &at_early_margin);LUSTRE_STATIC_UINT_ATTR (at_history, &at_history); -#ifdef CONFIG_SYSCTL -static struct ctl_table obd_table[] = { - {} -}; - -static struct ctl_table parent_table[] = { - { - .procname ="lustre" , - .data =NULL , - .maxlen =0 , - .mode =0555 , - .child = obd_table - }, - {} -}; -#endif -static struct attribute *lustre_attrs[] = { &lustre_sattr_timeout.u.attr, &lustre_attr_max_dirty_mb.attr,
@@ -181,18 +160,9 @@ static struct attribute_group lustre_attr_group = {int obd_sysctl_init (void ) { -#ifdef CONFIG_SYSCTL -if (!obd_table_header) - obd_table_header =register_sysctl_table (parent_table); -#endif return sysfs_create_group (lustre_kobj, &lustre_attr_group); }void obd_sysctl_clean (void ) { -#ifdef CONFIG_SYSCTL -if (obd_table_header) -unregister_sysctl_table (obd_table_header); - obd_table_header =NULL ; -#endif }
Signature · 1 line
2.1.0
PATCH 13/20 staging/lustre/libcfs: move /proc/sys/lnet to debugfs
In reply to [email protected]From: Oleg Drokin <[email protected]>
Parameters in lnet sysctl are of debug quantity, so let's move them to debugfs instead.
--- drivers/staging/lustre/lustre/libcfs/module.c | 86 +++++++++++++++++---------- 1 file changed, 56 insertions(+), 30 deletions(-)
drivers/staging/lustre/lustre/libcfs/module.c +56 -30
@@ -50,6 +50,7 @@#include <linux/list.h> #include <linux/sysctl.h> +#include <linux/debugfs.h> # define DEBUG_SUBSYSTEM S_LNET
@@ -69,10 +70,10 @@ extern struct miscdevice libcfs_dev;extern struct cfs_wi_sched *cfs_sched_rehash;extern void libcfs_init_nidstrings (void ); -static int insert_proc (void ); -static void remove_proc (void ); +static void insert_debugfs (void ); +static void remove_debugfs (void ); -static struct ctl_table_header *lnet_table_header; +static struct dentry *lnet_debugfs_root;extern char lnet_upcall[1024 ];/** * The path of debug log dump upcall script.
@@ -428,17 +429,10 @@ static int init_libcfs_module(void) goto cleanup_wi; } - - rc =insert_proc (); -if (rc) { -CERROR ("insert_proc: error %d\n" , rc); - goto cleanup_crypto; - } +insert_debugfs ();CDEBUG (D_OTHER ,"portals setup OK\n" );return 0 ; - cleanup_crypto: -cfs_crypto_unregister (); cleanup_wi:cfs_wi_shutdown (); cleanup_deregister:
@@ -454,7 +448,7 @@ static void exit_libcfs_module(void) {int rc; -remove_proc (); +remove_debugfs ();CDEBUG (D_MALLOC ,"before Portals cleanup: kmem %d\n" ,atomic_read (&libcfs_kmemory));
@@ -935,31 +929,63 @@ static struct ctl_table lnet_table[] = { } }; -static struct ctl_table top_table[] = { - { - .procname ="lnet" , - .mode =0555 , - .data =NULL , - .maxlen =0 , - .child = lnet_table, - }, - { - } +static ssize_t lnet_debugfs_read (struct file *filp,char __user *buf, +size_t count,loff_t *ppos) +{ +struct ctl_table *table = filp->private_data; +int error; + + error = table->proc_handler (table,0 , (void __user *)buf, &count, ppos); +if (!error) + error = count; + +return error; +} + +static ssize_t lnet_debugfs_write (struct file *filp,const char __user *buf, +size_t count,loff_t *ppos) +{ +struct ctl_table *table = filp->private_data; +int error; + + error = table->proc_handler (table,1 , (void __user *)buf, &count, ppos); +if (!error) + error = count; + +return error; +} + +static const struct file_operations lnet_debugfs_file_operations = { + .open = simple_open, + .read = lnet_debugfs_read, + .write = lnet_debugfs_write, + .llseek = default_llseek, }; -static int insert_proc (void ) +static void insert_debugfs (void ) { -if (lnet_table_header ==NULL ) - lnet_table_header =register_sysctl_table (top_table); -return 0 ; +struct ctl_table *table; +struct dentry *entry; + +if (lnet_debugfs_root ==NULL ) + lnet_debugfs_root =debugfs_create_dir ("lnet" ,NULL ); + +/* Even if we cannot create, just ignore it altogether) */ +if (IS_ERR_OR_NULL (lnet_debugfs_root)) +return ; + +for (table = lnet_table; table->procname; table++) + entry =debugfs_create_file (table->procname, table->mode, + lnet_debugfs_root, table, + &lnet_debugfs_file_operations); } -static void remove_proc (void ) +static void remove_debugfs (void ) { -if (lnet_table_header !=NULL ) -unregister_sysctl_table (lnet_table_header); +if (lnet_debugfs_root !=NULL ) +debugfs_remove_recursive (lnet_debugfs_root); - lnet_table_header =NULL ; + lnet_debugfs_root =NULL ; }MODULE_VERSION ("1.0.0" );
Signature · 1 line
2.1.0
PATCH 14/20 staging/lustre/libcfs: Remove redundant lnet debugfs variables
In reply to [email protected]From: Oleg Drokin <[email protected]>
/proc/sys/lnet/console_ratelimit, debug_path and panic_on_lbug are module parameters with no special magic accessible via /sys/module/libcfs/parameters/libcfs_console_ratelimit, /sys/module/libcfs/parameters/libcfs_debug_file_path and /sys/module/libcfs/parameters/libcfs_panic_on_lbug respectively.
As such just replace them with corresponding symlinks
--- drivers/staging/lustre/lustre/libcfs/module.c | 22 ---------------------- 1 file changed, 22 deletions(-)
drivers/staging/lustre/lustre/libcfs/module.c +0 -22
@@ -803,13 +803,6 @@ static struct ctl_table lnet_table[] = { .proc_handler = &proc_dobitmasks, }, { - .procname = "console_ratelimit", - .data = &libcfs_console_ratelimit, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { .procname = "console_max_delay_centisecs", .maxlen = sizeof(int), .mode = 0644,
@@ -829,14 +822,6 @@ static struct ctl_table lnet_table[] = { }, { - .procname = "debug_path", - .data = libcfs_debug_file_path_arr, - .maxlen = sizeof(libcfs_debug_file_path_arr), - .mode = 0644, - .proc_handler = &proc_dostring, - }, - - { .procname = "cpu_partition_table", .maxlen = 128, .mode = 0444,
@@ -872,13 +857,6 @@ static struct ctl_table lnet_table[] = { .proc_handler = &proc_dointvec, }, { - .procname = "panic_on_lbug", - .data = &libcfs_panic_on_lbug, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { .procname = "dump_kernel", .maxlen = 256, .mode = 0200,
Signature · 1 line
2.1.0
PATCH 15/20 staging/lustre/libcfs: get rid of debugfs/lnet/console_backoff
In reply to [email protected]From: Oleg Drokin <[email protected]>
module parameter libcfs_console_backoff accessible through /sys/module/libcfs/parameters/libcfs_console_backoff would do the same thing, just add a special "uintpos" parameter type to disallow 0 values too.
Also add a symlink to the module parameter variable for backwards compatibility
--- drivers/staging/lustre/lustre/libcfs/debug.c | 31 +++++++++++++- drivers/staging/lustre/lustre/libcfs/module.c | 59 +++++++++++---------------- 2 files changed, 54 insertions(+), 36 deletions(-)
drivers/staging/lustre/lustre/libcfs/debug.c +30 -1
@@ -82,8 +82,37 @@ module_param(libcfs_console_min_delay, uint, 0644);MODULE_PARM_DESC (libcfs_console_min_delay,"Lustre kernel debug console min delay (jiffies)" );EXPORT_SYMBOL (libcfs_console_min_delay); +static int param_set_uint_minmax (const char *val, +const struct kernel_param *kp, +unsigned int min,unsigned int max) +{ +unsigned int num; +int ret; + +if (!val) +return -EINVAL ; + ret =kstrtouint (val,0 , &num); +if (ret == -EINVAL || num < min || num > max) +return -EINVAL ; + *((unsigned int *)kp->arg) = num; +return 0 ; +} + +static int param_set_uintpos (const char *val,const struct kernel_param *kp) +{ +return param_set_uint_minmax (val, kp,1 ,-1 ); +} + +static struct kernel_param_ops param_ops_uintpos = { + .set = param_set_uintpos, + .get = param_get_uint, +}; + +#define param_check_uintpos (name, p) \ + __param_check(name, p, unsigned int) +unsigned int libcfs_console_backoff =CDEBUG_DEFAULT_BACKOFF ; -module_param (libcfs_console_backoff, uint,0644 ); +module_param (libcfs_console_backoff, uintpos,0644 );MODULE_PARM_DESC (libcfs_console_backoff,"Lustre kernel debug console backoff factor" );EXPORT_SYMBOL (libcfs_console_backoff);
drivers/staging/lustre/lustre/libcfs/module.c +24 -35
89 lines not on this page · raw message
Signature · 1 line
2.1.0
Re: [PATCH 15/20] staging/lustre/libcfs: get rid of debugfs/lnet/console_backoff
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_console_min_delay, uint, 0644); · line 95
Quoted 11 lines · On Mon, Jul 06, 2015 at 12:48:53PM -0400, [email protected] wrote:
drivers/staging/lustre/lustre/libcfs/debug.c +11
-0+static int param_set_uint_minmax (const char *val, +const struct kernel_param *kp, +unsigned int min,unsigned int max) +{ +unsigned int num; +int ret; + +if (!val) +return -EINVAL ; + ret =kstrtouint (val,0 , &num); +if (ret == -EINVAL || num < min || num > max)
^^^
Smatch is smart enough to know that "num" can be uninitialized here on some paths. It doesn't generate a warning yet because a lot of the kernel has error paths where we mostly assume things won't fail.
It should probably be:
ret = kstrtouint(val, 0, &num); if (ret) return ret; if (num < min || num > max) return -EINVAL;
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_console_min_delay, uint, 0644); · line 99
Quoted 4 lines
drivers/staging/lustre/lustre/libcfs/debug.c +4
-0+return -EINVAL ; + *((unsigned int *)kp->arg) = num; +return 0 ; +}
regards,
dan carpenter
Re: [PATCH 15/20] staging/lustre/libcfs: get rid of debugfs/lnet/console_backoff
Of course, this is not a critical flaw. Don't resend. Fix it later if you want.
regards,
dan carpenter
Re: [PATCH 15/20] staging/lustre/libcfs: get rid of debugfs/lnet/console_backoff
In reply to Dan CarpenterQuoted 17 lines · Dan Carpenter
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_console_min_delay, uint, 0644); · line 95
Quoted 11 lines · On Mon, Jul 06, 2015 at 12:48:53PM -0400, [email protected] wrote:
drivers/staging/lustre/lustre/libcfs/debug.c +11
-0+static int param_set_uint_minmax (const char *val, +const struct kernel_param *kp, +unsigned int min,unsigned int max) +{ +unsigned int num; +int ret; + +if (!val) +return -EINVAL ; + ret =kstrtouint (val,0 , &num); +if (ret == -EINVAL || num < min || num > max)^^^Smatch is smart enough to know that "num" can be uninitialized here on some paths. It doesn't generate a warning yet because a lot of the kernel has error paths where we mostly assume things won't fail.
Quoted 7 lines
It should probably be:
ret = kstrtouint(val, 0, &num); if (ret) return ret; if (num < min || num > max) return -EINVAL;
Hm, indeed kstrtouint can return errors other than -EINVAL. In reality this code comes from net/sunrpc/xprtsock.c and I failed to see the problem there while copying.
This also suggests that the type is might be enough in demand to make it generic so that people don't reimplement it themselves?
Thanks!
Bye,
Oleg
PATCH 16/20 staging/lustre/libcfs: Remove redundant enums and sysctl moduleparams
In reply to [email protected]From: Dmitry Eremin <[email protected]>
/proc/sys/lnet/lnet_memused
Remove memory tracking for LNet.
Remove redundant enums definition.
--- .../lustre/include/linux/libcfs/libcfs_private.h | 28 +-------------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 12 ------- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 5 --- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 3 +- drivers/staging/lustre/lnet/lnet/router_proc.c | 11 ------ .../staging/lustre/lustre/include/obd_support.h | 12 +++---- drivers/staging/lustre/lustre/libcfs/debug.c | 3 -- drivers/staging/lustre/lustre/libcfs/module.c | 41 ---------------------- drivers/staging/lustre/lustre/obdclass/class_obd.c | 6 ++-- 9 files changed, 9 insertions(+), 112 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +1 -27
@@ -87,24 +87,6 @@ do { \lbug_with_loc (&msgdata); \ } while (0) -extern atomic_t libcfs_kmemory; -/* -* Memory -*/ - -# define libcfs_kmem_inc (ptr, size) \ -do { \ - atomic_add(size, &libcfs_kmemory); \ -} while (0) - -# define libcfs_kmem_dec (ptr, size) \ -do { \ - atomic_sub(size, &libcfs_kmemory); \ -} while (0) - -# define libcfs_kmem_read () \ - atomic_read(&libcfs_kmemory) -#ifndef LIBCFS_VMALLOC_SIZE #define LIBCFS_VMALLOC_SIZE (2 << PAGE_CACHE_SHIFT)/* 2 pages */ #endif
@@ -121,14 +103,9 @@ do { \if (unlikely ((ptr) ==NULL )) { \CERROR ("LNET: out of memory at %s:%d (tried to alloc '" \ #ptr "' = %d)\n", __FILE__, __LINE__, (int)(size)); \ - CERROR("LNET: %d total bytes allocated by lnet\n", \ - libcfs_kmem_read()); \ }else { \memset ((ptr),0 , (size)); \ - libcfs_kmem_inc((ptr), (size)); \ - CDEBUG(D_MALLOC, "alloc '" #ptr "': %d at %p (tot %d).\n", \ - (int)(size), (ptr), libcfs_kmem_read()); \ - } \ + } \ }while (0 )/**
@@ -180,9 +157,6 @@ do { \ "%s:%d\n", s, __FILE__, __LINE__); \break ; \ } \ -libcfs_kmem_dec ((ptr), s); \ - CDEBUG(D_MALLOC, "kfreed '" #ptr "': %d at %p (tot %d).\n", \ - s, (ptr),libcfs_kmem_read ()); \if (unlikely (s >LIBCFS_VMALLOC_SIZE )) \vfree (ptr); \else \
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +0 -12
@@ -2667,9 +2667,6 @@ static void kiblnd_base_shutdown(void)LASSERT (list_empty (&kiblnd_data.kib_devs)); -CDEBUG (D_MALLOC ,"before LND base cleanup: kmem %d\n" , -atomic_read (&libcfs_kmemory)); -switch (kiblnd_data.kib_init) {default :LBUG ();
@@ -2720,9 +2717,6 @@ static void kiblnd_base_shutdown(void)if (kiblnd_data.kib_scheds !=NULL )cfs_percpt_free (kiblnd_data.kib_scheds); -CDEBUG (D_MALLOC ,"after LND base cleanup: kmem %d\n" , -atomic_read (&libcfs_kmemory)); - kiblnd_data.kib_init =IBLND_INIT_NOTHING ;module_put (THIS_MODULE ); }
@@ -2739,9 +2733,6 @@ void kiblnd_shutdown(lnet_ni_t *ni)if (net ==NULL ) goto out; -CDEBUG (D_MALLOC ,"before LND net cleanup: kmem %d\n" , -atomic_read (&libcfs_kmemory)); -write_lock_irqsave (g_lock, flags); net->ibn_shutdown =1 ;write_unlock_irqrestore (g_lock, flags);
@@ -2786,9 +2777,6 @@ void kiblnd_shutdown(lnet_ni_t *ni)break ; } -CDEBUG (D_MALLOC ,"after LND net cleanup: kmem %d\n" , -atomic_read (&libcfs_kmemory)); - net->ibn_init =IBLND_INIT_NOTHING ; ni->ni_data =NULL ;
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +0 -5
@@ -2252,8 +2252,6 @@ ksocknal_base_shutdown(void)int i;int j; -CDEBUG (D_MALLOC ,"before NAL cleanup: kmem %d\n" , -atomic_read (&libcfs_kmemory));LASSERT (ksocknal_data.ksnd_nnets ==0 );switch (ksocknal_data.ksnd_init) {
@@ -2331,9 +2329,6 @@ ksocknal_base_shutdown(void)break ; } -CDEBUG (D_MALLOC ,"after NAL cleanup: kmem %d\n" , -atomic_read (&libcfs_kmemory)); -module_put (THIS_MODULE ); }
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +1 -2
@@ -526,8 +526,7 @@ ksocknal_process_transmit (ksock_conn_t *conn, ksock_tx_t *tx) counter++;/* exponential backoff warnings */ if ((counter & (-counter)) == counter) -CWARN ("%u ENOMEM tx %p (%u allocated)\n" , - counter, conn,atomic_read (&libcfs_kmemory)); +CWARN ("%u ENOMEM tx %p\n" , counter, conn);/* Queue on ksnd_enomem_conns for retry after a timeout */ spin_lock_bh (&ksocknal_data.ksnd_reaper_lock);
drivers/staging/lustre/lnet/lnet/router_proc.c +0 -11
@@ -32,17 +32,6 @@static struct ctl_table_header *lnet_table_header; -#define CTL_LNET (0x100) -enum { -PSDEV_LNET_STATS =100 , -PSDEV_LNET_ROUTES , -PSDEV_LNET_ROUTERS , -PSDEV_LNET_PEERS , -PSDEV_LNET_BUFFERS , -PSDEV_LNET_NIS , -PSDEV_LNET_PTL_ROTOR , -}; -#define LNET_LOFFT_BITS (sizeof(loff_t) * 8)/* * NB: max allowed LNET_CPT_BITS is 8 on 64-bit system and 2 on 32-bit system
drivers/staging/lustre/lustre/include/obd_support.h +4 -8
@@ -501,8 +501,6 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,#define OBD_FAIL_ONCE CFS_FAIL_ONCE#define OBD_FAILED CFS_FAILED -extern atomic_t libcfs_kmemory; -extern void obd_update_maxusage (void );#define obd_memory_add (size) \
@@ -618,8 +616,8 @@ do { \if (unlikely ((ptr) ==NULL )) { \ CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n", \ (int )(size)); \ -CERROR ("%llu total bytes allocated by Lustre, %d by LNET\n" , \ -obd_memory_sum (),atomic_read (&libcfs_kmemory)); \ +CERROR ("%llu total bytes allocated by Lustre\n" , \ +obd_memory_sum ()); \ }else { \OBD_ALLOC_POST (ptr, size,"vmalloced" ); \ } \
@@ -765,12 +763,10 @@ do { \"failed\n" , (int )1 , \ (__u64)(1 << PAGE_CACHE_SHIFT)); \CERROR ("%llu total bytes and %llu total pages " \ -"(%llu bytes) allocated by Lustre, " \ -"%d total bytes by LNET\n" , \ +"(%llu bytes) allocated by Lustre\n" , \obd_memory_sum (), \obd_pages_sum () <<PAGE_CACHE_SHIFT , \ -obd_pages_sum (), \ -atomic_read (&libcfs_kmemory)); \ +obd_pages_sum ()); \ }else { \obd_pages_add (0 ); \ CDEBUG(D_MALLOC, "alloc_pages '" #ptr "': %d page(s) / " \
drivers/staging/lustre/lustre/libcfs/debug.c +0 -3
@@ -136,9 +136,6 @@ module_param(libcfs_panic_on_lbug, uint, 0644);MODULE_PARM_DESC (libcfs_panic_on_lbug,"Lustre kernel panic on LBUG" );EXPORT_SYMBOL (libcfs_panic_on_lbug); -atomic_t libcfs_kmemory =ATOMIC_INIT (0 ); -EXPORT_SYMBOL (libcfs_kmemory); -static wait_queue_head_t debug_ctlwq;char libcfs_debug_file_path_arr[PATH_MAX ] =LIBCFS_DEBUG_FILE_PATH_DEFAULT ;
drivers/staging/lustre/lustre/libcfs/module.c +0 -41
65 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/class_obd.c +3 -3
@@ -140,11 +140,11 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,CERROR ("%s%salloc of %s (%llu bytes) failed at %s:%d\n" , ptr ?"force " :"" , type, name, (__u64 )size, file, line); -CERROR ("%llu total bytes and %llu total pages (%llu bytes) allocated by Lustre, %d total bytes by LNET\n" , +CERROR ("%llu total bytes and %llu total pages" +" (%llu bytes) allocated by Lustre\n" ,obd_memory_sum (),obd_pages_sum () <<PAGE_CACHE_SHIFT , -obd_pages_sum (), -atomic_read (&libcfs_kmemory)); +obd_pages_sum ());return 1 ; }return 0 ;
Signature · 1 line
2.1.0
PATCH 17/20 staging/lustre/libcfs: Remove unneeded lnet watchdog_ratelimit sysctl
In reply to [email protected]From: Dmitry Eremin <[email protected]>
It is no longer used anywhere.
--- drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 1 - drivers/staging/lustre/lustre/libcfs/debug.c | 3 --- drivers/staging/lustre/lustre/libcfs/module.c | 12 ------------ 3 files changed, 16 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +0 -1
@@ -50,7 +50,6 @@ extern unsigned int libcfs_stack;extern unsigned int libcfs_debug;extern unsigned int libcfs_printk;extern unsigned int libcfs_console_ratelimit; -extern unsigned int libcfs_watchdog_ratelimit;extern unsigned int libcfs_console_max_delay;extern unsigned int libcfs_console_min_delay;extern unsigned int libcfs_console_backoff;
drivers/staging/lustre/lustre/libcfs/debug.c +0 -3
@@ -128,9 +128,6 @@ EXPORT_SYMBOL(portal_enter_debugger);unsigned int libcfs_catastrophe;EXPORT_SYMBOL (libcfs_catastrophe); -unsigned int libcfs_watchdog_ratelimit =300 ; -EXPORT_SYMBOL (libcfs_watchdog_ratelimit); -unsigned int libcfs_panic_on_lbug =1 ;module_param (libcfs_panic_on_lbug, uint,0644 );MODULE_PARM_DESC (libcfs_panic_on_lbug,"Lustre kernel panic on LBUG" );
drivers/staging/lustre/lustre/libcfs/module.c +0 -12
@@ -511,9 +511,6 @@ static int proc_dobitmasks(struct ctl_table *table, int write, __proc_dobitmasks); } -static int min_watchdog_ratelimit;/* disable ratelimiting */ -static int max_watchdog_ratelimit = (24 *60 *60 );/* limit to once per day */ -static int __proc_dump_kernel (void *data,int write,loff_t pos,void __user *buffer,int nob) {
@@ -798,15 +795,6 @@ static struct ctl_table lnet_table[] = { .proc_handler = &proc_debug_mb, }, { - .procname = "watchdog_ratelimit", - .data = &libcfs_watchdog_ratelimit, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec_minmax, - .extra1 = &min_watchdog_ratelimit, - .extra2 = &max_watchdog_ratelimit, - }, - { .procname = "force_lbug", .data = NULL, .maxlen = 0,
Signature · 1 line
2.1.0
PATCH 18/20 staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
In reply to [email protected]From: Oleg Drokin <[email protected]>
It's just a fancy libcfs_debug_mb module parameter wrapper, so just add debug buffer size check and resizing and the same functionality now would be accessible via /sys/module/libcfs/parameters/libcfs_debug_mb
Also add a symlink for backwards compatibility.
--- drivers/staging/lustre/lustre/libcfs/debug.c | 37 ++++++++++++++++++++++-- drivers/staging/lustre/lustre/libcfs/module.c | 32 ++------------------ drivers/staging/lustre/lustre/libcfs/tracefile.c | 12 -------- drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 - 4 files changed, 37 insertions(+), 45 deletions(-)
drivers/staging/lustre/lustre/libcfs/debug.c +35 -2
@@ -57,8 +57,39 @@ module_param(libcfs_debug, int, 0644);MODULE_PARM_DESC (libcfs_debug,"Lustre kernel debug mask" );EXPORT_SYMBOL (libcfs_debug); +static int libcfs_param_debug_mb_set (const char *val, +const struct kernel_param *kp) +{ +int rc; +unsigned num; + + rc =kstrtouint (val,0 , &num); +if (rc == -EINVAL ) +return -EINVAL ; + +if (!*((unsigned int *)kp->arg)) { + *((unsigned int *)kp->arg) = num; +return 0 ; + } + + rc =cfs_trace_set_debug_mb (num); + +if (!rc) + *((unsigned int *)kp->arg) =cfs_trace_get_debug_mb (); + +return rc; +} + +static struct kernel_param_ops param_ops_debugmb = { + .set = libcfs_param_debug_mb_set, + .get = param_get_uint, +}; + +#define param_check_debugmb (name, p) \ + __param_check(name, p, unsigned int) +static unsigned int libcfs_debug_mb; -module_param (libcfs_debug_mb, uint,0644 ); +module_param (libcfs_debug_mb, debugmb,0644 );MODULE_PARM_DESC (libcfs_debug_mb,"Total debug buffer size." );EXPORT_SYMBOL (libcfs_debug_mb);
@@ -437,8 +468,10 @@ int libcfs_debug_init(unsigned long bufsize) } rc =cfs_tracefile_init (max); -if (rc ==0 ) +if (rc ==0 ) {libcfs_register_panic_notifier (); + libcfs_debug_mb =cfs_trace_get_debug_mb (); + }return rc; }
drivers/staging/lustre/lustre/libcfs/module.c +2 -30
@@ -550,31 +550,6 @@ static int proc_daemon_file(struct ctl_table *table, int write, __proc_daemon_file); } -static int __proc_debug_mb (void *data,int write, -loff_t pos,void __user *buffer,int nob) -{ -if (!write) { -char tmpstr[32 ]; -int len =snprintf (tmpstr,sizeof (tmpstr),"%d" , -cfs_trace_get_debug_mb ()); - -if (pos >= len) -return 0 ; - -return cfs_trace_copyout_string (buffer, nob, tmpstr + pos, -"\n" ); - } - -return cfs_trace_set_debug_mb_usrstr (buffer, nob); -} - -static int proc_debug_mb (struct ctl_table *table,int write, -void __user *buffer,size_t *lenp,loff_t *ppos) -{ -return proc_call_handler (table->data, write, ppos, buffer, lenp, - __proc_debug_mb); -} -static int proc_console_max_delay_cs (struct ctl_table *table,int write,void __user *buffer,size_t *lenp,loff_t *ppos)
@@ -790,11 +765,6 @@ static struct ctl_table lnet_table[] = { .proc_handler = &proc_daemon_file, }, { - .procname = "debug_mb", - .mode = 0644, - .proc_handler = &proc_debug_mb, - }, - { .procname = "force_lbug", .data = NULL, .maxlen = 0,
@@ -833,6 +803,8 @@ struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = { "/sys/module/libcfs/parameters/libcfs_panic_on_lbug"}, {"libcfs_console_backoff" , "/sys/module/libcfs/parameters/libcfs_console_backoff"}, + { "debug_mb", + "/sys/module/libcfs/parameters/libcfs_debug_mb"}, {}, };
drivers/staging/lustre/lustre/libcfs/tracefile.c +0 -12
@@ -937,18 +937,6 @@ int cfs_trace_set_debug_mb(int mb)return 0 ; } -int cfs_trace_set_debug_mb_usrstr (void __user *usr_str,int usr_str_nob) -{ -char str[32 ]; -int rc; - - rc =cfs_trace_copyin_string (str,sizeof (str), usr_str, usr_str_nob); -if (rc <0 ) -return rc; - -return cfs_trace_set_debug_mb (simple_strtoul (str,NULL ,0 )); -} -int cfs_trace_get_debug_mb (void ) {int i;
drivers/staging/lustre/lustre/libcfs/tracefile.h +0 -1
@@ -77,7 +77,6 @@ int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob);int cfs_trace_daemon_command (char *str);int cfs_trace_daemon_command_usrstr (void __user *usr_str,int usr_str_nob);int cfs_trace_set_debug_mb (int mb); -int cfs_trace_set_debug_mb_usrstr (void __user *usr_str,int usr_str_nob);int cfs_trace_get_debug_mb (void );extern void libcfs_debug_dumplog_internal (void *arg);
Signature · 1 line
2.1.0
Re: [PATCH 18/20] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_debug, int, 0644); · line 68
Quoted 9 lines · On Mon, Jul 06, 2015 at 12:48:56PM -0400, [email protected] wrote:
drivers/staging/lustre/lustre/libcfs/debug.c +9
-0+static int libcfs_param_debug_mb_set (const char *val, +const struct kernel_param *kp) +{ +int rc; +unsigned num; + + rc =kstrtouint (val,0 , &num); +if (rc == -EINVAL ) +return -EINVAL ;
Presumably, this is root only so using num uninitialized is not an information leak.
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_debug, int, 0644); · line 81
Quoted 13 lines
drivers/staging/lustre/lustre/libcfs/debug.c +13
-0+ +if (!*((unsigned int *)kp->arg)) { + *((unsigned int *)kp->arg) = num; +return 0 ; + } + + rc =cfs_trace_set_debug_mb (num); + +if (!rc) + *((unsigned int *)kp->arg) =cfs_trace_get_debug_mb (); + +return rc; +}
regards,
dan carpenter
Greg Kroah-Hartman
maintainerRe: [PATCH 18/20] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
Quoted 13 lines · Dan Carpenter
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_debug, int, 0644); · line 68
Quoted 9 lines · On Mon, Jul 06, 2015 at 12:48:56PM -0400, [email protected] wrote:
drivers/staging/lustre/lustre/libcfs/debug.c +9
-0+static int libcfs_param_debug_mb_set (const char *val, +const struct kernel_param *kp) +{ +int rc; +unsigned num; + + rc =kstrtouint (val,0 , &num); +if (rc == -EINVAL ) +return -EINVAL ;Presumably, this is root only so using num uninitialized is not an information leak.
But it's not good, this should be a check for rc < 0 to make sure.
Oleg, can you send a follow-on patch to fix this up?
thanks,
greg k-h
Re: [PATCH 18/20] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
Quoted 15 lines · Greg Kroah-Hartman
Quoted 13 lines · Dan Carpenter
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_debug, int, 0644); · line 68
Quoted 9 lines · On Mon, Jul 06, 2015 at 12:48:56PM -0400, [email protected] wrote:
drivers/staging/lustre/lustre/libcfs/debug.c +9
-0+static int libcfs_param_debug_mb_set (const char *val, +const struct kernel_param *kp) +{ +int rc; +unsigned num; + + rc =kstrtouint (val,0 , &num); +if (rc == -EINVAL ) +return -EINVAL ;Presumably, this is root only so using num uninitialized is not an information leak.
Quoted 3 lines
But it's not good, this should be a check for rc < 0 to make sure.
Oleg, can you send a follow-on patch to fix this up?
Sure.
Do you want it now or should I wait till you merge my previous bunch?
Bye,
Oleg
Greg Kroah-Hartman
maintainerRe: [PATCH 18/20] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
Quoted 18 lines · Oleg Drokin
Quoted 15 lines · Greg Kroah-Hartman
Quoted 13 lines · Dan Carpenter
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_debug, int, 0644); · line 68
Quoted 9 lines · On Mon, Jul 06, 2015 at 12:48:56PM -0400, [email protected] wrote:
drivers/staging/lustre/lustre/libcfs/debug.c +9
-0+static int libcfs_param_debug_mb_set (const char *val, +const struct kernel_param *kp) +{ +int rc; +unsigned num; + + rc =kstrtouint (val,0 , &num); +if (rc == -EINVAL ) +return -EINVAL ;Presumably, this is root only so using num uninitialized is not an information leak.
Quoted 6 lines
Quoted 3 lines
But it's not good, this should be a check for rc < 0 to make sure.
Oleg, can you send a follow-on patch to fix this up?
Sure.
Do you want it now or should I wait till you merge my previous bunch?
I already merged your previous bunch :)
Greg Kroah-Hartman
maintainerRe: [PATCH 18/20] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
In reply to [email protected]Quoted 49 lines · On Mon, Jul 06, 2015 at 12:48:56PM -0400, [email protected] wrote:
From: Oleg Drokin <[email protected]>
It's just a fancy
libcfs_debug_mbmodule parameter wrapper, so just add debug buffer size check and resizing and the same functionality now would be accessible via/sys/module/libcfs/parameters/libcfs_debug_mbAlso add a symlink for backwards compatibility.
Signed-off-by Oleg Drokin <[email protected]>--- drivers/staging/lustre/lustre/libcfs/debug.c | 37 ++++++++++++++++++++++-- drivers/staging/lustre/lustre/libcfs/module.c | 32 ++------------------ drivers/staging/lustre/lustre/libcfs/tracefile.c | 12 -------- drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 - 4 files changed, 37 insertions(+), 45 deletions(-)drivers/staging/lustre/lustre/libcfs/debug.c +24
-0@@ -57,8 +57,39 @@ module_param(libcfs_debug, int, 0644);MODULE_PARM_DESC (libcfs_debug,"Lustre kernel debug mask" );EXPORT_SYMBOL (libcfs_debug); +static int libcfs_param_debug_mb_set (const char *val, +const struct kernel_param *kp) +{ +int rc; +unsigned num; + + rc =kstrtouint (val,0 , &num); +if (rc == -EINVAL ) +return -EINVAL ; + +if (!*((unsigned int *)kp->arg)) { + *((unsigned int *)kp->arg) = num; +return 0 ; + } + + rc =cfs_trace_set_debug_mb (num); + +if (!rc) + *((unsigned int *)kp->arg) =cfs_trace_get_debug_mb (); + +return rc; +} + +static struct kernel_param_ops param_ops_debugmb = {
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_debug, int, 0644); · line 92
Quoted 10 lines
drivers/staging/lustre/lustre/libcfs/debug.c +8
-1+ .set = libcfs_param_debug_mb_set, + .get = param_get_uint, +}; + +#define param_check_debugmb (name, p) \ + __param_check(name, p, unsigned int) +static unsigned int libcfs_debug_mb; -module_param (libcfs_debug_mb, uint,0644 ); +module_param (libcfs_debug_mb, debugmb,0644 );
module_param wants a variable type as the second option, not a variable name, how is this working?
thanks,
greg k-h
Re: [PATCH 18/20] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
Quoted 55 lines · Greg Kroah-Hartman
Quoted 54 lines · On Mon, Jul 06, 2015 at 12:48:56PM -0400, [email protected] wrote:
From: Oleg Drokin <[email protected]>
It's just a fancy
libcfs_debug_mbmodule parameter wrapper, so just add debug buffer size check and resizing and the same functionality now would be accessible via/sys/module/libcfs/parameters/libcfs_debug_mbAlso add a symlink for backwards compatibility.
Signed-off-by Oleg Drokin <[email protected]>---
drivers/staging/lustre/lustre/libcfs/debug.c | 37 ++++++++++++++++++++++-- drivers/staging/lustre/lustre/libcfs/module.c | 32 ++------------------ drivers/staging/lustre/lustre/libcfs/tracefile.c | 12 -------- drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 - 4 files changed, 37 insertions(+), 45 deletions(-)drivers/staging/lustre/lustre/libcfs/debug.c +29
-0@@ -57,8 +57,39 @@ module_param(libcfs_debug, int, 0644);MODULE_PARM_DESC (libcfs_debug,"Lustre kernel debug mask" );EXPORT_SYMBOL (libcfs_debug); +static int libcfs_param_debug_mb_set (const char *val, +const struct kernel_param *kp) +{ +int rc; +unsigned num; + + rc =kstrtouint (val,0 , &num); +if (rc == -EINVAL ) +return -EINVAL ; + +if (!*((unsigned int *)kp->arg)) { + *((unsigned int *)kp->arg) = num; +return 0 ; + } + + rc =cfs_trace_set_debug_mb (num); + +if (!rc) + *((unsigned int *)kp->arg) =cfs_trace_get_debug_mb (); + +return rc; +} + +static struct kernel_param_ops param_ops_debugmb = { + .set = libcfs_param_debug_mb_set, + .get = param_get_uint, +}; + +#define param_check_debugmb (name, p) \
Quoted 8 lines
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_debug, int, 0644); · line 92
Quoted 5 lines
drivers/staging/lustre/lustre/libcfs/debug.c +3
-1+ __param_check(name, p, unsigned int) +static unsigned int libcfs_debug_mb; -module_param (libcfs_debug_mb, uint,0644 ); +module_param (libcfs_debug_mb, debugmb,0644 );
module_paramwants a variable type as the second option, not a variable name, how is this working?
debugmb IS the type, that I just declared above. See all the param_ops_XXX and param_check_XXX thing?
Greg Kroah-Hartman
maintainerRe: [PATCH 18/20] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
Quoted 67 lines · Oleg Drokin
Quoted 55 lines · Greg Kroah-Hartman
Quoted 54 lines · On Mon, Jul 06, 2015 at 12:48:56PM -0400, [email protected] wrote:
From: Oleg Drokin <[email protected]>
It's just a fancy
libcfs_debug_mbmodule parameter wrapper, so just add debug buffer size check and resizing and the same functionality now would be accessible via/sys/module/libcfs/parameters/libcfs_debug_mbAlso add a symlink for backwards compatibility.
Signed-off-by Oleg Drokin <[email protected]>---
drivers/staging/lustre/lustre/libcfs/debug.c | 37 ++++++++++++++++++++++-- drivers/staging/lustre/lustre/libcfs/module.c | 32 ++------------------ drivers/staging/lustre/lustre/libcfs/tracefile.c | 12 -------- drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 - 4 files changed, 37 insertions(+), 45 deletions(-)drivers/staging/lustre/lustre/libcfs/debug.c +29
-0@@ -57,8 +57,39 @@ module_param(libcfs_debug, int, 0644);MODULE_PARM_DESC (libcfs_debug,"Lustre kernel debug mask" );EXPORT_SYMBOL (libcfs_debug); +static int libcfs_param_debug_mb_set (const char *val, +const struct kernel_param *kp) +{ +int rc; +unsigned num; + + rc =kstrtouint (val,0 , &num); +if (rc == -EINVAL ) +return -EINVAL ; + +if (!*((unsigned int *)kp->arg)) { + *((unsigned int *)kp->arg) = num; +return 0 ; + } + + rc =cfs_trace_set_debug_mb (num); + +if (!rc) + *((unsigned int *)kp->arg) =cfs_trace_get_debug_mb (); + +return rc; +} + +static struct kernel_param_ops param_ops_debugmb = { + .set = libcfs_param_debug_mb_set, + .get = param_get_uint, +}; + +#define param_check_debugmb (name, p) \Quoted 8 lines
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_debug, int, 0644); · line 92
Quoted 5 lines
drivers/staging/lustre/lustre/libcfs/debug.c +3
-1+ __param_check(name, p, unsigned int) +static unsigned int libcfs_debug_mb; -module_param (libcfs_debug_mb, uint,0644 ); +module_param (libcfs_debug_mb, debugmb,0644 );
module_paramwants a variable type as the second option, not a variable name, how is this working?
Quoted 2 lines
debugmb IS the type, that I just declared above. See all the
param_ops_XXXandparam_check_XXXthing?
Ah, missed that, sorry, my fault.
Ok, I see you resent this with a better comment, thanks for that, I'll go queue it up now.
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 18/20] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
In reply to [email protected]Quoted 49 lines · On Mon, Jul 06, 2015 at 12:48:56PM -0400, [email protected] wrote:
From: Oleg Drokin <[email protected]>
It's just a fancy
libcfs_debug_mbmodule parameter wrapper, so just add debug buffer size check and resizing and the same functionality now would be accessible via/sys/module/libcfs/parameters/libcfs_debug_mbAlso add a symlink for backwards compatibility.
Signed-off-by Oleg Drokin <[email protected]>--- drivers/staging/lustre/lustre/libcfs/debug.c | 37 ++++++++++++++++++++++-- drivers/staging/lustre/lustre/libcfs/module.c | 32 ++------------------ drivers/staging/lustre/lustre/libcfs/tracefile.c | 12 -------- drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 - 4 files changed, 37 insertions(+), 45 deletions(-)drivers/staging/lustre/lustre/libcfs/debug.c +24
-0@@ -57,8 +57,39 @@ module_param(libcfs_debug, int, 0644);MODULE_PARM_DESC (libcfs_debug,"Lustre kernel debug mask" );EXPORT_SYMBOL (libcfs_debug); +static int libcfs_param_debug_mb_set (const char *val, +const struct kernel_param *kp) +{ +int rc; +unsigned num; + + rc =kstrtouint (val,0 , &num); +if (rc == -EINVAL ) +return -EINVAL ; + +if (!*((unsigned int *)kp->arg)) { + *((unsigned int *)kp->arg) = num; +return 0 ; + } + + rc =cfs_trace_set_debug_mb (num); + +if (!rc) + *((unsigned int *)kp->arg) =cfs_trace_get_debug_mb (); + +return rc; +} + +static struct kernel_param_ops param_ops_debugmb = {
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_debug, int, 0644); · line 92
Quoted 10 lines
drivers/staging/lustre/lustre/libcfs/debug.c +8
-1+ .set = libcfs_param_debug_mb_set, + .get = param_get_uint, +}; + +#define param_check_debugmb (name, p) \ + __param_check(name, p, unsigned int) +static unsigned int libcfs_debug_mb; -module_param (libcfs_debug_mb, uint,0644 ); +module_param (libcfs_debug_mb, debugmb,0644 );
I'll stop here in the patch series, please fix this up and resend the remaining 3.
thanks,
greg k-h
Re: [PATCH 18/20] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb
Quoted 55 lines · Greg Kroah-Hartman
Quoted 54 lines · On Mon, Jul 06, 2015 at 12:48:56PM -0400, [email protected] wrote:
From: Oleg Drokin <[email protected]>
It's just a fancy
libcfs_debug_mbmodule parameter wrapper, so just add debug buffer size check and resizing and the same functionality now would be accessible via/sys/module/libcfs/parameters/libcfs_debug_mbAlso add a symlink for backwards compatibility.
Signed-off-by Oleg Drokin <[email protected]>---
drivers/staging/lustre/lustre/libcfs/debug.c | 37 ++++++++++++++++++++++-- drivers/staging/lustre/lustre/libcfs/module.c | 32 ++------------------ drivers/staging/lustre/lustre/libcfs/tracefile.c | 12 -------- drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 - 4 files changed, 37 insertions(+), 45 deletions(-)drivers/staging/lustre/lustre/libcfs/debug.c +29
-0@@ -57,8 +57,39 @@ module_param(libcfs_debug, int, 0644);MODULE_PARM_DESC (libcfs_debug,"Lustre kernel debug mask" );EXPORT_SYMBOL (libcfs_debug); +static int libcfs_param_debug_mb_set (const char *val, +const struct kernel_param *kp) +{ +int rc; +unsigned num; + + rc =kstrtouint (val,0 , &num); +if (rc == -EINVAL ) +return -EINVAL ; + +if (!*((unsigned int *)kp->arg)) { + *((unsigned int *)kp->arg) = num; +return 0 ; + } + + rc =cfs_trace_set_debug_mb (num); + +if (!rc) + *((unsigned int *)kp->arg) =cfs_trace_get_debug_mb (); + +return rc; +} + +static struct kernel_param_ops param_ops_debugmb = { + .set = libcfs_param_debug_mb_set, + .get = param_get_uint, +}; + +#define param_check_debugmb (name, p) \
Quoted 8 lines
drivers/staging/lustre/lustre/libcfs/debug.c module_param(libcfs_debug, int, 0644); · line 92
Quoted 5 lines
drivers/staging/lustre/lustre/libcfs/debug.c +3
-1+ __param_check(name, p, unsigned int) +static unsigned int libcfs_debug_mb; -module_param (libcfs_debug_mb, uint,0644 ); +module_param (libcfs_debug_mb, debugmb,0644 );I'll stop here in the patch series, please fix this up and resend the remaining 3.
I'll fix up the EINVAL comparison.
I am just trying to see wht is it you want me to fix with the debugmb type, you don't like the name? Abetter suggestion?
Bye,
Oleg
PATCH 19/20 staging/lustre/libcfs: get rid of debugfs/lnet/console_{min,max}_delay_centisecs
In reply to [email protected]From: Dmitry Eremin <[email protected]>
They are just fancy module parameters wrappers,
so just the same functionality now would be accessible via /sys/module/libcfs/parameters/libcfs_console_{min,max}_delay
Also install compatibility symlinks
--- drivers/staging/lustre/lustre/libcfs/debug.c | 69 ++++++++++++++++++++-- drivers/staging/lustre/lustre/libcfs/module.c | 82 ++------------------------- 2 files changed, 68 insertions(+), 83 deletions(-)
drivers/staging/lustre/lustre/libcfs/debug.c +64 -5
@@ -103,16 +103,75 @@ module_param(libcfs_console_ratelimit, uint, 0644);MODULE_PARM_DESC (libcfs_console_ratelimit,"Lustre kernel debug console ratelimit (0 to disable)" );EXPORT_SYMBOL (libcfs_console_ratelimit); +static int param_set_delay_minmax (const char *val, +const struct kernel_param *kp, +long min,long max) +{ +long d; +int sec; +int rc; + + rc =kstrtoint (val,0 , &sec); +if (rc) +return -EINVAL ; + + d =cfs_time_seconds (sec) /100 ; +if (d < min || d > max) +return -EINVAL ; + + *((unsigned int *)kp->arg) = d; + +return 0 ; +} + +static int param_get_delay (char *buffer,const struct kernel_param *kp) +{ +unsigned int d = *(unsigned int *)kp->arg; + +return sprintf (buffer,"%u" , (unsigned int )cfs_duration_sec (d *100 )); +} +unsigned int libcfs_console_max_delay; -module_param (libcfs_console_max_delay, uint,0644 ); -MODULE_PARM_DESC (libcfs_console_max_delay,"Lustre kernel debug console max delay (jiffies)" );EXPORT_SYMBOL (libcfs_console_max_delay); -unsigned int libcfs_console_min_delay; -module_param (libcfs_console_min_delay, uint,0644 ); -MODULE_PARM_DESC (libcfs_console_min_delay,"Lustre kernel debug console min delay (jiffies)" );EXPORT_SYMBOL (libcfs_console_min_delay); +static int param_set_console_max_delay (const char *val, +const struct kernel_param *kp) +{ +return param_set_delay_minmax (val, kp, + libcfs_console_min_delay,INT_MAX ); +} + +static struct kernel_param_ops param_ops_console_max_delay = { + .set = param_set_console_max_delay, + .get = param_get_delay, +}; + +#define param_check_console_max_delay (name, p) \ + __param_check(name, p, unsigned int) + +module_param (libcfs_console_max_delay, console_max_delay,0644 ); +MODULE_PARM_DESC (libcfs_console_max_delay,"Lustre kernel debug console max delay (jiffies)" ); + +static int param_set_console_min_delay (const char *val, +const struct kernel_param *kp) +{ +return param_set_delay_minmax (val, kp, +1 , libcfs_console_max_delay); +} + +static struct kernel_param_ops param_ops_console_min_delay = { + .set = param_set_console_min_delay, + .get = param_get_delay, +}; + +#define param_check_console_min_delay (name, p) \ + __param_check(name, p, unsigned int) + +module_param (libcfs_console_min_delay, console_min_delay,0644 ); +MODULE_PARM_DESC (libcfs_console_min_delay,"Lustre kernel debug console min delay (jiffies)" ); +static int param_set_uint_minmax (const char *val,const struct kernel_param *kp,unsigned int min,unsigned int max)
drivers/staging/lustre/lustre/libcfs/module.c +4 -78
100 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 20/20 staging/lustre/libcfs: remove unused portal_enter_debugger variable
In reply to [email protected]From: Dmitry Eremin <[email protected]>
Remove portal_enter_debugger because it's not used any more.
--- drivers/staging/lustre/lustre/libcfs/debug.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/lustre/lustre/libcfs/debug.c +0 -3
@@ -212,9 +212,6 @@ EXPORT_SYMBOL(libcfs_debug_binary);unsigned int libcfs_stack =3 *THREAD_SIZE /4 ;EXPORT_SYMBOL (libcfs_stack); -static unsigned int portal_enter_debugger; -EXPORT_SYMBOL (portal_enter_debugger); -unsigned int libcfs_catastrophe;EXPORT_SYMBOL (libcfs_catastrophe);
Signature · 1 line
2.1.0