kernel/kernel-std/debian/patches/0004-Affine-irqs-and-workqueues-with-kthread_cpus.patch
Li Zhou 92efe6f666 kernel-std: add initial version for debian packaging
Add kernel 5.10.74 debian packaging.

The kernel we are building starts as source code from the Yocto Project
kernel found at
(https://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto/about/?h=v5.10/standard/base).
To facilitate the creation of a Debian package of this kernel we start
by making a copy of the 5.10 Debian Bullseye 'debian' folder taken from
(http://snapshot.debian.org/package/linux/5.10.28-1/) and apply
customization via the meta-data patches in debian/deb_patches dir. In
this way we can review and incorporate changes the Debian community
makes to their kernel's 'debian' folder over time.

Since there are StarlingX specific patches to the kernel not suitable to
send for merging in linux-yocto we apply these here as defined in scope
and order in the contained debian/patches/series file.

Verification:
As we are only getting the Debian work bootstrapped there is quite a few
restrictions as far as what can be tested.

- I have compared it to the kernel 5.10.74 being used with stx centos:
  - the linux-yocto source code is same;
  - all the StarlingX specific patches are same;
  - the .config of Starlingx centos kernel 5.10.74 is taken to Starlingx
    debian, coexists and overrides the default debian kenrel configs,
    and only below changes are done for it:
    - remove some CONFIGs not set by Starlingx centos kernel code
      intentionally, such as CONFIG_CC_CAN_LINK;
    - remove some CONFIGs special for Starlingx centos kernel code such
      as: CONFIG_CC_VERSION_TEXT;
    - keep the CONFIGs related with signature aligned with debian
      release, because the security feature is still in development.
- 28 debs are built successfully. Build kernel image into rootfs and
  initramfs. Build the LAT ustart image from them.
- Use qemu to boot the ustart image, and the installer installs the
  rootfs successfully. The final debian system with this new kernel
  boot up successfully and run some simple commands successfully.

Story: 2009221
Task: 43290
Signed-off-by: Li Zhou <li.zhou@windriver.com>
Change-Id: I2f98fcc3f929e3e006d30210d559913a10a77ac2
2021-11-23 02:20:43 -05:00

73 lines
2.5 KiB
Diff

From 286f3a8af7f620dac84f20de5f7ad6542f447ace Mon Sep 17 00:00:00 2001
From: Chris Friesen <chris.friesen@windriver.com>
Date: Tue, 24 Nov 2015 16:27:29 -0500
Subject: [PATCH 04/10] Affine irqs and workqueues with kthread_cpus
If the kthread_cpus boot arg is set it means we want to affine
kernel threads to the specified CPU mask as much as possible
in order to avoid doing work on other CPUs.
In this commit we extend the meaning of that boot arg to also
apply to the CPU affinity of unbound and ordered workqueues.
We also use the kthread_cpus value to determine the default irq
affinity. Specifically, as long as the previously-calculated
irq affinity intersects with the kthread_cpus affinity then we'll
use the intersection of the two as the default irq affinity.
Signed-off-by: Chris Friesen <chris.friesen@windriver.com>
[VT: replacing spaces with tabs. Performed tests]
Signed-off-by: Vu Tran <vu.tran@windriver.com>
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Zhang Zhiguo <zhangzhg@neusoft.com>
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
---
kernel/irq/manage.c | 7 +++++++
kernel/workqueue.c | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 79dc02b956dc..420b5ce0bf89 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -515,6 +515,13 @@ int irq_setup_affinity(struct irq_desc *desc)
if (cpumask_intersects(&mask, nodemask))
cpumask_and(&mask, &mask, nodemask);
}
+
+ /* This will narrow down the affinity further if we've specified
+ * a reduced cpu_kthread_mask in the boot args.
+ */
+ if (cpumask_intersects(&mask, cpu_kthread_mask))
+ cpumask_and(&mask, &mask, cpu_kthread_mask);
+
ret = irq_do_set_affinity(&desc->irq_data, &mask, false);
raw_spin_unlock(&mask_lock);
return ret;
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 1e2ca744dadb..b854874d0518 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5956,6 +5956,8 @@ void __init workqueue_init_early(void)
BUG_ON(!(attrs = alloc_workqueue_attrs()));
attrs->nice = std_nice[i];
+ /* If we've specified a kthread mask apply it here too. */
+ cpumask_copy(attrs->cpumask, cpu_kthread_mask);
unbound_std_wq_attrs[i] = attrs;
/*
@@ -5966,6 +5968,8 @@ void __init workqueue_init_early(void)
BUG_ON(!(attrs = alloc_workqueue_attrs()));
attrs->nice = std_nice[i];
attrs->no_numa = true;
+ /* If we've specified a kthread mask apply it here too. */
+ cpumask_copy(attrs->cpumask, cpu_kthread_mask);
ordered_wq_attrs[i] = attrs;
}
--
2.29.2