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 F1279C433FE for ; Fri, 18 Feb 2022 17:33:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238653AbiBRRd5 (ORCPT ); Fri, 18 Feb 2022 12:33:57 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238656AbiBRRdy (ORCPT ); Fri, 18 Feb 2022 12:33:54 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9EF72B6201 for ; Fri, 18 Feb 2022 09:33:33 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id y11so2814827pfi.11 for ; Fri, 18 Feb 2022 09:33:33 -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=DawLCXzSIgJxif3UfQrpoVCzlIzEfJYQjJYMKzO/mqA=; b=bVtGhZHOXdLJk0W06wRc9uBcovqXbMoH9SqzLAvel4sB4lBTQjw7M+OF4TKBMmyGpd VZ/esSYZsMef1kAycskE8+oPeO0CeUlBe+quQFZIqu/IFDww5w079ABI/XtovZhxkRGW IuThUHhMGXXFTvwNs75R2kKB5jWMld9KxT41vzdc0bcQVVPCAjVMzBhEJHNYDFbrWKQc UDUqSnPWoV42JOduUdC8T/vrnRceCTEygns9/GZ/MJwSXf5qNgflqtqYuF83JGGgOVo3 3y/NrHemd63hmx/NTjNxMNVohpgFhYd4TaA+GaK+jQ8seJP5ab0qPPhRZHSrRsDKRgq7 XaJg== 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=DawLCXzSIgJxif3UfQrpoVCzlIzEfJYQjJYMKzO/mqA=; b=AOJsapL/ngoIqLTrMYSjk4m5XK2kUDAxD9Y9TAr8JqK7hpRktEN0ZAlGLfymL5VOs/ EA2z2o18+8tGelIUm0MT0hNT1zb9DcWR8riXDbNOenhdfNw6+4BfqxDZtkgm6IoxRHKF uCfmZRFBXt2Vgu1m5jr+0qJiwd/EzD5QNBgFRpAwwhFTU8VM7pL+ve8H4/IS2owj4LQY OzvdpcEnhpi+Bcdv2XnnEoLyU5LLWs6Jj4wsOH6ubtAM5MKY8y0JM0yM3Ob5zlhenOWi c68b2/m0+ViSYXCGrL6VqSVnVHrhfGHx/lv/zug5eHVrVfrzShs2FvtUpESqqqZTd3xj tgyg== X-Gm-Message-State: AOAM532XClZ/VDdaN7wt2hl7Ynd3Fddby/HJg6gsnjhY7PQ6eOlQHuGX GNs2Tj+PskvcgT8z64lG+MTCmA== X-Google-Smtp-Source: ABdhPJw5eWTs2BTk05UmURA54Db71bx4mjZ+FpOAoAe2XOR2qvF9PrePoJKMFqLR+3MSyalzpy67vw== X-Received: by 2002:a63:560a:0:b0:373:bd8f:bb6f with SMTP id k10-20020a63560a000000b00373bd8fbb6fmr5401620pgb.33.1645205613073; Fri, 18 Feb 2022 09:33:33 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id e3sm8534386pga.74.2022.02.18.09.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 09:33:32 -0800 (PST) Date: Fri, 18 Feb 2022 17:33:28 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v3 6/6] KVM: x86: allow defining return-0 static calls Message-ID: References: <20220217180831.288210-1-pbonzini@redhat.com> <20220217180831.288210-7-pbonzini@redhat.com> <8f99a6a2-b64e-0211-a7d3-8b84c668a92f@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8f99a6a2-b64e-0211-a7d3-8b84c668a92f@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 18, 2022, Paolo Bonzini wrote: > On 2/18/22 17:29, Sean Christopherson wrote: > > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > > index ab1c4778824a..d3da64106685 100644 > > > --- a/arch/x86/kvm/x86.c > > > +++ b/arch/x86/kvm/x86.c > > > @@ -131,6 +131,7 @@ struct kvm_x86_ops kvm_x86_ops __read_mostly; > > > DEFINE_STATIC_CALL_NULL(kvm_x86_##func, \ > > > *(((struct kvm_x86_ops *)0)->func)); > > > #define KVM_X86_OP_OPTIONAL KVM_X86_OP > > > +#define KVM_X86_OP_OPTIONAL_RET0 KVM_X86_OP > > > #include > > > EXPORT_STATIC_CALL_GPL(kvm_x86_get_cs_db_l_bits); > > > EXPORT_STATIC_CALL_GPL(kvm_x86_cache_reg); > > > @@ -12016,7 +12017,6 @@ void kvm_arch_flush_shadow_memslot(struct kvm *kvm, > > > static inline bool kvm_guest_apic_has_interrupt(struct kvm_vcpu *vcpu) > > > { > > > return (is_guest_mode(vcpu) && > > > - kvm_x86_ops.guest_apic_has_interrupt && > > > static_call(kvm_x86_guest_apic_has_interrupt)(vcpu)); > > > > Can you opportunistically align the indentation and drop the outer parantheses? I.e. > > > > return is_guest_mode(vcpu) && > > static_call(kvm_x86_guest_apic_has_interrupt)(vcpu); > > Hmm, I like having the parentheses (despite "return not being a function") > because editors are inconsistent in what indentation to use after return. > > Some use a tab (which does the right thing just by chance with Linux because > "return " is as long as a tab is wide), but vim for example does the totally Uh, no, vim inserts a tab. "return " isn't as long as a tab is wide. That's 7 chars, tabs are 8, which is exactly the problem. I'm ok with return (is_guest_mode(vcpu) && static_call(kvm_x86_guest_apic_has_interrupt)(vcpu)); I care more about alignment than unnecessary (), but I'd still prefer return is_guest_mode(vcpu) && static_call(kvm_x86_guest_apic_has_interrupt)(vcpu)); > awkward > > int f() > { > return a && > b; > } > > Of course I can fix the indentation. > > Paolo > > > > } > > > diff --git a/kernel/static_call.c b/kernel/static_call.c > > > index 43ba0b1e0edb..76abd46fe6ee 100644 > > > --- a/kernel/static_call.c > > > +++ b/kernel/static_call.c > > > @@ -503,6 +503,7 @@ long __static_call_return0(void) > > > { > > > return 0; > > > } > > > +EXPORT_SYMBOL_GPL(__static_call_return0) > > > > This doesn't compile, it needs a semicolon. > > >