#include <lustre_crypto.h>
#include "tracefile.h"
+int cpu_npartitions;
+EXPORT_SYMBOL(cpu_npartitions);
+module_param(cpu_npartitions, int, 0444);
+MODULE_PARM_DESC(cpu_npartitions, "# of CPU partitions");
+
+char *cpu_pattern = "N";
+EXPORT_SYMBOL(cpu_pattern);
+module_param(cpu_pattern, charp, 0444);
+MODULE_PARM_DESC(cpu_pattern, "CPU partitions pattern");
+
struct lnet_debugfs_symlink_def {
const char *name;
const char *target;
return len;
}
-static int proc_cpt_table(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
-{
- size_t nob = *lenp;
- loff_t pos = *ppos;
- char *buf = NULL;
- int len = 4096;
- int rc = 0;
-
- if (write)
- return -EPERM;
-
- while (1) {
- LIBCFS_ALLOC(buf, len);
- if (buf == NULL)
- return -ENOMEM;
-
- rc = cfs_cpt_table_print(cfs_cpt_tab, buf, len);
- if (rc >= 0)
- break;
-
- if (rc == -EFBIG) {
- LIBCFS_FREE(buf, len);
- len <<= 1;
- continue;
- }
- goto out;
- }
-
- if (pos >= rc) {
- rc = 0;
- goto out;
- }
-
- rc = cfs_trace_copyout_string(buffer, nob, buf + pos, NULL);
-out:
- if (buf != NULL)
- LIBCFS_FREE(buf, len);
- return rc;
-}
-
-static int proc_cpt_distance(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
-{
- size_t nob = *lenp;
- loff_t pos = *ppos;
- char *buf = NULL;
- int len = 4096;
- int rc = 0;
-
- if (write)
- return -EPERM;
-
- while (1) {
- LIBCFS_ALLOC(buf, len);
- if (buf == NULL)
- return -ENOMEM;
-
- rc = cfs_cpt_distance_print(cfs_cpt_tab, buf, len);
- if (rc >= 0)
- break;
-
- if (rc == -EFBIG) {
- LIBCFS_FREE(buf, len);
- len <<= 1;
- continue;
- }
- goto out;
- }
-
- if (pos >= rc) {
- rc = 0;
- goto out;
- }
-
- rc = cfs_trace_copyout_string(buffer, nob, buf + pos, NULL);
- out:
- if (buf != NULL)
- LIBCFS_FREE(buf, len);
- return rc;
-}
-
static struct ctl_table lnet_table[] = {
{
.procname = "debug",
.proc_handler = &proc_dobitmasks,
},
{
- .procname = "cpu_partition_table",
- .maxlen = 128,
- .mode = 0444,
- .proc_handler = &proc_cpt_table,
- },
- {
- .procname = "cpu_partition_distance",
- .maxlen = 128,
- .mode = 0444,
- .proc_handler = &proc_cpt_distance,
- },
- {
.procname = "debug_log_upcall",
.data = lnet_debug_log_upcall,
.maxlen = sizeof(lnet_debug_log_upcall),
goto cleanup_lock;
}
- rc = cfs_cpu_init();
- if (rc != 0)
- goto cleanup_debug;
-
cfs_rehash_wq = alloc_workqueue("cfs_rh", WQ_SYSFS, 4);
if (!cfs_rehash_wq) {
rc = -ENOMEM;
CERROR("libcfs: failed to start rehash workqueue: rc = %d\n",
rc);
- goto cleanup_cpu;
+ goto cleanup_debug;
}
rc = cfs_crypto_register();
cleanup_wq:
destroy_workqueue(cfs_rehash_wq);
cfs_rehash_wq = NULL;
-cleanup_cpu:
- cfs_cpu_fini();
cleanup_debug:
libcfs_debug_cleanup();
cleanup_lock:
cfs_crypto_unregister();
- cfs_cpu_fini();
-
/* the below message is checked in test-framework.sh check_mem_leak() */
if (libcfs_kmem_read() != 0)
CERROR("Portals memory leaked: %lld bytes\n",