Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0f0b06f
adding ci files
mcgrof Jan 28, 2025
85546b0
module: Begin to move from RCU-sched to RCU.
Jan 8, 2025
fa89193
module: Use proper RCU assignment in add_kallsyms().
Jan 8, 2025
fc48e7d
module: Use RCU in find_kallsyms_symbol().
Jan 8, 2025
fa493cb
module: Use RCU in module_get_kallsym().
Jan 8, 2025
862a4e9
module: Use RCU in find_module_all().
Jan 8, 2025
da8322c
module: Use RCU in __find_kallsyms_symbol_value().
Jan 8, 2025
b8e1fff
module: Use RCU in module_kallsyms_on_each_symbol().
Jan 8, 2025
d4096c9
module: Remove module_assert_mutex_or_preempt() from try_add_tainted_…
Jan 8, 2025
1ab78a9
module: Use RCU in find_symbol().
Jan 8, 2025
2797927
module: Use RCU in __is_module_percpu_address().
Jan 8, 2025
a44cfd0
module: Allow __module_address() to be called from RCU section.
Jan 8, 2025
5387c73
module: Use RCU in search_module_extables().
Jan 8, 2025
bbb5c14
module: Use RCU in all users of __module_address().
Jan 8, 2025
4ff935a
module: Use RCU in all users of __module_text_address().
Jan 8, 2025
0c1e43a
ARM: module: Use RCU in all users of __module_text_address().
Jan 8, 2025
710213b
arm64: module: Use RCU in all users of __module_text_address().
Jan 8, 2025
f016e40
LoongArch/orc: Use RCU in all users of __module_address().
Jan 8, 2025
91fc8e2
LoongArch: ftrace: Use RCU in all users of __module_text_address().
Jan 8, 2025
8ad1cb4
powerpc/ftrace: Use RCU in all users of __module_text_address().
Jan 8, 2025
810c627
cfi: Use RCU while invoking __module_address().
Jan 8, 2025
e19dcdd
x86: Use RCU in all users of __module_address().
Jan 8, 2025
15084c2
jump_label: Use RCU in all users of __module_address().
Jan 8, 2025
24762a3
jump_label: Use RCU in all users of __module_text_address().
Jan 8, 2025
9bce666
bpf: Use RCU in all users of __module_text_address().
Jan 8, 2025
b93277f
kprobes: Use RCU in all users of __module_text_address().
Jan 8, 2025
c1c3fca
static_call: Use RCU in all users of __module_text_address().
Jan 8, 2025
b70703b
bug: Use RCU instead RCU-sched to protect module_bug_list.
Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/kdevops-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# SPDX-License-Identifier: GPL-2.0
#
# This can be used towards the end of your action. All tasks here run even if
# any of the previous tasks failed.

name: Kdevops cleanup workflow

on:
workflow_call: # Makes this workflow reusable

jobs:
cleanup:
name: Archive results and cleanup
runs-on: [self-hosted, Linux, X64]
steps:
- name: Set Linux kdevops development path
if: ${{ job.status != 'cancelled' }}
run: echo "LINUX_KDEVOPS_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV

- name: Get systemd journal files
if: ${{ job.status != 'cancelled' }}
run: |
if [[ ! -d kdevops ]]; then
exit 0
fi
cd kdevops
make journal-dump

- name: Start SSH Agent
if: ${{ job.status != 'cancelled' }}
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Build our kdevops archive results
if: ${{ job.status != 'cancelled' }}
run: |
if [[ ! -d kdevops ]]; then
exit 0
fi
cd kdevops
make ci-archive

