From: Vipin Sharma <vipinsh@google.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Ben Gardon <bgardon@google.com>,
David Matlack <dmatlack@google.com>,
pbonzini@redhat.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [Patch] KVM: x86/mmu: Make optimized __handle_changed_spte() for clear dirty log
Date: Mon, 30 Jan 2023 12:17:19 -0800 [thread overview]
Message-ID: <CAHVum0eReWgo_3yWxdtbyFGxeTnWUiEn9uVu0W5XX3KfHAgikw@mail.gmail.com> (raw)
In-Reply-To: <Y9gH3OHA4ftegU7X@google.com>
On Mon, Jan 30, 2023 at 10:09 AM Sean Christopherson <seanjc@google.com> wrote:
>
> On Sat, Jan 28, 2023, Vipin Sharma wrote:
> > On Wed, Jan 25, 2023 at 5:49 PM Sean Christopherson <seanjc@google.com> wrote:
> > > -static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,
> > > - u64 old_spte, u64 new_spte, int level,
> > > - bool shared)
> > > -{
> > > - __handle_changed_spte(kvm, as_id, gfn, old_spte, new_spte, level,
> > > - shared);
> > > handle_changed_spte_acc_track(old_spte, new_spte, level);
> > > - handle_changed_spte_dirty_log(kvm, as_id, gfn, old_spte,
> > > - new_spte, level);
> > > +
> > > + /* COMMENT GOES HERE. */
> >
> > Current "shared" callers are not making a page dirty. If a new
> > "shared" caller makes a page dirty then make sure
> > handle_changed_spte_dirty_log is called.
> >
> > How is this?
>
> I was hoping for a more definitive "rule" than "KVM doesn't currently do XYZ".
>
> > > + if (!shared)
> > > + handle_changed_spte_dirty_log(kvm, as_id, gfn, old_spte,
> > > + new_spte, level);
> > > }
> > >
What if implementation is changed a little more? I can think of two options:
Option 1:
Remove handle_changed_spte_dirty_log() and let the callers handle
mark_page_dirty_in_slot(). Similar to how fast page faults do this.
This will get rid of the "shared" variable and defining its rules for
the shared and nonshared flow.
Option 2:
Changing meaning of this variable from "shared" to something like
"handle_dirty_log"
Callers will know if they want dirty log to be handled or not.
I am preferring option 1.
next prev parent reply other threads:[~2023-01-30 20:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-25 21:38 [Patch] KVM: x86/mmu: Make optimized __handle_changed_spte() for clear dirty log Vipin Sharma
2023-01-25 22:00 ` David Matlack
2023-01-25 22:25 ` Ben Gardon
2023-01-26 0:40 ` Vipin Sharma
2023-01-26 1:49 ` Sean Christopherson
2023-01-28 17:20 ` Vipin Sharma
2023-01-30 18:09 ` Sean Christopherson
2023-01-30 20:17 ` Vipin Sharma [this message]
2023-01-30 22:49 ` Sean Christopherson
2023-01-30 22:12 ` David Matlack
2023-01-30 23:49 ` Sean Christopherson
2023-01-31 17:41 ` David Matlack
2023-01-31 18:01 ` Vipin Sharma
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=CAHVum0eReWgo_3yWxdtbyFGxeTnWUiEn9uVu0W5XX3KfHAgikw@mail.gmail.com \
--to=vipinsh@google.com \
--cc=bgardon@google.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@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;
as well as URLs for NNTP newsgroup(s).