public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: 'Guanjun' <guanjun@linux.alibaba.com>
To: dave.hansen@linux.intel.com, luto@kernel.org,
	peterz@infradead.org, kirill.shutemov@linux.intel.com,
	yu.c.zhang@linux.intel.com, tabba@google.com,
	xiaoyao.li@intel.com
Cc: pbonzini@redhat.com, x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] KVM: Move kvm_gmem_migrate_folio inside CONFIG_MIGRATION
Date: Mon, 11 Dec 2023 11:05:18 +0800	[thread overview]
Message-ID: <20231211030518.2722714-1-guanjun@linux.alibaba.com> (raw)

From: Guanjun <guanjun@linux.alibaba.com>

'kvm_gmem_migrate_folio' is only used when CONFIG_MIGRATION
is defined, And it will triggers the compiler warning about
'kvm_gmem_migrate_folio' defined but not used when CONFIG_MIGRATION
isn't defined.

The compiler complained like that:
arch/x86/kvm/../../../virt/kvm/guest_memfd.c:262:12: error: ‘kvm_gmem_migrate_folio’ defined but not used [-Werror=unused-function]
  262 | static int kvm_gmem_migrate_folio(struct address_space *mapping,
      |            ^~~~~~~~~~~~~~~~~~~~~~

Fixes: a7800aa80ea4 (KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory)
Signed-off-by: Guanjun <guanjun@linux.alibaba.com>
---
 virt/kvm/guest_memfd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
index 16d58806e913..62bb8a1a47d1 100644
--- a/virt/kvm/guest_memfd.c
+++ b/virt/kvm/guest_memfd.c
@@ -259,6 +259,7 @@ void kvm_gmem_init(struct module *module)
 	kvm_gmem_fops.owner = module;
 }
 
+#ifdef CONFIG_MIGRATION
 static int kvm_gmem_migrate_folio(struct address_space *mapping,
 				  struct folio *dst, struct folio *src,
 				  enum migrate_mode mode)
@@ -266,6 +267,7 @@ static int kvm_gmem_migrate_folio(struct address_space *mapping,
 	WARN_ON_ONCE(1);
 	return -EINVAL;
 }
+#endif
 
 static int kvm_gmem_error_folio(struct address_space *mapping,
 		struct folio *folio)
-- 
2.39.3


             reply	other threads:[~2023-12-11  3:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11  3:05 'Guanjun' [this message]
2023-12-11 15:15 ` [PATCH 1/1] KVM: Move kvm_gmem_migrate_folio inside CONFIG_MIGRATION Sean Christopherson

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=20231211030518.2722714-1-guanjun@linux.alibaba.com \
    --to=guanjun@linux.alibaba.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tabba@google.com \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@intel.com \
    --cc=yu.c.zhang@linux.intel.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