Re: [PATCH RFC REPOST 1/2] paravirt: refactor struct paravirt_ops into smaller pv_*_ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Huh, thought I did a more complete reply to this.  Must have farted on it.

Rusty Russell wrote:
> Thanks Jeremy, I've actually taken time to finally review this in detail (I'm 
> assuming you'll refactor as necessary after the x86 arch merger).
>   

Yep.

>> +struct paravirt_ops paravirt_ops;
>> +
>>     
>
> Do you actually need to define this?  See below...
>
>   
>> +DEF_NATIVE(, ud2a, "ud2a");
>>     
>
> Hmm, that's ugly.  It was ugly before, but it's uglier now.  Maybe just 
> use "unsigned char ud2a[] = { 0x0f, 0x0b };" in paravirt_patch_default?
>   

Yeah, its not pretty.  I'll have another go.

>>  }
>>
>>  struct paravirt_ops paravirt_ops = {
>>     
> ...
>   
>> +	.pv_info = {
>> +		.name = "bare hardware",
>> +		.paravirt_enabled = 0,
>> +		.kernel_rpl = 0,
>> +		.shared_kernel_pmd = 1,	/* Only used when CONFIG_X86_PAE is set */
>> +	},
>>     
>
> This is the bit I don't get.  Why not just declare struct pv_info pvinfo, etc, 
> and use the declaration of struct paravirt_ops to get your unique 
> offset-based identifiers for patching?
>   

Given an op id number in .parainstructions, the patching code needs to
be able to index into something to get the corresponding function
pointer.  If each pv_* structure is its own little unrelated structure,
then the id has to be a <structure, id> tuple, which just complicates
things.  If I pack them all into a single structure then it becomes a
simple offset calculation.

That said, there's no need for pv_info to be in that structure, since it
contains no function pointers.  I'll move it out.

    J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux