Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-12352 libcfs: crashes with certain cpu part numbers
[fs/lustre-release.git]
/
libcfs
/
libcfs
/
tracefile.h
diff --git
a/libcfs/libcfs/tracefile.h
b/libcfs/libcfs/tracefile.h
index
12c9ce9
..
7994ab6
100644
(file)
--- a/
libcfs/libcfs/tracefile.h
+++ b/
libcfs/libcfs/tracefile.h
@@
-15,11
+15,7
@@
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
*
* GPL HEADER END
*/
*
* GPL HEADER END
*/
@@
-27,7
+23,7
@@
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012,
2017,
Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
/*
* This file is part of Lustre, http://www.lustre.org/
@@
-39,13
+35,12
@@
#include <libcfs/libcfs.h>
#include <libcfs/libcfs.h>
-#if defined(__linux__)
-#include "linux/linux-tracefile.h"
-#elif defined(__WINNT__)
-#include "winnt/winnt-tracefile.h"
-#else
-#error Unsupported operating system.
-#endif
+enum cfs_trace_buf_type {
+ CFS_TCD_TYPE_PROC = 0,
+ CFS_TCD_TYPE_SOFTIRQ,
+ CFS_TCD_TYPE_IRQ,
+ CFS_TCD_TYPE_MAX
+};
/* trace file lock routines */
/* trace file lock routines */
@@
-53,6
+48,11
@@
extern char cfs_tracefile[TRACEFILE_NAME_SIZE];
extern long long cfs_tracefile_size;
extern char cfs_tracefile[TRACEFILE_NAME_SIZE];
extern long long cfs_tracefile_size;
+/**
+ * The path of debug log dump upcall script.
+ */
+extern char lnet_debug_log_upcall[1024];
+
extern void libcfs_run_debug_log_upcall(char *file);
int cfs_tracefile_init_arch(void);
extern void libcfs_run_debug_log_upcall(char *file);
int cfs_tracefile_init_arch(void);
@@
-74,16
+74,14
@@
void cfs_tracefile_exit(void);
int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
-
const cha
r *usr_buffer, int usr_buffer_nob);
-int cfs_trace_copyout_string(char *usr_buffer, int usr_buffer_nob,
+
const char __use
r *usr_buffer, int usr_buffer_nob);
+int cfs_trace_copyout_string(char
__user
*usr_buffer, int usr_buffer_nob,
const char *knl_str, char *append);
int cfs_trace_allocate_string_buffer(char **str, int nob);
const char *knl_str, char *append);
int cfs_trace_allocate_string_buffer(char **str, int nob);
-void cfs_trace_free_string_buffer(char *str, int nob);
-int cfs_trace_dump_debug_buffer_usrstr(void *usr_str, int usr_str_nob);
+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(char *str);
-int cfs_trace_daemon_command_usrstr(void *usr_str, int usr_str_nob);
+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(int mb);
-int cfs_trace_set_debug_mb_usrstr(void *usr_str, int usr_str_nob);
int cfs_trace_get_debug_mb(void);
extern void libcfs_debug_dumplog_internal(void *arg);
int cfs_trace_get_debug_mb(void);
extern void libcfs_debug_dumplog_internal(void *arg);
@@
-92,7
+90,7
@@
extern void libcfs_unregister_panic_notifier(void);
extern int libcfs_panic_in_progress;
extern int cfs_trace_max_debug_mb(void);
extern int libcfs_panic_in_progress;
extern int cfs_trace_max_debug_mb(void);
-#define TCD_MAX_PAGES (5 << (20 - PAGE_
CACHE_
SHIFT))
+#define TCD_MAX_PAGES (5 << (20 - PAGE_SHIFT))
#define TCD_STOCK_PAGES (TCD_MAX_PAGES)
#define CFS_TRACEFILE_SIZE (500 << 20)
#define TCD_STOCK_PAGES (TCD_MAX_PAGES)
#define CFS_TRACEFILE_SIZE (500 << 20)
@@
-101,7
+99,7
@@
extern int cfs_trace_max_debug_mb(void);
/*
* Private declare for tracefile
*/
/*
* Private declare for tracefile
*/
-#define TCD_MAX_PAGES (5 << (20 - PAGE_
CACHE_
SHIFT))
+#define TCD_MAX_PAGES (5 << (20 - PAGE_SHIFT))
#define TCD_STOCK_PAGES (TCD_MAX_PAGES)
#define CFS_TRACEFILE_SIZE (500 << 20)
#define TCD_STOCK_PAGES (TCD_MAX_PAGES)
#define CFS_TRACEFILE_SIZE (500 << 20)
@@
-125,9
+123,9
@@
union cfs_trace_data_union {
/*
* pages with trace records not yet processed by tracefiled.
*/
/*
* pages with trace records not yet processed by tracefiled.
*/
-
cfs_list_t
tcd_pages;
+
struct list_head
tcd_pages;
/* number of pages on ->tcd_pages */
/* number of pages on ->tcd_pages */
- unsigned long tcd_cur_pages;
+ unsigned long tcd_cur_pages;
/*
* pages with trace records already processed by
/*
* pages with trace records already processed by
@@
-139,9
+137,9
@@
union cfs_trace_data_union {
* (put_pages_on_daemon_list()). LRU pages from this list are
* discarded when list grows too large.
*/
* (put_pages_on_daemon_list()). LRU pages from this list are
* discarded when list grows too large.
*/
-
cfs_list_t
tcd_daemon_pages;
+
struct list_head
tcd_daemon_pages;
/* number of pages on ->tcd_daemon_pages */
/* number of pages on ->tcd_daemon_pages */
- unsigned long tcd_cur_daemon_pages;
+ unsigned long tcd_cur_daemon_pages;
/*
* Maximal number of pages allowed on ->tcd_pages and
/*
* Maximal number of pages allowed on ->tcd_pages and
@@
-173,7
+171,7
@@
union cfs_trace_data_union {
* TCD_STOCK_PAGES pagesful are consumed by trace records all
* emitted in non-blocking contexts. Which is quite unlikely.
*/
* TCD_STOCK_PAGES pagesful are consumed by trace records all
* emitted in non-blocking contexts. Which is quite unlikely.
*/
-
cfs_list_t
tcd_stock_pages;
+
struct list_head
tcd_stock_pages;
/* number of pages on ->tcd_stock_pages */
unsigned long tcd_cur_stock_pages;
/* number of pages on ->tcd_stock_pages */
unsigned long tcd_cur_stock_pages;
@@
-203,21
+201,13
@@
extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS];
/* XXX nikita: this declaration is internal to tracefile.c and should probably
* be moved there */
struct page_collection {
/* XXX nikita: this declaration is internal to tracefile.c and should probably
* be moved there */
struct page_collection {
- cfs_list_t pc_pages;
- /*
- * spin-lock protecting ->pc_pages. It is taken by smp_call_function()
- * call-back functions. XXX nikita: Which is horrible: all processors
- * receive NMI at the same time only to be serialized by this
- * lock. Probably ->pc_pages should be replaced with an array of
- * NR_CPUS elements accessed locklessly.
- */
- spinlock_t pc_lock;
+ struct list_head pc_pages;
/*
* if this flag is set, collect_pages() will spill both
* ->tcd_daemon_pages and ->tcd_pages to the ->pc_pages. Otherwise,
* only ->tcd_pages are spilled.
*/
/*
* if this flag is set, collect_pages() will spill both
* ->tcd_daemon_pages and ->tcd_pages to the ->pc_pages. Otherwise,
* only ->tcd_pages are spilled.
*/
- int pc_want_daemon_pages;
+ int
pc_want_daemon_pages;
};
/* XXX nikita: this declaration is internal to tracefile.c and should probably
};
/* XXX nikita: this declaration is internal to tracefile.c and should probably
@@
-225,9
+215,9
@@
struct page_collection {
struct tracefiled_ctl {
struct completion tctl_start;
struct completion tctl_stop;
struct tracefiled_ctl {
struct completion tctl_start;
struct completion tctl_stop;
-
cfs_waitq_t
tctl_waitq;
+
wait_queue_head_t
tctl_waitq;
pid_t tctl_pid;
pid_t tctl_pid;
-
cfs_atomic_t
tctl_shutdown;
+
atomic_t
tctl_shutdown;
};
/*
};
/*
@@
-239,24
+229,24
@@
struct cfs_trace_page {
/*
* page itself
*/
/*
* page itself
*/
- struct page *page;
+ struct page
*page;
/*
* linkage into one of the lists in trace_data_union or
* page_collection
*/
/*
* linkage into one of the lists in trace_data_union or
* page_collection
*/
-
cfs_list_t
linkage;
+
struct list_head
linkage;
/*
* number of bytes used within this page
*/
/*
* number of bytes used within this page
*/
- unsigned int used;
+ unsigned int
used;
/*
* cpu that owns this page
*/
/*
* cpu that owns this page
*/
- unsigned short cpu;
+ unsigned short
cpu;
/*
* type(context) of this page
*/
/*
* type(context) of this page
*/
- unsigned short type;
+ unsigned short
type;
};
extern void cfs_set_ptldebug_header(struct ptldebug_header *header,
};
extern void cfs_set_ptldebug_header(struct ptldebug_header *header,
@@
-269,15
+259,8
@@
extern void cfs_print_to_console(struct ptldebug_header *hdr, int mask,
extern int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking);
extern void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking);
extern int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking);
extern void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking);
-/**
- * trace_buf_type_t, trace_buf_idx_get() and trace_console_buffers[][]
- * are not public libcfs API; they should be defined in
- * platform-specific tracefile include files
- * (see, for example, linux-tracefile.h).
- */
-
extern char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
extern char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
-extern
cfs_trace_buf_type_t
cfs_trace_buf_idx_get(void);
+extern
enum cfs_trace_buf_type
cfs_trace_buf_idx_get(void);
static inline char *cfs_trace_get_console_buffer(void)
{
static inline char *cfs_trace_get_console_buffer(void)
{
@@
-287,12
+270,6
@@
static inline char *cfs_trace_get_console_buffer(void)
return cfs_trace_console_buffers[i][j];
}
return cfs_trace_console_buffers[i][j];
}
-static inline void
-cfs_trace_put_console_buffer(char *buffer)
-{
- put_cpu();
-}
-
static inline struct cfs_trace_cpu_data *cfs_trace_get_tcd(void)
{
struct cfs_trace_cpu_data *tcd =
static inline struct cfs_trace_cpu_data *cfs_trace_get_tcd(void)
{
struct cfs_trace_cpu_data *tcd =
@@
-309,8
+286,8
@@
static inline void cfs_trace_put_tcd(struct cfs_trace_cpu_data *tcd)
put_cpu();
}
put_cpu();
}
-int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd,
in
t gfp,
-
cfs_list_t
*stock);
+int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd,
gfp_
t gfp,
+
struct list_head
*stock);
int cfs_tcd_owns_tage(struct cfs_trace_cpu_data *tcd,
int cfs_tcd_owns_tage(struct cfs_trace_cpu_data *tcd,
@@
-320,21
+297,21
@@
extern void cfs_trace_assertion_failed(const char *str,
struct libcfs_debug_msg_data *m);
/* ASSERTION that is safe to use within the debug system */
struct libcfs_debug_msg_data *m);
/* ASSERTION that is safe to use within the debug system */
-#define __LASSERT(cond) \
-do {
\
-
if (unlikely(!(cond))) { \
-
LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_EMERG, NULL); \
-
cfs_trace_assertion_failed("ASSERTION("#cond") failed", \
-
&msgdata); \
-
} \
+#define __LASSERT(cond)
\
+do { \
+ if (unlikely(!(cond))) { \
+ LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_EMERG, NULL); \
+ cfs_trace_assertion_failed("ASSERTION("#cond") failed", \
+ &msgdata); \
+ } \
} while (0)
} while (0)
-#define __LASSERT_TAGE_INVARIANT(tage)
\
-do {
\
-
__LASSERT(tage != NULL); \
-
__LASSERT(tage->page != NULL); \
- __LASSERT(tage->used <= PAGE_
CACHE_SIZE);
\
- __LASSERT(page_count(tage->page) > 0); \
+#define __LASSERT_TAGE_INVARIANT(tage) \
+do { \
+ __LASSERT(tage != NULL); \
+ __LASSERT(tage->page != NULL); \
+ __LASSERT(tage->used <= PAGE_
SIZE);
\
+ __LASSERT(page_count(tage->page) > 0);
\
} while (0)
#endif /* LUSTRE_TRACEFILE_PRIVATE */
} while (0)
#endif /* LUSTRE_TRACEFILE_PRIVATE */