Skip to content

[PW_SID:995384] Drivers: hv: Fix NEED_RESCHED_LAZY and use common APIs - #835

Closed
linux-riscv-bot wants to merge 5 commits into
workflow__riscv__fixesfrom
pw995384
Closed

[PW_SID:995384] Drivers: hv: Fix NEED_RESCHED_LAZY and use common APIs#835
linux-riscv-bot wants to merge 5 commits into
workflow__riscv__fixesfrom
pw995384

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 995384 applied to workflow__riscv__fixes

Name: Drivers: hv: Fix NEED_RESCHED_LAZY and use common APIs
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=995384
Version: 1

Move the root partition's handling of pending thread work fully into
mshv_common.c so that the "work pending" and "do work" code is co-located.
Splitting the flags-to-check logic makes the code unnnecessarily difficult
to maintain, e.g. it would be all too easy to add a check in "do work" but
not in "work pending", and vice versa.

Note, this adds an extra CALL+RET when no work is pending; that will be
remedied in the near feature by switching to common virtualization entry
APIs.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Check for NEED_RESCHED_LAZY, not just NEED_RESCHED, prior to transferring
control to a guest.  Failure to check for lazy resched can unnecessarily
delay rescheduling until the next tick when using a lazy preemption model.

Fixes: 621191d ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…oper

Move KVM's morphing of pending signals into userspace exits into KVM
proper, and drop the @vcpu param from xfer_to_guest_mode_handle_work().
How KVM responds to -EINTR is a detail that really belongs in KVM itself,
and invoking kvm_handle_signal_exit() from kernel code creates an inverted
module dependency.  E.g. attempting to move kvm_handle_signal_exit() into
kvm_main.c would generate an linker error when building kvm.ko as a module.

Dropping KVM details will also converting the KVM "entry" code into a more
generic virtualization framework so that it can be used when running as a
Hyper-V root partition.

Lastly, eliminating usage of "struct kvm_vcpu" outside of KVM is also nice
to have for KVM x86 developers, as keeping the details of kvm_vcpu purely
within KVM allows changing the layout of the structure without having to
boot into a new kernel, e.g. allows rebuilding and reloading kvm.ko with a
modified kvm_vcpu structure as part of debug/development.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Rename the "kvm" entry code files and Kconfigs to use generic "virt"
nomenclature so that the code can be reused by other hypervisors (or
rather, their root/dom0 partition drivers), without incorrectly suggesting
the code somehow relies on and/or involves KVM.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…uest

Use the kernel's common "entry virt" APIs to handle pending work prior to
(re)entering guest mode, now that the virt APIs don't have a superfluous
dependency on KVM.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 103.07 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1024.79 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1317.19 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.94 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.47 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 2.01 seconds
Result: WARNING
Output:

CHECK: Blank lines aren't necessary before a close brace '}'
#77: FILE: drivers/hv/mshv_common.c:183:
+
+}

total: 0 errors, 0 warnings, 1 checks, 77 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 83c45097d8ec ("Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 1 checks, 77 lines checked
CHECK: Blank lines aren't necessary before a close brace '}'


@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 74.60 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
kdoc
Desc: Detects for kdoc errors
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/5] Drivers: hv: Move TIF pre-guest work handling fully into mshv_common.c"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.60 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 102.13 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1024.62 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1317.36 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.69 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.50 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.73 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 73.74 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
kdoc
Desc: Detects for kdoc errors
Duration: 0.83 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/5] Drivers: hv: Handle NEED_RESCHED_LAZY before transferring to guest"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/5] entry/kvm: KVM: Move KVM details related to signal/-EINTR into KVM proper"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 102.66 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/5] entry/kvm: KVM: Move KVM details related to signal/-EINTR into KVM proper"
kdoc
Desc: Detects for kdoc errors
Duration: 0.99 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/5] entry/kvm: KVM: Move KVM details related to signal/-EINTR into KVM proper"
module-param
Desc: Detect module_param changes
Duration: 0.33 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/5] entry/kvm: KVM: Move KVM details related to signal/-EINTR into KVM proper"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/5] entry/kvm: KVM: Move KVM details related to signal/-EINTR into KVM proper"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 103.13 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1728.40 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2147.42 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.46 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.83 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 3.59 seconds
Result: WARNING
Output:

WARNING: line length of 110 exceeds 100 columns
#171: FILE: include/linux/rcupdate.h:132:
+#if defined(CONFIG_NO_HZ_FULL) && (!defined(CONFIG_GENERIC_ENTRY) || !defined(CONFIG_VIRT_XFER_TO_GUEST_WORK))

WARNING: line length of 110 exceeds 100 columns
#209: FILE: kernel/rcu/tree.c:576:
+#if defined(CONFIG_NO_HZ_FULL) && (!defined(CONFIG_GENERIC_ENTRY) || !defined(CONFIG_VIRT_XFER_TO_GUEST_WORK))

WARNING: line length of 123 exceeds 100 columns
#227: FILE: kernel/rcu/tree.c:614:
+#endif /* #if defined(CONFIG_NO_HZ_FULL) && (!defined(CONFIG_GENERIC_ENTRY) || !defined(CONFIG_VIRT_XFER_TO_GUEST_WORK)) */

total: 0 errors, 3 warnings, 0 checks, 139 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 03262359e2e7 ("entry: Rename "kvm" entry code assets to "virt" to genericize APIs") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 3 warnings, 0 checks, 139 lines checked
WARNING: line length of 110 exceeds 100 columns
WARNING: line length of 123 exceeds 100 columns


@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 74.05 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
kdoc
Desc: Detects for kdoc errors
Duration: 0.98 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
module-param
Desc: Detect module_param changes
Duration: 0.37 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/5] entry: Rename "kvm" entry code assets to "virt" to genericize APIs"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 102.66 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1036.68 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1325.80 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.94 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.97 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.30 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 74.89 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
kdoc
Desc: Detects for kdoc errors
Duration: 0.84 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/5] Drivers: hv: Use common "entry virt" APIs to do work before running guest"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot
linux-riscv-bot deleted the pw995384 branch August 27, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants