All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: cros-kernel-buildreports@googlegroups.com
Cc: oe-kbuild-all@lists.linux.dev
Subject: [android-common:android16-6.12-desktop 280/280] arch/x86/kvm/mmu/mmu.c:4595:39: error: invalid application of 'sizeof' to incomplete type 'struct kvm_pinned_page'
Date: Wed, 12 Mar 2025 23:28:28 +0800	[thread overview]
Message-ID: <202503122351.Dmionfev-lkp@intel.com> (raw)

tree:   https://android.googlesource.com/kernel/common android16-6.12-desktop
head:   416b1b8e121ff0114c661e47e388426ad5cce864
commit: 09bf6b8a4a13018bbcea10b0f62f734ff6bbcb1a [280/280] ANDROID: REVERTME: HACK: kvm: pin all the pages used by protected VM
config: i386-buildonly-randconfig-003-20250312 (https://download.01.org/0day-ci/archive/20250312/202503122351.Dmionfev-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250312/202503122351.Dmionfev-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/202503122351.Dmionfev-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/percpu.h:5,
                    from arch/x86/include/asm/msr.h:15,
                    from arch/x86/include/asm/tsc.h:10,
                    from arch/x86/include/asm/timex.h:6,
                    from include/linux/timex.h:67,
                    from include/linux/time32.h:13,
                    from include/linux/time.h:60,
                    from include/linux/jiffies.h:10,
                    from include/linux/ktime.h:25,
                    from include/linux/timer.h:6,
                    from include/linux/workqueue.h:9,
                    from include/linux/mm_types.h:19,
                    from arch/x86/kvm/irq.h:13,
                    from arch/x86/kvm/mmu/mmu.c:19:
   arch/x86/kvm/mmu/mmu.c: In function 'direct_page_fault':
>> arch/x86/kvm/mmu/mmu.c:4595:39: error: invalid application of 'sizeof' to incomplete type 'struct kvm_pinned_page'
    4595 |                 ppage = kmalloc(sizeof(*ppage), GFP_KERNEL_ACCOUNT);
         |                                       ^
   include/linux/alloc_tag.h:227:16: note: in definition of macro 'alloc_hooks_tag'
     227 |         typeof(_do_alloc) _res;                                         \
         |                ^~~~~~~~~
   include/linux/slab.h:887:49: note: in expansion of macro 'alloc_hooks'
     887 | #define kmalloc(...)                            alloc_hooks(kmalloc_noprof(__VA_ARGS__))
         |                                                 ^~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:4595:25: note: in expansion of macro 'kmalloc'
    4595 |                 ppage = kmalloc(sizeof(*ppage), GFP_KERNEL_ACCOUNT);
         |                         ^~~~~~~
>> arch/x86/kvm/mmu/mmu.c:4595:39: error: invalid application of 'sizeof' to incomplete type 'struct kvm_pinned_page'
    4595 |                 ppage = kmalloc(sizeof(*ppage), GFP_KERNEL_ACCOUNT);
         |                                       ^
   include/linux/alloc_tag.h:231:24: note: in definition of macro 'alloc_hooks_tag'
     231 |                 _res = _do_alloc;                                       \
         |                        ^~~~~~~~~
   include/linux/slab.h:887:49: note: in expansion of macro 'alloc_hooks'
     887 | #define kmalloc(...)                            alloc_hooks(kmalloc_noprof(__VA_ARGS__))
         |                                                 ^~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:4595:25: note: in expansion of macro 'kmalloc'
    4595 |                 ppage = kmalloc(sizeof(*ppage), GFP_KERNEL_ACCOUNT);
         |                         ^~~~~~~
>> arch/x86/kvm/mmu/mmu.c:4595:39: error: invalid application of 'sizeof' to incomplete type 'struct kvm_pinned_page'
    4595 |                 ppage = kmalloc(sizeof(*ppage), GFP_KERNEL_ACCOUNT);
         |                                       ^
   include/linux/alloc_tag.h:234:24: note: in definition of macro 'alloc_hooks_tag'
     234 |                 _res = _do_alloc;                                       \
         |                        ^~~~~~~~~
   include/linux/slab.h:887:49: note: in expansion of macro 'alloc_hooks'
     887 | #define kmalloc(...)                            alloc_hooks(kmalloc_noprof(__VA_ARGS__))
         |                                                 ^~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:4595:25: note: in expansion of macro 'kmalloc'
    4595 |                 ppage = kmalloc(sizeof(*ppage), GFP_KERNEL_ACCOUNT);
         |                         ^~~~~~~
>> arch/x86/kvm/mmu/mmu.c:4595:23: warning: assignment to 'struct kvm_pinned_page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    4595 |                 ppage = kmalloc(sizeof(*ppage), GFP_KERNEL_ACCOUNT);
         |                       ^
>> arch/x86/kvm/mmu/mmu.c:4630:22: error: invalid use of undefined type 'struct kvm_pinned_page'
    4630 |                 ppage->page = pfn_to_page(fault->pfn);
         |                      ^~
   arch/x86/kvm/mmu/mmu.c:4631:31: error: invalid use of undefined type 'struct kvm_pinned_page'
    4631 |                 get_page(ppage->page);
         |                               ^~
   arch/x86/kvm/mmu/mmu.c:4632:37: error: 'struct kvm' has no member named 'pkvm'
    4632 |                 spin_lock(&vcpu->kvm->pkvm.pinned_page_lock);
         |                                     ^~
   arch/x86/kvm/mmu/mmu.c:4633:32: error: invalid use of undefined type 'struct kvm_pinned_page'
    4633 |                 list_add(&ppage->list, &vcpu->kvm->pkvm.pinned_pages);
         |                                ^~
   arch/x86/kvm/mmu/mmu.c:4633:50: error: 'struct kvm' has no member named 'pkvm'
    4633 |                 list_add(&ppage->list, &vcpu->kvm->pkvm.pinned_pages);
         |                                                  ^~
   arch/x86/kvm/mmu/mmu.c:4634:39: error: 'struct kvm' has no member named 'pkvm'
    4634 |                 spin_unlock(&vcpu->kvm->pkvm.pinned_page_lock);
         |                                       ^~


vim +4595 arch/x86/kvm/mmu/mmu.c

  4583	
  4584	static int direct_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
  4585	{
  4586		struct kvm_pinned_page *ppage = NULL;
  4587		kvm_pfn_t orig_pfn;
  4588		int r;
  4589	
  4590		/* Dummy roots are used only for shadowing bad guest roots. */
  4591		if (WARN_ON_ONCE(kvm_mmu_is_dummy_root(vcpu->arch.mmu->root.hpa)))
  4592			return RET_PF_RETRY;
  4593	
  4594		if (vcpu->kvm->arch.vm_type == KVM_X86_PROTECTED_VM) {
> 4595			ppage = kmalloc(sizeof(*ppage), GFP_KERNEL_ACCOUNT);
  4596			if (!ppage)
  4597				return -ENOMEM;
  4598		}
  4599	
  4600		if (page_fault_handle_page_track(vcpu, fault))
  4601			return RET_PF_WRITE_PROTECTED;
  4602	
  4603		r = fast_page_fault(vcpu, fault);
  4604		if (r != RET_PF_INVALID)
  4605			return r;
  4606	
  4607		r = mmu_topup_memory_caches(vcpu, false);
  4608		if (r)
  4609			return r;
  4610	
  4611		r = kvm_faultin_pfn(vcpu, fault, ACC_ALL);
  4612		if (r != RET_PF_CONTINUE)
  4613			return r;
  4614	
  4615		orig_pfn = fault->pfn;
  4616	
  4617		r = RET_PF_RETRY;
  4618		write_lock(&vcpu->kvm->mmu_lock);
  4619	
  4620		if (is_page_fault_stale(vcpu, fault))
  4621			goto out_unlock;
  4622	
  4623		r = make_mmu_pages_available(vcpu);
  4624		if (r)
  4625			goto out_unlock;
  4626	
  4627		r = direct_map(vcpu, fault);
  4628	
  4629		if (ppage && r == RET_PF_FIXED) {
> 4630			ppage->page = pfn_to_page(fault->pfn);
  4631			get_page(ppage->page);
  4632			spin_lock(&vcpu->kvm->pkvm.pinned_page_lock);
  4633			list_add(&ppage->list, &vcpu->kvm->pkvm.pinned_pages);
  4634			spin_unlock(&vcpu->kvm->pkvm.pinned_page_lock);
  4635		}
  4636	
  4637	out_unlock:
  4638		write_unlock(&vcpu->kvm->mmu_lock);
  4639		kvm_release_pfn_clean(orig_pfn);
  4640		return r;
  4641	}
  4642	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2025-03-12 15:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202503122351.Dmionfev-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=cros-kernel-buildreports@googlegroups.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.