[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH 2/2] VT-d: use clear_page() in alloc_pgtable_maddr()
- To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
- Date: Fri, 17 Jul 2020 02:49:04 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.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-SenderADCheck; bh=Hk965ARW+ikK3M59/OeHcUZO/J+ppj2m64EOXbCKxxU=; b=C4yHCYdPh/QU37lgHd3+bDRU+ZwEfSZPCq48aSVWNiWasO0aDGf7jKOouNuioNKVJJZv/0my7mERR8fmUSYcbO7lzcttAy2EcdhMQa+kaubfNPVoD1N6EFHg9RJQ1DxEqSOGD9+9ZUKC8pbqx/0wsebhL95QfnRooJRS0MPED6yVdsXrQHQ/GrlMnbCMHHN57ZHNCx6Az4yJht5ZmwDBgy/RN17sirjwKsqY8jRjNEus218U2fzsdiGBwepE9IOw4/QDpZBiDelyRsgxkSNoA0dyQDSrp6VngFtP7zlf61/+bCIuyPZ9hrxu9x/8fFxS1dRtivty8A7n3tPR4thNTg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=It9fFztwMRTYiuKbRJ30dg7bNTHtDsI/TrcCPNW3MiIOSY5oqrSuPR7LartyLIp5q9scr8klFkqa63uvxhBbK585RWXkeljxuoTKZjyT6NIBBY96Tv8dFGovULXWAT4RcSif3p04/xlHjov0lXudSTNmqeZ5gMXT1sbK0O04FbBDoyMurrj/8csb6auyGkBgPHPFu6WGHe6B9NkFlcip1uMjdMs52s/Cidle5N4EBOuv7t/G1lVlNrSD1fi3+PAH4HLBzxe55As6zR8Epm1ZF1OTWjW4/h+pF92bGLPeNvBJYwwDrTlpo2+utQ6tJWSW0UnPY/jus06KvJ3d0WzTdw==
- Authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=intel.com;
- Delivery-date: Fri, 17 Jul 2020 02:49:14 +0000
- Dlp-product: dlpe-windows
- Dlp-reaction: no-action
- Dlp-version: 11.2.0.6
- Ironport-sdr: +v9j2Ftv0Gnvx+rSI4WTG+1sf5Wohq5SqryUN8XFzLwg8nMp92SJq2H9jbVVSLeo5EmKVoeO4n zIy5Jqsv5G1w==
- Ironport-sdr: 2OXcmu4kXRiDvZs7LK49cX/J3VfFh1LxC2zBc12YJSTerYHwnsI8IrvF2ZFmelWQxV1h/Gcfk1 VJGZpIxOvywQ==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHWWo9Tnv7rOln+0USMn9HVMeMuSqkLFGfQ
- Thread-topic: [PATCH 2/2] VT-d: use clear_page() in alloc_pgtable_maddr()
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Wednesday, July 15, 2020 6:04 PM
>
> For full pages this is (meant to be) more efficient. Also change the
> type and reduce the scope of the involved local variable.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
>
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -199,7 +199,6 @@ static void sync_cache(const void *addr,
> uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
> {
> struct page_info *pg, *cur_pg;
> - u64 *vaddr;
> unsigned int i;
>
> pg = alloc_domheap_pages(NULL, get_order_from_pages(npages),
> @@ -210,8 +209,9 @@ uint64_t alloc_pgtable_maddr(unsigned lo
> cur_pg = pg;
> for ( i = 0; i < npages; i++ )
> {
> - vaddr = __map_domain_page(cur_pg);
> - memset(vaddr, 0, PAGE_SIZE);
> + void *vaddr = __map_domain_page(cur_pg);
> +
> + clear_page(vaddr);
>
> if ( (iommu_ops.init ? &iommu_ops : &vtd_ops)->sync_cache )
> sync_cache(vaddr, PAGE_SIZE);
|