[elbe-devel] [PATCH] elbepack: remove cpuset workaround

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Jul 15 11:06:39 CEST 2024


The whole cpuset logic was introduced in commit
5f7b7b2406a5 ("pbuilder: add --cpuset option to "elbe pbuilder build" and "elbe control"")
to work around a bug in QEMU triggered by Java.
This bug was fixed in QEMU 3.1, which is available since Debian buster.
As this is used within the initvm we are using a newer version of
Debian/QEMU in any case.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 bash-completion                   |  2 +-
 docs/elbe-pbuilder.rst            |  8 +-------
 elbepack/asyncworker.py           |  5 ++---
 elbepack/commands/control.py      |  4 ----
 elbepack/commands/pbuilder.py     |  4 ----
 elbepack/daemons/soap/esoap.py    |  6 +++---
 elbepack/elbeproject.py           | 24 +++++-------------------
 elbepack/pbuilderaction.py        |  2 +-
 elbepack/projectmanager.py        |  4 ++--
 elbepack/soapclient.py            |  3 +--
 newsfragments/+cpuset.removal.rst |  1 +
 11 files changed, 17 insertions(+), 46 deletions(-)

diff --git a/bash-completion b/bash-completion
index b05361e3752b..a0824c9c79c5 100644
--- a/bash-completion
+++ b/bash-completion
@@ -138,7 +138,7 @@ _cmd_args_completion_elbe()
             pbuilder)
                 file_arg=true
                 disable_space=true
-                cmd_opt=$(_elbe_subcmd_with_opt 'build create --cpuset= --cross --help --origfile= -p \
+                cmd_opt=$(_elbe_subcmd_with_opt 'build create --cross --help --origfile= -p \
                                                  --project= --skip-download --variants= --xmlfile= --ccache-size= \
                                                  -h --no-ccache --output= --profile= --proxy= -v --writeproject=')
                 ;;
diff --git a/docs/elbe-pbuilder.rst b/docs/elbe-pbuilder.rst
index 8043b7929945..3d79c7765f17 100644
--- a/docs/elbe-pbuilder.rst
+++ b/docs/elbe-pbuilder.rst
@@ -36,12 +36,6 @@ OPTIONS
    This file is used to create a new ELBE project including the pbuilder
    environment.
 
---cpuset <int>
-   When this value is not -1 (the default), the pbuilder is run using
-   *taskset <cpuset>* which allows one to limit the number of cpus used
-   for the build. This is useful when multithreading and qemu-user yield
-   problem with e.g. java.
-
 --profile string
    Specify the build profile(s) to build. (dpkg-buildpackage
    -P<profile>) Provide multiple profiles as a comma separated list.
@@ -138,7 +132,7 @@ EXAMPLES
    ::
 
       # cd program
-      # elbe pbuilder build --project `cat ../myarm.prj` --cpuset 1
+      # elbe pbuilder build --project `cat ../myarm.prj`
 
 SEE ALSO
 ========
diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
index bf6d5e068557..126ae79b6943 100644
--- a/elbepack/asyncworker.py
+++ b/elbepack/asyncworker.py
@@ -198,9 +198,8 @@ class BuildJob(AsyncWorkerJob):
 
 
 class PdebuildJob(AsyncWorkerJob):
-    def __init__(self, project, cpuset=-1, profile='', cross=False):
+    def __init__(self, project, profile='', cross=False):
         AsyncWorkerJob.__init__(self, project)
-        self.cpuset = cpuset
         self.profile = profile
         self.cross = cross
 
@@ -215,7 +214,7 @@ class PdebuildJob(AsyncWorkerJob):
         success = self.build_failed
         try:
             logging.info('Pdebuild started')
-            self.project.pdebuild(self.cpuset, self.profile, self.cross)
+            self.project.pdebuild(self.profile, self.cross)
         except Exception:
             logging.exception('Pdebuild failed')
         else:
diff --git a/elbepack/commands/control.py b/elbepack/commands/control.py
index feed0c71b3cd..68808a1c07a4 100644
--- a/elbepack/commands/control.py
+++ b/elbepack/commands/control.py
@@ -67,10 +67,6 @@ def run_command(argv):
                        dest='pbuilder_only', default=False,
                        help='Only list/download pbuilder Files')
 
