All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Juergen Gross <jgross@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Razvan Cojocaru <rcojocaru@bitdefender.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] SVM: re-work VMCB sync-ing
Date: Thu, 26 Apr 2018 13:27:06 -0400	[thread overview]
Message-ID: <ffee395f-cb72-cf98-c501-abb753460bf7@oracle.com> (raw)
In-Reply-To: <5AE1F65C02000078001BEE1E@prv1-mh.provo.novell.com>

On 04/26/2018 11:55 AM, Jan Beulich wrote:
>>>> On 26.04.18 at 17:20, <boris.ostrovsky@oracle.com> wrote:
>> On 04/26/2018 09:33 AM, Jan Beulich wrote:
>>>>> -static void svm_sync_vmcb(struct vcpu *v)
>>>>> +static void svm_sync_vmcb(struct vcpu *v, enum vmcb_sync_state new_state)
>>>>>  {
>>>>>      struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
>>>>>  
>>>>> -    if ( arch_svm->vmcb_in_sync )
>>>>> -        return;
>>>>> -
>>>>> -    arch_svm->vmcb_in_sync = 1;
>>>>> +    if ( arch_svm->vmcb_sync_state == vmcb_needs_vmsave )
>>>>> +        svm_vmsave(arch_svm->vmcb);
>>>>>  
>>>>> -    svm_vmsave(arch_svm->vmcb);
>>>>> +    if ( arch_svm->vmcb_sync_state != vmcb_needs_vmload )
>>>>> +        arch_svm->vmcb_sync_state = new_state;
>>>> This is slightly awkward for a couple of reasons.  First, passing
>>>> vmcb_in_sync in forget the fact that a vmload is needed.
>>> Certainly not - that's the purpose of the if() around it.
>>>
>>>> In my patch, I introduced svm_sync_vmcb_for_update(), rather than
>>>> requiring a parameter to be passed in.  I think this is a better API,
>>>> and it shrinks the size of the patch.
>>> I'm not convinced of the "better", and even less so of the "shrinks". But
>>> I'll wait to see what the SVM maintainers say.
>>
>> I think a single function is better. In fact, I was wondering whether
>> svm_vmload() could also be folded into svm_sync_vmcb() since it is also
>> a syncing operation.
> That doesn't look like it would produce a usable interface: How would
> you envision the state transition to be specified by the caller? Right
> now the intended new state gets passed in, but in your model
> vmcb_in_sync could mean either vmload or vmsave is needed. The
> two svm_vmload() uses right now would pass that value in addition
> to the svm_sync_vmcb() calls already doing so. And the function
> couldn't tell what to do from the current state (if it's
> vmcb_needs_vmload, a load is only needed in the cases where
> svm_vmload() is called right now). Adding a 3rd parameter or a
> second enum 

I was thinking about another enum value, e.g. sync_to_cpu (and
sync_to_vmcb replacing vmcb_needs_vmsave).

This will allow us to hide (v->arch.hvm_svm.vmcb_sync_state ==
vmcb_needs_vmload) test.


-boris


> doesn't look like a good idea either. But maybe I'm not
> seeing your intentions; I'm certainly open to (more specific)
> suggestions.
>
> Jan
>
>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-04-26 17:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 12:01 [PATCH] SVM: re-work VMCB sync-ing Jan Beulich
2018-04-26 12:43 ` Andrew Cooper
2018-04-26 13:33   ` Jan Beulich
2018-04-26 15:20     ` Boris Ostrovsky
2018-04-26 15:55       ` Jan Beulich
2018-04-26 17:27         ` Boris Ostrovsky [this message]
2018-04-27 15:52           ` Jan Beulich
2018-04-27 18:29             ` Boris Ostrovsky
2018-04-30  7:46               ` Jan Beulich

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=ffee395f-cb72-cf98-c501-abb753460bf7@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jgross@suse.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.