From bce2358d14ae3ec63122f0babf11e94d95bd6378 Mon Sep 17 00:00:00 2001 From: chenxujun Date: Thu, 21 Jul 2022 17:52:54 +0800 Subject: [PATCH] src: fix word wrong, add init_fast to compile, modify for code check --- cli.py | 18 ++++++++++++++---- sched_boundary/process.py | 2 +- src/Makefile.plugsched | 7 +++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/cli.py b/cli.py index 4141a9a..58a8422 100755 --- a/cli.py +++ b/cli.py @@ -6,6 +6,7 @@ Usage: plugsched-cli init + plugsched-cli init_fast plugsched-cli dev_init plugsched-cli extract_src plugsched-cli build @@ -16,6 +17,7 @@ Options: Available subcommands: init Initialize a scheduler module for a specific kernel release and product + init_fast A fast init process, do not compile many drivers dev_init Initialize plugsched development envrionment from kernel source code extrat_src extract kernel source code from kernel-src rpm build Build a scheduler module rpm package for a specific kernel release and product @@ -72,6 +74,7 @@ class Plugsched(object): self.get_kernel_version(self.makefile) self.get_config_dir() self.search_springboard = sh.Command(self.plugsched_path + '/tools/springboard_search.sh') + self.init_fast = False with open(os.path.join(self.config_dir, 'sched_boundary.yaml')) as f: self.config = load(f, Loader) @@ -166,7 +169,11 @@ class Plugsched(object): def extract(self): logging.info('Extracting scheduler module objs: %s', ' '.join(self.mod_objs)) - self.make(stage = 'collect', plugsched_tmpdir = self.tmp_dir, plugsched_modpath = self.mod_path) + if self.init_fast: + self.make(stage = 'collect_fast', plugsched_tmpdir = self.tmp_dir, plugsched_modpath = self.mod_path, + objs = self.mod_objs) + else: + self.make(stage = 'collect', plugsched_tmpdir = self.tmp_dir, plugsched_modpath = self.mod_path) self.plugsched_sh.cp(self.sym_vers, self.vmlinux, self.work_dir, force=True) @@ -179,7 +186,8 @@ class Plugsched(object): def create_sandbox(self, kernel_src): logging.info('Creating mod build directory structure') - rsync(kernel_src + '/', self.work_dir, archive=True, verbose=True, delete=True, exclude='.git', filter=':- .gitignore') + rsync(kernel_src + '/', self.work_dir, archive=True, verbose=True, delete=True, + exclude='.git', filter=':- .gitignore') self.mod_sh.mkdir(self.mod_path, parents=True) self.mod_sh.mkdir(self.tmp_dir, parents=True) @@ -233,7 +241,7 @@ class Plugsched(object): self.plugsched_sh.rm('rpmbuild', recursive=True, force=True) self.plugsched_sh.mkdir('rpmbuild') rpmbase_sh = sh(_cwd=rpmbuild_root) - rpmbase_sh.mkdir(['BUILD','RPMS','SOURCES','SPECS','SRPMS']) + rpmbase_sh.mkdir(['BUILD', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS']) self.plugsched_sh.cp('module-contrib/scheduler.spec', os.path.join(rpmbuild_root, 'SPECS'), force=True) rpmbase_sh.rpmbuild('--define', '%%_outdir %s' % os.path.realpath(self.plugsched_path + '/module-contrib'), @@ -273,7 +281,7 @@ if __name__ == '__main__': sh.rm(rpmbuild_root, recursive=True, force=True) - elif arguments['init']: + elif arguments['init'] or arguments['init_fast']: release_kernel = arguments[''] kernel_src = arguments[''] work_dir = arguments[''] @@ -290,6 +298,8 @@ if __name__ == '__main__': logging.fatal("%s not found, please install kernel-devel-%s.rpm", kernel_config, release_kernel) plugsched = Plugsched(work_dir, vmlinux, makefile, sym_vers) + if arguments['init_fast']: + plugsched.init_fast = True plugsched.cmd_init(kernel_src, kernel_config) elif arguments['dev_init']: diff --git a/sched_boundary/process.py b/sched_boundary/process.py index 2c9f885..d6b0a62 100644 --- a/sched_boundary/process.py +++ b/sched_boundary/process.py @@ -54,7 +54,7 @@ def read_meta(filename): # Disagreement 1: vmlinux thinks XXX is in core.c, plugsched thinks it's in kernel/sched/core.c # Disagreement 2: vmlinux thinks XXX is in core.c, plugsched thinks it's in sched.h # Disagreement 3: vmlinux thinks XXX is in usercopy_64.c, plugsched thinks it's in core.c -# Disagrement: 4: vmlinux optimizes XXX to XXX.isra.1, XXX.constprop.1, etc. plugsched remains XXX. +# Disagreement 4: vmlinux optimizes XXX to XXX.isra.1, XXX.constprop.1, etc. plugsched remains XXX. def get_in_any(key, files): for file in files: diff --git a/src/Makefile.plugsched b/src/Makefile.plugsched index 852fe24..d2e3e26 100644 --- a/src/Makefile.plugsched +++ b/src/Makefile.plugsched @@ -20,6 +20,13 @@ sidecar: $(plugsched_modpath)/export_jump_sidecar.h collect: $(MAKE) CFLAGS_KERNEL="$(GCC_PLUGIN_FLAGS)collect" \ CFLAGS_MODULE="$(GCC_PLUGIN_FLAGS)collect" + +collect_fast: $(objs) + $(MAKE) CFLAGS_KERNEL="$(GCC_PLUGIN_FLAGS)collect" \ + CFLAGS_MODULE="$(GCC_PLUGIN_FLAGS)collect" M=init + $(MAKE) CFLAGS_KERNEL="$(GCC_PLUGIN_FLAGS)collect" \ + CFLAGS_MODULE="$(GCC_PLUGIN_FLAGS)collect" $(objs) + analyze: python3 $(plugsched_tmpdir)/process.py ./vmlinux $(plugsched_tmpdir) $(plugsched_modpath) extract: -- Gitee