-    oparser.add_option('--cpuset', default=-1, type='int',
-                       help='Limit cpuset of pbuilder commands (bitmask)'
-                            '(defaults to -1 for all CPUs)')
-
     oparser.add_option('--profile', dest='profile', default='',
                        help='Make pbuilder commands build the specified profile')
 
diff --git a/elbepack/commands/pbuilder.py b/elbepack/commands/pbuilder.py
index f91e466cd781..f0ef6b6e7aa2 100644
--- a/elbepack/commands/pbuilder.py
+++ b/elbepack/commands/pbuilder.py
@@ -38,10 +38,6 @@ def run_command(argv):
     oparser.add_option('--output', dest='outdir', default=None,
                        help='directory where to save downloaded Files')
 
-    oparser.add_option('--cpuset', default=-1, type='int',
-                       help='Limit cpuset of pbuilder commands (bitmask) '
-                            '(defaults to -1 for all CPUs)')
-
     oparser.add_option('--profile', dest='profile', default='',
                        help='profile that shall be built')
 
diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
index db12f3448f8d..e1534ad87550 100644
--- a/elbepack/daemons/soap/esoap.py
+++ b/elbepack/daemons/soap/esoap.py
@@ -245,12 +245,12 @@ class ESoap (ServiceBase):
         fp.write(binascii.a2b_base64(data))
         fp.close()
 
-    @rpc(String, Integer, String, Boolean)
+    @rpc(String, String, Boolean)
     @authenticated_uid
     @soap_faults
-    def finish_pdebuild(self, uid, builddir, cpuset, profile, cross):
+    def finish_pdebuild(self, uid, builddir, profile, cross):
         self.app.pm.open_project(uid, builddir)
-        self.app.pm.build_current_pdebuild(uid, cpuset, profile, cross)
+        self.app.pm.build_current_pdebuild(uid, profile, cross)
 
     @rpc(String, String)
     @authenticated_uid
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 7d04e988ee3a..7c4316f3ea46 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -441,9 +441,6 @@ class ElbeProject:
         else:
             logging.info('Unknown pbuild source: %s', p.tag)
 
-        # pdebuild_build(-1) means use all cpus
-        self.pdebuild_build(cpuset=-1, profile='', cross=False)
-
     def build_cdroms(self, build_bin=True,
                      build_sources=False, cdrom_size=None,
                      tgt_pkg_lst=None):
@@ -707,7 +704,7 @@ class ElbeProject:
         else:
             do(['mkdir', '-p', os.path.join(self.builddir, 'pbuilder', 'result')])
 
-    def pdebuild(self, cpuset, profile, cross):
+    def pdebuild(self, profile, cross):
         cross_pbuilderrc = os.path.join(self.builddir, 'cross_pbuilderrc')
         if cross and not os.path.exists(cross_pbuilderrc):
             logging.error('Please make sure that you create the pbuilder '
@@ -738,20 +735,10 @@ class ElbeProject:
             os.path.join(self.builddir, 'current_pdebuild.tar.gz'),
             '-C', pbdir])
 
-        self.pdebuild_build(cpuset, profile, cross)
+        self.pdebuild_build(profile, cross)
         self.repo.finalize()
 
-    def pdebuild_build(self, cpuset, profile, cross):
-        # check whether we have to use taskset to run pdebuild
-        # this might be useful, when things like java dont
-        # work with multithreading
-        #
-        if cpuset != -1:
-            cpuset_cmd = f'taskset {cpuset} '
-        else:
-            # cpuset == -1 means empty cpuset_cmd
-            cpuset_cmd = ''
-
+    def pdebuild_build(self, profile, cross):
         profile_list = profile.split(',')
         deb_build_opts = [i for i in profile_list if i in ('nodoc', 'nocheck')]
 
