[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87wnmg7bt0.ffs@tglx>
Date: Thu, 14 Oct 2021 01:19:23 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Josh Poimboeuf <jpoimboe@...hat.com>,
Borislav Petkov <bp@...en8.de>
Cc: Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
Paolo Bonzini <pbonzini@...hat.com>,
David Hildenbrand <david@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Juergen Gross <jgross@...e.com>, Deep Shah <sdeep@...are.com>,
VMware Inc <pv-drivers@...are.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, Peter H Anvin <hpa@...or.com>,
Dave Hansen <dave.hansen@...el.com>,
Tony Luck <tony.luck@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
Sean Christopherson <seanjc@...gle.com>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v10 03/11] x86/cpufeatures: Add TDX Guest CPU feature
On Wed, Oct 13 2021 at 12:42, Josh Poimboeuf wrote:
> On Wed, Oct 13, 2021 at 10:18:18AM +0200, Borislav Petkov wrote:
>> > +#include <asm/tdx.h>
>> > +
>> > +bool is_tdx_guest(void)
>> > +{
>> > + static int tdx_guest = -1;
>>
>> Put that one at the top of the file because such static variables do not
>> belong among the automatic function vars.
>
> I disagree, this prevents confusion and misuse by making it clear that
> the scope of the static variable is limited to this function.
I kinda agree under the assumption that a static variable is only used
in a particular context and there is a reasonable requirement to do so.
The above does not qualify as I pointed out in my other reply. Just
because it looks like strict local usage at the first glance does not
make an argument, really.
I'm amazed that it's so hard to see that this
use()
init()
pattern is broken to begin with.
So why are you arguing about the placement of this variable in the first
place instead of actually looking at the code, wondering about the
obscenity and then asking about the call ordering?
In case that I might miss something important here due to my lack of CS
education, please let me know.
Thanks,
tglx
Powered by blists - more mailing lists