[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202210012130.VcQKUcXG-lkp@intel.com>
Date: Sat, 1 Oct 2022 21:41:52 +0800
From: kernel test robot <lkp@...el.com>
To: Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org, seanjc@...gle.com,
maciej.szmigiero@...cle.com
Subject: Re: [PATCH v2 4/8] KVM: x86: do not go through ctxt->ops when
emulating rsm
Hi Paolo,
I love your patch! Perhaps something to improve:
[auto build test WARNING on kvm/queue]
[also build test WARNING on next-20220930]
[cannot apply to mst-vhost/linux-next linus/master v6.0-rc7]
[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/Paolo-Bonzini/KVM-x86-allow-compiling-out-SMM-support/20220930-012220
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
config: i386-randconfig-a013-20220926
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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
# https://github.com/intel-lab-lkp/linux/commit/cc73a769dae68cad03e5f075d8b09aac79cd0125
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Paolo-Bonzini/KVM-x86-allow-compiling-out-SMM-support/20220930-012220
git checkout cc73a769dae68cad03e5f075d8b09aac79cd0125
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kvm/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> arch/x86/kvm/smm.c:503:21: warning: unused variable 'cr4' [-Wunused-variable]
unsigned long cr0, cr4, efer;
^
>> arch/x86/kvm/smm.c:503:26: warning: unused variable 'efer' [-Wunused-variable]
unsigned long cr0, cr4, efer;
^
2 warnings generated.
vim +/cr4 +503 arch/x86/kvm/smm.c
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 499
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 500 int emulator_leave_smm(struct x86_emulate_ctxt *ctxt)
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 501 {
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 502 struct kvm_vcpu *vcpu = ctxt->vcpu;
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 @503 unsigned long cr0, cr4, efer;
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 504 char buf[512];
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 505 u64 smbase;
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 506 int ret;
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 507
cc73a769dae68c Paolo Bonzini 2022-09-29 508 smbase = vcpu->arch.smbase;
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 509
cc73a769dae68c Paolo Bonzini 2022-09-29 510 ret = kvm_vcpu_read_guest(vcpu, smbase + 0xfe00, buf, sizeof(buf));
cc73a769dae68c Paolo Bonzini 2022-09-29 511 if (ret < 0)
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 512 return X86EMUL_UNHANDLEABLE;
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 513
cc73a769dae68c Paolo Bonzini 2022-09-29 514 if ((vcpu->arch.hflags & HF_SMM_INSIDE_NMI_MASK) == 0)
cc73a769dae68c Paolo Bonzini 2022-09-29 515 static_call(kvm_x86_set_nmi_mask)(vcpu, false);
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 516
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 517 kvm_smm_changed(vcpu, false);
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 518
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 519 /*
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 520 * Get back to real mode, to prepare a safe state in which to load
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 521 * CR0/CR3/CR4/EFER. It's all a bit more complicated if the vCPU
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 522 * supports long mode.
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 523 */
cc73a769dae68c Paolo Bonzini 2022-09-29 524 #ifdef CONFIG_X86_64
cc73a769dae68c Paolo Bonzini 2022-09-29 525 if (guest_cpuid_has(vcpu, X86_FEATURE_LM)) {
cc73a769dae68c Paolo Bonzini 2022-09-29 526 struct kvm_segment cs_desc;
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 527
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 528 /* Zero CR4.PCIDE before CR0.PG. */
cc73a769dae68c Paolo Bonzini 2022-09-29 529 cr4 = kvm_read_cr4(vcpu);
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 530 if (cr4 & X86_CR4_PCIDE)
cc73a769dae68c Paolo Bonzini 2022-09-29 531 kvm_set_cr4(vcpu, cr4 & ~X86_CR4_PCIDE);
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 532
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 533 /* A 32-bit code segment is required to clear EFER.LMA. */
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 534 memset(&cs_desc, 0, sizeof(cs_desc));
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 535 cs_desc.type = 0xb;
cc73a769dae68c Paolo Bonzini 2022-09-29 536 cs_desc.s = cs_desc.g = cs_desc.present = 1;
cc73a769dae68c Paolo Bonzini 2022-09-29 537 kvm_set_segment(vcpu, &cs_desc, VCPU_SREG_CS);
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 538 }
cc73a769dae68c Paolo Bonzini 2022-09-29 539 #endif
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 540
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 541 /* For the 64-bit case, this will clear EFER.LMA. */
cc73a769dae68c Paolo Bonzini 2022-09-29 542 cr0 = kvm_read_cr0(vcpu);
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 543 if (cr0 & X86_CR0_PE)
cc73a769dae68c Paolo Bonzini 2022-09-29 544 kvm_set_cr0(vcpu, cr0 & ~(X86_CR0_PG | X86_CR0_PE));
cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 545
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (150061 bytes)
Powered by blists - more mailing lists