- name: Upload our kdevops results archive
if: ${{ job.status != 'cancelled' }}
uses: actions/upload-artifact@v4
with:
name: kdevops-ci-results
path: ${{ env.LINUX_KDEVOPS_PATH }}/kdevops/archive/*.zip

- name: Run kdevops make destroy
if: always()
run: |
if [[ ! -d kdevops ]]; then
exit 0
fi
cd kdevops
make destroy
cd ..
rm -rf kdevops
37 changes: 37 additions & 0 deletions .github/workflows/kdevops-generic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SPDX-License-Identifier: GPL-2.0
#
# Most simple Linux kernel subsystems can be tested with this target
# test setup. For more elaborates tests look for a topic branch under the
# kdevops-ci tree. For example to test a filesystem look at the fstests
# branch.

name: Run generic kdevops CI tests

on:
push:
branches: ['**']
pull_request:
branches: ['**']
workflow_dispatch: # Allow manual triggering

jobs:
setup:
uses: ./.github/workflows/kdevops-init.yml
secrets: inherit

run-tests:
needs: setup
name: Run CI tests
runs-on: [self-hosted, Linux, X64]
steps:
- name: Run CI tests
run: |
cd kdevops
make ci-test
echo "ok" > ci.result

cleanup:
needs: [run-tests, setup] # Add setup as a dependency to ensure proper ordering
if: always() # This ensures cleanup runs even if run-tests fails
uses: ./.github/workflows/kdevops-cleanup.yml
secrets: inherit
187 changes: 187 additions & 0 deletions .github/workflows/kdevops-init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# SPDX-License-Identifier: GPL-2.0
#
# This can be used as a initialization workflow for most Linux kernel
# development environments. This takes care of:
#
# - Checks out and re-using a local mirror for your kernel tree
# - Looks for a defconfig in kdevops to use for your kernel tree
# - Sets up CI metadata for kdevops-results-archive
# - Ensures your kernel tree at least builds with defconfig
# - Brings up target DUTs nodes
# - Installs your Linux kernel tree on them
# - Builds all of your test requirements for your Linux kernel tree

name: Base kdevops workflow

on:
workflow_call: # Makes this workflow reusable
inputs:
kdevops_defconfig:
required: false
type: string

jobs:
setup:
name: Setup kdevops environment
runs-on: [self-hosted, Linux, X64]
steps:
- name: Verify we won't expect user input interactions on the host key
run: |
mkdir -p ~/.ssh
if ! grep -q "StrictHostKeyChecking no" ~/.ssh/config 2>/dev/null; then
echo "StrictHostKeyChecking no" >> ~/.ssh/config
fi

- name: Start SSH Agent for initial test
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

# Modify the repo here if you have a custom or private URL for the archive
# This can also just be a repo variable later.
- name: Verify our ssh connection will work
run: |
if ! git ls-remote git@github.com:linux-kdevops/kdevops-results-archive.git HEAD; then
echo "Cannot access kdevops-results-archive repository"
exit 1
fi

- name: Configure git
run: |
git config --global --add safe.directory '*'
git config --global user.name "kdevops"
git config --global user.email "kdevops@lists.linux.dev"

- name: Checkout kdevops
run: |
rm -rf kdevops
git clone /mirror/kdevops.git kdevops

- name: Make sure our repo kdevops defconfig exists
run: |
cd kdevops
if [[ -z "${{ inputs.kdevops_defconfig }}" ]]; then
KDEVOPS_DEFCONFIG=$(basename ${{ github.repository }})
else
KDEVOPS_DEFCONFIG="${{ inputs.kdevops_defconfig }}"
fi

if [[ ! -f defconfigs/$KDEVOPS_DEFCONFIG ]]; then
echo "kdevops lacks a defconfig for this repository, expected to find: defconfigs/$KDEVOPS_DEFCONFIG"
exit 1
fi

echo "KDEVOPS_DEFCONFIG=$KDEVOPS_DEFCONFIG" >> $GITHUB_ENV

- name: Checkout custom branch with delta on kdevops/linux
run: |
LINUX_TREE="https://github.com/${{ github.repository }}"
LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
cd kdevops
git clone $LINUX_TREE --reference /mirror/linux.git/ --depth=5 linux
cd linux
git fetch origin $LINUX_TREE_REF
git checkout $LINUX_TREE_REF
git log -1

- name: Initialize CI metadata for kdevops-results-archive for linux
run: |
cd kdevops/linux
echo "$(basename ${{ github.repository }})" > ../ci.trigger

# This supports using kdevops github actions using two different
# approaches:
#
# 1) Commit the .github/ directory onto a Linux tree before your
# kernel changes. This approach is used for example for
# testing patches posted on the mailing list with patchwork,
# this is the strategy kernel-patch-deaemon uses. Since the
# patches are ephemeral there is not important git history to
# maintain.
#
# 2) Merge the .github/ directory at the end of your development
# tree. This is useful for kernel developers wishing to test
# existing trees.
#
# So this checks to see if the last commit (top of the tree) *added*
# the .github directory. If the last commit added it, then we assume
# the commit prior to it was the one we'd like to document as the main
# test point.
if git diff-tree --no-commit-id --name-only --diff-filter=A -r HEAD | grep -q "^\.github/"; then
git log -2 --skip=1 --pretty=format:"%s" -1 > ../ci.subject
git describe --exact-match --tags HEAD^ 2>/dev/null || git rev-parse --short HEAD^ > ../ci.ref
else
git log -1 --pretty=format:"%s" > ../ci.subject
git describe --exact-match --tags HEAD 2>/dev/null || git rev-parse --short HEAD > ../ci.ref
fi

RELEVANT_GIT_TAG=$(cat ../ci.ref)
RELEVANT_GIT_REF=$(git rev-parse --short=12 $RELEVANT_GIT_TAG)

echo "LINUX_GIT_REF=$RELEVANT_GIT_REF" >> $GITHUB_ENV
echo "LINUX_GIT_TAG=$RELEVANT_GIT_TAG" >> $GITHUB_ENV

# Start out pessimistic
echo "unknown" > ../ci.result
echo "Nothing to write home about." > ../ci.commit_extra

- name: Run a quick Linux kernel defconfig build test
run: |
cd kdevops/linux
git reset --hard ${{ env.LINUX_GIT_TAG }}
make defconfig
make -j$(nproc)

- name: Run kdevops make defconfig-repo
run: |
LINUX_TREE="https://github.com/${{ github.repository }}"
LINUX_TREE_REF="${{ env.LINUX_GIT_TAG }}"

# We make the compromise here to use a relevant git tag for the
# host prefix so that folks can easily tell what exact kernel tree
# is being tested by using the relevant git ref. That is, if you
# pushed a tree with the .github/ directory as the top of the tree,
# that commit will not be used, we'll use the last one as that is
# the relevant git ref we want to annotate a test for.
#
# The compromise here we use special KDEVOPS to separete the
# commit ID and github.run_id. Exotic things likes UTF characters
# and dots have problems.
KDEVOPS_HOSTS_PREFIX="${{ env.LINUX_GIT_REF }}KDEVOPS${{ github.run_id }}"

echo "Going to use defconfig-${{ env.KDEVOPS_DEFCONFIG }}"

echo "Linux tree: $LINUX_TREE"
echo "Linux trigger ref: $LINUX_TREE_REF"
echo "Linux tag: ${{ env.LINUX_GIT_TAG }}"
echo "Runner ID: ${{ github.run_id }}"
echo "kdevops host prefix: $KDEVOPS_HOSTS_PREFIX"
echo "kdevops defconfig: defconfig-${{ env.KDEVOPS_DEFCONFIG }}"

KDEVOPS_ARGS="KDEVOPS_HOSTS_PREFIX=$KDEVOPS_HOSTS_PREFIX LINUX_TREE=$LINUX_TREE LINUX_TREE_REF=$LINUX_TREE_REF defconfig-${{ env.KDEVOPS_DEFCONFIG }}"
echo "Going to run:"
echo "make $KDEVOPS_ARGS"

cd kdevops
make $KDEVOPS_ARGS

- name: Run kdevops make
run: |
cd kdevops
make -j$(nproc)

- name: Run kdevops make bringup
run: |
cd kdevops
ls -ld linux
make bringup

- name: Build linux and boot test nodes on test kernel
run: |
cd kdevops
make linux

- name: Build required ci tests
run: |
cd kdevops
make ci-build-test
4 changes: 1 addition & 3 deletions arch/arm/kernel/module-plts.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,9 @@ bool in_module_plt(unsigned long loc)
struct module *mod;
bool ret;

preempt_disable();
guard(rcu)();
mod = __module_text_address(loc);
ret = mod && (loc - (u32)mod->arch.core.plt_ent < mod->arch.core.plt_count * PLT_ENT_SIZE ||
loc - (u32)mod->arch.init.plt_ent < mod->arch.init.plt_count * PLT_ENT_SIZE);
preempt_enable();

return ret;
}
7 changes: 3 additions & 4 deletions arch/arm64/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,13 @@ static bool ftrace_find_callable_addr(struct dyn_ftrace *rec,
* dealing with an out-of-range condition, we can assume it
* is due to a module being loaded far away from the kernel.
*
* NOTE: __module_text_address() must be called with preemption
* disabled, but we can rely on ftrace_lock to ensure that 'mod'
* NOTE: __module_text_address() must be called within a RCU read
* section, but we can rely on ftrace_lock to ensure that 'mod'
* retains its validity throughout the remainder of this code.
*/
if (!mod) {
preempt_disable();
guard(rcu)();
mod = __module_text_address(pc);
preempt_enable();
}

