lkml.org 
[lkml]   [2023]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [Patch v2 3/5] KVM: x86/mmu: Optimize SPTE change for aging gfn range
    On Fri, Feb 03, 2023 at 11:28:20AM -0800, Vipin Sharma wrote:
    > No need to check all of the conditions in __handle_changed_spte(). Aging
    > a gfn range implies resetting access bit or marking spte for access
    > tracking.
    >
    > Use atomic operation to only reset those bits. This avoids checking many
    > conditions in __handle_changed_spte() API. Also, clean up code by
    > removing dead code and API parameters.

    Suggest splitting out the dead code cleanup to make it easier to review.

    >
    > Signed-off-by: Vipin Sharma <vipinsh@google.com>
    > ---
    > arch/x86/kvm/mmu/tdp_mmu.c | 68 ++++++++++++++------------------------
    > 1 file changed, 25 insertions(+), 43 deletions(-)
    >
    > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
    > index 83f15052aa6c..18630a06fa1f 100644
    > --- a/arch/x86/kvm/mmu/tdp_mmu.c
    > +++ b/arch/x86/kvm/mmu/tdp_mmu.c
    > @@ -1251,32 +1228,37 @@ static __always_inline bool kvm_tdp_mmu_handle_gfn(struct kvm *kvm,
    > /*
    > * Mark the SPTEs range of GFNs [start, end) unaccessed and return non-zero
    > * if any of the GFNs in the range have been accessed.
    > + *
    > + * No need to mark corresponding PFN as accessed as this call is coming from
    > + * MMU notifier for that page via HVA.

    Thanks for adding this comment.

    Can you just extend it to mention that the information is passed via the
    return value? e.g.

    * No need to mark corresponding PFN as accessed as this call is coming
    * from the clear_young() or clear_flush_young() notifier, which uses
    * the return value to determine if the page has been accessed.

    \
     
     \ /
      Last update: 2023-03-27 00:11    [W:5.322 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site