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, <rcojoc...@bitdefender.com> 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.

>  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.

~Andrew

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

Reply via email to