Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp568200imn; Wed, 3 Aug 2022 16:04:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR7qI6E4Gwj+KN36cVijngJByG7sCl13WihZ/fKuqX40q5uzR9MOGJ3kjcqm4CZzlGq2rci8 X-Received: by 2002:a17:90b:4b91:b0:1f4:e116:8f1 with SMTP id lr17-20020a17090b4b9100b001f4e11608f1mr7334279pjb.121.1659567860711; Wed, 03 Aug 2022 16:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659567860; cv=none; d=google.com; s=arc-20160816; b=ZECse19BeU+pPId2aemyVN5Yg0Bk6+tRqiltU/d9HE5fbB0PLIYkJqIk64EZ0RfJfY QSryolxHs4F3bkjAV+4LyKpvSnO0LeHCiTS0ccPRVDGgbxsKUAKdKlZnx9pWc0ooLvs9 xoXJbNRyv7fh3ODsKqSvVLPwjswNbVx45tUmyax0i71qdKM02LmUMQkZQwgwPQ4nWxTp BhNizIvO2J3BeZegQ81rAiDQu4BYbyWHyuU0oXwxekDWdy/oEWiQaIu6E4mq61bsKrge xaFBYYn02cFG2cb6bVkOdWTFZyak9xsnGH11QlJIu9N1dY/otgepmWVHcPznSujFQNOk ZHvQ== 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:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=oBCv022ttB7721Z3didtrTXQbQIFya4DDNpwzpvFOME=; b=sLdfXwVKYrqjjMefBE8V2UCvr+RuyuVNLeS7Qaj7PtvVD8PN3FL55irIMvKPWmavtE dyUkxajeN6aoIi8IloeDJOBzU4HFCcnStM2PH1ZOPJxq/SFy1LQE48mfXCcp1/0241AL ciWs3ZeVwFFhwyFU/vC0CNEWY4+hgagqo6NcuTAR/6JMdo6Q1NROBQpSIAVyti0idnzy SYeh4sF/uQ5DFwB4BlYNhPBobt78wqPX7pY1o+6U05axcQQGp8aLPK2aDL8wALkKtYXS P5lx1ihSjxmYCM6O7Min3Xdb/aq3bKpjyd7vWRAf2b64ebiWEaJS7marnju8hqnfoBdG /c5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nRGmFYXY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id om17-20020a17090b3a9100b001f2c9c64006si3776399pjb.0.2022.08.03.16.04.06; Wed, 03 Aug 2022 16:04:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nRGmFYXY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238354AbiHCWuI (ORCPT + 99 others); Wed, 3 Aug 2022 18:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238115AbiHCWuF (ORCPT ); Wed, 3 Aug 2022 18:50:05 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 137702AC52 for ; Wed, 3 Aug 2022 15:50:04 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id o18-20020a17090aac1200b001f3252af009so1760935pjq.7 for ; Wed, 03 Aug 2022 15:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:reply-to:from:to:cc; bh=oBCv022ttB7721Z3didtrTXQbQIFya4DDNpwzpvFOME=; b=nRGmFYXYob2GdMUmzVPtyDqEUR4f1txFj3eI4VVHWcJD5TA26Ng57GTnR4wknp5irR 0OjY1XipvycfJdRNf4cc71TTbsTPrBJeUVhTaCTBop1TxwnSpeZOMIPzmYbk8/os/5H2 dZGzbuS51W74pjnEjrCc420YzLoWTRHYj3jfXF2zQ0Sxqd7lA2Vc9qoeRkuYRxytuf4B wC87A7OWoSqN281vU9v6pWnZog8E6ukhTBQTVMdRgoOdiosuA/Wmy0a3Fxj8wrqdhsDu 5GzDArttSXC1Av+hAzUYdVU5L2QaGTQvgtdlS6A8hDClbG1w3kyjHoNyZ8+b2nY0kvAs WPqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc; bh=oBCv022ttB7721Z3didtrTXQbQIFya4DDNpwzpvFOME=; b=MEs94EAz7DQk/kJz+U+uIYcbKty52i6gU78DvPZfTJe5hdCJOvQPjf+Y4/4jsyTL4K A0ecWcynwpgFrkBrGxWIDrLQ4HzFoJYXGCy2eIxRBHUKVw9NE/SNx1+8CG1cgzXACD3g t29+zkeVW4QTF8UVV2dzfefFpx9d9cPZmOi4ojR6SBSeuTpFjiEhxV+ATZO7GutRWifF svjhGxYz543ySssgO3rk3XnP7Sr0+glOICpF3cYJ3sgFv40SPNNfXkW7iFTlfV8uhFxk We5vRO+Dk3VsdkLCLH7PyZdMRp+y3QV7e2DcxC0SrGrK5g1/dCLUd30mNZRBbMLa3ml1 wzBA== X-Gm-Message-State: ACgBeo1cNmfOjcQa8zmlQUy8W4UJMUw7bBnxN7eKy4k7OkNrdKK4zvzw aRaSOtakOdOtJTDSvAM4ohnpBDoAJxw= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a00:2303:b0:52e:526e:10e3 with SMTP id h3-20020a056a00230300b0052e526e10e3mr2678199pfh.77.1659567003637; Wed, 03 Aug 2022 15:50:03 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 3 Aug 2022 22:49:55 +0000 In-Reply-To: <20220803224957.1285926-1-seanjc@google.com> Message-Id: <20220803224957.1285926-2-seanjc@google.com> Mime-Version: 1.0 References: <20220803224957.1285926-1-seanjc@google.com> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog Subject: [PATCH v2 1/3] KVM: x86: Tag kvm_mmu_x86_module_init() with __init From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Kai Huang , Michael Roth , Tom Lendacky Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mark kvm_mmu_x86_module_init() with __init, the entire reason it exists is to initialize variables when kvm.ko is loaded, i.e. it must never be called after module initialization. Fixes: 1d0e84806047 ("KVM: x86/mmu: Resolve nx_huge_pages when kvm.ko is loaded") Cc: stable@vger.kernel.org Reviewed-by: Kai Huang Tested-by: Michael Roth Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/mmu/mmu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index e8281d64a431..5ffa578cafe1 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1704,7 +1704,7 @@ static inline int kvm_arch_flush_remote_tlb(struct kvm *kvm) #define kvm_arch_pmi_in_guest(vcpu) \ ((vcpu) && (vcpu)->arch.handling_intr_from_guest) -void kvm_mmu_x86_module_init(void); +void __init kvm_mmu_x86_module_init(void); int kvm_mmu_vendor_module_init(void); void kvm_mmu_vendor_module_exit(void); diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 3e1317325e1f..bf808107a56b 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -6700,7 +6700,7 @@ static int set_nx_huge_pages(const char *val, const struct kernel_param *kp) * nx_huge_pages needs to be resolved to true/false when kvm.ko is loaded, as * its default value of -1 is technically undefined behavior for a boolean. */ -void kvm_mmu_x86_module_init(void) +void __init kvm_mmu_x86_module_init(void) { if (nx_huge_pages == -1) __set_nx_huge_pages(get_nx_auto_mode()); -- 2.37.1.559.g78731f0fdb-goog