tracing: Avoid possible softlockup in tracing_iter_reset()
Zheng Yejian authored
In __tracing_open(), when max latency tracers took place on the cpu,
the time start of its buffer would be updated, then event entries with
timestamps being earlier than start of the buffer would be skipped
(see tracing_iter_reset()).

Softlockup will occur if the kernel is non-preemptible and too many
entries were skipped in the loop that reset every cpu buffer, so add
cond_resched() to avoid it.

Cc: stable@vger.kernel.org
Fixes: 2f26ebd5 ("tracing: use timestamp to determine start of latency traces")
Link: https://lore.kernel.org/20240827124654.3817443-1-zhengyejian@huaweicloud.com

Suggested-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarZheng Yejian <zhengyejian@huaweicloud.com>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
49aa8a1f
Name Last commit Last update
Documentation Merge tag 'powerpc-6.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
LICENSES LICENSES: Add the copyleft-next-0.3.1 license
arch Merge tag 'driver-core-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
block block: Fix lockdep warning in blk_mq_mark_tag_wait
certs kbuild: use $(src) instead of $(srctree)/$(src) for source directory
crypto crypto: testmgr - generate power-of-2 lengths more often
drivers Merge tag 'char-misc-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
fs Merge tag 'for-6.11-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
include Merge tag 'char-misc-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
init Merge tag 'rust-fixes-6.11' of https://github.com/Rust-for-Linux/linux
io_uring io_uring/sqpoll: annotate debug task == current with data_race()
ipc sysctl: treewide: constify the ctl_table argument of proc_handlers
kernel tracing: Avoid possible softlockup in tracing_iter_reset()
lib Merge tag 'bcachefs-2024-08-16' of git://evilpiepirate.org/bcachefs
mm Merge tag 'mm-hotfixes-stable-2024-08-17-19-34' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
net Merge tag 'net-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
rust Merge tag 'rust-fixes-6.11' of https://github.com/Rust-for-Linux/linux
samples Merge tag 'driver-core-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
scripts Merge tag 'rust-fixes-6.11' of https://github.com/Rust-for-Linux/linux
security KEYS: trusted: dcp: fix leak of blob encryption key
sound ALSA: hda/tas2781: Use correct endian conversion
tools Merge tag 'mm-hotfixes-stable-2024-08-17-19-34' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
usr initramfs: shorten cmd_initfs in usr/Makefile
virt KVM: x86: Disallow read-only memslots for SEV-ES and SEV-SNP (and TDX)
.clang-format Docs: Move clang-format from process/ to dev-tools/
.cocciconfig
.editorconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the reStructuredText markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.