When rt_runtime is modified from -1 to a valid control value, it may
cause the task to be throttled all the time. Operations like the following
will trigger the bug. E.g:
1. echo -1 > /proc/sys/kernel/sched_rt_runtime_us
2. Run a FIFO task named A that executes while(1)
3. echo 950000 > /proc/sys/kernel/sched_rt_runtime_us
When rt_runtime is -1, The rt period timer will not be activated when task A
enqueued. And then the task will be throttled after setting rt_runtime to
950,000. The task will always be throttled because the rt period timer is not
activated.
Reported-by: Hulk Robot <hulkci(a)huawei.com>
Signed-off-by: Li Hua <hucool.lihua(a)huawei.com>
v1->v2:
- call do_start_rt_bandwidth to reduce repetitive code.
- use raw_spin_lock_irqsave to avoid deadlock on a timer context.
---
kernel/sched/rt.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index b48baaba2fc2..7b4f4fbbb404 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -52,11 +52,8 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime)
rt_b->rt_period_timer.function = sched_rt_period_timer;
}
-static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
+static inline void do_start_rt_bandwidth(struct rt_bandwidth *rt_b)
{
- if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF)
- return;
-
raw_spin_lock(&rt_b->rt_runtime_lock);
if (!rt_b->rt_period_active) {
rt_b->rt_period_active = 1;
@@ -75,6 +72,14 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
raw_spin_unlock(&rt_b->rt_runtime_lock);
}
+static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
+{
+ if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF)
+ return;
+
+ do_start_rt_bandwidth(rt_b);
+}
+
void init_rt_rq(struct rt_rq *rt_rq)
{
struct rt_prio_array *array;
@@ -1031,13 +1036,17 @@ static void update_curr_rt(struct rq *rq)
for_each_sched_rt_entity(rt_se) {
struct rt_rq *rt_rq = rt_rq_of_se(rt_se);
+ int exceeded;
if (sched_rt_runtime(rt_rq) != RUNTIME_INF) {
raw_spin_lock(&rt_rq->rt_runtime_lock);
rt_rq->rt_time += delta_exec;
- if (sched_rt_runtime_exceeded(rt_rq))
+ exceeded = sched_rt_runtime_exceeded(rt_rq);
+ if (exceeded)
resched_curr(rq);
raw_spin_unlock(&rt_rq->rt_runtime_lock);
+ if (exceeded)
+ do_start_rt_bandwidth(sched_rt_bandwidth(rt_rq));
}
}
}
@@ -2911,8 +2920,12 @@ static int sched_rt_global_validate(void)
static void sched_rt_do_global(void)
{
+ unsigned long flags;
+
+ raw_spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags);
def_rt_bandwidth.rt_runtime = global_rt_runtime();
def_rt_bandwidth.rt_period = ns_to_ktime(global_rt_period());
+ raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags);
}
int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
--
2.17.1
Trying to remove the fsl-sata module in the PPC64 GNU/Linux
leads to the following warning:
------------[ cut here ]------------
remove_proc_entry: removing non-empty directory 'irq/69',
leaking at least 'fsl-sata[ff0221000.sata]'
WARNING: CPU: 3 PID: 1048 at fs/proc/generic.c:722
.remove_proc_entry+0x20c/0x220
IRQMASK: 0
NIP [c00000000033826c] .remove_proc_entry+0x20c/0x220
LR [c000000000338268] .remove_proc_entry+0x208/0x220
Call Trace:
.remove_proc_entry+0x208/0x220 (unreliable)
.unregister_irq_proc+0x104/0x140
.free_desc+0x44/0xb0
.irq_free_descs+0x9c/0xf0
.irq_dispose_mapping+0x64/0xa0
.sata_fsl_remove+0x58/0xa0 [sata_fsl]
.platform_drv_remove+0x40/0x90
.device_release_driver_internal+0x160/0x2c0
.driver_detach+0x64/0xd0
.bus_remove_driver+0x70/0xf0
.driver_unregister+0x38/0x80
.platform_driver_unregister+0x14/0x30
.fsl_sata_driver_exit+0x18/0xa20 [sata_fsl]
---[ end trace 0ea876d4076908f5 ]---
The driver creates the mapping by calling irq_of_parse_and_map(),
so it also has to dispose the mapping. But the easy way out is to
simply use platform_get_irq() instead of irq_of_parse_map(). Also
we should adapt return value checking and propagate error values.
In this case the mapping is not managed by the device but by
the of core, so the device has not to dispose the mapping.
Fixes: faf0b2e5afe7 ("drivers/ata: add support to Freescale 3.0Gbps SATA Controller")
Cc: stable(a)vger.kernel.org
Reported-by: Hulk Robot <hulkci(a)huawei.com>
Signed-off-by: Baokun Li <libaokun1(a)huawei.com>
---
V1->V2:
Adapt return value checking and propagate error values.
V2->V3:
Add fixed and CC stable.
drivers/ata/sata_fsl.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 30759fd1c3a2..f850dfab72a6 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1493,8 +1493,9 @@ static int sata_fsl_probe(struct platform_device *ofdev)
host_priv->ssr_base = ssr_base;
host_priv->csr_base = csr_base;
- irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
- if (!irq) {
+ irq = platform_get_irq(ofdev, 0);
+ if (irq < 0) {
+ retval = irq;
dev_err(&ofdev->dev, "invalid irq from platform\n");
goto error_exit_with_cleanup;
}
@@ -1570,8 +1571,6 @@ static int sata_fsl_remove(struct platform_device *ofdev)
ata_host_detach(host);
- irq_dispose_mapping(host_priv->irq);
-
return 0;
}
--
2.31.1
This is the start of the stable review cycle for the 5.10.81 release.
There are 21 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.81-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 5.10.81-rc1
Subbaraman Narayanamurthy <quic_subbaram(a)quicinc.com>
thermal: Fix NULL pointer dereferences in of_thermal_ functions
Greg Thelen <gthelen(a)google.com>
perf/core: Avoid put_page() when GUP fails
Nathan Chancellor <nathan(a)kernel.org>
scripts/lld-version.sh: Rewrite based on upstream ld-version.sh
Gao Xiang <hsiangkao(a)linux.alibaba.com>
erofs: fix unsafe pagevec reuse of hooked pclusters
Yue Hu <huyue2(a)yulong.com>
erofs: remove the occupied parameter from z_erofs_pagevec_enqueue()
Marc Zyngier <maz(a)kernel.org>
PCI: Add MSI masking quirk for Nvidia ION AHCI
Marc Zyngier <maz(a)kernel.org>
PCI/MSI: Deal with devices lying about their MSI mask capability
Thomas Gleixner <tglx(a)linutronix.de>
PCI/MSI: Destroy sysfs before freeing entries
Sven Schnelle <svens(a)stackframe.org>
parisc/entry: fix trace test in syscall exit path
Peter Zijlstra <peterz(a)infradead.org>
x86/iopl: Fake iopl(3) CLI/STI usage
Nick Desaulniers <ndesaulniers(a)google.com>
arm64: vdso32: suppress error message for 'make mrproper'
Michael Riesch <michael.riesch(a)wolfvision.net>
net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings
Wong Vee Khee <vee.khee.wong(a)linux.intel.com>
net: stmmac: fix issue where clk is being unprepared twice
Joakim Zhang <qiangqing.zhang(a)nxp.com>
net: stmmac: fix system hang if change mac address after interface ifdown
Yang Yingliang <yangyingliang(a)huawei.com>
net: stmmac: fix missing unlock on error in stmmac_suspend()
Wei Yongjun <weiyongjun1(a)huawei.com>
net: stmmac: platform: fix build error with !CONFIG_PM_SLEEP
Joakim Zhang <qiangqing.zhang(a)nxp.com>
net: stmmac: add clocks management for gmac driver
Masami Hiramatsu <mhiramat(a)kernel.org>
bootconfig: init: Fix memblock leak in xbc_make_cmdline()
Xie Yongji <xieyongji(a)bytedance.com>
loop: Use blk_validate_block_size() to validate block size
Xie Yongji <xieyongji(a)bytedance.com>
block: Add a helper to validate the block size
Kees Cook <keescook(a)chromium.org>
fortify: Explicitly disable Clang support
-------------
Diffstat:
Makefile | 4 +-
arch/arm64/kernel/vdso32/Makefile | 3 +-
arch/parisc/kernel/entry.S | 2 +-
arch/x86/include/asm/insn-eval.h | 1 +
arch/x86/include/asm/processor.h | 1 +
arch/x86/kernel/process.c | 1 +
arch/x86/kernel/traps.c | 34 +++++++
arch/x86/lib/insn-eval.c | 2 +-
drivers/block/loop.c | 17 +---
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 9 --
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 87 ++++++++++++++--
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 111 ++++++++++++++++-----
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 30 ++++--
drivers/pci/msi.c | 27 ++---
drivers/pci/quirks.c | 6 ++
drivers/thermal/thermal_of.c | 9 +-
fs/erofs/zdata.c | 15 ++-
fs/erofs/zpvec.h | 14 ++-
include/linux/blkdev.h | 8 ++
include/linux/pci.h | 2 +
init/main.c | 1 +
kernel/events/core.c | 10 +-
scripts/lld-version.sh | 35 +++++--
security/Kconfig | 3 +
25 files changed, 320 insertions(+), 113 deletions(-)