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 i;
|
||||
|
||||
TSENTER2(filename);
|
||||
if (archsw.arch_loadaddr != NULL)
|
||||
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;
|
||||
}
|
||||
}
|
||||
TSEXIT();
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -743,9 +745,11 @@ file_loadraw(const char *fname, char *type, int insert)
|
||||
int verror;
|
||||
#endif
|
||||
|
||||
TSENTER2(fname);
|
||||
/* We can't load first */
|
||||
if ((file_findfile(NULL, NULL)) == NULL) {
|
||||
command_errmsg = "can't load file before kernel";
|
||||
TSEXIT();
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -754,6 +758,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
||||
if (name == NULL) {
|
||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||
"can't find '%s'", fname);
|
||||
TSEXIT();
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -761,6 +766,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||
"can't open '%s': %s", name, strerror(errno));
|
||||
free(name);
|
||||
TSEXIT();
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -772,6 +778,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
||||
free(name);
|
||||
free(vctx);
|
||||
close(fd);
|
||||
TSEXIT();
|
||||
return(NULL);
|
||||
}
|
||||
#else
|
||||
@ -781,6 +788,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
||||
name, ve_error_get());
|
||||
free(name);
|
||||
close(fd);
|
||||
TSEXIT();
|
||||
return(NULL);
|
||||
}
|
||||
#endif
|
||||
@ -805,6 +813,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
||||
#ifdef LOADER_VERIEXEC_VECTX
|
||||
free(vctx);
|
||||
#endif
|
||||
TSEXIT();
|
||||
return(NULL);
|
||||
}
|
||||
laddr += got;
|
||||
@ -817,6 +826,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
||||
free(name);
|
||||
close(fd);
|
||||
free(vctx);
|
||||
TSEXIT();
|
||||
return(NULL);
|
||||
}
|
||||
#endif
|
||||
@ -828,6 +838,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
||||
"no memory to load %s", name);
|
||||
free(name);
|
||||
close(fd);
|
||||
TSEXIT();
|
||||
return (NULL);
|
||||
}
|
||||
fp->f_name = name;
|
||||
@ -843,6 +854,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
||||
"no memory to load %s", name);
|
||||
free(name);
|
||||
close(fd);
|
||||
TSEXIT();
|
||||
return (NULL);
|
||||
}
|
||||
/* recognise space consumption */
|
||||
@ -852,6 +864,7 @@ file_loadraw(const char *fname, char *type, int insert)
|
||||
if (insert != 0)
|
||||
file_insert_tail(fp);
|
||||
close(fd);
|
||||
TSEXIT();
|
||||
return(fp);
|
||||
}
|
||||
|
||||
@ -867,8 +880,10 @@ mod_load(char *modname, struct mod_depend *verinfo, int argc, char *argv[])
|
||||
int err;
|
||||
char *filename;
|
||||
|
||||
TSENTER2(modname);
|
||||
if (file_havepath(modname)) {
|
||||
printf("Warning: mod_load() called instead of mod_loadkld() for module '%s'\n", modname);
|
||||
TSEXIT();
|
||||
return (mod_loadkld(modname, argc, argv));
|
||||
}
|
||||
/* see if module is already loaded */
|
||||
@ -880,6 +895,7 @@ mod_load(char *modname, struct mod_depend *verinfo, int argc, char *argv[])
|
||||
#endif
|
||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||
"warning: module '%s' already loaded", mp->m_name);
|
||||
TSEXIT();
|
||||
return (0);
|
||||
}
|
||||
/* 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) {
|
||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||
"can't find '%s'", modname);
|
||||
TSEXIT();
|
||||
return (ENOENT);
|
||||
}
|
||||
err = mod_loadkld(filename, argc, argv);
|
||||
free(filename);
|
||||
TSEXIT();
|
||||
return (err);
|
||||
}
|
||||
|
||||
@ -906,6 +924,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[])
|
||||
char *filename;
|
||||
vm_offset_t loadaddr_saved;
|
||||
|
||||
TSENTER2(kldname);
|
||||
/*
|
||||
* Get fully qualified KLD name
|
||||
*/
|
||||
@ -913,6 +932,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[])
|
||||
if (filename == NULL) {
|
||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||
"can't find '%s'", kldname);
|
||||
TSEXIT();
|
||||
return (ENOENT);
|
||||
}
|
||||
/*
|
||||
@ -923,6 +943,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[])
|
||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||
"warning: KLD '%s' already loaded", filename);
|
||||
free(filename);
|
||||
TSEXIT();
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -949,6 +970,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[])
|
||||
if (err)
|
||||
file_discard(fp);
|
||||
free(filename);
|
||||
TSEXIT();
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
@ -486,6 +486,7 @@ void hexdump(caddr_t region, size_t len);
|
||||
/* tslog.c */
|
||||
#define TSRAW(a, b, c) tslog(a, b, c)
|
||||
#define TSENTER() TSRAW("ENTER", __func__, NULL)
|
||||
#define TSENTER2(x) TSRAW("ENTER", __func__, x)
|
||||
#define TSEXIT() TSRAW("EXIT", __func__, NULL)
|
||||
#define TSLINE() TSRAW("EVENT", __FILE__, __XSTRING(__LINE__))
|
||||
void tslog(const char *, const char *, const char *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user