@@ -790,8 +777,7 @@ class ElbeProject:
                 do(['dpkg-source', '-b', '.'],
                    cwd=os.path.join(self.builddir, 'pdebuilder', 'current'),
                    env_add=debuild_env)
-                do([cpuset_cmd,
-                    'pbuilder', 'build', '--host-arch', self.arch,
+                do(['pbuilder', 'build', '--host-arch', self.arch,
                     '--configfile', os.path.join(self.builddir, 'cross_pbuilderrc'),
                     '--basetgz', os.path.join(self.builddir, 'pbuilder_cross', 'base.tgz'),
                     '--buildresult', os.path.join(self.builddir, 'pbuilder_cross', 'result'),
@@ -800,7 +786,7 @@ class ElbeProject:
                    env_add=debuild_env)
                 pbuilderdir = 'pbuilder_cross'
             else:
-                do([cpuset_cmd, 'pdebuild',
+                do(['pdebuild',
                     '--configfile', os.path.join(self.builddir, 'pbuilderrc'),
                     '--use-pdebuild-internal',
                     '--buildresult', os.path.join(self.builddir, 'pbuilder', 'result')],
diff --git a/elbepack/pbuilderaction.py b/elbepack/pbuilderaction.py
index 32f6a38f4e34..8df9243143db 100644
--- a/elbepack/pbuilderaction.py
+++ b/elbepack/pbuilderaction.py
@@ -229,7 +229,7 @@ class BuildAction(PBuilderAction):
 
         try:
             run_elbe([
-                'control', 'set_pdebuild', '--cpuset', str(opt.cpuset),
+                'control', 'set_pdebuild',
                 '--profile', opt.profile, *crossopt,
                 prjdir, tmp.fname('pdebuild.tar.gz'),
             ], check=True)
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index e8a386d664cc..30057d7f2be9 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -310,7 +310,7 @@ class ProjectManager:
             self.worker.enqueue(CreatePbuilderJob(ep, ccachesize, cross,
                                                   noccache))
 
-    def build_current_pdebuild(self, userid, cpuset, profile, cross):
+    def build_current_pdebuild(self, userid, profile, cross):
         with self.lock:
             ep = self._get_current_project(userid, allow_busy=False)
             if (not path.isdir(path.join(ep.builddir, 'pbuilder')) and
@@ -318,7 +318,7 @@ class ProjectManager:
                 raise InvalidState('No pbuilder exists: run "elbe pbuilder '
                                    f'create --project {ep.builddir}" first')
 
-            self.worker.enqueue(PdebuildJob(ep, cpuset, profile, cross))
+            self.worker.enqueue(PdebuildJob(ep, profile, cross))
 
     def set_orig_fname(self, userid, fname):
         with self.lock:
diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
index a3bab5865a18..afa85adca047 100644
--- a/elbepack/soapclient.py
+++ b/elbepack/soapclient.py
@@ -667,8 +667,7 @@ class SetPdebuilderAction(ClientAction):
 
         client.service.start_pdebuild(builddir)
         self.upload_file(client.service.append_pdebuild, builddir, filename)
-        client.service.finish_pdebuild(builddir, opt.cpuset,
-                                       opt.profile, opt.cross)
+        client.service.finish_pdebuild(builddir, opt.profile, opt.cross)
 
 
 ClientAction.register(SetPdebuilderAction)
diff --git a/newsfragments/+cpuset.removal.rst b/newsfragments/+cpuset.removal.rst
new file mode 100644
index 000000000000..ae5518132b97
--- /dev/null
+++ b/newsfragments/+cpuset.removal.rst
@@ -0,0 +1 @@
+The `--cpuset` argument of `elbe pbuilder`.

---
base-commit: 6b90d50cfdcdf3414bf162dc4c1c80390665d533
change-id: 20240712-cpuset-b2cb122cbf01

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list