From: Teng Hu <[email protected]>
Return -ETIME when a process waiting on a semaphore woken up
due to timedout, while return -EINTR when woken up by a signal.
Signed-off-by: Teng Hu <[email protected]>
---
kernel/locking/semaphore.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/locking/semaphore.c b/kernel/locking/semaphore.c
index 9ee381e4d2a4..97ad6a747d2f 100644
--- a/kernel/locking/semaphore.c
+++ b/kernel/locking/semaphore.c
@@ -225,6 +225,8 @@ static inline int __sched __down_common(struct semaphore *sem, long state,
raw_spin_lock_irq(&sem->lock);
if (waiter.up)
return 0;
+ if (timeout)
+ goto interrupted;
}
timed_out:
--
2.20.1
Greeting,
FYI, we noticed the following commit (built with gcc-9):
commit: e45ef9869b6ababad3336ae7af8376d7174204db ("[PATCH] kernel/locking: Return proper value in __down_common()")
url: https://github.com/0day-ci/linux/commits/huteng-ht-bytedance-com/kernel-locking-Return-proper-value-in-__down_common/20220309-190848
base: https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git cd27ccfc727e99352321c0c75012ab9c5a90321e
patch link: https://lore.kernel.org/lkml/[email protected]
in testcase: aim7
version: aim7-x86_64-1-1_20220308
with following parameters:
disk: 1BRD_48G
fs: xfs
test: disk_rr
load: 3000
cpufreq_governor: performance
ucode: 0x7002402
test-description: AIM7 is a traditional UNIX system level benchmark suite which is used to test and measure the performance of multiuser system.
test-url: https://sourceforge.net/projects/aimbench/files/aim-suite7/
on test machine: 144 threads 4 sockets Intel(R) Xeon(R) Gold 5318H CPU @ 2.50GHz with 128G memory
caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
(please be noted this does not always happen, in our tests 9 out of 36 runs
show this problem. but always clean on parent)
If you fix the issue, kindly add following tag
Reported-by: kernel test robot <[email protected]>
[ 56.597652][ T1784] ipmi setup fail, skip bmc-watchdog setup!
[ 56.597654][ T1784]
[ 70.766216][ C53] perf: interrupt took too long (2503 > 2500), lowering kernel.perf_event_max_sample_rate to 79000
[ 71.472045][ C36] perf: interrupt took too long (3159 > 3128), lowering kernel.perf_event_max_sample_rate to 63000
[ 78.970208][ T1101] XFS (ram0): xlog_verify_grant_tail: space > BBTOB(tail_blocks)
[ 79.201518][ T8249] XFS: Assertion failed: bp->b_transp == NULL, file: fs/xfs/xfs_trans_buf.c, line: 68
[ 79.211428][ T8249] ------------[ cut here ]------------
[ 79.217170][ T8249] kernel BUG at fs/xfs/xfs_message.c:110!
[ 79.223145][ T8249] invalid opcode: 0000 [#1] SMP NOPTI
[ 79.228753][ T8249] CPU: 80 PID: 8249 Comm: multitask Not tainted 5.17.0-rc1-00015-ge45ef9869b6a #1
[ 79.238192][ T8249] Hardware name: Intel Corporation CooperCity/CooperCity, BIOS WLYDCRB1.SYS.0016.P29.2006080250 06/08/2020
[ 79.249806][ T8249] RIP: 0010:assfail (kbuild/src/consumer/fs/xfs/./xfs_trace.h:247) xfs
[ 79.255364][ T8249] Code: 67 fc ff ff 0f 0b c3 0f 1f 44 00 00 41 89 c8 48 89 d1 48 89 f2 48 c7 c6 c0 40 58 c0 e8 82 f9 ff ff 80 3d a2 b4 0a 00 00 74 02 <0f> 0b 0f 0b c3 48 8d 45 10 48 89 e2 4c 89 e6 48 89 1c 24 48 89 44
All code
========
0: 67 fc addr32 cld
2: ff (bad)
3: ff 0f decl (%rdi)
5: 0b c3 or %ebx,%eax
7: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
c: 41 89 c8 mov %ecx,%r8d
f: 48 89 d1 mov %rdx,%rcx
12: 48 89 f2 mov %rsi,%rdx
15: 48 c7 c6 c0 40 58 c0 mov $0xffffffffc05840c0,%rsi
1c: e8 82 f9 ff ff callq 0xfffffffffffff9a3
21: 80 3d a2 b4 0a 00 00 cmpb $0x0,0xab4a2(%rip) # 0xab4ca
28: 74 02 je 0x2c
2a:* 0f 0b ud2 <-- trapping instruction
2c: 0f 0b ud2
2e: c3 retq
2f: 48 8d 45 10 lea 0x10(%rbp),%rax
33: 48 89 e2 mov %rsp,%rdx
36: 4c 89 e6 mov %r12,%rsi
39: 48 89 1c 24 mov %rbx,(%rsp)
3d: 48 rex.W
3e: 89 .byte 0x89
3f: 44 rex.R
Code starting with the faulting instruction
===========================================
0: 0f 0b ud2
2: 0f 0b ud2
4: c3 retq
5: 48 8d 45 10 lea 0x10(%rbp),%rax
9: 48 89 e2 mov %rsp,%rdx
c: 4c 89 e6 mov %r12,%rsi
f: 48 89 1c 24 mov %rbx,(%rsp)
13: 48 rex.W
14: 89 .byte 0x89
15: 44 rex.R
[ 79.275696][ T8249] RSP: 0018:ffffc90025493cc8 EFLAGS: 00010202
[ 79.282075][ T8249] RAX: 0000000000000000 RBX: ffff8881004fbc00 RCX: 0000000000000000
[ 79.290367][ T8249] RDX: 00000000ffffffc0 RSI: 000000000000000a RDI: ffffffffc057622a
[ 79.298667][ T8249] RBP: ffff88813a849220 R08: ffff88885fe9bb40 R09: 0000000000000000
[ 79.306973][ T8249] R10: 000000000000000a R11: f000000000000000 R12: ffff88813a849220
[ 79.315279][ T8249] R13: 0000000000000001 R14: ffffc90025493db8 R15: ffffffffc05673e0
[ 79.323577][ T8249] FS: 00007f931cd6b740(0000) GS:ffff88885fe80000(0000) knlGS:0000000000000000
[ 79.332830][ T8249] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 79.339749][ T8249] CR2: 00007f5d2d3f7a20 CR3: 00000002340de005 CR4: 00000000007706e0
[ 79.348068][ T8249] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 79.356391][ T8249] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 79.364718][ T8249] PKRU: 55555554
[ 79.368622][ T8249] Call Trace:
[ 79.372254][ T8249] <TASK>
[ 79.375525][ T8249] _xfs_trans_bjoin (kbuild/src/consumer/fs/xfs/xfs_trans_buf.c:68 (discriminator 1)) xfs
[ 79.381215][ T8249] xfs_trans_read_buf_map (kbuild/src/consumer/fs/xfs/xfs_trans_buf.c:311) xfs
[ 79.387507][ T8249] xfs_read_agi (kbuild/src/consumer/fs/xfs/xfs_trans.h:204 kbuild/src/consumer/fs/xfs/libxfs/xfs_ialloc.c:2584) xfs
[ 79.392827][ T8249] xfs_iunlink (kbuild/src/consumer/fs/xfs/xfs_inode.c:2172) xfs
To reproduce:
git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
sudo bin/lkp install job.yaml # job file is attached in this email
bin/lkp split-job --compatible job.yaml # generate the yaml file for lkp run
sudo bin/lkp run generated-yaml-file
# if come across any failure that blocks the test,
# please remove ~/.lkp and /lkp dir to run from a clean state.
---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/[email protected]
Thanks,
Oliver Sang