[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/8] x86/paging: fold most HAP and shadow final teardown
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Thu, 5 Jan 2023 17:56:43 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GdZtvZrOsg8Sj7hTmBkOQFY27J9pWH8YOATNQ+FZNv4=; b=ddVpCJi7LzHy8Cv1Xp+iHATHYa32oDZHkm1A7HQjaHgBkiYZn1A2CUmLNZrCBLHzp548UQ3FqcVtQ8vS8eZ99ntJUND2OxhbDmxjQ4RFyAdWYQSt1P3OagazZBQK500VGxl+/kH+R7nA3iguJ188HcQnSNIn188eVovqmWkzqIq9PDZMK6di33DT9EMllojfTAJqQ03MSSM1NjsfWW1GwdN4WfNg5rVQSTbDTuotcLwndUwYlzOJxjTLcuyBxgrWY+obrQTti+damMNyukSj7t8FPFALmlBLGBEZls5LjVeYyv0etkUo3ah7rrRW229OmOfiNMoDeNFs9Nz+VjDr/w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DLCnfSJAAmZy1e6lyGUu6OIAHSwZboa9yqGaPYb7a7r44D29NjAsHZd2v8gp0sUAuP0KD07cOHT8JEVKZfxDd75RhGx+XJivhOFcvFTPXCIsGGm/9xj6QvVt3dXE618pAiWkmr9TAyCwHqBHH10V1D0Z1Wiw92+9rAmYE+KzsfOGqwTLwC6DwuGplowYM54nfNoI91EXt0LYlc72uNZLavplGLaFygHtpE040pYY7shhUJuOqtvxFHMOXt+No/55L8ihaW/YX1r3xSDp8NeKnWnWDfq2OvA6mvcxOn/xoaD3auV0k7umlcZWTgzG6cGUxNDs61y7qCpiuBBpWUErPw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxx>, "Tim (Xen.org)" <tim@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Thu, 05 Jan 2023 17:57:02 +0000
- Ironport-data: A9a23:LgcBa6n8nTAbdhTZeSWVHgLo5gy3J0RdPkR7XQ2eYbSJt1+Wr1Gzt xIdDGDTOfbfZ2ekftojaN6w80NSupOGnNEwHFRrrXwzESMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icf3grHmeIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE4p7aqaVA8w5ARkPqgS5AKGzBH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 bsbGmAcYQCuveiVx7elYdFigcgCHeC+aevzulk4pd3YJdAPZMmZBoD1v5pf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVklI3jOmF3Nn9I7RmQe18mEqCq 32A1GP+GhwAb/SUyCaf82LqjejK9c/+cNNKT+Xlq6U76LGV7lE8Il5KdgOkm/6ajnKmC+hAe nYT2zV7+MDe82TuFLERRSaQonSJoxodUNp4CPAh5UeGza+8yxmdLngJSHhGctNOnNM3QBQ62 1nPmMnmbRR/vbvQRX+D+7O8qTKpJTNTPWIEfTUDTwYO/5/kuo5bs/7UZtNqEarwi8KvHzj1m mqOtHJm2+RVitMX3aKm+1yBmyirupXCUg8y4EPQQ36h6QR6IoWiYuRE9GTm0BqJF67BJnHpg ZTOs5P2ADwmZX1VqBGwfQ==
- Ironport-hdrordr: A9a23:wznkk6152PDbSQyhwfmTkAqjBHYkLtp133Aq2lEZdPU0SKGlfq GV7ZEmPHrP4gr5N0tOpTntAse9qBDnhPxICOsqXYtKNTOO0AeVxelZhrcKqAeQeBEWmNQ96U 9hGZIOcuEZDzJB/LvHCN/TKadd/DGFmprY+ts31x1WPGVXgzkL1XYANu6ceHcGIzVuNN4CO7 e3wNFInDakcWR/VLXBOpFUN9KzweEijfjdEGc7OyI=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHZFT+yfO+11AII6U6krdJn3spgiq54lXqAgAD0VYCAFqnVgA==
- Thread-topic: [PATCH 2/8] x86/paging: fold most HAP and shadow final teardown
On 22/12/2022 7:51 am, Jan Beulich wrote:
> On 21.12.2022 18:16, Andrew Cooper wrote:
>> On 21/12/2022 1:25 pm, Jan Beulich wrote:
>>> + d, d->arch.paging.total_pages,
>>> + d->arch.paging.free_pages, d->arch.paging.p2m_pages);
>>> +
>>> + if ( hap )
>>> hap_final_teardown(d);
>>> +
>>> + /*
>>> + * Double-check that the domain didn't have any paging memory.
>>> + * It is possible for a domain that never got domain_kill()ed
>>> + * to get here with its paging allocation intact.
>> I know you're mostly just moving this comment, but it's misleading.
>>
>> This path is used for the domain_create() error path, and there will be
>> a nonzero allocation for HVM guests.
>>
>> I think we do want to rework this eventually - we will simplify things
>> massively by splitting the things can can only happen for a domain which
>> has run into relinquish_resources.
>>
>> At a minimum, I'd suggest dropping the first sentence. "double check"
>> implies it's an extraordinary case, which isn't warranted here IMO.
> Instead of dropping I think I would prefer to make it start "Make sure
> ...".
That's still awkward grammar, and a bit misleading IMO. How about
rewriting it entirely?
/* Remove remaining paging memory. This can be nonzero on certain error
paths. */
>
>>> + */
>>> + if ( d->arch.paging.total_pages )
>>> + {
>>> + if ( hap )
>>> + hap_teardown(d, NULL);
>>> + else
>>> + shadow_teardown(d, NULL);
>>> + }
>>> +
>>> + /* It is now safe to pull down the p2m map. */
>>> + p2m_teardown(p2m_get_hostp2m(d), true, NULL);
>>> +
>>> + /* Free any paging memory that the p2m teardown released. */
>> I don't think this isn't true any more. 410 also made HAP/shadow free
>> pages fully for a dying domain, so p2m_teardown() at this point won't
>> add to the free memory pool.
>>
>> I think the subsequent *_set_allocation() can be dropped, and the
>> assertions left.
> I agree, but if anything this will want to be a separate patch then.
I'd be happy putting that in this patch, but if you don't want to
combine it, then it should be a prerequisite IMO, so we don't have a
"clean up $X" patch which is shuffling buggy code around.
~Andrew
|