lkml.org 
[lkml]   [2021]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC v2 27/32] x86/tdx: Exclude Shared bit from __PHYSICAL_MASK
From
Date
On 5/20/21 11:48 AM, Kuppuswamy, Sathyanarayanan wrote:
>>>   +/* The highest bit of a guest physical address is the "sharing"
>>> bit */
>>> +phys_addr_t tdg_shared_mask(void)
>>> +{
>>> +    return 1ULL << (td_info.gpa_width - 1);
>>> +}
>>
>> Why not just inline this thing?  Functions don't get any smaller than
>> that.  Or does it not get used anywhere else?  Or are you concerned
>> about exporting td_info?
>
> We don't want to export td_info. It has more information additional to
> shared mask details. Any reason for suggesting to use inline?

My favorite reason is that it eliminates the need for three declarations:
1. An extern for the header
2. A stub for the header
3. The real function in the .c file.

An inline removes two places that might get out of sync in some way and
eliminates the need to check two implementation sites when grepping.

Not in this case, but in general, inlines also result in faster, more
compact code since the compiler has more visibility into what the
function does at its call sites.

Not wanting to export td_info _is_ a reasonable argument, though.

\
 
 \ /
  Last update: 2021-05-20 22:30    [W:0.381 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site