| Message ID | 20260228005355.823048-3-xujiakai2025@iscas.ac.cn |
|---|---|
| State | Superseded |
| Headers | show |
| Series | RISC-V: KVM: Validate SBI STA shmem alignment | expand |
Hi Jiakai,
kernel test robot noticed the following build warnings:
[auto build test WARNING on v6.19]
[cannot apply to kvm/queue kvm/next linus/master kvm/linux-next v7.0-rc1 next-20260227]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jiakai-Xu/RISC-V-KVM-Validate-SBI-STA-shmem-alignment-in-kvm_sbi_ext_sta_set_reg/20260228-085648
base: v6.19
patch link: https://lore.kernel.org/r/20260228005355.823048-3-xujiakai2025%40iscas.ac.cn
patch subject: [PATCH v9 2/3] KVM: selftests: Refactor UAPI tests into dedicated function
config: arm64-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260228/202602280523.Y5Q8Pdft-lkp@intel.com/config)
compiler: aarch64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260228/202602280523.Y5Q8Pdft-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602280523.Y5Q8Pdft-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> steal_time.c:207:13: warning: function declaration isn't a prototype [-Wstrict-prototypes]
207 | static void check_steal_time_uapi()
| ^~~~~~~~~~~~~~~~~~~~~
cc1: note: unrecognized command-line option '-Wno-gnu-variable-sized-type-not-at-end' may have been intended to silence earlier diagnostics
Hi all, I received a notification from the kernel test robot regarding my patch. It indicates that void check_steal_time_uapi() should be changed to void check_steal_time_uapi(void) to avoid a compiler warning. I would like to wait for the reviewers’ feedback on this patch. If there are no issues aside from this warning, I will submit the final version addressing the compiler warning. If there are other suggestions, I will incorporate them accordingly. Thanks, Jiakai "kernel test robot" <lkp@intel.com>写道: > Hi Jiakai, > > kernel test robot noticed the following build warnings: > > [auto build test WARNING on v6.19] > [cannot apply to kvm/queue kvm/next linus/master kvm/linux-next v7.0-rc1 next-20260227] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Jiakai-Xu/RISC-V-KVM-Validate-SBI-STA-shmem-alignment-in-kvm_sbi_ext_sta_set_reg/20260228-085648 > base: v6.19 > patch link: https://lore.kernel.org/r/20260228005355.823048-3-xujiakai2025%40iscas.ac.cn > patch subject: [PATCH v9 2/3] KVM: selftests: Refactor UAPI tests into dedicated function > config: arm64-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260228/202602280523.Y5Q8Pdft-lkp@intel.com/config) > compiler: aarch64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260228/202602280523.Y5Q8Pdft-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202602280523.Y5Q8Pdft-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > > >> steal_time.c:207:13: warning: function declaration isn't a prototype [-Wstrict-prototypes] > 207 | static void check_steal_time_uapi() > | ^~~~~~~~~~~~~~~~~~~~~ > cc1: note: unrecognized command-line option '-Wno-gnu-variable-sized-type-not-at-end' may have been intended to silence earlier diagnostics > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki
On Sat, Feb 28, 2026 at 12:53:54AM +0000, Jiakai Xu wrote: > Move steal time UAPI tests from steal_time_init() into a separate > check_steal_time_uapi() function for better code organization and > maintainability. > > Previously, x86 and ARM64 architectures performed UAPI validation > tests within steal_time_init(), mixing initialization logic with > uapi tests. > > Changes by architecture: > x86_64: > - Extract MSR reserved bits test from steal_time_init() > - Move to check_steal_time_uapi() which tests that setting > MSR_KVM_STEAL_TIME with KVM_STEAL_RESERVED_MASK fails > ARM64: > - Extract three UAPI tests from steal_time_init(): > Device attribute support check > Misaligned IPA rejection (EINVAL) > Duplicate IPA setting rejection (EEXIST) > - Move all tests to check_steal_time_uapi() > RISC-V: > - Add empty check_steal_time_uapi() stub for future use > - No changes to steal_time_init() (had no tests to extract) > > The new check_steal_time_uapi() function: > - Is called once before the per-VCPU test loop > > No functional change intended. > > Suggested-by: Andrew Jones <andrew.jones@oss.qualcomm.com> > Signed-off-by: Jiakai Xu <xujiakai2025@iscas.ac.cn> > Signed-off-by: Jiakai Xu <jiakaiPeanut@gmail.com> > --- > V8 -> V9: Created a temporary VM with one vCPU in > check_steal_time_uapi() instead of adding extra vCPUs to the > main VM. > Made check_steal_time_uapi() parameterless for all architectures. > V7 -> V8: Used ST_GPA_BASE directly instead of > st_gva[]/sync_global_to_guest() in x86_64 and ARM64 > check_steal_time_uapi(). > Created a temporary vcpu in ARM64 check_steal_time_uapi() to > avoid EEXIST when steal_time_init() later sets IPA for vcpu[0]. > Removed unnecessary comment in RISC-V check_steal_time_uapi(). > --- > tools/testing/selftests/kvm/steal_time.c | 67 ++++++++++++++++++------ > 1 file changed, 51 insertions(+), 16 deletions(-) Reviewed-by: Andrew Jones <andrew.jones@oss.qualcomm.com>
diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c index 8edc1fca345ba..75ad067f27260 100644 --- a/tools/testing/selftests/kvm/steal_time.c +++ b/tools/testing/selftests/kvm/steal_time.c @@ -69,16 +69,10 @@ static bool is_steal_time_supported(struct kvm_vcpu *vcpu) static void steal_time_init(struct kvm_vcpu *vcpu, uint32_t i) { - int ret; - /* ST_GPA_BASE is identity mapped */ st_gva[i] = (void *)(ST_GPA_BASE + i * STEAL_TIME_SIZE); sync_global_to_guest(vcpu->vm, st_gva[i]); - ret = _vcpu_set_msr(vcpu, MSR_KVM_STEAL_TIME, - (ulong)st_gva[i] | KVM_STEAL_RESERVED_MASK); - TEST_ASSERT(ret == 0, "Bad GPA didn't fail"); - vcpu_set_msr(vcpu, MSR_KVM_STEAL_TIME, (ulong)st_gva[i] | KVM_MSR_ENABLED); } @@ -99,6 +93,21 @@ static void steal_time_dump(struct kvm_vm *vm, uint32_t vcpu_idx) st->pad[8], st->pad[9], st->pad[10]); } +static void check_steal_time_uapi() +{ + struct kvm_vm *vm; + struct kvm_vcpu *vcpu; + int ret; + + vm = vm_create_with_one_vcpu(&vcpu, NULL); + + ret = _vcpu_set_msr(vcpu, MSR_KVM_STEAL_TIME, + (ulong)ST_GPA_BASE | KVM_STEAL_RESERVED_MASK); + TEST_ASSERT(ret == 0, "Bad GPA didn't fail"); + + kvm_vm_free(vm); +} + #elif defined(__aarch64__) /* PV_TIME_ST must have 64-byte alignment */ @@ -170,7 +179,6 @@ static void steal_time_init(struct kvm_vcpu *vcpu, uint32_t i) { struct kvm_vm *vm = vcpu->vm; uint64_t st_ipa; - int ret; struct kvm_device_attr dev = { .group = KVM_ARM_VCPU_PVTIME_CTRL, @@ -178,21 +186,12 @@ static void steal_time_init(struct kvm_vcpu *vcpu, uint32_t i) .addr = (uint64_t)&st_ipa, }; - vcpu_ioctl(vcpu, KVM_HAS_DEVICE_ATTR, &dev); - /* ST_GPA_BASE is identity mapped */ st_gva[i] = (void *)(ST_GPA_BASE + i * STEAL_TIME_SIZE); sync_global_to_guest(vm, st_gva[i]); - st_ipa = (ulong)st_gva[i] | 1; - ret = __vcpu_ioctl(vcpu, KVM_SET_DEVICE_ATTR, &dev); - TEST_ASSERT(ret == -1 && errno == EINVAL, "Bad IPA didn't report EINVAL"); - st_ipa = (ulong)st_gva[i]; vcpu_ioctl(vcpu, KVM_SET_DEVICE_ATTR, &dev); - - ret = __vcpu_ioctl(vcpu, KVM_SET_DEVICE_ATTR, &dev); - TEST_ASSERT(ret == -1 && errno == EEXIST, "Set IPA twice without EEXIST"); } static void steal_time_dump(struct kvm_vm *vm, uint32_t vcpu_idx) @@ -205,6 +204,36 @@ static void steal_time_dump(struct kvm_vm *vm, uint32_t vcpu_idx) ksft_print_msg(" st_time: %ld\n", st->st_time); } +static void check_steal_time_uapi() +{ + struct kvm_vm *vm; + struct kvm_vcpu *vcpu; + uint64_t st_ipa; + int ret; + + vm = vm_create_with_one_vcpu(&vcpu, NULL); + + struct kvm_device_attr dev = { + .group = KVM_ARM_VCPU_PVTIME_CTRL, + .attr = KVM_ARM_VCPU_PVTIME_IPA, + .addr = (uint64_t)&st_ipa, + }; + + vcpu_ioctl(vcpu, KVM_HAS_DEVICE_ATTR, &dev); + + st_ipa = (ulong)ST_GPA_BASE | 1; + ret = __vcpu_ioctl(vcpu, KVM_SET_DEVICE_ATTR, &dev); + TEST_ASSERT(ret == -1 && errno == EINVAL, "Bad IPA didn't report EINVAL"); + + st_ipa = (ulong)ST_GPA_BASE; + vcpu_ioctl(vcpu, KVM_SET_DEVICE_ATTR, &dev); + + ret = __vcpu_ioctl(vcpu, KVM_SET_DEVICE_ATTR, &dev); + TEST_ASSERT(ret == -1 && errno == EEXIST, "Set IPA twice without EEXIST"); + + kvm_vm_free(vm); +} + #elif defined(__riscv) /* SBI STA shmem must have 64-byte alignment */ @@ -301,6 +330,10 @@ static void steal_time_dump(struct kvm_vm *vm, uint32_t vcpu_idx) pr_info("\n"); } +static void check_steal_time_uapi() +{ +} + #endif static void *do_steal_time(void *arg) @@ -369,6 +402,8 @@ int main(int ac, char **av) TEST_REQUIRE(is_steal_time_supported(vcpus[0])); ksft_set_plan(NR_VCPUS); + check_steal_time_uapi(); + /* Run test on each VCPU */ for (i = 0; i < NR_VCPUS; ++i) { steal_time_init(vcpus[i], i);
Move steal time UAPI tests from steal_time_init() into a separate check_steal_time_uapi() function for better code organization and maintainability. Previously, x86 and ARM64 architectures performed UAPI validation tests within steal_time_init(), mixing initialization logic with uapi tests. Changes by architecture: x86_64: - Extract MSR reserved bits test from steal_time_init() - Move to check_steal_time_uapi() which tests that setting MSR_KVM_STEAL_TIME with KVM_STEAL_RESERVED_MASK fails ARM64: - Extract three UAPI tests from steal_time_init(): Device attribute support check Misaligned IPA rejection (EINVAL) Duplicate IPA setting rejection (EEXIST) - Move all tests to check_steal_time_uapi() RISC-V: - Add empty check_steal_time_uapi() stub for future use - No changes to steal_time_init() (had no tests to extract) The new check_steal_time_uapi() function: - Is called once before the per-VCPU test loop No functional change intended. Suggested-by: Andrew Jones <andrew.jones@oss.qualcomm.com> Signed-off-by: Jiakai Xu <xujiakai2025@iscas.ac.cn> Signed-off-by: Jiakai Xu <jiakaiPeanut@gmail.com> --- V8 -> V9: Created a temporary VM with one vCPU in check_steal_time_uapi() instead of adding extra vCPUs to the main VM. Made check_steal_time_uapi() parameterless for all architectures. V7 -> V8: Used ST_GPA_BASE directly instead of st_gva[]/sync_global_to_guest() in x86_64 and ARM64 check_steal_time_uapi(). Created a temporary vcpu in ARM64 check_steal_time_uapi() to avoid EEXIST when steal_time_init() later sets IPA for vcpu[0]. Removed unnecessary comment in RISC-V check_steal_time_uapi(). --- tools/testing/selftests/kvm/steal_time.c | 67 ++++++++++++++++++------ 1 file changed, 51 insertions(+), 16 deletions(-)