* [PATCH v3] KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged
@ 2021-02-01 8:36 Wanpeng Li
2021-02-01 11:21 ` kernel test robot
2021-02-01 17:31 ` kernel test robot
0 siblings, 2 replies; 5+ messages in thread
From: Wanpeng Li @ 2021-02-01 8:36 UTC (permalink / raw)
To: linux-kernel, kvm
Cc: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
Jim Mattson, Joerg Roedel, Brijesh Singh
From: Wanpeng Li <wanpengli@tencent.com>
The per-cpu vsyscall pvclock data pointer assigns either an element of the
static array hv_clock_boot (#vCPU <= 64) or dynamically allocated memory
hvclock_mem (vCPU > 64), the dynamically memory will not be allocated if
kvmclock vsyscall is disabled, this can result in cpu hotpluged fails in
kvmclock_setup_percpu() which returns -ENOMEM. It's broken for no-vsyscall
and sometimes you end up with vsyscall disabled if the host does something
strange. This patch fixes it by allocating this dynamically memory
unconditionally even if vsyscall is disabled.
Fixes: 6a1cac56f4 ("x86/kvm: Use __bss_decrypted attribute in shared variables")
Reported-by: Zelin Deng <zelin.deng@linux.alibaba.com>
Tested-by: Haiwei Li <lihaiwei@tencent.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: stable@vger.kernel.org#v4.19-rc5+
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
---
v2 -> v3:
* allocate dynamically memory unconditionally
v1 -> v2:
* add code comments
arch/x86/kernel/kvmclock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index aa59374..a72b16e 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -268,6 +268,8 @@ static void __init kvmclock_init_mem(void)
static int __init kvm_setup_vsyscall_timeinfo(void)
{
+ kvmclock_init_mem();
+
#ifdef CONFIG_X86_64
u8 flags;
@@ -281,8 +283,6 @@ static int __init kvm_setup_vsyscall_timeinfo(void)
kvm_clock.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
#endif
- kvmclock_init_mem();
-
return 0;
}
early_initcall(kvm_setup_vsyscall_timeinfo);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3] KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged
2021-02-01 8:36 [PATCH v3] KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged Wanpeng Li
@ 2021-02-01 11:21 ` kernel test robot
2021-02-01 17:31 ` kernel test robot
1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-02-01 11:21 UTC (permalink / raw)
To: Wanpeng Li, linux-kernel, kvm
Cc: kbuild-all, Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov,
Wanpeng Li, Jim Mattson, Joerg Roedel, Brijesh Singh
[-- Attachment #1: Type: text/plain, Size: 3115 bytes --]
Hi Wanpeng,
I love your patch! Perhaps something to improve:
[auto build test WARNING on kvm/linux-next]
[also build test WARNING on linux/master vhost/linux-next next-20210125]
[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]
url: https://github.com/0day-ci/linux/commits/Wanpeng-Li/KVM-kvmclock-Fix-vCPUs-64-can-t-be-online-hotpluged/20210201-163927
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/132ae1cea476666dff619b5a7c5675011edd7fe7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Wanpeng-Li/KVM-kvmclock-Fix-vCPUs-64-can-t-be-online-hotpluged/20210201-163927
git checkout 132ae1cea476666dff619b5a7c5675011edd7fe7
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
arch/x86/kernel/kvmclock.c: In function 'kvm_setup_vsyscall_timeinfo':
>> arch/x86/kernel/kvmclock.c:274:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
274 | u8 flags;
| ^~
vim +274 arch/x86/kernel/kvmclock.c
6a1cac56f41f9e Brijesh Singh 2018-09-14 268
e499a9b6dc488a Thomas Gleixner 2018-07-19 269 static int __init kvm_setup_vsyscall_timeinfo(void)
e499a9b6dc488a Thomas Gleixner 2018-07-19 270 {
132ae1cea47666 Wanpeng Li 2021-02-01 271 kvmclock_init_mem();
132ae1cea47666 Wanpeng Li 2021-02-01 272
e499a9b6dc488a Thomas Gleixner 2018-07-19 273 #ifdef CONFIG_X86_64
e499a9b6dc488a Thomas Gleixner 2018-07-19 @274 u8 flags;
e499a9b6dc488a Thomas Gleixner 2018-07-19 275
95a3d4454bb1cf Thomas Gleixner 2018-07-19 276 if (!per_cpu(hv_clock_per_cpu, 0) || !kvmclock_vsyscall)
e499a9b6dc488a Thomas Gleixner 2018-07-19 277 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 278
95a3d4454bb1cf Thomas Gleixner 2018-07-19 279 flags = pvclock_read_flags(&hv_clock_boot[0].pvti);
e499a9b6dc488a Thomas Gleixner 2018-07-19 280 if (!(flags & PVCLOCK_TSC_STABLE_BIT))
95a3d4454bb1cf Thomas Gleixner 2018-07-19 281 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 282
b95a8a27c300d1 Thomas Gleixner 2020-02-07 283 kvm_clock.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
e499a9b6dc488a Thomas Gleixner 2018-07-19 284 #endif
6a1cac56f41f9e Brijesh Singh 2018-09-14 285
e499a9b6dc488a Thomas Gleixner 2018-07-19 286 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 287 }
e499a9b6dc488a Thomas Gleixner 2018-07-19 288 early_initcall(kvm_setup_vsyscall_timeinfo);
e499a9b6dc488a Thomas Gleixner 2018-07-19 289
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 64347 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged
@ 2021-02-01 11:21 ` kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-02-01 11:21 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3178 bytes --]
Hi Wanpeng,
I love your patch! Perhaps something to improve:
[auto build test WARNING on kvm/linux-next]
[also build test WARNING on linux/master vhost/linux-next next-20210125]
[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]
url: https://github.com/0day-ci/linux/commits/Wanpeng-Li/KVM-kvmclock-Fix-vCPUs-64-can-t-be-online-hotpluged/20210201-163927
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/132ae1cea476666dff619b5a7c5675011edd7fe7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Wanpeng-Li/KVM-kvmclock-Fix-vCPUs-64-can-t-be-online-hotpluged/20210201-163927
git checkout 132ae1cea476666dff619b5a7c5675011edd7fe7
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
arch/x86/kernel/kvmclock.c: In function 'kvm_setup_vsyscall_timeinfo':
>> arch/x86/kernel/kvmclock.c:274:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
274 | u8 flags;
| ^~
vim +274 arch/x86/kernel/kvmclock.c
6a1cac56f41f9e Brijesh Singh 2018-09-14 268
e499a9b6dc488a Thomas Gleixner 2018-07-19 269 static int __init kvm_setup_vsyscall_timeinfo(void)
e499a9b6dc488a Thomas Gleixner 2018-07-19 270 {
132ae1cea47666 Wanpeng Li 2021-02-01 271 kvmclock_init_mem();
132ae1cea47666 Wanpeng Li 2021-02-01 272
e499a9b6dc488a Thomas Gleixner 2018-07-19 273 #ifdef CONFIG_X86_64
e499a9b6dc488a Thomas Gleixner 2018-07-19 @274 u8 flags;
e499a9b6dc488a Thomas Gleixner 2018-07-19 275
95a3d4454bb1cf Thomas Gleixner 2018-07-19 276 if (!per_cpu(hv_clock_per_cpu, 0) || !kvmclock_vsyscall)
e499a9b6dc488a Thomas Gleixner 2018-07-19 277 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 278
95a3d4454bb1cf Thomas Gleixner 2018-07-19 279 flags = pvclock_read_flags(&hv_clock_boot[0].pvti);
e499a9b6dc488a Thomas Gleixner 2018-07-19 280 if (!(flags & PVCLOCK_TSC_STABLE_BIT))
95a3d4454bb1cf Thomas Gleixner 2018-07-19 281 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 282
b95a8a27c300d1 Thomas Gleixner 2020-02-07 283 kvm_clock.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
e499a9b6dc488a Thomas Gleixner 2018-07-19 284 #endif
6a1cac56f41f9e Brijesh Singh 2018-09-14 285
e499a9b6dc488a Thomas Gleixner 2018-07-19 286 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 287 }
e499a9b6dc488a Thomas Gleixner 2018-07-19 288 early_initcall(kvm_setup_vsyscall_timeinfo);
e499a9b6dc488a Thomas Gleixner 2018-07-19 289
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 64347 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged
2021-02-01 8:36 [PATCH v3] KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged Wanpeng Li
@ 2021-02-01 17:31 ` kernel test robot
2021-02-01 17:31 ` kernel test robot
1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-02-01 17:31 UTC (permalink / raw)
To: Wanpeng Li, linux-kernel, kvm
Cc: kbuild-all, clang-built-linux, Paolo Bonzini,
Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
Joerg Roedel, Brijesh Singh
[-- Attachment #1: Type: text/plain, Size: 3453 bytes --]
Hi Wanpeng,
I love your patch! Perhaps something to improve:
[auto build test WARNING on kvm/linux-next]
[also build test WARNING on linux/master vhost/linux-next next-20210125]
[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]
url: https://github.com/0day-ci/linux/commits/Wanpeng-Li/KVM-kvmclock-Fix-vCPUs-64-can-t-be-online-hotpluged/20210201-163927
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: x86_64-randconfig-a013-20210201 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 275c6af7d7f1ed63a03d05b4484413e447133269)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/132ae1cea476666dff619b5a7c5675011edd7fe7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Wanpeng-Li/KVM-kvmclock-Fix-vCPUs-64-can-t-be-online-hotpluged/20210201-163927
git checkout 132ae1cea476666dff619b5a7c5675011edd7fe7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> arch/x86/kernel/kvmclock.c:274:5: warning: ISO C90 forbids mixing declarations and code [-Wdeclaration-after-statement]
u8 flags;
^
1 warning generated.
vim +274 arch/x86/kernel/kvmclock.c
6a1cac56f41f9e Brijesh Singh 2018-09-14 268
e499a9b6dc488a Thomas Gleixner 2018-07-19 269 static int __init kvm_setup_vsyscall_timeinfo(void)
e499a9b6dc488a Thomas Gleixner 2018-07-19 270 {
132ae1cea47666 Wanpeng Li 2021-02-01 271 kvmclock_init_mem();
132ae1cea47666 Wanpeng Li 2021-02-01 272
e499a9b6dc488a Thomas Gleixner 2018-07-19 273 #ifdef CONFIG_X86_64
e499a9b6dc488a Thomas Gleixner 2018-07-19 @274 u8 flags;
e499a9b6dc488a Thomas Gleixner 2018-07-19 275
95a3d4454bb1cf Thomas Gleixner 2018-07-19 276 if (!per_cpu(hv_clock_per_cpu, 0) || !kvmclock_vsyscall)
e499a9b6dc488a Thomas Gleixner 2018-07-19 277 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 278
95a3d4454bb1cf Thomas Gleixner 2018-07-19 279 flags = pvclock_read_flags(&hv_clock_boot[0].pvti);
e499a9b6dc488a Thomas Gleixner 2018-07-19 280 if (!(flags & PVCLOCK_TSC_STABLE_BIT))
95a3d4454bb1cf Thomas Gleixner 2018-07-19 281 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 282
b95a8a27c300d1 Thomas Gleixner 2020-02-07 283 kvm_clock.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
e499a9b6dc488a Thomas Gleixner 2018-07-19 284 #endif
6a1cac56f41f9e Brijesh Singh 2018-09-14 285
e499a9b6dc488a Thomas Gleixner 2018-07-19 286 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 287 }
e499a9b6dc488a Thomas Gleixner 2018-07-19 288 early_initcall(kvm_setup_vsyscall_timeinfo);
e499a9b6dc488a Thomas Gleixner 2018-07-19 289
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40050 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged
@ 2021-02-01 17:31 ` kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-02-01 17:31 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3520 bytes --]
Hi Wanpeng,
I love your patch! Perhaps something to improve:
[auto build test WARNING on kvm/linux-next]
[also build test WARNING on linux/master vhost/linux-next next-20210125]
[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]
url: https://github.com/0day-ci/linux/commits/Wanpeng-Li/KVM-kvmclock-Fix-vCPUs-64-can-t-be-online-hotpluged/20210201-163927
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: x86_64-randconfig-a013-20210201 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 275c6af7d7f1ed63a03d05b4484413e447133269)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/132ae1cea476666dff619b5a7c5675011edd7fe7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Wanpeng-Li/KVM-kvmclock-Fix-vCPUs-64-can-t-be-online-hotpluged/20210201-163927
git checkout 132ae1cea476666dff619b5a7c5675011edd7fe7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> arch/x86/kernel/kvmclock.c:274:5: warning: ISO C90 forbids mixing declarations and code [-Wdeclaration-after-statement]
u8 flags;
^
1 warning generated.
vim +274 arch/x86/kernel/kvmclock.c
6a1cac56f41f9e Brijesh Singh 2018-09-14 268
e499a9b6dc488a Thomas Gleixner 2018-07-19 269 static int __init kvm_setup_vsyscall_timeinfo(void)
e499a9b6dc488a Thomas Gleixner 2018-07-19 270 {
132ae1cea47666 Wanpeng Li 2021-02-01 271 kvmclock_init_mem();
132ae1cea47666 Wanpeng Li 2021-02-01 272
e499a9b6dc488a Thomas Gleixner 2018-07-19 273 #ifdef CONFIG_X86_64
e499a9b6dc488a Thomas Gleixner 2018-07-19 @274 u8 flags;
e499a9b6dc488a Thomas Gleixner 2018-07-19 275
95a3d4454bb1cf Thomas Gleixner 2018-07-19 276 if (!per_cpu(hv_clock_per_cpu, 0) || !kvmclock_vsyscall)
e499a9b6dc488a Thomas Gleixner 2018-07-19 277 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 278
95a3d4454bb1cf Thomas Gleixner 2018-07-19 279 flags = pvclock_read_flags(&hv_clock_boot[0].pvti);
e499a9b6dc488a Thomas Gleixner 2018-07-19 280 if (!(flags & PVCLOCK_TSC_STABLE_BIT))
95a3d4454bb1cf Thomas Gleixner 2018-07-19 281 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 282
b95a8a27c300d1 Thomas Gleixner 2020-02-07 283 kvm_clock.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
e499a9b6dc488a Thomas Gleixner 2018-07-19 284 #endif
6a1cac56f41f9e Brijesh Singh 2018-09-14 285
e499a9b6dc488a Thomas Gleixner 2018-07-19 286 return 0;
e499a9b6dc488a Thomas Gleixner 2018-07-19 287 }
e499a9b6dc488a Thomas Gleixner 2018-07-19 288 early_initcall(kvm_setup_vsyscall_timeinfo);
e499a9b6dc488a Thomas Gleixner 2018-07-19 289
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 40050 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-02-01 17:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 8:36 [PATCH v3] KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged Wanpeng Li
2021-02-01 11:21 ` kernel test robot
2021-02-01 11:21 ` kernel test robot
2021-02-01 17:31 ` kernel test robot
2021-02-01 17:31 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.