kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Scott Wood <scottwood@freescale.com>
Cc: Avi Kivity <avi@redhat.com>,
	kvm-ppc@vger.kernel.org, kvm list <kvm@vger.kernel.org>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH 04/14] KVM: PPC: e500: MMU API
Date: Thu, 10 Nov 2011 15:20:28 +0100	[thread overview]
Message-ID: <4EBBDDAC.1060505@suse.de> (raw)
In-Reply-To: <4EB01B4B.8090209@freescale.com>

On 11/01/2011 05:16 PM, Scott Wood wrote:
> On 11/01/2011 03:58 AM, Avi Kivity wrote:
>> On 10/31/2011 10:12 PM, Scott Wood wrote:
>>>>> +4.59 KVM_DIRTY_TLB
>>>>> +
>>>>> +Capability: KVM_CAP_SW_TLB
>>>>> +Architectures: ppc
>>>>> +Type: vcpu ioctl
>>>>> +Parameters: struct kvm_dirty_tlb (in)
>>>>> +Returns: 0 on success, -1 on error
>>>>> +
>>>>> +struct kvm_dirty_tlb {
>>>>> +	__u64 bitmap;
>>>>> +	__u32 num_dirty;
>>>>> +};
>>>> This is not 32/64 bit safe.  e500 is 32-bit only, yes?
>>> e5500 is 64-bit -- we don't support it with KVM yet, but it's planned.
>>>
>>>> but what if someone wants to emulate an e500 on a ppc64?  maybe it's better to add
>>>> padding here.
>>> What is unsafe about it?  Are you picturing TLBs with more than 4
>>> billion entries?
>> sizeof(struct kvm_tlb_dirty) == 12 for 32-bit userspace, but ==  16 for
>> 64-bit userspace and the kernel.  ABI structures must have the same
>> alignment and size for 32/64 bit userspace, or they need compat handling.
> The size is 16 on 32-bit ppc -- the alignment of __u64 forces this.  It
> looks like this is different in the 32x86 ABI.
>
> We can pad explicitly if you prefer.

I would prefer if we keep this stable :). There's no good reason to pad 
it - ppc64 creates the same struct definition.

>>> There shouldn't be any alignment issues.
>>>
>>>> Another alternative is to drop the num_dirty field (and let the kernel
>>>> compute it instead, shouldn't take long?), and have the third argument
>>>> to ioctl() reference the bitmap directly.
>>> The idea was to make it possible for the kernel to apply a threshold
>>> above which it would be better to ignore the bitmap entirely and flush
>>> everything:
>>>
>>> http://www.spinics.net/lists/kvm/msg50079.html
>>>
>>> Currently we always just flush everything, and QEMU always says
>>> everything is dirty when it makes a change, but the API is there if needed.
>> Right, but you don't need num_dirty for it.  There are typically only a
>> few dozen entries, yes?  It should take a trivial amount of time to
>> calculate its weight.
> There are over 500 entries currently, and QEMU could make it much larger
> if it wants to decrease guest-visible faults on certain workloads.
>
> It's not the most important feature, indeed we currently ignore the
> bitmap entirely.  But it could be useful depending on how the API is
> used in the future, and I don't think we gain much by dropping it at
> this point.  Alex, any thoughts?

The kernel can always opt in to ignore the field if it chooses to, so I 
don't see the point in dropping it. There shouldn't be an alignment 
problem in the first place :).


Alex

  parent reply	other threads:[~2011-11-10 14:20 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31  7:53 [PULL 00/14] ppc patch queue 2011-10-31 Alexander Graf
2011-10-31  7:53 ` [PATCH 01/14] KVM: PPC: e500: don't translate gfn to pfn with preemption disabled Alexander Graf
2011-10-31 12:50   ` Avi Kivity
2011-10-31 18:52     ` Scott Wood
2011-11-01  9:00       ` Avi Kivity
2011-10-31  7:53 ` [PATCH 02/14] KVM: PPC: e500: Eliminate preempt_disable in local_sid_destroy_all Alexander Graf
2011-10-31  7:53 ` [PATCH 03/14] KVM: PPC: e500: clear up confusion between host and guest entries Alexander Graf
2011-10-31  7:53 ` [PATCH 04/14] KVM: PPC: e500: MMU API Alexander Graf
2011-10-31 13:24   ` Avi Kivity
2011-10-31 20:12     ` Scott Wood
2011-11-01  8:58       ` Avi Kivity
2011-11-01  9:55         ` Avi Kivity
2011-11-01 16:16         ` Scott Wood
2011-11-02 10:33           ` Avi Kivity
2011-11-10 14:20           ` Alexander Graf [this message]
2011-11-10 14:16             ` Avi Kivity
2011-10-31  7:53 ` [PATCH 05/14] KVM: PPC: e500: tlbsx: fix tlb0 esel Alexander Graf
2011-10-31  7:53 ` [PATCH 06/14] KVM: PPC: e500: Don't hardcode PIR=0 Alexander Graf
2011-10-31 13:27   ` Avi Kivity
2011-10-31  7:53 ` [PATCH 07/14] KVM: PPC: Fix build failure with HV KVM and CBE Alexander Graf
2011-10-31  7:53 ` [PATCH 08/14] Revert "KVM: PPC: Add support for explicit HIOR setting" Alexander Graf
2011-10-31 13:30   ` Avi Kivity
2011-10-31 23:49     ` Alexander Graf
2011-10-31  7:53 ` [PATCH 09/14] KVM: PPC: Add generic single register ioctls Alexander Graf
2011-10-31 13:36   ` Avi Kivity
2011-10-31 17:26     ` Jan Kiszka
2011-11-10 14:22     ` Alexander Graf
2011-11-10 16:05   ` Marcelo Tosatti
2011-11-10 16:49     ` Alexander Graf
2011-11-10 17:35       ` Marcelo Tosatti
2011-11-15 23:45         ` Alexander Graf
2011-11-23 12:47           ` Marcelo Tosatti
2011-12-19 12:58             ` Alexander Graf
2011-12-19 17:29               ` Marcelo Tosatti
2011-10-31  7:53 ` [PATCH 10/14] KVM: PPC: Add support for explicit HIOR setting Alexander Graf
2011-10-31  7:53 ` [PATCH 11/14] KVM: PPC: Whitespace fix for kvm.h Alexander Graf
2011-10-31  7:53 ` [PATCH 12/14] KVM: Fix whitespace in kvm_para.h Alexander Graf
2011-10-31  7:53 ` [PATCH 13/14] KVM: PPC: E500: Support hugetlbfs Alexander Graf
2011-10-31 13:38   ` Avi Kivity
2011-11-10 14:24     ` Alexander Graf
2011-10-31  7:53 ` [PATCH 14/14] PPC: Fix race in mtmsr paravirt implementation Alexander Graf

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=4EBBDDAC.1060505@suse.de \
    --to=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=scottwood@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 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).