[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V3 2/3] x86/mm: allocate logdirty_ranges for altp2ms



On 10/30/18 6:54 PM, Andrew Cooper wrote:
> On 30/10/18 16:51, Razvan Cojocaru wrote:
>> On 10/30/18 6:28 PM, Andrew Cooper wrote:
>>> On 30/10/18 16:22, Jan Beulich wrote:
>>>>>>> On 29.10.18 at 13:40, <rcojocaru@xxxxxxxxxxxxxxx> wrote:
>>>>> This patch is a pre-requisite for the one fixing VGA logdirty
>>>>> freezes when using altp2m. It only concerns itself with the
>>>>> ranges allocation / deallocation / initialization part.
>>>> But while looking (briefly only for now) over patch 3 I couldn't
>>>> see any sync-ing of the log-dirty ranges there either. Doesn't
>>>> this need doing either there or here, if you go the copy route?
>>>>
>>>>> @@ -2271,6 +2297,7 @@ void p2m_flush_altp2m(struct domain *d)
>>>>>      {
>>>>>          p2m_flush_table(d->arch.altp2m_p2m[i]);
>>>>>          /* Uninit and reinit ept to force TLB shootdown */
>>>>> +        p2m_free_logdirty(d->arch.altp2m_p2m[i]);
>>>>>          ept_p2m_uninit(d->arch.altp2m_p2m[i]);
>>>>>          ept_p2m_init(d->arch.altp2m_p2m[i]);
>>>>>          d->arch.altp2m_eptp[i] = mfn_x(INVALID_MFN);
>>>>> @@ -2341,6 +2385,7 @@ int p2m_destroy_altp2m_by_id(struct domain *d, 
>>>>> unsigned int idx)
>>>>>          {
>>>>>              p2m_flush_table(d->arch.altp2m_p2m[idx]);
>>>>>              /* Uninit and reinit ept to force TLB shootdown */
>>>>> +            p2m_free_logdirty(d->arch.altp2m_p2m[idx]);
>>>>>              ept_p2m_uninit(d->arch.altp2m_p2m[idx]);
>>>>>              ept_p2m_init(d->arch.altp2m_p2m[idx]);
>>>>>              d->arch.altp2m_eptp[idx] = mfn_x(INVALID_MFN);
>>>>> @@ -2471,6 +2516,7 @@ static void p2m_reset_altp2m(struct p2m_domain *p2m)
>>>>>  {
>>>>>      p2m_flush_table(p2m);
>>>>>      /* Uninit and reinit ept to force TLB shootdown */
>>>>> +    p2m_free_logdirty(p2m);
>>>>>      ept_p2m_uninit(p2m);
>>>>>      ept_p2m_init(p2m);
>>>>>      p2m->min_remapped_gfn = gfn_x(INVALID_GFN);
>>>> For one these look all pretty similar, so I wonder why there's
>>>> no helper function. But that's not something you need to change.
>>>> Yet why are you freeing the log-dirty ranges here? These aren't
>>>> full cleanup paths afaict.
>>> Rangesets get added to the domain rangeset list, and we clean them all
>>> up rangeset_domain_destroy()
>>>
>>> TBH, I'm not sure why we do it like this, and I'm not 100% convinced it
>>> is a clever deallocation scheme.
>> To eliminate any confusion: are you saying that rangesets should only be
>> allocated, and never explicitly deallocated (since
>> rangeset_domain_destroy() takes care of that)?
> 
> No, because that becomes (effectively) a memory leak each time we create
> a new view.

Not really, since the patch checks if ( p2m->logdirty_ranges ) in the
new p2m_init_logdirty() function, and does not allocate in that case.
However, that might be wrong with regard to rangeset_merge() if
de-allocations don't happen when they do now.

>>  If that is correct, then
>> there's a problem in the code now with the way we're handling the
>> logdirty_ranges for the hostp2m (where we clean it up in p2m_free_one()
>> and p2m_teardown_hostp2m()).
> 
> To answer Jan's question, the reason you are destroying/recreating the
> rangeset is because we've got no clear API.  Perhaps fixing that is the
> better course of action.

Fair enough, but if possible it would be great if we could get this
working upstream as soon as possible - both Tamas and us think of this
as a high-priority problem, since it's basically a dealbreaker for using
altp2m.

I'm happy to follow Jan's suggestion of keeping the altp2m rangeset
around until p2m_teardown_altp2m() and simply empty it before merging,
and we can discuss refactoring the API after the fix.

Is this acceptable to everyone? If so, is p2m_teardown_altp2m() the
ideal place to clean up?


Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.