if (WARN_ON(!mod))
Expand Down
9 changes: 4 additions & 5 deletions arch/loongarch/kernel/ftrace_dyn.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ static bool ftrace_find_callable_addr(struct dyn_ftrace *rec, struct module *mod
* dealing with an out-of-range condition, we can assume it
* is due to a module being loaded far away from the kernel.
*
* NOTE: __module_text_address() must be called with preemption
* disabled, but we can rely on ftrace_lock to ensure that 'mod'
* NOTE: __module_text_address() must be called within a RCU read
* section, but we can rely on ftrace_lock to ensure that 'mod'
* retains its validity throughout the remainder of this code.
*/
if (!mod) {
preempt_disable();
mod = __module_text_address(pc);
preempt_enable();
scoped_guard(rcu)
mod = __module_text_address(pc);
}

if (WARN_ON(!mod))
Expand Down
4 changes: 1 addition & 3 deletions arch/loongarch/kernel/unwind_orc.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ bool unwind_next_frame(struct unwind_state *state)
return false;

/* Don't let modules unload while we're reading their ORC data. */
preempt_disable();
guard(rcu)();

if (is_entry_func(state->pc))
goto end;
Expand Down Expand Up @@ -514,14 +514,12 @@ bool unwind_next_frame(struct unwind_state *state)
if (!__kernel_text_address(state->pc))
goto err;

preempt_enable();
return true;

err:
state->error = true;

end:
preempt_enable();
state->stack_info.type = STACK_TYPE_UNKNOWN;
return false;
}
Expand Down
6 changes: 2 additions & 4 deletions arch/powerpc/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ static unsigned long ftrace_lookup_module_stub(unsigned long ip, unsigned long a
{
struct module *mod = NULL;

preempt_disable();
mod = __module_text_address(ip);
preempt_enable();

scoped_guard(rcu)
mod = __module_text_address(ip);
if (!mod)
pr_err("No module loaded at addr=%lx\n", ip);

Expand Down
6 changes: 2 additions & 4 deletions arch/powerpc/kernel/trace/ftrace_64_pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ static struct module *ftrace_lookup_module(struct dyn_ftrace *rec)
{
struct module *mod;

preempt_disable();
mod = __module_text_address(rec->ip);
preempt_enable();

scoped_guard(rcu)
mod = __module_text_address(rec->ip);
if (!mod)
pr_err("No module loaded at addr=%lx\n", rec->ip);

Expand Down
3 changes: 1 addition & 2 deletions arch/x86/kernel/callthunks.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ static inline bool within_module_coretext(void *addr)
#ifdef CONFIG_MODULES
struct module *mod;

preempt_disable();
guard(rcu)();
mod = __module_address((unsigned long)addr);
if (mod && within_module_core((unsigned long)addr, mod))
ret = true;
preempt_enable();
#endif
return ret;
}
Expand Down
Loading
Loading