All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Christoffer Dall <christoffer.dall@linaro.org>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Marc Zyngier <marc.zyngier@arm.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v2] arm/arm64: KVM: Properly account for guest CPU time
Date: Mon, 01 Jun 2015 15:37:32 +0200	[thread overview]
Message-ID: <556C601C.4000501@de.ibm.com> (raw)
In-Reply-To: <20150601133558.GA20286@cbox>

Am 01.06.2015 um 15:35 schrieb Christoffer Dall:
> On Mon, Jun 01, 2015 at 11:21:19AM +0200, Christian Borntraeger wrote:
>> Am 01.06.2015 um 11:08 schrieb Christoffer Dall:
>>
>>>>>
>>>>> Second, looking at the ppc and mips code, they seem to also call
>>>>> kvm_guest_exit() before enabling interrupts, so I don't understand how
>>>>> guest CPU time accounting works on those architectures.
>>>>
>>>> Not an expert here, but I assume mips has the same logic as arm so if your
>>>> patch is right for arm its probably also for mips.
>>>>
>>>> powerpc looks similar to what s390 does (not using the tick, instead it uses
>>>> a hw-timer) so this should be fine.
>>>>
>>> I wonder if we can simply enable HAVE_VIRT_CPU_ACCOUNTING_GEN and get
>>> this for free which would avoid the need for this patch?
>>
>> Asssuming that HAVE_VIRT_CPU_ACCOUNTING_GEN behaves similar to 
>> HAVE_VIRT_CPU_ACCOUNTING on s390/power in respect to not rely on ticks
>> - yes it might work out. Can you give it a try?
>>
> Adding HAVE_VIRT_CPU_ACCOUNTING_GEN to arch/arm64/Kconfig works, but has
> no effect unless you also enable CONFIG_NO_HZ_FULL, so that hardly feels
> like a fix since it would be a shame to force users to use this config
> option to report CPU usage correctly.
> 
> I'm not entirely sure what the history and meaning behind these configs
> are, so maybe there is an entirely different rework needed here.  It
> seems logical that you could simply sample the counter at entry/exit of
> the guest, but if there is nowhere to store this data without
> NO_HZ_FULL+VIRT_CPU_ACCOUNTING_GEN then I guess that would be why?

Given Paolos response that irq_disable/enable is faster than save/restore
at least on x86 your v2 patch might actually be the right thing to do.

Christian


WARNING: multiple messages have this Message-ID (diff)
From: borntraeger@de.ibm.com (Christian Borntraeger)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] arm/arm64: KVM: Properly account for guest CPU time
Date: Mon, 01 Jun 2015 15:37:32 +0200	[thread overview]
Message-ID: <556C601C.4000501@de.ibm.com> (raw)
In-Reply-To: <20150601133558.GA20286@cbox>

Am 01.06.2015 um 15:35 schrieb Christoffer Dall:
> On Mon, Jun 01, 2015 at 11:21:19AM +0200, Christian Borntraeger wrote:
>> Am 01.06.2015 um 11:08 schrieb Christoffer Dall:
>>
>>>>>
>>>>> Second, looking at the ppc and mips code, they seem to also call
>>>>> kvm_guest_exit() before enabling interrupts, so I don't understand how
>>>>> guest CPU time accounting works on those architectures.
>>>>
>>>> Not an expert here, but I assume mips has the same logic as arm so if your
>>>> patch is right for arm its probably also for mips.
>>>>
>>>> powerpc looks similar to what s390 does (not using the tick, instead it uses
>>>> a hw-timer) so this should be fine.
>>>>
>>> I wonder if we can simply enable HAVE_VIRT_CPU_ACCOUNTING_GEN and get
>>> this for free which would avoid the need for this patch?
>>
>> Asssuming that HAVE_VIRT_CPU_ACCOUNTING_GEN behaves similar to 
>> HAVE_VIRT_CPU_ACCOUNTING on s390/power in respect to not rely on ticks
>> - yes it might work out. Can you give it a try?
>>
> Adding HAVE_VIRT_CPU_ACCOUNTING_GEN to arch/arm64/Kconfig works, but has
> no effect unless you also enable CONFIG_NO_HZ_FULL, so that hardly feels
> like a fix since it would be a shame to force users to use this config
> option to report CPU usage correctly.
> 
> I'm not entirely sure what the history and meaning behind these configs
> are, so maybe there is an entirely different rework needed here.  It
> seems logical that you could simply sample the counter at entry/exit of
> the guest, but if there is nowhere to store this data without
> NO_HZ_FULL+VIRT_CPU_ACCOUNTING_GEN then I guess that would be why?

Given Paolos response that irq_disable/enable is faster than save/restore
at least on x86 your v2 patch might actually be the right thing to do.

Christian

  reply	other threads:[~2015-06-01 13:37 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 18:49 [PATCH v2] arm/arm64: KVM: Properly account for guest CPU time Christoffer Dall
2015-05-28 18:49 ` Christoffer Dall
2015-05-29 22:34 ` Mario Smarduch
2015-05-29 22:34   ` Mario Smarduch
2015-05-31  6:59   ` Christoffer Dall
2015-05-31  6:59     ` Christoffer Dall
2015-06-01 15:48     ` Mario Smarduch
2015-06-01 15:48       ` Mario Smarduch
2015-06-02  9:27       ` Christoffer Dall
2015-06-02  9:27         ` Christoffer Dall
2015-06-02 11:55         ` Christoffer Dall
2015-06-02 11:55           ` Christoffer Dall
2015-06-05 12:24         ` Mario Smarduch
2015-06-05 12:24           ` Mario Smarduch
2015-06-08 11:35           ` Christoffer Dall
2015-06-08 11:35             ` Christoffer Dall
2015-06-09 23:04             ` Mario Smarduch
2015-06-09 23:04               ` Mario Smarduch
2015-06-01  7:47 ` Christian Borntraeger
2015-06-01  7:47   ` Christian Borntraeger
2015-06-01  9:08   ` Christoffer Dall
2015-06-01  9:08     ` Christoffer Dall
2015-06-01  9:21     ` Christian Borntraeger
2015-06-01  9:21       ` Christian Borntraeger
2015-06-01 13:35       ` Christoffer Dall
2015-06-01 13:35         ` Christoffer Dall
2015-06-01 13:37         ` Christian Borntraeger [this message]
2015-06-01 13:37           ` Christian Borntraeger
2015-06-02  9:28           ` Christoffer Dall
2015-06-02  9:28             ` Christoffer Dall
2015-06-01 11:34   ` Paolo Bonzini
2015-06-01 11:34     ` Paolo Bonzini
2015-06-01 11:42     ` Christian Borntraeger
2015-06-01 11:42       ` Christian Borntraeger
2015-06-01 11:52       ` Paolo Bonzini
2015-06-01 11:52         ` Paolo Bonzini
2015-06-08 17:50 ` Marc Zyngier
2015-06-08 17:50   ` Marc Zyngier
2015-06-09 14:43   ` Christoffer Dall
2015-06-09 14:43     ` Christoffer Dall
2015-06-09 16:39     ` Marc Zyngier
2015-06-09 16:39       ` Marc Zyngier

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=556C601C.4000501@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=pbonzini@redhat.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.