Compare commits
2 Commits
a03db36fed
...
a84cf6e84b
Author | SHA1 | Date | |
---|---|---|---|
a84cf6e84b | |||
352b17054d |
2
debian/bin/genpatch-pfkernel
vendored
2
debian/bin/genpatch-pfkernel
vendored
@ -7,7 +7,7 @@ w=$(git rev-parse --path-format=absolute --show-toplevel) ; : "${w:?}" ; cd "$w"
|
||||
|
||||
dst='debian/patches/pf'
|
||||
src='../linux-extras'
|
||||
branches='amd-pstate amd-rapl cpuidle crypto fixes ksm zstd'
|
||||
branches='amd-pstate amd-rapl cpu cpuidle crypto fixes ksm zstd'
|
||||
|
||||
[ -d "${dst}" ]
|
||||
|
||||
|
2
debian/bin/new-release
vendored
2
debian/bin/new-release
vendored
@ -29,7 +29,7 @@ ver_path="v${major}.${minor}"
|
||||
|
||||
tarball_new="linux_${v}.orig.tar"
|
||||
tarball_new_comp="${tarball_new}.xz"
|
||||
do_compress() { do_idle xz -1vv "$1" ; }
|
||||
do_compress() { do_idle xz -8vv "$1" ; }
|
||||
|
||||
while ! [ -s "../${tarball_new_comp}" ] ; do
|
||||
|
||||
|
86
debian/bin/refine-configs
vendored
Executable file
86
debian/bin/refine-configs
vendored
Executable file
@ -0,0 +1,86 @@
|
||||
#!/bin/sh
|
||||
set -ef
|
||||
|
||||
prj_dir=$(readlink -f "$(dirname "$0")/../..")
|
||||
cd "${prj_dir}"
|
||||
|
||||
[ -s debian/changelog ]
|
||||
dpkg-parsechangelog --show-field Source | grep -Eq '^linux'
|
||||
|
||||
ch_ver=$(dpkg-parsechangelog --show-field Version)
|
||||
|
||||
v=$1
|
||||
[ -n "$v" ] || v=$(echo "${ch_ver}" | sed -E 's/^\d+://;s/-[^-]+$//')
|
||||
[ -n "$v" ]
|
||||
|
||||
## should be source tree with patches applied
|
||||
src_dir=$2
|
||||
[ -n "${src_dir}" ] || src_dir="/tmp/linux-$v"
|
||||
[ -n "${src_dir}" ]
|
||||
[ -d "${src_dir}" ]
|
||||
src_dir=$(readlink -f "${src_dir}")
|
||||
|
||||
export PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
nproc=$(nproc || printf 2)
|
||||
case "${nproc}" in
|
||||
[0-1] ) nproc=2 ;;
|
||||
[2-9] | 1[0-9] ) ;;
|
||||
* ) nproc=20 ;;
|
||||
esac
|
||||
|
||||
rm -rf debian/build/
|
||||
make -f debian/rules debian/control
|
||||
[ -f debian/rules.gen ]
|
||||
|
||||
configs=$(sed -En '\,debian/build/(config\.[^ :]+):$,{s,,\1,p}' debian/rules.gen | sort -uV | tr -s '[:space:]' ' ')
|
||||
[ -n "${configs}" ]
|
||||
## produce configs
|
||||
make -f debian/rules.gen "-j${nproc}" $(printf ' debian/build/%s' ${configs})
|
||||
|
||||
## refresh configs
|
||||
for c in ${configs} ; do
|
||||
echo "# refreshing $c" >&2
|
||||
|
||||
f="debian/build/$c"
|
||||
cp -f "$f" "${src_dir}/.config"
|
||||
env -C "${src_dir}" make "-j${nproc}" olddefconfig
|
||||
cp -f "${src_dir}/.config" "$f"
|
||||
done
|
||||
|
||||
## remove BUILD_SALT
|
||||
find debian/build/ -name 'config.*' -type f -exec sed -i -E '/CONFIG_BUILD_SALT/d' {} +
|
||||
|
||||
## prepare configs for splitting
|
||||
find debian/build/ -name 'config.*' -type f -exec sed -i -En '/CONFIG_/p' {} +
|
||||
|
||||
(
|
||||
cd debian/build
|
||||
mkdir -p split-configs
|
||||
cd split-configs
|
||||
"${prj_dir}/../kconfigeditor2/split-common.py" $(printf ' ../%s' ${configs})
|
||||
find ./ -mindepth 1 -maxdepth 1 -type f -exec sed -i -En '/CONFIG_/p' {} +
|
||||
|
||||
cp -f output-common "${prj_dir}/debian/config/config"
|
||||
i=0
|
||||
for c in ${configs} ; do
|
||||
i=$((i+1))
|
||||
|
||||
## config.amd64_none_cloud -> amd64/config.cloud
|
||||
## config.amd64_rt_desktop -> amd64/rt/config.desktop
|
||||
read -r arch featureset flavour <<-EOF
|
||||
$(printf '%s' "${c#config.}" | tr '_' ' ')
|
||||
EOF
|
||||
[ -n "${arch}" ] || continue
|
||||
[ -n "${featureset}" ] || continue
|
||||
[ -n "${flavour}" ] || continue
|
||||
case "${featureset}" in
|
||||
none ) o="${arch}/config.${flavour}" ;;
|
||||
* ) o="${arch}/${featureset}/config.${flavour}" ;;
|
||||
esac
|
||||
|
||||
cp -f "output-part-$i" "${prj_dir}/debian/config/$o"
|
||||
done
|
||||
)
|
||||
|
||||
"${prj_dir}/../kconfigeditor2/process.py" -s "${src_dir}" .
|
7
debian/changelog
vendored
7
debian/changelog
vendored
@ -1,3 +1,10 @@
|
||||
linux (6.11.6-1) sid; urgency=medium
|
||||
|
||||
* New upstream stable update:
|
||||
https://www.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.11.6
|
||||
|
||||
-- Konstantin Demin <rockdrilla@gmail.com> Fri, 01 Nov 2024 10:54:09 +0300
|
||||
|
||||
linux (6.11.5-1) sid; urgency=medium
|
||||
|
||||
* New upstream stable update:
|
||||
|
3
debian/config/config
vendored
3
debian/config/config
vendored
@ -79,7 +79,6 @@ CONFIG_RANDOMIZE_BASE=y
|
||||
CONFIG_PHYSICAL_ALIGN=0x200000
|
||||
CONFIG_RANDOMIZE_MEMORY=y
|
||||
CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING=0xa
|
||||
# CONFIG_ADDRESS_MASKING is not set
|
||||
# CONFIG_COMPAT_VDSO is not set
|
||||
## choice: vsyscall table for legacy applications
|
||||
# CONFIG_LEGACY_VSYSCALL_XONLY is not set
|
||||
@ -3968,7 +3967,7 @@ CONFIG_NET_REDIRECT=y
|
||||
CONFIG_NET_RX_BUSY_POLL=y
|
||||
CONFIG_NET_SCH_FIFO=y
|
||||
CONFIG_NET_SCH_MQPRIO_LIB=m
|
||||
# CONFIG_NET_SELFTESTS is not set
|
||||
CONFIG_NET_SELFTESTS=m
|
||||
CONFIG_NET_SOCK_MSG=y
|
||||
CONFIG_NET_UDP_TUNNEL=m
|
||||
CONFIG_NET_XGRESS=y
|
||||
|
@ -18,7 +18,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
||||
|
||||
--- a/fs/btrfs/super.c
|
||||
+++ b/fs/btrfs/super.c
|
||||
@@ -2638,7 +2638,7 @@ module_exit(exit_btrfs_fs)
|
||||
@@ -2646,7 +2646,7 @@ module_exit(exit_btrfs_fs)
|
||||
|
||||
MODULE_DESCRIPTION("B-Tree File System (BTRFS)");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -1,61 +0,0 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Sun, 20 Oct 2024 14:49:51 +0200
|
||||
Subject: netfilter: xtables: fix typo causing some targets not to load on IPv6
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Origin: https://git.kernel.org/linus/306ed1728e8438caed30332e1ab46b28c25fe3d8
|
||||
Bug-Debian: https://bugs.debian.org/1085953
|
||||
|
||||
- There is no NFPROTO_IPV6 family for mark and NFLOG.
|
||||
- TRACE is also missing module autoload with NFPROTO_IPV6.
|
||||
|
||||
This results in ip6tables failing to restore a ruleset. This issue has been
|
||||
reported by several users providing incomplete patches.
|
||||
|
||||
Very similar to Ilya Katsnelson's patch including a missing chunk in the
|
||||
TRACE extension.
|
||||
|
||||
Fixes: 0bfcb7b71e73 ("netfilter: xtables: avoid NFPROTO_UNSPEC where needed")
|
||||
Reported-by: Ignat Korchagin <ignat@cloudflare.com>
|
||||
Reported-by: Ilya Katsnelson <me@0upti.me>
|
||||
Reported-by: Krzysztof Olędzki <ole@ans.pl>
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
net/netfilter/xt_NFLOG.c | 2 +-
|
||||
net/netfilter/xt_TRACE.c | 1 +
|
||||
net/netfilter/xt_mark.c | 2 +-
|
||||
3 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/net/netfilter/xt_NFLOG.c
|
||||
+++ b/net/netfilter/xt_NFLOG.c
|
||||
@@ -79,7 +79,7 @@ static struct xt_target nflog_tg_reg[] _
|
||||
{
|
||||
.name = "NFLOG",
|
||||
.revision = 0,
|
||||
- .family = NFPROTO_IPV4,
|
||||
+ .family = NFPROTO_IPV6,
|
||||
.checkentry = nflog_tg_check,
|
||||
.destroy = nflog_tg_destroy,
|
||||
.target = nflog_tg,
|
||||
--- a/net/netfilter/xt_TRACE.c
|
||||
+++ b/net/netfilter/xt_TRACE.c
|
||||
@@ -49,6 +49,7 @@ static struct xt_target trace_tg_reg[] _
|
||||
.target = trace_tg,
|
||||
.checkentry = trace_tg_check,
|
||||
.destroy = trace_tg_destroy,
|
||||
+ .me = THIS_MODULE,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
--- a/net/netfilter/xt_mark.c
|
||||
+++ b/net/netfilter/xt_mark.c
|
||||
@@ -62,7 +62,7 @@ static struct xt_target mark_tg_reg[] __
|
||||
{
|
||||
.name = "MARK",
|
||||
.revision = 2,
|
||||
- .family = NFPROTO_IPV4,
|
||||
+ .family = NFPROTO_IPV6,
|
||||
.target = mark_tg,
|
||||
.targetsize = sizeof(struct xt_mark_tginfo2),
|
||||
.me = THIS_MODULE,
|
@ -22,7 +22,7 @@ implementation went from disk-io.c to super.c; forwarded the issue]
|
||||
|
||||
--- a/fs/btrfs/super.c
|
||||
+++ b/fs/btrfs/super.c
|
||||
@@ -757,6 +757,18 @@ static void set_device_specific_options(
|
||||
@@ -766,6 +766,18 @@ static void set_device_specific_options(
|
||||
btrfs_set_opt(fs_info->mount_opt, SSD);
|
||||
|
||||
/*
|
||||
|
@ -72,7 +72,7 @@ Export the currently un-exported symbols it depends on.
|
||||
* Note: we use "set_current_state()" _after_ the wait-queue add,
|
||||
--- a/kernel/task_work.c
|
||||
+++ b/kernel/task_work.c
|
||||
@@ -97,6 +97,7 @@ int task_work_add(struct task_struct *ta
|
||||
@@ -108,6 +108,7 @@ int task_work_add(struct task_struct *ta
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
||||
Ignore sysrq setting - this boot parameter will
|
||||
--- a/arch/x86/Kconfig
|
||||
+++ b/arch/x86/Kconfig
|
||||
@@ -3065,6 +3065,14 @@ config COMPAT_32
|
||||
@@ -3066,6 +3066,14 @@ config COMPAT_32
|
||||
select HAVE_UID16
|
||||
select OLD_SIGSUSPEND3
|
||||
|
||||
|
144
debian/patches/krd/1001-Revert-perf-x86-rapl-Fix-the-energy-pkg-event-for-AMD-CPUs.patch
vendored
Normal file
144
debian/patches/krd/1001-Revert-perf-x86-rapl-Fix-the-energy-pkg-event-for-AMD-CPUs.patch
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
this reverts following commit:
|
||||
|
||||
From: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
|
||||
Date: Tue, 30 Jul 2024 04:49:18 +0000
|
||||
Subject: perf/x86/rapl: Fix the energy-pkg event for AMD CPUs
|
||||
|
||||
commit 8d72eba1cf8cecd76a2b4c1dd7673c2dc775f514 upstream.
|
||||
|
||||
After commit:
|
||||
|
||||
63edbaa48a57 ("x86/cpu/topology: Add support for the AMD 0x80000026 leaf")
|
||||
|
||||
... on AMD processors that support extended CPUID leaf 0x80000026, the
|
||||
topology_die_cpumask() and topology_logical_die_id() macros no longer
|
||||
return the package cpumask and package ID, instead they return the CCD
|
||||
(Core Complex Die) mask and ID respectively.
|
||||
|
||||
This leads to the energy-pkg event scope to be modified to CCD instead of package.
|
||||
|
||||
So, change the PMU scope for AMD and Hygon back to package.
|
||||
|
||||
On a 12 CCD 1 Package AMD Zen4 Genoa machine:
|
||||
|
||||
Before:
|
||||
|
||||
$ cat /sys/devices/power/cpumask
|
||||
0,8,16,24,32,40,48,56,64,72,80,88.
|
||||
|
||||
The expected cpumask here is supposed to be just "0", as it is a package
|
||||
scope event, only one CPU will be collecting the event for all the CPUs in
|
||||
the package.
|
||||
|
||||
After:
|
||||
|
||||
$ cat /sys/devices/power/cpumask
|
||||
0
|
||||
|
||||
[ mingo: Cleaned up the changelog ]
|
||||
|
||||
Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
|
||||
Signed-off-by: Ingo Molnar <mingo@kernel.org>
|
||||
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
|
||||
Link: https://lore.kernel.org/r/20240904100934.3260-1-Dhananjay.Ugwekar@amd.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
|
||||
--- a/arch/x86/events/rapl.c
|
||||
+++ b/arch/x86/events/rapl.c
|
||||
@@ -103,19 +103,6 @@ static struct perf_pmu_events_attr event
|
||||
.event_str = str, \
|
||||
};
|
||||
|
||||
-/*
|
||||
- * RAPL Package energy counter scope:
|
||||
- * 1. AMD/HYGON platforms have a per-PKG package energy counter
|
||||
- * 2. For Intel platforms
|
||||
- * 2.1. CLX-AP is multi-die and its RAPL MSRs are die-scope
|
||||
- * 2.2. Other Intel platforms are single die systems so the scope can be
|
||||
- * considered as either pkg-scope or die-scope, and we are considering
|
||||
- * them as die-scope.
|
||||
- */
|
||||
-#define rapl_pmu_is_pkg_scope() \
|
||||
- (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || \
|
||||
- boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
|
||||
-
|
||||
struct rapl_pmu {
|
||||
raw_spinlock_t lock;
|
||||
int n_active;
|
||||
@@ -153,25 +140,9 @@ static unsigned int rapl_cntr_mask;
|
||||
static u64 rapl_timer_ms;
|
||||
static struct perf_msr *rapl_msrs;
|
||||
|
||||
-/*
|
||||
- * Helper functions to get the correct topology macros according to the
|
||||
- * RAPL PMU scope.
|
||||
- */
|
||||
-static inline unsigned int get_rapl_pmu_idx(int cpu)
|
||||
-{
|
||||
- return rapl_pmu_is_pkg_scope() ? topology_logical_package_id(cpu) :
|
||||
- topology_logical_die_id(cpu);
|
||||
-}
|
||||
-
|
||||
-static inline const struct cpumask *get_rapl_pmu_cpumask(int cpu)
|
||||
-{
|
||||
- return rapl_pmu_is_pkg_scope() ? topology_core_cpumask(cpu) :
|
||||
- topology_die_cpumask(cpu);
|
||||
-}
|
||||
-
|
||||
static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu)
|
||||
{
|
||||
- unsigned int rapl_pmu_idx = get_rapl_pmu_idx(cpu);
|
||||
+ unsigned int rapl_pmu_idx = topology_logical_die_id(cpu);
|
||||
|
||||
/*
|
||||
* The unsigned check also catches the '-1' return value for non
|
||||
@@ -581,7 +552,7 @@ static int rapl_cpu_offline(unsigned int
|
||||
|
||||
pmu->cpu = -1;
|
||||
/* Find a new cpu to collect rapl events */
|
||||
- target = cpumask_any_but(get_rapl_pmu_cpumask(cpu), cpu);
|
||||
+ target = cpumask_any_but(topology_die_cpumask(cpu), cpu);
|
||||
|
||||
/* Migrate rapl events to the new target */
|
||||
if (target < nr_cpu_ids) {
|
||||
@@ -594,11 +565,6 @@ static int rapl_cpu_offline(unsigned int
|
||||
|
||||
static int rapl_cpu_online(unsigned int cpu)
|
||||
{
|
||||
- s32 rapl_pmu_idx = get_rapl_pmu_idx(cpu);
|
||||
- if (rapl_pmu_idx < 0) {
|
||||
- pr_err("topology_logical_(package/die)_id() returned a negative value");
|
||||
- return -EINVAL;
|
||||
- }
|
||||
struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu);
|
||||
int target;
|
||||
|
||||
@@ -613,14 +579,14 @@ static int rapl_cpu_online(unsigned int
|
||||
pmu->timer_interval = ms_to_ktime(rapl_timer_ms);
|
||||
rapl_hrtimer_init(pmu);
|
||||
|
||||
- rapl_pmus->pmus[rapl_pmu_idx] = pmu;
|
||||
+ rapl_pmus->pmus[topology_logical_die_id(cpu)] = pmu;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if there is an online cpu in the package which collects rapl
|
||||
* events already.
|
||||
*/
|
||||
- target = cpumask_any_and(&rapl_cpu_mask, get_rapl_pmu_cpumask(cpu));
|
||||
+ target = cpumask_any_and(&rapl_cpu_mask, topology_die_cpumask(cpu));
|
||||
if (target < nr_cpu_ids)
|
||||
return 0;
|
||||
|
||||
@@ -709,10 +675,7 @@ static const struct attribute_group *rap
|
||||
|
||||
static int __init init_rapl_pmus(void)
|
||||
{
|
||||
- int nr_rapl_pmu = topology_max_packages();
|
||||
-
|
||||
- if (!rapl_pmu_is_pkg_scope())
|
||||
- nr_rapl_pmu *= topology_max_dies_per_package();
|
||||
+ int nr_rapl_pmu = topology_max_packages() * topology_max_dies_per_package();
|
||||
|
||||
rapl_pmus = kzalloc(struct_size(rapl_pmus, pmus, nr_rapl_pmu), GFP_KERNEL);
|
||||
if (!rapl_pmus)
|
@ -48,7 +48,7 @@ Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
struct quirk_entry {
|
||||
u32 nominal_freq;
|
||||
u32 lowest_freq;
|
||||
@@ -1392,7 +1388,7 @@ static ssize_t amd_pstate_show_status(ch
|
||||
@@ -1402,7 +1398,7 @@ static ssize_t amd_pstate_show_status(ch
|
||||
return sysfs_emit(buf, "%s\n", amd_pstate_mode_string[cppc_state]);
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
{
|
||||
int mode_idx;
|
||||
|
||||
@@ -1409,6 +1405,7 @@ static int amd_pstate_update_status(cons
|
||||
@@ -1419,6 +1415,7 @@ static int amd_pstate_update_status(cons
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
|
||||
--- a/drivers/cpufreq/amd-pstate.c
|
||||
+++ b/drivers/cpufreq/amd-pstate.c
|
||||
@@ -1595,7 +1595,7 @@ static void amd_pstate_epp_cpu_exit(stru
|
||||
@@ -1605,7 +1605,7 @@ static void amd_pstate_epp_cpu_exit(stru
|
||||
pr_debug("CPU %d exiting\n", policy->cpu);
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
{
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
u32 max_perf, min_perf, min_limit_perf, max_limit_perf;
|
||||
@@ -1645,7 +1645,7 @@ static void amd_pstate_epp_update_limit(
|
||||
@@ -1655,7 +1655,7 @@ static void amd_pstate_epp_update_limit(
|
||||
* This return value can only be negative for shared_memory
|
||||
* systems where EPP register read/write not supported.
|
||||
*/
|
||||
@ -32,7 +32,7 @@ Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
}
|
||||
|
||||
if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
|
||||
@@ -1658,12 +1658,13 @@ static void amd_pstate_epp_update_limit(
|
||||
@@ -1668,12 +1668,13 @@ static void amd_pstate_epp_update_limit(
|
||||
}
|
||||
|
||||
WRITE_ONCE(cpudata->cppc_req_cached, value);
|
||||
@ -47,7 +47,7 @@ Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
|
||||
if (!policy->cpuinfo.max_freq)
|
||||
return -ENODEV;
|
||||
@@ -1673,7 +1674,9 @@ static int amd_pstate_epp_set_policy(str
|
||||
@@ -1683,7 +1684,9 @@ static int amd_pstate_epp_set_policy(str
|
||||
|
||||
cpudata->policy = policy->policy;
|
||||
|
||||
|
@ -200,7 +200,7 @@ Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
ret = amd_pstate_init_freq(cpudata);
|
||||
if (ret)
|
||||
goto free_cpudata1;
|
||||
@@ -1493,12 +1479,12 @@ static int amd_pstate_epp_cpu_init(struc
|
||||
@@ -1503,12 +1489,12 @@ static int amd_pstate_epp_cpu_init(struc
|
||||
cpudata->cpu = policy->cpu;
|
||||
cpudata->epp_policy = 0;
|
||||
|
||||
@ -215,7 +215,7 @@ Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
ret = amd_pstate_init_freq(cpudata);
|
||||
if (ret)
|
||||
goto free_cpudata1;
|
||||
@@ -1960,6 +1946,12 @@ static int __init amd_pstate_init(void)
|
||||
@@ -1970,6 +1956,12 @@ static int __init amd_pstate_init(void)
|
||||
static_call_update(amd_pstate_update_perf, cppc_update_perf);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
|
||||
--- a/drivers/cpufreq/amd-pstate.c
|
||||
+++ b/drivers/cpufreq/amd-pstate.c
|
||||
@@ -1786,7 +1786,7 @@ static int __init amd_pstate_set_driver(
|
||||
@@ -1796,7 +1796,7 @@ static int __init amd_pstate_set_driver(
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
|
||||
u32 min_perf, u32 des_perf,
|
||||
u32 max_perf, bool fast_switch)
|
||||
{
|
||||
@@ -1909,9 +1909,9 @@ static int __init amd_pstate_init(void)
|
||||
@@ -1919,9 +1919,9 @@ static int __init amd_pstate_init(void)
|
||||
current_pstate_driver->adjust_perf = amd_pstate_adjust_perf;
|
||||
} else {
|
||||
pr_debug("AMD CPPC shared memory based functionality is supported\n");
|
||||
|
@ -47,7 +47,7 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
ret = freq_qos_add_request(&policy->constraints, &cpudata->req[1],
|
||||
FREQ_QOS_MAX, policy->cpuinfo.max_freq);
|
||||
if (ret < 0) {
|
||||
@@ -1736,6 +1729,13 @@ static int amd_pstate_epp_resume(struct
|
||||
@@ -1746,6 +1739,13 @@ static int amd_pstate_epp_resume(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
static struct cpufreq_driver amd_pstate_driver = {
|
||||
.flags = CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS,
|
||||
.verify = amd_pstate_verify,
|
||||
@@ -1749,6 +1749,7 @@ static struct cpufreq_driver amd_pstate_
|
||||
@@ -1759,6 +1759,7 @@ static struct cpufreq_driver amd_pstate_
|
||||
.update_limits = amd_pstate_update_limits,
|
||||
.name = "amd-pstate",
|
||||
.attr = amd_pstate_attr,
|
||||
@ -69,7 +69,7 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
};
|
||||
|
||||
static struct cpufreq_driver amd_pstate_epp_driver = {
|
||||
@@ -1765,6 +1766,7 @@ static struct cpufreq_driver amd_pstate_
|
||||
@@ -1775,6 +1776,7 @@ static struct cpufreq_driver amd_pstate_
|
||||
.set_boost = amd_pstate_set_boost,
|
||||
.name = "amd-pstate-epp",
|
||||
.attr = amd_pstate_epp_attr,
|
||||
|
@ -1,42 +0,0 @@
|
||||
From d1216c052bedbf6d79e4b0261e2f09e17c66ffd3 Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
|
||||
Date: Fri, 4 Oct 2024 12:23:04 +0000
|
||||
Subject: cpufreq/amd-pstate: Fix amd_pstate mode switch on shared memory
|
||||
systems
|
||||
|
||||
While switching the driver mode between active and passive, Collaborative
|
||||
Processor Performance Control (CPPC) is disabled in
|
||||
amd_pstate_unregister_driver(). But, it is not enabled back while registering
|
||||
the new driver (passive or active). This leads to the new driver mode not
|
||||
working correctly, so enable it back in amd_pstate_register_driver().
|
||||
|
||||
Fixes: 3ca7bc818d8c ("cpufreq: amd-pstate: Add guided mode control support via sysfs")
|
||||
Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
|
||||
---
|
||||
drivers/cpufreq/amd-pstate.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
--- a/drivers/cpufreq/amd-pstate.c
|
||||
+++ b/drivers/cpufreq/amd-pstate.c
|
||||
@@ -1221,11 +1221,21 @@ static int amd_pstate_register_driver(in
|
||||
return -EINVAL;
|
||||
|
||||
cppc_state = mode;
|
||||
+
|
||||
+ ret = amd_pstate_enable(true);
|
||||
+ if (ret) {
|
||||
+ pr_err("failed to enable cppc during amd-pstate driver registration, return %d\n",
|
||||
+ ret);
|
||||
+ amd_pstate_driver_cleanup();
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
ret = cpufreq_register_driver(current_pstate_driver);
|
||||
if (ret) {
|
||||
amd_pstate_driver_cleanup();
|
||||
return ret;
|
||||
}
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,46 +0,0 @@
|
||||
From 4086c1a804741c9c8f418d6088e8c531f2a481f3 Mon Sep 17 00:00:00 2001
|
||||
From: Naohiro Aota <naohiro.aota@wdc.com>
|
||||
Date: Tue, 1 Oct 2024 17:03:32 +0900
|
||||
Subject: btrfs: zoned: fix zone unusable accounting for freed reserved extent
|
||||
|
||||
When btrfs reserves an extent and does not use it (e.g, by an error), it
|
||||
calls btrfs_free_reserved_extent() to free the reserved extent. In the
|
||||
process, it calls btrfs_add_free_space() and then it accounts the region
|
||||
bytes as block_group->zone_unusable.
|
||||
|
||||
However, it leaves the space_info->bytes_zone_unusable side not updated. As
|
||||
a result, ENOSPC can happen while a space_info reservation succeeded. The
|
||||
reservation is fine because the freed region is not added in
|
||||
space_info->bytes_zone_unusable, leaving that space as "free". OTOH,
|
||||
corresponding block group counts it as zone_unusable and its allocation
|
||||
pointer is not rewound, we cannot allocate an extent from that block group.
|
||||
That will also negate space_info's async/sync reclaim process, and cause an
|
||||
ENOSPC error from the extent allocation process.
|
||||
|
||||
Fix that by returning the space to space_info->bytes_zone_unusable.
|
||||
Ideally, since a bio is not submitted for this reserved region, we should
|
||||
return the space to free space and rewind the allocation pointer. But, it
|
||||
needs rework on extent allocation handling, so let it work in this way for
|
||||
now.
|
||||
|
||||
Fixes: 169e0da91a21 ("btrfs: zoned: track unusable bytes for zones")
|
||||
CC: stable@vger.kernel.org # 5.15+
|
||||
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
|
||||
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
|
||||
Reviewed-by: David Sterba <dsterba@suse.com>
|
||||
Signed-off-by: David Sterba <dsterba@suse.com>
|
||||
---
|
||||
fs/btrfs/block-group.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/fs/btrfs/block-group.c
|
||||
+++ b/fs/btrfs/block-group.c
|
||||
@@ -3819,6 +3819,8 @@ void btrfs_free_reserved_bytes(struct bt
|
||||
spin_lock(&cache->lock);
|
||||
if (cache->ro)
|
||||
space_info->bytes_readonly += num_bytes;
|
||||
+ else if (btrfs_is_zoned(cache->fs_info))
|
||||
+ space_info->bytes_zone_unusable += num_bytes;
|
||||
cache->reserved -= num_bytes;
|
||||
space_info->bytes_reserved -= num_bytes;
|
||||
space_info->max_extent_size = 0;
|
@ -1,64 +0,0 @@
|
||||
From aa8155f0ba032729ec4f28c5cb9669fb14f6947b Mon Sep 17 00:00:00 2001
|
||||
From: Filipe Manana <fdmanana@suse.com>
|
||||
Date: Mon, 14 Oct 2024 16:14:18 +0100
|
||||
Subject: btrfs: clear force-compress on remount when compress mount option is
|
||||
given
|
||||
|
||||
After the migration to use fs context for processing mount options we had
|
||||
a slight change in the semantics for remounting a filesystem that was
|
||||
mounted with compress-force. Before we could clear compress-force by
|
||||
passing only "-o compress[=algo]" during a remount, but after that change
|
||||
that does not work anymore, force-compress is still present and one needs
|
||||
to pass "-o compress-force=no,compress[=algo]" to the mount command.
|
||||
|
||||
Example, when running on a kernel 6.8+:
|
||||
|
||||
$ mount -o compress-force=zlib:9 /dev/sdi /mnt/sdi
|
||||
$ mount | grep sdi
|
||||
/dev/sdi on /mnt/sdi type btrfs (rw,relatime,compress-force=zlib:9,discard=async,space_cache=v2,subvolid=5,subvol=/)
|
||||
|
||||
$ mount -o remount,compress=zlib:5 /mnt/sdi
|
||||
$ mount | grep sdi
|
||||
/dev/sdi on /mnt/sdi type btrfs (rw,relatime,compress-force=zlib:5,discard=async,space_cache=v2,subvolid=5,subvol=/)
|
||||
|
||||
On a 6.7 kernel (or older):
|
||||
|
||||
$ mount -o compress-force=zlib:9 /dev/sdi /mnt/sdi
|
||||
$ mount | grep sdi
|
||||
/dev/sdi on /mnt/sdi type btrfs (rw,relatime,compress-force=zlib:9,discard=async,space_cache=v2,subvolid=5,subvol=/)
|
||||
|
||||
$ mount -o remount,compress=zlib:5 /mnt/sdi
|
||||
$ mount | grep sdi
|
||||
/dev/sdi on /mnt/sdi type btrfs (rw,relatime,compress=zlib:5,discard=async,space_cache=v2,subvolid=5,subvol=/)
|
||||
|
||||
So update btrfs_parse_param() to clear "compress-force" when "compress" is
|
||||
given, providing the same semantics as kernel 6.7 and older.
|
||||
|
||||
Reported-by: Roman Mamedov <rm@romanrm.net>
|
||||
Link: https://lore.kernel.org/linux-btrfs/20241014182416.13d0f8b0@nvm/
|
||||
CC: stable@vger.kernel.org # 6.8+
|
||||
Signed-off-by: Filipe Manana <fdmanana@suse.com>
|
||||
Reviewed-by: David Sterba <dsterba@suse.com>
|
||||
Signed-off-by: David Sterba <dsterba@suse.com>
|
||||
---
|
||||
fs/btrfs/super.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
--- a/fs/btrfs/super.c
|
||||
+++ b/fs/btrfs/super.c
|
||||
@@ -340,6 +340,15 @@ static int btrfs_parse_param(struct fs_c
|
||||
fallthrough;
|
||||
case Opt_compress:
|
||||
case Opt_compress_type:
|
||||
+ /*
|
||||
+ * Provide the same semantics as older kernels that don't use fs
|
||||
+ * context, specifying the "compress" option clears
|
||||
+ * "force-compress" without the need to pass
|
||||
+ * "compress-force=[no|none]" before specifying "compress".
|
||||
+ */
|
||||
+ if (opt != Opt_compress_force && opt != Opt_compress_force_type)
|
||||
+ btrfs_clear_opt(ctx->mount_opt, FORCE_COMPRESS);
|
||||
+
|
||||
if (opt == Opt_compress || opt == Opt_compress_force) {
|
||||
ctx->compress_type = BTRFS_COMPRESS_ZLIB;
|
||||
ctx->compress_level = BTRFS_ZLIB_DEFAULT_LEVEL;
|
@ -1,68 +0,0 @@
|
||||
From 81baeb2a67d8245ac5b61299e54dd65defd4ac72 Mon Sep 17 00:00:00 2001
|
||||
From: Qu Wenruo <wqu@suse.com>
|
||||
Date: Tue, 10 Sep 2024 15:21:04 +0930
|
||||
Subject: btrfs: qgroup: set a more sane default value for subtree drop
|
||||
threshold
|
||||
|
||||
Since commit 011b46c30476 ("btrfs: skip subtree scan if it's too high to
|
||||
avoid low stall in btrfs_commit_transaction()"), btrfs qgroup can
|
||||
automatically skip large subtree scan at the cost of marking qgroup
|
||||
inconsistent.
|
||||
|
||||
It's designed to address the final performance problem of snapshot drop
|
||||
with qgroup enabled, but to be safe the default value is
|
||||
BTRFS_MAX_LEVEL, requiring a user space daemon to set a different value
|
||||
to make it work.
|
||||
|
||||
I'd say it's not a good idea to rely on user space tool to set this
|
||||
default value, especially when some operations (snapshot dropping) can
|
||||
be triggered immediately after mount, leaving a very small window to
|
||||
that that sysfs interface.
|
||||
|
||||
So instead of disabling this new feature by default, enable it with a
|
||||
low threshold (3), so that large subvolume tree drop at mount time won't
|
||||
cause huge qgroup workload.
|
||||
|
||||
CC: stable@vger.kernel.org # 6.1
|
||||
Signed-off-by: Qu Wenruo <wqu@suse.com>
|
||||
Reviewed-by: David Sterba <dsterba@suse.com>
|
||||
Signed-off-by: David Sterba <dsterba@suse.com>
|
||||
---
|
||||
fs/btrfs/disk-io.c | 2 +-
|
||||
fs/btrfs/qgroup.c | 2 +-
|
||||
fs/btrfs/qgroup.h | 2 ++
|
||||
3 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/fs/btrfs/disk-io.c
|
||||
+++ b/fs/btrfs/disk-io.c
|
||||
@@ -1960,7 +1960,7 @@ static void btrfs_init_qgroup(struct btr
|
||||
fs_info->qgroup_seq = 1;
|
||||
fs_info->qgroup_ulist = NULL;
|
||||
fs_info->qgroup_rescan_running = false;
|
||||
- fs_info->qgroup_drop_subtree_thres = BTRFS_MAX_LEVEL;
|
||||
+ fs_info->qgroup_drop_subtree_thres = BTRFS_QGROUP_DROP_SUBTREE_THRES_DEFAULT;
|
||||
mutex_init(&fs_info->qgroup_rescan_lock);
|
||||
}
|
||||
|
||||
--- a/fs/btrfs/qgroup.c
|
||||
+++ b/fs/btrfs/qgroup.c
|
||||
@@ -1407,7 +1407,7 @@ int btrfs_quota_disable(struct btrfs_fs_
|
||||
fs_info->quota_root = NULL;
|
||||
fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_ON;
|
||||
fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE;
|
||||
- fs_info->qgroup_drop_subtree_thres = BTRFS_MAX_LEVEL;
|
||||
+ fs_info->qgroup_drop_subtree_thres = BTRFS_QGROUP_DROP_SUBTREE_THRES_DEFAULT;
|
||||
spin_unlock(&fs_info->qgroup_lock);
|
||||
|
||||
btrfs_free_qgroup_config(fs_info);
|
||||
--- a/fs/btrfs/qgroup.h
|
||||
+++ b/fs/btrfs/qgroup.h
|
||||
@@ -121,6 +121,8 @@ struct btrfs_inode;
|
||||
#define BTRFS_QGROUP_RUNTIME_FLAG_CANCEL_RESCAN (1ULL << 63)
|
||||
#define BTRFS_QGROUP_RUNTIME_FLAG_NO_ACCOUNTING (1ULL << 62)
|
||||
|
||||
+#define BTRFS_QGROUP_DROP_SUBTREE_THRES_DEFAULT (3)
|
||||
+
|
||||
/*
|
||||
* Record a dirty extent, and info qgroup to update quota on it
|
||||
*/
|
@ -1,107 +0,0 @@
|
||||
From f6f5cd12972307324de5decd7fa41b0b3c98639c Mon Sep 17 00:00:00 2001
|
||||
From: Boris Burkov <boris@bur.io>
|
||||
Date: Fri, 18 Oct 2024 15:44:34 -0700
|
||||
Subject: btrfs: fix read corruption due to race with extent map merging
|
||||
|
||||
In debugging some corrupt squashfs files, we observed symptoms of
|
||||
corrupt page cache pages but correct on-disk contents. Further
|
||||
investigation revealed that the exact symptom was a correct page
|
||||
followed by an incorrect, duplicate, page. This got us thinking about
|
||||
extent maps.
|
||||
|
||||
commit ac05ca913e9f ("Btrfs: fix race between using extent maps and merging them")
|
||||
enforces a reference count on the primary `em` extent_map being merged,
|
||||
as that one gets modified.
|
||||
|
||||
However, since,
|
||||
commit 3d2ac9922465 ("btrfs: introduce new members for extent_map")
|
||||
both 'em' and 'merge' get modified, which started modifying 'merge'
|
||||
and thus introduced the same race.
|
||||
|
||||
We were able to reproduce this by looping the affected squashfs workload
|
||||
in parallel on a bunch of separate btrfs-es while also dropping caches.
|
||||
We are still working on a simple enough reproducer to make into an fstest.
|
||||
|
||||
The simplest fix is to stop modifying 'merge', which is not essential,
|
||||
as it is dropped immediately after the merge. This behavior is simply
|
||||
a consequence of the order of the two extent maps being important in
|
||||
computing the new values. Modify merge_ondisk_extents to take prev and
|
||||
next by const* and also take a third merged parameter that it puts the
|
||||
results in. Note that this introduces the rather odd behavior of passing
|
||||
'em' to merge_ondisk_extents as a const * and as a regular ptr.
|
||||
|
||||
Fixes: 3d2ac9922465 ("btrfs: introduce new members for extent_map")
|
||||
CC: stable@vger.kernel.org # 6.11+
|
||||
Reviewed-by: Qu Wenruo <wqu@suse.com>
|
||||
Reviewed-by: Filipe Manana <fdmanana@suse.com>
|
||||
Signed-off-by: Omar Sandoval <osandov@fb.com>
|
||||
Signed-off-by: Boris Burkov <boris@bur.io>
|
||||
Signed-off-by: David Sterba <dsterba@suse.com>
|
||||
---
|
||||
fs/btrfs/extent_map.c | 31 ++++++++++++++++---------------
|
||||
1 file changed, 16 insertions(+), 15 deletions(-)
|
||||
|
||||
--- a/fs/btrfs/extent_map.c
|
||||
+++ b/fs/btrfs/extent_map.c
|
||||
@@ -240,13 +240,19 @@ static bool mergeable_maps(const struct
|
||||
/*
|
||||
* Handle the on-disk data extents merge for @prev and @next.
|
||||
*
|
||||
+ * @prev: left extent to merge
|
||||
+ * @next: right extent to merge
|
||||
+ * @merged: the extent we will not discard after the merge; updated with new values
|
||||
+ *
|
||||
+ * After this, one of the two extents is the new merged extent and the other is
|
||||
+ * removed from the tree and likely freed. Note that @merged is one of @prev/@next
|
||||
+ * so there is const/non-const aliasing occurring here.
|
||||
+ *
|
||||
* Only touches disk_bytenr/disk_num_bytes/offset/ram_bytes.
|
||||
* For now only uncompressed regular extent can be merged.
|
||||
- *
|
||||
- * @prev and @next will be both updated to point to the new merged range.
|
||||
- * Thus one of them should be removed by the caller.
|
||||
*/
|
||||
-static void merge_ondisk_extents(struct extent_map *prev, struct extent_map *next)
|
||||
+static void merge_ondisk_extents(const struct extent_map *prev, const struct extent_map *next,
|
||||
+ struct extent_map *merged)
|
||||
{
|
||||
u64 new_disk_bytenr;
|
||||
u64 new_disk_num_bytes;
|
||||
@@ -281,15 +287,10 @@ static void merge_ondisk_extents(struct
|
||||
new_disk_bytenr;
|
||||
new_offset = prev->disk_bytenr + prev->offset - new_disk_bytenr;
|
||||
|
||||
- prev->disk_bytenr = new_disk_bytenr;
|
||||
- prev->disk_num_bytes = new_disk_num_bytes;
|
||||
- prev->ram_bytes = new_disk_num_bytes;
|
||||
- prev->offset = new_offset;
|
||||
-
|
||||
- next->disk_bytenr = new_disk_bytenr;
|
||||
- next->disk_num_bytes = new_disk_num_bytes;
|
||||
- next->ram_bytes = new_disk_num_bytes;
|
||||
- next->offset = new_offset;
|
||||
+ merged->disk_bytenr = new_disk_bytenr;
|
||||
+ merged->disk_num_bytes = new_disk_num_bytes;
|
||||
+ merged->ram_bytes = new_disk_num_bytes;
|
||||
+ merged->offset = new_offset;
|
||||
}
|
||||
|
||||
static void dump_extent_map(struct btrfs_fs_info *fs_info, const char *prefix,
|
||||
@@ -358,7 +359,7 @@ static void try_merge_map(struct btrfs_i
|
||||
em->generation = max(em->generation, merge->generation);
|
||||
|
||||
if (em->disk_bytenr < EXTENT_MAP_LAST_BYTE)
|
||||
- merge_ondisk_extents(merge, em);
|
||||
+ merge_ondisk_extents(merge, em, em);
|
||||
em->flags |= EXTENT_FLAG_MERGED;
|
||||
|
||||
validate_extent_map(fs_info, em);
|
||||
@@ -375,7 +376,7 @@ static void try_merge_map(struct btrfs_i
|
||||
if (rb && can_merge_extent_map(merge) && mergeable_maps(em, merge)) {
|
||||
em->len += merge->len;
|
||||
if (em->disk_bytenr < EXTENT_MAP_LAST_BYTE)
|
||||
- merge_ondisk_extents(em, merge);
|
||||
+ merge_ondisk_extents(em, merge, em);
|
||||
validate_extent_map(fs_info, em);
|
||||
rb_erase(&merge->rb_node, &tree->root);
|
||||
RB_CLEAR_NODE(&merge->rb_node);
|
@ -1,101 +0,0 @@
|
||||
From 7f83049bda761f340991af8dce79a4e98c62b378 Mon Sep 17 00:00:00 2001
|
||||
From: Qu Wenruo <wqu@suse.com>
|
||||
Date: Thu, 19 Sep 2024 20:18:11 +0930
|
||||
Subject: btrfs: reject ro->rw reconfiguration if there are hard ro
|
||||
requirements
|
||||
|
||||
[BUG]
|
||||
Syzbot reports the following crash:
|
||||
|
||||
BTRFS info (device loop0 state MCS): disabling free space tree
|
||||
BTRFS info (device loop0 state MCS): clearing compat-ro feature flag for FREE_SPACE_TREE (0x1)
|
||||
BTRFS info (device loop0 state MCS): clearing compat-ro feature flag for FREE_SPACE_TREE_VALID (0x2)
|
||||
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN NOPTI
|
||||
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
|
||||
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
|
||||
RIP: 0010:backup_super_roots fs/btrfs/disk-io.c:1691 [inline]
|
||||
RIP: 0010:write_all_supers+0x97a/0x40f0 fs/btrfs/disk-io.c:4041
|
||||
Call Trace:
|
||||
<TASK>
|
||||
btrfs_commit_transaction+0x1eae/0x3740 fs/btrfs/transaction.c:2530
|
||||
btrfs_delete_free_space_tree+0x383/0x730 fs/btrfs/free-space-tree.c:1312
|
||||
btrfs_start_pre_rw_mount+0xf28/0x1300 fs/btrfs/disk-io.c:3012
|
||||
btrfs_remount_rw fs/btrfs/super.c:1309 [inline]
|
||||
btrfs_reconfigure+0xae6/0x2d40 fs/btrfs/super.c:1534
|
||||
btrfs_reconfigure_for_mount fs/btrfs/super.c:2020 [inline]
|
||||
btrfs_get_tree_subvol fs/btrfs/super.c:2079 [inline]
|
||||
btrfs_get_tree+0x918/0x1920 fs/btrfs/super.c:2115
|
||||
vfs_get_tree+0x90/0x2b0 fs/super.c:1800
|
||||
do_new_mount+0x2be/0xb40 fs/namespace.c:3472
|
||||
do_mount fs/namespace.c:3812 [inline]
|
||||
__do_sys_mount fs/namespace.c:4020 [inline]
|
||||
__se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997
|
||||
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
|
||||
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
|
||||
entry_SYSCALL_64_after_hwframe+0x77/0x7f
|
||||
|
||||
[CAUSE]
|
||||
To support mounting different subvolume with different RO/RW flags for
|
||||
the new mount APIs, btrfs introduced two workaround to support this feature:
|
||||
|
||||
- Skip mount option/feature checks if we are mounting a different
|
||||
subvolume
|
||||
|
||||
- Reconfigure the fs to RW if the initial mount is RO
|
||||
|
||||
Combining these two, we can have the following sequence:
|
||||
|
||||
- Mount the fs ro,rescue=all,clear_cache,space_cache=v1
|
||||
rescue=all will mark the fs as hard read-only, so no v2 cache clearing
|
||||
will happen.
|
||||
|
||||
- Mount a subvolume rw of the same fs.
|
||||
We go into btrfs_get_tree_subvol(), but fc_mount() returns EBUSY
|
||||
because our new fc is RW, different from the original fs.
|
||||
|
||||
Now we enter btrfs_reconfigure_for_mount(), which switches the RO flag
|
||||
first so that we can grab the existing fs_info.
|
||||
Then we reconfigure the fs to RW.
|
||||
|
||||
- During reconfiguration, option/features check is skipped
|
||||
This means we will restart the v2 cache clearing, and convert back to
|
||||
v1 cache.
|
||||
This will trigger fs writes, and since the original fs has "rescue=all"
|
||||
option, it skips the csum tree read.
|
||||
|
||||
And eventually causing NULL pointer dereference in super block
|
||||
writeback.
|
||||
|
||||
[FIX]
|
||||
For reconfiguration caused by different subvolume RO/RW flags, ensure we
|
||||
always run btrfs_check_options() to ensure we have proper hard RO
|
||||
requirements met.
|
||||
|
||||
In fact the function btrfs_check_options() doesn't really do many
|
||||
complex checks, but hard RO requirement and some feature dependency
|
||||
checks, thus there is no special reason not to do the check for mount
|
||||
reconfiguration.
|
||||
|
||||
Reported-by: syzbot+56360f93efa90ff15870@syzkaller.appspotmail.com
|
||||
Link: https://lore.kernel.org/linux-btrfs/0000000000008c5d090621cb2770@google.com/
|
||||
Fixes: f044b318675f ("btrfs: handle the ro->rw transition for mounting different subvolumes")
|
||||
CC: stable@vger.kernel.org # 6.8+
|
||||
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
|
||||
Signed-off-by: Qu Wenruo <wqu@suse.com>
|
||||
Signed-off-by: David Sterba <dsterba@suse.com>
|
||||
---
|
||||
fs/btrfs/super.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/fs/btrfs/super.c
|
||||
+++ b/fs/btrfs/super.c
|
||||
@@ -1519,8 +1519,7 @@ static int btrfs_reconfigure(struct fs_c
|
||||
sync_filesystem(sb);
|
||||
set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
|
||||
|
||||
- if (!mount_reconfigure &&
|
||||
- !btrfs_check_options(fs_info, &ctx->mount_opt, fc->sb_flags))
|
||||
+ if (!btrfs_check_options(fs_info, &ctx->mount_opt, fc->sb_flags))
|
||||
return -EINVAL;
|
||||
|
||||
ret = btrfs_check_features(fs_info, !(fc->sb_flags & SB_RDONLY));
|
@ -1,54 +0,0 @@
|
||||
From ed73b9279db9536a9672cba6506950c26cedb140 Mon Sep 17 00:00:00 2001
|
||||
From: Yue Haibing <yuehaibing@huawei.com>
|
||||
Date: Tue, 22 Oct 2024 17:52:08 +0800
|
||||
Subject: btrfs: fix passing 0 to ERR_PTR in btrfs_search_dir_index_item()
|
||||
|
||||
The ret may be zero in btrfs_search_dir_index_item() and should not
|
||||
passed to ERR_PTR(). Now btrfs_unlink_subvol() is the only caller to
|
||||
this, reconstructed it to check ERR_PTR(-ENOENT) while ret >= 0.
|
||||
|
||||
This fixes smatch warnings:
|
||||
|
||||
fs/btrfs/dir-item.c:353
|
||||
btrfs_search_dir_index_item() warn: passing zero to 'ERR_PTR'
|
||||
|
||||
Fixes: 9dcbe16fccbb ("btrfs: use btrfs_for_each_slot in btrfs_search_dir_index_item")
|
||||
CC: stable@vger.kernel.org # 6.1+
|
||||
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
|
||||
Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
|
||||
Reviewed-by: David Sterba <dsterba@suse.com>
|
||||
Signed-off-by: David Sterba <dsterba@suse.com>
|
||||
---
|
||||
fs/btrfs/dir-item.c | 4 ++--
|
||||
fs/btrfs/inode.c | 7 ++-----
|
||||
2 files changed, 4 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/fs/btrfs/dir-item.c
|
||||
+++ b/fs/btrfs/dir-item.c
|
||||
@@ -347,8 +347,8 @@ btrfs_search_dir_index_item(struct btrfs
|
||||
return di;
|
||||
}
|
||||
/* Adjust return code if the key was not found in the next leaf. */
|
||||
- if (ret > 0)
|
||||
- ret = 0;
|
||||
+ if (ret >= 0)
|
||||
+ ret = -ENOENT;
|
||||
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
--- a/fs/btrfs/inode.c
|
||||
+++ b/fs/btrfs/inode.c
|
||||
@@ -4344,11 +4344,8 @@ static int btrfs_unlink_subvol(struct bt
|
||||
*/
|
||||
if (btrfs_ino(inode) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) {
|
||||
di = btrfs_search_dir_index_item(root, path, dir_ino, &fname.disk_name);
|
||||
- if (IS_ERR_OR_NULL(di)) {
|
||||
- if (!di)
|
||||
- ret = -ENOENT;
|
||||
- else
|
||||
- ret = PTR_ERR(di);
|
||||
+ if (IS_ERR(di)) {
|
||||
+ ret = PTR_ERR(di);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
}
|
@ -10,14 +10,14 @@ Subject: ZEN: INTERACTIVE: Use BFQ as the elevator for SQ devices
|
||||
|
||||
--- a/block/elevator.c
|
||||
+++ b/block/elevator.c
|
||||
@@ -569,7 +569,11 @@ static struct elevator_type *elevator_ge
|
||||
@@ -568,7 +568,11 @@ static struct elevator_type *elevator_ge
|
||||
!blk_mq_is_shared_tags(q->tag_set->flags))
|
||||
return NULL;
|
||||
|
||||
+#if defined(CONFIG_ZEN_INTERACTIVE) && defined(CONFIG_IOSCHED_BFQ)
|
||||
+ return elevator_find_get(q, "bfq");
|
||||
+ return elevator_find_get("bfq");
|
||||
+#else
|
||||
return elevator_find_get(q, "mq-deadline");
|
||||
return elevator_find_get("mq-deadline");
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
@ -10,20 +10,20 @@ Subject: ZEN: INTERACTIVE: Use Kyber as the elevator for MQ devices
|
||||
|
||||
--- a/block/elevator.c
|
||||
+++ b/block/elevator.c
|
||||
@@ -567,7 +567,13 @@ static struct elevator_type *elevator_ge
|
||||
@@ -566,7 +566,13 @@ static struct elevator_type *elevator_ge
|
||||
|
||||
if (q->nr_hw_queues != 1 &&
|
||||
!blk_mq_is_shared_tags(q->tag_set->flags))
|
||||
+#if defined(CONFIG_ZEN_INTERACTIVE) && defined(CONFIG_MQ_IOSCHED_KYBER)
|
||||
+ return elevator_find_get(q, "kyber");
|
||||
+ return elevator_find_get("kyber");
|
||||
+#elif defined(CONFIG_ZEN_INTERACTIVE)
|
||||
+ return elevator_find_get(q, "mq-deadline");
|
||||
+ return elevator_find_get("mq-deadline");
|
||||
+#else
|
||||
return NULL;
|
||||
+#endif
|
||||
|
||||
#if defined(CONFIG_ZEN_INTERACTIVE) && defined(CONFIG_IOSCHED_BFQ)
|
||||
return elevator_find_get(q, "bfq");
|
||||
return elevator_find_get("bfq");
|
||||
--- a/init/Kconfig
|
||||
+++ b/init/Kconfig
|
||||
@@ -143,6 +143,7 @@ config ZEN_INTERACTIVE
|
||||
|
10
debian/patches/series
vendored
10
debian/patches/series
vendored
@ -73,7 +73,6 @@ bugfix/all/disable-some-marvell-phys.patch
|
||||
bugfix/all/fs-add-module_softdep-declarations-for-hard-coded-cr.patch
|
||||
bugfix/all/documentation-use-relative-source-paths-in-abi-documentation.patch
|
||||
bugfix/all/Revert-mmc-dw_mmc-Fix-IDMAC-operation-with-pages-big.patch
|
||||
bugfix/all/netfilter-xtables-fix-typo-causing-some-targets-not-.patch
|
||||
|
||||
# Miscellaneous features
|
||||
|
||||
@ -115,6 +114,8 @@ krd/0001-Revert-objtool-dont-fail-the-kernel-build-on-fatal-errors.patch
|
||||
krd/0002-established-timeout.patch
|
||||
krd/0003-local-ports.patch
|
||||
krd/0004-bridge-group_fwd_mask.patch
|
||||
## adjustment for patchset-pf/amd-rapl/
|
||||
krd/1001-Revert-perf-x86-rapl-Fix-the-energy-pkg-event-for-AMD-CPUs.patch
|
||||
|
||||
## 3rd party patches
|
||||
|
||||
@ -187,7 +188,6 @@ patchset-pf/amd-pstate/0018-cpufreq-amd-pstate-Rename-MSR-and-shared-memory-spec
|
||||
patchset-pf/amd-pstate/0019-cpufreq-Add-a-callback-to-update-the-min_freq_req-fr.patch
|
||||
patchset-pf/amd-pstate/0020-cpufreq-amd-pstate-Set-the-initial-min_freq-to-lowes.patch
|
||||
patchset-pf/amd-pstate/0021-cpufreq-amd-pstate-Cleanup-the-old-min_freq-qos-requ.patch
|
||||
patchset-pf/amd-pstate/0022-cpufreq-amd-pstate-Fix-amd_pstate-mode-switch-on-sha.patch
|
||||
patchset-pf/amd-pstate/0023-cpufreq-amd-pstate-Use-nominal-perf-for-limits-when-.patch
|
||||
patchset-pf/amd-pstate/0024-cpufreq-amd-pstate-Don-t-update-CPPC-request-in-amd_.patch
|
||||
patchset-pf/amd-pstate/0025-cpufreq-amd-pstate-Use-amd_pstate_update_min_max_lim.patch
|
||||
@ -307,13 +307,7 @@ patchset-pf/fixes/0002-cpufreq-Remove-LATENCY_MULTIPLIER.patch
|
||||
patchset-pf/fixes/0003-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch
|
||||
patchset-pf/fixes/0004-nfsd-add-more-info-to-WARN_ON_ONCE-on-failed-callbac.patch
|
||||
patchset-pf/fixes/0005-e1000e-Remove-Meteor-Lake-SMBUS-workarounds.patch
|
||||
patchset-pf/fixes/0006-btrfs-zoned-fix-zone-unusable-accounting-for-freed-r.patch
|
||||
patchset-pf/fixes/0007-btrfs-clear-force-compress-on-remount-when-compress-.patch
|
||||
patchset-pf/fixes/0008-btrfs-qgroup-set-a-more-sane-default-value-for-subtr.patch
|
||||
patchset-pf/fixes/0009-btrfs-also-add-stripe-entries-for-NOCOW-writes.patch
|
||||
patchset-pf/fixes/0010-btrfs-fix-read-corruption-due-to-race-with-extent-ma.patch
|
||||
patchset-pf/fixes/0011-btrfs-reject-ro-rw-reconfiguration-if-there-are-hard.patch
|
||||
patchset-pf/fixes/0012-btrfs-fix-passing-0-to-ERR_PTR-in-btrfs_search_dir_i.patch
|
||||
|
||||
patchset-zen/fixes/0001-Partially-revert-drm-amd-amdgpu-add-pipe1-hardware-s.patch
|
||||
patchset-zen/fixes/0002-drm-amdgpu-swsmu-default-to-fullscreen-3D-profile-fo.patch
|
||||
|
Loading…
Reference in New Issue
Block a user