Ryusuke Konishi
4b901256a7
nilfs2: add support for FS_IOC_GETFSLABEL
...
Implement support for FS_IOC_GETFSLABEL ioctl to read filesystem label.
Link: https://lkml.kernel.org/r/20240815074408.5550-4-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:34 -07:00
Ryusuke Konishi
8d1dba2e7c
nilfs2: add support for FS_IOC_GETFSSYSFSPATH
...
Use the standard helper super_set_sysfs_name_bdev() to give the sysfs
subpath of the filesystem for the FS_IOC_GETFSSYSFSPATH ioctl.
For nilfs2, it will output "nilfs2/<dev>".
Link: https://lkml.kernel.org/r/20240815074408.5550-3-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:34 -07:00
Ryusuke Konishi
ef851d44a8
nilfs2: add support for FS_IOC_GETUUID
...
Patch series "nilfs2: add support for some common ioctls".
This series adds support for common ioctls to nilfs2 for getting the
volume UUID and the relative path of an FS instance within the sysfs
namespace, and also implements ioctls for nilfs2 to get and set the volume
label.
This patch (of 2):
Expose the UUID of a file system instance using the super_set_uuid helper
and support the FS_IOC_GETUUID ioctl.
Link: https://lkml.kernel.org/r/20240815074408.5550-1-konishi.ryusuke@gmail.com
Link: https://lkml.kernel.org/r/20240815074408.5550-2-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:34 -07:00
Uros Bizjak
16d9691ad4
lib/percpu_counter: add missing __percpu qualifier to a cast
...
Add missing __percpu qualifier to a (void *) cast to fix
percpu_counter.c:212:36: warning: cast removes address space '__percpu' of expression
percpu_counter.c:212:33: warning: incorrect type in assignment (different address spaces)
percpu_counter.c:212:33: expected signed int [noderef] [usertype] __percpu *counters
percpu_counter.c:212:33: got void *
sparse warnings.
Found by GCC's named address space checks.
There were no changes in the resulting object file.
Link: https://lkml.kernel.org/r/20240814064437.940162-1-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Tejun Heo <tj@kernel.org >
Cc: Christoph Lameter <cl@linux.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:34 -07:00
Kuan-Wei Chiu
cbf164cd44
lib/bcd: optimize _bin2bcd() for improved performance
...
The original _bin2bcd() function used / 10 and % 10 operations for
conversion. Although GCC optimizes these operations and does not generate
division or modulus instructions, the new implementation reduces the
number of mov instructions in the generated code for both x86-64 and ARM
architectures.
This optimization calculates the tens digit using (val * 103) >> 10, which
is accurate for values of 'val' in the range [0, 178]. Given that the
valid input range is [0, 99], this method ensures correctness while
simplifying the generated code.
Link: https://lkml.kernel.org/r/20240812170229.229380-1-visitorckw@gmail.com
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com >
Cc: Ching-Chun (Jim) Huang <jserv@ccns.ncku.edu.tw >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:33 -07:00
Jani Nikula
ccbfd2df30
drm/xe: clean up fault injection usage
...
With the proper stubs in place in linux/fault-inject.h, we can remove a
bunch of conditional compilation for CONFIG_FAULT_INJECTION=n.
Link: https://lkml.kernel.org/r/20240813121237.2382534-3-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com >
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com >
Cc: Akinobu Mita <akinobu.mita@gmail.com >
Cc: Lucas De Marchi <lucas.demarchi@intel.com >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com >
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org >
Cc: Rob Clark <robdclark@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:33 -07:00
Jani Nikula
f161cdd91b
drm/msm: clean up fault injection usage
...
With the proper stubs in place in linux/fault-inject.h, we can remove a
bunch of conditional compilation for CONFIG_FAULT_INJECTION=n.
Link: https://lkml.kernel.org/r/20240813121237.2382534-2-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com >
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com >
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com >
Cc: Akinobu Mita <akinobu.mita@gmail.com >
Cc: Rob Clark <robdclark@gmail.com >
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org >
Cc: Lucas De Marchi <lucas.demarchi@intel.com >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:33 -07:00
Jani Nikula
6ce2082fd3
fault-inject: improve build for CONFIG_FAULT_INJECTION=n
...
The fault-inject.h users across the kernel need to add a lot of #ifdef
CONFIG_FAULT_INJECTION to cater for shortcomings in the header. Make
fault-inject.h self-contained for CONFIG_FAULT_INJECTION=n, and add stubs
for DECLARE_FAULT_ATTR(), setup_fault_attr(), should_fail_ex(), and
should_fail() to allow removal of conditional compilation.
[akpm@linux-foundation.org: repair fallout from no longer including debugfs.h into fault-inject.h]
[akpm@linux-foundation.org: fix drivers/misc/xilinx_tmr_inject.c]
[akpm@linux-foundation.org: Add debugfs.h inclusion to more files, per Stephen]
Link: https://lkml.kernel.org/r/20240813121237.2382534-1-jani.nikula@intel.com
Fixes: 6ff1cb355e ("[PATCH] fault-injection capabilities infrastructure")
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Cc: Akinobu Mita <akinobu.mita@gmail.com >
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com >
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org >
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com >
Cc: Lucas De Marchi <lucas.demarchi@intel.com >
Cc: Rob Clark <robdclark@gmail.com >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com >
Cc: Stephen Rothwell <sfr@canb.auug.org.au >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:33 -07:00
Davidlohr Bueso
a15bec6a8f
lib/rhashtable: cleanup fallback check in bucket_table_alloc()
...
Upon allocation failure, the current check with the nofail bits is
unnecessary, and further stands in the way of discouraging direct use of
__GFP_NOFAIL. Remove this and replace with the proper way of determining
if doing a non-blocking allocation for the nested table case.
Link: https://lkml.kernel.org/r/20240806153927.184515-1-dave@stgolabs.net
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net >
Suggested-by: Michal Hocko <mhocko@suse.com >
Cc: Davidlohr Bueso <dave@stgolabs.net >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:32 -07:00
Waiman Long
97cf8f5f93
watchdog: handle the ENODEV failure case of lockup_detector_delay_init() separately
...
When watchdog_hardlockup_probe() is being called by
lockup_detector_delay_init(), an error return of -ENODEV will happen
for the arm64 arch when arch_perf_nmi_is_available() returns false. This
means that NMI is not usable by the hard lockup detector and so has to
be disabled. This can be considered a deficiency in that particular
arm64 chip, but there is nothing we can do about it. That also means
the following error will always be reported when the kernel boot up.
watchdog: Delayed init of the lockup detector failed: -19
The word "failed" itself has a connotation that there is something
wrong with the kernel which is not really the case here. Handle this
special ENODEV case separately and explain the reason behind disabling
hard lockup detector without causing anxiety for those users who read
the above message and wonder about it.
Link: https://lkml.kernel.org/r/20240802151621.617244-1-longman@redhat.com
Signed-off-by: Waiman Long <longman@redhat.com >
Cc: Douglas Anderson <dianders@chromium.org >
Cc: Joel Granados <j.granados@samsung.com >
Cc: Li Zhe <lizhe.67@bytedance.com >
Cc: Petr Mladek <pmladek@suse.com >
Cc: Thomas Weißschuh <linux@weissschuh.net >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:32 -07:00
J. R. Okajima
e0ba72e3a4
lockdep: upper limit LOCKDEP_CHAINS_BITS
...
CONFIG_LOCKDEP_CHAINS_BITS value decides the size of chain_hlocks[] in
kernel/locking/lockdep.c, and it is checked by add_chain_cache() with
BUILD_BUG_ON((1UL << 24) <= ARRAY_SIZE(chain_hlocks));
This patch is just to silence BUILD_BUG_ON().
See also https://lore.kernel.org/all/30795.1620913191@jrobl/
[cmllamas@google.com: fix minor checkpatch issues in commit log]
Link: https://lkml.kernel.org/r/20240723164018.2489615-1-cmllamas@google.com
Signed-off-by: J. R. Okajima <hooanon05g@gmail.com >
Signed-off-by: Carlos Llamas <cmllamas@google.com >
Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Boqun Feng <boqun.feng@gmail.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Waiman Long <longman@redhat.com >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:32 -07:00
Breno Leitao
8af2caf730
failcmd: make failcmd.sh executable
...
Change the file permissions of tools/testing/fault-injection/failcmd.sh to
allow execution. This ensures the script can be run directly without
explicitly invoking a shell.
Link: https://lkml.kernel.org/r/20240729085215.3403417-1-leitao@debian.org
Signed-off-by: Breno Leitao <leitao@debian.org >
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:32 -07:00
Breno Leitao
11ee88a0f9
fault-injection: enhance failcmd to exit on non-hex address input
...
The failcmd.sh script in the fault-injection toolkit does not currently
validate whether the provided address is in hexadecimal format. This can
lead to silent failures if the address is sourced from places like
`/proc/kallsyms`, which omits the '0x' prefix, potentially causing users
to operate under incorrect assumptions.
Introduce a new function, `exit_if_not_hex`, which checks the format of
the provided address and exits with an error message if the address is not
a valid hexadecimal number.
This enhancement prevents users from running the command with improperly
formatted addresses, thus improving the robustness and usability of the
failcmd tool.
Link: https://lkml.kernel.org/r/20240729084512.3349928-1-leitao@debian.org
Signed-off-by: Breno Leitao <leitao@debian.org >
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:31 -07:00
Jeff Johnson
588661fd87
locking/ww_mutex/test: add MODULE_DESCRIPTION()
...
Fix the 'make W=1' warning:
WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/locking/test-ww_mutex.o
Link: https://lkml.kernel.org/r/20240730-module_description_orphans-v1-5-7094088076c8@quicinc.com
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com >
Acked-by: Waiman Long <longman@redhat.com >
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com >
Cc: Alistar Popple <alistair@popple.id.au >
Cc: Andrew Jeffery <andrew@codeconstruct.com.au >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Boqun Feng <boqun.feng@gmail.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Christophe Leroy <christophe.leroy@csgroup.eu >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Eddie James <eajames@linux.ibm.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jeremy Kerr <jk@ozlabs.org >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Karol Herbst <karolherbst@gmail.com >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Naveen N Rao <naveen@kernel.org >
Cc: Nicholas Piggin <npiggin@gmail.com >
Cc: Nouveau <nouveau@lists.freedesktop.org >
Cc: Pekka Paalanen <ppaalanen@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rafael J. Wysocki <rafael@kernel.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Steven Rostedt (Google) <rostedt@goodmis.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Viresh Kumar <viresh.kumar@linaro.org >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:31 -07:00
Jeff Johnson
fc5def2c2a
x86/mm: add testmmiotrace MODULE_DESCRIPTION()
...
Fix the following 'make W=1' warning:
WARNING: modpost: missing MODULE_DESCRIPTION() in arch/x86/mm/testmmiotrace.o
Link: https://lkml.kernel.org/r/20240730-module_description_orphans-v1-2-7094088076c8@quicinc.com
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com >
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com >
Cc: Alistar Popple <alistair@popple.id.au >
Cc: Andrew Jeffery <andrew@codeconstruct.com.au >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Boqun Feng <boqun.feng@gmail.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Christophe Leroy <christophe.leroy@csgroup.eu >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Eddie James <eajames@linux.ibm.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jeremy Kerr <jk@ozlabs.org >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Karol Herbst <karolherbst@gmail.com >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Naveen N Rao <naveen@kernel.org >
Cc: Nicholas Piggin <npiggin@gmail.com >
Cc: Nouveau <nouveau@lists.freedesktop.org >
Cc: Pekka Paalanen <ppaalanen@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rafael J. Wysocki <rafael@kernel.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Steven Rostedt (Google) <rostedt@goodmis.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Viresh Kumar <viresh.kumar@linaro.org >
Cc: Waiman Long <longman@redhat.com >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:31 -07:00
Jeff Johnson
f6fc302db0
crypto: arm/xor - add missing MODULE_DESCRIPTION() macro
...
Patch series "treewide: add missing MODULE_DESCRIPTION() macros".
Since commit 1fffe7a34c ("script: modpost: emit a warning when the
description is missing"), a module without a MODULE_DESCRIPTION() will
result in a warning when built with make W=1.
Recently, multiple developers have been eradicating these warnings
treewide, and I personally submitted almost 300 patches over the past few
months. Almost all of my patches landed by 6.11-rc1, either by being
merged in a 6.10-rc or by being merged in the 6.11 merge window. However,
a few of my patches did not land.
This patch (of 5):
With ARCH=arm and CONFIG_KERNEL_MODE_NEON=y, make W=1 C=1 reports:
WARNING: modpost: missing MODULE_DESCRIPTION() in arch/arm/lib/xor-neon.o
Add the missing invocation of the MODULE_DESCRIPTION() macro.
Link: https://lkml.kernel.org/r/20240730-module_description_orphans-v1-0-7094088076c8@quicinc.com
Link: https://lkml.kernel.org/r/20240730-module_description_orphans-v1-1-7094088076c8@quicinc.com
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com >
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com >
Cc: Alistar Popple <alistair@popple.id.au >
Cc: Andrew Jeffery <andrew@codeconstruct.com.au >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Boqun Feng <boqun.feng@gmail.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Christophe Leroy <christophe.leroy@csgroup.eu >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Eddie James <eajames@linux.ibm.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jeremy Kerr <jk@ozlabs.org >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Karol Herbst <karolherbst@gmail.com >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com >
Cc: Michael Ellerman <mpe@ellerman.id.au > (powerpc)
Cc: Naveen N Rao <naveen@kernel.org >
Cc: Nicholas Piggin <npiggin@gmail.com >
Cc: Nouveau <nouveau@lists.freedesktop.org >
Cc: Pekka Paalanen <ppaalanen@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rafael J. Wysocki <rafael@kernel.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Steven Rostedt (Google) <rostedt@goodmis.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Viresh Kumar <viresh.kumar@linaro.org >
Cc: Waiman Long <longman@redhat.com >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:31 -07:00
Breno Leitao
5b9da39dc5
failcmd: add script file in MAINTAINERS
...
failcmd is one of the main interfaces to fault injection framework, but,
it is not listed under FAULT INJECTION SUPPORT entry in MAINTAINERS. This
is unfortunate, since git-send-email doesn't find emails to send the
patches to, forcing the user to try to guess who maintains it.
Akinobu Mita seems to be actively maintaining it, so, let's add the file
under FAULT INJECTION SUPPORT section.
Link: https://lkml.kernel.org/r/20240730160814.1979876-1-leitao@debian.org
Signed-off-by: Breno Leitao <leitao@debian.org >
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:30 -07:00
Jinjie Ruan
59d58189f3
crash: fix crash memory reserve exceed system memory bug
...
On x86_32 Qemu machine with 1GB memory, the cmdline "crashkernel=4G" is ok
as below:
crashkernel reserved: 0x0000000020000000 - 0x0000000120000000 (4096 MB)
It's similar on other architectures, such as ARM32 and RISCV32.
The cause is that the crash_size is parsed and printed with "unsigned long
long" data type which is 8 bytes but allocated used with "phys_addr_t"
which is 4 bytes in memblock_phys_alloc_range().
Fix it by checking if crash_size is greater than system RAM size and
return error if so.
After this patch, there is no above confusing reserve success info.
Link: https://lkml.kernel.org/r/20240729115252.1659112-1-ruanjinjie@huawei.com
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com >
Suggested-by: Mike Rapoport <rppt@kernel.org >
Acked-by: Baoquan He <bhe@redhat.com >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Dave Young <dyoung@redhat.com >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Vivek Goyal <vgoyal@redhat.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:30 -07:00
Andrii Nakryiko
00bd8ec2f7
fs/procfs: remove build ID-related code duplication in PROCMAP_QUERY
...
A piece of build ID handling code in PROCMAP_QUERY ioctl() was
accidentally duplicated. It wasn't meant to be part of ed5d583a88
("fs/procfs: implement efficient VMA querying API for /proc/<pid>/maps")
commit, which is what introduced duplication.
It has no correctness implications, but we unnecessarily perform the same
work twice, if build ID parsing is requested. Drop the duplication.
Link: https://lkml.kernel.org/r/20240729174044.4008399-1-andrii@kernel.org
Fixes: ed5d583a88 ("fs/procfs: implement efficient VMA querying API for /proc/<pid>/maps")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Reported-by: Jann Horn <jannh@google.com >
Cc: Alexey Dobriyan <adobriyan@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:30 -07:00
Thorsten Blum
b6e21b7120
lib: checksum: use ARRAY_SIZE() to improve assert_setup_correct()
...
Use ARRAY_SIZE() to simplify the assert_setup_correct() function and
improve its readability.
Link: https://lkml.kernel.org/r/20240726154946.230928-1-thorsten.blum@toblux.com
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:30 -07:00
Deshan Zhang
9a42bfd255
lib/lru_cache: fix spelling mistake "colision"->"collision"
...
There is a spelling mistake in a literal string and in cariable names.
Fix these.
Link: https://lkml.kernel.org/r/20240725093044.1742842-1-deshan@nfschina.com
Signed-off-by: Deshan Zhang <deshan@nfschina.com >
Cc: Christoph Böhmwalder <christoph.boehmwalder@linbit.com >
Cc: Lars Ellenberg <lars.ellenberg@linbit.com >
Cc: Philipp Reisner <philipp.reisner@linbit.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:29 -07:00
Markus Elfring
fbe617af69
closures: use seq_putc() in debug_show()
...
A single line break should be put into a sequence. Thus use the
corresponding function "seq_putc".
This issue was transformed by using the Coccinelle software.
Link: https://lkml.kernel.org/r/e7faa2c4-9590-44b4-8669-69ef810277b1@web.de
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net >
Cc: Kent Overstreet <kent.overstreet@linux.dev >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:29 -07:00
Markus Elfring
7b76689a02
dyndbg: use seq_putc() in ddebug_proc_show()
...
Single characters should be put into a sequence. Thus use the
corresponding function "seq_putc".
This issue was transformed by using the Coccinelle software.
Link: https://lkml.kernel.org/r/375b5b4b-6295-419e-bae9-da724a7a682d@web.de
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net >
Cc: Jason Baron <jbaron@akamai.com >
Cc: Jim Cromie <jim.cromie@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:29 -07:00
Kuan-Ying Lee
0833952c07
scripts/gdb: add 'lx-kasan_mem_to_shadow' command
...
This command allows users to quickly translate memory address to the kasan
shadow memory address.
Example output:
(gdb) lx-kasan_mem_to_shadow 0xffff000019acc008
shadow addr: 0xffff600003359801
Link: https://lkml.kernel.org/r/20240723064902.124154-6-kuan-ying.lee@canonical.com
Signed-off-by: Kuan-Ying Lee <kuan-ying.lee@canonical.com >
Cc: Jan Kiszka <jan.kiszka@siemens.com >
Cc: Kieran Bingham <kbingham@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:29 -07:00
Kuan-Ying Lee
35249f68b5
scripts/gdb: add 'lx-stack_depot_lookup' command.
...
This command allows users to quickly retrieve a stacktrace using a handle
obtained from a memory coredump.
Example output:
(gdb) lx-stack_depot_lookup 0x00c80300
0xffff8000807965b4 <kmem_cache_alloc_noprof+660>: mov x20, x0
0xffff800081a077d8 <kmem_cache_oob_alloc+76>: mov x1, x0
0xffff800081a079a0 <test_version_show+100>: cbnz w0, 0xffff800081a07968 <test_version_show+44>
0xffff800082f4a3fc <kobj_attr_show+60>: ldr x19, [sp, #16 ]
0xffff800080a0fb34 <sysfs_kf_seq_show+460>: ldp x3, x4, [sp, #96 ]
0xffff800080a0a550 <kernfs_seq_show+296>: ldp x19, x20, [sp, #16 ]
0xffff8000808e7b40 <seq_read_iter+836>: mov w5, w0
0xffff800080a0b8ac <kernfs_fop_read_iter+804>: mov x23, x0
0xffff800080914a48 <copy_splice_read+972>: mov x6, x0
0xffff8000809151c4 <do_splice_read+348>: ldr x21, [sp, #32 ]
Link: https://lkml.kernel.org/r/20240723064902.124154-5-kuan-ying.lee@canonical.com
Signed-off-by: Kuan-Ying Lee <kuan-ying.lee@canonical.com >
Cc: Jan Kiszka <jan.kiszka@siemens.com >
Cc: Kieran Bingham <kbingham@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:28 -07:00
Kuan-Ying Lee
4b183f6139
scripts/gdb: fix lx-mounts command error
...
(gdb) lx-mounts
mount super_block devname pathname fstype options
Python Exception <class 'gdb.error'>: There is no member named list.
Error occurred in Python: There is no member named list.
We encounter the above issue after commit 2eea9ce431 ("mounts: keep
list of mounts in an rbtree"). The commit move a mount from list into
rbtree.
So we can instead use rbtree to iterate all mounts information.
Link: https://lkml.kernel.org/r/20240723064902.124154-4-kuan-ying.lee@canonical.com
Fixes: 2eea9ce431 ("mounts: keep list of mounts in an rbtree")
Signed-off-by: Kuan-Ying Lee <kuan-ying.lee@canonical.com >
Cc: Jan Kiszka <jan.kiszka@siemens.com >
Cc: Kieran Bingham <kbingham@kernel.org >
Cc: <stable@vger.kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:28 -07:00
Kuan-Ying Lee
0c77e103c4
scripts/gdb: add iteration function for rbtree
...
Add inorder iteration function for rbtree usage.
This is a preparation patch for the next patch to fix the gdb mounts
issue.
Link: https://lkml.kernel.org/r/20240723064902.124154-3-kuan-ying.lee@canonical.com
Fixes: 2eea9ce431 ("mounts: keep list of mounts in an rbtree")
Signed-off-by: Kuan-Ying Lee <kuan-ying.lee@canonical.com >
Cc: Jan Kiszka <jan.kiszka@siemens.com >
Cc: Kieran Bingham <kbingham@kernel.org >
Cc: <stable@vger.kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:28 -07:00
Kuan-Ying Lee
a633a4b800
scripts/gdb: fix timerlist parsing issue
...
Patch series "Fix some GDB command error and add some GDB commands", v3.
Fix some GDB command errors and add some useful GDB commands.
This patch (of 5):
Commit 7988e5ae2b ("tick: Split nohz and highres features from
nohz_mode") and commit 7988e5ae2b ("tick: Split nohz and highres
features from nohz_mode") move 'tick_stopped' and 'nohz_mode' to flags
field which will break the gdb lx-mounts command:
(gdb) lx-timerlist
Python Exception <class 'gdb.error'>: There is no member named nohz_mode.
Error occurred in Python: There is no member named nohz_mode.
(gdb) lx-timerlist
Python Exception <class 'gdb.error'>: There is no member named tick_stopped.
Error occurred in Python: There is no member named tick_stopped.
We move 'tick_stopped' and 'nohz_mode' to flags field instead.
Link: https://lkml.kernel.org/r/20240723064902.124154-1-kuan-ying.lee@canonical.com
Link: https://lkml.kernel.org/r/20240723064902.124154-2-kuan-ying.lee@canonical.com
Fixes: a478ffb2ae ("tick: Move individual bit features to debuggable mask accesses")
Fixes: 7988e5ae2b ("tick: Split nohz and highres features from nohz_mode")
Signed-off-by: Kuan-Ying Lee <kuan-ying.lee@canonical.com >
Cc: Jan Kiszka <jan.kiszka@siemens.com >
Cc: Kieran Bingham <kbingham@kernel.org >
Cc: <stable@vger.kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:28 -07:00
Julian Sun
d1c7848b58
scripts: add macro_checker script to check unused parameters in macros
...
Recently, I saw a patch[1] on the ext4 mailing list regarding
the correction of a macro definition error. Jan mentioned
that "The bug in the macro is a really nasty trap...".
Because existing compilers are unable to detect
unused parameters in macro definitions. This inspired me
to write a script to check for unused parameters in
macro definitions and to run it.
Surprisingly, the script uncovered numerous issues across
various subsystems, including filesystems, drivers, and sound etc.
Some of these issues involved parameters that were accepted
but never used, for example:
#define XFS_DAENTER_DBS(mp,w) \
(XFS_DA_NODE_MAXDEPTH + (((w) == XFS_DATA_FORK) ? 2 : 0))
where mp was unused.
While others are actual bugs.
For example:
#define HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(x) \
(ab->hw_params.regs->hal_seq_wcss_umac_ce0_src_reg)
#define HAL_SEQ_WCSS_UMAC_CE0_DST_REG(x) \
(ab->hw_params.regs->hal_seq_wcss_umac_ce0_dst_reg)
#define HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(x) \
(ab->hw_params.regs->hal_seq_wcss_umac_ce1_src_reg)
#define HAL_SEQ_WCSS_UMAC_CE1_DST_REG(x) \
(ab->hw_params.regs->hal_seq_wcss_umac_ce1_dst_reg)
where x was entirely unused, and instead, a local variable ab was used.
I have submitted patches[2-5] to fix some of these issues,
but due to the large number, many still remain unaddressed.
I believe that the kernel and matainers would benefit from
this script to check for unused parameters in macro definitions.
It should be noted that it may cause some false positives
in conditional compilation scenarios, such as
#ifdef DEBUG
static int debug(arg) {};
#else
#define debug(arg)
#endif
So the caller needs to manually verify whether it is a true
issue. But this should be fine, because Maintainers should only
need to review their own subsystems, which typically results
in only a few reports.
[1]: https://patchwork.ozlabs.org/project/linux-ext4/patch/1717652596-58760-1-git-send-email-carrionbent@linux.alibaba.com/
[2]: https://lore.kernel.org/linux-xfs/20240721112701.212342-1-sunjunchao2870@gmail.com/
[3]: https://lore.kernel.org/linux-bcachefs/20240721123943.246705-1-sunjunchao2870@gmail.com/
[4]: https://sourceforge.net/p/linux-f2fs/mailman/message/58797811/
[5]: https://sourceforge.net/p/linux-f2fs/mailman/message/58797812/
[sunjunchao2870@gmail.com: reduce false positives]
Link: https://lkml.kernel.org/r/20240726031310.254742-1-sunjunchao2870@gmail.com
Link: https://lkml.kernel.org/r/20240723091154.52458-1-sunjunchao2870@gmail.com
Signed-off-by: Julian Sun <sunjunchao2870@gmail.com >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Christian Brauner <brauner@kernel.org >
Cc: Darrick J. Wong <djwong@kernel.org >
Cc: Jan Kara <jack@suse.cz >
Cc: Junchao Sun <sunjunchao2870@gmail.com >
Cc: Kalle Valo <kvalo@kernel.org >
Cc: Masahiro Yamada <masahiroy@kernel.org >
Cc: Miguel Ojeda <ojeda@kernel.org >
Cc: Nicolas Schier <n.schier@avm.de >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:28 -07:00
Lasse Collin
c6f371bab2
xz: remove XZ_EXTERN and extern from functions
...
XZ_EXTERN was used to make internal functions static in the preboot code.
However, in other decompressors this hasn't been done. On x86-64, this
makes no difference to the kernel image size.
Omit XZ_EXTERN and let some of the internal functions be extern in the
preboot code. Omitting XZ_EXTERN from include/linux/xz.h fixes warnings
in "make htmldocs" and makes the intradocument links to xz_dec functions
work in Documentation/staging/xz.rst. The alternative would have been to
add "XZ_EXTERN" to c_id_attributes in Documentation/conf.py but omitting
XZ_EXTERN seemed cleaner.
Link: https://lore.kernel.org/lkml/20240723205437.3c0664b0@kaneli/
Link: https://lkml.kernel.org/r/20240724110544.16430-1-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Tested-by: Michael Ellerman <mpe@ellerman.id.au > (powerpc)
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Sam James <sam@gentoo.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:27 -07:00
Lasse Collin
ab4ce9831a
riscv: boot: add Image.xz support
...
The Image.* targets existed for other compressors already. Bootloader
support is needed for decompression.
This is for CONFIG_EFI_ZBOOT=n. With CONFIG_EFI_ZBOOT=y, XZ was already
available.
Comparision with Linux 6.10 RV64GC tinyconfig (in KiB):
1027 Image
594 Image.gz
541 Image.zst
510 Image.lzma
474 Image.xz
Link: https://lkml.kernel.org/r/20240721133633.47721-17-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Sam James <sam@gentoo.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:27 -07:00
Lasse Collin
181e71f662
arm64: boot: add Image.xz support
...
The Image.* targets existed for other compressors already. Bootloader
support is needed for decompression.
This is for CONFIG_EFI_ZBOOT=n. With CONFIG_EFI_ZBOOT=y, XZ was already
available.
Link: https://lkml.kernel.org/r/20240721133633.47721-16-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Will Deacon <will@kernel.org >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Sam James <sam@gentoo.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:27 -07:00
Lasse Collin
7472ff8ada
xz: adjust arch-specific options for better kernel compression
...
Use LZMA2 options that match the arch-specific alignment of instructions.
This change reduces compressed kernel size 0-2 % depending on the arch.
On 1-byte-aligned x86 it makes no difference and on 4-byte-aligned archs
it helps the most.
Use the ARM-Thumb filter for ARM-Thumb2 kernels. This reduces compressed
kernel size about 5 %.[1] Previously such kernels were compressed using
the ARM filter which didn't do anything useful with ARM-Thumb2 code.
Add BCJ filter support for ARM64 and RISC-V. Compared to unfiltered XZ or
plain LZMA, the compressed kernel size is reduced about 5 % on ARM64 and 7
% on RISC-V. A new enough version of the xz tool is required: 5.4.0 for
ARM64 and 5.6.0 for RISC-V. With an old xz version, a message is printed
to standard error and the kernel is compressed without the filter.
Update lib/decompress_unxz.c to match the changes to xz_wrap.sh.
Update the CONFIG_KERNEL_XZ help text in init/Kconfig:
- Add the RISC-V and ARM64 filters.
- Clarify that the PowerPC filter is for big endian only.
- Omit IA-64.
Link: https://lore.kernel.org/lkml/1637379771-39449-1-git-send-email-zhongjubin@huawei.com/ [1]
Link: https://lkml.kernel.org/r/20240721133633.47721-15-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Will Deacon <will@kernel.org >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:27 -07:00
Lasse Collin
8653c90992
xz: use 128 MiB dictionary and force single-threaded mode
...
This only affects kernel image compression, not any other xz usage.
Desktop kernels on x86-64 are already around 60 MiB. Using a dictionary
larger than 32 MiB should have no downsides nowadays as anyone building
the kernel should have plenty of RAM. 128 MiB dictionary needs 1346 MiB
of RAM with xz versions 5.0.x - 5.6.x in single-threaded mode. On archs
that use xz_wrap.sh, kernel decompression is done in single-call mode so a
larger dictionary doesn't affect boot-time memory requirements.
xz >= 5.6.0 uses multithreaded mode by default which compresses slightly
worse than single-threaded mode. Kernel compression rarely used more than
one thread anyway because with 32 MiB dictionary size the default block
size was 96 MiB in multithreaded mode. So only a single thread was used
anyway unless the kernel was over 96 MiB.
Comparison to CONFIG_KERNEL_LZMA: It uses "lzma -9" which mapped to 32 MiB
dictionary in LZMA Utils 4.32.7 (the final release in 2008). Nowadays the
lzma tool on most systems is from XZ Utils where -9 maps to 64 MiB
dictionary. So using a 32 MiB dictionary with CONFIG_KERNEL_XZ may have
compressed big kernels slightly worse than the old LZMA option.
Comparison to CONFIG_KERNEL_ZSTD: zstd uses 128 MiB dictionary.
Link: https://lkml.kernel.org/r/20240721133633.47721-14-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:26 -07:00
Lasse Collin
93d09773d1
xz: add RISC-V BCJ filter
...
A later commit updates lib/decompress_unxz.c to enable this filter for
kernel decompression. lib/decompress_unxz.c is already used if
CONFIG_EFI_ZBOOT=y && CONFIG_KERNEL_XZ=y.
This filter can be used by Squashfs without modifications to the Squashfs
kernel code (only needs support in userspace Squashfs-tools).
Link: https://lkml.kernel.org/r/20240721133633.47721-13-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:26 -07:00
Lasse Collin
4b62813f5e
xz: Add ARM64 BCJ filter
...
Also omit a duplicated check for XZ_DEC_ARM in xz_private.h.
A later commit updates lib/decompress_unxz.c to enable this filter for
kernel decompression. lib/decompress_unxz.c is already used if
CONFIG_EFI_ZBOOT=y && CONFIG_KERNEL_XZ=y.
This filter can be used by Squashfs without modifications to the Squashfs
kernel code (only needs support in userspace Squashfs-tools).
Link: https://lkml.kernel.org/r/20240721133633.47721-12-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:26 -07:00
Lasse Collin
bdfc041171
xz: optimize for-loop conditions in the BCJ decoders
...
Compilers cannot optimize the addition "i + 4" away since theoretically it
could overflow.
Link: https://lkml.kernel.org/r/20240721133633.47721-11-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:26 -07:00
Lasse Collin
2ee96abef2
xz: cleanup CRC32 edits from 2018
...
In 2018, a dependency on <linux/crc32poly.h> was added to avoid
duplicating the same constant in multiple files. Two months later it was
found to be a bad idea and the definition of CRC32_POLY_LE macro was moved
into xz_private.h to avoid including <linux/crc32poly.h>.
xz_private.h is a wrong place for it too. Revert back to the upstream
version which has the poly in xz_crc32_init() in xz_crc32.c.
Link: https://lkml.kernel.org/r/20240721133633.47721-10-lasse.collin@tukaani.org
Fixes: faa16bc404 ("lib: Use existing define with polynomial")
Fixes: 242cdad873 ("lib/xz: Put CRC32_POLY_LE in xz_private.h")
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Tested-by: Michael Ellerman <mpe@ellerman.id.au > (powerpc)
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:25 -07:00
Lasse Collin
6416724679
xz: Documentation/staging/xz.rst: Revise thoroughly
...
Add SPDX license identifier.
Omit xz_dec_test info. That isn't relevant to developers of non-XZ code.
Revise the docs about xzkern and add xzkern_with_size. The latter was
added to scripts/Makefile.lib in the commit 7ce7e984ab ("kbuild: rename
cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}").
Omit contact info as MAINTAINERS has it.
Omit other info that is outdated or not relevant in the kernel context.
Include the xz_dec kernel-doc from include/linux/xz.h.
Link: https://lkml.kernel.org/r/20240721133633.47721-8-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Reviewed-by: Randy Dunlap <rdunlap@infradead.org >
Tested-by: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:25 -07:00
Lasse Collin
0f2c599634
xz: improve the MicroLZMA kernel-doc in xz.h
...
Move the description of the format into a "DOC:" comment. Emphasize that
MicroLZMA functions aren't usually needed.
Link: https://lkml.kernel.org/r/20240721133633.47721-7-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:25 -07:00
Lasse Collin
ad8c67b870
xz: fix kernel-doc formatting errors in xz.h
...
The opaque structs xz_dec and xz_dec_microlzma are declared in xz.h but
their definitions are in xz_dec_lzma2.c without kernel-doc comments. Use
regular comments for these structs in xz.h to avoid errors when building
the docs.
Add a few missing colons.
Link: https://lkml.kernel.org/r/20240721133633.47721-6-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:25 -07:00
Lasse Collin
ff221153aa
xz: fix comments and coding style
...
- Fix comments that were no longer in sync with the code below them.
- Fix language errors.
- Fix coding style.
Link: https://lkml.kernel.org/r/20240721133633.47721-5-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:24 -07:00
Lasse Collin
836d13a6ef
xz: switch from public domain to BSD Zero Clause License (0BSD)
...
Remove the public domain notices and add SPDX license identifiers.
Change MODULE_LICENSE from "GPL" to "Dual BSD/GPL" because 0BSD should
count as a BSD license variant here.
The switch to 0BSD was done in the upstream XZ Embedded project because
public domain has (real or perceived) legal issues in some jurisdictions.
Link: https://lkml.kernel.org/r/20240721133633.47721-4-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:24 -07:00
Lasse Collin
c1ccbbaa76
LICENSES: add 0BSD license text
...
The license text was copied from:
https://spdx.org/licenses/0BSD.html
Link: https://lkml.kernel.org/r/20240721133633.47721-3-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:24 -07:00
Lasse Collin
22be8e6b13
MAINTAINERS: add XZ Embedded maintainer
...
Patch series "xz: Updates to license, filters, and compression options",
v2.
XZ Embedded, the upstream project, switched from public domain to the BSD
Zero Clause License (0BSD). Now matching SPDX license identifiers can be
added.
Documentation was revised. Fix syntax errors in kernel-doc comments in
<linux/xz.h>. The xz_dec API docs from <linux/xz.h> are now included in
Documentation/staging/xz.rst.
The new ARM64 and RISC-V filters can be used for kernel decompression if
CONFIG_EFI_ZBOOT=y. The filters can be used by Squashfs too. (Userspace
Squashfs-tools already had the ARM64 filter support committed but it was
reverted due to backdoor fears. I try to get ARM64 and RISC-V filter
support added to Squashfs-tools somewhat soon.)
Account for the default threading change made in the xz command line tool
version 5.6.0. Tweak kernel compression options for archs that support XZ
compressed kernel.
This patch (of 16):
I have been the maintainer of the upstream project since I submitted the
code to Linux in 2010 but I forgot to add myself to MAINTAINERS.
Link: https://lkml.kernel.org/r/20240721133633.47721-1-lasse.collin@tukaani.org
Link: https://lkml.kernel.org/r/20240721133633.47721-2-lasse.collin@tukaani.org
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org >
Reviewed-by: Sam James <sam@gentoo.org >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: Joel Stanley <joel@jms.id.au >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Jubin Zhong <zhongjubin@huawei.com >
Cc: Jules Maselbas <jmaselbas@zdiv.net >
Cc: Krzysztof Kozlowski <krzk@kernel.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Rui Li <me@lirui.org >
Cc: Simon Glass <sjg@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:24 -07:00
Heming Zhao
dfe6c5692f
ocfs2: fix the la space leak when unmounting an ocfs2 volume
...
This bug has existed since the initial OCFS2 code. The code logic in
ocfs2_sync_local_to_main() is wrong, as it ignores the last contiguous
free bits, which causes an OCFS2 volume to lose the last free clusters of
LA window on each umount command.
Link: https://lkml.kernel.org/r/20240719114310.14245-1-heming.zhao@suse.com
Signed-off-by: Heming Zhao <heming.zhao@suse.com >
Reviewed-by: Su Yue <glass.su@suse.com >
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Mark Fasheh <mark@fasheh.com >
Cc: Joel Becker <jlbec@evilplan.org >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Changwei Ge <gechangwei@live.cn >
Cc: Gang He <ghe@suse.com >
Cc: Jun Piao <piaojun@huawei.com >
Cc: Heming Zhao <heming.zhao@suse.com >
Cc: <stable@vger.kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:23 -07:00
Uros Bizjak
acf02be3c7
kexec: use atomic_try_cmpxchg_acquire() in kexec_trylock()
...
Use atomic_try_cmpxchg_acquire(*ptr, &old, new) instead of
atomic_cmpxchg_acquire(*ptr, old, new) == old in kexec_trylock().
x86 CMPXCHG instruction returns success in ZF flag, so
this change saves a compare after cmpxchg.
Link: https://lkml.kernel.org/r/20240719103937.53742-1-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com >
Acked-by: Baoquan He <bhe@redhat.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:23 -07:00
Andrey Konovalov
e24f4de8a7
kcov: don't instrument lib/find_bit.c
...
This file produces large amounts of flaky coverage not useful for the
KCOV's intended use case (guiding the fuzzing process).
Link: https://lkml.kernel.org/r/20240722223726.194658-1-andrey.konovalov@linux.dev
Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com >
Reviewed-by: Dmitry Vyukov <dvyukov@google.com >
Cc: Aleksandr Nogikh <nogikh@google.com >
Cc: Alexander Potapenko <glider@google.com >
Cc: Marco Elver <elver@google.com >
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Cc: Yury Norov <yury.norov@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:23 -07:00
Jeff Johnson
053a5e4cbb
lib: test_objpool: add missing MODULE_DESCRIPTION() macro
...
make allmodconfig && make W=1 C=1 reports:
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_objpool.o
Add the missing invocation of the MODULE_DESCRIPTION() macro.
Link: https://lkml.kernel.org/r/20240715-md-lib-test_objpool-v2-1-5a2b9369c37e@quicinc.com
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com >
Reviewed-by: Matt Wu <wuqiang.matt@bytedance.com >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:23 -07:00
Nicolas Pitre
1635e62e75
mul_u64_u64_div_u64: basic sanity test
...
Verify that edge cases produce proper results, and some more.
[npitre@baylibre.com: avoid undefined shift value]
Link: https://lkml.kernel.org/r/7rrs9pn1-n266-3013-9q6n-1osp8r8s0rrn@syhkavp.arg
Link: https://lkml.kernel.org/r/20240707190648.1982714-3-nico@fluxnic.net
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com >
Cc: Biju Das <biju.das.jz@bp.renesas.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-09-01 20:43:22 -07:00