All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: "mihai.caraman@freescale.com" <mihai.caraman@freescale.com>,
	"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 3/6 v2] KVM: PPC: Book3E: Increase FPU laziness
Date: Fri, 04 Jul 2014 07:46:18 +0000	[thread overview]
Message-ID: <53B65BCA.6040200@suse.de> (raw)
In-Reply-To: <bf24ca20f84f449a8781107acaec33d1@BY2PR03MB508.namprd03.prod.outlook.com>


On 03.07.14 17:46, mihai.caraman@freescale.com wrote:
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf@suse.de]
>> Sent: Thursday, July 03, 2014 3:29 PM
>> To: Caraman Mihai Claudiu-B02008; kvm-ppc@vger.kernel.org
>> Cc: kvm@vger.kernel.org; linuxppc-dev@lists.ozlabs.org
>> Subject: Re: [PATCH 3/6 v2] KVM: PPC: Book3E: Increase FPU laziness
>>
>>
>> On 30.06.14 17:34, Mihai Caraman wrote:
>>> Increase FPU laziness by calling kvmppc_load_guest_fp() just before
>>> returning to guest instead of each sched in. Without this improvement
>>> an interrupt may also claim floting point corrupting guest state.
>> How do you handle context switching with this patch applied? During most
>> of the guest's lifetime we never exit kvmppc_vcpu_run(), so when the
>> guest gets switched out all FPU state gets lost?
> No, we had this discussion in ver 1. The FP/VMX/VSX is implemented lazy in
> the kernel i.e. the unit state is not saved/restored until another thread
> that once claimed the unit is sched in.
>
> Since FP/VMX/VSX can be activated by the guest independent of the host, the
> vcpu thread is always using the unit (even if it did not claimed it once).
>
> Now, this patch optimize the sched in flow. Instead of checking on each vcpu
> sched in if the kernel unloaded unit's guest state for another competing host
> process we do this when we enter the guest.

But we only do it when we enter the guest from QEMU, not when we enter 
the guest after a context switch on cond_resched(), no?


Alex


WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: "mihai.caraman@freescale.com" <mihai.caraman@freescale.com>,
	"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 3/6 v2] KVM: PPC: Book3E: Increase FPU laziness
Date: Fri, 04 Jul 2014 09:46:18 +0200	[thread overview]
Message-ID: <53B65BCA.6040200@suse.de> (raw)
In-Reply-To: <bf24ca20f84f449a8781107acaec33d1@BY2PR03MB508.namprd03.prod.outlook.com>


On 03.07.14 17:46, mihai.caraman@freescale.com wrote:
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf@suse.de]
>> Sent: Thursday, July 03, 2014 3:29 PM
>> To: Caraman Mihai Claudiu-B02008; kvm-ppc@vger.kernel.org
>> Cc: kvm@vger.kernel.org; linuxppc-dev@lists.ozlabs.org
>> Subject: Re: [PATCH 3/6 v2] KVM: PPC: Book3E: Increase FPU laziness
>>
>>
>> On 30.06.14 17:34, Mihai Caraman wrote:
>>> Increase FPU laziness by calling kvmppc_load_guest_fp() just before
>>> returning to guest instead of each sched in. Without this improvement
>>> an interrupt may also claim floting point corrupting guest state.
>> How do you handle context switching with this patch applied? During most
>> of the guest's lifetime we never exit kvmppc_vcpu_run(), so when the
>> guest gets switched out all FPU state gets lost?
> No, we had this discussion in ver 1. The FP/VMX/VSX is implemented lazy in
> the kernel i.e. the unit state is not saved/restored until another thread
> that once claimed the unit is sched in.
>
> Since FP/VMX/VSX can be activated by the guest independent of the host, the
> vcpu thread is always using the unit (even if it did not claimed it once).
>
> Now, this patch optimize the sched in flow. Instead of checking on each vcpu
> sched in if the kernel unloaded unit's guest state for another competing host
> process we do this when we enter the guest.

But we only do it when we enter the guest from QEMU, not when we enter 
the guest after a context switch on cond_resched(), no?


Alex

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: "mihai.caraman@freescale.com" <mihai.caraman@freescale.com>,
	"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 3/6 v2] KVM: PPC: Book3E: Increase FPU laziness
Date: Fri, 04 Jul 2014 09:46:18 +0200	[thread overview]
Message-ID: <53B65BCA.6040200@suse.de> (raw)
In-Reply-To: <bf24ca20f84f449a8781107acaec33d1@BY2PR03MB508.namprd03.prod.outlook.com>


On 03.07.14 17:46, mihai.caraman@freescale.com wrote:
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf@suse.de]
>> Sent: Thursday, July 03, 2014 3:29 PM
>> To: Caraman Mihai Claudiu-B02008; kvm-ppc@vger.kernel.org
>> Cc: kvm@vger.kernel.org; linuxppc-dev@lists.ozlabs.org
>> Subject: Re: [PATCH 3/6 v2] KVM: PPC: Book3E: Increase FPU laziness
>>
>>
>> On 30.06.14 17:34, Mihai Caraman wrote:
>>> Increase FPU laziness by calling kvmppc_load_guest_fp() just before
>>> returning to guest instead of each sched in. Without this improvement
>>> an interrupt may also claim floting point corrupting guest state.
>> How do you handle context switching with this patch applied? During most
>> of the guest's lifetime we never exit kvmppc_vcpu_run(), so when the
>> guest gets switched out all FPU state gets lost?
> No, we had this discussion in ver 1. The FP/VMX/VSX is implemented lazy in
> the kernel i.e. the unit state is not saved/restored until another thread
> that once claimed the unit is sched in.
>
> Since FP/VMX/VSX can be activated by the guest independent of the host, the
> vcpu thread is always using the unit (even if it did not claimed it once).
>
> Now, this patch optimize the sched in flow. Instead of checking on each vcpu
> sched in if the kernel unloaded unit's guest state for another competing host
> process we do this when we enter the guest.

