virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Andrew Morton <akpm@osdl.org>, Petr Vandrovec <petr@vmware.com>,
	Chaz Masden <zamsden@gmail.com>,
	Virtualization Mailing List <virtualization@lists.osdl.org>,
	Chris Wright <chrisw@sous-sol.org>, Andi Kleen <ak@muc.de>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [RFC, PATCH 2/5] Paravirt_ops patch bugs.patch
Date: Thu, 19 Apr 2007 22:28:52 -0700	[thread overview]
Message-ID: <46284F94.7010901@vmware.com> (raw)
In-Reply-To: <46284D4C.1070007@goop.org>

Jeremy Fitzhardinge wrote:
> Zachary Amsden wrote:
>   
>> Jeremy Fitzhardinge wrote:
>>     
>>> Zachary Amsden wrote:
>>>  
>>>       
>>>> Failing to patch because not enough space is available for a call or
>>>> jump
>>>> or because the site clobbers do not allow the target clobbers to fit is
>>>> a fatal error; it means the kernel can not be properly virtualized.
>>>>       
>>>>         
>>> No, that doesn't follow.  If the original site was:
>>>
>>> patchable_start:
>>>     push %eax
>>>     push %ecx
>>>     push %edx
>>>     call *paravirt_ops + thingy
>>>     pop
>>>     pop
>>>     pop
>>> patchable_end:
>>>
>>> then its perfectly OK to leave it as-is, even if the direct call's
>>> destination clobbers are mismatched.  If the patcher wants to generate a
>>> call to a C function in a context which can't deal with normal C calling
>>> conventions, then it needs to also patch in appropriate save/restores.
>>>   
>>>       
>> The example is a bit misconstrued.  In this case, the clobbers for the
>> patchable region are CLBR_ALL - so there is no possibility of mismatch
>> because of expanded clobber list.
>>     
>
> In my example, it would be CLBR_NONE, meaning that the surrounding code
> expects no registers to be clobbered.  We have constructions like this
> for paravirt_ops calls in entry.S, in contexts where no clobbers are
> acceptable, let alone normal C calls.
>
>   
>> If the patchable region consisted of this, it would be bad:
>>
>>    push %eax
>>    push %ecx
>> patchable_start:
>>    push %edx
>>    call *paravirt_ops + thingy
>>    pop
>> patchable_end: (note - site clobber EDX ok)
>>    pop
>>    pop
>>
>>
>> But, why would you do that?
>>     
>
> We have done that in the past, to give the inlined code free access to
> some scratch registers, but without clobbering everything.
>   

Yes, we still do that, but..


>> Calls through paravirt_ops function pointers are C function calls. 
>> Failing to provide a patchable region which can make a C function call
>> is a BUG().
>>     
>
> That's not the case at the moment.
>   

All of the patch sites can make C function calls, perhaps with fewer 
clobbers.  If the implementation cannot fit a proper save / restore and 
call to the C function into the allotted space, it still is a BUG().  If 
it has unique clobber requirements which go beyond the patch site 
clobbers, surely it can't use the generic patch code for those 
operations.  But it still must have the space.

Zach

      reply	other threads:[~2007-04-20  5:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20  1:52 [RFC, PATCH 2/5] Paravirt_ops patch bugs.patch Zachary Amsden
2007-04-20  4:39 ` Jeremy Fitzhardinge
2007-04-20  5:09   ` Zachary Amsden
2007-04-20  5:19     ` Jeremy Fitzhardinge
2007-04-20  5:28       ` Zachary Amsden [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46284F94.7010901@vmware.com \
    --to=zach@vmware.com \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=chrisw@sous-sol.org \
    --cc=jeremy@goop.org \
    --cc=mingo@elte.hu \
    --cc=petr@vmware.com \
    --cc=virtualization@lists.osdl.org \
    --cc=zamsden@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).