Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1363018rdb; Fri, 1 Dec 2023 14:24:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFu3Mg/A2pfU1wZ7yxb/oFkGP33t7vXTukMw4Qys3bHXPZY+A8EXycZKIXMQZTJhoC/eB2G X-Received: by 2002:a17:902:a603:b0:1d0:6ffd:e2eb with SMTP id u3-20020a170902a60300b001d06ffde2ebmr173399plq.133.1701469459621; Fri, 01 Dec 2023 14:24:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701469459; cv=none; d=google.com; s=arc-20160816; b=oS3CIF8RlttFOMcH8nuGx54lsvT9Aoehn3mAs30XWQwEgNYpeGH1UM8M3u+slUzMXf +QvDWjO/awkM+ZxRhzt/5bnqilqonhSTbloAHUgGQ2EFCMcZuvsaczbDXwfllTlguGRr aan6JmSbna8Q3weg0fdO89mYylstdhNksbDNlevH261X3TXgHrvNhsdu+hpdXtP6xcco INk0q7xJHQXcQWL6a+jxgT+m2wAKp3qfPWk7w9ob8QaIbb5oyP46v9CrJJisUU2tXRTa YY72BHapDO8Ca9QRIcmqTKVpsL8+CJaSfTNKhEp1h8BLx08v1bD/X0oADZ4NAM8lr8cI WB4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=/EaOyG2WIzsmtRAtj27ai8on7XhQQ3gj4a4UXCtq+eI=; fh=fQU2OLfEd3n/6B72cNIJwjt5n1uHoUeXX4V4Rb/oWPE=; b=kT2P+reaRDldwMnGFZ1fObZvqkqGhnQ9a1GtK+RY6Hux2Cv7sypbX2A8t6AVaFVCK/ oshOw1yDxZP47MNZ2snCoxytIcZooJ5J2hm6cNq2GJsH4LVbWUCPRDqfw8AHuqPsKpNw mXAK2tLo57Dpn3ddiQvOOU6WHg3V077jRP6mS1WJ4F9IKIfzY9ZfK35eohjwqeg3yLaE sFmSmWA1GqU+tQk/gCko4UXl1IMd4jGlEfgd1OPc+75s0GHGoSgcgLxMy0TKxZttY01u WXDkB5Wcmp9unlmJ5uWTZMnekj04wjUoZ1UhnkfAOxe/WJFFakKQIhfM1ysk6cIelPqm r0tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=xAKRMNyA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id jg9-20020a17090326c900b001cf68d3e90csi3842992plb.98.2023.12.01.14.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 14:24:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=xAKRMNyA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5545A8077825; Fri, 1 Dec 2023 14:24:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441818AbjLAWYD (ORCPT + 99 others); Fri, 1 Dec 2023 17:24:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjLAWYC (ORCPT ); Fri, 1 Dec 2023 17:24:02 -0500 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 284A710D for ; Fri, 1 Dec 2023 14:24:09 -0800 (PST) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-5aaae6f46e1so1196265a12.3 for ; Fri, 01 Dec 2023 14:24:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701469448; x=1702074248; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=/EaOyG2WIzsmtRAtj27ai8on7XhQQ3gj4a4UXCtq+eI=; b=xAKRMNyAvhsdmdwsxirPecuic9+vA3FGhqgLEEGD66zfKFy1JE6KnXdXVebXGH6kTI +bW319xynRBprHz49TYRt9f8VxgZt6C6zy7bvx9kyXJD7cMNws8GDnyJjZNa9FzM7v/f JRZbwdRgpCK/OCO/64BEwZOYl404E17RJ4BWzDM1yQm3eaCyeLAuNzI+22jyrYFk8j5d 5XPMUL/gfkpfPDdkcbvD288nftmQ6USSewEbkwR1RFm87YpRIbdpRqD40RKNYSynCqq4 K4tmixrgjYgmD/iwPM77JQhLTMwoo5TUy+JkRV3W/E9hAHKYyaYpVQnEJyuKo64FEYmv SKkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701469448; x=1702074248; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/EaOyG2WIzsmtRAtj27ai8on7XhQQ3gj4a4UXCtq+eI=; b=GYAJETbjQq09cY2lJQl+da90lceRQlXMXmMfWXjJn90x+t7ZgpgpTQgf8FxxqsOw7s sre15ZfBxthZ3GpPbf3+FNUSNc36yTeWHLQSBLKPhKXkblfi2gFWk2myLIZCTfxn8zrc VURkZZBAhHwFfBpoZ2WhvTk+0C7dRG16Ua3IpIJ0iEn6pZTh+FH8DHJZ6B84UM5Gbqlc BID8lq+cmna3KHyMJkjZM2TvpisQrZSlxM/RGEDkiq+5hL9xqkLOU/0/S8nl4N74/tyH LQl6OLEhVSpBLufuNArdJagsb/NhDsWVs3mhs/69VoAUTvs+8hhYPz9ntwaRFDdhnyc8 QouQ== X-Gm-Message-State: AOJu0YwJq8cWURdEJeSD/Ue3D5bmV1I5wFALVZ7h/CQyHbWYrLSIPVsA hlJ3TNiSHWOcTCUnvw/tabMF3l/skxA= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a63:1402:0:b0:5bd:bcde:c677 with SMTP id u2-20020a631402000000b005bdbcdec677mr4120679pgl.2.1701469448566; Fri, 01 Dec 2023 14:24:08 -0800 (PST) Date: Fri, 1 Dec 2023 14:24:06 -0800 In-Reply-To: <20231129153250.3105359-1-arnd@kernel.org> Mime-Version: 1.0 References: <20231129153250.3105359-1-arnd@kernel.org> Message-ID: Subject: Re: [PATCH] KVM: guest-memfd: fix unused-function warning From: Sean Christopherson To: Arnd Bergmann Cc: Paolo Bonzini , Yu Zhang , Isaku Yamahata , Chao Peng , "Kirill A. Shutemov" , Arnd Bergmann , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 01 Dec 2023 14:24:17 -0800 (PST) On Wed, Nov 29, 2023, Arnd Bergmann wrote: > From: Arnd Bergmann > > With migration disabled, one function becomes unused: > > 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, > | ^~~~~~~~~~~~~~~~~~~~~~ > > Replace the #ifdef around the reference with a corresponding PTR_IF() check > that lets the compiler know how it is otherwise used. > > Fixes: a7800aa80ea4 ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory") > Signed-off-by: Arnd Bergmann > --- > virt/kvm/guest_memfd.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c > index 16d58806e913..1a0355b95379 100644 > --- a/virt/kvm/guest_memfd.c > +++ b/virt/kvm/guest_memfd.c > @@ -301,9 +301,8 @@ static int kvm_gmem_error_folio(struct address_space *mapping, > > static const struct address_space_operations kvm_gmem_aops = { > .dirty_folio = noop_dirty_folio, > -#ifdef CONFIG_MIGRATION > - .migrate_folio = kvm_gmem_migrate_folio, > -#endif > + .migrate_folio = PTR_IF(IS_ENABLED(CONFIG_MIGRATION), > + kvm_gmem_migrate_folio), I'd much prefer to just delete the #ifdef, e.g. so that we don't somehow end up running fallback_migrate_folio(). I have no clue why I wrapped the hook with CONFIG_MIGRATION.