virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kernellwp@gmail.com, linux-s390@vger.kernel.org,
	benh@kernel.crashing.org, jgross@suse.com, kvm@vger.kernel.org,
	peterz@infradead.org, Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>,
	will.deacon@arm.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, mingo@redhat.com,
	paulus@samba.org, mpe@ellerman.id.au,
	xen-devel-request@lists.xenproject.org,
	paulmck@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org,
	boqun.feng@gmail.com
Subject: Re: [PATCH v4 5/5] x86, kvm: support vcpu preempted check
Date: Mon, 24 Oct 2016 17:14:18 +0200	[thread overview]
Message-ID: <20161024151417.GC2247@potion> (raw)
In-Reply-To: <c00e636e-ea06-6bbb-6a67-39804ee8ba75@redhat.com>

2016-10-24 16:39+0200, Paolo Bonzini:
> On 19/10/2016 19:24, Radim Krčmář wrote:
>>> > +	if (vcpu->arch.st.msr_val & KVM_MSR_ENABLED)
>>> > +		if (kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.st.stime,
>>> > +					&vcpu->arch.st.steal,
>>> > +					sizeof(struct kvm_steal_time)) == 0) {
>>> > +			vcpu->arch.st.steal.preempted = 1;
>>> > +			kvm_write_guest_cached(vcpu->kvm, &vcpu->arch.st.stime,
>>> > +					&vcpu->arch.st.steal,
>>> > +					sizeof(struct kvm_steal_time));
>>> > +		}
>> Please name this block of code.  Something like
>>   kvm_steal_time_set_preempted(vcpu);
> 
> While at it:
> 
> 1) the kvm_read_guest_cached is not necessary.  You can rig the call to
> kvm_write_guest_cached so that it only writes vcpu->arch.st.steal.preempted.

I agree.  kvm_write_guest_cached() always writes from offset 0, so we'd
want a new function that allows to specify a starting offset.

Using cached vcpu->arch.st.steal to avoid the read wouldn't be as good.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2016-10-24 15:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1476872416-42752-1-git-send-email-xinhui.pan@linux.vnet.ibm.com>
2016-10-19  6:47 ` [PATCH v4 0/5] implement vcpu preempted check Christian Borntraeger
2016-10-19 16:57   ` Pan Xinhui
2016-10-19 10:20 ` [PATCH v4 1/5] kernel/sched: introduce vcpu preempted check interface Pan Xinhui
2016-10-19 10:20 ` [PATCH v4 2/5] locking/osq: Drop the overload of osq_lock() Pan Xinhui
2016-10-19 10:20 ` [PATCH v4 3/5] kernel/locking: Drop the overload of {mutex, rwsem}_spin_on_owner Pan Xinhui
2016-10-19 10:20 ` [PATCH v4 4/5] powerpc/spinlock: support vcpu preempted check Pan Xinhui
2016-10-19 10:20 ` [PATCH v4 5/5] x86, kvm: " Pan Xinhui
2016-10-19 17:24   ` Radim Krčmář
2016-10-19 18:45     ` Pan Xinhui
2016-10-24 14:39     ` Paolo Bonzini
     [not found]     ` <c00e636e-ea06-6bbb-6a67-39804ee8ba75@redhat.com>
2016-10-24 15:14       ` Radim Krčmář [this message]
2016-10-24 15:18         ` Paolo Bonzini
     [not found]         ` <1a556fcf-e071-8c32-7a4b-ca7a2ffc17e9@redhat.com>
2016-10-25  1:25           ` Pan Xinhui
2016-10-19 15:58 ` [PATCH v4 0/5] implement " Juergen Gross
     [not found] ` <a801cd40-1019-01e2-1013-f04363fc7f31@suse.com>
2016-10-19 17:08   ` Pan Xinhui

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=20161024151417.GC2247@potion \
    --to=rkrcmar@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=boqun.feng@gmail.com \
    --cc=jgross@suse.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=will.deacon@arm.com \
    --cc=xen-devel-request@lists.xenproject.org \
    --cc=xinhui.pan@linux.vnet.ibm.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).