But we only do it when we enter the guest from QEMU, not when we enter 
the guest after a context switch on cond_resched(), no?


Alex

  reply	other threads:[~2014-07-04  7:46 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30 15:34 [PATCH 0/6 v2] KVM: PPC: Book3e: AltiVec support Mihai Caraman
2014-06-30 15:34 ` Mihai Caraman
2014-06-30 15:34 ` Mihai Caraman
2014-06-30 15:34 ` [PATCH 1/6 v2] KVM: PPC: Book3E: Use common defines for SPE/FP/AltiVec int numbers Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-07-03 12:21   ` Alexander Graf
2014-07-03 12:21     ` Alexander Graf
2014-07-03 12:21     ` Alexander Graf
2014-07-03 15:25     ` mihai.caraman
2014-07-03 15:25       ` mihai.caraman
2014-07-03 15:25       ` mihai.caraman
2014-07-03 15:30       ` Alexander Graf
2014-07-03 15:30         ` Alexander Graf
2014-07-03 15:30         ` Alexander Graf
2014-07-03 15:53         ` mihai.caraman
2014-07-03 15:53           ` mihai.caraman
2014-07-03 15:53           ` mihai.caraman
2014-07-03 22:15       ` Scott Wood
2014-07-03 22:15         ` Scott Wood
2014-07-03 22:15         ` Scott Wood
2014-07-03 22:31         ` Scott Wood
2014-07-03 22:31           ` Scott Wood
2014-07-03 22:31           ` Scott Wood
2014-07-03 22:35           ` Alexander Graf
2014-07-03 22:35             ` Alexander Graf
2014-07-03 22:35             ` Alexander Graf
2014-07-03 23:00             ` Scott Wood
2014-07-03 23:00               ` Scott Wood
2014-07-03 23:00               ` Scott Wood
2014-07-03 23:02               ` Alexander Graf
2014-07-03 23:02                 ` Alexander Graf
2014-07-03 23:02                 ` Alexander Graf
2014-07-03 22:31         ` Alexander Graf
2014-07-03 22:31           ` Alexander Graf
2014-07-03 22:31           ` Alexander Graf
2014-07-21 13:23     ` mihai.caraman
2014-07-21 13:23       ` mihai.caraman
2014-07-24  9:16       ` mihai.caraman
2014-07-24  9:16         ` mihai.caraman
2014-07-26  0:10         ` Scott Wood
2014-07-26  0:10           ` Scott Wood
2014-07-26  0:10           ` Scott Wood
2014-07-28  8:54           ` mihai.caraman
2014-07-28  8:54             ` mihai.caraman
2014-07-28  8:54             ` mihai.caraman
2014-07-28 22:42             ` Scott Wood
2014-07-28 22:42               ` Scott Wood
2014-07-28 22:42               ` Scott Wood
2014-06-30 15:34 ` [PATCH 2/6 v2] KVM: PPC: Book3E: Refactor SPE/FP exit handling Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-07-03 12:21   ` Alexander Graf
2014-07-03 12:21     ` Alexander Graf
2014-07-03 12:21     ` Alexander Graf
2014-06-30 15:34 ` [PATCH 3/6 v2] KVM: PPC: Book3E: Increase FPU laziness Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-07-03 12:28   ` Alexander Graf
2014-07-03 12:28     ` Alexander Graf
2014-07-03 12:28     ` Alexander Graf
2014-07-03 15:46     ` mihai.caraman
2014-07-03 15:46       ` mihai.caraman
2014-07-03 15:46       ` mihai.caraman
2014-07-04  7:46       ` Alexander Graf [this message]
2014-07-04  7:46         ` Alexander Graf
2014-07-04  7:46         ` Alexander Graf
2014-07-04  7:52         ` Alexander Graf
2014-07-04  7:52           ` Alexander Graf
2014-07-04  7:52           ` Alexander Graf
2014-06-30 15:34 ` [PATCH 4/6 v2] KVM: PPC: Book3E: Add AltiVec support Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-07-03 12:32   ` Alexander Graf
2014-07-03 12:32     ` Alexander Graf
2014-07-03 12:32     ` Alexander Graf
2014-07-03 15:58     ` mihai.caraman
2014-07-03 15:58       ` mihai.caraman
2014-07-03 15:58       ` mihai.caraman
2014-07-03 23:07   ` Scott Wood
2014-07-03 23:07     ` Scott Wood
2014-07-03 23:07     ` Scott Wood
2014-06-30 15:34 ` [PATCH 5/6 v2] KVM: PPC: Book3E: Add ONE_REG " Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-07-03 12:33   ` Alexander Graf
2014-07-03 12:33     ` Alexander Graf
2014-07-03 12:33     ` Alexander Graf
2014-07-03 16:11     ` mihai.caraman
2014-07-03 16:11       ` mihai.caraman
2014-07-03 16:11       ` mihai.caraman
2014-07-04  7:54       ` Alexander Graf
2014-07-04  7:54         ` Alexander Graf
2014-07-04  7:54         ` Alexander Graf
2014-06-30 15:34 ` [PATCH 6/6 v2] KVM: PPC: Book3E: Enable e6500 core Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman
2014-06-30 15:34   ` Mihai Caraman

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=53B65BCA.6040200@suse.de \
    --to=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mihai.caraman@freescale.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 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.