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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABCF8C433EF for ; Tue, 15 Feb 2022 17:08:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239455AbiBORIX (ORCPT ); Tue, 15 Feb 2022 12:08:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236369AbiBORIU (ORCPT ); Tue, 15 Feb 2022 12:08:20 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DAC811AA1B for ; Tue, 15 Feb 2022 09:08:10 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id d187so35886384pfa.10 for ; Tue, 15 Feb 2022 09:08:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TRcNDUgXoT6OZOBt2+++3rmCdi8tsP1V+jytusJgHpc=; b=dItuKln7xrgOVHkAQ9pjdGpQViJKChs+LxfNttrgJ0Cr7S2Qmt+lYAW8GRGaPy6/P5 IB0o7rRimgAtQJ6piWnoiTIvPalw2BpyCcW4W4CHZKSU9VoeDbDYXDTLRcCa2JcAasY/ aEl6Yy9zYJ0dG3Ub4G1lWT8iM9S4xff0T/QO191ZffmbQYPR3EP6JZ3AaPApvNfEZpBo 1C8yihxT0e3xX8KRlOrF1it+DQYR+sJRhK+66IVvI0x6LWcTruuNFupZFEVihwMjSJc0 VEfKrnSvv0CRb/xNO5g+DggdjuzTvbptWmYTWyET8Os5PSKVmt0mjeSHlx6q0qgYb1ON ptMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TRcNDUgXoT6OZOBt2+++3rmCdi8tsP1V+jytusJgHpc=; b=vuJQFX1yuVjqFDMPXrzH5gWimvpjZbIr13YIgPgNNyzOZdz+47PU1SYF3+OMf0i0Fd zzQNQnNR2J6srjxTt3dECjlWxZTFvMp3bv2I4NujC3vYmty2dwSg4WpazjMoTV1yz2GP 8ucFrXNVYtFOp+Q+cxCwVI6t2SfqW3YlRKkfxhUE7ND+M6zmzR5tBjeQFQ1TsCRisDPf b16koum4+sH9XCtfzCVrdnIjm1b3BEadkM09sU4/Ya94juMbVZAoCucQRKSN7wValnYZ PFXtE+k71EsPCpPOkMrCEsKStaXHP1u76l64Jo2dagxnUn17ttSxnJqzs0fhFVKrUUw2 MOig== X-Gm-Message-State: AOAM530OWOha25W0lIhaiOMrCIKUn2VrbzyeUKlsU3dJnTfhyQHGM6gA L8zLl/VWOPgrj6CwjhvHzVKokA== X-Google-Smtp-Source: ABdhPJzrsZn3NwtaFf5BiKmBjOYmsYtgU/fWcbt/Anm0hsxLEPBoVreh5F9X5rtngmqMyMdHCgZsJQ== X-Received: by 2002:a05:6a00:16d3:: with SMTP id l19mr5227528pfc.7.1644944889854; Tue, 15 Feb 2022 09:08:09 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id k26sm3050425pgl.46.2022.02.15.09.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 09:08:09 -0800 (PST) Date: Tue, 15 Feb 2022 17:08:05 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v2 2/5] KVM: x86: remove KVM_X86_OP_NULL and mark optional kvm_x86_ops Message-ID: References: <20220214131614.3050333-1-pbonzini@redhat.com> <20220214131614.3050333-3-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220214131614.3050333-3-pbonzini@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 14, 2022, Paolo Bonzini wrote: > The original use of KVM_X86_OP_NULL, which was to mark calls > that do not follow a specific naming convention, is not in use > anymore. Instead, let's mark calls that are optional because > they are always invoked within conditionals or with static_call_cond. > Those that are _not_, i.e. those that are defined with KVM_X86_OP, > must be defined by both vendor modules or some kind of NULL pointer > dereference is bound to happen at runtime. > > Signed-off-by: Paolo Bonzini > --- > arch/x86/include/asm/kvm-x86-ops.h | 84 +++++++++++++++--------------- > arch/x86/include/asm/kvm_host.h | 4 +- > arch/x86/kvm/x86.c | 2 +- > 3 files changed, 44 insertions(+), 46 deletions(-) > > diff --git a/arch/x86/include/asm/kvm-x86-ops.h b/arch/x86/include/asm/kvm-x86-ops.h > index 9e37dc3d8863..9415d9af204c 100644 > --- a/arch/x86/include/asm/kvm-x86-ops.h > +++ b/arch/x86/include/asm/kvm-x86-ops.h > @@ -1,25 +1,23 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > -#if !defined(KVM_X86_OP) || !defined(KVM_X86_OP_NULL) > +#if !defined(KVM_X86_OP) || !defined(KVM_X86_OP_OPTIONAL) > BUILD_BUG_ON(1) > #endif > > /* > - * KVM_X86_OP() and KVM_X86_OP_NULL() are used to help generate > + * KVM_X86_OP() and KVM_X86_OP_OPTIONAL() are used to help generate > * "static_call()"s. They are also intended for use when defining > - * the vmx/svm kvm_x86_ops. KVM_X86_OP() can be used for those > - * functions that follow the [svm|vmx]_func_name convention. > - * KVM_X86_OP_NULL() can leave a NULL definition for the > - * case where there is no definition or a function name that > - * doesn't match the typical naming convention is supplied. > + * the vmx/svm kvm_x86_ops. But assuming your veto of actually using kvm-x86-ops to fill vendor ops isn't overriden, they're _not_ "intended for use when defining the vmx/svm kvm_x86_ops." > KVM_X86_OP_OPTIONAL() can be used for those > + * functions that can have a NULL definition, for example if > + * "static_call_cond()" will be used at the call sites. > */