loader: tslog: Add more log for module loading
This helps mesuring what's happening when we load the kernel/modules/mfsroot. This also adds TSENTER2 which uses the third argument of TSRAW, same as in the kernel. MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33699
This commit is contained in:
parent
ed6417cd8d
commit
01cad73192
@ -556,6 +556,7 @@ file_load(char *filename, vm_offset_t dest, struct preloaded_file **result)
|
|||||||
int error;
|
int error;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
TSENTER2(filename);
|
||||||
if (archsw.arch_loadaddr != NULL)
|
if (archsw.arch_loadaddr != NULL)
|
||||||
dest = archsw.arch_loadaddr(LOAD_RAW, filename, dest);
|
dest = archsw.arch_loadaddr(LOAD_RAW, filename, dest);
|
||||||
|
|
||||||
@ -582,6 +583,7 @@ file_load(char *filename, vm_offset_t dest, struct preloaded_file **result)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TSEXIT();
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,9 +745,11 @@ file_loadraw(const char *fname, char *type, int insert)
|
|||||||
int verror;
|
int verror;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
TSENTER2(fname);
|
||||||
/* We can't load first */
|
/* We can't load first */
|
||||||
if ((file_findfile(NULL, NULL)) == NULL) {
|
if ((file_findfile(NULL, NULL)) == NULL) {
|
||||||
command_errmsg = "can't load file before kernel";
|
command_errmsg = "can't load file before kernel";
|
||||||
|
TSEXIT();
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,6 +758,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
|||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||||
"can't find '%s'", fname);
|
"can't find '%s'", fname);
|
||||||
|
TSEXIT();
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -761,6 +766,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
|||||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||||
"can't open '%s': %s", name, strerror(errno));
|
"can't open '%s': %s", name, strerror(errno));
|
||||||
free(name);
|
free(name);
|
||||||
|
TSEXIT();
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -772,6 +778,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
|||||||
free(name);
|
free(name);
|
||||||
free(vctx);
|
free(vctx);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
TSEXIT();
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -781,6 +788,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
|||||||
name, ve_error_get());
|
name, ve_error_get());
|
||||||
free(name);
|
free(name);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
TSEXIT();
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -805,6 +813,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
|||||||
#ifdef LOADER_VERIEXEC_VECTX
|
#ifdef LOADER_VERIEXEC_VECTX
|
||||||
free(vctx);
|
free(vctx);
|
||||||
#endif
|
#endif
|
||||||
|
TSEXIT();
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
laddr += got;
|
laddr += got;
|
||||||
@ -817,6 +826,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
|||||||
free(name);
|
free(name);
|
||||||
close(fd);
|
close(fd);
|
||||||
free(vctx);
|
free(vctx);
|
||||||
|
TSEXIT();
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -828,6 +838,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
|||||||
"no memory to load %s", name);
|
"no memory to load %s", name);
|
||||||
free(name);
|
free(name);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
TSEXIT();
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
fp->f_name = name;
|
fp->f_name = name;
|
||||||
@ -843,6 +854,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
|||||||
"no memory to load %s", name);
|
"no memory to load %s", name);
|
||||||
free(name);
|
free(name);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
TSEXIT();
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
/* recognise space consumption */
|
/* recognise space consumption */
|
||||||
@ -852,6 +864,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
|||||||
if (insert != 0)
|
if (insert != 0)
|
||||||
file_insert_tail(fp);
|
file_insert_tail(fp);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
TSEXIT();
|
||||||
return(fp);
|
return(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,8 +880,10 @@ mod_load(char *modname, struct mod_depend *verinfo, int argc, char *argv[])
|
|||||||
int err;
|
int err;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
|
TSENTER2(modname);
|
||||||
if (file_havepath(modname)) {
|
if (file_havepath(modname)) {
|
||||||
printf("Warning: mod_load() called instead of mod_loadkld() for module '%s'\n", modname);
|
printf("Warning: mod_load() called instead of mod_loadkld() for module '%s'\n", modname);
|
||||||
|
TSEXIT();
|
||||||
return (mod_loadkld(modname, argc, argv));
|
return (mod_loadkld(modname, argc, argv));
|
||||||
}
|
}
|
||||||
/* see if module is already loaded */
|
/* see if module is already loaded */
|
||||||
@ -880,6 +895,7 @@ mod_load(char *modname, struct mod_depend *verinfo, int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||||
"warning: module '%s' already loaded", mp->m_name);
|
"warning: module '%s' already loaded", mp->m_name);
|
||||||
|
TSEXIT();
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
/* locate file with the module on the search path */
|
/* locate file with the module on the search path */
|
||||||
@ -887,10 +903,12 @@ mod_load(char *modname, struct mod_depend *verinfo, int argc, char *argv[])
|
|||||||
if (filename == NULL) {
|
if (filename == NULL) {
|
||||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||||
"can't find '%s'", modname);
|
"can't find '%s'", modname);
|
||||||
|
TSEXIT();
|
||||||
return (ENOENT);
|
return (ENOENT);
|
||||||
}
|
}
|
||||||
err = mod_loadkld(filename, argc, argv);
|
err = mod_loadkld(filename, argc, argv);
|
||||||
free(filename);
|
free(filename);
|
||||||
|
TSEXIT();
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,6 +924,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[])
|
|||||||
char *filename;
|
char *filename;
|
||||||
vm_offset_t loadaddr_saved;
|
vm_offset_t loadaddr_saved;
|
||||||
|
|
||||||
|
TSENTER2(kldname);
|
||||||
/*
|
/*
|
||||||
* Get fully qualified KLD name
|
* Get fully qualified KLD name
|
||||||
*/
|
*/
|
||||||
@ -913,6 +932,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[])
|
|||||||
if (filename == NULL) {
|
if (filename == NULL) {
|
||||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||||
"can't find '%s'", kldname);
|
"can't find '%s'", kldname);
|
||||||
|
TSEXIT();
|
||||||
return (ENOENT);
|
return (ENOENT);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -923,6 +943,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[])
|
|||||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||||
"warning: KLD '%s' already loaded", filename);
|
"warning: KLD '%s' already loaded", filename);
|
||||||
free(filename);
|
free(filename);
|
||||||
|
TSEXIT();
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,6 +970,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[])
|
|||||||
if (err)
|
if (err)
|
||||||
file_discard(fp);
|
file_discard(fp);
|
||||||
free(filename);
|
free(filename);
|
||||||
|
TSEXIT();
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,6 +486,7 @@ void hexdump(caddr_t region, size_t len);
|
|||||||
/* tslog.c */
|
/* tslog.c */
|
||||||
#define TSRAW(a, b, c) tslog(a, b, c)
|
#define TSRAW(a, b, c) tslog(a, b, c)
|
||||||
#define TSENTER() TSRAW("ENTER", __func__, NULL)
|
#define TSENTER() TSRAW("ENTER", __func__, NULL)
|
||||||
|
#define TSENTER2(x) TSRAW("ENTER", __func__, x)
|
||||||
#define TSEXIT() TSRAW("EXIT", __func__, NULL)
|
#define TSEXIT() TSRAW("EXIT", __func__, NULL)
|
||||||
#define TSLINE() TSRAW("EVENT", __FILE__, __XSTRING(__LINE__))
|
#define TSLINE() TSRAW("EVENT", __FILE__, __XSTRING(__LINE__))
|
||||||
void tslog(const char *, const char *, const char *);
|
void tslog(const char *, const char *, const char *);
|
||||||
|
Loading…
Reference in New Issue
Block a user