lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zgrc7clg.ffs@tglx>
Date:   Thu, 14 Oct 2021 01:02:19 +0200
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Sathyanarayanan Kuppuswamy 
        <sathyanarayanan.kuppuwamy@...ux.intel.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>,
        Josh Poimboeuf <jpoimboe@...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 15:28, Sathyanarayanan Kuppuswamy wrote:
> On 10/13/21 2:37 PM, Borislav Petkov wrote:
>> On Wed, Oct 13, 2021 at 11:25:35PM +0200, Thomas Gleixner wrote:
>>> So this ends up in doing:
>>>
>>>     use();
>>>     init();
>>>
>>> Can you spot what's wrong with that?
>>>
>>> That's a clear violation of common sense and is simply not going to
>>> happen. Why? If you think about deep defensive programming then use()
>>> will look like this:
>>>
>>> use()
>>> {
>>>          assert(initialized);
>>> }
>>>
>>> which is not something made up. It's a fundamental principle of
>>> programming and some languages enforce that for very good reasons.
>>>
>>> Just because it can be done in C is no justification.
>> Oh, I heartily agree.
>>   
>>> What's wrong with:
>>>
>>> x86_64_start_kernel()
>>>
>>>      tdx_early_init();
>>>
>>>      copy_bootdata();
>>>      
>>>      tdx_late_init();
>>>
>>> Absolutely nothing. It's clear, simple and well defined.
>> I like simple more than anyone, so sure, I'd prefer that a lot more.
>>
>> And so the options parsing would need to happen early using, say,
>> cmdline_find_option() or so, like sme_enable() does.
>
> Since in tdx_early_init() all we are going to do is to initialize
> "tdx_guest_detected" using cpuid call, shall we name it
> tdx_guest_cpuid_init()? (similar to sme_enable call in AMD)

How is that similar?

Just chose a name which makes sense in the overall scheme. I surely care
about naming convetions, but what I care more about is correctness.

Whether it ends up being named

        tdx_enable() - to match the SME muck

or

        tdx_detect()

or whatever makes sense does not really matter. As long as it makes
sense. That's bikeshed painting realm.

Coming back to your suggestion 'tdx_guest_cpuid_init()'. Just sit back
and think about what that name says:

    tdx_guest_cpuid_init()

For the uniformed reader this says:

    If tdx guest then initialize CPUID

which is obviously not what you want to express, right?

So, naming matters but you are free to chose something which makes
sense.

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