From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Feiner <pfeiner@google.com>, Jim Mattson <jmattson@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
kvm list <kvm@vger.kernel.org>,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH] KVM: MMU: speedup update_permission_bitmask
Date: Tue, 12 Sep 2017 21:55:56 +0200 [thread overview]
Message-ID: <a6c48912-494b-793e-d741-db2d634588d5@redhat.com> (raw)
In-Reply-To: <CAM3pwhFj2SudxAP70EtQUO=98p3E6j58GuPVPKu3noYKmRDaXg@mail.gmail.com>
On 12/09/2017 18:48, Peter Feiner wrote:
>>>
>>> Because update_permission_bitmask is actually the top item in the profile
>>> for nested vmexits, this speeds up an L2->L1 vmexit by about ten thousand
>>> clock cycles, or up to 30%:
>
> This is a great improvement! Why not take it a step further and
> compute the whole table once at module init time and be done with it?
> There are only 5 extra input bits (nx, ept, smep, smap, wp),
4 actually, nx could be ignored (because unlike WP, the bit is reserved
when nx is disabled). It is only handled for clarity.
> so the
> whole table would only take up (1 << 5) * 16 = 512 bytes. Moreover, if
> you had 32 VMs on the host, you'd actually save memory!
Indeed; my thought was to write a script or something to generate the
tables at compile time, but doing it at module init time would be clever
and easier.
That said, the generated code for the function, right now, is pretty
good. If it saved 1000 clock cycles per nested vmexit it would be very
convincing, but if it were 50 or even 100 a bit less so.
Paolo
next prev parent reply other threads:[~2017-09-12 19:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-24 15:56 Paolo Bonzini
2017-08-28 19:42 ` Jim Mattson
2017-09-12 16:48 ` Peter Feiner
2017-09-12 19:55 ` Paolo Bonzini [this message]
2017-09-12 20:06 ` Peter Feiner
2017-08-29 16:46 ` David Hildenbrand
2017-09-12 8:20 ` Paolo Bonzini
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=a6c48912-494b-793e-d741-db2d634588d5@redhat.com \
--to=pbonzini@redhat.com \
--cc=david@redhat.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pfeiner@google.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
all inboxes | Powered by JetHome®