From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88347C3A5A7 for ; Thu, 1 Dec 2022 23:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tMfp9ejIYmd8E1nihrFPBoYlNvC6iq3W1PJ8XHT1ZLI=; b=OUQ0lICKjSahDH JrxgfnBog3HoY+xaK4Dj3uehPS3FWJuVAPsi8zE4jYQ83+KpoQl/sN8aceI6quAvbgsQoHopSWTnJ GCIJ/kcnTxqp+hNSFUDdYSFxAyPClI7nF1OFMaGjUjVH9zJTMh1ZRrGq3scvjrAgFnH1ZjlFoff9r xVkbYvJSkX5AIpmB5gwwBIywdKm0SJjAyEH5Nq+6HwOfVQYAgjdiwJxtefvEfe3ESSz3J/gIYduVq W28Jnnq6V2YN+VllfwIA/PDLB7WebDGWujJ2fiJvHRV0+AobKwca4161fhM5hdKyVGvGJXMb12MmS BkNLDkykoIXldDvH4eBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0swO-00Bf4P-Cu; Thu, 01 Dec 2022 23:26:04 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0sMj-00BR3V-4Q for linux-arm-kernel@lists.infradead.org; Thu, 01 Dec 2022 22:49:15 +0000 Received: by mail-pj1-x1031.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso6654268pjt.0 for ; Thu, 01 Dec 2022 14:49:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=mKF7ACqUicTgwRFQrz4oBsMFvmn+mRrenbI3VwK9VtA=; b=Lo1VVBU0quIBqwSjUL/IX6jsQ3Rcbq3kNXFx1b09LmjnR9bQqqs8Qnjl452IWYkBSY P1KTyvwrHEdLgoshrms0r4SI8z1ngo83OqCHRxrURyBE+yArcM+Cs5TCeq44GobVkF0m IuDj+iWRP2zVVwjI1HJslgwJO64iafu01Owc+4A3/mvkEjyzFr8iFAR19fNs0LBLJTf3 Kg1ZIMc5fZ0ipGhmHdhLOXnD8uVTRyQX02DQttBjsyjAKjRvEJFav2gCuZ5FSQ6cpVhK zD3GLCkmoDFgDHZV7t7XBqH0jElTPRdTcydGeJqtHoccQFH5HqfiAwKx6tg04wXmDFCc QADQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mKF7ACqUicTgwRFQrz4oBsMFvmn+mRrenbI3VwK9VtA=; b=moI887TAUhBKgA/0v3HlPyu78LBQyYmzYeTPO+cBgHFXSk75UM+syocWb5HDNTWEP2 V9rgEhVKDKgLcmL6BJAFR5log/sP4QQD+1G00b9waEXvYbGRLlcABPsUt62vfK2ZtUxm v22dpeK6Wdd267O89z4IbNsDkhQIakY6eTASJ0YTo9ivJTpDLF9OwIaDNBgiWGaC/nW2 8eHrcHxme4s3h1LMIXycELy8IBiNOXFxTvEGA8cHzQ0zSNM/9Ikyvuc6uGuaNHniG9J/ +wbk2CxeBgwYSAwNAzr5ZhOYKCzdbaZyP/mLppbt4we6wlG7SaJUAiNFP97c1YkeS++Y +FNg== X-Gm-Message-State: ANoB5pkQ4l1eiN2SpGfJ+CtFAYbv1oBY2gRIpjXL+s4d/uXd5oQuGL5G PLS9jBGXQ9ak26BM4mwpJZpKIg== X-Google-Smtp-Source: AA0mqf4Wt8uYV/bEa16p+0WrrISPwxZH3fHAX4g+Oh8a2UKzOEMh4LEyPBB3ZTgiAtA3/myS/mdVQA== X-Received: by 2002:a17:903:32ce:b0:189:a0eb:4a26 with SMTP id i14-20020a17090332ce00b00189a0eb4a26mr13829305plr.162.1669934951343; Thu, 01 Dec 2022 14:49:11 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id c73-20020a624e4c000000b0056bc742d21esm3854175pfb.176.2022.12.01.14.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 14:49:10 -0800 (PST) Date: Thu, 1 Dec 2022 22:49:06 +0000 From: Sean Christopherson To: Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= Cc: Paolo Bonzini , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Matthew Rosato , Eric Farman , Vitaly Kuznetsov , David Woodhouse , Paul Durrant , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Atish Patra , David Hildenbrand , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Yao , Cornelia Huck , Isaku Yamahata , Fabiano Rosas , Michael Ellerman , Kai Huang , Chao Gao , Thomas Gleixner Subject: Re: [PATCH v2 21/50] KVM: MIPS: Hardcode callbacks to hardware virtualization extensions Message-ID: References: <20221130230934.1014142-1-seanjc@google.com> <20221130230934.1014142-22-seanjc@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221201_144913_197879_9CBFD9D2 X-CRM114-Status: GOOD ( 21.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Dec 01, 2022, Philippe Mathieu-Daud=E9 wrote: > On 1/12/22 00:09, Sean Christopherson wrote: > > Now that KVM no longer supports trap-and-emulate (see commit 45c7e8af4a= 5e > > "MIPS: Remove KVM_TE support"), hardcode the MIPS callbacks to the > > virtualization callbacks. > > = > > Harcoding the callbacks eliminates the technically-unnecessary check on > > non-NULL kvm_mips_callbacks in kvm_arch_init(). MIPS has never support= ed > > multiple in-tree modules, i.e. barring an out-of-tree module, where > > copying and renaming kvm.ko counts as "out-of-tree", KVM could never > > encounter a non-NULL set of callbacks during module init. > > = > > The callback check is also subtly broken, as it is not thread safe, > > i.e. if there were multiple modules, loading both concurrently would > > create a race between checking and setting kvm_mips_callbacks. > > = > > Given that out-of-tree shenanigans are not the kernel's responsibility, > > hardcode the callbacks to simplify the code. > > = > > Signed-off-by: Sean Christopherson > > --- > > arch/mips/include/asm/kvm_host.h | 2 +- > > arch/mips/kvm/Makefile | 2 +- > > arch/mips/kvm/callback.c | 14 -------------- > > arch/mips/kvm/mips.c | 9 ++------- > > arch/mips/kvm/vz.c | 7 ++++--- > > 5 files changed, 8 insertions(+), 26 deletions(-) > > delete mode 100644 arch/mips/kvm/callback.c > > = > > diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/k= vm_host.h > > index 28f0ba97db71..2803c9c21ef9 100644 > > --- a/arch/mips/include/asm/kvm_host.h > > +++ b/arch/mips/include/asm/kvm_host.h > > @@ -758,7 +758,7 @@ struct kvm_mips_callbacks { > > void (*vcpu_reenter)(struct kvm_vcpu *vcpu); > > }; > > extern struct kvm_mips_callbacks *kvm_mips_callbacks; > = > IIUC we could even constify this pointer. Good point. Protecting the pointer itself is a bit gross, but it is a nice stopgap until the callbacks are gone. I'll fold this in. Thanks! extern const struct kvm_mips_callbacks * const kvm_mips_callbacks; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel