mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Gardon <bgardon@google.com>
To: kernel test robot <lkp@intel.com>
Cc: kbuild-all@lists.01.org, LKML <linux-kernel@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Peter Feiner <pfeiner@google.com>
Subject: Re: arch/x86/kvm/mmu/tdp_mmu.c:533:9: sparse: sparse: cast removes address space '__rcu' of expression
Date: Mon, 1 Mar 2021 09:22:15 -0800	[thread overview]
Message-ID: <CANgfPd8K-SmOYjQgubn0NjtxmLXnyLafMTCQ6KppiWR7ZeOYig@mail.gmail.com> (raw)
In-Reply-To: <202102280728.9KxiUPjh-lkp@intel.com>

It looks like the __rcu tags aren't being propagated around to all the
different references to PT memory. I'll look into what it would take
to fix this. I don't believe these kernel test warnings indicate a
correctness issue in the kernel, but propagating the __rcu annotations
will be helpful for developers in the future.

On Sat, Feb 27, 2021 at 3:48 PM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   5695e51619745d4fe3ec2506a2f0cd982c5e27a4
> commit: 08f07c800e9d35b59d0c8346333f189160bd67d4 KVM: x86/mmu: Flush TLBs after zap in TDP MMU PF handler
> date:   3 weeks ago
> config: x86_64-randconfig-s022-20210228 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> reproduce:
>         # apt-get install sparse
>         # sparse version: v0.6.3-241-geaceeafa-dirty
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=08f07c800e9d35b59d0c8346333f189160bd67d4
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout 08f07c800e9d35b59d0c8346333f189160bd67d4
>         # save the attached .config to linux build tree
>         make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> "sparse warnings: (new ones prefixed by >>)"
>    arch/x86/kvm/mmu/tdp_mmu.c:459:49: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected unsigned long long [usertype] *pt @@     got unsigned long long [noderef] [usertype] __rcu * @@
>    arch/x86/kvm/mmu/tdp_mmu.c:459:49: sparse:     expected unsigned long long [usertype] *pt
>    arch/x86/kvm/mmu/tdp_mmu.c:459:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *
>    arch/x86/kvm/mmu/tdp_mmu.c:291:9: sparse: sparse: context imbalance in 'tdp_mmu_link_page' - different lock contexts for basic block
>    arch/x86/kvm/mmu/tdp_mmu.c:316:9: sparse: sparse: context imbalance in 'tdp_mmu_unlink_page' - different lock contexts for basic block
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected unsigned long long [usertype] *root_pt @@     got unsigned long long [noderef] [usertype] __rcu * @@
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse:     expected unsigned long long [usertype] *root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse:     got unsigned long long [noderef] [usertype] __rcu *
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     expected unsigned long long [usertype] *sptep
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned long long [usertype] *root_pt @@     got unsigned long long [noderef] [usertype] __rcu * @@
>    arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse:     expected unsigned long long [usertype] *root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse:     got unsigned long long [noderef] [usertype] __rcu *
> >> arch/x86/kvm/mmu/tdp_mmu.c:533:9: sparse: sparse: cast removes address space '__rcu' of expression
>    arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned long long [usertype] *root_pt @@     got unsigned long long [noderef] [usertype] __rcu * @@
>    arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse:     expected unsigned long long [usertype] *root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse:     got unsigned long long [noderef] [usertype] __rcu *
>    arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned long long [usertype] *root_pt @@     got unsigned long long [noderef] [usertype] __rcu * @@
>    arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse:     expected unsigned long long [usertype] *root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse:     got unsigned long long [noderef] [usertype] __rcu *
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     expected unsigned long long [usertype] *sptep
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     expected unsigned long long [usertype] *sptep
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     expected unsigned long long [usertype] *sptep
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected unsigned long long [usertype] *root_pt @@     got unsigned long long [noderef] [usertype] __rcu * @@
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse:     expected unsigned long long [usertype] *root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse:     got unsigned long long [noderef] [usertype] __rcu *
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     expected unsigned long long [usertype] *sptep
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected unsigned long long [usertype] *root_pt @@     got unsigned long long [noderef] [usertype] __rcu * @@
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse:     expected unsigned long long [usertype] *root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse:     got unsigned long long [noderef] [usertype] __rcu *
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     expected unsigned long long [usertype] *sptep
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     expected unsigned long long [usertype] *sptep
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected unsigned long long [usertype] *root_pt @@     got unsigned long long [noderef] [usertype] __rcu * @@
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse:     expected unsigned long long [usertype] *root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse:     got unsigned long long [noderef] [usertype] __rcu *
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     expected unsigned long long [usertype] *sptep
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected unsigned long long [usertype] *root_pt @@     got unsigned long long [noderef] [usertype] __rcu * @@
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse:     expected unsigned long long [usertype] *root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse:     got unsigned long long [noderef] [usertype] __rcu *
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     expected unsigned long long [usertype] *sptep
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     expected unsigned long long [usertype] *sptep
>    arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse:     got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt
>
> vim +/__rcu +533 arch/x86/kvm/mmu/tdp_mmu.c
>
>    509
>    510  static inline bool tdp_mmu_zap_spte_atomic(struct kvm *kvm,
>    511                                             struct tdp_iter *iter)
>    512  {
>    513          /*
>    514           * Freeze the SPTE by setting it to a special,
>    515           * non-present value. This will stop other threads from
>    516           * immediately installing a present entry in its place
>    517           * before the TLBs are flushed.
>    518           */
>    519          if (!tdp_mmu_set_spte_atomic(kvm, iter, REMOVED_SPTE))
>    520                  return false;
>    521
>    522          kvm_flush_remote_tlbs_with_address(kvm, iter->gfn,
>    523                                             KVM_PAGES_PER_HPAGE(iter->level));
>    524
>    525          /*
>    526           * No other thread can overwrite the removed SPTE as they
>    527           * must either wait on the MMU lock or use
>    528           * tdp_mmu_set_spte_atomic which will not overrite the
>    529           * special removed SPTE value. No bookkeeping is needed
>    530           * here since the SPTE is going from non-present
>    531           * to non-present.
>    532           */
>  > 533          WRITE_ONCE(*iter->sptep, 0);
>    534
>    535          return true;
>    536  }
>    537
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

      reply	other threads:[~2021-03-01 21:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-27 23:47 kernel test robot
2021-03-01 17:22 ` Ben Gardon [this message]

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=CANgfPd8K-SmOYjQgubn0NjtxmLXnyLafMTCQ6KppiWR7ZeOYig@mail.gmail.com \
    --to=bgardon@google.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=pbonzini@redhat.com \
    --cc=pfeiner@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®