lkml.org 
[lkml]   [2021]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/6] KVM: mmu: also return page from gfn_to_pfn
    Excerpts from David Stevens's message of June 24, 2021 1:57 pm:
    > From: David Stevens <stevensd@chromium.org>
    >
    > Return a struct kvm_pfn_page containing both a pfn and an optional
    > struct page from the gfn_to_pfn family of functions. This differentiates
    > the gup and follow_fault_pfn cases, which allows callers that only need
    > a pfn to avoid touching the page struct in the latter case. For callers
    > that need a struct page, introduce a helper function that unwraps a
    > struct kvm_pfn_page into a struct page. This helper makes the call to
    > kvm_get_pfn which had previously been in hva_to_pfn_remapped.
    >
    > For now, wrap all calls to gfn_to_pfn functions in the new helper
    > function. Callers which don't need the page struct will be updated in
    > follow-up patches.

    Hmm. You mean callers that do need the page will be updated? Normally
    if there will be leftover users that don't need the struct page then
    you would go the other way and keep the old call the same, and add a new
    one (gfn_to_pfn_page) just for those that need it.

    Most kernel code I look at passes back multiple values by updating
    pointers to struct or variables rather than returning a struct, I
    suppose that's not really a big deal and a matter of taste.

    Thanks,
    Nick

    \
     
     \ /
      Last update: 2021-06-24 10:53    [W:2.349 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site