David Woodhouse <dwmw2@xxxxxxxxxxxxx> writes: > On 14 December 2020 21:13:40 GMT, Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> wrote: >>What about different address space ids? >> >>gfn_to_memslot() now calls kvm_memslots() which gives memslots for >>address space id = 0 but what if we want something different? Note, >>different vCPUs can (in theory) be in different address spaces so we >>actually need 'vcpu' and not 'kvm' then. > > Sure, but then you want a different function; this one is called > 'kvm_map_gfn()' and it operates on kvm_memslots(). It *doesn't* > operate on the vcpu at all. > Actually, we already have kvm_vcpu_map() which uses kvm_vcpu_memslots() inside so no new function is needed. > Which is why it's so bizarre that its argument is a 'vcpu' which it > only ever uses to get vcpu->kvm from it. It should just take the kvm > pointer. Your change is correct but I'm not sure that it's entirely clear that kvm_map_gfn() implicitly uses 'as_id=0' and I don't even see a comment about the fact :-( -- Vitaly