kernel-std: upgrade to 6.6.7
Update kernel source to 6.6.7 from linux-yocto upstream. Update "debian" folder source to 6.1.27-1~bpo11+1 from debian upstream, because kernel 6.6.7 is ported to our bullseye platform now and the newest "debian" folder from debian upstream for bullseye platform is for 6.1. Add an optimization for the StarlingX debian kernel building framework: We used to always maintain kernel with patches on "debian" folder and they are put at kernel/kernel-std(rt)/debian/deb_patches dir. Most of these patches are about "changelog" (debian/changelog) and "config" (debian/config/amd64/none/config). The patches in "deb_patches" dir increased rapidly. Next We will put "changelog" and "config" at the dir kernel/kernel-std(rt)/debian/source and use them to replace debian/changelog and debian/config/amd64/none/config after the upstream "debian" folder is extracted. This can not only keep a clean "deb_patches" folder, but also avoid using a big patch to remove the "changelog" file in the upstream "debian" folder before any kernel build. Below are changes about "deb_patches"/"patches" for kernel-std: (We use the patches' serial number in their name to represent them becuase so many patches are involved here.) (1)about "deb_patches" folder: (1.1)Because of the optimization, all the patches about changelog and config for 5.10 can be abandoned and they will be changed directly in the files under "source" dir for 6.6. Patches for 5.10 that are abandoned because they are about config: 0003/0005/0006/0007/0008/0010/0011/0015/0017/0021/0025/0027 Patches for 5.10 that are abandoned because they are about changelog: 0001/0002/0007/0012/0019/0022/0023/0024/0026/0028/0029/0031/0032/0033 The "changelog" and "config" under "source" dir for 6.6 are verified to be aligned with those for 5.10 build. CONFIG_FANOTIFY is enabled in "config" as a new request. (1.2)Patch 0016 for 5.10 is abandoned because the new commit <Use parallel XZ for source tar generation> is available in new version "debian" folder, which does the same work. Refer to: https://salsa.debian.org/kernel-team/linux/-/commit/ 50b61a14e6dbc50b19dfe938c4679ecda50b83ee (1.3)Below patches for 5.10 are ported to 6.6: 0004/0009/0014 (0009/0014 are merged into 0004) compose patch 0001 for 6.6; 0013 is ported to 0002 for 6.6; 0020 is ported to 0003 for 6.6; 0005/0018 (0005 is merged into 0018) compose patch 0004 for 6.6; 0030 is ported to 0005 for 6.6. List the new patches for 6.6: New patches 0001-0005 are ported from "deb_patches" for 5.10; New patches 0006-0009 are added for building kernel 6.6.7 with 6.1.27-1~bpo11+1 "debian" folder. (2)about "patches" folder: (2.1)Patches for 5.10 that are abandoned because they are already in 6.6.7 include: 0010/0017-0027/0030-0037/0040-0055/0057-0074 (2.2)Patch 0011 for 5.10 is abandoned for new upstream commit <scsi: smartpqi: Expose SAS address for SATA drives> in 6.6. Refer to: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/ linux.git/commit/?id=00598b056aa6d46c7a6819efa850ec9d0d690d76 The new upstream commit has done what 0011 does. (2.3)Patch 0038 for 5.10 is abandoned for new upstream commit <samples/bpf: replace broken overhead microbenchmark with fib_table_lookup> in 6.6. Refer to: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/ linux.git/commit/?id=58e975d014e1e31bd1586be7d2be6d61bd3e3ada 0038 isn't needed any more with the new commit merged. (2.4)Patch 0015-0016 are abandoned because the issue has been fixed from the user space side by using the stable /dev/disk/by-path/... symbolic links instead of names like /dev/sda that can change (confirmed by M. Vefa Bicakci). (2.5)Below patches for 5.10 are ported to 6.6: 0001-0009/0012/0028-0029/0039/0056/0075 Test plan: The out of tree kernel modules for 6.6 aren't ready by now. So many tests can't be done yet because the related test environments need those OOT drivers. Here list the tests which have been done with a test patch to remove the OOT drivers from the ISO temporarily. There are also 2 patches as workaround for solving 2 issues met when installing lab in jenkins job. PASS: Build linux/linux-rt OK. PASS: Build ISO OK. PASS: Install and boot up OK on a AIO-SX lab with std/rt kernel. Story: 2011000 Task: 49365 Signed-off-by: Li Zhou <li.zhou@windriver.com> Change-Id: Ied97721153e9eb8f81d37dfccbff5555c243f2f0
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
From 7c6b99658dc1eaa6467fcb2a4df09705c391f2d6 Mon Sep 17 00:00:00 2001
|
||||
From 95ab9d6bdf33e047307163a41e6fa9124be1573b Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Thu, 11 Nov 2021 17:24:01 +0800
|
||||
Subject: [PATCH 4/4] kernel-std: Adapt the debian folder for new source
|
||||
Subject: [PATCH] kernel-std: Adapt the debian folder for new source
|
||||
|
||||
Below are the changes on DEBIAN's kernel release's "debian" folder
|
||||
for building linux-yocto kernel source 5.10.74, besides kernel configs
|
||||
for building linux-yocto kernel source 6.6.7, besides kernel configs
|
||||
and the debian/changelog file:
|
||||
|
||||
-Update debian/config/amd64/none/defines to disable debian cloud image
|
||||
@@ -15,50 +15,61 @@ and the debian/changelog file:
|
||||
-Update debian/lib/python/debian_linux/debian.py to remove an
|
||||
unimportant format check for changelog because it conflicts with the
|
||||
new build system;
|
||||
-Update debian/patches/series to only keep the patches to support
|
||||
package build system and the lockdown feature, which are from
|
||||
-Update debian/patches/series to only keep the necessary patches to
|
||||
support package build system and the lockdown feature, which are from
|
||||
DEBIAN release.
|
||||
-Update debian/rules to solve the issue that build paused after
|
||||
gencontrol.
|
||||
-Update abiname from "0.deb11.9" to "1" for new STX kernel.
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
[lz: adapted the patch for porting kernel from 5.10 to 6.6]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/config/amd64/none/defines | 7 --
|
||||
debian/config/defines | 7 +-
|
||||
debian/lib/python/debian_linux/debian.py | 23 +++--
|
||||
debian/patches/series | 108 -----------------------
|
||||
debian/config/amd64/none/defines | 8 --
|
||||
debian/config/defines | 9 +-
|
||||
debian/lib/python/debian_linux/debian.py | 23 ++--
|
||||
debian/patches/series | 134 -----------------------
|
||||
debian/rules | 9 +-
|
||||
5 files changed, 18 insertions(+), 136 deletions(-)
|
||||
5 files changed, 19 insertions(+), 164 deletions(-)
|
||||
|
||||
diff --git a/debian/config/amd64/none/defines b/debian/config/amd64/none/defines
|
||||
index ada2355..090dc41 100644
|
||||
index 1717c99..090dc41 100644
|
||||
--- a/debian/config/amd64/none/defines
|
||||
+++ b/debian/config/amd64/none/defines
|
||||
@@ -1,10 +1,3 @@
|
||||
@@ -1,11 +1,3 @@
|
||||
[base]
|
||||
flavours:
|
||||
amd64
|
||||
- cloud-amd64
|
||||
-default-flavour: amd64
|
||||
-quick-flavour: cloud-amd64
|
||||
-
|
||||
-[cloud-amd64_image]
|
||||
-configs:
|
||||
- config.cloud
|
||||
- amd64/config.cloud-amd64
|
||||
diff --git a/debian/config/defines b/debian/config/defines
|
||||
index 7133cd7..018a1b2 100644
|
||||
index 1b4ee8f..6e38cd8 100644
|
||||
--- a/debian/config/defines
|
||||
+++ b/debian/config/defines
|
||||
@@ -141,7 +141,6 @@ arches:
|
||||
@@ -1,5 +1,5 @@
|
||||
[abi]
|
||||
-abiname: 0.deb11.9
|
||||
+abiname: 1
|
||||
ignore-changes:
|
||||
__cpuhp_*
|
||||
__udp_gso_segment
|
||||
@@ -145,7 +145,6 @@ arches:
|
||||
compiler: gcc-10
|
||||
featuresets:
|
||||
none
|
||||
- rt
|
||||
|
||||
[build]
|
||||
debug-info: true
|
||||
@@ -149,7 +148,7 @@ debug-info: true
|
||||
signed-code: false
|
||||
# Disable code signing by default; this can be overridden per-architecture
|
||||
@@ -153,7 +152,7 @@ signed-code: false
|
||||
trusted-certs: debian/certs/debian-uefi-certs.pem
|
||||
|
||||
[featureset-rt_base]
|
||||
-enabled: true
|
||||
@@ -66,7 +77,7 @@ index 7133cd7..018a1b2 100644
|
||||
|
||||
[description]
|
||||
part-long-up: This kernel is not suitable for SMP (multi-processor,
|
||||
@@ -167,3 +166,7 @@ gcc-10: gcc-10 <!stage1 !cross !pkg.linux.nokernel>, gcc-10-@gnu-type-package@ <
|
||||
@@ -171,3 +170,7 @@ gcc-10: gcc-10 <!stage1 !cross !pkg.linux.nokernel>, gcc-10-@gnu-type-package@ <
|
||||
# initramfs-generators
|
||||
initramfs-fallback: linux-initramfs-tool
|
||||
initramfs-tools: initramfs-tools (>= 0.120+deb8u2)
|
||||
@@ -75,10 +86,10 @@ index 7133cd7..018a1b2 100644
|
||||
+docs: false
|
||||
+installer: false
|
||||
diff --git a/debian/lib/python/debian_linux/debian.py b/debian/lib/python/debian_linux/debian.py
|
||||
index 6fb2618..2e0fed9 100644
|
||||
index 8fca8fb..2e41715 100644
|
||||
--- a/debian/lib/python/debian_linux/debian.py
|
||||
+++ b/debian/lib/python/debian_linux/debian.py
|
||||
@@ -85,18 +85,17 @@ class Changelog(list):
|
||||
@@ -87,18 +87,17 @@ class Changelog(list):
|
||||
v = Version(top_match.group('version'))
|
||||
else:
|
||||
bottom_match = self._bottom_re.match(line)
|
||||
@@ -109,10 +120,10 @@ index 6fb2618..2e0fed9 100644
|
||||
|
||||
class Version(object):
|
||||
diff --git a/debian/patches/series b/debian/patches/series
|
||||
index 56d1700..163943a 100644
|
||||
index 1f915ac..7326cee 100644
|
||||
--- a/debian/patches/series
|
||||
+++ b/debian/patches/series
|
||||
@@ -1,13 +1,3 @@
|
||||
@@ -1,146 +1,12 @@
|
||||
-debian/gitignore.patch
|
||||
-
|
||||
-# Disable features broken by exclusion of upstream files
|
||||
@@ -126,10 +137,24 @@ index 56d1700..163943a 100644
|
||||
# Changes to support package build system
|
||||
debian/version.patch
|
||||
debian/uname-version-timestamp.patch
|
||||
@@ -26,68 +16,6 @@ debian/documentation-drop-sphinx-version-check.patch
|
||||
debian/kernelvariables.patch
|
||||
-debian/ia64-hardcode-arch-script-output.patch
|
||||
-debian/mips-disable-werror.patch
|
||||
-debian/mips-boston-disable-its.patch
|
||||
-debian/mips-ieee754-relaxed.patch
|
||||
-debian/arch-sh4-fix-uimage-build.patch
|
||||
-debian/tools-perf-perf-read-vdso-in-libexec.patch
|
||||
-debian/tools-perf-install-python-bindings.patch
|
||||
-debian/wireless-add-debian-wireless-regdb-certificates.patch
|
||||
-debian/export-symbols-needed-by-android-drivers.patch
|
||||
-debian/android-enable-building-ashmem-and-binder-as-modules.patch
|
||||
-debian/documentation-drop-sphinx-version-check.patch
|
||||
debian/perf-traceevent-support-asciidoctor-for-documentatio.patch
|
||||
debian/kbuild-look-for-module.lds-under-arch-directory-too.patch
|
||||
|
||||
-debian/kbuild-abort-build-if-subdirs-used.patch
|
||||
-debian/module-avoid-abi-changes-when-debug-info-is-disabled.patch
|
||||
-debian/makefile-make-compiler-version-comparison-optional.patch
|
||||
-
|
||||
-# Fixes/improvements to firmware loading
|
||||
-features/all/drivers-media-dvb-usb-af9005-request_firmware.patch
|
||||
-debian/iwlwifi-do-not-request-unreleased-firmware.patch
|
||||
@@ -137,17 +162,11 @@ index 56d1700..163943a 100644
|
||||
-bugfix/all/firmware-remove-redundant-log-messages-from-drivers.patch
|
||||
-bugfix/all/radeon-amdgpu-firmware-is-required-for-drm-and-kms-on-r600-onward.patch
|
||||
-debian/firmware_class-refer-to-debian-wiki-firmware-page.patch
|
||||
-
|
||||
-# Patches from aufs5 repository, imported with debian/bin/genpatch-aufs.
|
||||
-# These are only the changes needed to allow aufs to be built out-of-tree.
|
||||
-#features/all/aufs5/aufs5-base.patch
|
||||
-#features/all/aufs5/aufs5-mmap.patch
|
||||
-#features/all/aufs5/aufs5-standalone.patch
|
||||
-bugfix/all/wifi-mt76-do-not-run-mt76_unregister_device-on-unregistered-hw.patch
|
||||
-
|
||||
-# Change some defaults for security reasons
|
||||
-debian/af_802154-Disable-auto-loading-as-mitigation-against.patch
|
||||
-debian/rds-Disable-auto-loading-as-mitigation-against-local.patch
|
||||
-debian/decnet-Disable-auto-loading-as-mitigation-against-lo.patch
|
||||
-debian/dccp-disable-auto-loading-as-mitigation-against-local-exploits.patch
|
||||
-debian/hamradio-disable-auto-loading-as-mitigation-against-local-exploits.patch
|
||||
-debian/fs-enable-link-security-restrictions-by-default.patch
|
||||
@@ -172,47 +191,64 @@ index 56d1700..163943a 100644
|
||||
-
|
||||
-# Arch bug fixes
|
||||
-bugfix/arm/arm-dts-kirkwood-fix-sata-pinmux-ing-for-ts419.patch
|
||||
-bugfix/arm64/dts-rockchip-correct-voltage-selector-firefly-RK3399.patch
|
||||
-bugfix/x86/perf-tools-fix-unwind-build-on-i386.patch
|
||||
-bugfix/sh/sh-boot-do-not-use-hyphen-in-exported-variable-name.patch
|
||||
-bugfix/arm/arm-mm-export-__sync_icache_dcache-for-xen-privcmd.patch
|
||||
-bugfix/powerpc/powerpc-boot-fix-missing-crc32poly.h-when-building-with-kernel_xz.patch
|
||||
-bugfix/arm64/arm64-acpi-Add-fixup-for-HPE-m400-quirks.patch
|
||||
-bugfix/x86/x86-32-disable-3dnow-in-generic-config.patch
|
||||
-bugfix/alpha/alpha-fix-missing-symbol-versions-for-str-n-cat-cpy.patch
|
||||
-
|
||||
-# Arch features
|
||||
-features/arm64/arm64-dts-rockchip-Add-basic-support-for-Kobol-s-Hel.patch
|
||||
-features/arm64/dt-bindings-rockchip-Add-Hardkernel-ODROID-M1-board.patch
|
||||
-features/arm64/arm64-dts-rockchip-Add-Hardkernel-ODROID-M1-board.patch
|
||||
-features/arm64/arm64-dts-rockchip-add-thermal-support-to-ODROID-M1.patch
|
||||
-features/arm64/arm64-dts-rockchip-Add-NOR-flash-to-ODROID-M1.patch
|
||||
-features/arm64/arm64-dts-rockchip-Add-analog-audio-on-ODROID-M1.patch
|
||||
-features/arm64/arm64-dts-rockchip-Enable-vop2-and-hdmi-tx-on-ODROID.patch
|
||||
-features/arm64/arm64-dts-rockchip-Enable-HDMI-audio-on-ODROID-M1.patch
|
||||
-features/arm64/arm64-dts-rockchip-Enable-the-GPU-on-ODROID-M1.patch
|
||||
-features/arm64/arm64-dts-rockchip-Enable-the-USB-2.0-ports-on-ODROI.patch
|
||||
-features/arm64/arm64-dts-rockchip-Enable-the-USB-3.0-ports-on-ODROI.patch
|
||||
-features/arm64/arm64-dts-rockchip-Add-SATA-support-to-ODROID-M1.patch
|
||||
-features/arm64/arm64-dts-rockchip-Add-PCIEe-v3-nodes-to-ODROID-M1.patch
|
||||
-features/arm64/arm64-dts-rockchip-Add-IR-receiver-node-to-ODROID-M1.patch
|
||||
-features/x86/x86-memtest-WARN-if-bad-RAM-found.patch
|
||||
-features/x86/x86-make-x32-syscall-support-conditional.patch
|
||||
-
|
||||
-# Quartz64 bug fixes/patches
|
||||
-bugfix/arm64/arm64-dts-rockchip-fix-spdif-fe460000-ordering-on-rk.patch
|
||||
-features/arm64/quartz64/arm64-dts-rockchip-RK356x-Add-I2S2-device-node.patch
|
||||
-features/arm64/quartz64/arm64-dts-rockchip-Enable-GPU-on-SOQuartz-CM4.patch
|
||||
-features/arm64/quartz64/arm64-dts-rockchip-Enable-video-output-and-HDMI-on-S.patch
|
||||
-features/arm64/quartz64/arm64-dts-rockchip-Enable-HDMI-sound-on-SOQuartz.patch
|
||||
-features/arm64/quartz64/arm64-dts-rockchip-Enable-PCIe-2-on-SOQuartz-CM4IO.patch
|
||||
-features/arm64/quartz64/dt-bindings-arm-rockchip-Add-SOQuartz-Blade.patch
|
||||
-features/arm64/quartz64/arm64-dts-rockchip-Add-SOQuartz-blade-board.patch
|
||||
-features/arm64/quartz64/dt-bindings-arm-rockchip-Add-SOQuartz-Model-A.patch
|
||||
-features/arm64/quartz64/arm64-dts-rockchip-Add-SOQuartz-Model-A-baseboard.patch
|
||||
-
|
||||
-# Miscellaneous bug fixes
|
||||
-bugfix/all/disable-some-marvell-phys.patch
|
||||
-bugfix/all/fs-add-module_softdep-declarations-for-hard-coded-cr.patch
|
||||
-bugfix/all/partially-revert-usb-kconfig-using-select-for-usb_co.patch
|
||||
-debian/makefile-do-not-check-for-libelf-when-building-oot-module.patch
|
||||
-bugfix/all/partially-revert-net-socket-implement-64-bit-timestamps.patch
|
||||
-
|
||||
-bugfix/all/media-cx18-avoid-strlen-call-that-triggers-ice-in-gc.patch
|
||||
|
||||
# Miscellaneous features
|
||||
|
||||
# Lockdown missing pieces
|
||||
@@ -95,39 +23,3 @@ features/all/lockdown/efi-add-an-efi_secure_boot-flag-to-indicate-secure-b.patch
|
||||
features/all/lockdown/efi-add-an-efi_secure_boot-flag-to-indicate-secure-b.patch
|
||||
features/all/lockdown/efi-lock-down-the-kernel-if-booted-in-secure-boot-mo.patch
|
||||
features/all/lockdown/mtd-disable-slram-and-phram-when-locked-down.patch
|
||||
features/all/lockdown/arm64-add-kernel-config-option-to-lock-down-when.patch
|
||||
-features/all/lockdown/mtd-disable-slram-and-phram-when-locked-down.patch
|
||||
-features/all/lockdown/arm64-add-kernel-config-option-to-lock-down-when.patch
|
||||
-
|
||||
-# Improve integrity platform keyring for kernel modules verification
|
||||
-features/all/db-mok-keyring/0001-MODSIGN-do-not-load-mok-when-secure-boot-disabled.patch
|
||||
-features/all/db-mok-keyring/0002-MODSIGN-load-blacklist-from-MOKx.patch
|
||||
-features/all/db-mok-keyring/0003-MODSIGN-checking-the-blacklisted-hash-before-loading-a-kernel-module.patch
|
||||
-features/all/db-mok-keyring/0004-MODSIGN-check-the-attributes-of-db-and-mok.patch
|
||||
-features/all/db-mok-keyring/modsign-make-shash-allocation-failure-fatal.patch
|
||||
-features/all/db-mok-keyring/KEYS-Make-use-of-platform-keyring-for-module-signature.patch
|
||||
-features/all/db-mok-keyring/trust-machine-keyring-by-default.patch
|
||||
-
|
||||
-# Security fixes
|
||||
-debian/i386-686-pae-pci-set-pci-nobios-by-default.patch
|
||||
-debian/ntfs-mark-it-as-broken.patch
|
||||
-bugfix/x86/0001-bpf-x86-Validate-computation-of-branch-displacements.patch
|
||||
-bugfix/x86/0002-bpf-x86-Validate-computation-of-branch-displacements.patch
|
||||
-bugfix/all/netfilter-nf_tables-deactivate-anonymous-set-from-pr.patch
|
||||
-
|
||||
-# Fix exported symbol versions
|
||||
-bugfix/all/module-disable-matching-missing-version-crc.patch
|
||||
@@ -225,21 +261,20 @@ index 56d1700..163943a 100644
|
||||
-bugfix/x86/revert-perf-build-fix-libunwind-feature-detection-on.patch
|
||||
-bugfix/all/tools-build-remove-bpf-run-time-check-at-build-time.patch
|
||||
-bugfix/all/cpupower-bump-soname-version.patch
|
||||
-bugfix/all/libcpupower-hide-private-function.patch
|
||||
-bugfix/all/cpupower-fix-checks-for-cpu-existence.patch
|
||||
-bugfix/all/tools-perf-pmu-events-fix-reproducibility.patch
|
||||
-bugfix/all/bpftool-fix-version-string-in-recursive-builds.patch
|
||||
-bugfix/all/tools-include-uapi-fix-errno.h.patch
|
||||
-bugfix/all/libapi-define-_fortify_source-as-2-not-empty.patch
|
||||
-bugfix/all/tools-perf-fix-missing-ldflags-for-some-programs.patch
|
||||
-
|
||||
-# overlay: allow mounting in user namespaces
|
||||
-debian/overlayfs-permit-mounts-in-userns.patch
|
||||
-# debian-installer fixes
|
||||
-bugfix/powerpc/fbdev-offb-Update-expected-device-name.patch
|
||||
-
|
||||
-# ABI maintenance
|
||||
diff --git a/debian/rules b/debian/rules
|
||||
index 3659e5b..db4fc10 100755
|
||||
index b39c230..67f799b 100755
|
||||
--- a/debian/rules
|
||||
+++ b/debian/rules
|
||||
@@ -113,12 +113,7 @@ debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES)
|
||||
@@ -130,12 +130,7 @@ debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES)
|
||||
# Hash randomisation makes the pickled config unreproducible
|
||||
PYTHONHASHSEED=0 $<
|
||||
md5sum $^ > debian/control.md5sum
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,31 +0,0 @@
|
||||
From 9576d9ffaaa5af945ae375ebbd8b855a1165ff3b Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Tue, 23 Nov 2021 10:53:44 +0800
|
||||
Subject: [PATCH 2/4] kernel-std: Add a new changelog file for linux-yocto
|
||||
source code
|
||||
|
||||
Don't list the commits logs and only give out the link for checking
|
||||
about the git history of this source code.
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
create mode 100644 debian/changelog
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
new file mode 100644
|
||||
index 0000000..c64e51a
|
||||
--- /dev/null
|
||||
+++ b/debian/changelog
|
||||
@@ -0,0 +1,7 @@
|
||||
+linux (5.10.74-1) stable; urgency=medium
|
||||
+
|
||||
+ * New upstream stable update:
|
||||
+ https://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=9e84a42af61ff9c6feb89ab8d61ee5f25fb35c72
|
||||
+
|
||||
+ -- Li Zhou <li.zhou@windriver.com> Tue Nov 9 11:23:35 CST 2021
|
||||
+
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 75e10ef94efd1b511793fd64be4e12f2c31a3c10 Mon Sep 17 00:00:00 2001
|
||||
From 9040e78079d28419601e030db062fadf54be3392 Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Tue, 5 Jul 2022 14:37:18 +0800
|
||||
Subject: [PATCH] kernel-std: fix /proc/version content
|
||||
@@ -11,16 +11,18 @@ To make /proc/version not contain debian maillist.
|
||||
Add "StarlingX" in KBUILD_BUILD_VERSION_TIMESTAMP
|
||||
to correct only "Debian" in the utsname::version string.
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
[lz: Adapted the patch for context changes.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/rules.real | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/debian/rules.real b/debian/rules.real
|
||||
index 01b568c..ffd75e7 100644
|
||||
index 0e88ed7..69474b8 100644
|
||||
--- a/debian/rules.real
|
||||
+++ b/debian/rules.real
|
||||
@@ -43,7 +43,7 @@ export LINK_DOC_PACKAGE
|
||||
@@ -42,7 +42,7 @@ undefine LANGUAGE
|
||||
stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@
|
||||
|
||||
setup_env := env -u ABINAME -u ARCH -u FEATURESET -u FLAVOUR -u VERSION -u LOCALVERSION
|
||||
@@ -28,7 +30,7 @@ index 01b568c..ffd75e7 100644
|
||||
+setup_env += DISTRIBUTION_OFFICIAL_BUILD=1 DISTRIBUTOR="$(DISTRIBUTOR)" DISTRIBUTION_VERSION="$(SOURCEVERSION)" KBUILD_BUILD_TIMESTAMP="$(SOURCE_DATE)" KBUILD_BUILD_VERSION_TIMESTAMP="StarlingX $(DISTRIBUTOR) $(SOURCEVERSION) ($(SOURCE_DATE_UTC_ISO))"
|
||||
setup_env += KBUILD_VERBOSE=$(if $(filter terse,$(DEB_BUILD_OPTIONS)),0,1)
|
||||
|
||||
MAKE_CLEAN = $(setup_env) $(MAKE) KCFLAGS=-fdebug-prefix-map=$(CURDIR)/=
|
||||
MAKE_CLEAN = $(setup_env) $(MAKE) KCFLAGS=-fdebug-prefix-map=$(CURDIR)/= KBUILD_HOSTCFLAGS='$(CFLAGS) $(CPPFLAGS)' HOSTCFLAGS='$(CFLAGS) $(CPPFLAGS)' KBUILD_HOSTLDFLAGS='$(LDFLAGS)'
|
||||
--
|
||||
2.17.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,10 @@
|
||||
From cf7b1336907da9e20d025a018ca41144e2874b82 Mon Sep 17 00:00:00 2001
|
||||
From 33d2d1d57426eac81e53347c8da5b38a2a4ec5c9 Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Wed, 2 Nov 2022 14:48:33 +0800
|
||||
Subject: [PATCH] kernel: std: unset LOCK_DOWN_IN_EFI_SECURE_BOOT
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
[lz: Adapted the patch for context changes.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/bin/gencontrol_signed.py | 1 -
|
||||
@@ -10,22 +12,22 @@ Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
2 files changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/debian/bin/gencontrol_signed.py b/debian/bin/gencontrol_signed.py
|
||||
index 75d9112..b984cf3 100755
|
||||
index 5a5d7f2..9b6ca87 100755
|
||||
--- a/debian/bin/gencontrol_signed.py
|
||||
+++ b/debian/bin/gencontrol_signed.py
|
||||
@@ -188,7 +188,6 @@ class Gencontrol(Base):
|
||||
@@ -198,7 +198,6 @@ class Gencontrol(Base):
|
||||
(image_package_name, image_suffix)) as f:
|
||||
kconfig = f.readlines()
|
||||
assert 'CONFIG_EFI_STUB=y\n' in kconfig
|
||||
- assert 'CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT=y\n' in kconfig
|
||||
cert_re = re.compile(r'CONFIG_SYSTEM_TRUSTED_KEYS="(.*)"$')
|
||||
cert_file_name = None
|
||||
for line in kconfig:
|
||||
cert_file_name = config_build['trusted-certs']
|
||||
self.image_packages.append((image_suffix, image_package_name,
|
||||
cert_file_name))
|
||||
diff --git a/debian/config/config b/debian/config/config
|
||||
index 90826df..fa750b7 100644
|
||||
index 521caee..ca34823 100644
|
||||
--- a/debian/config/config
|
||||
+++ b/debian/config/config
|
||||
@@ -7789,7 +7789,7 @@ CONFIG_SECURITY_LOCKDOWN_LSM=y
|
||||
@@ -7826,7 +7826,7 @@ CONFIG_SECURITY_LANDLOCK=y
|
||||
## choice: Kernel default lockdown mode
|
||||
CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE=y
|
||||
## end choice
|
||||
@@ -0,0 +1,75 @@
|
||||
From 85c4a7ccd47f96b423c5606a796448f65e85b3e5 Mon Sep 17 00:00:00 2001
|
||||
From: Jiping Ma <jiping.ma2@windriver.com>
|
||||
Date: Mon, 26 Sep 2022 20:58:57 -0700
|
||||
Subject: [PATCH] Place module signing keys in a separate package
|
||||
|
||||
Currently we package our module signing keys as part of
|
||||
the 'linux-kbuild' package. This means that anyone obtaining
|
||||
our 'linux-kbuild' package, which we do publish, can produce
|
||||
signed modules. This violates the intent of secure boot.
|
||||
|
||||
Re-package our module signing keys into a separate package
|
||||
known as 'linux-keys'.
|
||||
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
[lz: adapted the patch for porting kernel from 5.10 to 6.6]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/rules.real | 20 ++++++++++++++++++++
|
||||
debian/templates/tools-versioned.control.in | 9 +++++++++
|
||||
2 files changed, 29 insertions(+)
|
||||
|
||||
diff --git a/debian/rules.real b/debian/rules.real
|
||||
index 69474b8..d95c14c 100644
|
||||
--- a/debian/rules.real
|
||||
+++ b/debian/rules.real
|
||||
@@ -586,6 +586,26 @@ endif
|
||||
dh_md5sums
|
||||
dh_builddeb -- $(BUILDDEB_ARGS)
|
||||
|
||||
+build_keys:
|
||||
+
|
||||
+binary_keys: PACKAGE_NAME = linux-keys-$(VERSION)
|
||||
+binary_keys: DH_OPTIONS = -p$(PACKAGE_NAME)
|
||||
+binary_keys: DIR = $(CURDIR)/debian/$(PACKAGE_NAME)
|
||||
+binary_keys: build_keys
|
||||
+ dh_testdir
|
||||
+ dh_testroot
|
||||
+ dh_prep
|
||||
+ dh_installdirs
|
||||
+ dh_install $(BUILD_DIR)/*/certs/signing_key.pem /usr/src/kernels/$(ABINAME)-$(ARCH)/
|
||||
+ dh_install $(BUILD_DIR)/*/certs/signing_key.x509 /usr/src/kernels/$(ABINAME)-$(ARCH)/
|
||||
+ dh_installchangelogs
|
||||
+ dh_compress
|
||||
+ dh_fixperms
|
||||
+ dh_installdeb
|
||||
+ dh_gencontrol
|
||||
+ dh_md5sums
|
||||
+ dh_builddeb
|
||||
+
|
||||
build_cpupower: $(STAMPS_DIR)/build-tools-headers
|
||||
$(call make-tools,tools/power/cpupower)
|
||||
ifneq ($(filter i386 amd64 x32,$(DEB_HOST_ARCH)),)
|
||||
diff --git a/debian/templates/tools-versioned.control.in b/debian/templates/tools-versioned.control.in
|
||||
index 84480de..8b313f6 100644
|
||||
--- a/debian/templates/tools-versioned.control.in
|
||||
+++ b/debian/templates/tools-versioned.control.in
|
||||
@@ -7,6 +7,15 @@ Multi-Arch: foreign
|
||||
Description: Kbuild infrastructure for Linux @version@
|
||||
This package provides the kbuild infrastructure for the headers packages for Linux kernel version @version@.
|
||||
|
||||
+Package: linux-keys-@version@
|
||||
+Meta-Rules-Target: keys
|
||||
+Build-Profiles: <!stage1 !pkg.linux.notools>
|
||||
+Architecture: linux-any
|
||||
+Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
+Multi-Arch: foreign
|
||||
+Description: Key infrastructure for Linux @version@
|
||||
+ This package provides the kernel module signing keys for Linux kernel version @version@.
|
||||
+
|
||||
Package: linux-bootwrapper-@abiname@
|
||||
Meta-Rules-Target: bootwrapper
|
||||
Build-Profiles: <!stage1 !pkg.linux.notools>
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
From d222b4474a1d8944b0b4d8978d8e9fe6b1ee80db Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Thu, 17 Feb 2022 10:08:13 +0800
|
||||
Subject: [PATCH] kernel-modules: sign kernel-modules
|
||||
|
||||
Sign kernel-modules by the keys created by kernel.
|
||||
Put the keys into linux-kbuild-5.10 package and they will be used
|
||||
to sign the out of tree kernel modules.
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/config/amd64/none/config | 11 +++++++++++
|
||||
debian/rules.real | 2 ++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
|
||||
index a12e291..771a68b 100644
|
||||
--- a/debian/config/amd64/none/config
|
||||
+++ b/debian/config/amd64/none/config
|
||||
@@ -6497,3 +6497,14 @@ CONFIG_RUNTIME_TESTING_MENU=y
|
||||
# CONFIG_HYPERV_TESTING is not set
|
||||
# end of Kernel Testing and Coverage
|
||||
# end of Kernel hacking
|
||||
+
|
||||
+##
|
||||
+## file: init/Kconfig
|
||||
+##
|
||||
+CONFIG_MODULE_SIG_ALL=y
|
||||
+# CONFIG_MODULE_SIG_FORCE is not set
|
||||
+
|
||||
+##
|
||||
+## file: certs/Kconfig
|
||||
+##
|
||||
+CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
|
||||
diff --git a/debian/rules.real b/debian/rules.real
|
||||
index 3304579..552fcf0 100644
|
||||
--- a/debian/rules.real
|
||||
+++ b/debian/rules.real
|
||||
@@ -664,6 +664,8 @@ install-kbuild: build-kbuild
|
||||
$(call make-tools,scripts) install DESTDIR=$(DIR) prefix=$(PREFIX_DIR)
|
||||
$(call make-tools,tools/objtool) install DESTDIR=$(DIR) prefix=$(PREFIX_DIR)
|
||||
dh_link $(PREFIX_DIR) /usr/src/$(PACKAGE_NAME)
|
||||
+ dh_install $(BUILD_DIR)/*/certs/signing_key.pem /usr/src/kernels/$(ABINAME)-$(ARCH)/
|
||||
+ dh_install $(BUILD_DIR)/*/certs/signing_key.x509 /usr/src/kernels/$(ABINAME)-$(ARCH)/
|
||||
dh_installchangelogs
|
||||
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
|
||||
dh_installdocs
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 1cf3ef469ee46524ca5656ae3666210cd297d4b9 Mon Sep 17 00:00:00 2001
|
||||
From eb48a2dbea5b87f879fa9e47dd0f35434352511d Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Tue, 12 Sep 2023 14:20:59 +0800
|
||||
Subject: [PATCH] kernel-std: Add pkgs without abiname for image/headers
|
||||
@@ -26,25 +26,27 @@ be determined because it is deduced from init control files of
|
||||
packages. The build error for kernel modules is like:
|
||||
"unsat-dependency: linux-headers-stx-amd64:amd64"
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
[lz: Adapted the patch for upgrading kernel from 5.10 to 6.6.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/control | 16 ++++++++++++++++
|
||||
debian/rules.real | 4 ++--
|
||||
debian/templates/control.extra.in | 16 ++++++++++++++++
|
||||
debian/templates/control.tools-versioned.in | 2 +-
|
||||
4 files changed, 35 insertions(+), 3 deletions(-)
|
||||
debian/rules.real | 2 +-
|
||||
debian/templates/extra.control.in | 18 ++++++++++++++++++
|
||||
debian/templates/tools-versioned.control.in | 2 +-
|
||||
4 files changed, 36 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/debian/control b/debian/control
|
||||
index 11c2e77..255cd94 100644
|
||||
index 493e8f3..d163f4c 100644
|
||||
--- a/debian/control
|
||||
+++ b/debian/control
|
||||
@@ -14606,3 +14606,19 @@ Description: Linux for multiprocessor 32-bit PA-RISC (dummy package)
|
||||
@@ -18525,3 +18525,19 @@ Depends: linux-image-parisc, ${misc:Depends}
|
||||
Description: Linux for multiprocessor 32-bit PA-RISC (dummy package)
|
||||
This is a dummy transitional package. It can be safely removed.
|
||||
Build-Profiles: <!stage1 !pkg.linux.nokernel !pkg.linux.nometa>
|
||||
|
||||
+Package: linux-image-stx-amd64
|
||||
+Architecture: amd64
|
||||
+Depends: linux-image-5.10.0-6-amd64-unsigned (= ${binary:Version}), ${misc:Depends}
|
||||
+Depends: linux-image-6.6.0-1-amd64-unsigned (= ${binary:Version}), ${misc:Depends}
|
||||
+Description: Linux for 64-bit PCs (meta-package)
|
||||
+ This package depends on the latest unsigned Linux kernel and modules for
|
||||
+ use on PCs with AMD64, Intel 64 or VIA Nano processors.
|
||||
@@ -52,44 +54,36 @@ index 11c2e77..255cd94 100644
|
||||
+
|
||||
+Package: linux-headers-stx-amd64
|
||||
+Architecture: amd64
|
||||
+Depends: linux-headers-5.10.0-6-amd64 (= ${binary:Version}), ${misc:Depends}
|
||||
+Depends: linux-headers-6.6.0-1-amd64 (= ${binary:Version}), ${misc:Depends}
|
||||
+Description: Header files for Linux amd64 configuration (meta-package)
|
||||
+ This package depends on the architecture-specific header files for the
|
||||
+ latest Linux kernel amd64 configuration.
|
||||
+Build-Profiles: <!stage1 !pkg.linux.nokernel>
|
||||
+
|
||||
diff --git a/debian/rules.real b/debian/rules.real
|
||||
index a13e1f5..5a1fcee 100644
|
||||
index d95c14c..f2ea3ea 100644
|
||||
--- a/debian/rules.real
|
||||
+++ b/debian/rules.real
|
||||
@@ -72,7 +72,7 @@ binary-arch-arch: \
|
||||
$(call if_package, $(SOURCE_BASENAME)-config-$(VERSION), install-config_$(ARCH)) \
|
||||
$(call if_package, linux-libc-dev, install-libc-dev_$(ARCH)) \
|
||||
$(call if_package, linux-kbuild-$(VERSION), install-kbuild) \
|
||||
- $(call if_package, linux-keys-$(VERSION), install-keys) \
|
||||
+ $(call if_package, linux-keys, install-keys) \
|
||||
$(call if_package, linux-perf-$(VERSION), install-perf) \
|
||||
$(if $(filter-out x-$(VERSION),x$(SOURCE_SUFFIX)), \
|
||||
$(call if_package, linux-perf$(SOURCE_SUFFIX), install-perf-meta)) \
|
||||
@@ -679,7 +679,7 @@ endif
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
@@ -588,7 +588,7 @@ endif
|
||||
|
||||
-install-keys: PACKAGE_NAME = linux-keys-$(VERSION)
|
||||
+install-keys: PACKAGE_NAME = linux-keys
|
||||
install-keys: DH_OPTIONS = -p$(PACKAGE_NAME)
|
||||
install-keys: DIR = $(CURDIR)/debian/$(PACKAGE_NAME)
|
||||
install-keys:
|
||||
diff --git a/debian/templates/control.extra.in b/debian/templates/control.extra.in
|
||||
index ef90151..c84ab8a 100644
|
||||
--- a/debian/templates/control.extra.in
|
||||
+++ b/debian/templates/control.extra.in
|
||||
@@ -42,3 +42,19 @@ Priority: extra
|
||||
build_keys:
|
||||
|
||||
-binary_keys: PACKAGE_NAME = linux-keys-$(VERSION)
|
||||
+binary_keys: PACKAGE_NAME = linux-keys
|
||||
binary_keys: DH_OPTIONS = -p$(PACKAGE_NAME)
|
||||
binary_keys: DIR = $(CURDIR)/debian/$(PACKAGE_NAME)
|
||||
binary_keys: build_keys
|
||||
diff --git a/debian/templates/extra.control.in b/debian/templates/extra.control.in
|
||||
index 4f9fdd8..03edee1 100644
|
||||
--- a/debian/templates/extra.control.in
|
||||
+++ b/debian/templates/extra.control.in
|
||||
@@ -47,3 +47,21 @@ Priority: extra
|
||||
Depends: linux-image-parisc, ${misc:Depends}
|
||||
Description: Linux for multiprocessor 32-bit PA-RISC (dummy package)
|
||||
This is a dummy transitional package. It can be safely removed.
|
||||
+
|
||||
+Package: linux-image-stx-amd64
|
||||
+Meta-Rules-Target: meta
|
||||
+Build-Profiles: <!stage1 !pkg.linux.nokernel>
|
||||
+Depends: linux-image-@abiname@-amd64-unsigned (= ${binary:Version}), ${misc:Depends}
|
||||
+Architecture: amd64
|
||||
@@ -98,25 +92,26 @@ index ef90151..c84ab8a 100644
|
||||
+ for use on PCs with AMD64, Intel 64 or VIA Nano processors.
|
||||
+
|
||||
+Package: linux-headers-stx-amd64
|
||||
+Meta-Rules-Target: meta
|
||||
+Build-Profiles: <!stage1 !pkg.linux.nokernel>
|
||||
+Depends: linux-headers-@abiname@-amd64 (= ${binary:Version}), ${misc:Depends}
|
||||
+Architecture: amd64
|
||||
+Description: Header files for Linux amd64 configuration (meta-package)
|
||||
+ This package depends on the architecture-specific header files for the latest
|
||||
+ Linux kernel amd64 configuration.
|
||||
diff --git a/debian/templates/control.tools-versioned.in b/debian/templates/control.tools-versioned.in
|
||||
index c9d48ed..9daecd7 100644
|
||||
--- a/debian/templates/control.tools-versioned.in
|
||||
+++ b/debian/templates/control.tools-versioned.in
|
||||
@@ -6,7 +6,7 @@ Multi-Arch: foreign
|
||||
diff --git a/debian/templates/tools-versioned.control.in b/debian/templates/tools-versioned.control.in
|
||||
index 8b313f6..2a54fe9 100644
|
||||
--- a/debian/templates/tools-versioned.control.in
|
||||
+++ b/debian/templates/tools-versioned.control.in
|
||||
@@ -7,7 +7,7 @@ Multi-Arch: foreign
|
||||
Description: Kbuild infrastructure for Linux @version@
|
||||
This package provides the kbuild infrastructure for the headers packages for Linux kernel version @version@.
|
||||
|
||||
-Package: linux-keys-@version@
|
||||
+Package: linux-keys
|
||||
Meta-Rules-Target: keys
|
||||
Build-Profiles: <!stage1 !pkg.linux.notools>
|
||||
Architecture: linux-any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
--
|
||||
2.17.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,105 @@
|
||||
From b729436165b02b5db543e12b4f5fe5c96c662b10 Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Fri, 22 Dec 2023 14:33:45 +0800
|
||||
Subject: [PATCH 6/9] Update patches for kernel 6.6.7
|
||||
|
||||
Kernel 6.6.7 is ported to our bullseye platform now.
|
||||
Need build kernel 6.6.7 with 6.1.27-bpo11 "debian" folder.
|
||||
Update the patches involved in "debian" folder for context changes.
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
...ok-for-module.lds-under-arch-directory-too.patch | 6 +++---
|
||||
...event-support-asciidoctor-for-documentatio.patch | 13 -------------
|
||||
debian/patches/debian/version.patch | 2 +-
|
||||
...-efi_secure_boot-flag-to-indicate-secure-b.patch | 2 +-
|
||||
...own-the-kernel-if-booted-in-secure-boot-mo.patch | 2 +-
|
||||
5 files changed, 6 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/debian/patches/debian/kbuild-look-for-module.lds-under-arch-directory-too.patch b/debian/patches/debian/kbuild-look-for-module.lds-under-arch-directory-too.patch
|
||||
index f9a22d8..eea69e4 100644
|
||||
--- a/debian/patches/debian/kbuild-look-for-module.lds-under-arch-directory-too.patch
|
||||
+++ b/debian/patches/debian/kbuild-look-for-module.lds-under-arch-directory-too.patch
|
||||
@@ -42,11 +42,11 @@ Index: linux/scripts/Makefile.modfinal
|
||||
|
||||
quiet_cmd_btf_ko = BTF [M] $@
|
||||
@@ -57,7 +58,7 @@ if_changed_except = $(if $(call newer_pr
|
||||
- printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
|
||||
+ printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
|
||||
|
||||
# Re-generate module BTFs if either module's .ko or vmlinux changed
|
||||
--$(modules): %.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE
|
||||
-+$(modules): %.ko: %.o %.mod.o $(ARCH_MODULE_LDS) $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE
|
||||
+-%.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE
|
||||
++%.ko: %.o %.mod.o $(ARCH_MODULE_LDS) $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE
|
||||
+$(call if_changed_except,ld_ko_o,vmlinux)
|
||||
ifdef CONFIG_DEBUG_INFO_BTF_MODULES
|
||||
+$(if $(newer-prereqs),$(call cmd,btf_ko))
|
||||
diff --git a/debian/patches/debian/perf-traceevent-support-asciidoctor-for-documentatio.patch b/debian/patches/debian/perf-traceevent-support-asciidoctor-for-documentatio.patch
|
||||
index 89df33a..3971218 100644
|
||||
--- a/debian/patches/debian/perf-traceevent-support-asciidoctor-for-documentatio.patch
|
||||
+++ b/debian/patches/debian/perf-traceevent-support-asciidoctor-for-documentatio.patch
|
||||
@@ -23,19 +23,6 @@ index 972754082a85..272d06173a3e 100644
|
||||
ASCIIDOC_HTML = xhtml11
|
||||
MANPAGE_XSL = manpage-normal.xsl
|
||||
XMLTO_EXTRA =
|
||||
-diff --git a/tools/lib/traceevent/Documentation/Makefile b/tools/lib/traceevent/Documentation/Makefile
|
||||
-index aa72ab96c3c1..f3a4ff3b8b0e 100644
|
||||
---- a/tools/lib/traceevent/Documentation/Makefile
|
||||
-+++ b/tools/lib/traceevent/Documentation/Makefile
|
||||
-@@ -28,7 +28,7 @@ mandir?=$(prefix)/share/man
|
||||
- man3dir=$(mandir)/man3
|
||||
-
|
||||
- ASCIIDOC=asciidoc
|
||||
--ASCIIDOC_EXTRA = --unsafe -f asciidoc.conf
|
||||
-+ASCIIDOC_EXTRA =
|
||||
- ASCIIDOC_HTML = xhtml11
|
||||
- MANPAGE_XSL = manpage-normal.xsl
|
||||
- XMLTO_EXTRA =
|
||||
diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile
|
||||
index 6e54979c2124..7bfa6ae971ab 100644
|
||||
--- a/tools/perf/Documentation/Makefile
|
||||
diff --git a/debian/patches/debian/version.patch b/debian/patches/debian/version.patch
|
||||
index 1425f55..47fc6c0 100644
|
||||
--- a/debian/patches/debian/version.patch
|
||||
+++ b/debian/patches/debian/version.patch
|
||||
@@ -22,7 +22,7 @@ Index: linux/Makefile
|
||||
@@ -1263,7 +1263,8 @@ PHONY += prepare archprepare
|
||||
|
||||
archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \
|
||||
- asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h \
|
||||
+ asm-generic $(version_h) include/generated/utsrelease.h \
|
||||
- include/generated/compile.h include/generated/autoconf.h remove-stale-files
|
||||
+ include/generated/compile.h include/generated/autoconf.h \
|
||||
+ include/generated/package.h remove-stale-files
|
||||
diff --git a/debian/patches/features/all/lockdown/efi-add-an-efi_secure_boot-flag-to-indicate-secure-b.patch b/debian/patches/features/all/lockdown/efi-add-an-efi_secure_boot-flag-to-indicate-secure-b.patch
|
||||
index b466987..6a8940d 100644
|
||||
--- a/debian/patches/features/all/lockdown/efi-add-an-efi_secure_boot-flag-to-indicate-secure-b.patch
|
||||
+++ b/debian/patches/features/all/lockdown/efi-add-an-efi_secure_boot-flag-to-indicate-secure-b.patch
|
||||
@@ -138,7 +138,7 @@ cc: linux-efi@vger.kernel.org
|
||||
|
||||
extern int efi_status_to_err(efi_status_t status);
|
||||
@@ -1107,13 +1117,6 @@ static inline bool efi_runtime_disabled(
|
||||
- extern void efi_call_virt_check_flags(unsigned long flags, const char *call);
|
||||
+ extern void efi_call_virt_check_flags(unsigned long flags, const void *caller);
|
||||
extern unsigned long efi_call_virt_save_flags(void);
|
||||
|
||||
-enum efi_secureboot_mode {
|
||||
diff --git a/debian/patches/features/all/lockdown/efi-lock-down-the-kernel-if-booted-in-secure-boot-mo.patch b/debian/patches/features/all/lockdown/efi-lock-down-the-kernel-if-booted-in-secure-boot-mo.patch
|
||||
index 9ec4258..9687fa9 100644
|
||||
--- a/debian/patches/features/all/lockdown/efi-lock-down-the-kernel-if-booted-in-secure-boot-mo.patch
|
||||
+++ b/debian/patches/features/all/lockdown/efi-lock-down-the-kernel-if-booted-in-secure-boot-mo.patch
|
||||
@@ -34,9 +34,9 @@ Index: debian-kernel/arch/x86/kernel/setup.c
|
||||
|
||||
+ efi_set_secure_boot(boot_params.secure_boot);
|
||||
+
|
||||
+ reserve_ibft_region();
|
||||
dmi_setup();
|
||||
|
||||
- /*
|
||||
@@ -1130,8 +1132,6 @@ void __init setup_arch(char **cmdline_p)
|
||||
/* Allocate bigger log buffer */
|
||||
setup_log_buf(1);
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
From 5c4cf6c9765ee8d83bd3f7dcddebf2a5d45a3fec Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Mon, 11 Apr 2022 16:05:02 +0800
|
||||
Subject: [PATCH] Debian: update 5.10 Kernel to 5.10.99
|
||||
|
||||
Update debian/changelog.
|
||||
Add new configs:
|
||||
CONFIG_BPF_UNPRIV_DEFAULT_OFF
|
||||
CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/changelog | 11 +++++++++--
|
||||
debian/config/amd64/none/config | 6 ++++++
|
||||
2 files changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index c64e51a..5a2b6bb 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,6 +1,13 @@
|
||||
-linux (5.10.74-1) stable; urgency=medium
|
||||
+linux (5.10.99-1) unstable; urgency=medium
|
||||
|
||||
- * New upstream stable update:
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=84f6a75f64961e59d61bf3d70ab17e8bb430386b
|
||||
+
|
||||
+ -- Li Zhou <li.zhou@windriver.com> Wed Apr 13 11:37:52 CST 2022
|
||||
+
|
||||
+linux (5.10.74-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
https://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=9e84a42af61ff9c6feb89ab8d61ee5f25fb35c72
|
||||
|
||||
-- Li Zhou <li.zhou@windriver.com> Tue Nov 9 11:23:35 CST 2021
|
||||
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
|
||||
index 1f00698..a5dadc7 100644
|
||||
--- a/debian/config/amd64/none/config
|
||||
+++ b/debian/config/amd64/none/config
|
||||
@@ -6398,3 +6398,9 @@ CONFIG_MODULE_SIG_ALL=y
|
||||
## file: certs/Kconfig
|
||||
##
|
||||
CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
|
||||
+
|
||||
+#
|
||||
+# Upgrade to 5.10.99
|
||||
+#
|
||||
+# CONFIG_BPF_UNPRIV_DEFAULT_OFF is not set
|
||||
+# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 494225b3addd442fc21bcea6ba3e2900fb0acadd Mon Sep 17 00:00:00 2001
|
||||
From: Diederik de Haas <didi.debian@cknow.org>
|
||||
Date: Wed, 8 Mar 2023 10:39:42 +0100
|
||||
Subject: [PATCH 7/9] linux-kbuild: Stop building bin2c in 6.3
|
||||
|
||||
In upstream commit ec61452aaad6bb0d4f3f4d4b78d27bed90eb2494 `bin2c` was
|
||||
removed, so stop trying to build it as it causes a FTBFS.
|
||||
|
||||
[lz: Porting from https://salsa.debian.org/kernel-team/linux/-/commit/
|
||||
d4ee24ef3f7369b5fb9cdfbb0a549f393163c97a to fix build error:
|
||||
"No rule to make target 'bin2c'"]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/rules.d/scripts/Makefile | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/debian/rules.d/scripts/Makefile b/debian/rules.d/scripts/Makefile
|
||||
index bbfe9c0..c913e25 100644
|
||||
--- a/debian/rules.d/scripts/Makefile
|
||||
+++ b/debian/rules.d/scripts/Makefile
|
||||
@@ -1,5 +1,4 @@
|
||||
PROGS = \
|
||||
- bin2c \
|
||||
kallsyms \
|
||||
recordmcount \
|
||||
sign-file \
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
From 816d9085688975fa3c2ed130ca3bb96f4818d2c5 Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Fri, 15 Apr 2022 16:01:44 +0800
|
||||
Subject: [PATCH] config: set configs needed for secure boot
|
||||
|
||||
In the debian patch
|
||||
[efi: Lock down the kernel if booted in secure boot mode], the config
|
||||
"CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT" depends on SECURITY_LOCKDOWN_LSM
|
||||
and selects SECURITY_LOCKDOWN_LSM_EARLY.
|
||||
Set those 2 configs correctly to enable
|
||||
CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT.
|
||||
So that unsigned / missigned kernel modules will be rejected when
|
||||
secure boot is enabled and CONFIG_MODULE_SIG_FORCE is not set.
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/config/amd64/none/config | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
|
||||
index a5dadc7..df018e4 100644
|
||||
--- a/debian/config/amd64/none/config
|
||||
+++ b/debian/config/amd64/none/config
|
||||
@@ -5683,7 +5683,8 @@ CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE=256
|
||||
# CONFIG_SECURITY_LOADPIN is not set
|
||||
CONFIG_SECURITY_YAMA=y
|
||||
# CONFIG_SECURITY_SAFESETID is not set
|
||||
-# CONFIG_SECURITY_LOCKDOWN_LSM is not set
|
||||
+CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y
|
||||
+CONFIG_SECURITY_LOCKDOWN_LSM=y
|
||||
# CONFIG_INTEGRITY is not set
|
||||
# CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set
|
||||
CONFIG_DEFAULT_SECURITY_SELINUX=y
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
From dd7dd21144699b26e3ee7c7618a2bf84dc256af5 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Hutchings <benh@debian.org>
|
||||
Date: Mon, 15 May 2023 01:05:54 +0200
|
||||
Subject: [PATCH 8/9] linux-perf: Update build rules and dependencies for
|
||||
change to demangling
|
||||
|
||||
- Upstream commit dd317df07207 "perf build: Make binutil libraries opt
|
||||
in" disabled use of both libbfd's bfd_demangle() and libiberty's
|
||||
cplus_demangle() by default, enabled only if the BUILD_NONDISTRO
|
||||
variable is set.
|
||||
- Upstream commit 3b4e4efe88f6 "perf symbol: Add abi::__cxa_demangle
|
||||
C++ demangling support" then added support for abi::__cxa_demangle()
|
||||
as the preferred option.
|
||||
|
||||
It doesn't make sense that cplus_demangle() is disabled by default,
|
||||
because libiberty is still under LGPLv2.1. However, by accepting the
|
||||
new default we can remove the build-dependency on libiberty-dev.
|
||||
__abi::cxa_demangle() is implemented (for GCC) in libstdc++, which is
|
||||
included in build-essential. Therefore:
|
||||
|
||||
- Stop setting NO_LIBBFD=1 as this is no longer necessary.
|
||||
- Check for __cxa_demangle in the perf executable.
|
||||
- Drop libiberty-dev from Build-Depends.
|
||||
|
||||
[lz: porting from https://salsa.debian.org/kernel-team/linux/-/commit/
|
||||
d08991fc66f353a2622a2e25595f71ccc58ead2d to fix build error:
|
||||
grep cplus_demangle /<<PKGBUILDDIR>>/debian/build/build-tools/tools/perf/perf
|
||||
make[3]: *** [/<<PKGBUILDDIR>>/debian/rules.d/tools/perf/Makefile:58: all] Error 1
|
||||
]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/rules.d/tools/perf/Makefile | 9 ++-------
|
||||
debian/templates/tools-unversioned.control.in | 1 -
|
||||
2 files changed, 2 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/debian/rules.d/tools/perf/Makefile b/debian/rules.d/tools/perf/Makefile
|
||||
index 8b14e2a..1e7bca4 100644
|
||||
--- a/debian/rules.d/tools/perf/Makefile
|
||||
+++ b/debian/rules.d/tools/perf/Makefile
|
||||
@@ -10,11 +10,6 @@ MAKE_PERF += feature-jvmti=0
|
||||
|
||||
MAKE_PERF += perfexecdir=lib/perf-core plugindir=/usr/lib/traceevent/plugins tipdir=share/doc/linux-perf perf_include_dir=include/perf perf_examples_dir=share/doc/linux-perf/examples
|
||||
|
||||
-# perf can link against libbfd if available, but the result is
|
||||
-# undistributable as they are licenced under GPL v2 and v3+
|
||||
-# respectively. Override detection of libbfd.
|
||||
-MAKE_PERF += NO_LIBBFD=1
|
||||
-
|
||||
# perf can link against libdebuginfod if available, but the result is
|
||||
# undistributable for the same reason. Override detection of
|
||||
# libdebuginfod.
|
||||
@@ -58,8 +53,8 @@ endif
|
||||
# Check that perf didn't get linked against incompatibly-licensed libraries
|
||||
type ldd
|
||||
! ldd $(CURDIR)/perf | grep -E '\blib(bfd|crypto|debuginfod)'
|
||||
-# Check that it includes cplus_demangle from libiberty
|
||||
- grep cplus_demangle $(CURDIR)/perf
|
||||
+# Check that it links against abi::__cxa_demangle from libstdc++
|
||||
+ grep __cxa_demangle $(CURDIR)/perf
|
||||
|
||||
install:
|
||||
+$(MAKE_PERF) -C $(top_srcdir)/tools/perf -f Makefile.perf install install-python_ext
|
||||
diff --git a/debian/templates/tools-unversioned.control.in b/debian/templates/tools-unversioned.control.in
|
||||
index 65e7238..c71b7e9 100644
|
||||
--- a/debian/templates/tools-unversioned.control.in
|
||||
+++ b/debian/templates/tools-unversioned.control.in
|
||||
@@ -66,7 +66,6 @@ Build-Depends:
|
||||
libaudit-dev,
|
||||
libbabeltrace-dev,
|
||||
libdw-dev,
|
||||
- libiberty-dev,
|
||||
libnewt-dev,
|
||||
libnuma-dev,
|
||||
# version in bullseye is too old
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
From 3a8c58b8529493f9695236061099f9d7237726f4 Mon Sep 17 00:00:00 2001
|
||||
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
|
||||
Date: Thu, 21 Apr 2022 17:52:22 +0000
|
||||
Subject: [PATCH] Drop Android patches
|
||||
|
||||
Since the uprevision to the 5.10.99 kernel has been fixed with commit
|
||||
cf100293c190 ("debian: Update kernel head commit"), the kernel build has
|
||||
been failing due to the failed application of Android-related Debian
|
||||
patches, presumably because the patched files between kernel versions
|
||||
5.10.74 and 5.10.99 are different. Here are the error messages:
|
||||
|
||||
===
|
||||
dpkg-source: info: applying debian/export-symbols-needed-by-android-drivers.patch
|
||||
patching file fs/file.c
|
||||
Hunk #1 succeeded at 780 (offset 104 lines).
|
||||
patching file kernel/fork.c
|
||||
Hunk #1 succeeded at 1127 (offset -4 lines).
|
||||
patching file kernel/sched/core.c
|
||||
Hunk #1 succeeded at 5043 (offset 376 lines).
|
||||
patching file kernel/task_work.c
|
||||
Hunk #1 succeeded at 68 (offset 16 lines).
|
||||
patching file mm/memory.c
|
||||
Hunk #1 succeeded at 1554 (offset 187 lines).
|
||||
patching file mm/shmem.c
|
||||
Hunk #1 succeeded at 4288 (offset 130 lines).
|
||||
patching file security/security.c
|
||||
Hunk #1 FAILED at 725.
|
||||
1 out of 1 hunk FAILED
|
||||
dpkg-source: info: the patch has fuzz which is not allowed, or is malformed
|
||||
===
|
||||
|
||||
This commit removes the patches related to Android, as StarlingX does
|
||||
not (at least currently) make use of Android-related drivers in the
|
||||
kernel.
|
||||
|
||||
Also note that CONFIG_ANDROID is disabled in StarlingX's configuration
|
||||
file snippet, which ought to disable the CONFIG_ASHMEM and
|
||||
CONFIG_ANDROID_BINDER_IPC options.
|
||||
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/patches/series | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/debian/patches/series b/debian/patches/series
|
||||
index dad02b9..826c190 100644
|
||||
--- a/debian/patches/series
|
||||
+++ b/debian/patches/series
|
||||
@@ -10,8 +10,6 @@ debian/arch-sh4-fix-uimage-build.patch
|
||||
debian/tools-perf-version.patch
|
||||
debian/tools-perf-install.patch
|
||||
debian/wireless-add-debian-wireless-regdb-certificates.patch
|
||||
-debian/export-symbols-needed-by-android-drivers.patch
|
||||
-debian/android-enable-building-ashmem-and-binder-as-modules.patch
|
||||
debian/documentation-drop-sphinx-version-check.patch
|
||||
debian/perf-traceevent-support-asciidoctor-for-documentatio.patch
|
||||
debian/kbuild-look-for-module.lds-under-arch-directory-too.patch
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From d359553cf57e17cc34729eae4c1327f5fb5d2426 Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Mon, 25 Dec 2023 10:51:17 +0800
|
||||
Subject: [PATCH 9/9] rtla: fix error for undefined reference
|
||||
|
||||
Add '-pthread' to EXTRA_LDFLAGS to fix this error when building rtla:
|
||||
/usr/bin/ld: /tmp/rtla.2STv8j.ltrans0.ltrans.o:
|
||||
undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
|
||||
/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0:
|
||||
error adding symbols: DSO missing from command line
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/rules.d/tools/tracing/rtla/Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/debian/rules.d/tools/tracing/rtla/Makefile b/debian/rules.d/tools/tracing/rtla/Makefile
|
||||
index 9dd1cfd..6cba478 100644
|
||||
--- a/debian/rules.d/tools/tracing/rtla/Makefile
|
||||
+++ b/debian/rules.d/tools/tracing/rtla/Makefile
|
||||
@@ -5,7 +5,7 @@ all:
|
||||
echo '$(UPSTREAMVERSION)' >VERSION
|
||||
rsync -a $(top_srcdir)/tools/tracing/rtla/ .
|
||||
rsync -a $(top_srcdir)/Documentation/tools/rtla/ Documentation/
|
||||
- $(MAKE) EXTRA_CFLAGS='$(CFLAGS) $(CPPFLAGS)' EXTRA_LDFLAGS='$(LDFLAGS)' PKG_CONFIG='$(PKG_CONFIG)'
|
||||
+ $(MAKE) EXTRA_CFLAGS='$(CFLAGS) $(CPPFLAGS)' EXTRA_LDFLAGS='$(LDFLAGS) -pthread' PKG_CONFIG='$(PKG_CONFIG)'
|
||||
|
||||
install:
|
||||
$(MAKE) install
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From 90f87bfc5bbc26bc3bfeb5d89b89d5bd794b716b Mon Sep 17 00:00:00 2001
|
||||
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
|
||||
Date: Thu, 21 Apr 2022 02:06:11 +0000
|
||||
Subject: [PATCH] Debian: Disable CONFIG_BNXT*
|
||||
|
||||
This commit disables the CONFIG_BNXT* options, because StarlingX ships
|
||||
with an out-of-tree version of the bnxt_en kernel module. The
|
||||
aforementioned configuration options enable the in-tree version of the
|
||||
same module.
|
||||
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
debian/config/amd64/none/config | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
|
||||
index a5dadc7b6b55..5088a2aec7a2 100644
|
||||
--- a/debian/config/amd64/none/config
|
||||
+++ b/debian/config/amd64/none/config
|
||||
@@ -2451,11 +2451,11 @@ CONFIG_TIGON3_HWMON=y
|
||||
CONFIG_BNX2X=m
|
||||
CONFIG_BNX2X_SRIOV=y
|
||||
# CONFIG_SYSTEMPORT is not set
|
||||
-CONFIG_BNXT=m
|
||||
-CONFIG_BNXT_SRIOV=y
|
||||
-CONFIG_BNXT_FLOWER_OFFLOAD=y
|
||||
-CONFIG_BNXT_DCB=y
|
||||
-CONFIG_BNXT_HWMON=y
|
||||
+# CONFIG_BNXT is not set
|
||||
+# CONFIG_BNXT_SRIOV is not set
|
||||
+# CONFIG_BNXT_FLOWER_OFFLOAD is not set
|
||||
+# CONFIG_BNXT_DCB is not set
|
||||
+# CONFIG_BNXT_HWMON is not set
|
||||
CONFIG_NET_VENDOR_BROCADE=y
|
||||
# CONFIG_BNA is not set
|
||||
CONFIG_NET_VENDOR_CADENCE=y
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
From 8d2b2a2cd694d77872b28cbbd03d2647ef43c394 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Voiculeasa <dan.voiculeasa@windriver.com>
|
||||
Date: Tue, 10 May 2022 12:21:32 +0300
|
||||
Subject: [PATCH 11/11] Debian: Hardcode net.naming-scheme in CONFIG_CMDLINE
|
||||
|
||||
Between CentOS systemd v219 and Debian systemd v247 some changes for
|
||||
determining NIC naming were introduced. Something called Predictable
|
||||
Names is used[1]. When booting Debian we will see interfaces using a
|
||||
different predictable name, which requires to be handled at an upper
|
||||
level.
|
||||
|
||||
Try to keep differences to a minimum, to minimize upgrades impact.
|
||||
Hardcode kernel parameter here to keep the effort contained.
|
||||
|
||||
On Debian we use systemd 247.
|
||||
Use scheme v238, the oldest known scheme[2] to systemd 247.
|
||||
|
||||
There will be future work to handle the new naming scheme.
|
||||
|
||||
[1]: https://wiki.debian.org/NetworkInterfaceNames
|
||||
[2]: https://github.com/systemd/systemd/blob/v247/src/
|
||||
shared/netif-naming-scheme.c#L8
|
||||
|
||||
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
|
||||
---
|
||||
debian/config/amd64/none/config | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
|
||||
index 5d75b7523..f8babc0c3 100644
|
||||
--- a/debian/config/amd64/none/config
|
||||
+++ b/debian/config/amd64/none/config
|
||||
@@ -466,7 +466,8 @@ CONFIG_HOTPLUG_CPU=y
|
||||
CONFIG_LEGACY_VSYSCALL_EMULATE=y
|
||||
# CONFIG_LEGACY_VSYSCALL_XONLY is not set
|
||||
# CONFIG_LEGACY_VSYSCALL_NONE is not set
|
||||
-# CONFIG_CMDLINE_BOOL is not set
|
||||
+CONFIG_CMDLINE_BOOL=y
|
||||
+CONFIG_CMDLINE="net.naming-scheme=vSTX7_0"
|
||||
CONFIG_MODIFY_LDT_SYSCALL=y
|
||||
CONFIG_HAVE_LIVEPATCH=y
|
||||
CONFIG_LIVEPATCH=y
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
From 1cec1b6f24812ef23b9d6f7b489c1b67e5e99a7b Mon Sep 17 00:00:00 2001
|
||||
From: Jiping Ma <jiping.ma2@windriver.com>
|
||||
Date: Tue, 26 Apr 2022 20:23:50 -0700
|
||||
Subject: [PATCH] Debian: update 5.10 Kernel to 5.10.112
|
||||
|
||||
Update debian/changelog.
|
||||
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
---
|
||||
debian/changelog | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index 5a2b6bb..9c7a271 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,3 +1,13 @@
|
||||
+linux (5.10.112-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=6cf7dea05bd756513cf58c5ced8c6bf1d1f23c15
|
||||
+ * To fix the follow 2 CVE issues.
|
||||
+ CVE-2022-0435: kernel: remote stack overflow via kernel panic on systems using TIPC may lead to DoS
|
||||
+ CVE-2022-0847: kernel: improper initialization of the "flags" member of the new pipe_buffer
|
||||
+
|
||||
+ -- Jiping Ma <jiping.ma2@windriver.com> Wed Apr 27 11:13:32 CST 2022
|
||||
+
|
||||
linux (5.10.99-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
From 073427e88d24bf573734e22d0e23d65f95b0a479 Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Wed, 6 Jul 2022 14:51:17 +0800
|
||||
Subject: [PATCH] kernel-std: clean patches from debian release
|
||||
|
||||
Clean the patches listed in debian/patches/series:
|
||||
(1) For section [# Changes to support package build system]
|
||||
|
||||
Below 2 patches are kept for adding kernel version information
|
||||
in debian style:
|
||||
debian/version.patch
|
||||
debian/uname-version-timestamp.patch
|
||||
|
||||
Below 4 patches are kept for working together with debian kernel
|
||||
building style, or else building errors occur:
|
||||
debian/kernelvariables.patch
|
||||
debian/tools-perf-version.patch
|
||||
debian/perf-traceevent-support-asciidoctor-for-documentatio.patch
|
||||
debian/kbuild-look-for-module.lds-under-arch-directory-too.patch
|
||||
|
||||
(2) For section [# Lockdown missing pieces].
|
||||
Only 2 patches are kept for the necessary function of kernel modules
|
||||
signing.
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/patches/series | 10 ----------
|
||||
1 file changed, 10 deletions(-)
|
||||
|
||||
diff --git a/debian/patches/series b/debian/patches/series
|
||||
index 6b96a60..d91da94 100644
|
||||
--- a/debian/patches/series
|
||||
+++ b/debian/patches/series
|
||||
@@ -2,15 +2,7 @@
|
||||
debian/version.patch
|
||||
debian/uname-version-timestamp.patch
|
||||
debian/kernelvariables.patch
|
||||
-debian/ia64-hardcode-arch-script-output.patch
|
||||
-debian/mips-disable-werror.patch
|
||||
-debian/mips-boston-disable-its.patch
|
||||
-debian/mips-ieee754-relaxed.patch
|
||||
-debian/arch-sh4-fix-uimage-build.patch
|
||||
debian/tools-perf-version.patch
|
||||
-debian/tools-perf-install.patch
|
||||
-debian/wireless-add-debian-wireless-regdb-certificates.patch
|
||||
-debian/documentation-drop-sphinx-version-check.patch
|
||||
debian/perf-traceevent-support-asciidoctor-for-documentatio.patch
|
||||
debian/kbuild-look-for-module.lds-under-arch-directory-too.patch
|
||||
|
||||
@@ -19,5 +11,3 @@ debian/kbuild-look-for-module.lds-under-arch-directory-too.patch
|
||||
# Lockdown missing pieces
|
||||
features/all/lockdown/efi-add-an-efi_secure_boot-flag-to-indicate-secure-b.patch
|
||||
features/all/lockdown/efi-lock-down-the-kernel-if-booted-in-secure-boot-mo.patch
|
||||
-features/all/lockdown/mtd-disable-slram-and-phram-when-locked-down.patch
|
||||
-features/all/lockdown/arm64-add-kernel-config-option-to-lock-down-when.patch
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
From cdc58885c1a1a0d0f83ff8fc8f86bd708eba9229 Mon Sep 17 00:00:00 2001
|
||||
From: Haiqing Bai <haiqing.bai@windriver.com>
|
||||
Date: Tue, 5 Jul 2022 09:09:53 +0000
|
||||
Subject: [PATCH] Debian: Added apparmor security module
|
||||
|
||||
Added apparmor and its required kernel configs, but not
|
||||
enable apparmor by default.
|
||||
|
||||
Signed-off-by: Haiqing Bai <haiqing.bai@windriver.com>
|
||||
---
|
||||
debian/config/amd64/none/config | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
|
||||
index f8babc0c3..802eab7c5 100644
|
||||
--- a/debian/config/amd64/none/config
|
||||
+++ b/debian/config/amd64/none/config
|
||||
@@ -5662,7 +5662,7 @@ CONFIG_SECURITY_NETWORK=y
|
||||
CONFIG_PAGE_TABLE_ISOLATION=y
|
||||
# CONFIG_SECURITY_INFINIBAND is not set
|
||||
CONFIG_SECURITY_NETWORK_XFRM=y
|
||||
-# CONFIG_SECURITY_PATH is not set
|
||||
+CONFIG_SECURITY_PATH=y
|
||||
CONFIG_INTEL_TXT=y
|
||||
CONFIG_LSM_MMAP_MIN_ADDR=65536
|
||||
CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
|
||||
@@ -5680,13 +5680,14 @@ CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS=9
|
||||
CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE=256
|
||||
# CONFIG_SECURITY_SMACK is not set
|
||||
# CONFIG_SECURITY_TOMOYO is not set
|
||||
-# CONFIG_SECURITY_APPARMOR is not set
|
||||
+CONFIG_SECURITY_APPARMOR=y
|
||||
# CONFIG_SECURITY_LOADPIN is not set
|
||||
CONFIG_SECURITY_YAMA=y
|
||||
# CONFIG_SECURITY_SAFESETID is not set
|
||||
CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y
|
||||
CONFIG_SECURITY_LOCKDOWN_LSM=y
|
||||
-# CONFIG_INTEGRITY is not set
|
||||
+CONFIG_INTEGRITY=y
|
||||
+CONFIG_INTEGRITY_AUDIT=y
|
||||
# CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set
|
||||
CONFIG_DEFAULT_SECURITY_SELINUX=y
|
||||
# CONFIG_DEFAULT_SECURITY_DAC is not set
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
From 3fc9ffca7fe8d12ff3ad74b879bc30f8b205cbc0 Mon Sep 17 00:00:00 2001
|
||||
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
|
||||
Date: Fri, 29 Jul 2022 19:10:11 +0000
|
||||
Subject: [PATCH 16/17] debian/rules.real: Parallelize xz compression
|
||||
|
||||
This commit enables the multi-threading feature of the xz program so
|
||||
that it uses all of the available CPUs for the compression of the kernel
|
||||
source archive.
|
||||
|
||||
In a 12-core virtual machine, this reduces the compression time from
|
||||
about 9 minutes to a little less than 1 minute.
|
||||
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
debian/rules.real | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/debian/rules.real b/debian/rules.real
|
||||
index ffd75e75fc6e..2e6f636f70af 100644
|
||||
--- a/debian/rules.real
|
||||
+++ b/debian/rules.real
|
||||
@@ -134,7 +134,8 @@ $(BUILD_DIR)/$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz: $(STAMPS_DIR)/
|
||||
-print0 | \
|
||||
sort -z | \
|
||||
tar --owner=root --group=root --numeric-owner \
|
||||
- --no-recursion --null -T - -caf '$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz'
|
||||
+ --no-recursion --null -T - -I 'xz --threads=0' \
|
||||
+ -cf '$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz'
|
||||
rm -rf '$(DIR)'
|
||||
|
||||
$(BUILD_DIR)/linux-patch-$(UPSTREAMVERSION)-%.patch.xz: $(STAMPS_DIR)/source_none $(STAMPS_DIR)/source_%
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
From f3a0d2acb7208842d975ce6b449855fafaa41904 Mon Sep 17 00:00:00 2001
|
||||
From: Jiping Ma <jiping.ma2@windriver.com>
|
||||
Date: Wed, 14 Sep 2022 19:24:50 -0700
|
||||
Subject: [PATCH] Debian: Enable WireGuard config
|
||||
|
||||
This commit enables WIREGUARD and its related kernel configuration
|
||||
options to support WireGuard secure network tunnel.
|
||||
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
---
|
||||
debian/config/amd64/none/config | 21 +++++++++++++--------
|
||||
1 file changed, 13 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
|
||||
index f8babc0..63b41ba 100644
|
||||
--- a/debian/config/amd64/none/config
|
||||
+++ b/debian/config/amd64/none/config
|
||||
@@ -2376,7 +2376,8 @@ CONFIG_MII=m
|
||||
CONFIG_NET_CORE=y
|
||||
CONFIG_BONDING=m
|
||||
CONFIG_DUMMY=m
|
||||
-# CONFIG_WIREGUARD is not set
|
||||
+CONFIG_WIREGUARD=m
|
||||
+# CONFIG_WIREGUARD_DEBUG is not set
|
||||
# CONFIG_EQUALIZER is not set
|
||||
# CONFIG_NET_FC is not set
|
||||
CONFIG_IFB=m
|
||||
@@ -5759,7 +5760,7 @@ CONFIG_CRYPTO_ECDH=m
|
||||
# CONFIG_CRYPTO_ECRDSA is not set
|
||||
# CONFIG_CRYPTO_SM2 is not set
|
||||
# CONFIG_CRYPTO_CURVE25519 is not set
|
||||
-# CONFIG_CRYPTO_CURVE25519_X86 is not set
|
||||
+CONFIG_CRYPTO_CURVE25519_X86=m
|
||||
|
||||
#
|
||||
# Authenticated Encryption with Associated Data
|
||||
@@ -5808,7 +5809,7 @@ CONFIG_CRYPTO_CRC32_PCLMUL=m
|
||||
# CONFIG_CRYPTO_XXHASH is not set
|
||||
# CONFIG_CRYPTO_BLAKE2B is not set
|
||||
# CONFIG_CRYPTO_BLAKE2S is not set
|
||||
-# CONFIG_CRYPTO_BLAKE2S_X86 is not set
|
||||
+CONFIG_CRYPTO_BLAKE2S_X86=m
|
||||
CONFIG_CRYPTO_CRCT10DIF=y
|
||||
CONFIG_CRYPTO_CRCT10DIF_PCLMUL=m
|
||||
CONFIG_CRYPTO_GHASH=y
|
||||
@@ -5904,17 +5905,21 @@ CONFIG_CRYPTO_HASH_INFO=y
|
||||
#
|
||||
CONFIG_CRYPTO_LIB_AES=y
|
||||
CONFIG_CRYPTO_LIB_ARC4=m
|
||||
-# CONFIG_CRYPTO_LIB_BLAKE2S is not set
|
||||
+CONFIG_CRYPTO_ARCH_HAVE_LIB_BLAKE2S=m
|
||||
+CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=m
|
||||
+CONFIG_CRYPTO_LIB_BLAKE2S=m
|
||||
CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
|
||||
CONFIG_CRYPTO_LIB_CHACHA_GENERIC=m
|
||||
-# CONFIG_CRYPTO_LIB_CHACHA is not set
|
||||
-# CONFIG_CRYPTO_LIB_CURVE25519 is not set
|
||||
+CONFIG_CRYPTO_LIB_CHACHA=m
|
||||
+CONFIG_CRYPTO_ARCH_HAVE_LIB_CURVE25519=m
|
||||
+CONFIG_CRYPTO_LIB_CURVE25519_GENERIC=m
|
||||
+CONFIG_CRYPTO_LIB_CURVE25519=m
|
||||
CONFIG_CRYPTO_LIB_DES=m
|
||||
CONFIG_CRYPTO_LIB_POLY1305_RSIZE=11
|
||||
CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305=m
|
||||
CONFIG_CRYPTO_LIB_POLY1305_GENERIC=m
|
||||
-# CONFIG_CRYPTO_LIB_POLY1305 is not set
|
||||
-# CONFIG_CRYPTO_LIB_CHACHA20POLY1305 is not set
|
||||
+CONFIG_CRYPTO_LIB_POLY1305=m
|
||||
+CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m
|
||||
CONFIG_CRYPTO_LIB_SHA256=y
|
||||
CONFIG_CRYPTO_HW=y
|
||||
# CONFIG_CRYPTO_DEV_PADLOCK is not set
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
From 11af91a648f54802eeacae8d8f3d406cb23bdc8b Mon Sep 17 00:00:00 2001
|
||||
From: Jiping Ma <jiping.ma2@windriver.com>
|
||||
Date: Mon, 26 Sep 2022 20:58:57 -0700
|
||||
Subject: [PATCH] Place module signing keys in a separate package
|
||||
|
||||
Currently we package our module signing keys as part of
|
||||
the 'linux-kbuild' package. This means that anyone obtaining
|
||||
our 'linux-kbuild' package, which we do publish, can produce
|
||||
signed modules. This violates the intent of secure boot.
|
||||
|
||||
Re-package our module signing keys into a separate package
|
||||
known as 'linux-keys'.
|
||||
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
---
|
||||
debian/rules.real | 21 +++++++++++++++++++--
|
||||
debian/templates/control.tools-versioned.in | 8 ++++++++
|
||||
2 files changed, 27 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/debian/rules.real b/debian/rules.real
|
||||
index 01b568c..03dcb0a 100644
|
||||
--- a/debian/rules.real
|
||||
+++ b/debian/rules.real
|
||||
@@ -72,6 +72,7 @@ binary-arch-arch: \
|
||||
$(call if_package, $(SOURCE_BASENAME)-config-$(VERSION), install-config_$(ARCH)) \
|
||||
$(call if_package, linux-libc-dev, install-libc-dev_$(ARCH)) \
|
||||
$(call if_package, linux-kbuild-$(VERSION), install-kbuild) \
|
||||
+ $(call if_package, linux-keys-$(VERSION), install-keys) \
|
||||
$(call if_package, linux-perf-$(VERSION), install-perf) \
|
||||
$(if $(filter-out x-$(VERSION),x$(SOURCE_SUFFIX)), \
|
||||
$(call if_package, linux-perf$(SOURCE_SUFFIX), install-perf-meta)) \
|
||||
@@ -664,8 +665,6 @@ install-kbuild: build-kbuild
|
||||
$(call make-tools,scripts) install DESTDIR=$(DIR) prefix=$(PREFIX_DIR)
|
||||
$(call make-tools,tools/objtool) install DESTDIR=$(DIR) prefix=$(PREFIX_DIR)
|
||||
dh_link $(PREFIX_DIR) /usr/src/$(PACKAGE_NAME)
|
||||
- dh_install $(BUILD_DIR)/*/certs/signing_key.pem /usr/src/kernels/$(ABINAME)-$(ARCH)/
|
||||
- dh_install $(BUILD_DIR)/*/certs/signing_key.x509 /usr/src/kernels/$(ABINAME)-$(ARCH)/
|
||||
dh_installchangelogs
|
||||
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
|
||||
dh_installdocs
|
||||
@@ -679,6 +678,24 @@ endif
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
+install-keys: PACKAGE_NAME = linux-keys-$(VERSION)
|
||||
+install-keys: DH_OPTIONS = -p$(PACKAGE_NAME)
|
||||
+install-keys: DIR = $(CURDIR)/debian/$(PACKAGE_NAME)
|
||||
+install-keys:
|
||||
+ dh_testdir
|
||||
+ dh_testroot
|
||||
+ dh_prep
|
||||
+ dh_installdirs
|
||||
+ dh_install $(BUILD_DIR)/*/certs/signing_key.pem /usr/src/kernels/$(ABINAME)-$(ARCH)/
|
||||
+ dh_install $(BUILD_DIR)/*/certs/signing_key.x509 /usr/src/kernels/$(ABINAME)-$(ARCH)/
|
||||
+ dh_installchangelogs
|
||||
+ dh_compress
|
||||
+ dh_fixperms
|
||||
+ dh_installdeb
|
||||
+ dh_gencontrol
|
||||
+ dh_md5sums
|
||||
+ dh_builddeb
|
||||
+
|
||||
build-cpupower: $(STAMPS_DIR)/build-tools-headers
|
||||
$(call make-tools,tools/power/cpupower)
|
||||
ifneq ($(filter i386 amd64 x32,$(DEB_HOST_ARCH)),)
|
||||
diff --git a/debian/templates/control.tools-versioned.in b/debian/templates/control.tools-versioned.in
|
||||
index 9219039..c9d48ed 100644
|
||||
--- a/debian/templates/control.tools-versioned.in
|
||||
+++ b/debian/templates/control.tools-versioned.in
|
||||
@@ -6,6 +6,14 @@ Multi-Arch: foreign
|
||||
Description: Kbuild infrastructure for Linux @version@
|
||||
This package provides the kbuild infrastructure for the headers packages for Linux kernel version @version@.
|
||||
|
||||
+Package: linux-keys-@version@
|
||||
+Build-Profiles: <!stage1 !pkg.linux.notools>
|
||||
+Architecture: linux-any
|
||||
+Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
+Multi-Arch: foreign
|
||||
+Description: Key infrastructure for Linux @version@
|
||||
+ This package provides the kernel module signing keys for Linux kernel version @version@.
|
||||
+
|
||||
Package: linux-perf-@version@
|
||||
Build-Profiles: <!stage1 !pkg.linux.notools !nopython>
|
||||
Section: devel
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From db3731134e510d13159229ecd113b5355bf77fd9 Mon Sep 17 00:00:00 2001
|
||||
From: Jiping Ma <jiping.ma2@windriver.com>
|
||||
Date: Fri, 4 Nov 2022 00:07:59 -0700
|
||||
Subject: [PATCH] Upgrade 5.10 kernel to 5.10.152
|
||||
|
||||
Update debian/changelog.
|
||||
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index 9c7a271..7e89a53 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,3 +1,10 @@
|
||||
+linux (5.10.152-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=7d078581c0f754d6cb38b2bf1952925e0460ef84
|
||||
+
|
||||
+ -- Jiping Ma <jiping.ma2@windriver.com> Fri Nov 04 16:43:32 CST 2022
|
||||
+
|
||||
linux (5.10.112-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From 499fdf920b9b5523b7e0d47bbefb736ba54f7ece Mon Sep 17 00:00:00 2001
|
||||
From: Li Zhou <li.zhou@windriver.com>
|
||||
Date: Fri, 13 Jan 2023 19:20:29 +0800
|
||||
Subject: [PATCH] config: don't unset CONFIG_EFIVAR_FS
|
||||
|
||||
The efivarfs at /sys/firmware/efi/efivars is a new way to access
|
||||
the efi-variables and it is better supported by efi tools than the
|
||||
old way /sys/firmware/efi/vars. So here compile the efivarfs as a
|
||||
module by default.
|
||||
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
debian/config/amd64/none/config | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
|
||||
index 06e93c2..22fae05 100644
|
||||
--- a/debian/config/amd64/none/config
|
||||
+++ b/debian/config/amd64/none/config
|
||||
@@ -5471,7 +5471,6 @@ CONFIG_HUGETLB_PAGE=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
CONFIG_ARCH_HAS_GIGANTIC_PAGE=y
|
||||
CONFIG_CONFIGFS_FS=y
|
||||
-# CONFIG_EFIVAR_FS is not set
|
||||
# end of Pseudo filesystems
|
||||
|
||||
CONFIG_MISC_FILESYSTEMS=y
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From 9cfd878bd84176100aeea797ef6d8e3a32f24d0e Mon Sep 17 00:00:00 2001
|
||||
From: Jiping Ma <jiping.ma2@windriver.com>
|
||||
Date: Tue, 10 Jan 2023 17:32:23 -0800
|
||||
Subject: [PATCH] Upgrade 5.10 kernel to 5.10.162
|
||||
|
||||
Update debian/changelog.
|
||||
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index 7e89a53..aa02f67 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,3 +1,10 @@
|
||||
+linux (5.10.162-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=353f388471e281c0f387436b035bfdcd2f468505
|
||||
+
|
||||
+ -- Jiping Ma <jiping.ma2@windriver.com> Wed Jan 11 9:33:12 CST 2023
|
||||
+
|
||||
linux (5.10.152-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
--
|
||||
2.39.0
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
From 2d244521e85e4af04a2e1a49e5ca9eed7d5af38b Mon Sep 17 00:00:00 2001
|
||||
From: Jiping Ma <jiping.ma2@windriver.com>
|
||||
Date: Sat, 22 Apr 2023 20:28:27 -0700
|
||||
Subject: [PATCH] Fix badly formatted trailer line
|
||||
|
||||
Correct the date format in the changelog file.
|
||||
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
---
|
||||
debian/changelog | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index aa02f67..3d6de0b 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -3,14 +3,14 @@ linux (5.10.162-1) unstable; urgency=medium
|
||||
* New upstream update:
|
||||
https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=353f388471e281c0f387436b035bfdcd2f468505
|
||||
|
||||
- -- Jiping Ma <jiping.ma2@windriver.com> Wed Jan 11 9:33:12 CST 2023
|
||||
+ -- Jiping Ma <jiping.ma2@windriver.com> Wed, 11 Jan 2023 9:33:12 +0800
|
||||
|
||||
linux (5.10.152-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=7d078581c0f754d6cb38b2bf1952925e0460ef84
|
||||
|
||||
- -- Jiping Ma <jiping.ma2@windriver.com> Fri Nov 04 16:43:32 CST 2022
|
||||
+ -- Jiping Ma <jiping.ma2@windriver.com> Fri, 04 Nov 2022 16:43:32 +0800
|
||||
|
||||
linux (5.10.112-1) unstable; urgency=medium
|
||||
|
||||
@@ -20,19 +20,19 @@ linux (5.10.112-1) unstable; urgency=medium
|
||||
CVE-2022-0435: kernel: remote stack overflow via kernel panic on systems using TIPC may lead to DoS
|
||||
CVE-2022-0847: kernel: improper initialization of the "flags" member of the new pipe_buffer
|
||||
|
||||
- -- Jiping Ma <jiping.ma2@windriver.com> Wed Apr 27 11:13:32 CST 2022
|
||||
+ -- Jiping Ma <jiping.ma2@windriver.com> Wed, 27 Apr 2022 11:13:32 +0800
|
||||
|
||||
linux (5.10.99-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
https://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=84f6a75f64961e59d61bf3d70ab17e8bb430386b
|
||||
|
||||
- -- Li Zhou <li.zhou@windriver.com> Wed Apr 13 11:37:52 CST 2022
|
||||
+ -- Li Zhou <li.zhou@windriver.com> Wed, 13 Apr 2022 11:37:52 +0800
|
||||
|
||||
linux (5.10.74-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
https://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=9e84a42af61ff9c6feb89ab8d61ee5f25fb35c72
|
||||
|
||||
- -- Li Zhou <li.zhou@windriver.com> Tue Nov 9 11:23:35 CST 2021
|
||||
+ -- Li Zhou <li.zhou@windriver.com> Tue, 9 Nov 2021 11:23:35 +0800
|
||||
|
||||
--
|
||||
2.39.0
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From 156dc2e2691fef27a611d317ebc703b0a83b964b Mon Sep 17 00:00:00 2001
|
||||
From: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
Date: Thu, 27 Apr 2023 19:28:18 +0000
|
||||
Subject: [PATCH] Upgrade 5.10 kernel to 5.10.177
|
||||
|
||||
Update debian/changelog.
|
||||
|
||||
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index 3d6de0b..a3fe77e 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,3 +1,10 @@
|
||||
+linux (5.10.177-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=cf160f367e3ceb54cde11392a80413b152ca4e15
|
||||
+
|
||||
+ -- Peng Zhang <Peng.Zhang2@windriver.com> Wed, 26 Apr 2023 19:22:54 +0000
|
||||
+
|
||||
linux (5.10.162-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
From 2674da4d76d74e51ef5e17dbdafd88228efed704 Mon Sep 17 00:00:00 2001
|
||||
From: Haiqing Bai <haiqing.bai@windriver.com>
|
||||
Date: Tue, 9 May 2023 06:38:27 +0000
|
||||
Subject: [PATCH] Disable unprivileged eBPF by default
|
||||
|
||||
Unprivileged eBPF is disabled by default on most distro
|
||||
Disabling unprivileged eBPF effectively mitigates the
|
||||
known attack vectors for exploiting intra-mode branch
|
||||
injections attacks.
|
||||
This commit also removed the below kernel warning:
|
||||
"Spectre V2: WARNING: Unprivileged eBPF is enabled with eIBRS on,
|
||||
data leaks possible via Spectre v2 BHB attacks!"
|
||||
|
||||
Signed-off-by: Haiqing Bai <haiqing.bai@windriver.com>
|
||||
---
|
||||
debian/config/amd64/none/config | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
|
||||
index 75625e089..70ff1b80c 100644
|
||||
--- a/debian/config/amd64/none/config
|
||||
+++ b/debian/config/amd64/none/config
|
||||
@@ -6409,5 +6409,5 @@ CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
|
||||
#
|
||||
# Upgrade to 5.10.99
|
||||
#
|
||||
-# CONFIG_BPF_UNPRIV_DEFAULT_OFF is not set
|
||||
+CONFIG_BPF_UNPRIV_DEFAULT_OFF=y
|
||||
# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From 3a0c32c4f6e0ce759fd2a3f4212713263325f568 Mon Sep 17 00:00:00 2001
|
||||
From: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
Date: Wed, 31 May 2023 09:01:46 +0000
|
||||
Subject: [PATCH] Upgrade 5.10 kernel to 5.10.180
|
||||
|
||||
Update debian/changelog.
|
||||
|
||||
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index ba1d52e21..b612904e7 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,3 +1,10 @@
|
||||
+linux (5.10.180-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=c6515d2a698792220bed8fd39ccbcfec64d1130f
|
||||
+
|
||||
+ -- Peng Zhang <Peng.Zhang2@windriver.com> Wed, 31 May 2023 08:56:14 +0000
|
||||
+
|
||||
linux (5.10.177-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
From 9ccd5855a67d4ce932ed60fb6801ca28a80d9d24 Mon Sep 17 00:00:00 2001
|
||||
From: Alyson Deives Pereira <alyson.deivespereira@windriver.com>
|
||||
Date: Wed, 24 May 2023 20:40:24 -0300
|
||||
Subject: [PATCH] config: Enable Intel RAPL and uncore frequency control
|
||||
|
||||
Signed-off-by: Alyson Deives Pereira <alyson.deivespereira@windriver.com>
|
||||
---
|
||||
debian/config/amd64/none/config | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
|
||||
index 70ff1b80c3..bdee9655b8 100644
|
||||
--- a/debian/config/amd64/none/config
|
||||
+++ b/debian/config/amd64/none/config
|
||||
@@ -4700,7 +4700,7 @@ CONFIG_INTEL_RST=m
|
||||
# end of Intel Speed Select Technology interface support
|
||||
|
||||
CONFIG_INTEL_TURBO_MAX_3=y
|
||||
-# CONFIG_INTEL_UNCORE_FREQ_CONTROL is not set
|
||||
+CONFIG_INTEL_UNCORE_FREQ_CONTROL=m
|
||||
CONFIG_INTEL_PMC_CORE=m
|
||||
# CONFIG_INTEL_PUNIT_IPC is not set
|
||||
# CONFIG_INTEL_SCU_PCI is not set
|
||||
@@ -5301,7 +5301,9 @@ CONFIG_PWM_LPSS_PLATFORM=m
|
||||
# CONFIG_PHY_INTEL_LGM_EMMC is not set
|
||||
# end of PHY Subsystem
|
||||
|
||||
-# CONFIG_POWERCAP is not set
|
||||
+CONFIG_POWERCAP=y
|
||||
+CONFIG_INTEL_RAPL=y
|
||||
+CONFIG_INTEL_RAPL_CORE=y
|
||||
# CONFIG_MCB is not set
|
||||
|
||||
#
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From dc55edc65f258d19a8cc18fd340d3d09bc2fbd93 Mon Sep 17 00:00:00 2001
|
||||
From: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
Date: Mon, 17 Jul 2023 10:51:43 +0000
|
||||
Subject: [PATCH] Upgrade 5.10 kernel to 5.10.185
|
||||
|
||||
Update debian/changelog.
|
||||
|
||||
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index b00c04943..c9a526a23 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,3 +1,10 @@
|
||||
+linux (5.10.185-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=dafc025b033585311d1693255c80b60b690b0e54
|
||||
+
|
||||
+ -- Peng Zhang <Peng.Zhang2@windriver.com> Mon, 17 Jul 2023 10:47:53 +0000
|
||||
+
|
||||
linux (5.10.180-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From 282d6563fe01567af0719617127e29ef47b5cd7b Mon Sep 17 00:00:00 2001
|
||||
From: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
Date: Mon, 28 Aug 2023 06:12:16 +0000
|
||||
Subject: [PATCH] Upgrade 5.10 kernel to 5.10.189
|
||||
|
||||
Update debian/changelog.
|
||||
|
||||
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index c9a526a23..f31fd4012 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,3 +1,10 @@
|
||||
+linux (5.10.189-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=fc99f5e7ce23e4814c7b41f24c5d0296754be89e
|
||||
+
|
||||
+ -- Peng Zhang <Peng.Zhang2@windriver.com> Mon, 28 Aug 2023 05:56:12 +0000
|
||||
+
|
||||
linux (5.10.185-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From ff01be16202455ea86d1dc168f2aad85fd3ea2a6 Mon Sep 17 00:00:00 2001
|
||||
From: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
Date: Mon, 2 Oct 2023 08:13:47 +0000
|
||||
Subject: [PATCH] Upgrade 5.10 kernel to 5.10.192
|
||||
|
||||
Update debian/changelog.
|
||||
|
||||
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index e6e650d39..a1f54166b 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,3 +1,10 @@
|
||||
+linux (5.10.192-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=11b247211e00c610587b27a762e4814f56723958
|
||||
+
|
||||
+ -- Peng Zhang <Peng.Zhang2@windriver.com> Mon, 02 Oct 2023 08:09:11 +0000
|
||||
+
|
||||
linux (5.10.189-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From 5f955e3ab170e1b16bc7055bb30790b9948a319a Mon Sep 17 00:00:00 2001
|
||||
From: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
Date: Wed, 18 Oct 2023 08:40:44 +0000
|
||||
Subject: [PATCH] Upgrade 5.10 kernel to 5.10.198
|
||||
|
||||
Update debian/changelog.
|
||||
|
||||
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index a1f54166b..ab68b1363 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,3 +1,10 @@
|
||||
+linux (5.10.198-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=5601201f60a8abb5bbb54da99da2a38bfb7a46dd
|
||||
+
|
||||
+ -- Peng Zhang <Peng.Zhang2@windriver.com> Wed, 18 Oct 2023 08:33:53 +0000
|
||||
+
|
||||
linux (5.10.192-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From d62a1ac6ec0f1ac87fb53e9153a7c89a16c9f137 Mon Sep 17 00:00:00 2001
|
||||
From: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
Date: Tue, 16 Jan 2024 07:00:47 +0000
|
||||
Subject: [PATCH] Upgrade 5.10 kernel to 5.10.205
|
||||
|
||||
Update debian/changelog.
|
||||
|
||||
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/debian/changelog b/debian/changelog
|
||||
index ab68b1363..85928079d 100644
|
||||
--- a/debian/changelog
|
||||
+++ b/debian/changelog
|
||||
@@ -1,3 +1,10 @@
|
||||
+linux (5.10.205-1) unstable; urgency=medium
|
||||
+
|
||||
+ * New upstream update:
|
||||
+ https://git.yoctoproject.org/linux-yocto/log/?h=v5.10%2Fstandard%2Fbase&qt=range&q=0e1dfe1d29013deb4cfa75170fa414e75a14c530
|
||||
+
|
||||
+ -- Peng Zhang <Peng.Zhang2@windriver.com> Tue, 16 Jan 2024 06:57:16 +0000
|
||||
+
|
||||
linux (5.10.198-1) unstable; urgency=medium
|
||||
|
||||
* New upstream update:
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -1,33 +1,9 @@
|
||||
0001-kernel-std-Remove-the-old-changelog-file.patch
|
||||
0002-kernel-std-Add-a-new-changelog-file-for-linux-yocto-.patch
|
||||
0003-kernel-std-Add-a-kernel-config-file-for-stx-debian.patch
|
||||
0004-kernel-std-Adapt-the-debian-folder-for-new-source.patch
|
||||
0005-kernel-modules-sign-kernel-modules.patch
|
||||
0006-Debian-align-config-file-with-stx-centos.patch
|
||||
0007-Debian-update-5.10-Kernel-to-5.10.99.patch
|
||||
0008-config-set-configs-needed-for-secure-boot.patch
|
||||
0009-Drop-Android-patches.patch
|
||||
0010-Debian-Disable-CONFIG_BNXT.patch
|
||||
0011-Debian-Hardcode-net.naming-scheme-in-CONFIG_CMDLINE.patch
|
||||
0012-Debian-update-5.10-Kernel-to-5.10.112.patch
|
||||
0013-kernel-std-fix-proc-version-content.patch
|
||||
0014-kernel-std-clean-patches-from-debian-release.patch
|
||||
0015-Debian-Added-apparmor-security-module.patch
|
||||
0016-debian-rules.real-Parallelize-xz-compression.patch
|
||||
0017-Debian-Enable-WireGuard-config.patch
|
||||
0018-Place-module-signing-keys-in-a-separate-packa.patch
|
||||
0019-Upgrade-5.10-kernel-to-5.10.152.patch
|
||||
0020-kernel-std-unset-LOCK_DOWN_IN_EFI_SECURE_BOOT.patch
|
||||
0021-config-don-t-unset-CONFIG_EFIVAR_FS.patch
|
||||
0022-Upgrade-5.10-kernel-to-5.10.162.patch
|
||||
0023-Fix-badly-formatted-trailer-line.patch
|
||||
0024-Upgrade-5.10-kernel-to-5.10.177.patch
|
||||
0025-Disable-unprivileged-eBPF-by-default.patch
|
||||
0026-Upgrade-5.10-kernel-to-5.10.180.patch
|
||||
0027-config-Enable-Intel-RAPL-and-uncore-frequency-contro.patch
|
||||
0028-Upgrade-5.10-kernel-to-5.10.185.patch
|
||||
0029-Upgrade-5.10-kernel-to-5.10.189.patch
|
||||
0030-kernel-std-Add-pkgs-without-abiname-for-image-header.patch
|
||||
0031-Upgrade-5.10-kernel-to-5.10.192.patch
|
||||
0032-Upgrade-5.10-kernel-to-5.10.198.patch
|
||||
0033-Upgrade-5.10-kernel-to-5.10.205.patch
|
||||
0001-kernel-std-Adapt-the-debian-folder-for-new-source.patch
|
||||
0002-kernel-std-fix-proc-version-content.patch
|
||||
0003-kernel-std-unset-LOCK_DOWN_IN_EFI_SECURE_BOOT.patch
|
||||
0004-Place-module-signing-keys-in-a-separate-package.patch
|
||||
0005-kernel-std-Add-pkgs-without-abiname-for-image-header.patch
|
||||
0006-Update-patches-for-kernel-6.6.7.patch
|
||||
0007-linux-kbuild-Stop-building-bin2c-in-6.3.patch
|
||||
0008-linux-perf-Update-build-rules-and-dependencies-for-c.patch
|
||||
0009-rtla-fix-error-for-undefined-reference.patch
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
# be put at the same path where this script is located.
|
||||
# Tools needed: tar
|
||||
|
||||
KERNEL_HEAD_COMMIT=0e1dfe1d29013deb4cfa75170fa414e75a14c530
|
||||
DEBIAN_FILE=linux_5.10.28-1.debian.tar.xz
|
||||
KERNEL_HEAD_COMMIT=a7d960cfa075eb93eef1e04e96940a35d1a49d79
|
||||
DEBIAN_FILE=linux_6.1.27-1~bpo11%2B1.debian.tar.xz
|
||||
|
||||
tar xvf linux-yocto-${KERNEL_HEAD_COMMIT}.tar.gz
|
||||
if [ $? -ne 0 ]
|
||||
@@ -23,3 +23,13 @@ then
|
||||
echo "tar failed: debian folder for kernel!"
|
||||
exit 1
|
||||
fi
|
||||
cd debian
|
||||
cp "${MY_REPO_ROOT_DIR}"/cgcs-root/stx/kernel/kernel-std/\
|
||||
/debian/source/changelog ./
|
||||
cp "${MY_REPO_ROOT_DIR}"/cgcs-root/stx/kernel/kernel-std/\
|
||||
/debian/source/config ./config/amd64/none
|
||||
cd -
|
||||
|
||||
# The abiname is changed from "0.deb11.9" to "1", so replace
|
||||
# "6.1.0-0.deb11.9" with "6.6.0-1" in init control file.
|
||||
sed -i "s/6\.1\.0-0\.deb11\.9/6.6.0-1/g" ./debian/control
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
---
|
||||
debver: 5.10.205
|
||||
debver: 6.6.7
|
||||
debname: linux
|
||||
dl_hook: dl_hook
|
||||
dl_files:
|
||||
linux-yocto-0e1dfe1d29013deb4cfa75170fa414e75a14c530.tar.gz:
|
||||
linux-yocto-a7d960cfa075eb93eef1e04e96940a35d1a49d79.tar.gz:
|
||||
topdir: null
|
||||
url:
|
||||
"https://git.yoctoproject.org/linux-yocto/snapshot/\
|
||||
linux-yocto-0e1dfe1d29013deb4cfa75170fa414e75a14c530.tar.gz"
|
||||
sha256sum: 94d1336d5a1419f8c706132a08b43a4dae59e48bb90832b1c91df4e0a50f34ec
|
||||
linux_5.10.28-1.debian.tar.xz:
|
||||
linux-yocto-a7d960cfa075eb93eef1e04e96940a35d1a49d79.tar.gz"
|
||||
sha256sum: 908daef43545d465355db5971aee06ed7f5b1dcd7c8ba0389419e092072024db
|
||||
linux_6.1.27-1~bpo11%2B1.debian.tar.xz:
|
||||
topdir: null
|
||||
url:
|
||||
"http://snapshot.debian.org/archive/debian/20210410T143728Z/pool/main/\
|
||||
l/linux/linux_5.10.28-1.debian.tar.xz"
|
||||
sha256sum: 1367a40724054a540c4d9c92f0ea6f73e9e50b2a99e46b59a987be15bdc4c4b7
|
||||
"https://snapshot.debian.org/archive/debian/20230718T030758Z/pool/main/\
|
||||
l/linux/linux_6.1.27-1~bpo11%2B1.debian.tar.xz"
|
||||
sha256sum: 903cc8184efe94fa8f67bc85e12264b3e4c299153091ab88130c15c272d09478
|
||||
revision:
|
||||
dist: $STX_DIST
|
||||
GITREVCOUNT:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 13872c403cc86c8032c937b166fa5867b98d730b Mon Sep 17 00:00:00 2001
|
||||
From cd317ab94d47726632145fb6296872648d6c13a2 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Friesen <chris.friesen@windriver.com>
|
||||
Date: Thu, 17 Jun 2021 07:44:04 +0000
|
||||
Subject: [PATCH] Notification of death of arbitrary processes
|
||||
@@ -24,8 +24,10 @@ Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
[zp: Adapted the patch for context changes.]
|
||||
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
[lz: Adapted the patch for context changes.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
include/linux/init_task.h | 9 ++
|
||||
include/linux/init_task.h | 8 ++
|
||||
include/linux/sched.h | 6 +
|
||||
include/uapi/linux/prctl.h | 16 +++
|
||||
init/Kconfig | 15 +++
|
||||
@@ -37,19 +39,18 @@ Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
kernel/fork.c | 4 +
|
||||
kernel/signal.c | 11 ++
|
||||
kernel/sys.c | 8 ++
|
||||
12 files changed, 351 insertions(+)
|
||||
12 files changed, 350 insertions(+)
|
||||
create mode 100644 kernel/death_notify.c
|
||||
create mode 100644 kernel/death_notify.h
|
||||
|
||||
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
|
||||
index b2412b4d4..7a0828daf 100644
|
||||
index 40fc5813c..f1c786382 100644
|
||||
--- a/include/linux/init_task.h
|
||||
+++ b/include/linux/init_task.h
|
||||
@@ -25,6 +25,15 @@
|
||||
extern struct files_struct init_files;
|
||||
extern struct fs_struct init_fs;
|
||||
@@ -27,6 +27,14 @@ extern struct fs_struct init_fs;
|
||||
extern struct nsproxy init_nsproxy;
|
||||
+
|
||||
extern struct cred init_cred;
|
||||
|
||||
+#ifdef CONFIG_SIGEXIT
|
||||
+#define INIT_SIGEXIT(tsk) \
|
||||
+ .notify = LIST_HEAD_INIT(tsk.notify), \
|
||||
@@ -58,14 +59,14 @@ index b2412b4d4..7a0828daf 100644
|
||||
+#define INIT_SIGEXIT(tsk)
|
||||
+#endif
|
||||
+
|
||||
extern struct group_info init_groups;
|
||||
extern struct cred init_cred;
|
||||
|
||||
#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
|
||||
#define INIT_PREV_CPUTIME(x) .prev_cputime = { \
|
||||
.lock = __RAW_SPIN_LOCK_UNLOCKED(x.prev_cputime.lock), \
|
||||
diff --git a/include/linux/sched.h b/include/linux/sched.h
|
||||
index 5da4b3c89..51bbe9252 100644
|
||||
index ffb6eb55c..cf7f5602a 100644
|
||||
--- a/include/linux/sched.h
|
||||
+++ b/include/linux/sched.h
|
||||
@@ -1126,6 +1126,12 @@ struct task_struct {
|
||||
@@ -1256,6 +1256,12 @@ struct task_struct {
|
||||
short il_prev;
|
||||
short pref_node_fork;
|
||||
#endif
|
||||
@@ -79,7 +80,7 @@ index 5da4b3c89..51bbe9252 100644
|
||||
int numa_scan_seq;
|
||||
unsigned int numa_scan_period;
|
||||
diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
|
||||
index 7f0827705..dbd5a8b6e 100644
|
||||
index a5e06dcbb..0478d9868 100644
|
||||
--- a/include/uapi/linux/prctl.h
|
||||
+++ b/include/uapi/linux/prctl.h
|
||||
@@ -63,6 +63,22 @@
|
||||
@@ -106,12 +107,12 @@ index 7f0827705..dbd5a8b6e 100644
|
||||
#define PR_GET_SECCOMP 21
|
||||
#define PR_SET_SECCOMP 22
|
||||
diff --git a/init/Kconfig b/init/Kconfig
|
||||
index eba883d6d..e307211e0 100644
|
||||
index 2028ed4d5..818da5aa3 100644
|
||||
--- a/init/Kconfig
|
||||
+++ b/init/Kconfig
|
||||
@@ -1866,6 +1866,21 @@ config VM_EVENT_COUNTERS
|
||||
on EXPERT systems. /proc/vmstat will only show page counts
|
||||
if VM event counters are disabled.
|
||||
@@ -1882,6 +1882,21 @@ config DEBUG_PERF_USE_VMALLOC
|
||||
|
||||
endmenu
|
||||
|
||||
+config SIGEXIT
|
||||
+ bool "Notification of death of arbitrary processes"
|
||||
@@ -128,14 +129,14 @@ index eba883d6d..e307211e0 100644
|
||||
+ This is exposed to userspace via the prctl()
|
||||
+ call with the PR_DO_NOTIFY_TASK_STATE option
|
||||
+
|
||||
config SLUB_DEBUG
|
||||
default y
|
||||
bool "Enable SLUB debugging support" if EXPERT
|
||||
config SYSTEM_DATA_VERIFICATION
|
||||
def_bool n
|
||||
select SYSTEM_TRUSTED_KEYRING
|
||||
diff --git a/init/init_task.c b/init/init_task.c
|
||||
index 5fa18ed59..e1a245782 100644
|
||||
index ff6c4b9bf..ce2240882 100644
|
||||
--- a/init/init_task.c
|
||||
+++ b/init/init_task.c
|
||||
@@ -128,6 +128,7 @@ struct task_struct init_task
|
||||
@@ -129,6 +129,7 @@ struct task_struct init_task
|
||||
.alloc_lock = __SPIN_LOCK_UNLOCKED(init_task.alloc_lock),
|
||||
.journal_info = NULL,
|
||||
INIT_CPU_TIMERS(init_task)
|
||||
@@ -144,17 +145,17 @@ index 5fa18ed59..e1a245782 100644
|
||||
.timer_slack_ns = 50000, /* 50 usec default slack */
|
||||
.thread_pid = &init_struct_pid,
|
||||
diff --git a/kernel/Makefile b/kernel/Makefile
|
||||
index 82e9c8436..4ad61d5c9 100644
|
||||
index ebc692242..269dbd3ca 100644
|
||||
--- a/kernel/Makefile
|
||||
+++ b/kernel/Makefile
|
||||
@@ -108,6 +108,7 @@ obj-$(CONFIG_BPF) += bpf/
|
||||
obj-$(CONFIG_KCSAN) += kcsan/
|
||||
@@ -111,6 +111,7 @@ obj-$(CONFIG_KCSAN) += kcsan/
|
||||
obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o
|
||||
obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call.o
|
||||
obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o
|
||||
obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o
|
||||
+obj-$(CONFIG_SIGEXIT) += death_notify.o
|
||||
obj-$(CONFIG_CFI_CLANG) += cfi.o
|
||||
|
||||
obj-$(CONFIG_PERF_EVENTS) += events/
|
||||
|
||||
diff --git a/kernel/death_notify.c b/kernel/death_notify.c
|
||||
new file mode 100644
|
||||
index 000000000..5819d35a2
|
||||
@@ -442,10 +443,10 @@ index 000000000..14a0995b7
|
||||
+#endif
|
||||
+
|
||||
diff --git a/kernel/exit.c b/kernel/exit.c
|
||||
index bacdaf980..5f5420111 100644
|
||||
index bccfa4218..df6601e54 100644
|
||||
--- a/kernel/exit.c
|
||||
+++ b/kernel/exit.c
|
||||
@@ -69,6 +69,9 @@
|
||||
@@ -72,6 +72,9 @@
|
||||
#include <linux/uaccess.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <asm/mmu_context.h>
|
||||
@@ -455,7 +456,7 @@ index bacdaf980..5f5420111 100644
|
||||
|
||||
/*
|
||||
* The default value should be high enough to not crash a system that randomly
|
||||
@@ -241,6 +244,9 @@ void release_task(struct task_struct *p)
|
||||
@@ -250,6 +253,9 @@ void release_task(struct task_struct *p)
|
||||
cgroup_release(p);
|
||||
|
||||
write_lock_irq(&tasklist_lock);
|
||||
@@ -466,12 +467,12 @@ index bacdaf980..5f5420111 100644
|
||||
thread_pid = get_pid(p->thread_pid);
|
||||
__exit_signal(p);
|
||||
diff --git a/kernel/fork.c b/kernel/fork.c
|
||||
index 82aeb023d..1f3bf058c 100644
|
||||
index 94f3f5947..91f1345b3 100644
|
||||
--- a/kernel/fork.c
|
||||
+++ b/kernel/fork.c
|
||||
@@ -2080,6 +2080,10 @@ static __latent_entropy struct task_struct *copy_process(
|
||||
p->sequential_io = 0;
|
||||
p->sequential_io_avg = 0;
|
||||
@@ -2224,6 +2224,10 @@ static __latent_entropy struct task_struct *copy_process(
|
||||
RCU_INIT_POINTER(p->bpf_storage, NULL);
|
||||
p->bpf_ctx = NULL;
|
||||
#endif
|
||||
+#ifdef CONFIG_SIGEXIT
|
||||
+ INIT_LIST_HEAD(&p->notify);
|
||||
@@ -481,20 +482,20 @@ index 82aeb023d..1f3bf058c 100644
|
||||
/* Perform scheduler related setup. Assign this task to a CPU. */
|
||||
retval = sched_fork(clone_flags, p);
|
||||
diff --git a/kernel/signal.c b/kernel/signal.c
|
||||
index e487c4660..7e9e72ba6 100644
|
||||
index 5d45f5da2..dc8e3ff49 100644
|
||||
--- a/kernel/signal.c
|
||||
+++ b/kernel/signal.c
|
||||
@@ -55,6 +55,9 @@
|
||||
#include <asm/unistd.h>
|
||||
#include <asm/siginfo.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/syscall.h> /* for syscall_get_* */
|
||||
+#ifdef CONFIG_SIGEXIT
|
||||
+#include "death_notify.h"
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* SLAB caches for signal bits.
|
||||
@@ -1999,6 +2002,10 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
|
||||
@@ -2121,6 +2124,10 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
|
||||
__wake_up_parent(tsk, tsk->parent);
|
||||
spin_unlock_irqrestore(&psig->siglock, flags);
|
||||
|
||||
@@ -505,7 +506,7 @@ index e487c4660..7e9e72ba6 100644
|
||||
return autoreap;
|
||||
}
|
||||
|
||||
@@ -2071,6 +2078,10 @@ static void do_notify_parent_cldstop(struct task_struct *tsk,
|
||||
@@ -2193,6 +2200,10 @@ static void do_notify_parent_cldstop(struct task_struct *tsk,
|
||||
*/
|
||||
__wake_up_parent(tsk, parent);
|
||||
spin_unlock_irqrestore(&sighand->siglock, flags);
|
||||
@@ -515,12 +516,12 @@ index e487c4660..7e9e72ba6 100644
|
||||
+#endif
|
||||
}
|
||||
|
||||
static inline bool may_ptrace_stop(void)
|
||||
/*
|
||||
diff --git a/kernel/sys.c b/kernel/sys.c
|
||||
index 9f59cc8ab..c41abaaf4 100644
|
||||
index c85e1abf7..cd1cb1d33 100644
|
||||
--- a/kernel/sys.c
|
||||
+++ b/kernel/sys.c
|
||||
@@ -73,6 +73,9 @@
|
||||
@@ -75,6 +75,9 @@
|
||||
#include <asm/unistd.h>
|
||||
|
||||
#include "uid16.h"
|
||||
@@ -530,7 +531,7 @@ index 9f59cc8ab..c41abaaf4 100644
|
||||
|
||||
#ifndef SET_UNALIGN_CTL
|
||||
# define SET_UNALIGN_CTL(a, b) (-EINVAL)
|
||||
@@ -2418,6 +2421,11 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
|
||||
@@ -2504,6 +2507,11 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
|
||||
else
|
||||
error = PR_MCE_KILL_DEFAULT;
|
||||
break;
|
||||
@@ -543,5 +544,5 @@ index 9f59cc8ab..c41abaaf4 100644
|
||||
error = prctl_set_mm(arg2, arg3, arg4, arg5);
|
||||
break;
|
||||
--
|
||||
2.30.2
|
||||
2.17.1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 8d508571597d4e2d8c64621015c375ce0a346748 Mon Sep 17 00:00:00 2001
|
||||
From 4a7d20a9744955b56e63c9d36ba0938d3087ca83 Mon Sep 17 00:00:00 2001
|
||||
From: Dahir Osman <dahir.osman@windriver.com>
|
||||
Date: Wed, 13 Jan 2016 10:01:11 -0500
|
||||
Subject: [PATCH 02/10] PCI: Add ACS quirk for Intel Fortville NICs
|
||||
Subject: [PATCH] PCI: Add ACS quirk for Intel Fortville NICs
|
||||
|
||||
Use quirks to determine isolation for now until a later kernel can
|
||||
properly read the Fortville ACS capabilities.
|
||||
@@ -14,10 +14,10 @@ Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
|
||||
index b570f297e3ec..910026923549 100644
|
||||
index 472fa2c8e..344735c52 100644
|
||||
--- a/drivers/pci/quirks.c
|
||||
+++ b/drivers/pci/quirks.c
|
||||
@@ -4740,6 +4740,10 @@ static const struct pci_dev_acs_enabled {
|
||||
@@ -4941,6 +4941,10 @@ static const struct pci_dev_acs_enabled {
|
||||
{ PCI_VENDOR_ID_INTEL, 0x15b7, pci_quirk_mf_endpoint_acs },
|
||||
{ PCI_VENDOR_ID_INTEL, 0x15b8, pci_quirk_mf_endpoint_acs },
|
||||
{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_rciep_acs },
|
||||
@@ -29,5 +29,5 @@ index b570f297e3ec..910026923549 100644
|
||||
{ PCI_VENDOR_ID_QCOM, 0x0400, pci_quirk_qcom_rp_acs },
|
||||
{ PCI_VENDOR_ID_QCOM, 0x0401, pci_quirk_qcom_rp_acs },
|
||||
--
|
||||
2.29.2
|
||||
2.17.1
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From d4c6a64967be6e34fec40ddff5714efe001be7c3 Mon Sep 17 00:00:00 2001
|
||||
From 004708f2e02a4ae97672d2c618effa7cdbbe38a6 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Friesen <chris.friesen@windriver.com>
|
||||
Date: Tue, 24 Nov 2015 16:27:28 -0500
|
||||
Subject: [PATCH] affine compute kernel threads
|
||||
@@ -30,20 +30,22 @@ Signed-off-by: Zhang Zhiguo <zhangzhg@neusoft.com>
|
||||
Signed-off-by: Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
[jm: Adapted the patch for context changes.]
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
[lz: Adapted the patch for upgrading kernel from 5.10 to 6.6]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
.../admin-guide/kernel-parameters.txt | 10 ++++++++
|
||||
include/linux/cpumask.h | 3 +++
|
||||
init/main.c | 2 ++
|
||||
kernel/cpu.c | 23 +++++++++++++++++++
|
||||
kernel/kthread.c | 5 ++--
|
||||
kernel/kthread.c | 4 ++--
|
||||
kernel/umh.c | 3 +++
|
||||
6 files changed, 43 insertions(+), 3 deletions(-)
|
||||
6 files changed, 43 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
|
||||
index 19e9e220eaa1..0260789adc94 100644
|
||||
index 59f7b400d..acc7025c1 100644
|
||||
--- a/Documentation/admin-guide/kernel-parameters.txt
|
||||
+++ b/Documentation/admin-guide/kernel-parameters.txt
|
||||
@@ -2223,6 +2223,16 @@
|
||||
@@ -2473,6 +2473,16 @@
|
||||
See also Documentation/trace/kprobetrace.rst "Kernel
|
||||
Boot Parameter" section.
|
||||
|
||||
@@ -61,10 +63,10 @@ index 19e9e220eaa1..0260789adc94 100644
|
||||
and kernel address spaces.
|
||||
Default: enabled on cores which need mitigation.
|
||||
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
|
||||
index f0d895d6ac39..45f338cfdd6f 100644
|
||||
index c2aa0aa26..2919c2aef 100644
|
||||
--- a/include/linux/cpumask.h
|
||||
+++ b/include/linux/cpumask.h
|
||||
@@ -55,6 +55,7 @@ extern unsigned int nr_cpu_ids;
|
||||
@@ -61,6 +61,7 @@ static inline void set_nr_cpu_ids(unsigned int nr)
|
||||
* cpu_present_mask - has bit 'cpu' set iff cpu is populated
|
||||
* cpu_online_mask - has bit 'cpu' set iff cpu available to scheduler
|
||||
* cpu_active_mask - has bit 'cpu' set iff cpu available to migration
|
||||
@@ -72,24 +74,25 @@ index f0d895d6ac39..45f338cfdd6f 100644
|
||||
*
|
||||
* If !CONFIG_HOTPLUG_CPU, present == possible, and active == online.
|
||||
*
|
||||
@@ -91,10 +92,12 @@ extern struct cpumask __cpu_possible_mask;
|
||||
@@ -93,11 +94,13 @@ extern struct cpumask __cpu_possible_mask;
|
||||
extern struct cpumask __cpu_online_mask;
|
||||
extern struct cpumask __cpu_present_mask;
|
||||
extern struct cpumask __cpu_active_mask;
|
||||
+extern struct cpumask __cpu_kthread_mask;
|
||||
extern struct cpumask __cpu_dying_mask;
|
||||
#define cpu_possible_mask ((const struct cpumask *)&__cpu_possible_mask)
|
||||
#define cpu_online_mask ((const struct cpumask *)&__cpu_online_mask)
|
||||
#define cpu_present_mask ((const struct cpumask *)&__cpu_present_mask)
|
||||
#define cpu_active_mask ((const struct cpumask *)&__cpu_active_mask)
|
||||
+#define cpu_kthread_mask ((const struct cpumask *)&__cpu_kthread_mask)
|
||||
#define cpu_dying_mask ((const struct cpumask *)&__cpu_dying_mask)
|
||||
|
||||
extern atomic_t __num_online_cpus;
|
||||
|
||||
diff --git a/init/main.c b/init/main.c
|
||||
index db693781a12f..4e7777bdab6e 100644
|
||||
index bd4ce7345..c40b2c441 100644
|
||||
--- a/init/main.c
|
||||
+++ b/init/main.c
|
||||
@@ -1536,6 +1536,8 @@ static noinline void __init kernel_init_freeable(void)
|
||||
@@ -1633,6 +1633,8 @@ static noinline void __init kernel_init_freeable(void)
|
||||
|
||||
do_basic_setup();
|
||||
|
||||
@@ -97,12 +100,12 @@ index db693781a12f..4e7777bdab6e 100644
|
||||
+
|
||||
kunit_run_all_tests();
|
||||
|
||||
console_on_rootfs();
|
||||
wait_for_initramfs();
|
||||
diff --git a/kernel/cpu.c b/kernel/cpu.c
|
||||
index 67c22941b5f2..67b1a67bd8f0 100644
|
||||
index 98a7a7b14..d051b4097 100644
|
||||
--- a/kernel/cpu.c
|
||||
+++ b/kernel/cpu.c
|
||||
@@ -2498,6 +2498,29 @@ EXPORT_SYMBOL(__cpu_active_mask);
|
||||
@@ -2651,6 +2651,29 @@ EXPORT_SYMBOL(__cpu_dying_mask);
|
||||
atomic_t __num_online_cpus __read_mostly;
|
||||
EXPORT_SYMBOL(__num_online_cpus);
|
||||
|
||||
@@ -133,33 +136,32 @@ index 67c22941b5f2..67b1a67bd8f0 100644
|
||||
{
|
||||
cpumask_copy(&__cpu_present_mask, src);
|
||||
diff --git a/kernel/kthread.c b/kernel/kthread.c
|
||||
index 508fe5278285..a7bb87b00cea 100644
|
||||
index f97fd01a2..2bd5d136e 100644
|
||||
--- a/kernel/kthread.c
|
||||
+++ b/kernel/kthread.c
|
||||
@@ -405,8 +405,7 @@ struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data),
|
||||
* The kernel thread should not inherit these properties.
|
||||
*/
|
||||
sched_setscheduler_nocheck(task, SCHED_NORMAL, ¶m);
|
||||
- set_cpus_allowed_ptr(task,
|
||||
- housekeeping_cpumask(HK_FLAG_KTHREAD));
|
||||
+ set_cpus_allowed_ptr(task, cpu_kthread_mask);
|
||||
}
|
||||
kfree(create);
|
||||
return task;
|
||||
@@ -655,7 +654,7 @@ int kthreadd(void *unused)
|
||||
@@ -355,7 +355,7 @@ static int kthread(void *_create)
|
||||
* back to default in case they have been changed.
|
||||
*/
|
||||
sched_setscheduler_nocheck(current, SCHED_NORMAL, ¶m);
|
||||
- set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_TYPE_KTHREAD));
|
||||
+ set_cpus_allowed_ptr(current, cpu_kthread_mask);
|
||||
|
||||
/* OK, tell user we're spawned, wait for stop or wakeup */
|
||||
__set_current_state(TASK_UNINTERRUPTIBLE);
|
||||
@@ -722,7 +722,7 @@ int kthreadd(void *unused)
|
||||
/* Setup a clean context for our children to inherit. */
|
||||
set_task_comm(tsk, "kthreadd");
|
||||
ignore_signals(tsk);
|
||||
- set_cpus_allowed_ptr(tsk, housekeeping_cpumask(HK_FLAG_KTHREAD));
|
||||
- set_cpus_allowed_ptr(tsk, housekeeping_cpumask(HK_TYPE_KTHREAD));
|
||||
+ set_cpus_allowed_ptr(tsk, cpu_kthread_mask);
|
||||
set_mems_allowed(node_states[N_MEMORY]);
|
||||
|
||||
current->flags |= PF_NOFREEZE;
|
||||
diff --git a/kernel/umh.c b/kernel/umh.c
|
||||
index 3f646613a9d3..e5027cee43f7 100644
|
||||
index fbf872c62..43e3f4567 100644
|
||||
--- a/kernel/umh.c
|
||||
+++ b/kernel/umh.c
|
||||
@@ -80,6 +80,9 @@ static int call_usermodehelper_exec_async(void *data)
|
||||
@@ -82,6 +82,9 @@ static int call_usermodehelper_exec_async(void *data)
|
||||
*/
|
||||
current->fs->umask = 0022;
|
||||
|
||||
@@ -170,5 +172,5 @@ index 3f646613a9d3..e5027cee43f7 100644
|
||||
* Our parent (unbound workqueue) runs with elevated scheduling
|
||||
* priority. Avoid propagating that into the userspace child.
|
||||
--
|
||||
2.29.2
|
||||
2.17.1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 286f3a8af7f620dac84f20de5f7ad6542f447ace Mon Sep 17 00:00:00 2001
|
||||
From 1e17457b99a2f60ae6762a33e2f7f3c1e2f3bcbb 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
|
||||
Subject: [PATCH] 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
|
||||
@@ -22,16 +22,18 @@ 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>
|
||||
[lz: Adapted the patch for context changes.]
|
||||
Signed-off-by: Li Zhou <li.zhou@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
|
||||
index d309ba84e..6965ad7d0 100644
|
||||
--- a/kernel/irq/manage.c
|
||||
+++ b/kernel/irq/manage.c
|
||||
@@ -515,6 +515,13 @@ int irq_setup_affinity(struct irq_desc *desc)
|
||||
@@ -627,6 +627,13 @@ int irq_setup_affinity(struct irq_desc *desc)
|
||||
if (cpumask_intersects(&mask, nodemask))
|
||||
cpumask_and(&mask, &mask, nodemask);
|
||||
}
|
||||
@@ -46,10 +48,10 @@ index 79dc02b956dc..420b5ce0bf89 100644
|
||||
raw_spin_unlock(&mask_lock);
|
||||
return ret;
|
||||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
|
||||
index 1e2ca744dadb..b854874d0518 100644
|
||||
index 3a2cbe9e1..82246a3e5 100644
|
||||
--- a/kernel/workqueue.c
|
||||
+++ b/kernel/workqueue.c
|
||||
@@ -5956,6 +5956,8 @@ void __init workqueue_init_early(void)
|
||||
@@ -6591,6 +6591,8 @@ void __init workqueue_init_early(void)
|
||||
|
||||
BUG_ON(!(attrs = alloc_workqueue_attrs()));
|
||||
attrs->nice = std_nice[i];
|
||||
@@ -58,15 +60,15 @@ index 1e2ca744dadb..b854874d0518 100644
|
||||
unbound_std_wq_attrs[i] = attrs;
|
||||
|
||||
/*
|
||||
@@ -5966,6 +5968,8 @@ void __init workqueue_init_early(void)
|
||||
@@ -6600,6 +6602,8 @@ void __init workqueue_init_early(void)
|
||||
BUG_ON(!(attrs = alloc_workqueue_attrs()));
|
||||
attrs->nice = std_nice[i];
|
||||
attrs->no_numa = true;
|
||||
attrs->ordered = 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
|
||||
2.17.1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 82e56b6b7c05eebc589b37e96ed3b0a44d6cdef7 Mon Sep 17 00:00:00 2001
|
||||
From 130eb445c6abc1dec0cb9d24b2b7e4cba13f7037 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Friesen <chris.friesen@windriver.com>
|
||||
Date: Thu, 12 May 2016 18:00:00 -0400
|
||||
Subject: [PATCH 05/10] Make kernel start eth devices at offset
|
||||
Subject: [PATCH] Make kernel start eth devices at offset
|
||||
|
||||
In order to avoid naming collisions, we want to make the kernel
|
||||
start naming its "ethX" devices at eth1000 instead of eth0. This
|
||||
@@ -10,16 +10,18 @@ will let us rename to a range starting at eth0.
|
||||
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>
|
||||
[lz: Adapted the patch for context changes.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
net/core/dev.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/net/core/dev.c b/net/core/dev.c
|
||||
index 62ff7121b22d..e63fe7662c73 100644
|
||||
index 9bf90b2a7..9526361a0 100644
|
||||
--- a/net/core/dev.c
|
||||
+++ b/net/core/dev.c
|
||||
@@ -1218,6 +1218,12 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
|
||||
set_bit(i, inuse);
|
||||
@@ -1119,6 +1119,12 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
|
||||
__set_bit(i, inuse);
|
||||
}
|
||||
|
||||
+ /* STX extension, want kernel to start at eth1000 */
|
||||
@@ -29,8 +31,8 @@ index 62ff7121b22d..e63fe7662c73 100644
|
||||
+ }
|
||||
+
|
||||
i = find_first_zero_bit(inuse, max_netdevices);
|
||||
free_page((unsigned long) inuse);
|
||||
bitmap_free(inuse);
|
||||
}
|
||||
--
|
||||
2.29.2
|
||||
2.17.1
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From c35ee3034b61e72bf9fef888a3c4702049a77bcc Mon Sep 17 00:00:00 2001
|
||||
From f311c0cd55b9fb90696350d8545cf46381ccc805 Mon Sep 17 00:00:00 2001
|
||||
From: Matt Peters <matt.peters@windriver.com>
|
||||
Date: Mon, 30 May 2016 10:51:02 -0400
|
||||
Subject: [PATCH] intel-iommu: allow ignoring Ethernet device RMRR with IOMMU
|
||||
@@ -21,33 +21,35 @@ Signed-off-by: Dongqi Chen <chen.dq@neusoft.com>
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
[jp: fix warning: this 'else' clause does not guard]
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
[lz: Adapted the patch for upgrading kernel from 5.10 to 6.6.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
.../admin-guide/kernel-parameters.txt | 5 +++++
|
||||
Documentation/x86/intel-iommu.rst | 18 +++++++++++++++
|
||||
Documentation/arch/x86/iommu.rst | 18 +++++++++++++++
|
||||
drivers/iommu/intel/iommu.c | 22 ++++++++++++++++++-
|
||||
3 files changed, 44 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
|
||||
index 552f1db5b9d7..e862aabe6255 100644
|
||||
index 44b3c3f8c..d7c13e702 100644
|
||||
--- a/Documentation/admin-guide/kernel-parameters.txt
|
||||
+++ b/Documentation/admin-guide/kernel-parameters.txt
|
||||
@@ -1861,6 +1861,11 @@
|
||||
than 32-bit addressing. The default is to look
|
||||
for translation below 32-bit and if not available
|
||||
then look in the higher range.
|
||||
@@ -2115,6 +2115,11 @@
|
||||
bypassed by not enabling DMAR with this option. In
|
||||
this case, gfx device will use physical address for
|
||||
DMA.
|
||||
+ eth_no_rmrr [Default Off]
|
||||
+ With this option provided, the kernel will ignore
|
||||
+ any specified RMRR regions specified by the BIOS
|
||||
+ for PCI ethernet devices. Confirm with your hardware
|
||||
+ vendor the RMRR regions are indeed invalid first.
|
||||
strict [Default Off]
|
||||
With this option on every unmap_single operation will
|
||||
result in a hardware IOTLB flush operation as opposed
|
||||
diff --git a/Documentation/x86/intel-iommu.rst b/Documentation/x86/intel-iommu.rst
|
||||
index 099f13d51d5f..18e6a8d8b1ee 100644
|
||||
--- a/Documentation/x86/intel-iommu.rst
|
||||
+++ b/Documentation/x86/intel-iommu.rst
|
||||
@@ -33,6 +33,24 @@ regions will fail. Hence BIOS uses RMRR to specify these regions along with
|
||||
Deprecated, equivalent to iommu.strict=1.
|
||||
sp_off [Default Off]
|
||||
diff --git a/Documentation/arch/x86/iommu.rst b/Documentation/arch/x86/iommu.rst
|
||||
index 42c7a6faa..edcbff38c 100644
|
||||
--- a/Documentation/arch/x86/iommu.rst
|
||||
+++ b/Documentation/arch/x86/iommu.rst
|
||||
@@ -35,6 +35,24 @@ regions will fail. Hence BIOS uses RMRR to specify these regions along with
|
||||
devices that need to access these regions. OS is expected to setup
|
||||
unity mappings for these regions for these devices to access these regions.
|
||||
|
||||
@@ -69,25 +71,25 @@ index 099f13d51d5f..18e6a8d8b1ee 100644
|
||||
+actively using any DMA to/from RMRR, as otherwise system instability
|
||||
+may result.
|
||||
+
|
||||
How is IOVA generated?
|
||||
----------------------
|
||||
What is AMD IVRS?
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
|
||||
index 7e3db4c0324d..16ebba2723cb 100644
|
||||
index 4c3707384..6b185695a 100644
|
||||
--- a/drivers/iommu/intel/iommu.c
|
||||
+++ b/drivers/iommu/intel/iommu.c
|
||||
@@ -354,6 +354,7 @@ static int dmar_map_gfx = 1;
|
||||
static int dmar_forcedac;
|
||||
static int intel_iommu_strict;
|
||||
@@ -293,6 +293,7 @@ EXPORT_SYMBOL_GPL(intel_iommu_enabled);
|
||||
|
||||
static int dmar_map_gfx = 1;
|
||||
static int intel_iommu_superpage = 1;
|
||||
+static int intel_iommu_ethrmrr = 1;
|
||||
static int iommu_identity_mapping;
|
||||
static int intel_no_bounce;
|
||||
static int iommu_skip_te_disable;
|
||||
@@ -448,6 +449,15 @@ static int __init intel_iommu_setup(char *str)
|
||||
|
||||
@@ -339,6 +340,15 @@ static int __init intel_iommu_setup(char *str)
|
||||
} else if (!strncmp(str, "forcedac", 8)) {
|
||||
pr_info("Forcing DAC for PCI devices\n");
|
||||
dmar_forcedac = 1;
|
||||
pr_warn("intel_iommu=forcedac deprecated; use iommu.forcedac instead\n");
|
||||
iommu_dma_forcedac = true;
|
||||
+ } else if (!strncmp(str, "eth_no_rmrr", 11)) {
|
||||
+ if (!iommu_default_passthrough()) {
|
||||
+ printk(KERN_WARNING
|
||||
@@ -98,9 +100,9 @@ index 7e3db4c0324d..16ebba2723cb 100644
|
||||
+ intel_iommu_ethrmrr = 0;
|
||||
+ }
|
||||
} else if (!strncmp(str, "strict", 6)) {
|
||||
pr_info("Disable batched IOTLB flush\n");
|
||||
intel_iommu_strict = 1;
|
||||
@@ -2880,8 +2890,18 @@ static bool device_rmrr_is_relaxable(struct device *dev)
|
||||
pr_warn("intel_iommu=strict deprecated; use iommu.strict=1 instead\n");
|
||||
iommu_set_dma_strict();
|
||||
@@ -2518,8 +2528,18 @@ static bool device_rmrr_is_relaxable(struct device *dev)
|
||||
pdev = to_pci_dev(dev);
|
||||
if (IS_USB_DEVICE(pdev) || IS_GFX_DEVICE(pdev))
|
||||
return true;
|
||||
@@ -121,5 +123,5 @@ index 7e3db4c0324d..16ebba2723cb 100644
|
||||
|
||||
/*
|
||||
--
|
||||
2.29.2
|
||||
2.17.1
|
||||
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
From 87e7e3bd136b05d9ae105fe87879d1fe6730ee18 Mon Sep 17 00:00:00 2001
|
||||
From daa7dc61f0a3f84365409478fd9cefe67663a057 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Somerville <Jim.Somerville@windriver.com>
|
||||
Date: Tue, 6 Mar 2018 12:54:40 -0500
|
||||
Subject: [PATCH 06/10] turn off write same in smartqpi driver
|
||||
Subject: [PATCH] turn off write same in smartqpi driver
|
||||
|
||||
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>
|
||||
[lz: Adapted the patch for context changes.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
drivers/scsi/smartpqi/smartpqi_init.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
|
||||
index 9d0229656681..af46f3a024da 100644
|
||||
index 9f0f69c1e..8b4a280ee 100644
|
||||
--- a/drivers/scsi/smartpqi/smartpqi_init.c
|
||||
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
|
||||
@@ -6571,6 +6571,7 @@ static struct scsi_host_template pqi_driver_template = {
|
||||
.map_queues = pqi_map_queues,
|
||||
.sdev_attrs = pqi_sdev_attrs,
|
||||
.shost_attrs = pqi_shost_attrs,
|
||||
@@ -7401,6 +7401,7 @@ static struct scsi_host_template pqi_driver_template = {
|
||||
.sdev_groups = pqi_sdev_groups,
|
||||
.shost_groups = pqi_shost_groups,
|
||||
.cmd_size = sizeof(struct pqi_cmd_priv),
|
||||
+ .no_write_same = 1,
|
||||
};
|
||||
|
||||
static int pqi_register_scsi(struct pqi_ctrl_info *ctrl_info)
|
||||
--
|
||||
2.29.2
|
||||
2.17.1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 4d58a9a618827e4410e3828b4deef5832a8576db Mon Sep 17 00:00:00 2001
|
||||
From d5ba0852574a57872fd48b4e009e9fbc77533b20 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Somerville <Jim.Somerville@windriver.com>
|
||||
Date: Wed, 29 Jan 2020 14:19:22 -0500
|
||||
Subject: [PATCH 07/10] Allow dmar quirks for broken bioses
|
||||
Subject: [PATCH] Allow dmar quirks for broken bioses
|
||||
|
||||
Problem:
|
||||
Broken bios creates inaccurate DMAR tables,
|
||||
@@ -27,17 +27,19 @@ https://lkml.org/lkml/2019/12/24/15
|
||||
|
||||
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
[lz: Adapted the patch for context changes.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
drivers/iommu/intel/dmar.c | 25 ++++++++++++++++++++++++-
|
||||
1 file changed, 24 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
|
||||
index 02e7c10a4224..7d423ac36a44 100644
|
||||
index f800989ea..f08820cbc 100644
|
||||
--- a/drivers/iommu/intel/dmar.c
|
||||
+++ b/drivers/iommu/intel/dmar.c
|
||||
@@ -66,6 +66,26 @@ static void free_iommu(struct intel_iommu *iommu);
|
||||
|
||||
extern const struct iommu_ops intel_iommu_ops;
|
||||
@@ -65,6 +65,26 @@ static DEFINE_IDA(dmar_seq_ids);
|
||||
static int alloc_iommu(struct dmar_drhd_unit *drhd);
|
||||
static void free_iommu(struct intel_iommu *iommu);
|
||||
|
||||
+static int scope_mismatch_quirk;
|
||||
+static void quirk_dmar_scope_mismatch(struct pci_dev *dev)
|
||||
@@ -62,7 +64,7 @@ index 02e7c10a4224..7d423ac36a44 100644
|
||||
static void dmar_register_drhd_unit(struct dmar_drhd_unit *drhd)
|
||||
{
|
||||
/*
|
||||
@@ -255,7 +275,10 @@ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info,
|
||||
@@ -252,7 +272,10 @@ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info,
|
||||
info->dev->class >> 16 != PCI_BASE_CLASS_BRIDGE))) {
|
||||
pr_warn("Device scope type does not match for %s\n",
|
||||
pci_name(info->dev));
|
||||
@@ -75,5 +77,5 @@ index 02e7c10a4224..7d423ac36a44 100644
|
||||
|
||||
for_each_dev_scope(devices, devices_cnt, i, tmp)
|
||||
--
|
||||
2.29.2
|
||||
2.17.1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 451738188482a34603a184e868893f407998bdd4 Mon Sep 17 00:00:00 2001
|
||||
From d386d64f1cb47f5050586a446c9f045a1fcf9cce Mon Sep 17 00:00:00 2001
|
||||
From: Nayna Jain <nayna@linux.vnet.ibm.com>
|
||||
Date: Fri, 10 Nov 2017 17:16:35 -0500
|
||||
Subject: [PATCH 08/10] tpm: ignore burstcount to improve tpm_tis send()
|
||||
Subject: [PATCH] tpm: ignore burstcount to improve tpm_tis send()
|
||||
performance
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
@@ -27,23 +27,25 @@ Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
|
||||
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
|
||||
Signed-off-by: Dongqi Chen <chen.dq@neusoft.com>
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
[lz: Adapted the patch for context changes.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
drivers/char/tpm/tpm_tis_core.c | 43 ++++++++++++---------------------
|
||||
1 file changed, 15 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
|
||||
index a2e0395cbe61..2c69fde1e4e5 100644
|
||||
index 44f71f2c8..4dcf33b39 100644
|
||||
--- a/drivers/char/tpm/tpm_tis_core.c
|
||||
+++ b/drivers/char/tpm/tpm_tis_core.c
|
||||
@@ -330,7 +330,6 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)
|
||||
@@ -402,7 +402,6 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)
|
||||
{
|
||||
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
|
||||
int rc, status, burstcnt;
|
||||
- size_t count = 0;
|
||||
bool itpm = priv->flags & TPM_TIS_ITPM_WORKAROUND;
|
||||
bool itpm = test_bit(TPM_TIS_ITPM_WORKAROUND, &priv->flags);
|
||||
|
||||
status = tpm_tis_status(chip);
|
||||
@@ -343,36 +342,24 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)
|
||||
@@ -415,36 +414,24 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)
|
||||
goto out_err;
|
||||
}
|
||||
}
|
||||
@@ -96,5 +98,5 @@ index a2e0395cbe61..2c69fde1e4e5 100644
|
||||
goto out_err;
|
||||
|
||||
--
|
||||
2.29.2
|
||||
2.17.1
|
||||
|
||||
|
||||
@@ -1,395 +0,0 @@
|
||||
From b377b8aed56d93aef67f7dbad01d026bacffedb1 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Borkmann <daniel@iogearbox.net>
|
||||
Date: Tue, 14 Sep 2021 01:07:57 +0200
|
||||
Subject: [PATCH] bpf, cgroups: Fix cgroup v2 fallback on v1/v2 mixed mode
|
||||
|
||||
Fix cgroup v1 interference when non-root cgroup v2 BPF programs are used.
|
||||
Back in the days, commit bd1060a1d671 ("sock, cgroup: add sock->sk_cgroup")
|
||||
embedded per-socket cgroup information into sock->sk_cgrp_data and in order
|
||||
to save 8 bytes in struct sock made both mutually exclusive, that is, when
|
||||
cgroup v1 socket tagging (e.g. net_cls/net_prio) is used, then cgroup v2
|
||||
falls back to the root cgroup in sock_cgroup_ptr() (&cgrp_dfl_root.cgrp).
|
||||
|
||||
The assumption made was "there is no reason to mix the two and this is in line
|
||||
with how legacy and v2 compatibility is handled" as stated in bd1060a1d671.
|
||||
However, with Kubernetes more widely supporting cgroups v2 as well nowadays,
|
||||
this assumption no longer holds, and the possibility of the v1/v2 mixed mode
|
||||
with the v2 root fallback being hit becomes a real security issue.
|
||||
|
||||
Many of the cgroup v2 BPF programs are also used for policy enforcement, just
|
||||
to pick _one_ example, that is, to programmatically deny socket related system
|
||||
calls like connect(2) or bind(2). A v2 root fallback would implicitly cause
|
||||
a policy bypass for the affected Pods.
|
||||
|
||||
In production environments, we have recently seen this case due to various
|
||||
circumstances: i) a different 3rd party agent and/or ii) a container runtime
|
||||
such as [0] in the user's environment configuring legacy cgroup v1 net_cls
|
||||
tags, which triggered implicitly mentioned root fallback. Another case is
|
||||
Kubernetes projects like kind [1] which create Kubernetes nodes in a container
|
||||
and also add cgroup namespaces to the mix, meaning programs which are attached
|
||||
to the cgroup v2 root of the cgroup namespace get attached to a non-root
|
||||
cgroup v2 path from init namespace point of view. And the latter's root is
|
||||
out of reach for agents on a kind Kubernetes node to configure. Meaning, any
|
||||
entity on the node setting cgroup v1 net_cls tag will trigger the bypass
|
||||
despite cgroup v2 BPF programs attached to the namespace root.
|
||||
|
||||
Generally, this mutual exclusiveness does not hold anymore in today's user
|
||||
environments and makes cgroup v2 usage from BPF side fragile and unreliable.
|
||||
This fix adds proper struct cgroup pointer for the cgroup v2 case to struct
|
||||
sock_cgroup_data in order to address these issues; this implicitly also fixes
|
||||
the tradeoffs being made back then with regards to races and refcount leaks
|
||||
as stated in bd1060a1d671, and removes the fallback, so that cgroup v2 BPF
|
||||
programs always operate as expected.
|
||||
|
||||
[0] https://github.com/nestybox/sysbox/
|
||||
[1] https://kind.sigs.k8s.io/
|
||||
|
||||
Fixes: bd1060a1d671 ("sock, cgroup: add sock->sk_cgroup")
|
||||
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
|
||||
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
||||
Acked-by: Stanislav Fomichev <sdf@google.com>
|
||||
Acked-by: Tejun Heo <tj@kernel.org>
|
||||
Link: https://lore.kernel.org/bpf/20210913230759.2313-1-daniel@iogearbox.net
|
||||
(cherry picked from commit 8520e224f547cd070c7c8f97b1fc6d58cff7ccaa)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
include/linux/cgroup-defs.h | 107 +++++++++--------------------------
|
||||
include/linux/cgroup.h | 22 +------
|
||||
kernel/cgroup/cgroup.c | 50 ++++------------
|
||||
net/core/netclassid_cgroup.c | 7 +--
|
||||
net/core/netprio_cgroup.c | 10 +---
|
||||
5 files changed, 41 insertions(+), 155 deletions(-)
|
||||
|
||||
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
|
||||
index fee0b5547cd0..3e406626168a 100644
|
||||
--- a/include/linux/cgroup-defs.h
|
||||
+++ b/include/linux/cgroup-defs.h
|
||||
@@ -763,107 +763,54 @@ static inline void cgroup_threadgroup_change_end(struct task_struct *tsk) {}
|
||||
* sock_cgroup_data is embedded at sock->sk_cgrp_data and contains
|
||||
* per-socket cgroup information except for memcg association.
|
||||
*
|
||||
- * On legacy hierarchies, net_prio and net_cls controllers directly set
|
||||
- * attributes on each sock which can then be tested by the network layer.
|
||||
- * On the default hierarchy, each sock is associated with the cgroup it was
|
||||
- * created in and the networking layer can match the cgroup directly.
|
||||
- *
|
||||
- * To avoid carrying all three cgroup related fields separately in sock,
|
||||
- * sock_cgroup_data overloads (prioidx, classid) and the cgroup pointer.
|
||||
- * On boot, sock_cgroup_data records the cgroup that the sock was created
|
||||
- * in so that cgroup2 matches can be made; however, once either net_prio or
|
||||
- * net_cls starts being used, the area is overriden to carry prioidx and/or
|
||||
- * classid. The two modes are distinguished by whether the lowest bit is
|
||||
- * set. Clear bit indicates cgroup pointer while set bit prioidx and
|
||||
- * classid.
|
||||
- *
|
||||
- * While userland may start using net_prio or net_cls at any time, once
|
||||
- * either is used, cgroup2 matching no longer works. There is no reason to
|
||||
- * mix the two and this is in line with how legacy and v2 compatibility is
|
||||
- * handled. On mode switch, cgroup references which are already being
|
||||
- * pointed to by socks may be leaked. While this can be remedied by adding
|
||||
- * synchronization around sock_cgroup_data, given that the number of leaked
|
||||
- * cgroups is bound and highly unlikely to be high, this seems to be the
|
||||
- * better trade-off.
|
||||
+ * On legacy hierarchies, net_prio and net_cls controllers directly
|
||||
+ * set attributes on each sock which can then be tested by the network
|
||||
+ * layer. On the default hierarchy, each sock is associated with the
|
||||
+ * cgroup it was created in and the networking layer can match the
|
||||
+ * cgroup directly.
|
||||
*/
|
||||
struct sock_cgroup_data {
|
||||
- union {
|
||||
-#ifdef __LITTLE_ENDIAN
|
||||
- struct {
|
||||
- u8 is_data : 1;
|
||||
- u8 no_refcnt : 1;
|
||||
- u8 unused : 6;
|
||||
- u8 padding;
|
||||
- u16 prioidx;
|
||||
- u32 classid;
|
||||
- } __packed;
|
||||
-#else
|
||||
- struct {
|
||||
- u32 classid;
|
||||
- u16 prioidx;
|
||||
- u8 padding;
|
||||
- u8 unused : 6;
|
||||
- u8 no_refcnt : 1;
|
||||
- u8 is_data : 1;
|
||||
- } __packed;
|
||||
+ struct cgroup *cgroup; /* v2 */
|
||||
+#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
+ u32 classid; /* v1 */
|
||||
+#endif
|
||||
+#ifdef CONFIG_CGROUP_NET_PRIO
|
||||
+ u16 prioidx; /* v1 */
|
||||
#endif
|
||||
- u64 val;
|
||||
- };
|
||||
};
|
||||
|
||||
-/*
|
||||
- * There's a theoretical window where the following accessors race with
|
||||
- * updaters and return part of the previous pointer as the prioidx or
|
||||
- * classid. Such races are short-lived and the result isn't critical.
|
||||
- */
|
||||
static inline u16 sock_cgroup_prioidx(const struct sock_cgroup_data *skcd)
|
||||
{
|
||||
- /* fallback to 1 which is always the ID of the root cgroup */
|
||||
- return (skcd->is_data & 1) ? skcd->prioidx : 1;
|
||||
+#ifdef CONFIG_CGROUP_NET_PRIO
|
||||
+ return READ_ONCE(skcd->prioidx);
|
||||
+#else
|
||||
+ return 1;
|
||||
+#endif
|
||||
}
|
||||
|
||||
static inline u32 sock_cgroup_classid(const struct sock_cgroup_data *skcd)
|
||||
{
|
||||
- /* fallback to 0 which is the unconfigured default classid */
|
||||
- return (skcd->is_data & 1) ? skcd->classid : 0;
|
||||
+#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
+ return READ_ONCE(skcd->classid);
|
||||
+#else
|
||||
+ return 0;
|
||||
+#endif
|
||||
}
|
||||
|
||||
-/*
|
||||
- * If invoked concurrently, the updaters may clobber each other. The
|
||||
- * caller is responsible for synchronization.
|
||||
- */
|
||||
static inline void sock_cgroup_set_prioidx(struct sock_cgroup_data *skcd,
|
||||
u16 prioidx)
|
||||
{
|
||||
- struct sock_cgroup_data skcd_buf = {{ .val = READ_ONCE(skcd->val) }};
|
||||
-
|
||||
- if (sock_cgroup_prioidx(&skcd_buf) == prioidx)
|
||||
- return;
|
||||
-
|
||||
- if (!(skcd_buf.is_data & 1)) {
|
||||
- skcd_buf.val = 0;
|
||||
- skcd_buf.is_data = 1;
|
||||
- }
|
||||
-
|
||||
- skcd_buf.prioidx = prioidx;
|
||||
- WRITE_ONCE(skcd->val, skcd_buf.val); /* see sock_cgroup_ptr() */
|
||||
+#ifdef CONFIG_CGROUP_NET_PRIO
|
||||
+ WRITE_ONCE(skcd->prioidx, prioidx);
|
||||
+#endif
|
||||
}
|
||||
|
||||
static inline void sock_cgroup_set_classid(struct sock_cgroup_data *skcd,
|
||||
u32 classid)
|
||||
{
|
||||
- struct sock_cgroup_data skcd_buf = {{ .val = READ_ONCE(skcd->val) }};
|
||||
-
|
||||
- if (sock_cgroup_classid(&skcd_buf) == classid)
|
||||
- return;
|
||||
-
|
||||
- if (!(skcd_buf.is_data & 1)) {
|
||||
- skcd_buf.val = 0;
|
||||
- skcd_buf.is_data = 1;
|
||||
- }
|
||||
-
|
||||
- skcd_buf.classid = classid;
|
||||
- WRITE_ONCE(skcd->val, skcd_buf.val); /* see sock_cgroup_ptr() */
|
||||
+#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
+ WRITE_ONCE(skcd->classid, classid);
|
||||
+#endif
|
||||
}
|
||||
|
||||
#else /* CONFIG_SOCK_CGROUP_DATA */
|
||||
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
|
||||
index 618838c48313..9c88b7da3245 100644
|
||||
--- a/include/linux/cgroup.h
|
||||
+++ b/include/linux/cgroup.h
|
||||
@@ -816,33 +816,13 @@ static inline void cgroup_account_cputime_field(struct task_struct *task,
|
||||
*/
|
||||
#ifdef CONFIG_SOCK_CGROUP_DATA
|
||||
|
||||
-#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID)
|
||||
-extern spinlock_t cgroup_sk_update_lock;
|
||||
-#endif
|
||||
-
|
||||
-void cgroup_sk_alloc_disable(void);
|
||||
void cgroup_sk_alloc(struct sock_cgroup_data *skcd);
|
||||
void cgroup_sk_clone(struct sock_cgroup_data *skcd);
|
||||
void cgroup_sk_free(struct sock_cgroup_data *skcd);
|
||||
|
||||
static inline struct cgroup *sock_cgroup_ptr(struct sock_cgroup_data *skcd)
|
||||
{
|
||||
-#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID)
|
||||
- unsigned long v;
|
||||
-
|
||||
- /*
|
||||
- * @skcd->val is 64bit but the following is safe on 32bit too as we
|
||||
- * just need the lower ulong to be written and read atomically.
|
||||
- */
|
||||
- v = READ_ONCE(skcd->val);
|
||||
-
|
||||
- if (v & 3)
|
||||
- return &cgrp_dfl_root.cgrp;
|
||||
-
|
||||
- return (struct cgroup *)(unsigned long)v ?: &cgrp_dfl_root.cgrp;
|
||||
-#else
|
||||
- return (struct cgroup *)(unsigned long)skcd->val;
|
||||
-#endif
|
||||
+ return skcd->cgroup;
|
||||
}
|
||||
|
||||
#else /* CONFIG_CGROUP_DATA */
|
||||
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
|
||||
index c8b811e039cc..e065307f2346 100644
|
||||
--- a/kernel/cgroup/cgroup.c
|
||||
+++ b/kernel/cgroup/cgroup.c
|
||||
@@ -6419,74 +6419,44 @@ int cgroup_parse_float(const char *input, unsigned dec_shift, s64 *v)
|
||||
*/
|
||||
#ifdef CONFIG_SOCK_CGROUP_DATA
|
||||
|
||||
-#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID)
|
||||
-
|
||||
-DEFINE_SPINLOCK(cgroup_sk_update_lock);
|
||||
-static bool cgroup_sk_alloc_disabled __read_mostly;
|
||||
-
|
||||
-void cgroup_sk_alloc_disable(void)
|
||||
-{
|
||||
- if (cgroup_sk_alloc_disabled)
|
||||
- return;
|
||||
- pr_info("cgroup: disabling cgroup2 socket matching due to net_prio or net_cls activation\n");
|
||||
- cgroup_sk_alloc_disabled = true;
|
||||
-}
|
||||
-
|
||||
-#else
|
||||
-
|
||||
-#define cgroup_sk_alloc_disabled false
|
||||
-
|
||||
-#endif
|
||||
-
|
||||
void cgroup_sk_alloc(struct sock_cgroup_data *skcd)
|
||||
{
|
||||
- if (cgroup_sk_alloc_disabled) {
|
||||
- skcd->no_refcnt = 1;
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
/* Don't associate the sock with unrelated interrupted task's cgroup. */
|
||||
if (in_interrupt())
|
||||
return;
|
||||
|
||||
rcu_read_lock();
|
||||
-
|
||||
while (true) {
|
||||
struct css_set *cset;
|
||||
|
||||
cset = task_css_set(current);
|
||||
if (likely(cgroup_tryget(cset->dfl_cgrp))) {
|
||||
- skcd->val = (unsigned long)cset->dfl_cgrp;
|
||||
+ skcd->cgroup = cset->dfl_cgrp;
|
||||
cgroup_bpf_get(cset->dfl_cgrp);
|
||||
break;
|
||||
}
|
||||
cpu_relax();
|
||||
}
|
||||
-
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
void cgroup_sk_clone(struct sock_cgroup_data *skcd)
|
||||
{
|
||||
- if (skcd->val) {
|
||||
- if (skcd->no_refcnt)
|
||||
- return;
|
||||
- /*
|
||||
- * We might be cloning a socket which is left in an empty
|
||||
- * cgroup and the cgroup might have already been rmdir'd.
|
||||
- * Don't use cgroup_get_live().
|
||||
- */
|
||||
- cgroup_get(sock_cgroup_ptr(skcd));
|
||||
- cgroup_bpf_get(sock_cgroup_ptr(skcd));
|
||||
- }
|
||||
+ struct cgroup *cgrp = sock_cgroup_ptr(skcd);
|
||||
+
|
||||
+ /*
|
||||
+ * We might be cloning a socket which is left in an empty
|
||||
+ * cgroup and the cgroup might have already been rmdir'd.
|
||||
+ * Don't use cgroup_get_live().
|
||||
+ */
|
||||
+ cgroup_get(cgrp);
|
||||
+ cgroup_bpf_get(cgrp);
|
||||
}
|
||||
|
||||
void cgroup_sk_free(struct sock_cgroup_data *skcd)
|
||||
{
|
||||
struct cgroup *cgrp = sock_cgroup_ptr(skcd);
|
||||
|
||||
- if (skcd->no_refcnt)
|
||||
- return;
|
||||
cgroup_bpf_put(cgrp);
|
||||
cgroup_put(cgrp);
|
||||
}
|
||||
diff --git a/net/core/netclassid_cgroup.c b/net/core/netclassid_cgroup.c
|
||||
index 41b24cd31562..b6de5ee22391 100644
|
||||
--- a/net/core/netclassid_cgroup.c
|
||||
+++ b/net/core/netclassid_cgroup.c
|
||||
@@ -72,11 +72,8 @@ static int update_classid_sock(const void *v, struct file *file, unsigned n)
|
||||
struct update_classid_context *ctx = (void *)v;
|
||||
struct socket *sock = sock_from_file(file, &err);
|
||||
|
||||
- if (sock) {
|
||||
- spin_lock(&cgroup_sk_update_lock);
|
||||
+ if (sock)
|
||||
sock_cgroup_set_classid(&sock->sk->sk_cgrp_data, ctx->classid);
|
||||
- spin_unlock(&cgroup_sk_update_lock);
|
||||
- }
|
||||
if (--ctx->batch == 0) {
|
||||
ctx->batch = UPDATE_CLASSID_BATCH;
|
||||
return n + 1;
|
||||
@@ -122,8 +119,6 @@ static int write_classid(struct cgroup_subsys_state *css, struct cftype *cft,
|
||||
struct css_task_iter it;
|
||||
struct task_struct *p;
|
||||
|
||||
- cgroup_sk_alloc_disable();
|
||||
-
|
||||
cs->classid = (u32)value;
|
||||
|
||||
css_task_iter_start(css, 0, &it);
|
||||
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
|
||||
index 9bd4cab7d510..d4c71e382a13 100644
|
||||
--- a/net/core/netprio_cgroup.c
|
||||
+++ b/net/core/netprio_cgroup.c
|
||||
@@ -207,8 +207,6 @@ static ssize_t write_priomap(struct kernfs_open_file *of,
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
- cgroup_sk_alloc_disable();
|
||||
-
|
||||
rtnl_lock();
|
||||
|
||||
ret = netprio_set_prio(of_css(of), dev, prio);
|
||||
@@ -222,12 +220,10 @@ static int update_netprio(const void *v, struct file *file, unsigned n)
|
||||
{
|
||||
int err;
|
||||
struct socket *sock = sock_from_file(file, &err);
|
||||
- if (sock) {
|
||||
- spin_lock(&cgroup_sk_update_lock);
|
||||
+
|
||||
+ if (sock)
|
||||
sock_cgroup_set_prioidx(&sock->sk->sk_cgrp_data,
|
||||
(unsigned long)v);
|
||||
- spin_unlock(&cgroup_sk_update_lock);
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -236,8 +232,6 @@ static void net_prio_attach(struct cgroup_taskset *tset)
|
||||
struct task_struct *p;
|
||||
struct cgroup_subsys_state *css;
|
||||
|
||||
- cgroup_sk_alloc_disable();
|
||||
-
|
||||
cgroup_taskset_for_each(p, css, tset) {
|
||||
void *v = (void *)(unsigned long)css->id;
|
||||
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From ee39df8a1626eb35797b0f9943dc881752c36588 Mon Sep 17 00:00:00 2001
|
||||
From c335a673dea2fd4c0452d88975cc2045d0934d14 Mon Sep 17 00:00:00 2001
|
||||
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
|
||||
Date: Thu, 9 Sep 2021 04:56:46 -0400
|
||||
Subject: [PATCH] workqueue: Affine rescuer threads and unbound wqs
|
||||
@@ -24,15 +24,18 @@ former.
|
||||
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
[lz: Adapted the patch for upgrading kernel from 5.10 to 6.6
|
||||
according to M. Vefa Bicakci's suggestion.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
kernel/workqueue.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
kernel/workqueue.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
|
||||
index d6bdf3ad61e9..43f11a383cba 100644
|
||||
index e6a95bb74..a15ad43c8 100644
|
||||
--- a/kernel/workqueue.c
|
||||
+++ b/kernel/workqueue.c
|
||||
@@ -4242,7 +4242,7 @@ static int init_rescuer(struct workqueue_struct *wq)
|
||||
@@ -4659,7 +4659,7 @@ static int init_rescuer(struct workqueue_struct *wq)
|
||||
}
|
||||
|
||||
wq->rescuer = rescuer;
|
||||
@@ -41,21 +44,14 @@ index d6bdf3ad61e9..43f11a383cba 100644
|
||||
wake_up_process(rescuer->task);
|
||||
|
||||
return 0;
|
||||
@@ -5937,13 +5937,12 @@ static void __init wq_numa_init(void)
|
||||
void __init workqueue_init_early(void)
|
||||
{
|
||||
int std_nice[NR_STD_WORKER_POOLS] = { 0, HIGHPRI_NICE_LEVEL };
|
||||
- int hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ;
|
||||
int i, cpu;
|
||||
|
||||
BUILD_BUG_ON(__alignof__(struct pool_workqueue) < __alignof__(long long));
|
||||
|
||||
BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL));
|
||||
- cpumask_copy(wq_unbound_cpumask, housekeeping_cpumask(hk_flags));
|
||||
+ cpumask_copy(wq_unbound_cpumask, cpu_kthread_mask);
|
||||
|
||||
pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
|
||||
@@ -6545,6 +6545,7 @@ void __init workqueue_init_early(void)
|
||||
cpumask_copy(wq_unbound_cpumask, cpu_possible_mask);
|
||||
restrict_unbound_cpumask("HK_TYPE_WQ", housekeeping_cpumask(HK_TYPE_WQ));
|
||||
restrict_unbound_cpumask("HK_TYPE_DOMAIN", housekeeping_cpumask(HK_TYPE_DOMAIN));
|
||||
+ restrict_unbound_cpumask("kthread_cpus", cpu_kthread_mask);
|
||||
if (!cpumask_empty(&wq_cmdline_cpumask))
|
||||
restrict_unbound_cpumask("workqueue.unbound_cpus", &wq_cmdline_cpumask);
|
||||
|
||||
--
|
||||
2.29.2
|
||||
2.17.1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From b1d1297d44033ae1d756838d6e06f04d52d1ceb6 Mon Sep 17 00:00:00 2001
|
||||
From a0de2b0cbf1d33173642efd43dc45f0a005ab968 Mon Sep 17 00:00:00 2001
|
||||
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
|
||||
Date: Thu, 17 Feb 2022 14:17:58 -0500
|
||||
Subject: [PATCH] driver core: auxiliary bus: Enable by default
|
||||
@@ -22,7 +22,7 @@ Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
|
||||
index 040be48ce046..a18ec49b9dac 100644
|
||||
index 6f04b831a..f6177ea14 100644
|
||||
--- a/drivers/base/Kconfig
|
||||
+++ b/drivers/base/Kconfig
|
||||
@@ -3,6 +3,7 @@ menu "Generic Driver Options"
|
||||
@@ -34,5 +34,5 @@ index 040be48ce046..a18ec49b9dac 100644
|
||||
config UEVENT_HELPER
|
||||
bool "Support for uevent helper"
|
||||
--
|
||||
2.29.2
|
||||
2.17.1
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
From 2a32d5bc7e385fbf40f22cc413354e17a24d4de9 Mon Sep 17 00:00:00 2001
|
||||
From: Jiping Ma <jiping.ma2@windriver.com>
|
||||
Date: Sun, 10 Oct 2021 18:56:26 -0700
|
||||
Subject: [PATCH] scsi: smartpqi: Enable sas_address sysfs for SATA device
|
||||
type.
|
||||
|
||||
We met the issue DM complains that it can't find the disk specified
|
||||
in the deployment config file after we updated the Linux kernel to 5.10.
|
||||
The error is "failed to find disk for path /dev/disk/by-path/
|
||||
pci-0000:3b:00.0-sas-0x31402ec001d92983-lun-0"
|
||||
|
||||
This happens because device type SATA is excluded from being
|
||||
processed with the function pqi_is_device_with_sas_address.
|
||||
which causes all SATA type disk drives to appear the same, having
|
||||
zeroes in the lun name. /dev/disk/by-path/
|
||||
pci-0000:3b:00.0-sas-0x0000000000000000-lun-0
|
||||
|
||||
We can add type SA_DEVICE_TYPE_SATA to class device_with_sas_address,
|
||||
since it will also get the sas_address from wwid. and works transparently
|
||||
with the old kernel without gaps.
|
||||
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
---
|
||||
drivers/scsi/smartpqi/smartpqi_init.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
|
||||
index ecb2af3f43ca..df16e0a27a41 100644
|
||||
--- a/drivers/scsi/smartpqi/smartpqi_init.c
|
||||
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
|
||||
@@ -2101,6 +2101,7 @@ static inline void pqi_mask_device(u8 *scsi3addr)
|
||||
static inline bool pqi_is_device_with_sas_address(struct pqi_scsi_dev *device)
|
||||
{
|
||||
switch (device->device_type) {
|
||||
+ case SA_DEVICE_TYPE_SATA:
|
||||
case SA_DEVICE_TYPE_SAS:
|
||||
case SA_DEVICE_TYPE_EXPANDER_SMP:
|
||||
case SA_DEVICE_TYPE_SES:
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 3ba9b411491dfdca077f7810cf474e82026f63c8 Mon Sep 17 00:00:00 2001
|
||||
From d482b07774edf32e034aae1b8193939aff15f576 Mon Sep 17 00:00:00 2001
|
||||
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
|
||||
Date: Thu, 3 Feb 2022 21:34:14 -0500
|
||||
Subject: [PATCH] Enable CONFIG_PAGE_POOL by default
|
||||
@@ -15,22 +15,24 @@ CONFIG_PAGE_POOL, this commit enables the configuration option in
|
||||
question by default.
|
||||
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
[lz: Adapted the patch for context changes.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
net/Kconfig | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/net/Kconfig b/net/Kconfig
|
||||
index d6567162c1cf..add29b03a664 100644
|
||||
index 48c33c222..76ca8b992 100644
|
||||
--- a/net/Kconfig
|
||||
+++ b/net/Kconfig
|
||||
@@ -437,6 +437,7 @@ config NET_DEVLINK
|
||||
@@ -431,6 +431,7 @@ config NET_DEVLINK
|
||||
|
||||
config PAGE_POOL
|
||||
bool
|
||||
+ default y
|
||||
|
||||
config FAILOVER
|
||||
tristate "Generic failover module"
|
||||
config PAGE_POOL_STATS
|
||||
default n
|
||||
--
|
||||
2.29.2
|
||||
2.17.1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From ce6ac6352c2d5d319a852959b0d3169a0cf23d78 Mon Sep 17 00:00:00 2001
|
||||
From ed051d788e0f7d177bec80d7b594e7b889b975bd Mon Sep 17 00:00:00 2001
|
||||
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
|
||||
Date: Wed, 4 Jan 2023 20:41:54 -0500
|
||||
Subject: [PATCH] Revert "sched/idle: Move quiet_vmstate() into the NOHZ code"
|
||||
@@ -84,10 +84,10 @@ Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
2 files changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
|
||||
index 2593a733c084..a4122590ca54 100644
|
||||
index f26ab2675..9298330c5 100644
|
||||
--- a/kernel/sched/idle.c
|
||||
+++ b/kernel/sched/idle.c
|
||||
@@ -271,6 +271,7 @@ static void do_idle(void)
|
||||
@@ -274,6 +274,7 @@ static void do_idle(void)
|
||||
*/
|
||||
|
||||
__current_set_polling();
|
||||
@@ -96,10 +96,10 @@ index 2593a733c084..a4122590ca54 100644
|
||||
|
||||
while (!need_resched()) {
|
||||
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
|
||||
index 92fb738813f3..81ef5f83a0d8 100644
|
||||
index 1ad89eec2..468e756f1 100644
|
||||
--- a/kernel/time/tick-sched.c
|
||||
+++ b/kernel/time/tick-sched.c
|
||||
@@ -24,7 +24,6 @@
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <linux/irq_work.h>
|
||||
#include <linux/posix-timers.h>
|
||||
#include <linux/context_tracking.h>
|
||||
@@ -107,7 +107,7 @@ index 92fb738813f3..81ef5f83a0d8 100644
|
||||
|
||||
#include <asm/irq_regs.h>
|
||||
|
||||
@@ -812,7 +811,6 @@ static void tick_nohz_stop_tick(struct tick_sched *ts, int cpu)
|
||||
@@ -932,7 +931,6 @@ static void tick_nohz_stop_tick(struct tick_sched *ts, int cpu)
|
||||
*/
|
||||
if (!ts->tick_stopped) {
|
||||
calc_load_nohz_start();
|
||||
@@ -116,5 +116,5 @@ index 92fb738813f3..81ef5f83a0d8 100644
|
||||
ts->last_tick = hrtimer_get_expires(&ts->sched_timer);
|
||||
ts->tick_stopped = 1;
|
||||
--
|
||||
2.25.1
|
||||
2.17.1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 895e060d5da5a9f2d100495abafcb15871c2c486 Mon Sep 17 00:00:00 2001
|
||||
From d3a94bc5b2139aeb6f6d1f05c2bd47a8f9ad2650 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Somerville <jim.somerville@windriver.com>
|
||||
Date: Fri, 14 Apr 2023 15:29:22 -0400
|
||||
Subject: [PATCH] Port negative dentries limit feature from 3.10
|
||||
@@ -24,13 +24,22 @@ more calls into iterate_super
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
[zp: Adapted the patch for context and code changes.]
|
||||
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
|
||||
[lz: Adapted the patch for upgrading kernel from 5.10 to 6.6.
|
||||
The "struct ctl_table fs_table" in kernel/sysctl.c has been removed
|
||||
in 6.6. So move the proc file negative-dentry-limit's register
|
||||
table to fs/dcache.c as part of "struct ctl_table fs_dcache_sysctls",
|
||||
where the related functions and variables are defined.
|
||||
Then the related symbol exports for them aren't needed any more.
|
||||
Replace "&zero_ul" with "SYSCTL_LONG_ZERO" according to:
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
|
||||
commit/?id=b1f2aff888af54a057c2c3c0d88a13ef5d37b52a.]
|
||||
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
||||
---
|
||||
fs/dcache.c | 178 +++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
kernel/sysctl.c | 12 ++++
|
||||
2 files changed, 188 insertions(+), 2 deletions(-)
|
||||
fs/dcache.c | 185 +++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 183 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/fs/dcache.c b/fs/dcache.c
|
||||
index 30dec5522..51bafdd49 100644
|
||||
index 576ad162c..0fff744af 100644
|
||||
--- a/fs/dcache.c
|
||||
+++ b/fs/dcache.c
|
||||
@@ -32,6 +32,7 @@
|
||||
@@ -41,8 +50,8 @@ index 30dec5522..51bafdd49 100644
|
||||
#include "internal.h"
|
||||
#include "mount.h"
|
||||
|
||||
@@ -119,6 +120,30 @@ struct dentry_stat_t dentry_stat = {
|
||||
.age_limit = 45,
|
||||
@@ -124,6 +125,65 @@ struct dentry_stat_t {
|
||||
long dummy; /* Reserved for future use */
|
||||
};
|
||||
|
||||
+/*
|
||||
@@ -59,7 +68,6 @@ index 30dec5522..51bafdd49 100644
|
||||
+ */
|
||||
+static long negative_dentry_limit;
|
||||
+int dcache_negative_dentry_limit_sysctl;
|
||||
+EXPORT_SYMBOL_GPL(dcache_negative_dentry_limit_sysctl);
|
||||
+
|
||||
+/*
|
||||
+ * There will be a periodic check to see if the negative dentry limit
|
||||
@@ -69,13 +77,6 @@ index 30dec5522..51bafdd49 100644
|
||||
+static void prune_negative_dentry(struct work_struct *work);
|
||||
+static DECLARE_DELAYED_WORK(prune_negative_dentry_work, prune_negative_dentry);
|
||||
+
|
||||
static DEFINE_PER_CPU(long, nr_dentry);
|
||||
static DEFINE_PER_CPU(long, nr_dentry_unused);
|
||||
static DEFINE_PER_CPU(long, nr_dentry_negative);
|
||||
@@ -175,6 +200,43 @@ int proc_nr_dentry(struct ctl_table *table, int write, void *buffer,
|
||||
}
|
||||
#endif
|
||||
|
||||
+/*
|
||||
+ * Sysctl proc handler for dcache_negativ3_dentry_limit_sysctl.
|
||||
+ */
|
||||
@@ -111,12 +112,27 @@ index 30dec5522..51bafdd49 100644
|
||||
+ pr_info("Negative dentry limits = %ld\n", negative_dentry_limit);
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(proc_dcache_negative_dentry_limit);
|
||||
+
|
||||
/*
|
||||
* Compare 2 name strings, return 0 if they match, otherwise non-zero.
|
||||
* The strings are both count bytes long, and count is non-zero.
|
||||
@@ -1142,8 +1204,9 @@ void shrink_dentry_list(struct list_head *list)
|
||||
static DEFINE_PER_CPU(long, nr_dentry);
|
||||
static DEFINE_PER_CPU(long, nr_dentry_unused);
|
||||
static DEFINE_PER_CPU(long, nr_dentry_negative);
|
||||
@@ -191,6 +251,15 @@ static struct ctl_table fs_dcache_sysctls[] = {
|
||||
.mode = 0444,
|
||||
.proc_handler = proc_nr_dentry,
|
||||
},
|
||||
+ {
|
||||
+ .procname = "negative-dentry-limit",
|
||||
+ .data = &dcache_negative_dentry_limit_sysctl,
|
||||
+ .maxlen = sizeof(dcache_negative_dentry_limit_sysctl),
|
||||
+ .mode = 0644,
|
||||
+ .proc_handler = proc_dcache_negative_dentry_limit,
|
||||
+ .extra1 = SYSCTL_LONG_ZERO,
|
||||
+ .extra2 = SYSCTL_ONE_HUNDRED,
|
||||
+ },
|
||||
{ }
|
||||
};
|
||||
|
||||
@@ -1202,8 +1271,9 @@ void shrink_dentry_list(struct list_head *list)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +144,7 @@ index 30dec5522..51bafdd49 100644
|
||||
{
|
||||
struct list_head *freeable = arg;
|
||||
struct dentry *dentry = container_of(item, struct dentry, d_lru);
|
||||
@@ -1194,12 +1257,29 @@ static enum lru_status dentry_lru_isolate(struct list_head *item,
|
||||
@@ -1254,12 +1324,29 @@ static enum lru_status dentry_lru_isolate(struct list_head *item,
|
||||
return LRU_ROTATE;
|
||||
}
|
||||
|
||||
@@ -158,7 +174,7 @@ index 30dec5522..51bafdd49 100644
|
||||
/**
|
||||
* prune_dcache_sb - shrink the dcache
|
||||
* @sb: superblock
|
||||
@@ -1223,6 +1303,20 @@ long prune_dcache_sb(struct super_block *sb, struct shrink_control *sc)
|
||||
@@ -1283,6 +1370,20 @@ long prune_dcache_sb(struct super_block *sb, struct shrink_control *sc)
|
||||
return freed;
|
||||
}
|
||||
|
||||
@@ -179,7 +195,7 @@ index 30dec5522..51bafdd49 100644
|
||||
static enum lru_status dentry_lru_isolate_shrink(struct list_head *item,
|
||||
struct list_lru_one *lru, spinlock_t *lru_lock, void *arg)
|
||||
{
|
||||
@@ -1618,6 +1712,86 @@ static enum d_walk_ret umount_check(void *_data, struct dentry *dentry)
|
||||
@@ -1677,6 +1778,86 @@ static enum d_walk_ret umount_check(void *_data, struct dentry *dentry)
|
||||
return D_WALK_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -266,36 +282,6 @@ index 30dec5522..51bafdd49 100644
|
||||
static void do_one_tree(struct dentry *dentry)
|
||||
{
|
||||
shrink_dcache_parent(dentry);
|
||||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
|
||||
index a45f0dd10..034517367 100644
|
||||
--- a/kernel/sysctl.c
|
||||
+++ b/kernel/sysctl.c
|
||||
@@ -106,6 +106,9 @@
|
||||
|
||||
#if defined(CONFIG_SYSCTL)
|
||||
|
||||
+extern int dcache_negative_dentry_limit_sysctl;
|
||||
+extern proc_handler proc_dcache_negative_dentry_limit;
|
||||
+
|
||||
/* Constants used for minimum and maximum */
|
||||
#ifdef CONFIG_LOCKUP_DETECTOR
|
||||
static int sixty = 60;
|
||||
@@ -3416,6 +3419,15 @@ static struct ctl_table fs_table[] = {
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = SYSCTL_ONE,
|
||||
},
|
||||
+ {
|
||||
+ .procname = "negative-dentry-limit",
|
||||
+ .data = &dcache_negative_dentry_limit_sysctl,
|
||||
+ .maxlen = sizeof(dcache_negative_dentry_limit_sysctl),
|
||||
+ .mode = 0644,
|
||||
+ .proc_handler = proc_dcache_negative_dentry_limit,
|
||||
+ .extra1 = &zero_ul,
|
||||
+ .extra2 = SYSCTL_ONE_HUNDRED,
|
||||
+ },
|
||||
{ }
|
||||
};
|
||||
|
||||
--
|
||||
2.30.2
|
||||
2.17.1
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
From 42f1ccc21f873a27c125a4e1aa3cb70a2336aa14 Mon Sep 17 00:00:00 2001
|
||||
From: Jiping Ma <jiping.ma2@windriver.com>
|
||||
Date: Wed, 8 Dec 2021 17:49:56 -0800
|
||||
Subject: [PATCH] Revert "scsi: sd: Inline sd_probe_part2()"
|
||||
|
||||
This reverts commit 82a54da641f3cacfa31db36fc58a5e903f804c22.
|
||||
|
||||
Merge conflicts were encountered when reverting this commit, which
|
||||
inlines sd_probe_part2() into sd_probe(). However, the inlined parts
|
||||
of sd_probe_part2() have since been modified. To avoid a difference
|
||||
in behaviour, the updated code was relocated to sd_probe_part2().
|
||||
|
||||
The inlined code has been modified as follows since the inlining
|
||||
happened:
|
||||
The following code was added
|
||||
if (sdp->rpm_autosuspend) {
|
||||
pm_runtime_set_autosuspend_delay(dev,
|
||||
sdp->host->hostt->rpm_autosuspend_delay);
|
||||
}
|
||||
between the following line
|
||||
blk_pm_runtime_init(sdp->request_queue, dev);
|
||||
and the following line
|
||||
device_add_disk(dev, gd, NULL);
|
||||
|
||||
In addition, init_opal_dev() is now passed the pointer "sdkp"
|
||||
instead of "sdp" as the first argument. This commit ensures that
|
||||
these two changes were accounted for when reverting the inlining
|
||||
of sd_probe_part2().
|
||||
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
---
|
||||
drivers/scsi/sd.c | 111 ++++++++++++++++++++++++++--------------------
|
||||
1 file changed, 63 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
|
||||
index 56e291708587..d1d27516fc6a 100644
|
||||
--- a/drivers/scsi/sd.c
|
||||
+++ b/drivers/scsi/sd.c
|
||||
@@ -3364,6 +3364,68 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void sd_probe_part2(struct scsi_disk *sdkp)
|
||||
+{
|
||||
+ struct scsi_device *sdp;
|
||||
+ struct gendisk *gd;
|
||||
+ u32 index;
|
||||
+ struct device *dev;
|
||||
+
|
||||
+ sdp = sdkp->device;
|
||||
+ gd = sdkp->disk;
|
||||
+ index = sdkp->index;
|
||||
+ dev = &sdp->sdev_gendev;
|
||||
+
|
||||
+ gd->major = sd_major((index & 0xf0) >> 4);
|
||||
+ gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
|
||||
+
|
||||
+ gd->fops = &sd_fops;
|
||||
+ gd->private_data = &sdkp->driver;
|
||||
+ gd->queue = sdkp->device->request_queue;
|
||||
+
|
||||
+ /* defaults, until the device tells us otherwise */
|
||||
+ sdp->sector_size = 512;
|
||||
+ sdkp->capacity = 0;
|
||||
+ sdkp->media_present = 1;
|
||||
+ sdkp->write_prot = 0;
|
||||
+ sdkp->cache_override = 0;
|
||||
+ sdkp->WCE = 0;
|
||||
+ sdkp->RCD = 0;
|
||||
+ sdkp->ATO = 0;
|
||||
+ sdkp->first_scan = 1;
|
||||
+ sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS;
|
||||
+
|
||||
+ sd_revalidate_disk(gd);
|
||||
+
|
||||
+ gd->flags = GENHD_FL_EXT_DEVT;
|
||||
+ if (sdp->removable) {
|
||||
+ gd->flags |= GENHD_FL_REMOVABLE;
|
||||
+ gd->events |= DISK_EVENT_MEDIA_CHANGE;
|
||||
+ gd->event_flags = DISK_EVENT_FLAG_POLL | DISK_EVENT_FLAG_UEVENT;
|
||||
+ }
|
||||
+
|
||||
+ blk_pm_runtime_init(sdp->request_queue, dev);
|
||||
+ if (sdp->rpm_autosuspend) {
|
||||
+ pm_runtime_set_autosuspend_delay(dev,
|
||||
+ sdp->host->hostt->rpm_autosuspend_delay);
|
||||
+ }
|
||||
+ device_add_disk(dev, gd, NULL);
|
||||
+ if (sdkp->capacity)
|
||||
+ sd_dif_config_host(sdkp);
|
||||
+
|
||||
+ sd_revalidate_disk(gd);
|
||||
+
|
||||
+ if (sdkp->security) {
|
||||
+ sdkp->opal_dev = init_opal_dev(sdkp, &sd_sec_submit);
|
||||
+ if (sdkp->opal_dev)
|
||||
+ sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n");
|
||||
+ }
|
||||
+
|
||||
+ sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
|
||||
+ sdp->removable ? "removable " : "");
|
||||
+ scsi_autopm_put_device(sdp);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* sd_probe - called during driver initialization and whenever a
|
||||
* new scsi device is attached to the system. It is called once
|
||||
@@ -3455,54 +3517,7 @@ static int sd_probe(struct device *dev)
|
||||
|
||||
dev_set_drvdata(dev, sdkp);
|
||||
|
||||
- gd->major = sd_major((index & 0xf0) >> 4);
|
||||
- gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
|
||||
-
|
||||
- gd->fops = &sd_fops;
|
||||
- gd->private_data = &sdkp->driver;
|
||||
- gd->queue = sdkp->device->request_queue;
|
||||
-
|
||||
- /* defaults, until the device tells us otherwise */
|
||||
- sdp->sector_size = 512;
|
||||
- sdkp->capacity = 0;
|
||||
- sdkp->media_present = 1;
|
||||
- sdkp->write_prot = 0;
|
||||
- sdkp->cache_override = 0;
|
||||
- sdkp->WCE = 0;
|
||||
- sdkp->RCD = 0;
|
||||
- sdkp->ATO = 0;
|
||||
- sdkp->first_scan = 1;
|
||||
- sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS;
|
||||
-
|
||||
- sd_revalidate_disk(gd);
|
||||
-
|
||||
- gd->flags = GENHD_FL_EXT_DEVT;
|
||||
- if (sdp->removable) {
|
||||
- gd->flags |= GENHD_FL_REMOVABLE;
|
||||
- gd->events |= DISK_EVENT_MEDIA_CHANGE;
|
||||
- gd->event_flags = DISK_EVENT_FLAG_POLL | DISK_EVENT_FLAG_UEVENT;
|
||||
- }
|
||||
-
|
||||
- blk_pm_runtime_init(sdp->request_queue, dev);
|
||||
- if (sdp->rpm_autosuspend) {
|
||||
- pm_runtime_set_autosuspend_delay(dev,
|
||||
- sdp->host->hostt->rpm_autosuspend_delay);
|
||||
- }
|
||||
- device_add_disk(dev, gd, NULL);
|
||||
- if (sdkp->capacity)
|
||||
- sd_dif_config_host(sdkp);
|
||||
-
|
||||
- sd_revalidate_disk(gd);
|
||||
-
|
||||
- if (sdkp->security) {
|
||||
- sdkp->opal_dev = init_opal_dev(sdkp, &sd_sec_submit);
|
||||
- if (sdkp->opal_dev)
|
||||
- sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n");
|
||||
- }
|
||||
-
|
||||
- sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
|
||||
- sdp->removable ? "removable " : "");
|
||||
- scsi_autopm_put_device(sdp);
|
||||
+ sd_probe_part2(sdkp);
|
||||
|
||||
return 0;
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
From b5dad6e67f9704968ca7d4daf1715667cddafa3d Mon Sep 17 00:00:00 2001
|
||||
From: Jiping Ma <jiping.ma2@windriver.com>
|
||||
Date: Wed, 8 Dec 2021 18:34:59 -0800
|
||||
Subject: [PATCH 2/2] Revert commit f049cf1a7b
|
||||
|
||||
commit f049cf1a7b "scsi: sd: Rely on the driver core for asynchronous
|
||||
probing"
|
||||
|
||||
This reverts commit f049cf1a7b6737c75884247c3f6383ef104d255a,
|
||||
and it is a clean revert, there is not any conflict.
|
||||
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
|
||||
---
|
||||
drivers/scsi/scsi.c | 12 +++++++++---
|
||||
drivers/scsi/scsi_pm.c | 6 +++++-
|
||||
drivers/scsi/scsi_priv.h | 1 +
|
||||
drivers/scsi/sd.c | 12 +++++++++---
|
||||
4 files changed, 24 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
|
||||
index 24619c3bebd5..3080292a16cd 100644
|
||||
--- a/drivers/scsi/scsi.c
|
||||
+++ b/drivers/scsi/scsi.c
|
||||
@@ -86,10 +86,15 @@ unsigned int scsi_logging_level;
|
||||
EXPORT_SYMBOL(scsi_logging_level);
|
||||
#endif
|
||||
|
||||
+/* sd, scsi core and power management need to coordinate flushing async actions */
|
||||
+ASYNC_DOMAIN(scsi_sd_probe_domain);
|
||||
+EXPORT_SYMBOL(scsi_sd_probe_domain);
|
||||
+
|
||||
/*
|
||||
- * Domain for asynchronous system resume operations. It is marked 'exclusive'
|
||||
- * to avoid being included in the async_synchronize_full() that is invoked by
|
||||
- * dpm_resume().
|
||||
+ * Separate domain (from scsi_sd_probe_domain) to maximize the benefit of
|
||||
+ * asynchronous system resume operations. It is marked 'exclusive' to avoid
|
||||
+ * being included in the async_synchronize_full() that is invoked by
|
||||
+ * dpm_resume()
|
||||
*/
|
||||
ASYNC_DOMAIN_EXCLUSIVE(scsi_sd_pm_domain);
|
||||
EXPORT_SYMBOL(scsi_sd_pm_domain);
|
||||
@@ -799,6 +804,7 @@ static void __exit exit_scsi(void)
|
||||
scsi_exit_devinfo();
|
||||
scsi_exit_procfs();
|
||||
scsi_exit_queue();
|
||||
+ async_unregister_domain(&scsi_sd_probe_domain);
|
||||
}
|
||||
|
||||
subsys_initcall(init_scsi);
|
||||
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
|
||||
index 3717eea37ecb..b3d71b516213 100644
|
||||
--- a/drivers/scsi/scsi_pm.c
|
||||
+++ b/drivers/scsi/scsi_pm.c
|
||||
@@ -175,7 +175,11 @@ static int scsi_bus_resume_common(struct device *dev,
|
||||
|
||||
static int scsi_bus_prepare(struct device *dev)
|
||||
{
|
||||
- if (scsi_is_host_device(dev)) {
|
||||
+ if (scsi_is_sdev_device(dev)) {
|
||||
+ /* sd probing uses async_schedule. Wait until it finishes. */
|
||||
+ async_synchronize_full_domain(&scsi_sd_probe_domain);
|
||||
+
|
||||
+ } else if (scsi_is_host_device(dev)) {
|
||||
/* Wait until async scanning is finished */
|
||||
scsi_complete_async_scans();
|
||||
}
|
||||
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
|
||||
index 180636d54982..c43456f0870c 100644
|
||||
--- a/drivers/scsi/scsi_priv.h
|
||||
+++ b/drivers/scsi/scsi_priv.h
|
||||
@@ -172,6 +172,7 @@ static inline void scsi_autopm_put_host(struct Scsi_Host *h) {}
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
extern struct async_domain scsi_sd_pm_domain;
|
||||
+extern struct async_domain scsi_sd_probe_domain;
|
||||
|
||||
/* scsi_dh.c */
|
||||
#ifdef CONFIG_SCSI_DH
|
||||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
|
||||
index 2e22ee4501e7..e6c70475f084 100644
|
||||
--- a/drivers/scsi/sd.c
|
||||
+++ b/drivers/scsi/sd.c
|
||||
@@ -616,7 +616,6 @@ static struct scsi_driver sd_template = {
|
||||
.name = "sd",
|
||||
.owner = THIS_MODULE,
|
||||
.probe = sd_probe,
|
||||
- .probe_type = PROBE_PREFER_ASYNCHRONOUS,
|
||||
.remove = sd_remove,
|
||||
.shutdown = sd_shutdown,
|
||||
.pm = &sd_pm_ops,
|
||||
@@ -3364,8 +3363,12 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void sd_probe_part2(struct scsi_disk *sdkp)
|
||||
+/*
|
||||
+ * The asynchronous part of sd_probe
|
||||
+ */
|
||||
+static void sd_probe_async(void *data, async_cookie_t cookie)
|
||||
{
|
||||
+ struct scsi_disk *sdkp = data;
|
||||
struct scsi_device *sdp;
|
||||
struct gendisk *gd;
|
||||
u32 index;
|
||||
@@ -3424,6 +3427,7 @@ static void sd_probe_part2(struct scsi_disk *sdkp)
|
||||
sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
|
||||
sdp->removable ? "removable " : "");
|
||||
scsi_autopm_put_device(sdp);
|
||||
+ put_device(&sdkp->dev);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3517,7 +3521,8 @@ static int sd_probe(struct device *dev)
|
||||
|
||||
dev_set_drvdata(dev, sdkp);
|
||||
|
||||
- sd_probe_part2(sdkp);
|
||||
+ get_device(&sdkp->dev); /* prevent release before async_schedule */
|
||||
+ async_schedule_domain(sd_probe_async, sdkp, &scsi_sd_probe_domain);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -3554,6 +3559,7 @@ static int sd_remove(struct device *dev)
|
||||
scsi_autopm_get_device(sdkp->device);
|
||||
|
||||
async_synchronize_full_domain(&scsi_sd_pm_domain);
|
||||
+ async_synchronize_full_domain(&scsi_sd_probe_domain);
|
||||
device_del(&sdkp->dev);
|
||||
del_gendisk(sdkp->disk);
|
||||
sd_shutdown(dev);
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
From 7c2dc6277376104f8cfe7f8d07c77f6d7155fb73 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Tue, 18 May 2021 11:17:26 +0200
|
||||
Subject: [PATCH] genirq: Export affinity setter for modules
|
||||
|
||||
Perf modules abuse irq_set_affinity_hint() to set the affinity of system
|
||||
PMU interrupts just because irq_set_affinity() was not exported.
|
||||
|
||||
The fact that irq_set_affinity_hint() actually sets the affinity is a
|
||||
non-documented side effect and the name is clearly saying it's a hint.
|
||||
|
||||
To clean this up, export the real affinity setter.
|
||||
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Acked-by: Mark Rutland <mark.rutland@arm.com>
|
||||
Link: https://lore.kernel.org/r/20210518093117.968251441@linutronix.de
|
||||
(cherry picked from commit 4d80d6ca5d77fde9880da8466e5b64f250e5bf82)
|
||||
[mvb: Adjust context for a function that does not exist in v5.10.]
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
include/linux/interrupt.h | 35 ++---------------------------------
|
||||
kernel/irq/manage.c | 33 ++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 34 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
|
||||
index ee8299eb1f52..087a1cfad35c 100644
|
||||
--- a/include/linux/interrupt.h
|
||||
+++ b/include/linux/interrupt.h
|
||||
@@ -314,39 +314,8 @@ struct irq_affinity_desc {
|
||||
|
||||
extern cpumask_var_t irq_default_affinity;
|
||||
|
||||
-/* Internal implementation. Use the helpers below */
|
||||
-extern int __irq_set_affinity(unsigned int irq, const struct cpumask *cpumask,
|
||||
- bool force);
|
||||
-
|
||||
-/**
|
||||
- * irq_set_affinity - Set the irq affinity of a given irq
|
||||
- * @irq: Interrupt to set affinity
|
||||
- * @cpumask: cpumask
|
||||
- *
|
||||
- * Fails if cpumask does not contain an online CPU
|
||||
- */
|
||||
-static inline int
|
||||
-irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
|
||||
-{
|
||||
- return __irq_set_affinity(irq, cpumask, false);
|
||||
-}
|
||||
-
|
||||
-/**
|
||||
- * irq_force_affinity - Force the irq affinity of a given irq
|
||||
- * @irq: Interrupt to set affinity
|
||||
- * @cpumask: cpumask
|
||||
- *
|
||||
- * Same as irq_set_affinity, but without checking the mask against
|
||||
- * online cpus.
|
||||
- *
|
||||
- * Solely for low level cpu hotplug code, where we need to make per
|
||||
- * cpu interrupts affine before the cpu becomes online.
|
||||
- */
|
||||
-static inline int
|
||||
-irq_force_affinity(unsigned int irq, const struct cpumask *cpumask)
|
||||
-{
|
||||
- return __irq_set_affinity(irq, cpumask, true);
|
||||
-}
|
||||
+extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask);
|
||||
+extern int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask);
|
||||
|
||||
extern int irq_can_set_affinity(unsigned int irq);
|
||||
extern int irq_select_affinity(unsigned int irq);
|
||||
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
|
||||
index 420b5ce0bf89..eeedb6224e2f 100644
|
||||
--- a/kernel/irq/manage.c
|
||||
+++ b/kernel/irq/manage.c
|
||||
@@ -371,7 +371,8 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask,
|
||||
return ret;
|
||||
}
|
||||
|
||||
-int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force)
|
||||
+static int __irq_set_affinity(unsigned int irq, const struct cpumask *mask,
|
||||
+ bool force)
|
||||
{
|
||||
struct irq_desc *desc = irq_to_desc(irq);
|
||||
unsigned long flags;
|
||||
@@ -386,6 +387,36 @@ int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * irq_set_affinity - Set the irq affinity of a given irq
|
||||
+ * @irq: Interrupt to set affinity
|
||||
+ * @cpumask: cpumask
|
||||
+ *
|
||||
+ * Fails if cpumask does not contain an online CPU
|
||||
+ */
|
||||
+int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
|
||||
+{
|
||||
+ return __irq_set_affinity(irq, cpumask, false);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(irq_set_affinity);
|
||||
+
|
||||
+/**
|
||||
+ * irq_force_affinity - Force the irq affinity of a given irq
|
||||
+ * @irq: Interrupt to set affinity
|
||||
+ * @cpumask: cpumask
|
||||
+ *
|
||||
+ * Same as irq_set_affinity, but without checking the mask against
|
||||
+ * online cpus.
|
||||
+ *
|
||||
+ * Solely for low level cpu hotplug code, where we need to make per
|
||||
+ * cpu interrupts affine before the cpu becomes online.
|
||||
+ */
|
||||
+int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask)
|
||||
+{
|
||||
+ return __irq_set_affinity(irq, cpumask, true);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(irq_force_affinity);
|
||||
+
|
||||
int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
|
||||
{
|
||||
unsigned long flags;
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
From d4b260fea6b5d7f0da84236f97b385312ab2e0ac Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Fri, 3 Sep 2021 11:24:17 -0400
|
||||
Subject: [PATCH] genirq: Provide new interfaces for affinity hints
|
||||
|
||||
The discussion about removing the side effect of irq_set_affinity_hint() of
|
||||
actually applying the cpumask (if not NULL) as affinity to the interrupt,
|
||||
unearthed a few unpleasantries:
|
||||
|
||||
1) The modular perf drivers rely on the current behaviour for the very
|
||||
wrong reasons.
|
||||
|
||||
2) While none of the other drivers prevents user space from changing
|
||||
the affinity, a cursorily inspection shows that there are at least
|
||||
expectations in some drivers.
|
||||
|
||||
#1 needs to be cleaned up anyway, so that's not a problem
|
||||
|
||||
#2 might result in subtle regressions especially when irqbalanced (which
|
||||
nowadays ignores the affinity hint) is disabled.
|
||||
|
||||
Provide new interfaces:
|
||||
|
||||
irq_update_affinity_hint() - Only sets the affinity hint pointer
|
||||
irq_set_affinity_and_hint() - Set the pointer and apply the affinity to
|
||||
the interrupt
|
||||
|
||||
Make irq_set_affinity_hint() a wrapper around irq_apply_affinity_hint() and
|
||||
document it to be phased out.
|
||||
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Reviewed-by: Ming Lei <ming.lei@redhat.com>
|
||||
Link: https://lore.kernel.org/r/20210501021832.743094-1-jesse.brandeburg@intel.com
|
||||
Link: https://lore.kernel.org/r/20210903152430.244937-2-nitesh@redhat.com
|
||||
(cherry picked from commit 65c7cdedeb3026fabcc967a7aae2f755ad4d0783)
|
||||
[mvb: Adapt to v5.10 by resolving a minor merge conflict.]
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
include/linux/interrupt.h | 52 ++++++++++++++++++++++++++++++++++++++-
|
||||
kernel/irq/manage.c | 8 +++---
|
||||
2 files changed, 55 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
|
||||
index 087a1cfad35c..72350bdee846 100644
|
||||
--- a/include/linux/interrupt.h
|
||||
+++ b/include/linux/interrupt.h
|
||||
@@ -320,7 +320,45 @@ extern int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask);
|
||||
extern int irq_can_set_affinity(unsigned int irq);
|
||||
extern int irq_select_affinity(unsigned int irq);
|
||||
|
||||
-extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
|
||||
+extern int __irq_apply_affinity_hint(unsigned int irq, const struct cpumask *m,
|
||||
+ bool setaffinity);
|
||||
+
|
||||
+/**
|
||||
+ * irq_update_affinity_hint - Update the affinity hint
|
||||
+ * @irq: Interrupt to update
|
||||
+ * @m: cpumask pointer (NULL to clear the hint)
|
||||
+ *
|
||||
+ * Updates the affinity hint, but does not change the affinity of the interrupt.
|
||||
+ */
|
||||
+static inline int
|
||||
+irq_update_affinity_hint(unsigned int irq, const struct cpumask *m)
|
||||
+{
|
||||
+ return __irq_apply_affinity_hint(irq, m, false);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * irq_set_affinity_and_hint - Update the affinity hint and apply the provided
|
||||
+ * cpumask to the interrupt
|
||||
+ * @irq: Interrupt to update
|
||||
+ * @m: cpumask pointer (NULL to clear the hint)
|
||||
+ *
|
||||
+ * Updates the affinity hint and if @m is not NULL it applies it as the
|
||||
+ * affinity of that interrupt.
|
||||
+ */
|
||||
+static inline int
|
||||
+irq_set_affinity_and_hint(unsigned int irq, const struct cpumask *m)
|
||||
+{
|
||||
+ return __irq_apply_affinity_hint(irq, m, true);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Deprecated. Use irq_update_affinity_hint() or irq_set_affinity_and_hint()
|
||||
+ * instead.
|
||||
+ */
|
||||
+static inline int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
|
||||
+{
|
||||
+ return irq_set_affinity_and_hint(irq, m);
|
||||
+}
|
||||
|
||||
extern int
|
||||
irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
|
||||
@@ -350,6 +388,18 @@ static inline int irq_can_set_affinity(unsigned int irq)
|
||||
|
||||
static inline int irq_select_affinity(unsigned int irq) { return 0; }
|
||||
|
||||
+static inline int irq_update_affinity_hint(unsigned int irq,
|
||||
+ const struct cpumask *m)
|
||||
+{
|
||||
+ return -EINVAL;
|
||||
+}
|
||||
+
|
||||
+static inline int irq_set_affinity_and_hint(unsigned int irq,
|
||||
+ const struct cpumask *m)
|
||||
+{
|
||||
+ return -EINVAL;
|
||||
+}
|
||||
+
|
||||
static inline int irq_set_affinity_hint(unsigned int irq,
|
||||
const struct cpumask *m)
|
||||
{
|
||||
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
|
||||
index eeedb6224e2f..63e7de3683d2 100644
|
||||
--- a/kernel/irq/manage.c
|
||||
+++ b/kernel/irq/manage.c
|
||||
@@ -417,7 +417,8 @@ int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(irq_force_affinity);
|
||||
|
||||
-int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
|
||||
+int __irq_apply_affinity_hint(unsigned int irq, const struct cpumask *m,
|
||||
+ bool setaffinity)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct irq_desc *desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
|
||||
@@ -426,12 +427,11 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
|
||||
return -EINVAL;
|
||||
desc->affinity_hint = m;
|
||||
irq_put_desc_unlock(desc, flags);
|
||||
- /* set the initial affinity to prevent every interrupt being on CPU0 */
|
||||
- if (m)
|
||||
+ if (m && setaffinity)
|
||||
__irq_set_affinity(irq, m, false);
|
||||
return 0;
|
||||
}
|
||||
-EXPORT_SYMBOL_GPL(irq_set_affinity_hint);
|
||||
+EXPORT_SYMBOL_GPL(__irq_apply_affinity_hint);
|
||||
|
||||
static void irq_affinity_notify(struct work_struct *work)
|
||||
{
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
From 07298341feaa2c35fdd225735b4ee5299efb112f Mon Sep 17 00:00:00 2001
|
||||
From: Nitesh Narayan Lal <nitesh@redhat.com>
|
||||
Date: Fri, 3 Sep 2021 11:24:25 -0400
|
||||
Subject: [PATCH] ixgbe: Use irq_update_affinity_hint()
|
||||
|
||||
The driver uses irq_set_affinity_hint() to update the affinity_hint mask
|
||||
that is consumed by the userspace to distribute the interrupts. However,
|
||||
under the hood irq_set_affinity_hint() also applies the provided cpumask
|
||||
(if not NULL) as the affinity for the given interrupt which is an
|
||||
undocumented side effect.
|
||||
|
||||
To remove this side effect irq_set_affinity_hint() has been marked
|
||||
as deprecated and new interfaces have been introduced. Hence, replace the
|
||||
irq_set_affinity_hint() with the new interface irq_update_affinity_hint()
|
||||
that only updates the affinity_hint pointer.
|
||||
|
||||
Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
|
||||
Link: https://lore.kernel.org/r/20210903152430.244937-10-nitesh@redhat.com
|
||||
(cherry picked from commit cc493264c01d055742a34cfbaecaffb258dcc58c)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
|
||||
index ffe322136c58..fe10776d8479 100644
|
||||
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
|
||||
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
|
||||
@@ -3250,8 +3250,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
|
||||
/* If Flow Director is enabled, set interrupt affinity */
|
||||
if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
|
||||
/* assign the mask for this irq */
|
||||
- irq_set_affinity_hint(entry->vector,
|
||||
- &q_vector->affinity_mask);
|
||||
+ irq_update_affinity_hint(entry->vector,
|
||||
+ &q_vector->affinity_mask);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3267,8 +3267,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
|
||||
free_queue_irqs:
|
||||
while (vector) {
|
||||
vector--;
|
||||
- irq_set_affinity_hint(adapter->msix_entries[vector].vector,
|
||||
- NULL);
|
||||
+ irq_update_affinity_hint(adapter->msix_entries[vector].vector,
|
||||
+ NULL);
|
||||
free_irq(adapter->msix_entries[vector].vector,
|
||||
adapter->q_vector[vector]);
|
||||
}
|
||||
@@ -3401,7 +3401,7 @@ static void ixgbe_free_irq(struct ixgbe_adapter *adapter)
|
||||
continue;
|
||||
|
||||
/* clear the affinity_mask in the IRQ descriptor */
|
||||
- irq_set_affinity_hint(entry->vector, NULL);
|
||||
+ irq_update_affinity_hint(entry->vector, NULL);
|
||||
|
||||
free_irq(entry->vector, q_vector);
|
||||
}
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,743 +0,0 @@
|
||||
From a6492f505f12f830372636043098ad9dab3607d6 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Ertman <david.m.ertman@intel.com>
|
||||
Date: Wed, 2 Dec 2020 16:54:24 -0800
|
||||
Subject: [PATCH] Add auxiliary bus support
|
||||
|
||||
Add support for the Auxiliary Bus, auxiliary_device and auxiliary_driver.
|
||||
It enables drivers to create an auxiliary_device and bind an
|
||||
auxiliary_driver to it.
|
||||
|
||||
The bus supports probe/remove shutdown and suspend/resume callbacks.
|
||||
Each auxiliary_device has a unique string based id; driver binds to
|
||||
an auxiliary_device based on this id through the bus.
|
||||
|
||||
Co-developed-by: Kiran Patil <kiran.patil@intel.com>
|
||||
Co-developed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
|
||||
Co-developed-by: Fred Oh <fred.oh@linux.intel.com>
|
||||
Co-developed-by: Leon Romanovsky <leonro@nvidia.com>
|
||||
Signed-off-by: Kiran Patil <kiran.patil@intel.com>
|
||||
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
|
||||
Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
|
||||
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
|
||||
Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
|
||||
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
|
||||
Reviewed-by: Shiraz Saleem <shiraz.saleem@intel.com>
|
||||
Reviewed-by: Parav Pandit <parav@mellanox.com>
|
||||
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
|
||||
Reviewed-by: Martin Habets <mhabets@solarflare.com>
|
||||
Link: https://lore.kernel.org/r/20201113161859.1775473-2-david.m.ertman@intel.com
|
||||
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
|
||||
Link: https://lore.kernel.org/r/160695681289.505290.8978295443574440604.stgit@dwillia2-desk3.amr.corp.intel.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
(cherry picked from commit 7de3697e9cbd4bd3d62bafa249d57990e1b8f294)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
Documentation/driver-api/auxiliary_bus.rst | 234 ++++++++++++++++++
|
||||
Documentation/driver-api/index.rst | 1 +
|
||||
drivers/base/Kconfig | 3 +
|
||||
drivers/base/Makefile | 1 +
|
||||
drivers/base/auxiliary.c | 268 +++++++++++++++++++++
|
||||
include/linux/auxiliary_bus.h | 78 ++++++
|
||||
include/linux/mod_devicetable.h | 8 +
|
||||
scripts/mod/devicetable-offsets.c | 3 +
|
||||
scripts/mod/file2alias.c | 8 +
|
||||
9 files changed, 604 insertions(+)
|
||||
create mode 100644 Documentation/driver-api/auxiliary_bus.rst
|
||||
create mode 100644 drivers/base/auxiliary.c
|
||||
create mode 100644 include/linux/auxiliary_bus.h
|
||||
|
||||
diff --git a/Documentation/driver-api/auxiliary_bus.rst b/Documentation/driver-api/auxiliary_bus.rst
|
||||
new file mode 100644
|
||||
index 000000000000..5dd7804631ef
|
||||
--- /dev/null
|
||||
+++ b/Documentation/driver-api/auxiliary_bus.rst
|
||||
@@ -0,0 +1,234 @@
|
||||
+.. SPDX-License-Identifier: GPL-2.0-only
|
||||
+
|
||||
+=============
|
||||
+Auxiliary Bus
|
||||
+=============
|
||||
+
|
||||
+In some subsystems, the functionality of the core device (PCI/ACPI/other) is
|
||||
+too complex for a single device to be managed by a monolithic driver
|
||||
+(e.g. Sound Open Firmware), multiple devices might implement a common
|
||||
+intersection of functionality (e.g. NICs + RDMA), or a driver may want to
|
||||
+export an interface for another subsystem to drive (e.g. SIOV Physical Function
|
||||
+export Virtual Function management). A split of the functinoality into child-
|
||||
+devices representing sub-domains of functionality makes it possible to
|
||||
+compartmentalize, layer, and distribute domain-specific concerns via a Linux
|
||||
+device-driver model.
|
||||
+
|
||||
+An example for this kind of requirement is the audio subsystem where a single
|
||||
+IP is handling multiple entities such as HDMI, Soundwire, local devices such as
|
||||
+mics/speakers etc. The split for the core's functionality can be arbitrary or
|
||||
+be defined by the DSP firmware topology and include hooks for test/debug. This
|
||||
+allows for the audio core device to be minimal and focused on hardware-specific
|
||||
+control and communication.
|
||||
+
|
||||
+Each auxiliary_device represents a part of its parent functionality. The
|
||||
+generic behavior can be extended and specialized as needed by encapsulating an
|
||||
+auxiliary_device within other domain-specific structures and the use of .ops
|
||||
+callbacks. Devices on the auxiliary bus do not share any structures and the use
|
||||
+of a communication channel with the parent is domain-specific.
|
||||
+
|
||||
+Note that ops are intended as a way to augment instance behavior within a class
|
||||
+of auxiliary devices, it is not the mechanism for exporting common
|
||||
+infrastructure from the parent. Consider EXPORT_SYMBOL_NS() to convey
|
||||
+infrastructure from the parent module to the auxiliary module(s).
|
||||
+
|
||||
+
|
||||
+When Should the Auxiliary Bus Be Used
|
||||
+=====================================
|
||||
+
|
||||
+The auxiliary bus is to be used when a driver and one or more kernel modules,
|
||||
+who share a common header file with the driver, need a mechanism to connect and
|
||||
+provide access to a shared object allocated by the auxiliary_device's
|
||||
+registering driver. The registering driver for the auxiliary_device(s) and the
|
||||
+kernel module(s) registering auxiliary_drivers can be from the same subsystem,
|
||||
+or from multiple subsystems.
|
||||
+
|
||||
+The emphasis here is on a common generic interface that keeps subsystem
|
||||
+customization out of the bus infrastructure.
|
||||
+
|
||||
+One example is a PCI network device that is RDMA-capable and exports a child
|
||||
+device to be driven by an auxiliary_driver in the RDMA subsystem. The PCI
|
||||
+driver allocates and registers an auxiliary_device for each physical
|
||||
+function on the NIC. The RDMA driver registers an auxiliary_driver that claims
|
||||
+each of these auxiliary_devices. This conveys data/ops published by the parent
|
||||
+PCI device/driver to the RDMA auxiliary_driver.
|
||||
+
|
||||
+Another use case is for the PCI device to be split out into multiple sub
|
||||
+functions. For each sub function an auxiliary_device is created. A PCI sub
|
||||
+function driver binds to such devices that creates its own one or more class
|
||||
+devices. A PCI sub function auxiliary device is likely to be contained in a
|
||||
+struct with additional attributes such as user defined sub function number and
|
||||
+optional attributes such as resources and a link to the parent device. These
|
||||
+attributes could be used by systemd/udev; and hence should be initialized
|
||||
+before a driver binds to an auxiliary_device.
|
||||
+
|
||||
+A key requirement for utilizing the auxiliary bus is that there is no
|
||||
+dependency on a physical bus, device, register accesses or regmap support.
|
||||
+These individual devices split from the core cannot live on the platform bus as
|
||||
+they are not physical devices that are controlled by DT/ACPI. The same
|
||||
+argument applies for not using MFD in this scenario as MFD relies on individual
|
||||
+function devices being physical devices.
|
||||
+
|
||||
+Auxiliary Device
|
||||
+================
|
||||
+
|
||||
+An auxiliary_device represents a part of its parent device's functionality. It
|
||||
+is given a name that, combined with the registering drivers KBUILD_MODNAME,
|
||||
+creates a match_name that is used for driver binding, and an id that combined
|
||||
+with the match_name provide a unique name to register with the bus subsystem.
|
||||
+
|
||||
+Registering an auxiliary_device is a two-step process. First call
|
||||
+auxiliary_device_init(), which checks several aspects of the auxiliary_device
|
||||
+struct and performs a device_initialize(). After this step completes, any
|
||||
+error state must have a call to auxiliary_device_uninit() in its resolution path.
|
||||
+The second step in registering an auxiliary_device is to perform a call to
|
||||
+auxiliary_device_add(), which sets the name of the device and add the device to
|
||||
+the bus.
|
||||
+
|
||||
+Unregistering an auxiliary_device is also a two-step process to mirror the
|
||||
+register process. First call auxiliary_device_delete(), then call
|
||||
+auxiliary_device_uninit().
|
||||
+
|
||||
+.. code-block:: c
|
||||
+
|
||||
+ struct auxiliary_device {
|
||||
+ struct device dev;
|
||||
+ const char *name;
|
||||
+ u32 id;
|
||||
+ };
|
||||
+
|
||||
+If two auxiliary_devices both with a match_name "mod.foo" are registered onto
|
||||
+the bus, they must have unique id values (e.g. "x" and "y") so that the
|
||||
+registered devices names are "mod.foo.x" and "mod.foo.y". If match_name + id
|
||||
+are not unique, then the device_add fails and generates an error message.
|
||||
+
|
||||
+The auxiliary_device.dev.type.release or auxiliary_device.dev.release must be
|
||||
+populated with a non-NULL pointer to successfully register the auxiliary_device.
|
||||
+
|
||||
+The auxiliary_device.dev.parent must also be populated.
|
||||
+
|
||||
+Auxiliary Device Memory Model and Lifespan
|
||||
+------------------------------------------
|
||||
+
|
||||
+The registering driver is the entity that allocates memory for the
|
||||
+auxiliary_device and register it on the auxiliary bus. It is important to note
|
||||
+that, as opposed to the platform bus, the registering driver is wholly
|
||||
+responsible for the management for the memory used for the driver object.
|
||||
+
|
||||
+A parent object, defined in the shared header file, contains the
|
||||
+auxiliary_device. It also contains a pointer to the shared object(s), which
|
||||
+also is defined in the shared header. Both the parent object and the shared
|
||||
+object(s) are allocated by the registering driver. This layout allows the
|
||||
+auxiliary_driver's registering module to perform a container_of() call to go
|
||||
+from the pointer to the auxiliary_device, that is passed during the call to the
|
||||
+auxiliary_driver's probe function, up to the parent object, and then have
|
||||
+access to the shared object(s).
|
||||
+
|
||||
+The memory for the auxiliary_device is freed only in its release() callback
|
||||
+flow as defined by its registering driver.
|
||||
+
|
||||
+The memory for the shared object(s) must have a lifespan equal to, or greater
|
||||
+than, the lifespan of the memory for the auxiliary_device. The auxiliary_driver
|
||||
+should only consider that this shared object is valid as long as the
|
||||
+auxiliary_device is still registered on the auxiliary bus. It is up to the
|
||||
+registering driver to manage (e.g. free or keep available) the memory for the
|
||||
+shared object beyond the life of the auxiliary_device.
|
||||
+
|
||||
+The registering driver must unregister all auxiliary devices before its own
|
||||
+driver.remove() is completed.
|
||||
+
|
||||
+Auxiliary Drivers
|
||||
+=================
|
||||
+
|
||||
+Auxiliary drivers follow the standard driver model convention, where
|
||||
+discovery/enumeration is handled by the core, and drivers
|
||||
+provide probe() and remove() methods. They support power management
|
||||
+and shutdown notifications using the standard conventions.
|
||||
+
|
||||
+.. code-block:: c
|
||||
+
|
||||
+ struct auxiliary_driver {
|
||||
+ int (*probe)(struct auxiliary_device *,
|
||||
+ const struct auxiliary_device_id *id);
|
||||
+ int (*remove)(struct auxiliary_device *);
|
||||
+ void (*shutdown)(struct auxiliary_device *);
|
||||
+ int (*suspend)(struct auxiliary_device *, pm_message_t);
|
||||
+ int (*resume)(struct auxiliary_device *);
|
||||
+ struct device_driver driver;
|
||||
+ const struct auxiliary_device_id *id_table;
|
||||
+ };
|
||||
+
|
||||
+Auxiliary drivers register themselves with the bus by calling
|
||||
+auxiliary_driver_register(). The id_table contains the match_names of auxiliary
|
||||
+devices that a driver can bind with.
|
||||
+
|
||||
+Example Usage
|
||||
+=============
|
||||
+
|
||||
+Auxiliary devices are created and registered by a subsystem-level core device
|
||||
+that needs to break up its functionality into smaller fragments. One way to
|
||||
+extend the scope of an auxiliary_device is to encapsulate it within a domain-
|
||||
+pecific structure defined by the parent device. This structure contains the
|
||||
+auxiliary_device and any associated shared data/callbacks needed to establish
|
||||
+the connection with the parent.
|
||||
+
|
||||
+An example is:
|
||||
+
|
||||
+.. code-block:: c
|
||||
+
|
||||
+ struct foo {
|
||||
+ struct auxiliary_device auxdev;
|
||||
+ void (*connect)(struct auxiliary_device *auxdev);
|
||||
+ void (*disconnect)(struct auxiliary_device *auxdev);
|
||||
+ void *data;
|
||||
+ };
|
||||
+
|
||||
+The parent device then registers the auxiliary_device by calling
|
||||
+auxiliary_device_init(), and then auxiliary_device_add(), with the pointer to
|
||||
+the auxdev member of the above structure. The parent provides a name for the
|
||||
+auxiliary_device that, combined with the parent's KBUILD_MODNAME, creates a
|
||||
+match_name that is be used for matching and binding with a driver.
|
||||
+
|
||||
+Whenever an auxiliary_driver is registered, based on the match_name, the
|
||||
+auxiliary_driver's probe() is invoked for the matching devices. The
|
||||
+auxiliary_driver can also be encapsulated inside custom drivers that make the
|
||||
+core device's functionality extensible by adding additional domain-specific ops
|
||||
+as follows:
|
||||
+
|
||||
+.. code-block:: c
|
||||
+
|
||||
+ struct my_ops {
|
||||
+ void (*send)(struct auxiliary_device *auxdev);
|
||||
+ void (*receive)(struct auxiliary_device *auxdev);
|
||||
+ };
|
||||
+
|
||||
+
|
||||
+ struct my_driver {
|
||||
+ struct auxiliary_driver auxiliary_drv;
|
||||
+ const struct my_ops ops;
|
||||
+ };
|
||||
+
|
||||
+An example of this type of usage is:
|
||||
+
|
||||
+.. code-block:: c
|
||||
+
|
||||
+ const struct auxiliary_device_id my_auxiliary_id_table[] = {
|
||||
+ { .name = "foo_mod.foo_dev" },
|
||||
+ { },
|
||||
+ };
|
||||
+
|
||||
+ const struct my_ops my_custom_ops = {
|
||||
+ .send = my_tx,
|
||||
+ .receive = my_rx,
|
||||
+ };
|
||||
+
|
||||
+ const struct my_driver my_drv = {
|
||||
+ .auxiliary_drv = {
|
||||
+ .name = "myauxiliarydrv",
|
||||
+ .id_table = my_auxiliary_id_table,
|
||||
+ .probe = my_probe,
|
||||
+ .remove = my_remove,
|
||||
+ .shutdown = my_shutdown,
|
||||
+ },
|
||||
+ .ops = my_custom_ops,
|
||||
+ };
|
||||
diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst
|
||||
index f357f3eb400c..86759a74b7f1 100644
|
||||
--- a/Documentation/driver-api/index.rst
|
||||
+++ b/Documentation/driver-api/index.rst
|
||||
@@ -72,6 +72,7 @@ available subsections can be seen below.
|
||||
thermal/index
|
||||
fpga/index
|
||||
acpi/index
|
||||
+ auxiliary_bus
|
||||
backlight/lp855x-driver.rst
|
||||
connector
|
||||
console
|
||||
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
|
||||
index 8d7001712062..040be48ce046 100644
|
||||
--- a/drivers/base/Kconfig
|
||||
+++ b/drivers/base/Kconfig
|
||||
@@ -1,6 +1,9 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
menu "Generic Driver Options"
|
||||
|
||||
+config AUXILIARY_BUS
|
||||
+ bool
|
||||
+
|
||||
config UEVENT_HELPER
|
||||
bool "Support for uevent helper"
|
||||
help
|
||||
diff --git a/drivers/base/Makefile b/drivers/base/Makefile
|
||||
index 41369fc7004f..5e7bf9669a81 100644
|
||||
--- a/drivers/base/Makefile
|
||||
+++ b/drivers/base/Makefile
|
||||
@@ -7,6 +7,7 @@ obj-y := component.o core.o bus.o dd.o syscore.o \
|
||||
attribute_container.o transport_class.o \
|
||||
topology.o container.o property.o cacheinfo.o \
|
||||
swnode.o
|
||||
+obj-$(CONFIG_AUXILIARY_BUS) += auxiliary.o
|
||||
obj-$(CONFIG_DEVTMPFS) += devtmpfs.o
|
||||
obj-y += power/
|
||||
obj-$(CONFIG_ISA_BUS_API) += isa.o
|
||||
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
|
||||
new file mode 100644
|
||||
index 000000000000..ef2af417438b
|
||||
--- /dev/null
|
||||
+++ b/drivers/base/auxiliary.c
|
||||
@@ -0,0 +1,268 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/*
|
||||
+ * Copyright (c) 2019-2020 Intel Corporation
|
||||
+ *
|
||||
+ * Please see Documentation/driver-api/auxiliary_bus.rst for more information.
|
||||
+ */
|
||||
+
|
||||
+#define pr_fmt(fmt) "%s:%s: " fmt, KBUILD_MODNAME, __func__
|
||||
+
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/pm_domain.h>
|
||||
+#include <linux/pm_runtime.h>
|
||||
+#include <linux/string.h>
|
||||
+#include <linux/auxiliary_bus.h>
|
||||
+
|
||||
+static const struct auxiliary_device_id *auxiliary_match_id(const struct auxiliary_device_id *id,
|
||||
+ const struct auxiliary_device *auxdev)
|
||||
+{
|
||||
+ for (; id->name[0]; id++) {
|
||||
+ const char *p = strrchr(dev_name(&auxdev->dev), '.');
|
||||
+ int match_size;
|
||||
+
|
||||
+ if (!p)
|
||||
+ continue;
|
||||
+ match_size = p - dev_name(&auxdev->dev);
|
||||
+
|
||||
+ /* use dev_name(&auxdev->dev) prefix before last '.' char to match to */
|
||||
+ if (strlen(id->name) == match_size &&
|
||||
+ !strncmp(dev_name(&auxdev->dev), id->name, match_size))
|
||||
+ return id;
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int auxiliary_match(struct device *dev, struct device_driver *drv)
|
||||
+{
|
||||
+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
|
||||
+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv);
|
||||
+
|
||||
+ return !!auxiliary_match_id(auxdrv->id_table, auxdev);
|
||||
+}
|
||||
+
|
||||
+static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
+{
|
||||
+ const char *name, *p;
|
||||
+
|
||||
+ name = dev_name(dev);
|
||||
+ p = strrchr(name, '.');
|
||||
+
|
||||
+ return add_uevent_var(env, "MODALIAS=%s%.*s", AUXILIARY_MODULE_PREFIX, (int)(p - name),
|
||||
+ name);
|
||||
+}
|
||||
+
|
||||
+static const struct dev_pm_ops auxiliary_dev_pm_ops = {
|
||||
+ SET_RUNTIME_PM_OPS(pm_generic_runtime_suspend, pm_generic_runtime_resume, NULL)
|
||||
+ SET_SYSTEM_SLEEP_PM_OPS(pm_generic_suspend, pm_generic_resume)
|
||||
+};
|
||||
+
|
||||
+static int auxiliary_bus_probe(struct device *dev)
|
||||
+{
|
||||
+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
|
||||
+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = dev_pm_domain_attach(dev, true);
|
||||
+ if (ret) {
|
||||
+ dev_warn(dev, "Failed to attach to PM Domain : %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = auxdrv->probe(auxdev, auxiliary_match_id(auxdrv->id_table, auxdev));
|
||||
+ if (ret)
|
||||
+ dev_pm_domain_detach(dev, true);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int auxiliary_bus_remove(struct device *dev)
|
||||
+{
|
||||
+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
|
||||
+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (auxdrv->remove)
|
||||
+ ret = auxdrv->remove(auxdev);
|
||||
+ dev_pm_domain_detach(dev, true);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void auxiliary_bus_shutdown(struct device *dev)
|
||||
+{
|
||||
+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
|
||||
+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
|
||||
+
|
||||
+ if (auxdrv->shutdown)
|
||||
+ auxdrv->shutdown(auxdev);
|
||||
+}
|
||||
+
|
||||
+static struct bus_type auxiliary_bus_type = {
|
||||
+ .name = "auxiliary",
|
||||
+ .probe = auxiliary_bus_probe,
|
||||
+ .remove = auxiliary_bus_remove,
|
||||
+ .shutdown = auxiliary_bus_shutdown,
|
||||
+ .match = auxiliary_match,
|
||||
+ .uevent = auxiliary_uevent,
|
||||
+ .pm = &auxiliary_dev_pm_ops,
|
||||
+};
|
||||
+
|
||||
+/**
|
||||
+ * auxiliary_device_init - check auxiliary_device and initialize
|
||||
+ * @auxdev: auxiliary device struct
|
||||
+ *
|
||||
+ * This is the first step in the two-step process to register an auxiliary_device.
|
||||
+ *
|
||||
+ * When this function returns an error code, then the device_initialize will *not* have
|
||||
+ * been performed, and the caller will be responsible to free any memory allocated for the
|
||||
+ * auxiliary_device in the error path directly.
|
||||
+ *
|
||||
+ * It returns 0 on success. On success, the device_initialize has been performed. After this
|
||||
+ * point any error unwinding will need to include a call to auxiliary_device_uninit().
|
||||
+ * In this post-initialize error scenario, a call to the device's .release callback will be
|
||||
+ * triggered, and all memory clean-up is expected to be handled there.
|
||||
+ */
|
||||
+int auxiliary_device_init(struct auxiliary_device *auxdev)
|
||||
+{
|
||||
+ struct device *dev = &auxdev->dev;
|
||||
+
|
||||
+ if (!dev->parent) {
|
||||
+ pr_err("auxiliary_device has a NULL dev->parent\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (!auxdev->name) {
|
||||
+ pr_err("auxiliary_device has a NULL name\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ dev->bus = &auxiliary_bus_type;
|
||||
+ device_initialize(&auxdev->dev);
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(auxiliary_device_init);
|
||||
+
|
||||
+/**
|
||||
+ * __auxiliary_device_add - add an auxiliary bus device
|
||||
+ * @auxdev: auxiliary bus device to add to the bus
|
||||
+ * @modname: name of the parent device's driver module
|
||||
+ *
|
||||
+ * This is the second step in the two-step process to register an auxiliary_device.
|
||||
+ *
|
||||
+ * This function must be called after a successful call to auxiliary_device_init(), which
|
||||
+ * will perform the device_initialize. This means that if this returns an error code, then a
|
||||
+ * call to auxiliary_device_uninit() must be performed so that the .release callback will
|
||||
+ * be triggered to free the memory associated with the auxiliary_device.
|
||||
+ *
|
||||
+ * The expectation is that users will call the "auxiliary_device_add" macro so that the caller's
|
||||
+ * KBUILD_MODNAME is automatically inserted for the modname parameter. Only if a user requires
|
||||
+ * a custom name would this version be called directly.
|
||||
+ */
|
||||
+int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname)
|
||||
+{
|
||||
+ struct device *dev = &auxdev->dev;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!modname) {
|
||||
+ pr_err("auxiliary device modname is NULL\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ ret = dev_set_name(dev, "%s.%s.%d", modname, auxdev->name, auxdev->id);
|
||||
+ if (ret) {
|
||||
+ pr_err("auxiliary device dev_set_name failed: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = device_add(dev);
|
||||
+ if (ret)
|
||||
+ dev_err(dev, "adding auxiliary device failed!: %d\n", ret);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(__auxiliary_device_add);
|
||||
+
|
||||
+/**
|
||||
+ * auxiliary_find_device - auxiliary device iterator for locating a particular device.
|
||||
+ * @start: Device to begin with
|
||||
+ * @data: Data to pass to match function
|
||||
+ * @match: Callback function to check device
|
||||
+ *
|
||||
+ * This function returns a reference to a device that is 'found'
|
||||
+ * for later use, as determined by the @match callback.
|
||||
+ *
|
||||
+ * The callback should return 0 if the device doesn't match and non-zero
|
||||
+ * if it does. If the callback returns non-zero, this function will
|
||||
+ * return to the caller and not iterate over any more devices.
|
||||
+ */
|
||||
+struct auxiliary_device *
|
||||
+auxiliary_find_device(struct device *start, const void *data,
|
||||
+ int (*match)(struct device *dev, const void *data))
|
||||
+{
|
||||
+ struct device *dev;
|
||||
+
|
||||
+ dev = bus_find_device(&auxiliary_bus_type, start, data, match);
|
||||
+ if (!dev)
|
||||
+ return NULL;
|
||||
+
|
||||
+ return to_auxiliary_dev(dev);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(auxiliary_find_device);
|
||||
+
|
||||
+/**
|
||||
+ * __auxiliary_driver_register - register a driver for auxiliary bus devices
|
||||
+ * @auxdrv: auxiliary_driver structure
|
||||
+ * @owner: owning module/driver
|
||||
+ * @modname: KBUILD_MODNAME for parent driver
|
||||
+ */
|
||||
+int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner,
|
||||
+ const char *modname)
|
||||
+{
|
||||
+ if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (auxdrv->name)
|
||||
+ auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s.%s", modname, auxdrv->name);
|
||||
+ else
|
||||
+ auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s", modname);
|
||||
+ if (!auxdrv->driver.name)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ auxdrv->driver.owner = owner;
|
||||
+ auxdrv->driver.bus = &auxiliary_bus_type;
|
||||
+ auxdrv->driver.mod_name = modname;
|
||||
+
|
||||
+ return driver_register(&auxdrv->driver);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(__auxiliary_driver_register);
|
||||
+
|
||||
+/**
|
||||
+ * auxiliary_driver_unregister - unregister a driver
|
||||
+ * @auxdrv: auxiliary_driver structure
|
||||
+ */
|
||||
+void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv)
|
||||
+{
|
||||
+ driver_unregister(&auxdrv->driver);
|
||||
+ kfree(auxdrv->driver.name);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(auxiliary_driver_unregister);
|
||||
+
|
||||
+static int __init auxiliary_bus_init(void)
|
||||
+{
|
||||
+ return bus_register(&auxiliary_bus_type);
|
||||
+}
|
||||
+
|
||||
+static void __exit auxiliary_bus_exit(void)
|
||||
+{
|
||||
+ bus_unregister(&auxiliary_bus_type);
|
||||
+}
|
||||
+
|
||||
+module_init(auxiliary_bus_init);
|
||||
+module_exit(auxiliary_bus_exit);
|
||||
+
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
+MODULE_DESCRIPTION("Auxiliary Bus");
|
||||
+MODULE_AUTHOR("David Ertman <david.m.ertman@intel.com>");
|
||||
+MODULE_AUTHOR("Kiran Patil <kiran.patil@intel.com>");
|
||||
diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h
|
||||
new file mode 100644
|
||||
index 000000000000..282fbf7bf9af
|
||||
--- /dev/null
|
||||
+++ b/include/linux/auxiliary_bus.h
|
||||
@@ -0,0 +1,78 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
+/*
|
||||
+ * Copyright (c) 2019-2020 Intel Corporation
|
||||
+ *
|
||||
+ * Please see Documentation/driver-api/auxiliary_bus.rst for more information.
|
||||
+ */
|
||||
+
|
||||
+#ifndef _AUXILIARY_BUS_H_
|
||||
+#define _AUXILIARY_BUS_H_
|
||||
+
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/mod_devicetable.h>
|
||||
+#include <linux/slab.h>
|
||||
+
|
||||
+struct auxiliary_device {
|
||||
+ struct device dev;
|
||||
+ const char *name;
|
||||
+ u32 id;
|
||||
+};
|
||||
+
|
||||
+struct auxiliary_driver {
|
||||
+ int (*probe)(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id);
|
||||
+ int (*remove)(struct auxiliary_device *auxdev);
|
||||
+ void (*shutdown)(struct auxiliary_device *auxdev);
|
||||
+ int (*suspend)(struct auxiliary_device *auxdev, pm_message_t state);
|
||||
+ int (*resume)(struct auxiliary_device *auxdev);
|
||||
+ const char *name;
|
||||
+ struct device_driver driver;
|
||||
+ const struct auxiliary_device_id *id_table;
|
||||
+};
|
||||
+
|
||||
+static inline struct auxiliary_device *to_auxiliary_dev(struct device *dev)
|
||||
+{
|
||||
+ return container_of(dev, struct auxiliary_device, dev);
|
||||
+}
|
||||
+
|
||||
+static inline struct auxiliary_driver *to_auxiliary_drv(struct device_driver *drv)
|
||||
+{
|
||||
+ return container_of(drv, struct auxiliary_driver, driver);
|
||||
+}
|
||||
+
|
||||
+int auxiliary_device_init(struct auxiliary_device *auxdev);
|
||||
+int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname);
|
||||
+#define auxiliary_device_add(auxdev) __auxiliary_device_add(auxdev, KBUILD_MODNAME)
|
||||
+
|
||||
+static inline void auxiliary_device_uninit(struct auxiliary_device *auxdev)
|
||||
+{
|
||||
+ put_device(&auxdev->dev);
|
||||
+}
|
||||
+
|
||||
+static inline void auxiliary_device_delete(struct auxiliary_device *auxdev)
|
||||
+{
|
||||
+ device_del(&auxdev->dev);
|
||||
+}
|
||||
+
|
||||
+int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner,
|
||||
+ const char *modname);
|
||||
+#define auxiliary_driver_register(auxdrv) \
|
||||
+ __auxiliary_driver_register(auxdrv, THIS_MODULE, KBUILD_MODNAME)
|
||||
+
|
||||
+void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv);
|
||||
+
|
||||
+/**
|
||||
+ * module_auxiliary_driver() - Helper macro for registering an auxiliary driver
|
||||
+ * @__auxiliary_driver: auxiliary driver struct
|
||||
+ *
|
||||
+ * Helper macro for auxiliary drivers which do not do anything special in
|
||||
+ * module init/exit. This eliminates a lot of boilerplate. Each module may only
|
||||
+ * use this macro once, and calling it replaces module_init() and module_exit()
|
||||
+ */
|
||||
+#define module_auxiliary_driver(__auxiliary_driver) \
|
||||
+ module_driver(__auxiliary_driver, auxiliary_driver_register, auxiliary_driver_unregister)
|
||||
+
|
||||
+struct auxiliary_device *
|
||||
+auxiliary_find_device(struct device *start, const void *data,
|
||||
+ int (*match)(struct device *dev, const void *data));
|
||||
+
|
||||
+#endif /* _AUXILIARY_BUS_H_ */
|
||||
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
|
||||
index 5b08a473cdba..c425290b21e2 100644
|
||||
--- a/include/linux/mod_devicetable.h
|
||||
+++ b/include/linux/mod_devicetable.h
|
||||
@@ -838,4 +838,12 @@ struct mhi_device_id {
|
||||
kernel_ulong_t driver_data;
|
||||
};
|
||||
|
||||
+#define AUXILIARY_NAME_SIZE 32
|
||||
+#define AUXILIARY_MODULE_PREFIX "auxiliary:"
|
||||
+
|
||||
+struct auxiliary_device_id {
|
||||
+ char name[AUXILIARY_NAME_SIZE];
|
||||
+ kernel_ulong_t driver_data;
|
||||
+};
|
||||
+
|
||||
#endif /* LINUX_MOD_DEVICETABLE_H */
|
||||
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
|
||||
index 27007c18e754..e377f52dbfa3 100644
|
||||
--- a/scripts/mod/devicetable-offsets.c
|
||||
+++ b/scripts/mod/devicetable-offsets.c
|
||||
@@ -243,5 +243,8 @@ int main(void)
|
||||
DEVID(mhi_device_id);
|
||||
DEVID_FIELD(mhi_device_id, chan);
|
||||
|
||||
+ DEVID(auxiliary_device_id);
|
||||
+ DEVID_FIELD(auxiliary_device_id, name);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
|
||||
index 2417dd1dee33..fb4827027536 100644
|
||||
--- a/scripts/mod/file2alias.c
|
||||
+++ b/scripts/mod/file2alias.c
|
||||
@@ -1364,6 +1364,13 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias)
|
||||
{
|
||||
DEF_FIELD_ADDR(symval, mhi_device_id, chan);
|
||||
sprintf(alias, MHI_DEVICE_MODALIAS_FMT, *chan);
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static int do_auxiliary_entry(const char *filename, void *symval, char *alias)
|
||||
+{
|
||||
+ DEF_FIELD_ADDR(symval, auxiliary_device_id, name);
|
||||
+ sprintf(alias, AUXILIARY_MODULE_PREFIX "%s", *name);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1442,6 +1449,7 @@ static const struct devtable devtable[] = {
|
||||
{"tee", SIZE_tee_client_device_id, do_tee_entry},
|
||||
{"wmi", SIZE_wmi_device_id, do_wmi_entry},
|
||||
{"mhi", SIZE_mhi_device_id, do_mhi_entry},
|
||||
+ {"auxiliary", SIZE_auxiliary_device_id, do_auxiliary_entry},
|
||||
};
|
||||
|
||||
/* Create MODULE_ALIAS() statements.
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
From a64e93a757edfad34955b79f1774d10e9dae955e Mon Sep 17 00:00:00 2001
|
||||
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Date: Fri, 4 Dec 2020 12:43:47 +0100
|
||||
Subject: [PATCH] driver core: auxiliary bus: move slab.h from include file
|
||||
|
||||
No need to include slab.h in include/linux/auxiliary_bus.h, as it is not
|
||||
needed there. Move it to drivers/base/auxiliary.c instead.
|
||||
|
||||
Cc: Dan Williams <dan.j.williams@intel.com>
|
||||
Cc: Dave Ertman <david.m.ertman@intel.com>
|
||||
Cc: Fred Oh <fred.oh@linux.intel.com>
|
||||
Cc: Kiran Patil <kiran.patil@intel.com>
|
||||
Cc: Leon Romanovsky <leonro@nvidia.com>
|
||||
Cc: Martin Habets <mhabets@solarflare.com>
|
||||
Cc: Parav Pandit <parav@mellanox.com>
|
||||
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
|
||||
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
|
||||
Cc: Shiraz Saleem <shiraz.saleem@intel.com>
|
||||
Link: https://lore.kernel.org/r/X8og8xi3WkoYXet9@kroah.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
(cherry picked from commit 7bbb79ff5f7499e0c5d65987458410e8099207d8)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/base/auxiliary.c | 1 +
|
||||
include/linux/auxiliary_bus.h | 1 -
|
||||
2 files changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
|
||||
index ef2af417438b..eca36d6284d0 100644
|
||||
--- a/drivers/base/auxiliary.c
|
||||
+++ b/drivers/base/auxiliary.c
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/init.h>
|
||||
+#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pm_domain.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h
|
||||
index 282fbf7bf9af..3580743d0e8d 100644
|
||||
--- a/include/linux/auxiliary_bus.h
|
||||
+++ b/include/linux/auxiliary_bus.h
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
-#include <linux/slab.h>
|
||||
|
||||
struct auxiliary_device {
|
||||
struct device dev;
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
From 1eef241f79083237468a534e739ae053f2b7cfd5 Mon Sep 17 00:00:00 2001
|
||||
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Date: Fri, 4 Dec 2020 12:44:07 +0100
|
||||
Subject: [PATCH] driver core: auxiliary bus: make remove function return void
|
||||
|
||||
There's an effort to move the remove() callback in the driver core to
|
||||
not return an int, as nothing can be done if this function fails. To
|
||||
make that effort easier, make the aux bus remove function void to start
|
||||
with so that no users have to be changed sometime in the future.
|
||||
|
||||
Cc: Dan Williams <dan.j.williams@intel.com>
|
||||
Cc: Dave Ertman <david.m.ertman@intel.com>
|
||||
Cc: Fred Oh <fred.oh@linux.intel.com>
|
||||
Cc: Kiran Patil <kiran.patil@intel.com>
|
||||
Cc: Leon Romanovsky <leonro@nvidia.com>
|
||||
Cc: Martin Habets <mhabets@solarflare.com>
|
||||
Cc: Parav Pandit <parav@mellanox.com>
|
||||
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
|
||||
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
|
||||
Cc: Shiraz Saleem <shiraz.saleem@intel.com>
|
||||
Link: https://lore.kernel.org/r/X8ohB1ks1NK7kPop@kroah.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
(cherry picked from commit 8142a46c50d2dd8160c42284e1044eed3bec0d18)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
Documentation/driver-api/auxiliary_bus.rst | 2 +-
|
||||
drivers/base/auxiliary.c | 5 ++---
|
||||
include/linux/auxiliary_bus.h | 2 +-
|
||||
3 files changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/Documentation/driver-api/auxiliary_bus.rst b/Documentation/driver-api/auxiliary_bus.rst
|
||||
index 5dd7804631ef..2312506b0674 100644
|
||||
--- a/Documentation/driver-api/auxiliary_bus.rst
|
||||
+++ b/Documentation/driver-api/auxiliary_bus.rst
|
||||
@@ -150,7 +150,7 @@ and shutdown notifications using the standard conventions.
|
||||
struct auxiliary_driver {
|
||||
int (*probe)(struct auxiliary_device *,
|
||||
const struct auxiliary_device_id *id);
|
||||
- int (*remove)(struct auxiliary_device *);
|
||||
+ void (*remove)(struct auxiliary_device *);
|
||||
void (*shutdown)(struct auxiliary_device *);
|
||||
int (*suspend)(struct auxiliary_device *, pm_message_t);
|
||||
int (*resume)(struct auxiliary_device *);
|
||||
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
|
||||
index eca36d6284d0..c44e85802b43 100644
|
||||
--- a/drivers/base/auxiliary.c
|
||||
+++ b/drivers/base/auxiliary.c
|
||||
@@ -82,13 +82,12 @@ static int auxiliary_bus_remove(struct device *dev)
|
||||
{
|
||||
struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
|
||||
struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
|
||||
- int ret = 0;
|
||||
|
||||
if (auxdrv->remove)
|
||||
- ret = auxdrv->remove(auxdev);
|
||||
+ auxdrv->remove(auxdev);
|
||||
dev_pm_domain_detach(dev, true);
|
||||
|
||||
- return ret;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static void auxiliary_bus_shutdown(struct device *dev)
|
||||
diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h
|
||||
index 3580743d0e8d..d67b17606210 100644
|
||||
--- a/include/linux/auxiliary_bus.h
|
||||
+++ b/include/linux/auxiliary_bus.h
|
||||
@@ -19,7 +19,7 @@ struct auxiliary_device {
|
||||
|
||||
struct auxiliary_driver {
|
||||
int (*probe)(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id);
|
||||
- int (*remove)(struct auxiliary_device *auxdev);
|
||||
+ void (*remove)(struct auxiliary_device *auxdev);
|
||||
void (*shutdown)(struct auxiliary_device *auxdev);
|
||||
int (*suspend)(struct auxiliary_device *auxdev, pm_message_t state);
|
||||
int (*resume)(struct auxiliary_device *auxdev);
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
From 67b5e80aad2083d07dcbe0e36eb15e65217f373b Mon Sep 17 00:00:00 2001
|
||||
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Date: Fri, 4 Dec 2020 12:49:28 +0100
|
||||
Subject: [PATCH] driver core: auxiliary bus: minor coding style tweaks
|
||||
|
||||
For some reason, the original aux bus patch had some really long lines
|
||||
in a few places, probably due to it being a very long-lived patch in
|
||||
development by many different people. Fix that up so that the two files
|
||||
all have the same length lines and function formatting styles.
|
||||
|
||||
Cc: Dan Williams <dan.j.williams@intel.com>
|
||||
Cc: Dave Ertman <david.m.ertman@intel.com>
|
||||
Cc: Fred Oh <fred.oh@linux.intel.com>
|
||||
Cc: Kiran Patil <kiran.patil@intel.com>
|
||||
Cc: Leon Romanovsky <leonro@nvidia.com>
|
||||
Cc: Martin Habets <mhabets@solarflare.com>
|
||||
Cc: Parav Pandit <parav@mellanox.com>
|
||||
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
|
||||
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
|
||||
Cc: Shiraz Saleem <shiraz.saleem@intel.com>
|
||||
Link: https://lore.kernel.org/r/X8oiSFTpYHw1xE/o@kroah.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
(cherry picked from commit 0d2bf11a6b3e275a526b8d42d8d4a3a6067cf953)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/base/auxiliary.c | 58 +++++++++++++++++++----------------
|
||||
include/linux/auxiliary_bus.h | 6 ++--
|
||||
2 files changed, 35 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
|
||||
index c44e85802b43..f303daadf843 100644
|
||||
--- a/drivers/base/auxiliary.c
|
||||
+++ b/drivers/base/auxiliary.c
|
||||
@@ -50,8 +50,8 @@ static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
name = dev_name(dev);
|
||||
p = strrchr(name, '.');
|
||||
|
||||
- return add_uevent_var(env, "MODALIAS=%s%.*s", AUXILIARY_MODULE_PREFIX, (int)(p - name),
|
||||
- name);
|
||||
+ return add_uevent_var(env, "MODALIAS=%s%.*s", AUXILIARY_MODULE_PREFIX,
|
||||
+ (int)(p - name), name);
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops auxiliary_dev_pm_ops = {
|
||||
@@ -113,16 +113,18 @@ static struct bus_type auxiliary_bus_type = {
|
||||
* auxiliary_device_init - check auxiliary_device and initialize
|
||||
* @auxdev: auxiliary device struct
|
||||
*
|
||||
- * This is the first step in the two-step process to register an auxiliary_device.
|
||||
+ * This is the first step in the two-step process to register an
|
||||
+ * auxiliary_device.
|
||||
*
|
||||
- * When this function returns an error code, then the device_initialize will *not* have
|
||||
- * been performed, and the caller will be responsible to free any memory allocated for the
|
||||
- * auxiliary_device in the error path directly.
|
||||
+ * When this function returns an error code, then the device_initialize will
|
||||
+ * *not* have been performed, and the caller will be responsible to free any
|
||||
+ * memory allocated for the auxiliary_device in the error path directly.
|
||||
*
|
||||
- * It returns 0 on success. On success, the device_initialize has been performed. After this
|
||||
- * point any error unwinding will need to include a call to auxiliary_device_uninit().
|
||||
- * In this post-initialize error scenario, a call to the device's .release callback will be
|
||||
- * triggered, and all memory clean-up is expected to be handled there.
|
||||
+ * It returns 0 on success. On success, the device_initialize has been
|
||||
+ * performed. After this point any error unwinding will need to include a call
|
||||
+ * to auxiliary_device_uninit(). In this post-initialize error scenario, a call
|
||||
+ * to the device's .release callback will be triggered, and all memory clean-up
|
||||
+ * is expected to be handled there.
|
||||
*/
|
||||
int auxiliary_device_init(struct auxiliary_device *auxdev)
|
||||
{
|
||||
@@ -149,16 +151,19 @@ EXPORT_SYMBOL_GPL(auxiliary_device_init);
|
||||
* @auxdev: auxiliary bus device to add to the bus
|
||||
* @modname: name of the parent device's driver module
|
||||
*
|
||||
- * This is the second step in the two-step process to register an auxiliary_device.
|
||||
+ * This is the second step in the two-step process to register an
|
||||
+ * auxiliary_device.
|
||||
*
|
||||
- * This function must be called after a successful call to auxiliary_device_init(), which
|
||||
- * will perform the device_initialize. This means that if this returns an error code, then a
|
||||
- * call to auxiliary_device_uninit() must be performed so that the .release callback will
|
||||
- * be triggered to free the memory associated with the auxiliary_device.
|
||||
+ * This function must be called after a successful call to
|
||||
+ * auxiliary_device_init(), which will perform the device_initialize. This
|
||||
+ * means that if this returns an error code, then a call to
|
||||
+ * auxiliary_device_uninit() must be performed so that the .release callback
|
||||
+ * will be triggered to free the memory associated with the auxiliary_device.
|
||||
*
|
||||
- * The expectation is that users will call the "auxiliary_device_add" macro so that the caller's
|
||||
- * KBUILD_MODNAME is automatically inserted for the modname parameter. Only if a user requires
|
||||
- * a custom name would this version be called directly.
|
||||
+ * The expectation is that users will call the "auxiliary_device_add" macro so
|
||||
+ * that the caller's KBUILD_MODNAME is automatically inserted for the modname
|
||||
+ * parameter. Only if a user requires a custom name would this version be
|
||||
+ * called directly.
|
||||
*/
|
||||
int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname)
|
||||
{
|
||||
@@ -166,13 +171,13 @@ int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname)
|
||||
int ret;
|
||||
|
||||
if (!modname) {
|
||||
- pr_err("auxiliary device modname is NULL\n");
|
||||
+ dev_err(dev, "auxiliary device modname is NULL\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = dev_set_name(dev, "%s.%s.%d", modname, auxdev->name, auxdev->id);
|
||||
if (ret) {
|
||||
- pr_err("auxiliary device dev_set_name failed: %d\n", ret);
|
||||
+ dev_err(dev, "auxiliary device dev_set_name failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -197,9 +202,9 @@ EXPORT_SYMBOL_GPL(__auxiliary_device_add);
|
||||
* if it does. If the callback returns non-zero, this function will
|
||||
* return to the caller and not iterate over any more devices.
|
||||
*/
|
||||
-struct auxiliary_device *
|
||||
-auxiliary_find_device(struct device *start, const void *data,
|
||||
- int (*match)(struct device *dev, const void *data))
|
||||
+struct auxiliary_device *auxiliary_find_device(struct device *start,
|
||||
+ const void *data,
|
||||
+ int (*match)(struct device *dev, const void *data))
|
||||
{
|
||||
struct device *dev;
|
||||
|
||||
@@ -217,14 +222,15 @@ EXPORT_SYMBOL_GPL(auxiliary_find_device);
|
||||
* @owner: owning module/driver
|
||||
* @modname: KBUILD_MODNAME for parent driver
|
||||
*/
|
||||
-int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner,
|
||||
- const char *modname)
|
||||
+int __auxiliary_driver_register(struct auxiliary_driver *auxdrv,
|
||||
+ struct module *owner, const char *modname)
|
||||
{
|
||||
if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table))
|
||||
return -EINVAL;
|
||||
|
||||
if (auxdrv->name)
|
||||
- auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s.%s", modname, auxdrv->name);
|
||||
+ auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s.%s", modname,
|
||||
+ auxdrv->name);
|
||||
else
|
||||
auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s", modname);
|
||||
if (!auxdrv->driver.name)
|
||||
diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h
|
||||
index d67b17606210..fc51d45f106b 100644
|
||||
--- a/include/linux/auxiliary_bus.h
|
||||
+++ b/include/linux/auxiliary_bus.h
|
||||
@@ -70,8 +70,8 @@ void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv);
|
||||
#define module_auxiliary_driver(__auxiliary_driver) \
|
||||
module_driver(__auxiliary_driver, auxiliary_driver_register, auxiliary_driver_unregister)
|
||||
|
||||
-struct auxiliary_device *
|
||||
-auxiliary_find_device(struct device *start, const void *data,
|
||||
- int (*match)(struct device *dev, const void *data));
|
||||
+struct auxiliary_device *auxiliary_find_device(struct device *start,
|
||||
+ const void *data,
|
||||
+ int (*match)(struct device *dev, const void *data));
|
||||
|
||||
#endif /* _AUXILIARY_BUS_H_ */
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
From 7f4d45ef5bfe6dd025b1f7c736d198b9a208cdef Mon Sep 17 00:00:00 2001
|
||||
From: Dave Jiang <dave.jiang@intel.com>
|
||||
Date: Fri, 4 Dec 2020 09:46:49 -0700
|
||||
Subject: [PATCH] driver core: auxiliary bus: Fix auxiliary bus shutdown null
|
||||
auxdrv ptr
|
||||
|
||||
If the probe of the auxdrv failed, the device->driver is set to NULL.
|
||||
During kernel shutdown, the bus shutdown will call auxdrv->shutdown and
|
||||
cause an invalid ptr dereference. Add check to make sure device->driver is
|
||||
not NULL before we proceed.
|
||||
|
||||
Fixes: 7de3697e9cbd ("Add auxiliary bus support")
|
||||
Cc: Dave Ertman <david.m.ertman@intel.com>
|
||||
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
|
||||
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
|
||||
Link: https://lore.kernel.org/r/160710040926.1889434.8840329810698403478.stgit@djiang5-desk3.ch.intel.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
(cherry picked from commit 784b2c48ac12dcee27db001fb1a3c58c39380cb6)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/base/auxiliary.c | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
|
||||
index f303daadf843..8336535f1e11 100644
|
||||
--- a/drivers/base/auxiliary.c
|
||||
+++ b/drivers/base/auxiliary.c
|
||||
@@ -92,10 +92,15 @@ static int auxiliary_bus_remove(struct device *dev)
|
||||
|
||||
static void auxiliary_bus_shutdown(struct device *dev)
|
||||
{
|
||||
- struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver);
|
||||
- struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
|
||||
+ struct auxiliary_driver *auxdrv = NULL;
|
||||
+ struct auxiliary_device *auxdev;
|
||||
+
|
||||
+ if (dev->driver) {
|
||||
+ auxdrv = to_auxiliary_drv(dev->driver);
|
||||
+ auxdev = to_auxiliary_dev(dev);
|
||||
+ }
|
||||
|
||||
- if (auxdrv->shutdown)
|
||||
+ if (auxdrv && auxdrv->shutdown)
|
||||
auxdrv->shutdown(auxdev);
|
||||
}
|
||||
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
From 87f05137d98572c5926bbc6949ecc6616bd90057 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Jiang <dave.jiang@intel.com>
|
||||
Date: Wed, 10 Feb 2021 13:16:11 -0700
|
||||
Subject: [PATCH] driver core: auxiliary bus: Fix calling stage for auxiliary
|
||||
bus init
|
||||
|
||||
When the auxiliary device code is built into the kernel, it can be executed
|
||||
before the auxiliary bus is registered. This causes bus->p to be not
|
||||
allocated and triggers a NULL pointer dereference when the auxiliary bus
|
||||
device gets added with bus_add_device(). Call the auxiliary_bus_init()
|
||||
under driver_init() so the bus is initialized before devices.
|
||||
|
||||
Below is the kernel splat for the bug:
|
||||
[ 1.948215] BUG: kernel NULL pointer dereference, address: 0000000000000060
|
||||
[ 1.950670] #PF: supervisor read access in kernel mode
|
||||
[ 1.950670] #PF: error_code(0x0000) - not-present page
|
||||
[ 1.950670] PGD 0
|
||||
[ 1.950670] Oops: 0000 1 SMP NOPTI
|
||||
[ 1.950670] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-intel-nextsvmtest+ #2205
|
||||
[ 1.950670] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
|
||||
[ 1.950670] RIP: 0010:bus_add_device+0x64/0x140
|
||||
[ 1.950670] Code: 00 49 8b 75 20 48 89 df e8 59 a1 ff ff 41 89 c4 85 c0 75 7b 48 8b 53 50 48 85 d2 75 03 48 8b 13 49 8b 85 a0 00 00 00 48 89 de <48> 8
|
||||
78 60 48 83 c7 18 e8 ef d9 a9 ff 41 89 c4 85 c0 75 45 48 8b
|
||||
[ 1.950670] RSP: 0000:ff46032ac001baf8 EFLAGS: 00010246
|
||||
[ 1.950670] RAX: 0000000000000000 RBX: ff4597f7414aa680 RCX: 0000000000000000
|
||||
[ 1.950670] RDX: ff4597f74142bbc0 RSI: ff4597f7414aa680 RDI: ff4597f7414aa680
|
||||
[ 1.950670] RBP: ff46032ac001bb10 R08: 0000000000000044 R09: 0000000000000228
|
||||
[ 1.950670] R10: ff4597f741141b30 R11: ff4597f740182a90 R12: 0000000000000000
|
||||
[ 1.950670] R13: ffffffffa5e936c0 R14: 0000000000000000 R15: 0000000000000000
|
||||
[ 1.950670] FS: 0000000000000000(0000) GS:ff4597f7bba00000(0000) knlGS:0000000000000000
|
||||
[ 1.950670] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
|
||||
[ 1.950670] CR2: 0000000000000060 CR3: 000000002140c001 CR4: 0000000000f71ef0
|
||||
[ 1.950670] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
|
||||
[ 1.950670] DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400
|
||||
[ 1.950670] PKRU: 55555554
|
||||
[ 1.950670] Call Trace:
|
||||
[ 1.950670] device_add+0x3ee/0x850
|
||||
[ 1.950670] __auxiliary_device_add+0x47/0x60
|
||||
[ 1.950670] idxd_pci_probe+0xf77/0x1180
|
||||
[ 1.950670] local_pci_probe+0x4a/0x90
|
||||
[ 1.950670] pci_device_probe+0xff/0x1b0
|
||||
[ 1.950670] really_probe+0x1cf/0x440
|
||||
[ 1.950670] ? rdinit_setup+0x31/0x31
|
||||
[ 1.950670] driver_probe_device+0xe8/0x150
|
||||
[ 1.950670] device_driver_attach+0x58/0x60
|
||||
[ 1.950670] __driver_attach+0x8f/0x150
|
||||
[ 1.950670] ? device_driver_attach+0x60/0x60
|
||||
[ 1.950670] ? device_driver_attach+0x60/0x60
|
||||
[ 1.950670] bus_for_each_dev+0x79/0xc0
|
||||
[ 1.950670] ? kmem_cache_alloc_trace+0x323/0x430
|
||||
[ 1.950670] driver_attach+0x1e/0x20
|
||||
[ 1.950670] bus_add_driver+0x154/0x1f0
|
||||
[ 1.950670] driver_register+0x70/0xc0
|
||||
[ 1.950670] __pci_register_driver+0x54/0x60
|
||||
[ 1.950670] idxd_init_module+0xe2/0xfc
|
||||
[ 1.950670] ? idma64_platform_driver_init+0x19/0x19
|
||||
[ 1.950670] do_one_initcall+0x4a/0x1e0
|
||||
[ 1.950670] kernel_init_freeable+0x1fc/0x25c
|
||||
[ 1.950670] ? rest_init+0xba/0xba
|
||||
[ 1.950670] kernel_init+0xe/0x116
|
||||
[ 1.950670] ret_from_fork+0x1f/0x30
|
||||
[ 1.950670] Modules linked in:
|
||||
[ 1.950670] CR2: 0000000000000060
|
||||
[ 1.950670] --[ end trace cd7d1b226d3ca901 ]--
|
||||
|
||||
Fixes: 7de3697e9cbd ("Add auxiliary bus support")
|
||||
Reported-by: Jacob Pan <jacob.jun.pan@intel.com>
|
||||
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
|
||||
Acked-by: Dave Ertman <david.m.ertman@intel.com>
|
||||
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
|
||||
Link: https://lore.kernel.org/r/20210210201611.1611074-1-dave.jiang@intel.com
|
||||
Cc: stable <stable@vger.kernel.org>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
(cherry picked from commit 471b12c43f376d5203dbff0e91316eea11f6f4df)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/base/auxiliary.c | 13 +++----------
|
||||
drivers/base/base.h | 5 +++++
|
||||
drivers/base/init.c | 1 +
|
||||
3 files changed, 9 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
|
||||
index 8336535f1e11..d8b314e7d0fd 100644
|
||||
--- a/drivers/base/auxiliary.c
|
||||
+++ b/drivers/base/auxiliary.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/auxiliary_bus.h>
|
||||
+#include "base.h"
|
||||
|
||||
static const struct auxiliary_device_id *auxiliary_match_id(const struct auxiliary_device_id *id,
|
||||
const struct auxiliary_device *auxdev)
|
||||
@@ -260,19 +261,11 @@ void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(auxiliary_driver_unregister);
|
||||
|
||||
-static int __init auxiliary_bus_init(void)
|
||||
+void __init auxiliary_bus_init(void)
|
||||
{
|
||||
- return bus_register(&auxiliary_bus_type);
|
||||
+ WARN_ON(bus_register(&auxiliary_bus_type));
|
||||
}
|
||||
|
||||
-static void __exit auxiliary_bus_exit(void)
|
||||
-{
|
||||
- bus_unregister(&auxiliary_bus_type);
|
||||
-}
|
||||
-
|
||||
-module_init(auxiliary_bus_init);
|
||||
-module_exit(auxiliary_bus_exit);
|
||||
-
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_DESCRIPTION("Auxiliary Bus");
|
||||
MODULE_AUTHOR("David Ertman <david.m.ertman@intel.com>");
|
||||
diff --git a/drivers/base/base.h b/drivers/base/base.h
|
||||
index 91cfb8405abd..7d97447460fa 100644
|
||||
--- a/drivers/base/base.h
|
||||
+++ b/drivers/base/base.h
|
||||
@@ -119,6 +119,11 @@ static inline int hypervisor_init(void) { return 0; }
|
||||
extern int platform_bus_init(void);
|
||||
extern void cpu_dev_init(void);
|
||||
extern void container_dev_init(void);
|
||||
+#ifdef CONFIG_AUXILIARY_BUS
|
||||
+extern void auxiliary_bus_init(void);
|
||||
+#else
|
||||
+static inline void auxiliary_bus_init(void) { }
|
||||
+#endif
|
||||
|
||||
struct kobject *virtual_device_parent(struct device *dev);
|
||||
|
||||
diff --git a/drivers/base/init.c b/drivers/base/init.c
|
||||
index 908e6520e804..a9f57c22fb9e 100644
|
||||
--- a/drivers/base/init.c
|
||||
+++ b/drivers/base/init.c
|
||||
@@ -32,6 +32,7 @@ void __init driver_init(void)
|
||||
*/
|
||||
of_core_init();
|
||||
platform_bus_init();
|
||||
+ auxiliary_bus_init();
|
||||
cpu_dev_init();
|
||||
memory_dev_init();
|
||||
container_dev_init();
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
From bcfe18a2fd6d45f14ae60c742a7661a64e46305e Mon Sep 17 00:00:00 2001
|
||||
From: Dave Jiang <dave.jiang@intel.com>
|
||||
Date: Thu, 11 Feb 2021 13:21:29 -0700
|
||||
Subject: [PATCH] driver core: auxiliary bus: Remove unneeded module bits
|
||||
|
||||
Remove module bits in the auxiliary bus code since the auxiliary bus
|
||||
cannot be built as a module and the relevant code is not needed.
|
||||
|
||||
Cc: Dave Ertman <david.m.ertman@intel.com>
|
||||
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
|
||||
Link: https://lore.kernel.org/r/161307488980.1896017.15627190714413338196.stgit@djiang5-desk3.ch.intel.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
(cherry picked from commit bbf44abeeabfe05a124535e6c3a9fd7d682d42bf)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/base/auxiliary.c | 5 -----
|
||||
1 file changed, 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
|
||||
index d8b314e7d0fd..adc199dfba3c 100644
|
||||
--- a/drivers/base/auxiliary.c
|
||||
+++ b/drivers/base/auxiliary.c
|
||||
@@ -265,8 +265,3 @@ void __init auxiliary_bus_init(void)
|
||||
{
|
||||
WARN_ON(bus_register(&auxiliary_bus_type));
|
||||
}
|
||||
-
|
||||
-MODULE_LICENSE("GPL v2");
|
||||
-MODULE_DESCRIPTION("Auxiliary Bus");
|
||||
-MODULE_AUTHOR("David Ertman <david.m.ertman@intel.com>");
|
||||
-MODULE_AUTHOR("Kiran Patil <kiran.patil@intel.com>");
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From 09b57232d358202d79e2133d523a664906e9759c Mon Sep 17 00:00:00 2001
|
||||
From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
|
||||
Date: Tue, 13 Jul 2021 12:34:38 +0300
|
||||
Subject: [PATCH] driver core: auxiliary bus: Fix memory leak when
|
||||
driver_register() fail
|
||||
|
||||
If driver_register() returns with error we need to free the memory
|
||||
allocated for auxdrv->driver.name before returning from
|
||||
__auxiliary_driver_register()
|
||||
|
||||
Fixes: 7de3697e9cbd4 ("Add auxiliary bus support")
|
||||
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
|
||||
Cc: stable <stable@vger.kernel.org>
|
||||
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
|
||||
Link: https://lore.kernel.org/r/20210713093438.3173-1-peter.ujfalusi@linux.intel.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
(cherry picked from commit 4afa0c22eed33cfe0c590742387f0d16f32412f3)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/base/auxiliary.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
|
||||
index adc199dfba3c..6a30264ab2ba 100644
|
||||
--- a/drivers/base/auxiliary.c
|
||||
+++ b/drivers/base/auxiliary.c
|
||||
@@ -231,6 +231,8 @@ EXPORT_SYMBOL_GPL(auxiliary_find_device);
|
||||
int __auxiliary_driver_register(struct auxiliary_driver *auxdrv,
|
||||
struct module *owner, const char *modname)
|
||||
{
|
||||
+ int ret;
|
||||
+
|
||||
if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table))
|
||||
return -EINVAL;
|
||||
|
||||
@@ -246,7 +248,11 @@ int __auxiliary_driver_register(struct auxiliary_driver *auxdrv,
|
||||
auxdrv->driver.bus = &auxiliary_bus_type;
|
||||
auxdrv->driver.mod_name = modname;
|
||||
|
||||
- return driver_register(&auxdrv->driver);
|
||||
+ ret = driver_register(&auxdrv->driver);
|
||||
+ if (ret)
|
||||
+ kfree(auxdrv->driver.name);
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__auxiliary_driver_register);
|
||||
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
From 91f5728b6794550f08febea3bfe4018071520727 Mon Sep 17 00:00:00 2001
|
||||
From: Kyung Min Park <kyung.min.park@intel.com>
|
||||
Date: Mon, 7 Dec 2020 19:34:40 -0800
|
||||
Subject: [PATCH] x86: Enumerate AVX512 FP16 CPUID feature flag
|
||||
|
||||
Enumerate AVX512 Half-precision floating point (FP16) CPUID feature
|
||||
flag. Compared with using FP32, using FP16 cut the number of bits
|
||||
required for storage in half, reducing the exponent from 8 bits to 5,
|
||||
and the mantissa from 23 bits to 10. Using FP16 also enables developers
|
||||
to train and run inference on deep learning models fast when all
|
||||
precision or magnitude (FP32) is not needed.
|
||||
|
||||
A processor supports AVX512 FP16 if CPUID.(EAX=7,ECX=0):EDX[bit 23]
|
||||
is present. The AVX512 FP16 requires AVX512BW feature be implemented
|
||||
since the instructions for manipulating 32bit masks are associated with
|
||||
AVX512BW.
|
||||
|
||||
The only in-kernel usage of this is kvm passthrough. The CPU feature
|
||||
flag is shown as "avx512_fp16" in /proc/cpuinfo.
|
||||
|
||||
Signed-off-by: Kyung Min Park <kyung.min.park@intel.com>
|
||||
Acked-by: Dave Hansen <dave.hansen@intel.com>
|
||||
Reviewed-by: Tony Luck <tony.luck@intel.com>
|
||||
Message-Id: <20201208033441.28207-2-kyung.min.park@intel.com>
|
||||
Acked-by: Borislav Petkov <bp@suse.de>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
(cherry picked from commit e1b35da5e624f8b09d2e98845c2e4c84b179d9a4)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
arch/x86/include/asm/cpufeatures.h | 1 +
|
||||
arch/x86/kernel/cpu/cpuid-deps.c | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
|
||||
index 3b407f46f1a0..b5252fd26682 100644
|
||||
--- a/arch/x86/include/asm/cpufeatures.h
|
||||
+++ b/arch/x86/include/asm/cpufeatures.h
|
||||
@@ -374,6 +374,7 @@
|
||||
#define X86_FEATURE_TSXLDTRK (18*32+16) /* TSX Suspend Load Address Tracking */
|
||||
#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */
|
||||
#define X86_FEATURE_ARCH_LBR (18*32+19) /* Intel ARCH LBR */
|
||||
+#define X86_FEATURE_AVX512_FP16 (18*32+23) /* AVX512 FP16 */
|
||||
#define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */
|
||||
#define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */
|
||||
#define X86_FEATURE_FLUSH_L1D (18*32+28) /* Flush L1D cache */
|
||||
diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c
|
||||
index d502241995a3..42af31b64c2c 100644
|
||||
--- a/arch/x86/kernel/cpu/cpuid-deps.c
|
||||
+++ b/arch/x86/kernel/cpu/cpuid-deps.c
|
||||
@@ -69,6 +69,7 @@ static const struct cpuid_dep cpuid_deps[] = {
|
||||
{ X86_FEATURE_CQM_MBM_TOTAL, X86_FEATURE_CQM_LLC },
|
||||
{ X86_FEATURE_CQM_MBM_LOCAL, X86_FEATURE_CQM_LLC },
|
||||
{ X86_FEATURE_AVX512_BF16, X86_FEATURE_AVX512VL },
|
||||
+ { X86_FEATURE_AVX512_FP16, X86_FEATURE_AVX512BW },
|
||||
{ X86_FEATURE_ENQCMD, X86_FEATURE_XSAVES },
|
||||
{ X86_FEATURE_PER_THREAD_MBA, X86_FEATURE_MBA },
|
||||
{}
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
From 395b58fc9c018bd4fe380c40bcdd87c41ecf9b13 Mon Sep 17 00:00:00 2001
|
||||
From: Cathy Zhang <cathy.zhang@intel.com>
|
||||
Date: Mon, 7 Dec 2020 19:34:41 -0800
|
||||
Subject: [PATCH] KVM: x86: Expose AVX512_FP16 for supported CPUID
|
||||
|
||||
AVX512_FP16 is supported by Intel processors, like Sapphire Rapids.
|
||||
It could gain better performance for it's faster compared to FP32
|
||||
if the precision or magnitude requirements are met. It's availability
|
||||
is indicated by CPUID.(EAX=7,ECX=0):EDX[bit 23].
|
||||
|
||||
Expose it in KVM supported CPUID, then guest could make use of it; no
|
||||
new registers are used, only new instructions.
|
||||
|
||||
Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
|
||||
Signed-off-by: Kyung Min Park <kyung.min.park@intel.com>
|
||||
Acked-by: Dave Hansen <dave.hansen@intel.com>
|
||||
Reviewed-by: Tony Luck <tony.luck@intel.com>
|
||||
Message-Id: <20201208033441.28207-3-kyung.min.park@intel.com>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
(cherry picked from commit 2224fc9efb2d6593fbfb57287e39ba4958b188ba)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
arch/x86/kvm/cpuid.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
|
||||
index 41b0dc37720e..61f10169fc16 100644
|
||||
--- a/arch/x86/kvm/cpuid.c
|
||||
+++ b/arch/x86/kvm/cpuid.c
|
||||
@@ -418,7 +418,7 @@ void kvm_set_cpu_caps(void)
|
||||
F(AVX512_4VNNIW) | F(AVX512_4FMAPS) | F(SPEC_CTRL) |
|
||||
F(SPEC_CTRL_SSBD) | F(ARCH_CAPABILITIES) | F(INTEL_STIBP) |
|
||||
F(MD_CLEAR) | F(AVX512_VP2INTERSECT) | F(FSRM) |
|
||||
- F(SERIALIZE) | F(TSXLDTRK)
|
||||
+ F(SERIALIZE) | F(TSXLDTRK) | F(AVX512_FP16)
|
||||
);
|
||||
|
||||
/* TSC_ADJUST and ARCH_CAPABILITIES are emulated in software. */
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From 79f57d6d0f55cb6402cb445da438fee8d9133352 Mon Sep 17 00:00:00 2001
|
||||
From: Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
Date: Mon, 21 Dec 2020 09:04:54 -0300
|
||||
Subject: [PATCH] tools headers cpufeatures: Sync with the kernel sources
|
||||
|
||||
To pick the changes in:
|
||||
|
||||
69372cf01290b958 ("x86/cpu: Add VM page flush MSR availablility as a CPUID feature")
|
||||
e1b35da5e624f8b0 ("x86: Enumerate AVX512 FP16 CPUID feature flag")
|
||||
|
||||
That causes only these 'perf bench' objects to rebuild:
|
||||
|
||||
CC /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
|
||||
CC /tmp/build/perf/bench/mem-memset-x86-64-asm.o
|
||||
|
||||
And addresses these perf build warnings:
|
||||
|
||||
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
|
||||
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
|
||||
|
||||
Cc: Adrian Hunter <adrian.hunter@intel.com>
|
||||
Cc: Ian Rogers <irogers@google.com>
|
||||
Cc: Jiri Olsa <jolsa@kernel.org>
|
||||
Cc: Kyung Min Park <kyung.min.park@intel.com>
|
||||
Cc: Namhyung Kim <namhyung@kernel.org>
|
||||
Cc: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Cc: Tom Lendacky <thomas.lendacky@amd.com>
|
||||
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
(cherry picked from commit 7f3905f00a2025591a6883ee6880f928029b4d96)
|
||||
[mvb: Remove X86_FEATURE_VM_PAGE_FLUSH from this commit as that CPU
|
||||
feature constant is not provided by StarlingX's v5.10 baseline.]
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
tools/arch/x86/include/asm/cpufeatures.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h
|
||||
index b58730cc12e8..d7accc927691 100644
|
||||
--- a/tools/arch/x86/include/asm/cpufeatures.h
|
||||
+++ b/tools/arch/x86/include/asm/cpufeatures.h
|
||||
@@ -374,6 +374,7 @@
|
||||
#define X86_FEATURE_TSXLDTRK (18*32+16) /* TSX Suspend Load Address Tracking */
|
||||
#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */
|
||||
#define X86_FEATURE_ARCH_LBR (18*32+19) /* Intel ARCH LBR */
|
||||
+#define X86_FEATURE_AVX512_FP16 (18*32+23) /* AVX512 FP16 */
|
||||
#define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */
|
||||
#define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */
|
||||
#define X86_FEATURE_FLUSH_L1D (18*32+28) /* Flush L1D cache */
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From 547921028c785f90e52adb7f54cc2f13103934de Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <547921028c785f90e52adb7f54cc2f13103934de.1665174246.git.jim.somerville@windriver.com>
|
||||
From: Zqiang <qiang.zhang1211@gmail.com>
|
||||
Date: Mon, 15 Nov 2021 13:15:46 +0800
|
||||
Subject: [PATCH] rcu: Avoid running boost kthreads on isolated CPUs
|
||||
|
||||
When the boost kthreads are created on systems with nohz_full CPUs,
|
||||
the cpus_allowed_ptr is set to housekeeping_cpumask(HK_FLAG_KTHREAD).
|
||||
However, when the rcu_boost_kthread_setaffinity() is called, the original
|
||||
affinity will be changed and these kthreads can subsequently run on
|
||||
nohz_full CPUs. This commit makes rcu_boost_kthread_setaffinity()
|
||||
restrict these boost kthreads to housekeeping CPUs.
|
||||
|
||||
Signed-off-by: Zqiang <qiang.zhang1211@gmail.com>
|
||||
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
||||
[ commit c2cf0767e98eb4487444e5c7ebba491a866811ce upstream ]
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
kernel/rcu/tree_plugin.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
|
||||
index 9db906dcbdac..0a18fa5d27b3 100644
|
||||
--- a/kernel/rcu/tree_plugin.h
|
||||
+++ b/kernel/rcu/tree_plugin.h
|
||||
@@ -1185,8 +1185,9 @@ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu)
|
||||
if ((mask & leaf_node_cpu_bit(rnp, cpu)) &&
|
||||
cpu != outgoingcpu)
|
||||
cpumask_set_cpu(cpu, cm);
|
||||
+ cpumask_and(cm, cm, housekeeping_cpumask(HK_FLAG_RCU));
|
||||
if (cpumask_weight(cm) == 0)
|
||||
- cpumask_setall(cm);
|
||||
+ cpumask_copy(cm, housekeeping_cpumask(HK_FLAG_RCU));
|
||||
set_cpus_allowed_ptr(t, cm);
|
||||
free_cpumask_var(cm);
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From edbf1eb9032b84631031d9b43570e262f3461c24 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Foster <bfoster@redhat.com>
|
||||
Date: Fri, 9 Apr 2021 10:27:55 -0700
|
||||
Subject: [PATCH 2/4] xfs: open code ioend needs workqueue helper
|
||||
|
||||
Open code xfs_ioend_needs_workqueue() into the only remaining
|
||||
caller.
|
||||
|
||||
Signed-off-by: Brian Foster <bfoster@redhat.com>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
|
||||
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
|
||||
[commit 7adb8f14e134d5f885d47c4ccd620836235f0b7f upstream
|
||||
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git]
|
||||
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
|
||||
---
|
||||
fs/xfs/xfs_aops.c | 11 +++--------
|
||||
1 file changed, 3 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
|
||||
index 60943b28f..a74a9ead5 100644
|
||||
--- a/fs/xfs/xfs_aops.c
|
||||
+++ b/fs/xfs/xfs_aops.c
|
||||
@@ -206,13 +206,6 @@ xfs_end_io(
|
||||
}
|
||||
}
|
||||
|
||||
-static inline bool xfs_ioend_needs_workqueue(struct iomap_ioend *ioend)
|
||||
-{
|
||||
- return xfs_ioend_is_append(ioend) ||
|
||||
- ioend->io_type == IOMAP_UNWRITTEN ||
|
||||
- (ioend->io_flags & IOMAP_F_SHARED);
|
||||
-}
|
||||
-
|
||||
STATIC void
|
||||
xfs_end_bio(
|
||||
struct bio *bio)
|
||||
@@ -472,7 +465,9 @@ xfs_prepare_ioend(
|
||||
|
||||
memalloc_nofs_restore(nofs_flag);
|
||||
|
||||
- if (xfs_ioend_needs_workqueue(ioend))
|
||||
+ /* send ioends that might require a transaction to the completion wq */
|
||||
+ if (xfs_ioend_is_append(ioend) || ioend->io_type == IOMAP_UNWRITTEN ||
|
||||
+ (ioend->io_flags & IOMAP_F_SHARED))
|
||||
ioend->io_bio->bi_end_io = xfs_end_bio;
|
||||
return status;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
From 170e31793806ce5e5a9647b6340954536244518e Mon Sep 17 00:00:00 2001
|
||||
From: Brian Foster <bfoster@redhat.com>
|
||||
Date: Fri, 9 Apr 2021 10:27:55 -0700
|
||||
Subject: [PATCH 3/4] xfs: drop unused ioend private merge and setfilesize code
|
||||
|
||||
XFS no longer attaches anthing to ioend->io_private. Remove the
|
||||
unnecessary ->io_private merging code. This removes the only remaining
|
||||
user of xfs_setfilesize_ioend() so remove that function as well.
|
||||
|
||||
Signed-off-by: Brian Foster <bfoster@redhat.com>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
|
||||
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
|
||||
[commit 044c6449f18f174ba8d86640936add3fc7582e49 upstream
|
||||
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git]
|
||||
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
|
||||
---
|
||||
fs/xfs/xfs_aops.c | 46 +---------------------------------------------
|
||||
1 file changed, 1 insertion(+), 45 deletions(-)
|
||||
|
||||
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
|
||||
index a74a9ead5..23a9bd9ff 100644
|
||||
--- a/fs/xfs/xfs_aops.c
|
||||
+++ b/fs/xfs/xfs_aops.c
|
||||
@@ -85,31 +85,6 @@ xfs_setfilesize(
|
||||
return __xfs_setfilesize(ip, tp, offset, size);
|
||||
}
|
||||
|
||||
-STATIC int
|
||||
-xfs_setfilesize_ioend(
|
||||
- struct iomap_ioend *ioend,
|
||||
- int error)
|
||||
-{
|
||||
- struct xfs_inode *ip = XFS_I(ioend->io_inode);
|
||||
- struct xfs_trans *tp = ioend->io_private;
|
||||
-
|
||||
- /*
|
||||
- * The transaction may have been allocated in the I/O submission thread,
|
||||
- * thus we need to mark ourselves as being in a transaction manually.
|
||||
- * Similarly for freeze protection.
|
||||
- */
|
||||
- xfs_trans_set_context(tp);
|
||||
- __sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS);
|
||||
-
|
||||
- /* we abort the update if there was an IO error */
|
||||
- if (error) {
|
||||
- xfs_trans_cancel(tp);
|
||||
- return error;
|
||||
- }
|
||||
-
|
||||
- return __xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size);
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* IO write completion.
|
||||
*/
|
||||
@@ -163,25 +138,6 @@ xfs_end_ioend(
|
||||
memalloc_nofs_restore(nofs_flag);
|
||||
}
|
||||
|
||||
-/*
|
||||
- * If the to be merged ioend has a preallocated transaction for file
|
||||
- * size updates we need to ensure the ioend it is merged into also
|
||||
- * has one. If it already has one we can simply cancel the transaction
|
||||
- * as it is guaranteed to be clean.
|
||||
- */
|
||||
-static void
|
||||
-xfs_ioend_merge_private(
|
||||
- struct iomap_ioend *ioend,
|
||||
- struct iomap_ioend *next)
|
||||
-{
|
||||
- if (!ioend->io_private) {
|
||||
- ioend->io_private = next->io_private;
|
||||
- next->io_private = NULL;
|
||||
- } else {
|
||||
- xfs_setfilesize_ioend(next, -ECANCELED);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
/* Finish all pending io completions. */
|
||||
void
|
||||
xfs_end_io(
|
||||
@@ -201,7 +157,7 @@ xfs_end_io(
|
||||
while ((ioend = list_first_entry_or_null(&tmp, struct iomap_ioend,
|
||||
io_list))) {
|
||||
list_del_init(&ioend->io_list);
|
||||
- iomap_ioend_try_merge(ioend, &tmp, xfs_ioend_merge_private);
|
||||
+ iomap_ioend_try_merge(ioend, &tmp, NULL);
|
||||
xfs_end_ioend(ioend);
|
||||
}
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
From 2fd609b6c90a88630a50fb317473b210759b3873 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Foster <bfoster@redhat.com>
|
||||
Date: Fri, 9 Apr 2021 10:27:56 -0700
|
||||
Subject: [PATCH 4/4] xfs: drop unnecessary setfilesize helper
|
||||
|
||||
xfs_setfilesize() is the only remaining caller of the internal
|
||||
__xfs_setfilesize() helper. Fold them into a single function.
|
||||
|
||||
Signed-off-by: Brian Foster <bfoster@redhat.com>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
|
||||
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
|
||||
[commit e7a3d7e792a5ad50583a2e6c35e72bd2ca6096f4 upstream
|
||||
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git]
|
||||
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
|
||||
---
|
||||
fs/xfs/xfs_aops.c | 29 +++++++++--------------------
|
||||
1 file changed, 9 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
|
||||
index 23a9bd9ff..9e32d4135 100644
|
||||
--- a/fs/xfs/xfs_aops.c
|
||||
+++ b/fs/xfs/xfs_aops.c
|
||||
@@ -42,14 +42,20 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend)
|
||||
/*
|
||||
* Update on-disk file size now that data has been written to disk.
|
||||
*/
|
||||
-STATIC int
|
||||
-__xfs_setfilesize(
|
||||
+int
|
||||
+xfs_setfilesize(
|
||||
struct xfs_inode *ip,
|
||||
- struct xfs_trans *tp,
|
||||
xfs_off_t offset,
|
||||
size_t size)
|
||||
{
|
||||
+ struct xfs_mount *mp = ip->i_mount;
|
||||
+ struct xfs_trans *tp;
|
||||
xfs_fsize_t isize;
|
||||
+ int error;
|
||||
+
|
||||
+ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp);
|
||||
+ if (error)
|
||||
+ return error;
|
||||
|
||||
xfs_ilock(ip, XFS_ILOCK_EXCL);
|
||||
isize = xfs_new_eof(ip, offset + size);
|
||||
@@ -68,23 +74,6 @@ __xfs_setfilesize(
|
||||
return xfs_trans_commit(tp);
|
||||
}
|
||||
|
||||
-int
|
||||
-xfs_setfilesize(
|
||||
- struct xfs_inode *ip,
|
||||
- xfs_off_t offset,
|
||||
- size_t size)
|
||||
-{
|
||||
- struct xfs_mount *mp = ip->i_mount;
|
||||
- struct xfs_trans *tp;
|
||||
- int error;
|
||||
-
|
||||
- error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp);
|
||||
- if (error)
|
||||
- return error;
|
||||
-
|
||||
- return __xfs_setfilesize(ip, tp, offset, size);
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* IO write completion.
|
||||
*/
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
From 3e65002714f5b4d20ab30b01a58ddb0e243a74ac Mon Sep 17 00:00:00 2001
|
||||
From: Wentao Zhang <wentao.zhang@windriver.com>
|
||||
Date: Thu, 8 Dec 2022 11:55:17 +0800
|
||||
Subject: [PATCH] samples/bpf: use kprobe and urandom_read_iter
|
||||
|
||||
14c174633f34 ("random: remove unused tracepoints") removed all the
|
||||
tracepoints from drivers/char/random.c, one of which,
|
||||
random:urandom_read.
|
||||
|
||||
1b388e7765f2 ("random: convert to using fops->read_iter()") replaced
|
||||
kernel function urandom_read with urandom_read_iter.
|
||||
Therefore, kprobe on urandom_read is not working any more.
|
||||
|
||||
Use kprobing to replace the tracepoint and use urandom_read_iter
|
||||
to replace urandom_read to fix the breakage.
|
||||
|
||||
Fixes: 1b388e7765f2 ("random: convert to using fops->read_iter()")
|
||||
Fixes: 14c174633f34 ("random: remove unused tracepoints")
|
||||
Signed-off-by: Wentao Zhang <wentao.zhang@windriver.com>
|
||||
---
|
||||
samples/bpf/test_overhead_kprobe_kern.c | 2 +-
|
||||
samples/bpf/test_overhead_raw_tp_kern.c | 2 +-
|
||||
samples/bpf/test_overhead_tp_kern.c | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/samples/bpf/test_overhead_kprobe_kern.c b/samples/bpf/test_overhead_kprobe_kern.c
|
||||
index f6d593e47..2dcb4ba0e 100644
|
||||
--- a/samples/bpf/test_overhead_kprobe_kern.c
|
||||
+++ b/samples/bpf/test_overhead_kprobe_kern.c
|
||||
@@ -38,7 +38,7 @@ int prog(struct pt_regs *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-SEC("kprobe/urandom_read")
|
||||
+SEC("kprobe/urandom_read_iter")
|
||||
int prog2(struct pt_regs *ctx)
|
||||
{
|
||||
return 0;
|
||||
diff --git a/samples/bpf/test_overhead_raw_tp_kern.c b/samples/bpf/test_overhead_raw_tp_kern.c
|
||||
index 8763181a3..34a5aba61 100644
|
||||
--- a/samples/bpf/test_overhead_raw_tp_kern.c
|
||||
+++ b/samples/bpf/test_overhead_raw_tp_kern.c
|
||||
@@ -9,7 +9,7 @@ int prog(struct bpf_raw_tracepoint_args *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-SEC("raw_tracepoint/urandom_read")
|
||||
+SEC("kprobe/urandom_read_iter")
|
||||
int prog2(struct bpf_raw_tracepoint_args *ctx)
|
||||
{
|
||||
return 0;
|
||||
diff --git a/samples/bpf/test_overhead_tp_kern.c b/samples/bpf/test_overhead_tp_kern.c
|
||||
index eaa32693f..d5f7abb4c 100644
|
||||
--- a/samples/bpf/test_overhead_tp_kern.c
|
||||
+++ b/samples/bpf/test_overhead_tp_kern.c
|
||||
@@ -28,7 +28,7 @@ struct urandom_read {
|
||||
int pool_left;
|
||||
int input_left;
|
||||
};
|
||||
-SEC("tracepoint/random/urandom_read")
|
||||
+SEC("kprobe/urandom_read_iter")
|
||||
int prog2(struct urandom_read *ctx)
|
||||
{
|
||||
return 0;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
From b4cb1f9c968c93893b8f092b4360f3da7237afec Mon Sep 17 00:00:00 2001
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
Date: Tue, 15 Jun 2021 18:25:53 +0800
|
||||
Subject: [PATCH] kernfs: move revalidate to be near lookup
|
||||
|
||||
While the dentry operation kernfs_dop_revalidate() is grouped with
|
||||
dentry type functions it also has a strong affinity to the inode
|
||||
operation ->lookup().
|
||||
|
||||
It makes sense to locate this function near to kernfs_iop_lookup()
|
||||
because we will be adding VFS negative dentry caching to reduce path
|
||||
lookup overhead for non-existent paths.
|
||||
|
||||
There's no functional change from this patch.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
|
||||
Link: https://lore.kernel.org/r/162375275365.232295.8995526416263659926.stgit@web.messagingengine.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/dir.c | 86 ++++++++++++++++++++++++-------------------------
|
||||
1 file changed, 43 insertions(+), 43 deletions(-)
|
||||
|
||||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
|
||||
index 8b3c86a502da..c16571cbb997 100644
|
||||
--- a/fs/kernfs/dir.c
|
||||
+++ b/fs/kernfs/dir.c
|
||||
@@ -556,49 +556,6 @@ void kernfs_put(struct kernfs_node *kn)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kernfs_put);
|
||||
|
||||
-static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
-{
|
||||
- struct kernfs_node *kn;
|
||||
-
|
||||
- if (flags & LOOKUP_RCU)
|
||||
- return -ECHILD;
|
||||
-
|
||||
- /* Always perform fresh lookup for negatives */
|
||||
- if (d_really_is_negative(dentry))
|
||||
- goto out_bad_unlocked;
|
||||
-
|
||||
- kn = kernfs_dentry_node(dentry);
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
-
|
||||
- /* The kernfs node has been deactivated */
|
||||
- if (!kernfs_active(kn))
|
||||
- goto out_bad;
|
||||
-
|
||||
- /* The kernfs node has been moved? */
|
||||
- if (kernfs_dentry_node(dentry->d_parent) != kn->parent)
|
||||
- goto out_bad;
|
||||
-
|
||||
- /* The kernfs node has been renamed */
|
||||
- if (strcmp(dentry->d_name.name, kn->name) != 0)
|
||||
- goto out_bad;
|
||||
-
|
||||
- /* The kernfs node has been moved to a different namespace */
|
||||
- if (kn->parent && kernfs_ns_enabled(kn->parent) &&
|
||||
- kernfs_info(dentry->d_sb)->ns != kn->ns)
|
||||
- goto out_bad;
|
||||
-
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
- return 1;
|
||||
-out_bad:
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
-out_bad_unlocked:
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-const struct dentry_operations kernfs_dops = {
|
||||
- .d_revalidate = kernfs_dop_revalidate,
|
||||
-};
|
||||
-
|
||||
/**
|
||||
* kernfs_node_from_dentry - determine kernfs_node associated with a dentry
|
||||
* @dentry: the dentry in question
|
||||
@@ -1081,6 +1038,49 @@ struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent,
|
||||
return ERR_PTR(rc);
|
||||
}
|
||||
|
||||
+static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
+{
|
||||
+ struct kernfs_node *kn;
|
||||
+
|
||||
+ if (flags & LOOKUP_RCU)
|
||||
+ return -ECHILD;
|
||||
+
|
||||
+ /* Always perform fresh lookup for negatives */
|
||||
+ if (d_really_is_negative(dentry))
|
||||
+ goto out_bad_unlocked;
|
||||
+
|
||||
+ kn = kernfs_dentry_node(dentry);
|
||||
+ mutex_lock(&kernfs_mutex);
|
||||
+
|
||||
+ /* The kernfs node has been deactivated */
|
||||
+ if (!kernfs_active(kn))
|
||||
+ goto out_bad;
|
||||
+
|
||||
+ /* The kernfs node has been moved? */
|
||||
+ if (kernfs_dentry_node(dentry->d_parent) != kn->parent)
|
||||
+ goto out_bad;
|
||||
+
|
||||
+ /* The kernfs node has been renamed */
|
||||
+ if (strcmp(dentry->d_name.name, kn->name) != 0)
|
||||
+ goto out_bad;
|
||||
+
|
||||
+ /* The kernfs node has been moved to a different namespace */
|
||||
+ if (kn->parent && kernfs_ns_enabled(kn->parent) &&
|
||||
+ kernfs_info(dentry->d_sb)->ns != kn->ns)
|
||||
+ goto out_bad;
|
||||
+
|
||||
+ mutex_unlock(&kernfs_mutex);
|
||||
+ return 1;
|
||||
+out_bad:
|
||||
+ mutex_unlock(&kernfs_mutex);
|
||||
+out_bad_unlocked:
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+const struct dentry_operations kernfs_dops = {
|
||||
+ .d_revalidate = kernfs_dop_revalidate,
|
||||
+};
|
||||
+
|
||||
static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
struct dentry *dentry,
|
||||
unsigned int flags)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
From 55a6f84896a433e74ddddf2203cbb5fec5c05fca Mon Sep 17 00:00:00 2001
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
Date: Fri, 16 Jul 2021 17:28:18 +0800
|
||||
Subject: [PATCH] kernfs: add a revision to identify directory node changes
|
||||
|
||||
Add a revision counter to kernfs directory nodes so it can be used
|
||||
to detect if a directory node has changed during negative dentry
|
||||
revalidation.
|
||||
|
||||
There's an assumption that sizeof(unsigned long) <= sizeof(pointer)
|
||||
on all architectures and as far as I know that assumption holds.
|
||||
|
||||
So adding a revision counter to the struct kernfs_elem_dir variant of
|
||||
the kernfs_node type union won't increase the size of the kernfs_node
|
||||
struct. This is because struct kernfs_elem_dir is at least
|
||||
sizeof(pointer) smaller than the largest union variant. It's tempting
|
||||
to make the revision counter a u64 but that would increase the size of
|
||||
kernfs_node on archs where sizeof(pointer) is smaller than the revision
|
||||
counter.
|
||||
|
||||
Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
Link: https://lore.kernel.org/r/162642769895.63632.8356662784964509867.stgit@web.messagingengine.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/dir.c | 2 ++
|
||||
fs/kernfs/kernfs-internal.h | 19 +++++++++++++++++++
|
||||
include/linux/kernfs.h | 5 +++++
|
||||
3 files changed, 26 insertions(+)
|
||||
|
||||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
|
||||
index c16571cbb997..410fbbf797df 100644
|
||||
--- a/fs/kernfs/dir.c
|
||||
+++ b/fs/kernfs/dir.c
|
||||
@@ -380,6 +380,7 @@ static int kernfs_link_sibling(struct kernfs_node *kn)
|
||||
/* successfully added, account subdir number */
|
||||
if (kernfs_type(kn) == KERNFS_DIR)
|
||||
kn->parent->dir.subdirs++;
|
||||
+ kernfs_inc_rev(kn->parent);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -402,6 +403,7 @@ static bool kernfs_unlink_sibling(struct kernfs_node *kn)
|
||||
|
||||
if (kernfs_type(kn) == KERNFS_DIR)
|
||||
kn->parent->dir.subdirs--;
|
||||
+ kernfs_inc_rev(kn->parent);
|
||||
|
||||
rb_erase(&kn->rb, &kn->parent->dir.children);
|
||||
RB_CLEAR_NODE(&kn->rb);
|
||||
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
|
||||
index 7ee97ef59184..6a8d0ca26d03 100644
|
||||
--- a/fs/kernfs/kernfs-internal.h
|
||||
+++ b/fs/kernfs/kernfs-internal.h
|
||||
@@ -81,6 +81,25 @@ static inline struct kernfs_node *kernfs_dentry_node(struct dentry *dentry)
|
||||
return d_inode(dentry)->i_private;
|
||||
}
|
||||
|
||||
+static inline void kernfs_set_rev(struct kernfs_node *parent,
|
||||
+ struct dentry *dentry)
|
||||
+{
|
||||
+ dentry->d_time = parent->dir.rev;
|
||||
+}
|
||||
+
|
||||
+static inline void kernfs_inc_rev(struct kernfs_node *parent)
|
||||
+{
|
||||
+ parent->dir.rev++;
|
||||
+}
|
||||
+
|
||||
+static inline bool kernfs_dir_changed(struct kernfs_node *parent,
|
||||
+ struct dentry *dentry)
|
||||
+{
|
||||
+ if (parent->dir.rev != dentry->d_time)
|
||||
+ return true;
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
extern const struct super_operations kernfs_sops;
|
||||
extern struct kmem_cache *kernfs_node_cache, *kernfs_iattrs_cache;
|
||||
|
||||
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
|
||||
index 89f6a4214a70..195afa63ab1c 100644
|
||||
--- a/include/linux/kernfs.h
|
||||
+++ b/include/linux/kernfs.h
|
||||
@@ -98,6 +98,11 @@ struct kernfs_elem_dir {
|
||||
* better directly in kernfs_node but is here to save space.
|
||||
*/
|
||||
struct kernfs_root *root;
|
||||
+ /*
|
||||
+ * Monotonic revision counter, used to identify if a directory
|
||||
+ * node has changed during negative dentry revalidation.
|
||||
+ */
|
||||
+ unsigned long rev;
|
||||
};
|
||||
|
||||
struct kernfs_elem_symlink {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
From 1952b6d3b026943f0d922c9f8e7bf13b1f0c08f2 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
Date: Fri, 16 Jul 2021 17:28:24 +0800
|
||||
Subject: [PATCH] kernfs: use VFS negative dentry caching
|
||||
|
||||
If there are many lookups for non-existent paths these negative lookups
|
||||
can lead to a lot of overhead during path walks.
|
||||
|
||||
The VFS allows dentries to be created as negative and hashed, and caches
|
||||
them so they can be used to reduce the fairly high overhead alloc/free
|
||||
cycle that occurs during these lookups.
|
||||
|
||||
Use the kernfs node parent revision to identify if a change has been
|
||||
made to the containing directory so that the negative dentry can be
|
||||
discarded and the lookup redone.
|
||||
|
||||
Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
Link: https://lore.kernel.org/r/162642770420.63632.15791924970508867106.stgit@web.messagingengine.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/dir.c | 55 +++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 35 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
|
||||
index 410fbbf797df..0bbd09af8520 100644
|
||||
--- a/fs/kernfs/dir.c
|
||||
+++ b/fs/kernfs/dir.c
|
||||
@@ -1047,9 +1047,31 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
if (flags & LOOKUP_RCU)
|
||||
return -ECHILD;
|
||||
|
||||
- /* Always perform fresh lookup for negatives */
|
||||
- if (d_really_is_negative(dentry))
|
||||
- goto out_bad_unlocked;
|
||||
+ /* Negative hashed dentry? */
|
||||
+ if (d_really_is_negative(dentry)) {
|
||||
+ struct kernfs_node *parent;
|
||||
+
|
||||
+ /* If the kernfs parent node has changed discard and
|
||||
+ * proceed to ->lookup.
|
||||
+ */
|
||||
+ mutex_lock(&kernfs_mutex);
|
||||
+ spin_lock(&dentry->d_lock);
|
||||
+ parent = kernfs_dentry_node(dentry->d_parent);
|
||||
+ if (parent) {
|
||||
+ if (kernfs_dir_changed(parent, dentry)) {
|
||||
+ spin_unlock(&dentry->d_lock);
|
||||
+ mutex_unlock(&kernfs_mutex);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ spin_unlock(&dentry->d_lock);
|
||||
+ mutex_unlock(&kernfs_mutex);
|
||||
+
|
||||
+ /* The kernfs parent node hasn't changed, leave the
|
||||
+ * dentry negative and return success.
|
||||
+ */
|
||||
+ return 1;
|
||||
+ }
|
||||
|
||||
kn = kernfs_dentry_node(dentry);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
@@ -1075,7 +1097,6 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
return 1;
|
||||
out_bad:
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
-out_bad_unlocked:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1090,33 +1111,27 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
struct dentry *ret;
|
||||
struct kernfs_node *parent = dir->i_private;
|
||||
struct kernfs_node *kn;
|
||||
- struct inode *inode;
|
||||
+ struct inode *inode = NULL;
|
||||
const void *ns = NULL;
|
||||
|
||||
mutex_lock(&kernfs_mutex);
|
||||
-
|
||||
if (kernfs_ns_enabled(parent))
|
||||
ns = kernfs_info(dir->i_sb)->ns;
|
||||
|
||||
kn = kernfs_find_ns(parent, dentry->d_name.name, ns);
|
||||
-
|
||||
- /* no such entry */
|
||||
- if (!kn || !kernfs_active(kn)) {
|
||||
- ret = NULL;
|
||||
- goto out_unlock;
|
||||
- }
|
||||
-
|
||||
/* attach dentry and inode */
|
||||
- inode = kernfs_get_inode(dir->i_sb, kn);
|
||||
- if (!inode) {
|
||||
- ret = ERR_PTR(-ENOMEM);
|
||||
- goto out_unlock;
|
||||
+ if (kn && kernfs_active(kn)) {
|
||||
+ inode = kernfs_get_inode(dir->i_sb, kn);
|
||||
+ if (!inode)
|
||||
+ inode = ERR_PTR(-ENOMEM);
|
||||
}
|
||||
-
|
||||
- /* instantiate and hash dentry */
|
||||
+ /* Needed only for negative dentry validation */
|
||||
+ if (!inode)
|
||||
+ kernfs_set_rev(parent, dentry);
|
||||
+ /* instantiate and hash (possibly negative) dentry */
|
||||
ret = d_splice_alias(inode, dentry);
|
||||
- out_unlock:
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
+
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,576 +0,0 @@
|
||||
From ab1b2b46cfa230d14cbe6a02f4eee34ed9152f7c Mon Sep 17 00:00:00 2001
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
Date: Fri, 16 Jul 2021 17:28:29 +0800
|
||||
Subject: [PATCH] kernfs: switch kernfs to use an rwsem
|
||||
|
||||
The kernfs global lock restricts the ability to perform kernfs node
|
||||
lookup operations in parallel during path walks.
|
||||
|
||||
Change the kernfs mutex to an rwsem so that, when opportunity arises,
|
||||
node searches can be done in parallel with path walk lookups.
|
||||
|
||||
Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
Link: https://lore.kernel.org/r/162642770946.63632.2218304587223241374.stgit@web.messagingengine.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/dir.c | 100 ++++++++++++++++++------------------
|
||||
fs/kernfs/file.c | 4 +-
|
||||
fs/kernfs/inode.c | 16 +++---
|
||||
fs/kernfs/kernfs-internal.h | 5 +-
|
||||
fs/kernfs/mount.c | 12 ++---
|
||||
fs/kernfs/symlink.c | 4 +-
|
||||
include/linux/kernfs.h | 2 +-
|
||||
7 files changed, 72 insertions(+), 71 deletions(-)
|
||||
|
||||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
|
||||
index 0bbd09af8520..cdc57ab2e5ea 100644
|
||||
--- a/fs/kernfs/dir.c
|
||||
+++ b/fs/kernfs/dir.c
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "kernfs-internal.h"
|
||||
|
||||
-DEFINE_MUTEX(kernfs_mutex);
|
||||
+DECLARE_RWSEM(kernfs_rwsem);
|
||||
static DEFINE_SPINLOCK(kernfs_rename_lock); /* kn->parent and ->name */
|
||||
/*
|
||||
* Don't use rename_lock to piggy back on pr_cont_buf. We don't want to
|
||||
@@ -34,7 +34,7 @@ static DEFINE_SPINLOCK(kernfs_idr_lock); /* root->ino_idr */
|
||||
|
||||
static bool kernfs_active(struct kernfs_node *kn)
|
||||
{
|
||||
- lockdep_assert_held(&kernfs_mutex);
|
||||
+ lockdep_assert_held(&kernfs_rwsem);
|
||||
return atomic_read(&kn->active) >= 0;
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ static int kernfs_sd_compare(const struct kernfs_node *left,
|
||||
* @kn->parent->dir.children.
|
||||
*
|
||||
* Locking:
|
||||
- * mutex_lock(kernfs_mutex)
|
||||
+ * kernfs_rwsem held exclusive
|
||||
*
|
||||
* RETURNS:
|
||||
* 0 on susccess -EEXIST on failure.
|
||||
@@ -394,7 +394,7 @@ static int kernfs_link_sibling(struct kernfs_node *kn)
|
||||
* removed, %false if @kn wasn't on the rbtree.
|
||||
*
|
||||
* Locking:
|
||||
- * mutex_lock(kernfs_mutex)
|
||||
+ * kernfs_rwsem held exclusive
|
||||
*/
|
||||
static bool kernfs_unlink_sibling(struct kernfs_node *kn)
|
||||
{
|
||||
@@ -465,14 +465,14 @@ void kernfs_put_active(struct kernfs_node *kn)
|
||||
* return after draining is complete.
|
||||
*/
|
||||
static void kernfs_drain(struct kernfs_node *kn)
|
||||
- __releases(&kernfs_mutex) __acquires(&kernfs_mutex)
|
||||
+ __releases(&kernfs_rwsem) __acquires(&kernfs_rwsem)
|
||||
{
|
||||
struct kernfs_root *root = kernfs_root(kn);
|
||||
|
||||
- lockdep_assert_held(&kernfs_mutex);
|
||||
+ lockdep_assert_held_write(&kernfs_rwsem);
|
||||
WARN_ON_ONCE(kernfs_active(kn));
|
||||
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
|
||||
if (kernfs_lockdep(kn)) {
|
||||
rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_);
|
||||
@@ -491,7 +491,7 @@ static void kernfs_drain(struct kernfs_node *kn)
|
||||
|
||||
kernfs_drain_open_files(kn);
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -731,7 +731,7 @@ int kernfs_add_one(struct kernfs_node *kn)
|
||||
bool has_ns;
|
||||
int ret;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
|
||||
ret = -EINVAL;
|
||||
has_ns = kernfs_ns_enabled(parent);
|
||||
@@ -762,7 +762,7 @@ int kernfs_add_one(struct kernfs_node *kn)
|
||||
ps_iattr->ia_mtime = ps_iattr->ia_ctime;
|
||||
}
|
||||
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
|
||||
/*
|
||||
* Activate the new node unless CREATE_DEACTIVATED is requested.
|
||||
@@ -776,7 +776,7 @@ int kernfs_add_one(struct kernfs_node *kn)
|
||||
return 0;
|
||||
|
||||
out_unlock:
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -797,7 +797,7 @@ static struct kernfs_node *kernfs_find_ns(struct kernfs_node *parent,
|
||||
bool has_ns = kernfs_ns_enabled(parent);
|
||||
unsigned int hash;
|
||||
|
||||
- lockdep_assert_held(&kernfs_mutex);
|
||||
+ lockdep_assert_held(&kernfs_rwsem);
|
||||
|
||||
if (has_ns != (bool)ns) {
|
||||
WARN(1, KERN_WARNING "kernfs: ns %s in '%s' for '%s'\n",
|
||||
@@ -829,7 +829,7 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent,
|
||||
size_t len;
|
||||
char *p, *name;
|
||||
|
||||
- lockdep_assert_held(&kernfs_mutex);
|
||||
+ lockdep_assert_held_read(&kernfs_rwsem);
|
||||
|
||||
spin_lock_irq(&kernfs_pr_cont_lock);
|
||||
|
||||
@@ -868,10 +868,10 @@ struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
|
||||
{
|
||||
struct kernfs_node *kn;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
kn = kernfs_find_ns(parent, name, ns);
|
||||
kernfs_get(kn);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
|
||||
return kn;
|
||||
}
|
||||
@@ -892,10 +892,10 @@ struct kernfs_node *kernfs_walk_and_get_ns(struct kernfs_node *parent,
|
||||
{
|
||||
struct kernfs_node *kn;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
kn = kernfs_walk_ns(parent, path, ns);
|
||||
kernfs_get(kn);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
|
||||
return kn;
|
||||
}
|
||||
@@ -1054,18 +1054,18 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
/* If the kernfs parent node has changed discard and
|
||||
* proceed to ->lookup.
|
||||
*/
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
spin_lock(&dentry->d_lock);
|
||||
parent = kernfs_dentry_node(dentry->d_parent);
|
||||
if (parent) {
|
||||
if (kernfs_dir_changed(parent, dentry)) {
|
||||
spin_unlock(&dentry->d_lock);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
spin_unlock(&dentry->d_lock);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
|
||||
/* The kernfs parent node hasn't changed, leave the
|
||||
* dentry negative and return success.
|
||||
@@ -1074,7 +1074,7 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
}
|
||||
|
||||
kn = kernfs_dentry_node(dentry);
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
|
||||
/* The kernfs node has been deactivated */
|
||||
if (!kernfs_active(kn))
|
||||
@@ -1093,10 +1093,10 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
kernfs_info(dentry->d_sb)->ns != kn->ns)
|
||||
goto out_bad;
|
||||
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
return 1;
|
||||
out_bad:
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1114,7 +1114,7 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
struct inode *inode = NULL;
|
||||
const void *ns = NULL;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
if (kernfs_ns_enabled(parent))
|
||||
ns = kernfs_info(dir->i_sb)->ns;
|
||||
|
||||
@@ -1130,7 +1130,7 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
kernfs_set_rev(parent, dentry);
|
||||
/* instantiate and hash (possibly negative) dentry */
|
||||
ret = d_splice_alias(inode, dentry);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1250,7 +1250,7 @@ static struct kernfs_node *kernfs_next_descendant_post(struct kernfs_node *pos,
|
||||
{
|
||||
struct rb_node *rbn;
|
||||
|
||||
- lockdep_assert_held(&kernfs_mutex);
|
||||
+ lockdep_assert_held_write(&kernfs_rwsem);
|
||||
|
||||
/* if first iteration, visit leftmost descendant which may be root */
|
||||
if (!pos)
|
||||
@@ -1286,7 +1286,7 @@ void kernfs_activate(struct kernfs_node *kn)
|
||||
{
|
||||
struct kernfs_node *pos;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
|
||||
pos = NULL;
|
||||
while ((pos = kernfs_next_descendant_post(pos, kn))) {
|
||||
@@ -1300,14 +1300,14 @@ void kernfs_activate(struct kernfs_node *kn)
|
||||
pos->flags |= KERNFS_ACTIVATED;
|
||||
}
|
||||
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
}
|
||||
|
||||
static void __kernfs_remove(struct kernfs_node *kn)
|
||||
{
|
||||
struct kernfs_node *pos;
|
||||
|
||||
- lockdep_assert_held(&kernfs_mutex);
|
||||
+ lockdep_assert_held_write(&kernfs_rwsem);
|
||||
|
||||
/*
|
||||
* Short-circuit if non-root @kn has already finished removal.
|
||||
@@ -1330,7 +1330,7 @@ static void __kernfs_remove(struct kernfs_node *kn)
|
||||
pos = kernfs_leftmost_descendant(kn);
|
||||
|
||||
/*
|
||||
- * kernfs_drain() drops kernfs_mutex temporarily and @pos's
|
||||
+ * kernfs_drain() drops kernfs_rwsem temporarily and @pos's
|
||||
* base ref could have been put by someone else by the time
|
||||
* the function returns. Make sure it doesn't go away
|
||||
* underneath us.
|
||||
@@ -1377,9 +1377,9 @@ static void __kernfs_remove(struct kernfs_node *kn)
|
||||
*/
|
||||
void kernfs_remove(struct kernfs_node *kn)
|
||||
{
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
__kernfs_remove(kn);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1466,17 +1466,17 @@ bool kernfs_remove_self(struct kernfs_node *kn)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
kernfs_break_active_protection(kn);
|
||||
|
||||
/*
|
||||
* SUICIDAL is used to arbitrate among competing invocations. Only
|
||||
* the first one will actually perform removal. When the removal
|
||||
* is complete, SUICIDED is set and the active ref is restored
|
||||
- * while holding kernfs_mutex. The ones which lost arbitration
|
||||
- * waits for SUICDED && drained which can happen only after the
|
||||
- * enclosing kernfs operation which executed the winning instance
|
||||
- * of kernfs_remove_self() finished.
|
||||
+ * while kernfs_rwsem for held exclusive. The ones which lost
|
||||
+ * arbitration waits for SUICIDED && drained which can happen only
|
||||
+ * after the enclosing kernfs operation which executed the winning
|
||||
+ * instance of kernfs_remove_self() finished.
|
||||
*/
|
||||
if (!(kn->flags & KERNFS_SUICIDAL)) {
|
||||
kn->flags |= KERNFS_SUICIDAL;
|
||||
@@ -1494,9 +1494,9 @@ bool kernfs_remove_self(struct kernfs_node *kn)
|
||||
atomic_read(&kn->active) == KN_DEACTIVATED_BIAS)
|
||||
break;
|
||||
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
schedule();
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
}
|
||||
finish_wait(waitq, &wait);
|
||||
WARN_ON_ONCE(!RB_EMPTY_NODE(&kn->rb));
|
||||
@@ -1504,12 +1504,12 @@ bool kernfs_remove_self(struct kernfs_node *kn)
|
||||
}
|
||||
|
||||
/*
|
||||
- * This must be done while holding kernfs_mutex; otherwise, waiting
|
||||
- * for SUICIDED && deactivated could finish prematurely.
|
||||
+ * This must be done while kernfs_rwsem held exclusive; otherwise,
|
||||
+ * waiting for SUICIDED && deactivated could finish prematurely.
|
||||
*/
|
||||
kernfs_unbreak_active_protection(kn);
|
||||
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1533,7 +1533,7 @@ int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
|
||||
kn = kernfs_find_ns(parent, name, ns);
|
||||
if (kn) {
|
||||
@@ -1542,7 +1542,7 @@ int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
|
||||
kernfs_put(kn);
|
||||
}
|
||||
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
|
||||
if (kn)
|
||||
return 0;
|
||||
@@ -1568,7 +1568,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
|
||||
if (!kn->parent)
|
||||
return -EINVAL;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
|
||||
error = -ENOENT;
|
||||
if (!kernfs_active(kn) || !kernfs_active(new_parent) ||
|
||||
@@ -1622,7 +1622,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
|
||||
|
||||
error = 0;
|
||||
out:
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1697,7 +1697,7 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx)
|
||||
|
||||
if (!dir_emit_dots(file, ctx))
|
||||
return 0;
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
|
||||
if (kernfs_ns_enabled(parent))
|
||||
ns = kernfs_info(dentry->d_sb)->ns;
|
||||
@@ -1714,12 +1714,12 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx)
|
||||
file->private_data = pos;
|
||||
kernfs_get(pos);
|
||||
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
if (!dir_emit(ctx, name, len, ino, type))
|
||||
return 0;
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
}
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
file->private_data = NULL;
|
||||
ctx->pos = INT_MAX;
|
||||
return 0;
|
||||
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
|
||||
index c75719312147..60e2a86c535e 100644
|
||||
--- a/fs/kernfs/file.c
|
||||
+++ b/fs/kernfs/file.c
|
||||
@@ -860,7 +860,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
|
||||
spin_unlock_irq(&kernfs_notify_lock);
|
||||
|
||||
/* kick fsnotify */
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
|
||||
list_for_each_entry(info, &kernfs_root(kn)->supers, node) {
|
||||
struct kernfs_node *parent;
|
||||
@@ -898,7 +898,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
|
||||
iput(inode);
|
||||
}
|
||||
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
kernfs_put(kn);
|
||||
goto repeat;
|
||||
}
|
||||
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
|
||||
index fc2469a20fed..ddaf18198935 100644
|
||||
--- a/fs/kernfs/inode.c
|
||||
+++ b/fs/kernfs/inode.c
|
||||
@@ -106,9 +106,9 @@ int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
ret = __kernfs_setattr(kn, iattr);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr)
|
||||
if (!kn)
|
||||
return -EINVAL;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
error = setattr_prepare(dentry, iattr);
|
||||
if (error)
|
||||
goto out;
|
||||
@@ -134,7 +134,7 @@ int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr)
|
||||
setattr_copy(inode, iattr);
|
||||
|
||||
out:
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -189,9 +189,9 @@ int kernfs_iop_getattr(const struct path *path, struct kstat *stat,
|
||||
struct inode *inode = d_inode(path->dentry);
|
||||
struct kernfs_node *kn = inode->i_private;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
kernfs_refresh_inode(kn, inode);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
|
||||
generic_fillattr(inode, stat);
|
||||
return 0;
|
||||
@@ -281,9 +281,9 @@ int kernfs_iop_permission(struct inode *inode, int mask)
|
||||
|
||||
kn = inode->i_private;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
kernfs_refresh_inode(kn, inode);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
|
||||
return generic_permission(inode, mask);
|
||||
}
|
||||
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
|
||||
index 6a8d0ca26d03..c933d9bd8a78 100644
|
||||
--- a/fs/kernfs/kernfs-internal.h
|
||||
+++ b/fs/kernfs/kernfs-internal.h
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/lockdep.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mutex.h>
|
||||
+#include <linux/rwsem.h>
|
||||
#include <linux/xattr.h>
|
||||
|
||||
#include <linux/kernfs.h>
|
||||
@@ -69,7 +70,7 @@ struct kernfs_super_info {
|
||||
*/
|
||||
const void *ns;
|
||||
|
||||
- /* anchored at kernfs_root->supers, protected by kernfs_mutex */
|
||||
+ /* anchored at kernfs_root->supers, protected by kernfs_rwsem */
|
||||
struct list_head node;
|
||||
};
|
||||
#define kernfs_info(SB) ((struct kernfs_super_info *)(SB->s_fs_info))
|
||||
@@ -118,7 +119,7 @@ int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr);
|
||||
/*
|
||||
* dir.c
|
||||
*/
|
||||
-extern struct mutex kernfs_mutex;
|
||||
+extern struct rw_semaphore kernfs_rwsem;
|
||||
extern const struct dentry_operations kernfs_dops;
|
||||
extern const struct file_operations kernfs_dir_fops;
|
||||
extern const struct inode_operations kernfs_dir_iops;
|
||||
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
|
||||
index 9dc7e7a64e10..baa4155ba2ed 100644
|
||||
--- a/fs/kernfs/mount.c
|
||||
+++ b/fs/kernfs/mount.c
|
||||
@@ -255,9 +255,9 @@ static int kernfs_fill_super(struct super_block *sb, struct kernfs_fs_context *k
|
||||
sb->s_shrink.seeks = 0;
|
||||
|
||||
/* get root inode, initialize and unlock it */
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
inode = kernfs_get_inode(sb, info->root->kn);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
if (!inode) {
|
||||
pr_debug("kernfs: could not get root inode\n");
|
||||
return -ENOMEM;
|
||||
@@ -344,9 +344,9 @@ int kernfs_get_tree(struct fs_context *fc)
|
||||
}
|
||||
sb->s_flags |= SB_ACTIVE;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
list_add(&info->node, &info->root->supers);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
}
|
||||
|
||||
fc->root = dget(sb->s_root);
|
||||
@@ -372,9 +372,9 @@ void kernfs_kill_sb(struct super_block *sb)
|
||||
{
|
||||
struct kernfs_super_info *info = kernfs_info(sb);
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_write(&kernfs_rwsem);
|
||||
list_del(&info->node);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_write(&kernfs_rwsem);
|
||||
|
||||
/*
|
||||
* Remove the superblock from fs_supers/s_instances
|
||||
diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c
|
||||
index 5432883d819f..c8f8e41b8411 100644
|
||||
--- a/fs/kernfs/symlink.c
|
||||
+++ b/fs/kernfs/symlink.c
|
||||
@@ -116,9 +116,9 @@ static int kernfs_getlink(struct inode *inode, char *path)
|
||||
struct kernfs_node *target = kn->symlink.target_kn;
|
||||
int error;
|
||||
|
||||
- mutex_lock(&kernfs_mutex);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
error = kernfs_get_target_path(parent, target, path);
|
||||
- mutex_unlock(&kernfs_mutex);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
|
||||
return error;
|
||||
}
|
||||
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
|
||||
index 195afa63ab1c..95e1948379d0 100644
|
||||
--- a/include/linux/kernfs.h
|
||||
+++ b/include/linux/kernfs.h
|
||||
@@ -193,7 +193,7 @@ struct kernfs_root {
|
||||
u32 id_highbits;
|
||||
struct kernfs_syscall_ops *syscall_ops;
|
||||
|
||||
- /* list of kernfs_super_info of this root, protected by kernfs_mutex */
|
||||
+ /* list of kernfs_super_info of this root, protected by kernfs_rwsem */
|
||||
struct list_head supers;
|
||||
|
||||
wait_queue_head_t deactivate_waitq;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
From 1ba2bcb994271391f6719d76987a4eac8b91f625 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
Date: Fri, 16 Jul 2021 17:28:34 +0800
|
||||
Subject: [PATCH] kernfs: use i_lock to protect concurrent inode updates
|
||||
|
||||
The inode operations .permission() and .getattr() use the kernfs node
|
||||
write lock but all that's needed is the read lock to protect against
|
||||
partial updates of these kernfs node fields which are all done under
|
||||
the write lock.
|
||||
|
||||
And .permission() is called frequently during path walks and can cause
|
||||
quite a bit of contention between kernfs node operations and path
|
||||
walks when the number of concurrent walks is high.
|
||||
|
||||
To change kernfs_iop_getattr() and kernfs_iop_permission() to take
|
||||
the rw sem read lock instead of the write lock an additional lock is
|
||||
needed to protect against multiple processes concurrently updating
|
||||
the inode attributes and link count in kernfs_refresh_inode().
|
||||
|
||||
The inode i_lock seems like the sensible thing to use to protect these
|
||||
inode attribute updates so use it in kernfs_refresh_inode().
|
||||
|
||||
The last hunk in the patch, applied to kernfs_fill_super(), is possibly
|
||||
not needed but taking the lock was present originally. I prefer to
|
||||
continue to take it to protect against a partial update of the source
|
||||
kernfs fields during the call to kernfs_refresh_inode() made by
|
||||
kernfs_get_inode().
|
||||
|
||||
Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
Link: https://lore.kernel.org/r/162642771474.63632.16295959115893904470.stgit@web.messagingengine.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/inode.c | 18 ++++++++++++------
|
||||
fs/kernfs/mount.c | 4 ++--
|
||||
2 files changed, 14 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
|
||||
index ddaf18198935..73d7d4a24c51 100644
|
||||
--- a/fs/kernfs/inode.c
|
||||
+++ b/fs/kernfs/inode.c
|
||||
@@ -189,11 +189,13 @@ int kernfs_iop_getattr(const struct path *path, struct kstat *stat,
|
||||
struct inode *inode = d_inode(path->dentry);
|
||||
struct kernfs_node *kn = inode->i_private;
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
+ spin_lock(&inode->i_lock);
|
||||
kernfs_refresh_inode(kn, inode);
|
||||
- up_write(&kernfs_rwsem);
|
||||
-
|
||||
generic_fillattr(inode, stat);
|
||||
+ spin_unlock(&inode->i_lock);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -275,17 +277,21 @@ void kernfs_evict_inode(struct inode *inode)
|
||||
int kernfs_iop_permission(struct inode *inode, int mask)
|
||||
{
|
||||
struct kernfs_node *kn;
|
||||
+ int ret;
|
||||
|
||||
if (mask & MAY_NOT_BLOCK)
|
||||
return -ECHILD;
|
||||
|
||||
kn = inode->i_private;
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
+ spin_lock(&inode->i_lock);
|
||||
kernfs_refresh_inode(kn, inode);
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ ret = generic_permission(inode, mask);
|
||||
+ spin_unlock(&inode->i_lock);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
|
||||
- return generic_permission(inode, mask);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
int kernfs_xattr_get(struct kernfs_node *kn, const char *name,
|
||||
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
|
||||
index baa4155ba2ed..f2f909d09f52 100644
|
||||
--- a/fs/kernfs/mount.c
|
||||
+++ b/fs/kernfs/mount.c
|
||||
@@ -255,9 +255,9 @@ static int kernfs_fill_super(struct super_block *sb, struct kernfs_fs_context *k
|
||||
sb->s_shrink.seeks = 0;
|
||||
|
||||
/* get root inode, initialize and unlock it */
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_read(&kernfs_rwsem);
|
||||
inode = kernfs_get_inode(sb, info->root->kn);
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_read(&kernfs_rwsem);
|
||||
if (!inode) {
|
||||
pr_debug("kernfs: could not get root inode\n");
|
||||
return -ENOMEM;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
From e3ffb2492087e6d9b85c18fbc24b3d73b7d14dfd Mon Sep 17 00:00:00 2001
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
Date: Fri, 16 Jul 2021 17:28:40 +0800
|
||||
Subject: [PATCH] kernfs: dont call d_splice_alias() under kernfs node lock
|
||||
|
||||
The call to d_splice_alias() in kernfs_iop_lookup() doesn't depend on
|
||||
any kernfs node so there's no reason to hold the kernfs node lock when
|
||||
calling it.
|
||||
|
||||
Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
Link: https://lore.kernel.org/r/162642772000.63632.10672683419693513226.stgit@web.messagingengine.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/dir.c | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
|
||||
index cdc57ab2e5ea..51b35d6f9739 100644
|
||||
--- a/fs/kernfs/dir.c
|
||||
+++ b/fs/kernfs/dir.c
|
||||
@@ -1108,7 +1108,6 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
struct dentry *dentry,
|
||||
unsigned int flags)
|
||||
{
|
||||
- struct dentry *ret;
|
||||
struct kernfs_node *parent = dir->i_private;
|
||||
struct kernfs_node *kn;
|
||||
struct inode *inode = NULL;
|
||||
@@ -1128,11 +1127,10 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
/* Needed only for negative dentry validation */
|
||||
if (!inode)
|
||||
kernfs_set_rev(parent, dentry);
|
||||
- /* instantiate and hash (possibly negative) dentry */
|
||||
- ret = d_splice_alias(inode, dentry);
|
||||
up_read(&kernfs_rwsem);
|
||||
|
||||
- return ret;
|
||||
+ /* instantiate and hash (possibly negative) dentry */
|
||||
+ return d_splice_alias(inode, dentry);
|
||||
}
|
||||
|
||||
static int kernfs_iop_mkdir(struct inode *dir, struct dentry *dentry,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
From 51d9e2881717f650b762c322ddf484e9928e8355 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Tao <houtao1@huawei.com>
|
||||
Date: Tue, 28 Sep 2021 22:07:50 +0800
|
||||
Subject: [PATCH] kernfs: also call kernfs_set_rev() for positive dentry
|
||||
|
||||
A KMSAN warning is reported by Alexander Potapenko:
|
||||
|
||||
BUG: KMSAN: uninit-value in kernfs_dop_revalidate+0x61f/0x840
|
||||
fs/kernfs/dir.c:1053
|
||||
kernfs_dop_revalidate+0x61f/0x840 fs/kernfs/dir.c:1053
|
||||
d_revalidate fs/namei.c:854
|
||||
lookup_dcache fs/namei.c:1522
|
||||
__lookup_hash+0x3a6/0x590 fs/namei.c:1543
|
||||
filename_create+0x312/0x7c0 fs/namei.c:3657
|
||||
do_mkdirat+0x103/0x930 fs/namei.c:3900
|
||||
__do_sys_mkdir fs/namei.c:3931
|
||||
__se_sys_mkdir fs/namei.c:3929
|
||||
__x64_sys_mkdir+0xda/0x120 fs/namei.c:3929
|
||||
do_syscall_x64 arch/x86/entry/common.c:51
|
||||
|
||||
It seems a positive dentry in kernfs becomes a negative dentry directly
|
||||
through d_delete() in vfs_rmdir(). dentry->d_time is uninitialized
|
||||
when accessing it in kernfs_dop_revalidate(), because it is only
|
||||
initialized when created as negative dentry in kernfs_iop_lookup().
|
||||
|
||||
The problem can be reproduced by the following command:
|
||||
|
||||
cd /sys/fs/cgroup/pids && mkdir hi && stat hi && rmdir hi && stat hi
|
||||
|
||||
A simple fixes seems to be initializing d->d_time for positive dentry
|
||||
in kernfs_iop_lookup() as well. The downside is the negative dentry
|
||||
will be revalidated again after it becomes negative in d_delete(),
|
||||
because the revison of its parent must have been increased due to
|
||||
its removal.
|
||||
|
||||
Alternative solution is implement .d_iput for kernfs, and assign d_time
|
||||
for the newly-generated negative dentry in it. But we may need to
|
||||
take kernfs_rwsem to protect again the concurrent kernfs_link_sibling()
|
||||
on the parent directory, it is a little over-killing. Now the simple
|
||||
fix is chosen.
|
||||
|
||||
Link: https://marc.info/?l=linux-fsdevel&m=163249838610499
|
||||
Fixes: c7e7c04274b1 ("kernfs: use VFS negative dentry caching")
|
||||
Reported-by: Alexander Potapenko <glider@google.com>
|
||||
Signed-off-by: Hou Tao <houtao1@huawei.com>
|
||||
Link: https://lore.kernel.org/r/20210928140750.1274441-1-houtao1@huawei.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/dir.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
|
||||
index 51b35d6f9739..dd7ef74ee0ff 100644
|
||||
--- a/fs/kernfs/dir.c
|
||||
+++ b/fs/kernfs/dir.c
|
||||
@@ -1124,8 +1124,13 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
if (!inode)
|
||||
inode = ERR_PTR(-ENOMEM);
|
||||
}
|
||||
- /* Needed only for negative dentry validation */
|
||||
- if (!inode)
|
||||
+ /*
|
||||
+ * Needed for negative dentry validation.
|
||||
+ * The negative dentry can be created in kernfs_iop_lookup()
|
||||
+ * or transforms from positive dentry in dentry_unlink_inode()
|
||||
+ * called from vfs_rmdir().
|
||||
+ */
|
||||
+ if (!IS_ERR(inode))
|
||||
kernfs_set_rev(parent, dentry);
|
||||
up_read(&kernfs_rwsem);
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
From 1ec09b985b429c06bd9d58af05c0d8e1bcf24edc Mon Sep 17 00:00:00 2001
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
Date: Mon, 4 Oct 2021 09:03:53 +0800
|
||||
Subject: [PATCH] kernfs: don't create a negative dentry if inactive node
|
||||
exists
|
||||
|
||||
It's been reported that doing stress test for module insertion and
|
||||
removal can result in an ENOENT from libkmod for a valid module.
|
||||
|
||||
In kernfs_iop_lookup() a negative dentry is created if there's no kernfs
|
||||
node associated with the dentry or the node is inactive.
|
||||
|
||||
But inactive kernfs nodes are meant to be invisible to the VFS and
|
||||
creating a negative dentry for these can have unexpected side effects
|
||||
when the node transitions to an active state.
|
||||
|
||||
The point of creating negative dentries is to avoid the expensive
|
||||
alloc/free cycle that occurs if there are frequent lookups for kernfs
|
||||
attributes that don't exist. So kernfs nodes that are not yet active
|
||||
should not result in a negative dentry being created so when they
|
||||
transition to an active state VFS lookups can create an associated
|
||||
dentry is a natural way.
|
||||
|
||||
It's also been reported that https://github.com/osandov/blktests.git
|
||||
test block/001 hangs during the test. It was suggested that recent
|
||||
changes to blktests might have caused it but applying this patch
|
||||
resolved the problem without change to blktests.
|
||||
|
||||
Fixes: c7e7c04274b1 ("kernfs: use VFS negative dentry caching")
|
||||
Tested-by: Yi Zhang <yi.zhang@redhat.com>
|
||||
ACKed-by: Al Viro <viro@zeniv.linux.org.uk>
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
Link: https://lore.kernel.org/r/163330943316.19450.15056895533949392922.stgit@mickey.themaw.net
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/dir.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
|
||||
index dd7ef74ee0ff..6c189848f5c2 100644
|
||||
--- a/fs/kernfs/dir.c
|
||||
+++ b/fs/kernfs/dir.c
|
||||
@@ -1119,7 +1119,14 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
|
||||
kn = kernfs_find_ns(parent, dentry->d_name.name, ns);
|
||||
/* attach dentry and inode */
|
||||
- if (kn && kernfs_active(kn)) {
|
||||
+ if (kn) {
|
||||
+ /* Inactive nodes are invisible to the VFS so don't
|
||||
+ * create a negative.
|
||||
+ */
|
||||
+ if (!kernfs_active(kn)) {
|
||||
+ up_read(&kernfs_rwsem);
|
||||
+ return NULL;
|
||||
+ }
|
||||
inode = kernfs_get_inode(dir->i_sb, kn);
|
||||
if (!inode)
|
||||
inode = ERR_PTR(-ENOMEM);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,646 +0,0 @@
|
||||
From 7720de5a1c34ff3a9403ba02dbfd90e98e9d0c48 Mon Sep 17 00:00:00 2001
|
||||
From: Minchan Kim <minchan@kernel.org>
|
||||
Date: Thu, 18 Nov 2021 15:00:08 -0800
|
||||
Subject: [PATCH] kernfs: switch global kernfs_rwsem lock to per-fs lock
|
||||
|
||||
The kernfs implementation has big lock granularity(kernfs_rwsem) so
|
||||
every kernfs-based(e.g., sysfs, cgroup) fs are able to compete the
|
||||
lock. It makes trouble for some cases to wait the global lock
|
||||
for a long time even though they are totally independent contexts
|
||||
each other.
|
||||
|
||||
A general example is process A goes under direct reclaim with holding
|
||||
the lock when it accessed the file in sysfs and process B is waiting
|
||||
the lock with exclusive mode and then process C is waiting the lock
|
||||
until process B could finish the job after it gets the lock from
|
||||
process A.
|
||||
|
||||
This patch switches the global kernfs_rwsem to per-fs lock, which
|
||||
put the rwsem into kernfs_root.
|
||||
|
||||
Suggested-by: Tejun Heo <tj@kernel.org>
|
||||
Acked-by: Tejun Heo <tj@kernel.org>
|
||||
Signed-off-by: Minchan Kim <minchan@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20211118230008.2679780-1-minchan@kernel.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/dir.c | 110 ++++++++++++++++++++++++-----------------
|
||||
fs/kernfs/file.c | 6 ++-
|
||||
fs/kernfs/inode.c | 22 ++++++---
|
||||
fs/kernfs/mount.c | 15 +++---
|
||||
fs/kernfs/symlink.c | 5 +-
|
||||
include/linux/kernfs.h | 2 +
|
||||
6 files changed, 97 insertions(+), 63 deletions(-)
|
||||
|
||||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
|
||||
index 6c189848f5c2..4af4ce02f58c 100644
|
||||
--- a/fs/kernfs/dir.c
|
||||
+++ b/fs/kernfs/dir.c
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "kernfs-internal.h"
|
||||
|
||||
-DECLARE_RWSEM(kernfs_rwsem);
|
||||
static DEFINE_SPINLOCK(kernfs_rename_lock); /* kn->parent and ->name */
|
||||
/*
|
||||
* Don't use rename_lock to piggy back on pr_cont_buf. We don't want to
|
||||
@@ -34,7 +33,7 @@ static DEFINE_SPINLOCK(kernfs_idr_lock); /* root->ino_idr */
|
||||
|
||||
static bool kernfs_active(struct kernfs_node *kn)
|
||||
{
|
||||
- lockdep_assert_held(&kernfs_rwsem);
|
||||
+ lockdep_assert_held(&kernfs_root(kn)->kernfs_rwsem);
|
||||
return atomic_read(&kn->active) >= 0;
|
||||
}
|
||||
|
||||
@@ -465,14 +464,15 @@ void kernfs_put_active(struct kernfs_node *kn)
|
||||
* return after draining is complete.
|
||||
*/
|
||||
static void kernfs_drain(struct kernfs_node *kn)
|
||||
- __releases(&kernfs_rwsem) __acquires(&kernfs_rwsem)
|
||||
+ __releases(&kernfs_root(kn)->kernfs_rwsem)
|
||||
+ __acquires(&kernfs_root(kn)->kernfs_rwsem)
|
||||
{
|
||||
struct kernfs_root *root = kernfs_root(kn);
|
||||
|
||||
- lockdep_assert_held_write(&kernfs_rwsem);
|
||||
+ lockdep_assert_held_write(&root->kernfs_rwsem);
|
||||
WARN_ON_ONCE(kernfs_active(kn));
|
||||
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
|
||||
if (kernfs_lockdep(kn)) {
|
||||
rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_);
|
||||
@@ -491,7 +491,7 @@ static void kernfs_drain(struct kernfs_node *kn)
|
||||
|
||||
kernfs_drain_open_files(kn);
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -727,11 +727,12 @@ struct kernfs_node *kernfs_find_and_get_node_by_id(struct kernfs_root *root,
|
||||
int kernfs_add_one(struct kernfs_node *kn)
|
||||
{
|
||||
struct kernfs_node *parent = kn->parent;
|
||||
+ struct kernfs_root *root = kernfs_root(parent);
|
||||
struct kernfs_iattrs *ps_iattr;
|
||||
bool has_ns;
|
||||
int ret;
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
|
||||
ret = -EINVAL;
|
||||
has_ns = kernfs_ns_enabled(parent);
|
||||
@@ -762,7 +763,7 @@ int kernfs_add_one(struct kernfs_node *kn)
|
||||
ps_iattr->ia_mtime = ps_iattr->ia_ctime;
|
||||
}
|
||||
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
|
||||
/*
|
||||
* Activate the new node unless CREATE_DEACTIVATED is requested.
|
||||
@@ -776,7 +777,7 @@ int kernfs_add_one(struct kernfs_node *kn)
|
||||
return 0;
|
||||
|
||||
out_unlock:
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -797,7 +798,7 @@ static struct kernfs_node *kernfs_find_ns(struct kernfs_node *parent,
|
||||
bool has_ns = kernfs_ns_enabled(parent);
|
||||
unsigned int hash;
|
||||
|
||||
- lockdep_assert_held(&kernfs_rwsem);
|
||||
+ lockdep_assert_held(&kernfs_root(parent)->kernfs_rwsem);
|
||||
|
||||
if (has_ns != (bool)ns) {
|
||||
WARN(1, KERN_WARNING "kernfs: ns %s in '%s' for '%s'\n",
|
||||
@@ -829,7 +830,7 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent,
|
||||
size_t len;
|
||||
char *p, *name;
|
||||
|
||||
- lockdep_assert_held_read(&kernfs_rwsem);
|
||||
+ lockdep_assert_held_read(&kernfs_root(parent)->kernfs_rwsem);
|
||||
|
||||
spin_lock_irq(&kernfs_pr_cont_lock);
|
||||
|
||||
@@ -867,11 +868,12 @@ struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
|
||||
const char *name, const void *ns)
|
||||
{
|
||||
struct kernfs_node *kn;
|
||||
+ struct kernfs_root *root = kernfs_root(parent);
|
||||
|
||||
- down_read(&kernfs_rwsem);
|
||||
+ down_read(&root->kernfs_rwsem);
|
||||
kn = kernfs_find_ns(parent, name, ns);
|
||||
kernfs_get(kn);
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
|
||||
return kn;
|
||||
}
|
||||
@@ -891,11 +893,12 @@ struct kernfs_node *kernfs_walk_and_get_ns(struct kernfs_node *parent,
|
||||
const char *path, const void *ns)
|
||||
{
|
||||
struct kernfs_node *kn;
|
||||
+ struct kernfs_root *root = kernfs_root(parent);
|
||||
|
||||
- down_read(&kernfs_rwsem);
|
||||
+ down_read(&root->kernfs_rwsem);
|
||||
kn = kernfs_walk_ns(parent, path, ns);
|
||||
kernfs_get(kn);
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
|
||||
return kn;
|
||||
}
|
||||
@@ -920,6 +923,7 @@ struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops,
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
idr_init(&root->ino_idr);
|
||||
+ init_rwsem(&root->kernfs_rwsem);
|
||||
INIT_LIST_HEAD(&root->supers);
|
||||
|
||||
/*
|
||||
@@ -1043,6 +1047,7 @@ struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent,
|
||||
static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
{
|
||||
struct kernfs_node *kn;
|
||||
+ struct kernfs_root *root;
|
||||
|
||||
if (flags & LOOKUP_RCU)
|
||||
return -ECHILD;
|
||||
@@ -1054,18 +1059,19 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
/* If the kernfs parent node has changed discard and
|
||||
* proceed to ->lookup.
|
||||
*/
|
||||
- down_read(&kernfs_rwsem);
|
||||
spin_lock(&dentry->d_lock);
|
||||
parent = kernfs_dentry_node(dentry->d_parent);
|
||||
if (parent) {
|
||||
+ spin_unlock(&dentry->d_lock);
|
||||
+ root = kernfs_root(parent);
|
||||
+ down_read(&root->kernfs_rwsem);
|
||||
if (kernfs_dir_changed(parent, dentry)) {
|
||||
- spin_unlock(&dentry->d_lock);
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
return 0;
|
||||
}
|
||||
- }
|
||||
- spin_unlock(&dentry->d_lock);
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
+ } else
|
||||
+ spin_unlock(&dentry->d_lock);
|
||||
|
||||
/* The kernfs parent node hasn't changed, leave the
|
||||
* dentry negative and return success.
|
||||
@@ -1074,7 +1080,8 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
}
|
||||
|
||||
kn = kernfs_dentry_node(dentry);
|
||||
- down_read(&kernfs_rwsem);
|
||||
+ root = kernfs_root(kn);
|
||||
+ down_read(&root->kernfs_rwsem);
|
||||
|
||||
/* The kernfs node has been deactivated */
|
||||
if (!kernfs_active(kn))
|
||||
@@ -1093,10 +1100,10 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
||||
kernfs_info(dentry->d_sb)->ns != kn->ns)
|
||||
goto out_bad;
|
||||
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
return 1;
|
||||
out_bad:
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1110,10 +1117,12 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
{
|
||||
struct kernfs_node *parent = dir->i_private;
|
||||
struct kernfs_node *kn;
|
||||
+ struct kernfs_root *root;
|
||||
struct inode *inode = NULL;
|
||||
const void *ns = NULL;
|
||||
|
||||
- down_read(&kernfs_rwsem);
|
||||
+ root = kernfs_root(parent);
|
||||
+ down_read(&root->kernfs_rwsem);
|
||||
if (kernfs_ns_enabled(parent))
|
||||
ns = kernfs_info(dir->i_sb)->ns;
|
||||
|
||||
@@ -1124,7 +1133,7 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
* create a negative.
|
||||
*/
|
||||
if (!kernfs_active(kn)) {
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
return NULL;
|
||||
}
|
||||
inode = kernfs_get_inode(dir->i_sb, kn);
|
||||
@@ -1139,7 +1148,7 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
||||
*/
|
||||
if (!IS_ERR(inode))
|
||||
kernfs_set_rev(parent, dentry);
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
|
||||
/* instantiate and hash (possibly negative) dentry */
|
||||
return d_splice_alias(inode, dentry);
|
||||
@@ -1260,7 +1269,7 @@ static struct kernfs_node *kernfs_next_descendant_post(struct kernfs_node *pos,
|
||||
{
|
||||
struct rb_node *rbn;
|
||||
|
||||
- lockdep_assert_held_write(&kernfs_rwsem);
|
||||
+ lockdep_assert_held_write(&kernfs_root(root)->kernfs_rwsem);
|
||||
|
||||
/* if first iteration, visit leftmost descendant which may be root */
|
||||
if (!pos)
|
||||
@@ -1295,8 +1304,9 @@ static struct kernfs_node *kernfs_next_descendant_post(struct kernfs_node *pos,
|
||||
void kernfs_activate(struct kernfs_node *kn)
|
||||
{
|
||||
struct kernfs_node *pos;
|
||||
+ struct kernfs_root *root = kernfs_root(kn);
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
|
||||
pos = NULL;
|
||||
while ((pos = kernfs_next_descendant_post(pos, kn))) {
|
||||
@@ -1310,14 +1320,14 @@ void kernfs_activate(struct kernfs_node *kn)
|
||||
pos->flags |= KERNFS_ACTIVATED;
|
||||
}
|
||||
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
}
|
||||
|
||||
static void __kernfs_remove(struct kernfs_node *kn)
|
||||
{
|
||||
struct kernfs_node *pos;
|
||||
|
||||
- lockdep_assert_held_write(&kernfs_rwsem);
|
||||
+ lockdep_assert_held_write(&kernfs_root(kn)->kernfs_rwsem);
|
||||
|
||||
/*
|
||||
* Short-circuit if non-root @kn has already finished removal.
|
||||
@@ -1387,9 +1397,11 @@ static void __kernfs_remove(struct kernfs_node *kn)
|
||||
*/
|
||||
void kernfs_remove(struct kernfs_node *kn)
|
||||
{
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ struct kernfs_root *root = kernfs_root(kn);
|
||||
+
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
__kernfs_remove(kn);
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1475,8 +1487,9 @@ void kernfs_unbreak_active_protection(struct kernfs_node *kn)
|
||||
bool kernfs_remove_self(struct kernfs_node *kn)
|
||||
{
|
||||
bool ret;
|
||||
+ struct kernfs_root *root = kernfs_root(kn);
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
kernfs_break_active_protection(kn);
|
||||
|
||||
/*
|
||||
@@ -1504,9 +1517,9 @@ bool kernfs_remove_self(struct kernfs_node *kn)
|
||||
atomic_read(&kn->active) == KN_DEACTIVATED_BIAS)
|
||||
break;
|
||||
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
schedule();
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
}
|
||||
finish_wait(waitq, &wait);
|
||||
WARN_ON_ONCE(!RB_EMPTY_NODE(&kn->rb));
|
||||
@@ -1519,7 +1532,7 @@ bool kernfs_remove_self(struct kernfs_node *kn)
|
||||
*/
|
||||
kernfs_unbreak_active_protection(kn);
|
||||
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1536,6 +1549,7 @@ int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
|
||||
const void *ns)
|
||||
{
|
||||
struct kernfs_node *kn;
|
||||
+ struct kernfs_root *root;
|
||||
|
||||
if (!parent) {
|
||||
WARN(1, KERN_WARNING "kernfs: can not remove '%s', no directory\n",
|
||||
@@ -1543,7 +1557,8 @@ int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ root = kernfs_root(parent);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
|
||||
kn = kernfs_find_ns(parent, name, ns);
|
||||
if (kn) {
|
||||
@@ -1552,7 +1567,7 @@ int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
|
||||
kernfs_put(kn);
|
||||
}
|
||||
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
|
||||
if (kn)
|
||||
return 0;
|
||||
@@ -1571,6 +1586,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
|
||||
const char *new_name, const void *new_ns)
|
||||
{
|
||||
struct kernfs_node *old_parent;
|
||||
+ struct kernfs_root *root;
|
||||
const char *old_name = NULL;
|
||||
int error;
|
||||
|
||||
@@ -1578,7 +1594,8 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
|
||||
if (!kn->parent)
|
||||
return -EINVAL;
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ root = kernfs_root(kn);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
|
||||
error = -ENOENT;
|
||||
if (!kernfs_active(kn) || !kernfs_active(new_parent) ||
|
||||
@@ -1632,7 +1649,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
|
||||
|
||||
error = 0;
|
||||
out:
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1703,11 +1720,14 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx)
|
||||
struct dentry *dentry = file->f_path.dentry;
|
||||
struct kernfs_node *parent = kernfs_dentry_node(dentry);
|
||||
struct kernfs_node *pos = file->private_data;
|
||||
+ struct kernfs_root *root;
|
||||
const void *ns = NULL;
|
||||
|
||||
if (!dir_emit_dots(file, ctx))
|
||||
return 0;
|
||||
- down_read(&kernfs_rwsem);
|
||||
+
|
||||
+ root = kernfs_root(parent);
|
||||
+ down_read(&root->kernfs_rwsem);
|
||||
|
||||
if (kernfs_ns_enabled(parent))
|
||||
ns = kernfs_info(dentry->d_sb)->ns;
|
||||
@@ -1724,12 +1744,12 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx)
|
||||
file->private_data = pos;
|
||||
kernfs_get(pos);
|
||||
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
if (!dir_emit(ctx, name, len, ino, type))
|
||||
return 0;
|
||||
- down_read(&kernfs_rwsem);
|
||||
+ down_read(&root->kernfs_rwsem);
|
||||
}
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
file->private_data = NULL;
|
||||
ctx->pos = INT_MAX;
|
||||
return 0;
|
||||
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
|
||||
index 60e2a86c535e..9414a7a60a9f 100644
|
||||
--- a/fs/kernfs/file.c
|
||||
+++ b/fs/kernfs/file.c
|
||||
@@ -847,6 +847,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
|
||||
{
|
||||
struct kernfs_node *kn;
|
||||
struct kernfs_super_info *info;
|
||||
+ struct kernfs_root *root;
|
||||
repeat:
|
||||
/* pop one off the notify_list */
|
||||
spin_lock_irq(&kernfs_notify_lock);
|
||||
@@ -859,8 +860,9 @@ static void kernfs_notify_workfn(struct work_struct *work)
|
||||
kn->attr.notify_next = NULL;
|
||||
spin_unlock_irq(&kernfs_notify_lock);
|
||||
|
||||
+ root = kernfs_root(kn);
|
||||
/* kick fsnotify */
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
|
||||
list_for_each_entry(info, &kernfs_root(kn)->supers, node) {
|
||||
struct kernfs_node *parent;
|
||||
@@ -898,7 +900,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
|
||||
iput(inode);
|
||||
}
|
||||
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
kernfs_put(kn);
|
||||
goto repeat;
|
||||
}
|
||||
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
|
||||
index 73d7d4a24c51..e0d9d8aced84 100644
|
||||
--- a/fs/kernfs/inode.c
|
||||
+++ b/fs/kernfs/inode.c
|
||||
@@ -105,10 +105,11 @@ int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
|
||||
int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
|
||||
{
|
||||
int ret;
|
||||
+ struct kernfs_root *root = kernfs_root(kn);
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
ret = __kernfs_setattr(kn, iattr);
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -116,12 +117,14 @@ int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
struct kernfs_node *kn = inode->i_private;
|
||||
+ struct kernfs_root *root;
|
||||
int error;
|
||||
|
||||
if (!kn)
|
||||
return -EINVAL;
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ root = kernfs_root(kn);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
error = setattr_prepare(dentry, iattr);
|
||||
if (error)
|
||||
goto out;
|
||||
@@ -134,7 +137,7 @@ int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr)
|
||||
setattr_copy(inode, iattr);
|
||||
|
||||
out:
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -188,13 +191,14 @@ int kernfs_iop_getattr(const struct path *path, struct kstat *stat,
|
||||
{
|
||||
struct inode *inode = d_inode(path->dentry);
|
||||
struct kernfs_node *kn = inode->i_private;
|
||||
+ struct kernfs_root *root = kernfs_root(kn);
|
||||
|
||||
- down_read(&kernfs_rwsem);
|
||||
+ down_read(&root->kernfs_rwsem);
|
||||
spin_lock(&inode->i_lock);
|
||||
kernfs_refresh_inode(kn, inode);
|
||||
generic_fillattr(inode, stat);
|
||||
spin_unlock(&inode->i_lock);
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -277,19 +281,21 @@ void kernfs_evict_inode(struct inode *inode)
|
||||
int kernfs_iop_permission(struct inode *inode, int mask)
|
||||
{
|
||||
struct kernfs_node *kn;
|
||||
+ struct kernfs_root *root;
|
||||
int ret;
|
||||
|
||||
if (mask & MAY_NOT_BLOCK)
|
||||
return -ECHILD;
|
||||
|
||||
kn = inode->i_private;
|
||||
+ root = kernfs_root(kn);
|
||||
|
||||
- down_read(&kernfs_rwsem);
|
||||
+ down_read(&root->kernfs_rwsem);
|
||||
spin_lock(&inode->i_lock);
|
||||
kernfs_refresh_inode(kn, inode);
|
||||
ret = generic_permission(inode, mask);
|
||||
spin_unlock(&inode->i_lock);
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
|
||||
return ret;
|
||||
}
|
||||
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
|
||||
index f2f909d09f52..cfa79715fc1a 100644
|
||||
--- a/fs/kernfs/mount.c
|
||||
+++ b/fs/kernfs/mount.c
|
||||
@@ -236,6 +236,7 @@ struct dentry *kernfs_node_dentry(struct kernfs_node *kn,
|
||||
static int kernfs_fill_super(struct super_block *sb, struct kernfs_fs_context *kfc)
|
||||
{
|
||||
struct kernfs_super_info *info = kernfs_info(sb);
|
||||
+ struct kernfs_root *kf_root = kfc->root;
|
||||
struct inode *inode;
|
||||
struct dentry *root;
|
||||
|
||||
@@ -255,9 +256,9 @@ static int kernfs_fill_super(struct super_block *sb, struct kernfs_fs_context *k
|
||||
sb->s_shrink.seeks = 0;
|
||||
|
||||
/* get root inode, initialize and unlock it */
|
||||
- down_read(&kernfs_rwsem);
|
||||
+ down_read(&kf_root->kernfs_rwsem);
|
||||
inode = kernfs_get_inode(sb, info->root->kn);
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&kf_root->kernfs_rwsem);
|
||||
if (!inode) {
|
||||
pr_debug("kernfs: could not get root inode\n");
|
||||
return -ENOMEM;
|
||||
@@ -334,6 +335,7 @@ int kernfs_get_tree(struct fs_context *fc)
|
||||
|
||||
if (!sb->s_root) {
|
||||
struct kernfs_super_info *info = kernfs_info(sb);
|
||||
+ struct kernfs_root *root = kfc->root;
|
||||
|
||||
kfc->new_sb_created = true;
|
||||
|
||||
@@ -344,9 +346,9 @@ int kernfs_get_tree(struct fs_context *fc)
|
||||
}
|
||||
sb->s_flags |= SB_ACTIVE;
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
list_add(&info->node, &info->root->supers);
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
}
|
||||
|
||||
fc->root = dget(sb->s_root);
|
||||
@@ -371,10 +373,11 @@ void kernfs_free_fs_context(struct fs_context *fc)
|
||||
void kernfs_kill_sb(struct super_block *sb)
|
||||
{
|
||||
struct kernfs_super_info *info = kernfs_info(sb);
|
||||
+ struct kernfs_root *root = info->root;
|
||||
|
||||
- down_write(&kernfs_rwsem);
|
||||
+ down_write(&root->kernfs_rwsem);
|
||||
list_del(&info->node);
|
||||
- up_write(&kernfs_rwsem);
|
||||
+ up_write(&root->kernfs_rwsem);
|
||||
|
||||
/*
|
||||
* Remove the superblock from fs_supers/s_instances
|
||||
diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c
|
||||
index c8f8e41b8411..efb0b9ca9057 100644
|
||||
--- a/fs/kernfs/symlink.c
|
||||
+++ b/fs/kernfs/symlink.c
|
||||
@@ -114,11 +114,12 @@ static int kernfs_getlink(struct inode *inode, char *path)
|
||||
struct kernfs_node *kn = inode->i_private;
|
||||
struct kernfs_node *parent = kn->parent;
|
||||
struct kernfs_node *target = kn->symlink.target_kn;
|
||||
+ struct kernfs_root *root = kernfs_root(parent);
|
||||
int error;
|
||||
|
||||
- down_read(&kernfs_rwsem);
|
||||
+ down_read(&root->kernfs_rwsem);
|
||||
error = kernfs_get_target_path(parent, target, path);
|
||||
- up_read(&kernfs_rwsem);
|
||||
+ up_read(&root->kernfs_rwsem);
|
||||
|
||||
return error;
|
||||
}
|
||||
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
|
||||
index 95e1948379d0..170da90a5d62 100644
|
||||
--- a/include/linux/kernfs.h
|
||||
+++ b/include/linux/kernfs.h
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/uidgid.h>
|
||||
#include <linux/wait.h>
|
||||
+#include <linux/rwsem.h>
|
||||
|
||||
struct file;
|
||||
struct dentry;
|
||||
@@ -197,6 +198,7 @@ struct kernfs_root {
|
||||
struct list_head supers;
|
||||
|
||||
wait_queue_head_t deactivate_waitq;
|
||||
+ struct rw_semaphore kernfs_rwsem;
|
||||
};
|
||||
|
||||
struct kernfs_open_file {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
From 652fe3382d6740a60d687d74373273f0b8eb1256 Mon Sep 17 00:00:00 2001
|
||||
From: Minchan Kim <minchan@kernel.org>
|
||||
Date: Wed, 1 Dec 2021 15:16:48 -0800
|
||||
Subject: [PATCH] kernfs: prevent early freeing of root node
|
||||
|
||||
Marek reported the warning below.
|
||||
|
||||
=========================
|
||||
WARNING: held lock freed!
|
||||
5.16.0-rc2+ #10984 Not tainted
|
||||
-------------------------
|
||||
kworker/1:0/18 is freeing memory ffff00004034e200-ffff00004034e3ff,
|
||||
with a lock still held there!
|
||||
ffff00004034e348 (&root->kernfs_rwsem){++++}-{3:3}, at:
|
||||
__kernfs_remove+0x310/0x37c
|
||||
3 locks held by kworker/1:0/18:
|
||||
#0: ffff000040107938 ((wq_completion)cgroup_destroy){+.+.}-{0:0}, at:
|
||||
process_one_work+0x1f0/0x6f0
|
||||
#1: ffff80000b55bdc0
|
||||
((work_completion)(&(&css->destroy_rwork)->work)){+.+.}-{0:0}, at:
|
||||
process_one_work+0x1f0/0x6f0
|
||||
#2: ffff00004034e348 (&root->kernfs_rwsem){++++}-{3:3}, at:
|
||||
__kernfs_remove+0x310/0x37c
|
||||
|
||||
stack backtrace:
|
||||
CPU: 1 PID: 18 Comm: kworker/1:0 Not tainted 5.16.0-rc2+ #10984
|
||||
Hardware name: Raspberry Pi 4 Model B (DT)
|
||||
Workqueue: cgroup_destroy css_free_rwork_fn
|
||||
Call trace:
|
||||
dump_backtrace+0x0/0x1ac
|
||||
show_stack+0x18/0x24
|
||||
dump_stack_lvl+0x8c/0xb8
|
||||
dump_stack+0x18/0x34
|
||||
debug_check_no_locks_freed+0x124/0x140
|
||||
kfree+0xf0/0x3a4
|
||||
kernfs_put+0x1f8/0x224
|
||||
__kernfs_remove+0x1b8/0x37c
|
||||
kernfs_destroy_root+0x38/0x50
|
||||
css_free_rwork_fn+0x288/0x3d4
|
||||
process_one_work+0x288/0x6f0
|
||||
worker_thread+0x74/0x470
|
||||
kthread+0x188/0x194
|
||||
ret_from_fork+0x10/0x20
|
||||
|
||||
Since kernfs moves the kernfs_rwsem lock into root, it couldn't hold
|
||||
the lock when the root node is tearing down. Thus, get the refcount
|
||||
of root node.
|
||||
|
||||
Fixes: 393c3714081a ("kernfs: switch global kernfs_rwsem lock to per-fs lock")
|
||||
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
|
||||
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
|
||||
Acked-by: Tejun Heo <tj@kernel.org>
|
||||
Signed-off-by: Minchan Kim <minchan@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20211201231648.1027165-1-minchan@kernel.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/dir.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
|
||||
index 4af4ce02f58c..21ff2d9376fb 100644
|
||||
--- a/fs/kernfs/dir.c
|
||||
+++ b/fs/kernfs/dir.c
|
||||
@@ -969,7 +969,13 @@ struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops,
|
||||
*/
|
||||
void kernfs_destroy_root(struct kernfs_root *root)
|
||||
{
|
||||
- kernfs_remove(root->kn); /* will also free @root */
|
||||
+ /*
|
||||
+ * kernfs_remove holds kernfs_rwsem from the root so the root
|
||||
+ * shouldn't be freed during the operation.
|
||||
+ */
|
||||
+ kernfs_get(root->kn);
|
||||
+ kernfs_remove(root->kn);
|
||||
+ kernfs_put(root->kn); /* will also free @root */
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
From 94cd333ee4481ea2e36cacb46854c61a18563f49 Mon Sep 17 00:00:00 2001
|
||||
From: Imran Khan <imran.f.khan@oracle.com>
|
||||
Date: Fri, 18 Feb 2022 12:02:05 +1100
|
||||
Subject: [PATCH] kernfs: remove redundant kernfs_rwsem declaration.
|
||||
|
||||
Since 'commit 393c3714081a ("kernfs: switch global kernfs_rwsem lock to
|
||||
per-fs lock")' per-fs kernfs_rwsem has replaced global kernfs_rwsem.
|
||||
Remove redundant declaration of global kernfs_rwsem.
|
||||
|
||||
Fixes: 393c3714081a ("kernfs: switch global kernfs_rwsem lock to per-fs lock")
|
||||
Signed-off-by: Imran Khan <imran.f.khan@oracle.com>
|
||||
Link: https://lore.kernel.org/r/20220218010205.717582-1-imran.f.khan@oracle.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/kernfs-internal.h | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
|
||||
index c933d9bd8a78..1106102159d3 100644
|
||||
--- a/fs/kernfs/kernfs-internal.h
|
||||
+++ b/fs/kernfs/kernfs-internal.h
|
||||
@@ -119,7 +119,6 @@ int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr);
|
||||
/*
|
||||
* dir.c
|
||||
*/
|
||||
-extern struct rw_semaphore kernfs_rwsem;
|
||||
extern const struct dentry_operations kernfs_dops;
|
||||
extern const struct file_operations kernfs_dir_fops;
|
||||
extern const struct inode_operations kernfs_dir_iops;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
From debf41dbf2a2ba28155cdeb1aea102e16faa0745 Mon Sep 17 00:00:00 2001
|
||||
From: Minchan Kim <minchan@kernel.org>
|
||||
Date: Wed, 27 Apr 2022 10:21:51 -0700
|
||||
Subject: [PATCH] kernfs: fix NULL dereferencing in kernfs_remove
|
||||
|
||||
kernfs_remove supported NULL kernfs_node param to bail out but revent
|
||||
per-fs lock change introduced regression that dereferencing the
|
||||
param without NULL check so kernel goes crash.
|
||||
|
||||
This patch checks the NULL kernfs_node in kernfs_remove and if so,
|
||||
just return.
|
||||
|
||||
Quote from bug report by Jirka
|
||||
|
||||
```
|
||||
The bug is triggered by running NAS Parallel benchmark suite on
|
||||
SuperMicro servers with 2x Xeon(R) Gold 6126 CPU. Here is the error
|
||||
log:
|
||||
|
||||
[ 247.035564] BUG: kernel NULL pointer dereference, address: 0000000000000008
|
||||
[ 247.036009] #PF: supervisor read access in kernel mode
|
||||
[ 247.036009] #PF: error_code(0x0000) - not-present page
|
||||
[ 247.036009] PGD 0 P4D 0
|
||||
[ 247.036009] Oops: 0000 [#1] PREEMPT SMP PTI
|
||||
[ 247.058060] CPU: 1 PID: 6546 Comm: umount Not tainted
|
||||
5.16.0393c3714081a53795bbff0e985d24146def6f57f+ #16
|
||||
[ 247.058060] Hardware name: Supermicro Super Server/X11DDW-L, BIOS
|
||||
2.0b 03/07/2018
|
||||
[ 247.058060] RIP: 0010:kernfs_remove+0x8/0x50
|
||||
[ 247.058060] Code: 4c 89 e0 5b 5d 41 5c 41 5d 41 5e c3 49 c7 c4 f4
|
||||
ff ff ff eb b2 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 0f 1f 44 00 00
|
||||
41 54 55 <48> 8b 47 08 48 89 fd 48 85 c0 48 0f 44 c7 4c 8b 60 50 49 83
|
||||
c4 60
|
||||
[ 247.058060] RSP: 0018:ffffbbfa48a27e48 EFLAGS: 00010246
|
||||
[ 247.058060] RAX: 0000000000000001 RBX: ffffffff89e31f98 RCX: 0000000080200018
|
||||
[ 247.058060] RDX: 0000000080200019 RSI: fffff6760786c900 RDI: 0000000000000000
|
||||
[ 247.058060] RBP: ffffffff89e31f98 R08: ffff926b61b24d00 R09: 0000000080200018
|
||||
[ 247.122048] R10: ffff926b61b24d00 R11: ffff926a8040c000 R12: ffff927bd09a2000
|
||||
[ 247.122048] R13: ffffffff89e31fa0 R14: dead000000000122 R15: dead000000000100
|
||||
[ 247.122048] FS: 00007f01be0a8c40(0000) GS:ffff926fa8e40000(0000)
|
||||
knlGS:0000000000000000
|
||||
[ 247.122048] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
|
||||
[ 247.122048] CR2: 0000000000000008 CR3: 00000001145c6003 CR4: 00000000007706e0
|
||||
[ 247.122048] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
|
||||
[ 247.122048] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
|
||||
[ 247.122048] PKRU: 55555554
|
||||
[ 247.122048] Call Trace:
|
||||
[ 247.122048] <TASK>
|
||||
[ 247.122048] rdt_kill_sb+0x29d/0x350
|
||||
[ 247.122048] deactivate_locked_super+0x36/0xa0
|
||||
[ 247.122048] cleanup_mnt+0x131/0x190
|
||||
[ 247.122048] task_work_run+0x5c/0x90
|
||||
[ 247.122048] exit_to_user_mode_prepare+0x229/0x230
|
||||
[ 247.122048] syscall_exit_to_user_mode+0x18/0x40
|
||||
[ 247.122048] do_syscall_64+0x48/0x90
|
||||
[ 247.122048] entry_SYSCALL_64_after_hwframe+0x44/0xae
|
||||
[ 247.122048] RIP: 0033:0x7f01be2d735b
|
||||
```
|
||||
|
||||
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215696
|
||||
Link: https://lore.kernel.org/lkml/CAE4VaGDZr_4wzRn2___eDYRtmdPaGGJdzu_LCSkJYuY9BEO3cw@mail.gmail.com/
|
||||
Fixes: 393c3714081a (kernfs: switch global kernfs_rwsem lock to per-fs lock)
|
||||
Cc: stable@vger.kernel.org
|
||||
Reported-by: Jirka Hladky <jhladky@redhat.com>
|
||||
Tested-by: Jirka Hladky <jhladky@redhat.com>
|
||||
Acked-by: Tejun Heo <tj@kernel.org>
|
||||
Signed-off-by: Minchan Kim <minchan@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20220427172152.3505364-1-minchan@kernel.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
|
||||
---
|
||||
fs/kernfs/dir.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
|
||||
index 21ff2d9376fb..61df2ce1a5d9 100644
|
||||
--- a/fs/kernfs/dir.c
|
||||
+++ b/fs/kernfs/dir.c
|
||||
@@ -1403,7 +1403,12 @@ static void __kernfs_remove(struct kernfs_node *kn)
|
||||
*/
|
||||
void kernfs_remove(struct kernfs_node *kn)
|
||||
{
|
||||
- struct kernfs_root *root = kernfs_root(kn);
|
||||
+ struct kernfs_root *root;
|
||||
+
|
||||
+ if (!kn)
|
||||
+ return;
|
||||
+
|
||||
+ root = kernfs_root(kn);
|
||||
|
||||
down_write(&root->kernfs_rwsem);
|
||||
__kernfs_remove(kn);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From d92d4ffc712f4782e5bc022d99d45c463966e41a Mon Sep 17 00:00:00 2001
|
||||
From: Giovanni Gherdovich <ggherdovich@suse.cz>
|
||||
Date: Tue, 18 May 2021 14:34:12 +0200
|
||||
Subject: [PATCH] cpufreq: intel_pstate: Add Icelake servers support in no-HWP
|
||||
mode
|
||||
|
||||
Users may disable HWP in firmware, in which case intel_pstate wouldn't load
|
||||
unless the CPU model is explicitly supported.
|
||||
|
||||
Add ICELAKE_X to the list of CPUs that can register intel_pstate while not
|
||||
advertising the HWP capability. Without this change, an ICELAKE_X in no-HWP
|
||||
mode could only use the acpi_cpufreq frequency scaling driver.
|
||||
|
||||
See also commit d8de7a44e11f ("cpufreq: intel_pstate: Add Skylake servers
|
||||
support").
|
||||
|
||||
Signed-off-by: Giovanni Gherdovich <ggherdovich@suse.cz>
|
||||
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
||||
(cherry picked from commit fbdc21e9b038d00d0d56fa4e0f7701d42ae08f00)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/cpufreq/intel_pstate.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
|
||||
index 1686705bee7b..14504c761588 100644
|
||||
--- a/drivers/cpufreq/intel_pstate.c
|
||||
+++ b/drivers/cpufreq/intel_pstate.c
|
||||
@@ -2100,6 +2100,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
|
||||
X86_MATCH(ATOM_GOLDMONT, core_funcs),
|
||||
X86_MATCH(ATOM_GOLDMONT_PLUS, core_funcs),
|
||||
X86_MATCH(SKYLAKE_X, core_funcs),
|
||||
+ X86_MATCH(ICELAKE_X, core_funcs),
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From d72271f839550c054d93e797825bd749bd5a8f6a Mon Sep 17 00:00:00 2001
|
||||
From: Adamos Ttofari <attofari@amazon.de>
|
||||
Date: Fri, 12 Nov 2021 09:16:57 +0000
|
||||
Subject: [PATCH] cpufreq: intel_pstate: Add Ice Lake server to out-of-band IDs
|
||||
|
||||
Commit fbdc21e9b038 ("cpufreq: intel_pstate: Add Icelake servers
|
||||
support in no-HWP mode") enabled the use of Intel P-State driver
|
||||
for Ice Lake servers.
|
||||
|
||||
But it doesn't cover the case when OS can't control P-States.
|
||||
|
||||
Therefore, for Ice Lake server, if MSR_MISC_PWR_MGMT bits 8 or 18
|
||||
are enabled, then the Intel P-State driver should exit as OS can't
|
||||
control P-States.
|
||||
|
||||
Fixes: fbdc21e9b038 ("cpufreq: intel_pstate: Add Icelake servers support in no-HWP mode")
|
||||
Signed-off-by: Adamos Ttofari <attofari@amazon.de>
|
||||
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
||||
(cherry picked from commit cd23f02f166892603eb9f2d488152b975872b682)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/cpufreq/intel_pstate.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
|
||||
index 14504c761588..1bf7ae2ec8cd 100644
|
||||
--- a/drivers/cpufreq/intel_pstate.c
|
||||
+++ b/drivers/cpufreq/intel_pstate.c
|
||||
@@ -2109,6 +2109,7 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = {
|
||||
X86_MATCH(BROADWELL_D, core_funcs),
|
||||
X86_MATCH(BROADWELL_X, core_funcs),
|
||||
X86_MATCH(SKYLAKE_X, core_funcs),
|
||||
+ X86_MATCH(ICELAKE_X, core_funcs),
|
||||
{}
|
||||
};
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
From 3f316b2b3ee9ea147cd2392ff9580ec7cdd3ddce Mon Sep 17 00:00:00 2001
|
||||
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
|
||||
Date: Mon, 2 May 2022 13:50:52 -0700
|
||||
Subject: [PATCH] cpufreq: intel_pstate: Support Sapphire Rapids OOB mode
|
||||
|
||||
Prevent intel_pstate to load when OOB (Out Of Band) P-states mode is
|
||||
enabled in Sapphire Rapids. The OOB identifying bits are same as the
|
||||
prior generation CPUs like Ice Lake servers. So, also add Sapphire
|
||||
Rapids to intel_pstate_cpu_oob_ids list.
|
||||
|
||||
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
|
||||
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
||||
(cherry picked from commit bbd67f1b5a9449b090560ca5288aef0cfe623275)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/cpufreq/intel_pstate.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
|
||||
index 1bf7ae2ec8cd..3f894834fdee 100644
|
||||
--- a/drivers/cpufreq/intel_pstate.c
|
||||
+++ b/drivers/cpufreq/intel_pstate.c
|
||||
@@ -2110,6 +2110,7 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = {
|
||||
X86_MATCH(BROADWELL_X, core_funcs),
|
||||
X86_MATCH(SKYLAKE_X, core_funcs),
|
||||
X86_MATCH(ICELAKE_X, core_funcs),
|
||||
+ X86_MATCH(SAPPHIRERAPIDS_X, core_funcs),
|
||||
{}
|
||||
};
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
From 16e79a6cd1e512ee283a917a9ed54550ca56bc7d Mon Sep 17 00:00:00 2001
|
||||
From: Giovanni Gherdovich <ggherdovich@suse.cz>
|
||||
Date: Mon, 21 Nov 2022 16:35:40 +0100
|
||||
Subject: [PATCH] cpufreq: intel_pstate: Add Sapphire Rapids support in no-HWP
|
||||
mode
|
||||
|
||||
Users may disable HWP in firmware, in which case intel_pstate wouldn't load
|
||||
unless the CPU model is explicitly supported.
|
||||
|
||||
See also the following past commits:
|
||||
|
||||
commit d8de7a44e11f ("cpufreq: intel_pstate: Add Skylake servers support")
|
||||
commit 706c5328851d ("cpufreq: intel_pstate: Add Cometlake support in
|
||||
no-HWP mode")
|
||||
commit fbdc21e9b038 ("cpufreq: intel_pstate: Add Icelake servers support in
|
||||
no-HWP mode")
|
||||
commit 71bb5c82aaae ("cpufreq: intel_pstate: Add Tigerlake support in
|
||||
no-HWP mode")
|
||||
|
||||
Signed-off-by: Giovanni Gherdovich <ggherdovich@suse.cz>
|
||||
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
||||
(cherry picked from commit df51f287b5de3b9d4fd39593eafd1f8298d711c7)
|
||||
[ mvb: Fix a minor merge conflict involving missing Tiger Lake CPU
|
||||
support in StarlingX. ]
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/cpufreq/intel_pstate.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
|
||||
index 3f894834fdee..431c4068b62d 100644
|
||||
--- a/drivers/cpufreq/intel_pstate.c
|
||||
+++ b/drivers/cpufreq/intel_pstate.c
|
||||
@@ -2101,6 +2101,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
|
||||
X86_MATCH(ATOM_GOLDMONT_PLUS, core_funcs),
|
||||
X86_MATCH(SKYLAKE_X, core_funcs),
|
||||
X86_MATCH(ICELAKE_X, core_funcs),
|
||||
+ X86_MATCH(SAPPHIRERAPIDS_X, core_funcs),
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
From 74a981ffd11d9e22aa9117baa0025bafc60c0dda Mon Sep 17 00:00:00 2001
|
||||
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
||||
Date: Wed, 3 Feb 2021 13:43:20 +0200
|
||||
Subject: [PATCH] platform/x86/intel-uncore-freq: Add Sapphire Rapids server
|
||||
support
|
||||
|
||||
Sapphire Rapids uncore frequency control is the same as Skylake and
|
||||
Ice Lake. Add the Sapphire Rapids CPU model number to the match array.
|
||||
|
||||
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
||||
Reviewed-by: Tony Luck <tony.luck@intel.com>
|
||||
Link: https://lore.kernel.org/r/20210203114320.1398801-1-dedekind1@gmail.com
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
(cherry picked from commit 60accc011af0ff869875b1ded81cbd0948267f05)
|
||||
Signed-off-by: Alyson Deives Pereira <alyson.deivespereira@windriver.com>
|
||||
---
|
||||
drivers/platform/x86/intel-uncore-frequency.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/platform/x86/intel-uncore-frequency.c b/drivers/platform/x86/intel-uncore-frequency.c
|
||||
index 12d5ab7e1f5d..3ee4c5c8a64f 100644
|
||||
--- a/drivers/platform/x86/intel-uncore-frequency.c
|
||||
+++ b/drivers/platform/x86/intel-uncore-frequency.c
|
||||
@@ -377,6 +377,7 @@ static const struct x86_cpu_id intel_uncore_cpu_ids[] = {
|
||||
X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_X, NULL),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, NULL),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, NULL),
|
||||
+ X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, NULL),
|
||||
{}
|
||||
};
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
From 865f32679b6bbf92ebf4e0a74c36170c21c4250e Mon Sep 17 00:00:00 2001
|
||||
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
||||
Date: Wed, 2 Mar 2022 10:15:58 +0200
|
||||
Subject: [PATCH] intel_idle: add SPR support
|
||||
|
||||
Add Sapphire Rapids Xeon support.
|
||||
|
||||
Up until very recently, the C1 and C1E C-states were independent, but this
|
||||
has changed in some new chips, including Sapphire Rapids Xeon (SPR). In these
|
||||
chips the C1 and C1E states cannot be enabled at the same time. The "C1E
|
||||
promotion" bit in 'MSR_IA32_POWER_CTL' also has its semantics changed a bit.
|
||||
|
||||
Here are the C1, C1E, and "C1E promotion" bit rules on Xeons before SPR.
|
||||
|
||||
1. If C1E promotion bit is disabled.
|
||||
a. C1 requests end up with C1 C-state.
|
||||
b. C1E requests end up with C1E C-state.
|
||||
2. If C1E promotion bit is enabled.
|
||||
a. C1 requests end up with C1E C-state.
|
||||
b. C1E requests end up with C1E C-state.
|
||||
|
||||
Here are the C1, C1E, and "C1E promotion" bit rules on Sapphire Rapids Xeon.
|
||||
1. If C1E promotion bit is disabled.
|
||||
a. C1 requests end up with C1 C-state.
|
||||
b. C1E requests end up with C1 C-state.
|
||||
2. If C1E promotion bit is enabled.
|
||||
a. C1 requests end up with C1E C-state.
|
||||
b. C1E requests end up with C1E C-state.
|
||||
|
||||
Before SPR Xeon, the 'intel_idle' driver was disabling C1E promotion and was
|
||||
exposing C1 and C1E as independent C-states. But on SPR, C1 and C1E cannot be
|
||||
enabled at the same time.
|
||||
|
||||
This patch adds both C1 and C1E states. However, C1E is marked as with the
|
||||
"CPUIDLE_FLAG_UNUSABLE" flag, which means that in won't be registered by
|
||||
default. The C1E promotion bit will be cleared, which means that by default
|
||||
only C1 and C6 will be registered on SPR.
|
||||
|
||||
The next patch will add an option for enabling C1E and disabling C1 on SPR.
|
||||
|
||||
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
||||
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
||||
(cherry picked from commit 9edf3c0ffef0ec1bed8300315852b5c6a0997130)
|
||||
[mvb: Fix merge conflict caused by a lack of IceLake-D support in
|
||||
StarlingX.]
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/idle/intel_idle.c | 47 +++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 47 insertions(+)
|
||||
|
||||
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
|
||||
index b92b032fb6d1..7694d852b49d 100644
|
||||
--- a/drivers/idle/intel_idle.c
|
||||
+++ b/drivers/idle/intel_idle.c
|
||||
@@ -778,6 +778,46 @@ static struct cpuidle_state icx_cstates[] __initdata = {
|
||||
.enter = NULL }
|
||||
};
|
||||
|
||||
+/*
|
||||
+ * On Sapphire Rapids Xeon C1 has to be disabled if C1E is enabled, and vice
|
||||
+ * versa. On SPR C1E is enabled only if "C1E promotion" bit is set in
|
||||
+ * MSR_IA32_POWER_CTL. But in this case there effectively no C1, because C1
|
||||
+ * requests are promoted to C1E. If the "C1E promotion" bit is cleared, then
|
||||
+ * both C1 and C1E requests end up with C1, so there is effectively no C1E.
|
||||
+ *
|
||||
+ * By default we enable C1 and disable C1E by marking it with
|
||||
+ * 'CPUIDLE_FLAG_UNUSABLE'.
|
||||
+ */
|
||||
+static struct cpuidle_state spr_cstates[] __initdata = {
|
||||
+ {
|
||||
+ .name = "C1",
|
||||
+ .desc = "MWAIT 0x00",
|
||||
+ .flags = MWAIT2flg(0x00),
|
||||
+ .exit_latency = 1,
|
||||
+ .target_residency = 1,
|
||||
+ .enter = &intel_idle,
|
||||
+ .enter_s2idle = intel_idle_s2idle, },
|
||||
+ {
|
||||
+ .name = "C1E",
|
||||
+ .desc = "MWAIT 0x01",
|
||||
+ .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE | \
|
||||
+ CPUIDLE_FLAG_UNUSABLE,
|
||||
+ .exit_latency = 2,
|
||||
+ .target_residency = 4,
|
||||
+ .enter = &intel_idle,
|
||||
+ .enter_s2idle = intel_idle_s2idle, },
|
||||
+ {
|
||||
+ .name = "C6",
|
||||
+ .desc = "MWAIT 0x20",
|
||||
+ .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
|
||||
+ .exit_latency = 290,
|
||||
+ .target_residency = 800,
|
||||
+ .enter = &intel_idle,
|
||||
+ .enter_s2idle = intel_idle_s2idle, },
|
||||
+ {
|
||||
+ .enter = NULL }
|
||||
+};
|
||||
+
|
||||
static struct cpuidle_state atom_cstates[] __initdata = {
|
||||
{
|
||||
.name = "C1E",
|
||||
@@ -1088,6 +1128,12 @@ static const struct idle_cpu idle_cpu_icx __initconst = {
|
||||
.use_acpi = true,
|
||||
};
|
||||
|
||||
+static const struct idle_cpu idle_cpu_spr __initconst = {
|
||||
+ .state_table = spr_cstates,
|
||||
+ .disable_promotion_to_c1e = true,
|
||||
+ .use_acpi = true,
|
||||
+};
|
||||
+
|
||||
static const struct idle_cpu idle_cpu_avn __initconst = {
|
||||
.state_table = avn_cstates,
|
||||
.disable_promotion_to_c1e = true,
|
||||
@@ -1143,6 +1189,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = {
|
||||
X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE, &idle_cpu_skl),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_X, &idle_cpu_skx),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, &idle_cpu_icx),
|
||||
+ X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &idle_cpu_spr),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL, &idle_cpu_knl),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNM, &idle_cpu_knl),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, &idle_cpu_bxt),
|
||||
@@ -1,130 +0,0 @@
|
||||
From 740b87d322e28e14754cb74076799cf8ae44b8f4 Mon Sep 17 00:00:00 2001
|
||||
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
||||
Date: Wed, 2 Mar 2022 10:15:59 +0200
|
||||
Subject: [PATCH] intel_idle: add 'preferred_cstates' module argument
|
||||
|
||||
On Sapphire Rapids Xeon (SPR) the C1 and C1E states are basically mutually
|
||||
exclusive - only one of them can be enabled. By default, 'intel_idle' driver
|
||||
enables C1 and disables C1E. However, some users prefer to use C1E instead of
|
||||
C1, because it saves more energy.
|
||||
|
||||
This patch adds a new module parameter ('preferred_cstates') for enabling C1E
|
||||
and disabling C1. Here is the idea behind it.
|
||||
|
||||
1. This option has effect only for "mutually exclusive" C-states like C1 and
|
||||
C1E on SPR.
|
||||
2. It does not have any effect on independent C-states, which do not require
|
||||
other C-states to be disabled (most states on most platforms as of today).
|
||||
3. For mutually exclusive C-states, the 'intel_idle' driver always has a
|
||||
reasonable default, such as enabling C1 on SPR by default. On other
|
||||
platforms, the default may be different.
|
||||
4. Users can override the default using the 'preferred_cstates' parameter.
|
||||
5. The parameter accepts the preferred C-states bit-mask, similarly to the
|
||||
existing 'states_off' parameter.
|
||||
6. This parameter is not limited to C1/C1E, and leaves room for supporting
|
||||
other mutually exclusive C-states, if they come in the future.
|
||||
|
||||
Today 'intel_idle' can only be compiled-in, which means that on SPR, in order
|
||||
to disable C1 and enable C1E, users should boot with the following kernel
|
||||
argument: intel_idle.preferred_cstates=4
|
||||
|
||||
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
||||
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
||||
(cherry picked from commit da0e58c038e60e7e65d30813ebdfe91687aa8a24)
|
||||
[mvb: Fix merge conflicts caused by the lack of commit 642333384991
|
||||
("intel_idle: Adjust the SKX C6 parameters if PC6 is disabled")
|
||||
in StarlingX's v5.10 kernel.]
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/idle/intel_idle.c | 46 +++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 46 insertions(+)
|
||||
|
||||
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
|
||||
index 7694d852b49d..6837a5fa0214 100644
|
||||
--- a/drivers/idle/intel_idle.c
|
||||
+++ b/drivers/idle/intel_idle.c
|
||||
@@ -66,6 +66,7 @@ static struct cpuidle_driver intel_idle_driver = {
|
||||
/* intel_idle.max_cstate=0 disables driver */
|
||||
static int max_cstate = CPUIDLE_STATE_MAX - 1;
|
||||
static unsigned int disabled_states_mask;
|
||||
+static unsigned int preferred_states_mask;
|
||||
|
||||
static struct cpuidle_device __percpu *intel_idle_cpuidle_devices;
|
||||
|
||||
@@ -1377,6 +1378,8 @@ static inline void intel_idle_init_cstates_acpi(struct cpuidle_driver *drv) { }
|
||||
static inline bool intel_idle_off_by_default(u32 mwait_hint) { return false; }
|
||||
#endif /* !CONFIG_ACPI_PROCESSOR_CSTATE */
|
||||
|
||||
+static void c1e_promotion_enable(void);
|
||||
+
|
||||
/**
|
||||
* ivt_idle_state_table_update - Tune the idle states table for Ivy Town.
|
||||
*
|
||||
@@ -1517,6 +1520,26 @@ static void __init sklh_idle_state_table_update(void)
|
||||
skl_cstates[6].flags |= CPUIDLE_FLAG_UNUSABLE; /* C9-SKL */
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * spr_idle_state_table_update - Adjust Sapphire Rapids idle states table.
|
||||
+ */
|
||||
+static void __init spr_idle_state_table_update(void)
|
||||
+{
|
||||
+ /* Check if user prefers C1E over C1. */
|
||||
+ if (preferred_states_mask & BIT(2)) {
|
||||
+ if (preferred_states_mask & BIT(1))
|
||||
+ /* Both can't be enabled, stick to the defaults. */
|
||||
+ return;
|
||||
+
|
||||
+ spr_cstates[0].flags |= CPUIDLE_FLAG_UNUSABLE;
|
||||
+ spr_cstates[1].flags &= ~CPUIDLE_FLAG_UNUSABLE;
|
||||
+
|
||||
+ /* Enable C1E using the "C1E promotion" bit. */
|
||||
+ c1e_promotion_enable();
|
||||
+ disable_promotion_to_c1e = false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static bool __init intel_idle_verify_cstate(unsigned int mwait_hint)
|
||||
{
|
||||
unsigned int mwait_cstate = MWAIT_HINT2CSTATE(mwait_hint) + 1;
|
||||
@@ -1548,6 +1571,9 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
|
||||
case INTEL_FAM6_SKYLAKE:
|
||||
sklh_idle_state_table_update();
|
||||
break;
|
||||
+ case INTEL_FAM6_SAPPHIRERAPIDS_X:
|
||||
+ spr_idle_state_table_update();
|
||||
+ break;
|
||||
}
|
||||
|
||||
for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) {
|
||||
@@ -1625,6 +1651,15 @@ static void auto_demotion_disable(void)
|
||||
wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
|
||||
}
|
||||
|
||||
+static void c1e_promotion_enable(void)
|
||||
+{
|
||||
+ unsigned long long msr_bits;
|
||||
+
|
||||
+ rdmsrl(MSR_IA32_POWER_CTL, msr_bits);
|
||||
+ msr_bits |= 0x2;
|
||||
+ wrmsrl(MSR_IA32_POWER_CTL, msr_bits);
|
||||
+}
|
||||
+
|
||||
static void c1e_promotion_disable(void)
|
||||
{
|
||||
unsigned long long msr_bits;
|
||||
@@ -1794,3 +1829,14 @@ module_param(max_cstate, int, 0444);
|
||||
*/
|
||||
module_param_named(states_off, disabled_states_mask, uint, 0444);
|
||||
MODULE_PARM_DESC(states_off, "Mask of disabled idle states");
|
||||
+/*
|
||||
+ * Some platforms come with mutually exclusive C-states, so that if one is
|
||||
+ * enabled, the other C-states must not be used. Example: C1 and C1E on
|
||||
+ * Sapphire Rapids platform. This parameter allows for selecting the
|
||||
+ * preferred C-states among the groups of mutually exclusive C-states - the
|
||||
+ * selected C-states will be registered, the other C-states from the mutually
|
||||
+ * exclusive group won't be registered. If the platform has no mutually
|
||||
+ * exclusive C-states, this parameter has no effect.
|
||||
+ */
|
||||
+module_param_named(preferred_cstates, preferred_states_mask, uint, 0444);
|
||||
+MODULE_PARM_DESC(preferred_cstates, "Mask of preferred idle states");
|
||||
@@ -1,50 +0,0 @@
|
||||
From 313c832d5e62ca6da89e74c393e908ad667820c8 Mon Sep 17 00:00:00 2001
|
||||
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
||||
Date: Wed, 2 Mar 2022 10:16:00 +0200
|
||||
Subject: [PATCH] intel_idle: add core C6 optimization for SPR
|
||||
|
||||
Add a Sapphire Rapids Xeon C6 optimization, similar to what we have for Sky Lake
|
||||
Xeon: if package C6 is disabled, adjust C6 exit latency and target residency to
|
||||
match core C6 values, instead of using the default package C6 values.
|
||||
|
||||
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
||||
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
||||
(cherry picked from commit 3a9cf77b60dc9839b6674943bb7c9dcd524b6294)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/idle/intel_idle.c | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
|
||||
index 6837a5fa0214..8e4c41dab7ce 100644
|
||||
--- a/drivers/idle/intel_idle.c
|
||||
+++ b/drivers/idle/intel_idle.c
|
||||
@@ -1525,6 +1525,8 @@ static void __init sklh_idle_state_table_update(void)
|
||||
*/
|
||||
static void __init spr_idle_state_table_update(void)
|
||||
{
|
||||
+ unsigned long long msr;
|
||||
+
|
||||
/* Check if user prefers C1E over C1. */
|
||||
if (preferred_states_mask & BIT(2)) {
|
||||
if (preferred_states_mask & BIT(1))
|
||||
@@ -1538,6 +1540,19 @@ static void __init spr_idle_state_table_update(void)
|
||||
c1e_promotion_enable();
|
||||
disable_promotion_to_c1e = false;
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * By default, the C6 state assumes the worst-case scenario of package
|
||||
+ * C6. However, if PC6 is disabled, we update the numbers to match
|
||||
+ * core C6.
|
||||
+ */
|
||||
+ rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr);
|
||||
+
|
||||
+ /* Limit value 2 and above allow for PC6. */
|
||||
+ if ((msr & 0x7) < 2) {
|
||||
+ spr_cstates[2].exit_latency = 190;
|
||||
+ spr_cstates[2].target_residency = 600;
|
||||
+ }
|
||||
}
|
||||
|
||||
static bool __init intel_idle_verify_cstate(unsigned int mwait_hint)
|
||||
@@ -1,101 +0,0 @@
|
||||
From 56c2804828b5f2479c0287a1afc3c0b23e44f19a Mon Sep 17 00:00:00 2001
|
||||
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
||||
Date: Wed, 27 Apr 2022 09:08:52 +0300
|
||||
Subject: [PATCH] intel_idle: Fix the 'preferred_cstates' module parameter
|
||||
|
||||
Problem description.
|
||||
|
||||
When user boots kernel up with the 'intel_idle.preferred_cstates=4' option,
|
||||
we enable C1E and disable C1 states on Sapphire Rapids Xeon (SPR). In order
|
||||
for C1E to work on SPR, we have to enable the C1E promotion bit on all
|
||||
CPUs. However, we enable it only on one CPU.
|
||||
|
||||
Fix description.
|
||||
|
||||
The 'intel_idle' driver already has the infrastructure for disabling C1E
|
||||
promotion on every CPU. This patch uses the same infrastructure for
|
||||
enabling C1E promotion on every CPU. It changes the boolean
|
||||
'disable_promotion_to_c1e' variable to a tri-state 'c1e_promotion'
|
||||
variable.
|
||||
|
||||
Tested on a 2-socket SPR system. I verified the following combinations:
|
||||
|
||||
* C1E promotion enabled and disabled in BIOS.
|
||||
* Booted with and without the 'intel_idle.preferred_cstates=4' kernel
|
||||
argument.
|
||||
|
||||
In all 4 cases C1E promotion was correctly set on all CPUs.
|
||||
|
||||
Also tested on an old Broadwell system, just to make sure it does not cause
|
||||
a regression. C1E promotion was correctly disabled on that system, both C1
|
||||
and C1E were exposed (as expected).
|
||||
|
||||
Fixes: da0e58c038e6 ("intel_idle: add 'preferred_cstates' module argument")
|
||||
Reported-by: Jan Beulich <jbeulich@suse.com>
|
||||
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
||||
[ rjw: Minor changelog edits ]
|
||||
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
||||
(cherry picked from commit 39c184a6a9a7a99950b321d55fe713175cf1d404)
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
drivers/idle/intel_idle.c | 19 ++++++++++++-------
|
||||
1 file changed, 12 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
|
||||
index 8e4c41dab7ce..f7da2031c994 100644
|
||||
--- a/drivers/idle/intel_idle.c
|
||||
+++ b/drivers/idle/intel_idle.c
|
||||
@@ -71,7 +71,12 @@ static unsigned int preferred_states_mask;
|
||||
static struct cpuidle_device __percpu *intel_idle_cpuidle_devices;
|
||||
|
||||
static unsigned long auto_demotion_disable_flags;
|
||||
-static bool disable_promotion_to_c1e;
|
||||
+
|
||||
+static enum {
|
||||
+ C1E_PROMOTION_PRESERVE,
|
||||
+ C1E_PROMOTION_ENABLE,
|
||||
+ C1E_PROMOTION_DISABLE
|
||||
+} c1e_promotion = C1E_PROMOTION_PRESERVE;
|
||||
|
||||
struct idle_cpu {
|
||||
struct cpuidle_state *state_table;
|
||||
@@ -1378,8 +1383,6 @@ static inline void intel_idle_init_cstates_acpi(struct cpuidle_driver *drv) { }
|
||||
static inline bool intel_idle_off_by_default(u32 mwait_hint) { return false; }
|
||||
#endif /* !CONFIG_ACPI_PROCESSOR_CSTATE */
|
||||
|
||||
-static void c1e_promotion_enable(void);
|
||||
-
|
||||
/**
|
||||
* ivt_idle_state_table_update - Tune the idle states table for Ivy Town.
|
||||
*
|
||||
@@ -1537,8 +1540,7 @@ static void __init spr_idle_state_table_update(void)
|
||||
spr_cstates[1].flags &= ~CPUIDLE_FLAG_UNUSABLE;
|
||||
|
||||
/* Enable C1E using the "C1E promotion" bit. */
|
||||
- c1e_promotion_enable();
|
||||
- disable_promotion_to_c1e = false;
|
||||
+ c1e_promotion = C1E_PROMOTION_ENABLE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1706,7 +1708,9 @@ static int intel_idle_cpu_init(unsigned int cpu)
|
||||
if (auto_demotion_disable_flags)
|
||||
auto_demotion_disable();
|
||||
|
||||
- if (disable_promotion_to_c1e)
|
||||
+ if (c1e_promotion == C1E_PROMOTION_ENABLE)
|
||||
+ c1e_promotion_enable();
|
||||
+ else if (c1e_promotion == C1E_PROMOTION_DISABLE)
|
||||
c1e_promotion_disable();
|
||||
|
||||
return 0;
|
||||
@@ -1785,7 +1789,8 @@ static int __init intel_idle_init(void)
|
||||
if (icpu) {
|
||||
cpuidle_state_table = icpu->state_table;
|
||||
auto_demotion_disable_flags = icpu->auto_demotion_disable_flags;
|
||||
- disable_promotion_to_c1e = icpu->disable_promotion_to_c1e;
|
||||
+ if (icpu->disable_promotion_to_c1e)
|
||||
+ c1e_promotion = C1E_PROMOTION_DISABLE;
|
||||
if (icpu->use_acpi || force_use_acpi)
|
||||
intel_idle_acpi_cst_extract();
|
||||
} else if (!intel_idle_acpi_cst_extract()) {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user