public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] KVM: Move kvm_gmem_migrate_folio inside CONFIG_MIGRATION
@ 2023-12-11  3:05 'Guanjun'
  2023-12-11 15:15 ` Sean Christopherson
  0 siblings, 1 reply; 2+ messages in thread
From: 'Guanjun' @ 2023-12-11  3:05 UTC (permalink / raw)
  To: dave.hansen, luto, peterz, kirill.shutemov, yu.c.zhang, tabba,
	xiaoyao.li
  Cc: pbonzini, x86, kvm, linux-kernel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] KVM: Move kvm_gmem_migrate_folio inside CONFIG_MIGRATION
  2023-12-11  3:05 [PATCH 1/1] KVM: Move kvm_gmem_migrate_folio inside CONFIG_MIGRATION 'Guanjun'
@ 2023-12-11 15:15 ` Sean Christopherson
  0 siblings, 0 replies; 2+ messages in thread
From: Sean Christopherson @ 2023-12-11 15:15 UTC (permalink / raw)
  To: 'Guanjun'
  Cc: dave.hansen, luto, peterz, kirill.shutemov, yu.c.zhang, tabba,
	xiaoyao.li, pbonzini, x86, kvm, linux-kernel

On Mon, Dec 11, 2023, 'Guanjun' wrote:
> 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,
>       |            ^~~~~~~~~~~~~~~~~~~~~~

Already fixed, commit 80583d0cfd8f ("KVM: guest-memfd: fix unused-function warning")
in kvm/next.

https://lore.kernel.org/all/20231208184908.2298225-1-pbonzini@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-11 15:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-11  3:05 [PATCH 1/1] KVM: Move kvm_gmem_migrate_folio inside CONFIG_MIGRATION 'Guanjun'
2023-12-11 15:15 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox