From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1BDF9D; Sun, 10 Dec 2023 19:05:21 -0800 (PST) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R871e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=guanjun@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0Vy9Z.J._1702263918; Received: from localhost(mailfrom:guanjun@linux.alibaba.com fp:SMTPD_---0Vy9Z.J._1702263918) by smtp.aliyun-inc.com; Mon, 11 Dec 2023 11:05:19 +0800 From: 'Guanjun' 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 Message-Id: <20231211030518.2722714-1-guanjun@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Guanjun '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 --- 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